Files
Divergent/mods/Weapon Parts Overhaul/gamedata/scripts/mag_support.script
T
Rage 376b4b9689 Added New Mods and Profiles Folders
This is a complete rebuild of the modpack, with all new mods and updates for 1.5.3 of Anomaly.
2025-01-14 05:07:53 -05:00

25 lines
740 B
Plaintext

-- mag support wrapper
local function supports_mags(wpn)
if wuut_mags then
local defaultMagSection = wuut_mags.WeaponGetDefaulMagSection(wpn)
local defaultMagSectionExists = system_ini():section_exist(defaultMagSection)
return defaultMagSectionExists
elseif magazines then
return magazine_binder.is_supported_weapon(wpn)
else return false
end
end
function eject_mag(wpn)
if not supports_mags(wpn) then
wpn:force_unload_magazine(true)
return
end
if wuut_mags and wuut_mags.MagazineInWeaponIsValid(wpn) then
return wuut_mags.weapon_eject_mag_functor(wpn)
elseif magazines then
magazines.eject_magazine(wpn)
else wpn:force_unload_magazine(true) end
end