Refactor /mob/unEquip. (#27720)

* Refactor /mob/unEquip.

* fix things found in testing

* more fixes from testing

* fix removal of hooded suits

* fix flayers inability to deploy swarmprod

* fix changeling blade activation

* unnecessary parens

* pass default unequip args to proc overrides

* fix belts being able to forceMove into full hands
This commit is contained in:
warriorstar-orion
2025-01-09 20:58:35 -05:00
committed by GitHub
parent 17602326bc
commit 0eafad8475
213 changed files with 587 additions and 585 deletions
+2 -3
View File
@@ -94,8 +94,7 @@
var/obj/item/flash/F = holder
F.set_light(0)
owner.unEquip(holder, 1)
holder.forceMove(src)
owner.transfer_item_to(holder, src, force = TRUE)
holder = null
playsound(get_turf(owner), 'sound/mecha/mechmove03.ogg', 50, 1)
@@ -125,7 +124,7 @@
var/obj/item/offhand_arm_item = owner.get_active_hand()
to_chat(owner, "<span class='warning'>Your hands are too encumbered wielding [offhand_arm_item] to deploy [src]!</span>")
return
else if(!owner.unEquip(arm_item))
else if(!owner.drop_item_to_ground(arm_item))
to_chat(owner, "<span class='warning'>Your [arm_item] interferes with [src]!</span>")
return
else
@@ -171,7 +171,7 @@
return ..()
var/mob/living/carbon/human/C = M
if(is_robotic() && HAS_TRAIT(C, TRAIT_IPC_JOINTS_MAG) && isnull(C.bodyparts_by_name[limb_name]))
user.unEquip(src)
user.drop_item_to_ground(src)
replaced(C)
C.update_body()
C.updatehealth()
@@ -749,12 +749,12 @@ Note that amputating the affected organ does in fact remove the infection from t
holder.visible_message(\
"\The [holder.handcuffed.name] falls off of [holder.name].",\
"\The [holder.handcuffed.name] falls off you.")
holder.unEquip(holder.handcuffed)
holder.drop_item_to_ground(holder.handcuffed)
if(holder.legcuffed && (body_part in list(FOOT_LEFT, FOOT_RIGHT, LEG_LEFT, LEG_RIGHT)))
holder.visible_message(\
"\The [holder.legcuffed.name] falls off of [holder.name].",\
"\The [holder.legcuffed.name] falls off you.")
holder.unEquip(holder.legcuffed)
holder.drop_item_to_ground(holder.legcuffed)
/obj/item/organ/external/proc/fracture(silent = FALSE)
if(is_robotic())
@@ -182,7 +182,7 @@
/obj/item/organ_extractor/abductor/attackby__legacy__attackchain(obj/item/I, mob/user, params)
. = ..()
if(istype(I, /obj/item/organ/internal) && !storedorgan)
user.unEquip(I)
user.unequip(I)
insert_internal_organ_in_extractor(I)
/obj/item/organ_extractor/abductor/emp_act(severity)
@@ -319,7 +319,7 @@
var/mob/living/carbon/human/H = owner
if(isobj(H.shoes))
var/thingy = H.shoes
if(H.unEquip(H.shoes))
if(H.drop_item_to_ground(H.shoes))
walk_away(thingy,H,15,2)
spawn(20)
if(thingy)
@@ -52,7 +52,7 @@
if(I.w_class > WEIGHT_CLASS_SMALL)
to_chat(owner, "<span class='notice'>[I] is too large to fit in your [name].</span>")
return
if(owner.unEquip(I))
if(owner.unequip(I))
owner.visible_message("<span class='notice'>[owner] places [I] into [owner.p_their()] [name].</span>", "<span class='notice'>You place [I] into your [name].</span>")
I.forceMove(src)
held_item = I
@@ -61,7 +61,7 @@
return
var/hand = (body_part == ARM_LEFT) ? owner.l_hand : owner.r_hand
if(hand && owner.canUnEquip(hand))
owner.unEquip(hand)
owner.drop_item_to_ground(hand)
to_chat(owner, "<span class='userdanger'>Your [name] malfunctions, dropping what it was holding!</span>")
owner.custom_emote(EMOTE_VISIBLE, "drops what [owner.p_they()] [owner.p_were()] holding, [owner.p_their()] [name] malfunctioning!")
@@ -144,7 +144,8 @@
owner.AdjustWeakened(4 SECONDS)
/obj/item/organ/external/foot/remove()
if(owner && owner.shoes) owner.unEquip(owner.shoes)
if(owner && owner.shoes)
owner.drop_item_to_ground(owner.shoes)
. = ..()
/obj/item/organ/external/foot/right
@@ -175,7 +176,7 @@
return
var/hand = (body_part == HAND_LEFT) ? owner.l_hand : owner.r_hand
if(hand && owner.canUnEquip(hand))
owner.unEquip(hand)
owner.drop_item_to_ground(hand)
to_chat(owner, "<span class='userdanger'>Your [name] malfunctions, dropping what it was holding!</span>")
owner.custom_emote(EMOTE_VISIBLE, "drops what [owner.p_they()] [owner.p_were()] holding, [owner.p_their()] [name] malfunctioning!")
@@ -183,11 +184,11 @@
if(owner)
update_hand_missing()
if(owner.gloves)
owner.unEquip(owner.gloves)
owner.drop_item_to_ground(owner.gloves)
if(owner.l_hand && (body_part == HAND_LEFT))
owner.unEquip(owner.l_hand, TRUE)
owner.drop_item_to_ground(owner.l_hand, force = TRUE)
if(owner.r_hand && (body_part == HAND_RIGHT))
owner.unEquip(owner.r_hand, TRUE)
owner.drop_item_to_ground(owner.r_hand, force = TRUE)
. = ..()
@@ -274,15 +275,15 @@
dna = owner.dna.Clone()
name = "[dna.real_name]'s head"
if(owner.glasses)
owner.unEquip(owner.glasses, force = TRUE)
owner.drop_item_to_ground(owner.glasses, force = TRUE)
if(owner.head)
owner.unEquip(owner.head, force = TRUE)
owner.drop_item_to_ground(owner.head, force = TRUE)
if(owner.l_ear)
owner.unEquip(owner.l_ear, force = TRUE)
owner.drop_item_to_ground(owner.l_ear, force = TRUE)
if(owner.r_ear)
owner.unEquip(owner.r_ear, force = TRUE)
owner.drop_item_to_ground(owner.r_ear, force = TRUE)
if(owner.wear_mask)
owner.unEquip(owner.wear_mask, force = TRUE)
owner.drop_item_to_ground(owner.wear_mask, force = TRUE)
owner.update_hair()
owner.update_fhair()
owner.update_head_accessory()