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-10 01:58:35 +00:00
committed by GitHub
parent 17602326bc
commit 0eafad8475
213 changed files with 587 additions and 585 deletions
+4 -4
View File
@@ -50,10 +50,10 @@
do_jitter_animation(30 SECONDS)
if(iswizard(src) || (mind && mind.special_role == SPECIAL_ROLE_WIZARD_APPRENTICE)) //Wizards get non-cursed clown robes and magical mask.
unEquip(shoes, TRUE)
unEquip(wear_mask, TRUE)
unEquip(head, TRUE)
unEquip(wear_suit, TRUE)
drop_item_to_ground(shoes, force = TRUE)
drop_item_to_ground(wear_mask, force = TRUE)
drop_item_to_ground(head, force = TRUE)
drop_item_to_ground(wear_suit, force = TRUE)
equip_to_slot_if_possible(new /obj/item/clothing/head/wizard/clown, ITEM_SLOT_HEAD, TRUE, TRUE)
equip_to_slot_if_possible(new /obj/item/clothing/suit/wizrobe/clown, ITEM_SLOT_OUTER_SUIT, TRUE, TRUE)
equip_to_slot_if_possible(new /obj/item/clothing/shoes/clown_shoes/magical, ITEM_SLOT_SHOES, TRUE, TRUE)
+8 -17
View File
@@ -32,13 +32,13 @@
singlemutcheck(src, GLOB.nervousblock, MUTCHK_FORCED)
rename_character(real_name, "cluwne")
unEquip(w_uniform, 1)
unEquip(shoes, 1)
unEquip(gloves, 1)
drop_item_to_ground(w_uniform, force = TRUE)
drop_item_to_ground(shoes, force = TRUE)
drop_item_to_ground(gloves, force = TRUE)
var/obj/item/organ/internal/honktumor/cursed/tumor = new
tumor.insert(src)
if(!istype(wear_mask, /obj/item/clothing/mask/cursedclown)) //Infinite loops otherwise
unEquip(wear_mask, 1)
drop_item_to_ground(wear_mask, force = TRUE)
equip_to_slot_if_possible(new /obj/item/clothing/under/cursedclown, ITEM_SLOT_JUMPSUIT, TRUE, TRUE)
equip_to_slot_if_possible(new /obj/item/clothing/gloves/cursedclown, ITEM_SLOT_GLOVES, TRUE, TRUE)
equip_to_slot_if_possible(new /obj/item/clothing/mask/cursedclown, ITEM_SLOT_MASK, TRUE, TRUE)
@@ -65,23 +65,14 @@
dna.SetSEState(GLOB.nervousblock, FALSE)
singlemutcheck(src, GLOB.nervousblock, MUTCHK_FORCED)
var/obj/item/clothing/under/U = w_uniform
unEquip(w_uniform, 1)
if(U)
qdel(U)
var/obj/item/clothing/shoes/S = shoes
unEquip(shoes, 1)
if(S)
qdel(S)
qdel(w_uniform)
qdel(shoes)
if(istype(wear_mask, /obj/item/clothing/mask/cursedclown))
unEquip(wear_mask, 1)
qdel(wear_mask)
if(istype(gloves, /obj/item/clothing/gloves/cursedclown))
var/obj/item/clothing/gloves/G = gloves
unEquip(gloves, 1)
qdel(G)
qdel(gloves)
equip_to_slot_if_possible(new /obj/item/clothing/under/rank/procedure/iaa/formal/black, ITEM_SLOT_JUMPSUIT, TRUE, TRUE)
equip_to_slot_if_possible(new /obj/item/clothing/shoes/black, ITEM_SLOT_SHOES, TRUE, TRUE)
+1 -1
View File
@@ -40,7 +40,7 @@
magichead.voicechange = TRUE //NEEEEIIGHH
target.visible_message( "<span class='danger'>[target]'s face lights up in fire, and after the event a horse's head takes its place!</span>", \
"<span class='danger'>Your face burns up, and shortly after the fire you realise you have the face of a horse!</span>")
if(!target.unEquip(target.wear_mask))
if(!target.drop_item_to_ground(target.wear_mask))
qdel(target.wear_mask)
target.equip_to_slot_if_possible(magichead, ITEM_SLOT_MASK, TRUE, TRUE)
+5 -5
View File
@@ -59,7 +59,7 @@
if(iscarbon(current_body))
var/mob/living/carbon/C = current_body
for(var/obj/item/W in C)
C.unEquip(W)
C.drop_item_to_ground(W)
// Give a hint as to where the body is
var/wheres_wizdo = dir2text(get_dir(body_turf, item_turf))
@@ -116,10 +116,10 @@
if(ishuman(user))
var/mob/living/carbon/human/H = user
H.set_species(/datum/species/skeleton/lich)
H.unEquip(H.wear_suit)
H.unEquip(H.head)
H.unEquip(H.shoes)
H.unEquip(H.head)
H.drop_item_to_ground(H.wear_suit)
H.drop_item_to_ground(H.head)
H.drop_item_to_ground(H.shoes)
H.drop_item_to_ground(H.head)
equip_lich(H)
to_chat(user, "<span class='userdanger'>With a hideous feeling of emptiness you watch in horrified fascination as skin sloughs off bone! Blood boils, nerves disintegrate, eyes boil in their sockets! As your organs crumble to dust in your fleshless chest you come to terms with your choice. You're a lich!</span>")
+1 -1
View File
@@ -48,7 +48,7 @@
try_throw_object(user, target, I)
/datum/spell/charge_up/bounce/magnet/proc/try_throw_object(mob/user, mob/thrower, obj/item/to_throw)
if(!(to_throw.flags & CONDUCT) || !thrower.unEquip(to_throw, silent = TRUE))
if(!(to_throw.flags & CONDUCT) || !thrower.drop_item_to_ground(to_throw, silent = TRUE))
return FALSE
thrower.visible_message("<span class='warning'>[to_throw] gets thrown out of [thrower] [thrower.p_their()] hands!</span>",
"<span class='danger'>[to_throw] suddenly gets thrown out of your hands!</span>")
+3 -3
View File
@@ -35,9 +35,9 @@
/mob/living/carbon/human/proc/mimetouched()
Weaken(14 SECONDS)
if(iswizard(src) || (mind && mind.special_role == SPECIAL_ROLE_WIZARD_APPRENTICE)) //Wizards get non-cursed mime outfit. Replace with mime robes if we add those.
unEquip(wear_mask, TRUE)
unEquip(w_uniform, TRUE)
unEquip(wear_suit, TRUE)
drop_item_to_ground(wear_mask, force = TRUE)
drop_item_to_ground(w_uniform, force = TRUE)
drop_item_to_ground(wear_suit, force = TRUE)
equip_to_slot_if_possible(new /obj/item/clothing/mask/gas/mime, ITEM_SLOT_MASK, TRUE, TRUE)
equip_to_slot_if_possible(new /obj/item/clothing/under/rank/civilian/mime, ITEM_SLOT_JUMPSUIT, TRUE, TRUE)
equip_to_slot_if_possible(new /obj/item/clothing/suit/suspenders, ITEM_SLOT_OUTER_SUIT, TRUE, TRUE)
+1 -1
View File
@@ -18,7 +18,7 @@
var/obj/item/nullrod/scythe/talking/user_sword = user.loc
if(ishuman(user_sword.loc))
var/mob/living/carbon/holder = user_sword.loc
holder.unEquip(user_sword)
holder.drop_item_to_ground(user_sword)
else if(isstorage(user_sword.loc))
if(prob(50))
to_chat(user, "<span class='warning'>You fail to break out of [user_sword.loc]!</span>")
+1 -1
View File
@@ -76,7 +76,7 @@
if(ismob(item_to_retrieve.loc)) //If its on someone, properly drop it
var/mob/M = item_to_retrieve.loc
if(issilicon(M) || !M.unEquip(item_to_retrieve)) //Items in silicons warp the whole silicon
if(issilicon(M) || !M.drop_item_to_ground(item_to_retrieve)) //Items in silicons warp the whole silicon
M.visible_message("<span class='warning'>[M] suddenly disappears!</span>", "<span class='danger'>A force suddenly pulls you away!</span>")
M.forceMove(target.loc)
M.loc.visible_message("<span class='caution'>[M] suddenly appears!</span>")