From 334bbbd7a6a2d40f3386cec844313712201f8908 Mon Sep 17 00:00:00 2001 From: Geeves Date: Mon, 15 Mar 2021 17:54:14 +0200 Subject: [PATCH] Wielding Guns and Backpacks Fix (#11445) --- .../objects/items/weapons/storage/backpack.dm | 2 +- code/modules/projectiles/gun.dm | 20 +++++++++---------- .../changelogs/geeves-fixes_wielding_guns.yml | 6 ++++++ 3 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 html/changelogs/geeves-fixes_wielding_guns.yml diff --git a/code/game/objects/items/weapons/storage/backpack.dm b/code/game/objects/items/weapons/storage/backpack.dm index 51453d59cc7..10cb5f6a871 100644 --- a/code/game/objects/items/weapons/storage/backpack.dm +++ b/code/game/objects/items/weapons/storage/backpack.dm @@ -34,7 +34,7 @@ if (!..()) return 0 - if(species_restricted && istype(M,/mob/living/carbon/human)) + if(species_restricted && ishuman(M) && !(slot in list(slot_l_hand, slot_r_hand))) var/exclusive = null var/wearable = null var/mob/living/carbon/human/H = M diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 124c68daab2..203d2424824 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -701,12 +701,8 @@ to_chat(user, SPAN_NOTICE("You are no-longer stabilizing \the [name] with both hands.")) var/obj/item/offhand/O = user.get_inactive_hand() - if(O && istype(O)) + if(istype(O)) O.unwield() - else - O = user.get_active_hand() - return - else if(user.get_inactive_hand()) to_chat(user, SPAN_WARNING("You need your other hand to be empty.")) @@ -751,11 +747,10 @@ /obj/item/gun/mob_can_equip(M as mob, slot, disable_warning, ignore_blocked) //Cannot equip wielded items. - if(is_wieldable) - if(wielded) - if(!disable_warning) // unfortunately not sure there's a way to get this to only fire once when it's looped - to_chat(M, SPAN_WARNING("Lower \the [initial(name)] first!")) - return FALSE + if(wielded) + if(!disable_warning) // unfortunately not sure there's a way to get this to only fire once when it's looped + to_chat(M, SPAN_WARNING("Lower \the [initial(name)] first!")) + return FALSE return ..() @@ -814,7 +809,7 @@ if(user) var/obj/item/gun/O = user.get_inactive_hand() if(istype(O)) - to_chat(user, SPAN_NOTICE("You are no-longer stabilizing \the [name] with both hands.")) + to_chat(user, SPAN_NOTICE("You are no-longer stabilizing \the [O] with both hands.")) O.unwield() unwield() @@ -822,6 +817,9 @@ qdel(src) /obj/item/offhand/mob_can_equip(var/mob/M, slot, disable_warning = FALSE) + var/static/list/equippable_slots = list(slot_l_hand, slot_r_hand) + if(slot in equippable_slots) + return TRUE return FALSE /obj/item/gun/Destroy() diff --git a/html/changelogs/geeves-fixes_wielding_guns.yml b/html/changelogs/geeves-fixes_wielding_guns.yml new file mode 100644 index 00000000000..b33b43c87b4 --- /dev/null +++ b/html/changelogs/geeves-fixes_wielding_guns.yml @@ -0,0 +1,6 @@ +author: Geeves + +delete-after: True + +changes: + - bugfix: "Wielding guns and picking up species restricted backpacks now work again." \ No newline at end of file