diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm index aac1ba8ea87..48770a17848 100644 --- a/code/__DEFINES/is_helpers.dm +++ b/code/__DEFINES/is_helpers.dm @@ -219,6 +219,8 @@ #define iscell(I) (istype(I, /obj/item/cell)) +#define islascell(I) (istype(I, /obj/item/cell/lasgun)) + #define isfactorypart(I) (istype(I, /obj/item/factory_part)) #define isfactoryrefill(I) (istype(I, /obj/item/factory_refill)) diff --git a/code/game/objects/items/weapons/misc.dm b/code/game/objects/items/weapons/misc.dm index 581a5c77ab5..adad7760a52 100644 --- a/code/game/objects/items/weapons/misc.dm +++ b/code/game/objects/items/weapons/misc.dm @@ -124,7 +124,7 @@ /obj/item/weapon/powerfist/attackby(obj/item/I, mob/user, params) if(!istype(I, /obj/item/cell)) return ..() - if(!istype(I, /obj/item/cell/lasgun)) + if(!islascell(I)) to_chat(user, span_warning("The powerfist only accepts lasgun cells!")) return if(I.w_class >= WEIGHT_CLASS_BULKY) diff --git a/code/modules/projectiles/gun_helpers.dm b/code/modules/projectiles/gun_helpers.dm index 639483ed7e9..bfd81408f05 100644 --- a/code/modules/projectiles/gun_helpers.dm +++ b/code/modules/projectiles/gun_helpers.dm @@ -39,9 +39,21 @@ //tactical reloads /obj/item/weapon/gun/afterattack(atom/target, mob/user, has_proximity, click_parameters) - if(istype(target, /obj/item/ammo_magazine) || istype(target, /obj/item/cell)) + . = ..() + if(!has_proximity) + return + + if(isammomagazine(target)) + var/obj/item/ammo_magazine/mag_to_reload = target + if(mag_to_reload.flags_magazine & MAGAZINE_WORN) + return + tactical_reload(target, user) + + if(islascell(target)) + var/obj/item/cell/lasgun/cell_to_reload = target + if(CHECK_BITFIELD(get_flags_magazine_features(cell_to_reload), MAGAZINE_WORN)) + return tactical_reload(target, user) - return ..() /obj/item/weapon/gun/mob_can_equip(mob/user, slot, warning = TRUE, override_nodrop = FALSE, bitslot = FALSE) //Cannot equip wielded items or items burst firing.