Fixes guns being unwielded by mousing over the inventory UI (#22712)

Fixes #22036 

changes:
- bugfix: "Fixed guns getting unwielded when mousing over UI elements."
- bugfix: "Fixed mob_can_equip using M as mob, instead of mob/M. Also
adds its parameters to all its children."


https://github.com/user-attachments/assets/0f427609-3cfc-4c71-b817-44a8d2c6350d
This commit is contained in:
FenodyreeAv
2026-06-16 19:21:38 +00:00
committed by GitHub
parent 8255989fd9
commit ab65965c5c
12 changed files with 38 additions and 27 deletions
+2 -2
View File
@@ -119,7 +119,7 @@
return 0
//BS12: Species-restricted clothing check.
/obj/item/clothing/mob_can_equip(M as mob, slot, disable_warning = FALSE, bypass_blocked_check = FALSE)
/obj/item/clothing/mob_can_equip(M as mob, slot, disable_warning = FALSE, bypass_blocked_check = FALSE, is_overlay_check = FALSE)
//if we can't equip the item anyway, don't bother with species_restricted (cuts down on spam)
if (!..())
@@ -564,7 +564,7 @@
/obj/item/clothing/gloves/proc/Touch(var/atom/A, mob/user, var/proximity)
return 0 // return 1 to cancel attack_hand()
/obj/item/clothing/gloves/mob_can_equip(mob/user, slot, disable_warning = FALSE)
/obj/item/clothing/gloves/mob_can_equip(mob/user, slot, disable_warning = FALSE, bypass_blocked_check = FALSE, is_overlay_check = FALSE)
var/mob/living/carbon/human/H = user
if(slot && slot == slot_gloves)
if(istype(H.gloves, /obj/item/clothing/ring))
+1 -1
View File
@@ -79,7 +79,7 @@
else
return 0
/obj/item/clothing/shoes/magboots/mob_can_equip(mob/user, slot, disable_warning = FALSE)
/obj/item/clothing/shoes/magboots/mob_can_equip(mob/user, slot, disable_warning = FALSE, bypass_blocked_check = FALSE, is_overlay_check = FALSE)
if(slot != slot_shoes)
return ..()
+1 -1
View File
@@ -70,7 +70,7 @@
item_state = initial(item_state)
update_held_icon()
/obj/item/pickaxe/mob_can_equip(M, slot, disable_warning = FALSE)
/obj/item/pickaxe/mob_can_equip(M, slot, disable_warning = FALSE, bypass_blocked_check = FALSE, is_overlay_check = FALSE)
//Cannot equip wielded items.
if(wielded)
to_chat(M, SPAN_WARNING("Unwield the [initial(name)] first!"))
+1 -1
View File
@@ -40,7 +40,7 @@
if(item_to_equip.item_flags & ITEM_FLAG_NO_MOVE) //Cannot move ITEM_FLAG_NO_MOVE items from one inventory slot to another. Cannot do canremove here because then BSTs spawn naked.
return FALSE
if(!item_to_equip.mob_can_equip(src, slot, disable_warning, bypass_blocked_check))
if(!item_to_equip.mob_can_equip(src, slot, disable_warning, bypass_blocked_check, is_overlay_check = FALSE))
if(delete_on_fail)
qdel(item_to_equip)
else
+8 -7
View File
@@ -908,13 +908,14 @@ ABSTRACT_TYPE(/obj/item/gun)
#undef LYING_DOWN_FIRE_DELAY_AND_RECOIL_STAT_MULTIPLIER
#undef LYING_DOWN_ACCURACY_STAT_MULTIPLIER
/obj/item/gun/mob_can_equip(mob/user, slot, disable_warning, ignore_blocked)
/obj/item/gun/mob_can_equip(mob/user, slot, disable_warning, bypass_blocked_check = FALSE, is_overlay_check = FALSE)
//Cannot equip wielded items.
if(wielded)
unwield()
var/obj/item/offhand/O = user.get_inactive_hand()
if(istype(O))
O.unwield()
if(!is_overlay_check)
if(wielded)
unwield()
var/obj/item/offhand/O = user.get_inactive_hand()
if(istype(O))
O.unwield()
return ..()
/obj/item/gun/throw_at()
@@ -991,7 +992,7 @@ ABSTRACT_TYPE(/obj/item/gun)
if (!QDELETED(src))
qdel(src)
/obj/item/offhand/mob_can_equip(var/mob/M, slot, disable_warning = FALSE)
/obj/item/offhand/mob_can_equip(var/mob/M, slot, disable_warning = FALSE, bypass_blocked_check = FALSE, is_overlay_check = FALSE)
var/static/list/equippable_slots = list(slot_l_hand, slot_r_hand)
if(slot in equippable_slots)
return TRUE