mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 03:27:05 +01:00
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:
@@ -71,7 +71,7 @@
|
||||
else if(target_direction & SOUTH)
|
||||
x_offset = rand(-12, 12)
|
||||
y_offset = -16
|
||||
if(!user.unEquip(I))
|
||||
if(!user.drop_item_to_ground(I))
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You stick [I] to [target_turf].</span>")
|
||||
I.pixel_x = x_offset
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
if(!user.canUnEquip(I))
|
||||
return
|
||||
|
||||
INVOKE_ASYNC(user, TYPE_PROC_REF(/mob, unEquip), I)
|
||||
INVOKE_ASYNC(user, TYPE_PROC_REF(/mob, drop_item_to_ground), I)
|
||||
|
||||
var/list/click_params = params2list(params)
|
||||
//Center the icon where the user clicked.
|
||||
|
||||
@@ -178,20 +178,20 @@
|
||||
if(ismonkeybasic(user))
|
||||
if(require_twohands)
|
||||
to_chat(user, "<span class='notice'>[parent] is too heavy and cumbersome for you to carry!</span>")
|
||||
user.unEquip(parent, force = TRUE)
|
||||
user.drop_item_to_ground(parent, force = TRUE)
|
||||
else
|
||||
to_chat(user, "<span class='notice'>[parent] too heavy for you to wield fully.</span>")
|
||||
return
|
||||
if(user.get_inactive_hand())
|
||||
if(require_twohands)
|
||||
to_chat(user, "<span class='notice'>[parent] is too cumbersome to carry in one hand!</span>")
|
||||
user.unEquip(parent, force = TRUE)
|
||||
user.drop_item_to_ground(parent, force = TRUE)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need your other hand to be empty!</span>")
|
||||
return
|
||||
if(!user.has_both_hands())
|
||||
if(require_twohands)
|
||||
user.unEquip(parent, force = TRUE)
|
||||
user.drop_item_to_ground(parent, force = TRUE)
|
||||
to_chat(user, "<span class='warning'>You don't have enough intact hands.</span>")
|
||||
return
|
||||
|
||||
@@ -285,7 +285,7 @@
|
||||
|
||||
// if the item requires two handed drop the item on unwield
|
||||
if(require_twohands && can_drop)
|
||||
user.unEquip(parent, force = TRUE)
|
||||
user.drop_item_to_ground(parent, force = TRUE)
|
||||
|
||||
// Show message if requested
|
||||
if(show_message)
|
||||
@@ -393,7 +393,7 @@
|
||||
INVOKE_ASYNC(src, PROC_REF(unwield), user)
|
||||
|
||||
/datum/component/two_handed/proc/try_drop_item(mob/user)
|
||||
if(user.unEquip(parent))
|
||||
if(user.drop_item_to_ground(parent))
|
||||
user.visible_message("<span class='notice'>[user] loses [user.p_their()] grip on [parent]!</span>")
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
var/saved_internals = H.internal
|
||||
|
||||
H.unEquip(H.get_item_by_slot(ITEM_SLOT_MASK))
|
||||
H.drop_item_to_ground(H.get_item_by_slot(ITEM_SLOT_MASK))
|
||||
var/obj/item/clothing/mask/gas/clown_hat/peak_comedy = new
|
||||
peak_comedy.flags |= DROPDEL
|
||||
H.equip_to_slot_or_del(peak_comedy, ITEM_SLOT_MASK)
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
var/chosen_slot_ID = pick(eligible_slot_IDs)
|
||||
var/chosen_fashion = magic_fashion[num2text(chosen_slot_ID)]
|
||||
|
||||
H.unEquip(H.get_item_by_slot(chosen_slot_ID))
|
||||
H.drop_item_to_ground(H.get_item_by_slot(chosen_slot_ID))
|
||||
var/obj/item/magic_attire = new chosen_fashion
|
||||
magic_attire.flags |= DROPDEL
|
||||
H.equip_to_slot_or_del(magic_attire, chosen_slot_ID)
|
||||
|
||||
@@ -263,7 +263,7 @@
|
||||
|
||||
/// A utility function for `/datum/strippable_item`s to finish unequipping an item from a mob.
|
||||
/proc/finish_unequip_mob(obj/item/item, mob/source, mob/user)
|
||||
if(!source.unEquip(item))
|
||||
if(!source.drop_item_to_ground(item))
|
||||
return
|
||||
|
||||
add_attack_logs(user, source, "Stripping of [item]")
|
||||
@@ -427,7 +427,7 @@
|
||||
return
|
||||
|
||||
// make sure to drop the item
|
||||
if(!user.unEquip(held_item))
|
||||
if(!user.drop_item_to_ground(held_item))
|
||||
return
|
||||
|
||||
strippable_item.finish_equip(owner, held_item, user)
|
||||
|
||||
+1
-1
@@ -1521,7 +1521,7 @@
|
||||
switch(href_list["common"])
|
||||
if("undress")
|
||||
for(var/obj/item/I in current)
|
||||
current.unEquip(I, TRUE)
|
||||
current.drop_item_to_ground(I, force = TRUE)
|
||||
log_admin("[key_name(usr)] has unequipped [key_name(current)]")
|
||||
message_admins("[key_name_admin(usr)] has unequipped [key_name_admin(current)]")
|
||||
if("takeuplink")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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>")
|
||||
|
||||
@@ -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>")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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>")
|
||||
|
||||
@@ -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>")
|
||||
|
||||
Reference in New Issue
Block a user