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
+83 -37
View File
@@ -140,11 +140,11 @@
//Drops the item in our left hand
/mob/proc/drop_l_hand(force = FALSE)
return unEquip(l_hand, force) //All needed checks are in unEquip
return drop_item_to_ground(l_hand, force)
//Drops the item in our right hand
/mob/proc/drop_r_hand(force = FALSE)
return unEquip(r_hand, force) //Why was this not calling unEquip in the first place jesus fuck.
return drop_item_to_ground(r_hand, force)
//Drops the item in our active hand.
/mob/proc/drop_item()
@@ -153,57 +153,103 @@
else
return drop_r_hand()
//Here lie unEquip and before_item_take, already forgotten and not missed.
/mob/proc/canUnEquip(obj/item/I, force)
if(!I)
return TRUE
if((I.flags & NODROP) && !force)
return FALSE
if((SEND_SIGNAL(I, COMSIG_ITEM_PRE_UNEQUIP, force) & COMPONENT_ITEM_BLOCK_UNEQUIP) && !force)
return FALSE
return TRUE
/mob/proc/unEquip(obj/item/I, force, silent = FALSE) //Force overrides NODROP for things like wizarditis and admin undress.
if(!I) //If there's nothing to drop, the drop is automatically succesfull. If(unEquip) should generally be used to check for NODROP.
return 1
/**
* Unequip `target` and drop it at our current location.
*
* Returns `FALSE` if the unequip failed, and `target` if it succeeded. Returns
* `FALSE` if there is no target to drop. If the caller cares about handling the
* resultant dropped object, they are responsible for ensuring that the thing
* actually exists. This is to ensure that the return value is meaningful and that
* a nonexistant item being unequipped and returning null is not interpreted as
* a failure.
*
* However, if you don't care about the return value, feel free to pass in possibly
* nonexistant objects, such as when dropping anything in a slot for a spell/virus
* that replaces existing clothing.
*/
/mob/proc/drop_item_to_ground(obj/item/target, force = FALSE, silent = FALSE, drop_inventory = TRUE)
if(isnull(target))
return FALSE
if(!canUnEquip(I, force))
return 0
var/try_unequip = unequip_to(target, drop_location(), force, silent, drop_inventory, no_move = FALSE)
if(I == r_hand)
if(!try_unequip || !target)
return FALSE
return target
/**
* Unequip `target` and relocate it to `destination`.
*
* Returns `FALSE` if the transfer failed for any reason, and `TRUE` if it succeeded.
*/
/mob/proc/transfer_item_to(obj/item/target, atom/destination, force = FALSE, silent = TRUE)
return unequip_to(target, destination, force, silent, no_move = FALSE)
/**
* Unequip `target` without relocating it.
*
* Returns `FALSE` if the transfer failed for any reason, and `TRUE` if it succeeded.
*
* A destination cannot be specified; you must either `forceMove` or `qdel` it.
* If you intend to `qdel` it immediately, it is not necessary to call this;
* [/obj/item/proc/Destroy] will perform the necessary unequipping.
*/
/mob/proc/unequip(obj/item/target, force = FALSE, drop_inventory = TRUE)
return unequip_to(target, null, force, silent = TRUE, drop_inventory = drop_inventory, no_move = TRUE)
/**
* Central proc for unequipping items. Cannot be called but can be overridden so
* long as default arg values are preserved. Use [/mob/proc/unequip],
* [/mob/proc/drop_item_to_ground], or [/mob/proc/transfer_item_to] instead.
*
* - `target`: The object to unequip.
* - `destination`: The location the object should be unequipped to, if applicable.
* - `force`: Override `NODROP` for things like wizarditis and admin undress.
* - `silent`: Whether the unequip should play a sound.
* - `drop_inventory`: Whether items in the dropped item's slots (such as uniform pockets) should be dropped.
* - `no_move`: Whether we should attempt to move the item to `destination` or expect the caller to.
*/
/mob/proc/unequip_to(obj/item/target, atom/destination, force = FALSE, silent = FALSE, drop_inventory = TRUE, no_move = FALSE)
PROTECTED_PROC(TRUE)
if((target.flags & NODROP) && !force)
return FALSE
if((SEND_SIGNAL(target, COMSIG_ITEM_PRE_UNEQUIP, destination, force, silent, drop_inventory, no_move) & COMPONENT_ITEM_BLOCK_UNEQUIP) && !force)
return FALSE
if(target == r_hand)
r_hand = null
update_inv_r_hand()
else if(I == l_hand)
else if(target == l_hand)
l_hand = null
update_inv_l_hand()
else if(I in tkgrabbed_objects)
var/obj/item/tk_grab/tkgrab = tkgrabbed_objects[I]
unEquip(tkgrab, force)
else if(target in tkgrabbed_objects)
var/obj/item/tk_grab/tkgrab = tkgrabbed_objects[target]
unequip_to(tkgrab, destination, force, silent, drop_inventory, no_move)
if(I)
if(target)
if(client)
client.screen -= I
var/turf/drop_loc = drop_location()
if(drop_loc)
I.forceMove(drop_loc)
else
I.moveToNullspace()
I.dropped(src, silent)
if(I)
I.layer = initial(I.layer)
I.plane = initial(I.plane)
return 1
//Attemps to remove an object on a mob. Will not move it to another area or such, just removes from the mob.
/mob/proc/remove_from_mob(obj/O)
unEquip(O)
O.screen_loc = null
return 1
client.screen -= target
target.layer = initial(target.layer)
target.plane = initial(target.plane)
if(!no_move && !(target.flags & DROPDEL))
if(isnull(destination))
target.moveToNullspace()
else
target.forceMove(destination)
target.dropped(src, silent)
return TRUE
//Outdated but still in use apparently. This should at least be a human proc.
//Daily reminder to murder this - Remie.
@@ -258,7 +304,7 @@
var/list/items = list()
items |= get_equipped_items(TRUE)
for(var/I in items)
unEquip(I)
drop_item_to_ground(I)
drop_l_hand()
drop_r_hand()
@@ -1,3 +1,3 @@
//can't unequip since it can't equip anything // why the fuck is this it's own file
/mob/living/carbon/alien/larva/unEquip(obj/item/I, force, silent = FALSE)
/mob/living/carbon/alien/larva/unequip_to(obj/item/target, atom/destination, force = FALSE, silent = FALSE, drop_inventory = TRUE, no_move = FALSE)
return
@@ -46,7 +46,7 @@
/obj/item/clothing/mask/facehugger/attack__legacy__attackchain(mob/living/M, mob/user)
..()
user.unEquip(src)
user.drop_item_to_ground(src)
Attach(M)
/obj/item/clothing/mask/facehugger/examine(mob/user)
@@ -129,7 +129,7 @@
var/obj/item/clothing/W = target.wear_mask
if(W.flags & NODROP)
return FALSE
target.unEquip(W)
target.drop_item_to_ground(W)
target.visible_message("<span class='danger'>[src] tears [W] off of [target]'s face!</span>", \
"<span class='userdanger'>[src] tears [W] off of [target]'s face!</span>")
+11 -10
View File
@@ -9,7 +9,7 @@
for(var/obj/item in get_all_slots())
if(QDELETED(item))
continue
unEquip(item, silent = TRUE)
drop_item_to_ground(item, silent = TRUE)
qdel(item)
QDEL_LIST_CONTENTS(internal_organs)
QDEL_LIST_CONTENTS(stomach_contents)
@@ -704,7 +704,7 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
else if(!(I.flags & ABSTRACT)) //can't throw abstract items
thrown_thing = I
unEquip(I, silent = TRUE)
drop_item_to_ground(I, silent = TRUE)
if(HAS_TRAIT(src, TRAIT_PACIFISM) && I.throwforce)
to_chat(src, "<span class='notice'>You set [I] down gently on the ground.</span>")
@@ -733,25 +733,26 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
/mob/living/carbon/get_restraining_item()
return handcuffed
/mob/living/carbon/unEquip(obj/item/I, force, silent = FALSE) //THIS PROC DID NOT CALL ..()
. = ..() //Sets the default return value to what the parent returns.
if(!. || !I) //We don't want to set anything to null if the parent returned 0.
/mob/living/carbon/unequip_to(obj/item/target, atom/destination, force = FALSE, silent = FALSE, drop_inventory = TRUE, no_move = FALSE)
. = ..()
if(!. || !target) //We don't want to set anything to null if the parent returned 0.
return
if(I == back)
if(target == back)
back = null
update_inv_back()
else if(I == wear_mask)
else if(target == wear_mask)
if(ishuman(src)) //If we don't do this hair won't be properly rebuilt.
return
wear_mask = null
update_inv_wear_mask()
else if(I == handcuffed)
else if(target == handcuffed)
handcuffed = null
if(buckled && buckled.buckle_requires_restraints)
unbuckle()
update_handcuffed()
else if(I == legcuffed)
else if(target == legcuffed)
legcuffed = null
toggle_move_intent()
update_inv_legcuffed()
@@ -932,7 +933,7 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
to_chat(src, "<span class='notice'>You get rid of [I]!</span>")
if(I.security_lock)
I.do_break()
unEquip(I)
drop_item_to_ground(I)
remove_status_effect(STATUS_EFFECT_REMOVE_MUZZLE)
/mob/living/carbon/proc/cuff_resist(obj/item/restraints/restraints, break_cuffs)
+1 -1
View File
@@ -170,7 +170,7 @@
to_chat(receiver, "<span class='warning'>[I] stays stuck to [giver]'s hand when you try to take it!</span>")
return
UnregisterSignal(I, list(COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED)) // We don't want these triggering `cancel_give` at this point, since the give is successful.
giver.unEquip(I)
giver.drop_item_to_ground(I)
receiver.put_in_hands(I)
I.add_fingerprint(receiver)
I.on_give(giver, receiver)
@@ -59,7 +59,7 @@
visible_message("<span class='notice'>[src] seems to have [p_their()] hands full!</span>")
return
visible_message("<span class='notice'>[src] drops [in_hand] and picks up [thing] instead!</span>")
unEquip(in_hand)
unequip(in_hand)
in_hand.forceMove(old_loc)
else
visible_message("<span class='notice'>[src] picks up [thing]!</span>")
@@ -18,8 +18,7 @@
thing.throw_at(get_edge_target_turf(src, pick(GLOB.alldirs)), rand(1, 3), 5)
for(var/obj/item/I in get_equipped_items(include_pockets = TRUE))
unEquip(I, TRUE)
I.forceMove(get_turf(src))
drop_item_to_ground(I, force = TRUE)
if(!QDELETED(I)) // This is in case moving to the turf deletes the atom.
I.throw_at(get_edge_target_turf(src, pick(GLOB.alldirs)), rand(1, 3), 5)
@@ -323,7 +323,7 @@
)
if(cig.lit)
to_chat(user, "<span class='userdanger'>The lit [cig] burns on the way down!")
user.unEquip(cig)
user.unequip(cig)
qdel(cig)
H.adjustFireLoss(5)
return TRUE
@@ -67,42 +67,45 @@
if(ITEM_SLOT_ACCESSORY)
return TRUE
/mob/living/carbon/human/unEquip(obj/item/I, force, silent = FALSE)
/mob/living/carbon/human/unequip_to(obj/item/target, atom/destination, force = FALSE, silent = FALSE, drop_inventory = TRUE, no_move = FALSE)
. = ..() //See mob.dm for an explanation on this and some rage about people copypasting instead of calling ..() like they should.
if(!. || !I)
if(!. || !target)
return
if(I == wear_suit)
if(s_store)
unEquip(s_store, 1) //It makes no sense for your suit storage to stay on you if you drop your suit.
if(target == wear_suit)
if(s_store && drop_inventory)
// It makes no sense for your suit storage to stay on you if you drop your suit.
drop_item_to_ground(s_store, force = TRUE)
wear_suit = null
if(I.flags_inv & HIDEJUMPSUIT)
if(target.flags_inv & HIDEJUMPSUIT)
update_inv_w_uniform()
if(I.flags_inv & HIDESHOES)
if(target.flags_inv & HIDESHOES)
update_inv_shoes()
if(I.flags_inv & HIDEGLOVES)
if(target.flags_inv & HIDEGLOVES)
update_inv_gloves()
update_inv_wear_suit()
else if(I == w_uniform)
if(r_store)
unEquip(r_store, 1) //Again, makes sense for pockets to drop.
if(l_store)
unEquip(l_store, 1)
if(wear_id)
unEquip(wear_id)
if(belt && !(belt.flags_2 & ALLOW_BELT_NO_JUMPSUIT_2))
unEquip(belt)
else if(target == w_uniform)
//Again, makes sense for pockets to drop.
if(drop_inventory)
if(r_store)
drop_item_to_ground(r_store, force = TRUE)
if(l_store)
drop_item_to_ground(l_store, force = TRUE)
if(wear_id)
drop_item_to_ground(wear_id, force = TRUE)
if(belt && !(belt.flags_2 & ALLOW_BELT_NO_JUMPSUIT_2))
drop_item_to_ground(belt, force = TRUE)
w_uniform = null
update_inv_w_uniform()
else if(I == gloves)
else if(target == gloves)
gloves = null
update_inv_gloves()
else if(I == neck)
else if(target == neck)
neck = null
update_inv_neck()
else if(I == glasses)
else if(target == glasses)
glasses = null
var/obj/item/clothing/glasses/G = I
var/obj/item/clothing/glasses/G = target
if(G.tint)
update_tint()
if(G.prescription)
@@ -111,71 +114,71 @@
update_sight()
update_inv_glasses()
update_client_colour()
else if(I == head)
else if(target == head)
head = null
if(I.flags & BLOCKHAIR || I.flags & BLOCKHEADHAIR)
if(target.flags & BLOCKHAIR || target.flags & BLOCKHEADHAIR)
update_hair() //rebuild hair
update_fhair()
update_head_accessory()
// Bandanas and paper hats go on the head but are not head clothing
if(istype(I,/obj/item/clothing/head))
var/obj/item/clothing/head/hat = I
if(istype(target, /obj/item/clothing/head))
var/obj/item/clothing/head/hat = target
if(hat.vision_flags || hat.see_in_dark || !isnull(hat.lighting_alpha))
update_sight()
if(I.flags_inv & HIDEEARS)
if(target.flags_inv & HIDEEARS)
update_inv_ears()
head_update(I)
head_update(target)
update_inv_head()
update_misc_effects()
else if(I == r_ear)
else if(target == r_ear)
r_ear = null
update_inv_ears()
else if(I == l_ear)
else if(target == l_ear)
l_ear = null
update_inv_ears()
else if(I == shoes)
else if(target == shoes)
shoes = null
update_inv_shoes()
else if(I == belt)
else if(target == belt)
belt = null
update_inv_belt()
else if(I == wear_mask)
else if(target == wear_mask)
wear_mask = null
if(I.flags & BLOCKHAIR || I.flags & BLOCKHEADHAIR)
if(target.flags & BLOCKHAIR || target.flags & BLOCKHEADHAIR)
update_hair() //rebuild hair
update_fhair()
update_head_accessory()
if(internal && !get_organ_slot("breathing_tube"))
internal = null
if(I.flags_inv & HIDEEARS)
if(target.flags_inv & HIDEEARS)
update_inv_ears()
wear_mask_update(I, toggle_off = FALSE)
wear_mask_update(target, toggle_off = FALSE)
sec_hud_set_ID()
update_misc_effects()
update_inv_wear_mask()
else if(I == wear_id)
else if(target == wear_id)
wear_id = null
sec_hud_set_ID()
update_inv_wear_id()
else if(I == wear_pda)
else if(target == wear_pda)
wear_pda = null
update_inv_wear_pda()
else if(I == r_store)
else if(target == r_store)
r_store = null
update_inv_pockets()
else if(I == l_store)
else if(target == l_store)
l_store = null
update_inv_pockets()
else if(I == s_store)
else if(target == s_store)
s_store = null
update_inv_s_store()
else if(I == back)
else if(target == back)
back = null
update_inv_back()
else if(I == r_hand)
else if(target == r_hand)
r_hand = null
update_inv_r_hand()
else if(I == l_hand)
else if(target == l_hand)
l_hand = null
update_inv_l_hand()
update_action_buttons_icon()
@@ -326,7 +329,7 @@
update_inv_s_store()
if(ITEM_SLOT_IN_BACKPACK)
if(get_active_hand() == I)
unEquip(I)
drop_item_to_ground(I)
if(ismodcontrol(back))
var/obj/item/mod/control/C = back
if(C.bag)
@@ -1453,7 +1453,7 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
..()
if(current_size >= STAGE_THREE)
for(var/obj/item/hand in get_both_hands(src))
if(prob(current_size * 5) && hand.w_class >= ((11-current_size)/2) && unEquip(hand))
if(prob(current_size * 5) && hand.w_class >= ((11-current_size)/2) && drop_item_to_ground(hand))
step_towards(hand, src)
to_chat(src, "<span class='warning'>\The [S] pulls \the [hand] from your grip!</span>")
rad_act(current_size * 3)
@@ -92,12 +92,12 @@
if((E.body_part == HAND_LEFT) || (E.body_part == ARM_LEFT))
if(!l_hand)
continue
if(!unEquip(l_hand))
if(!drop_item_to_ground(l_hand))
continue
else
if(!r_hand)
continue
if(!unEquip(r_hand))
if(!drop_item_to_ground(r_hand))
continue
if(!E.properly_attached)
@@ -116,12 +116,12 @@
if((E.body_part == HAND_LEFT) || (E.body_part == ARM_LEFT))
if(!l_hand)
continue
if(!unEquip(l_hand))
if(!drop_item_to_ground(l_hand))
continue
else
if(!r_hand)
continue
if(!unEquip(r_hand))
if(!drop_item_to_ground(r_hand))
continue
custom_emote(EMOTE_VISIBLE, "drops what [p_they()] [p_were()] holding, [p_their()] [E.name] malfunctioning!")
@@ -636,7 +636,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts)
// Automatically drop anything in store / id / belt if you're not wearing a uniform. //CHECK IF NECESARRY
for(var/obj/item/thing in uniform_slots) // whoever made this
if(thing) // you're a piece of fucking garbage
unEquip(thing) // why the fuck would you goddamn do this motherfucking shit
drop_item_to_ground(thing) // why the fuck would you goddamn do this motherfucking shit
if(client) // INVENTORY CODE IN FUCKING ICON CODE
client.screen -= thing // WHAT THE FUCKING FUCK BAY GODDAMNIT
// **I FUCKING HATE YOU AAAAAAAAAA**
@@ -370,7 +370,7 @@
continue
var/obj/item/thing = H.get_item_by_slot(slot_id)
if(thing && (!thing.species_exception || !is_type_in_list(src, thing.species_exception)))
H.unEquip(thing)
H.drop_item_to_ground(thing)
if(H.hud_used)
H.hud_used.update_locked_slots()
H.ventcrawler = ventcrawler
@@ -372,7 +372,7 @@
/datum/species/golem/sand/handle_death(gibbed, mob/living/carbon/human/H)
H.visible_message("<span class='danger'>[H] turns into a pile of sand!</span>")
for(var/obj/item/W in H)
H.unEquip(W)
H.drop_item_to_ground(W)
for(var/i=1, i <= rand(3, 5), i++)
new /obj/item/stack/ore/glass(get_turf(H))
qdel(H)
@@ -406,7 +406,7 @@
playsound(H, "shatter", 70, 1)
H.visible_message("<span class='danger'>[H] shatters!</span>")
for(var/obj/item/W in H)
H.unEquip(W)
H.drop_item_to_ground(W)
for(var/i=1, i <= rand(3, 5), i++)
new /obj/item/shard(get_turf(H))
qdel(H)
@@ -192,7 +192,7 @@
/datum/species/plasmaman/after_equip_job(datum/job/J, mob/living/carbon/human/H)
if(!H.mind || !H.mind.assigned_role || H.mind.assigned_role != "Clown" && H.mind.assigned_role != "Mime")
H.unEquip(H.wear_mask)
H.drop_item_to_ground(H.wear_mask)
H.equip_or_collect(new /obj/item/clothing/mask/breath(H), ITEM_SLOT_MASK)
var/tank_pref = H.client && H.client.prefs ? H.client.prefs.active_character.speciesprefs : null
@@ -202,7 +202,7 @@
else
internal_tank = new /obj/item/tank/internals/plasmaman/belt/full(H)
if(!H.equip_to_appropriate_slot(internal_tank) && !H.put_in_any_hand_if_possible(internal_tank))
H.unEquip(H.l_hand)
H.drop_item_to_ground(H.l_hand)
H.equip_or_collect(internal_tank, ITEM_SLOT_LEFT_HAND)
to_chat(H, "<span class='boldannounceooc'>Could not find an empty slot for internals! Please report this as a bug.</span>")
stack_trace("Failed to equip plasmaman with a tank, with the job [J.type]")
@@ -79,7 +79,7 @@
/datum/species/vox/after_equip_job(datum/job/J, mob/living/carbon/human/H)
if(!H.mind || !H.mind.assigned_role || H.mind.assigned_role != "Clown" && H.mind.assigned_role != "Mime")
H.unEquip(H.wear_mask)
H.drop_item_to_ground(H.wear_mask)
H.equip_or_collect(new /obj/item/clothing/mask/breath/vox/respirator(H), ITEM_SLOT_MASK)
var/tank_pref = H.client && H.client.prefs ? H.client.prefs.active_character.speciesprefs : null
@@ -90,7 +90,7 @@
internal_tank = new /obj/item/tank/internals/emergency_oxygen/double/vox(H)
if(!H.equip_to_appropriate_slot(internal_tank))
if(!H.put_in_any_hand_if_possible(internal_tank))
H.unEquip(H.l_hand)
H.drop_item_to_ground(H.l_hand)
H.equip_or_collect(internal_tank, ITEM_SLOT_LEFT_HAND)
to_chat(H, "<span class='boldannounceooc'>Could not find an empty slot for internals! Please report this as a bug</span>")
H.internal = internal_tank
@@ -15,7 +15,7 @@
/datum/superheroes/proc/equip(mob/living/carbon/human/H)
H.rename_character(H.real_name, name)
for(var/obj/item/W in H.get_all_slots())
H.unEquip(W)
H.drop_item_to_ground(W)
H.equip_to_slot_or_del(new /obj/item/radio/headset(H), ITEM_SLOT_LEFT_EAR)
/datum/superheroes/proc/fixflags(mob/living/carbon/human/H)
@@ -222,7 +222,7 @@
// No `update_dna=0` here because the character is being over-written
target.change_eye_color(1,1,1)
for(var/obj/item/W in target.get_all_slots())
target.unEquip(W)
target.drop_item_to_ground(W)
target.rename_character(target.real_name, "Generic Henchman ([rand(1, 1000)])")
target.equip_to_slot_or_del(new /obj/item/clothing/under/color/grey/greytide(target), ITEM_SLOT_JUMPSUIT)
target.equip_to_slot_or_del(new /obj/item/clothing/shoes/black/greytide(target), ITEM_SLOT_SHOES)
+2 -2
View File
@@ -481,12 +481,12 @@
var/mob/living/carbon/C = src
if(C.handcuffed && !initial(C.handcuffed))
C.unEquip(C.handcuffed)
C.drop_item_to_ground(C.handcuffed)
C.handcuffed = initial(C.handcuffed)
C.update_handcuffed()
if(C.legcuffed && !initial(C.legcuffed))
C.unEquip(C.legcuffed)
C.drop_item_to_ground(C.legcuffed)
C.legcuffed = initial(C.legcuffed)
C.update_inv_legcuffed()
+2 -2
View File
@@ -264,7 +264,7 @@
/mob/living/silicon/pai/proc/force_fold_out()
if(ismob(card.loc))
var/mob/holder = card.loc
holder.unEquip(card)
holder.drop_item_to_ground(card)
else if(istype(card.loc, /obj/item/pda))
var/obj/item/pda/holder = card.loc
holder.pai = null
@@ -343,7 +343,7 @@
if(istype(H))
var/mob/living/M = H.loc
if(istype(M))
M.unEquip(H)
M.drop_item_to_ground(H)
H.loc = get_turf(src)
loc = get_turf(H)
@@ -239,9 +239,9 @@
while(slot_start != slot_num) //If we wrap around without finding any free slots, just give up.
return
/mob/living/silicon/robot/unEquip(obj/item/I, force, silent = FALSE)
if(I == module_active)
uneq_active(I)
/mob/living/silicon/robot/unequip_to(obj/item/target, atom/destination, force = FALSE, silent = FALSE, drop_inventory = TRUE, no_move = FALSE)
if(target == module_active)
uneq_active(target)
return ..()
/mob/living/silicon/robot/proc/update_module_icon()
@@ -539,7 +539,7 @@
to_chat(user, "<span class='warning'>[item_to_add] does not fit on the head of [src]!</span>")
return FALSE
if(!user.unEquip(item_to_add))
if(!user.transfer_item_to(item_to_add, src))
to_chat(user, "<span class='warning'>[item_to_add] is stuck to your hand, you cannot put it on [src]!</span>")
return FALSE
@@ -547,7 +547,6 @@
"<span class='notice'>[user] puts [item_to_add] on [real_name].</span>",
"<span class='notice'>You put [item_to_add] on [real_name].</span>"
)
item_to_add.forceMove(src)
silicon_hat = item_to_add
update_icons()
@@ -578,7 +577,7 @@
/mob/living/silicon/proc/drop_hat()
if(silicon_hat)
unEquip(silicon_hat)
drop_item_to_ground(silicon_hat)
null_hat()
update_icons()
return TRUE
@@ -17,7 +17,7 @@
/obj/item/bucket_sensor/attackby__legacy__attackchain(obj/item/W, mob/user as mob, params)
..()
if(istype(W, /obj/item/robot_parts/l_arm) || istype(W, /obj/item/robot_parts/r_arm))
if(!user.unEquip(W))
if(!user.unequip(W))
return
qdel(W)
var/turf/T = get_turf(loc)
@@ -25,7 +25,7 @@
A.name = created_name
A.robot_arm = W.type
to_chat(user, "<span class='notice'>You add the robot arm to the bucket and sensor assembly. Beep boop!</span>")
user.unEquip(src, 1)
user.unequip(src, force = TRUE)
qdel(src)
else if(is_pen(W))
@@ -64,7 +64,7 @@
switch(build_step)
if(0,1)
if(istype(W, /obj/item/robot_parts/l_leg) || istype(W, /obj/item/robot_parts/r_leg))
if(!user.unEquip(W))
if(!user.unequip(W))
return
qdel(W)
build_step++
@@ -78,7 +78,7 @@
else if(istype(W, /obj/item/clothing/suit/bluetag))
newcolor = "b"
if(newcolor || istype(W, /obj/item/clothing/suit/armor/vest))
if(!user.unEquip(W))
if(!user.unequip(W))
return
lasercolor = newcolor
qdel(W)
@@ -105,7 +105,7 @@
if(!istype(W, /obj/item/clothing/head/helmet))
return
if(!user.unEquip(W))
if(!user.unequip(W))
return
qdel(W)
build_step++
@@ -114,7 +114,7 @@
if(5)
if(isprox(W))
if(!user.unEquip(W))
if(!user.unequip(W))
return
qdel(W)
build_step++
@@ -153,7 +153,7 @@
new_name = "disabler ED-209 assembly"
else
return
if(!user.unEquip(W))
if(!user.unequip(W))
return
build_step++
to_chat(user, "<span class='notice'>You add [W] to [src].</span>")
@@ -166,14 +166,14 @@
if(9)
if(istype(W, /obj/item/stock_parts/cell))
if(!user.unEquip(W))
if(!user.unequip(W))
return
build_step++
to_chat(user, "<span class='notice'>You complete the ED-209.</span>")
var/turf/T = get_turf(src)
new /mob/living/simple_animal/bot/ed209(T,created_name,lasercolor)
qdel(W)
user.unEquip(src, 1)
user.unequip(src, force = TRUE)
qdel(src)
/obj/item/ed209_assembly/screwdriver_act(mob/living/user, obj/item/I)
@@ -280,7 +280,7 @@
B.update_icon(UPDATE_ICON_STATE)
user.put_in_hands(B)
to_chat(user, "<span class='notice'>You add the tiles into the empty toolbox. They protrude from the top.</span>")
user.unEquip(src, 1)
user.unequip(src, force = TRUE)
qdel(src)
else
to_chat(user, "<span class='warning'>You need 10 floor tiles to start building a floorbot.</span>")
@@ -299,7 +299,7 @@
B.update_icon(UPDATE_ICON_STATE)
user.put_in_hands(B)
to_chat(user, "<span class='notice'>You add the sensor to the toolbox and tiles.</span>")
user.unEquip(src, 1)
user.unequip(src, force = TRUE)
qdel(src)
else if(is_pen(W))
@@ -321,7 +321,7 @@
A.name = created_name
A.robot_arm = W.type
to_chat(user, "<span class='notice'>You add the robot arm to the odd looking toolbox assembly. Boop beep!</span>")
user.unEquip(src, 1)
user.unequip(src, force = TRUE)
qdel(src)
//Medbot Assembly
@@ -349,7 +349,7 @@
qdel(I)
user.put_in_hands(A)
to_chat(user, "<span class='notice'>You add the robot arm to the first aid kit.</span>")
user.unEquip(src, 1)
user.unequip(src, force = TRUE)
qdel(src)
/obj/item/firstaid_arm_assembly
@@ -423,7 +423,7 @@
S.robot_arm = robot_arm
else
new /mob/living/simple_animal/bot/medbot/syndicate(T) //Syndicate medibots are a special case that have so many unique vars on them, it's not worth passing them through construction phases
user.unEquip(src, 1)
user.unequip(src, force = TRUE)
qdel(src)
/obj/item/firstaid_arm_assembly/update_name()
@@ -455,7 +455,7 @@
var/obj/item/secbot_assembly/A = new /obj/item/secbot_assembly
user.put_in_hands(A)
to_chat(user, "<span class='notice'>You add the signaler to the helmet.</span>")
user.unEquip(src, 1)
user.unequip(src, force = TRUE)
qdel(src)
@@ -470,14 +470,14 @@
to_chat(user, "<span class='notice'>You weld the hole in [src] shut!</span>")
else if(isprox(I) && (build_step == 1))
if(!user.unEquip(I))
if(!user.unequip(I))
return
build_step++
to_chat(user, "<span class='notice'>You add the prox sensor to [src]!</span>")
qdel(I)
else if(((istype(I, /obj/item/robot_parts/l_arm)) || (istype(I, /obj/item/robot_parts/r_arm))) && (build_step == 2))
if(!user.unEquip(I))
if(!user.unequip(I))
return
build_step++
to_chat(user, "<span class='notice'>You add the robot arm to [src]!</span>")
@@ -485,7 +485,7 @@
qdel(I)
else if((istype(I, /obj/item/melee/baton)) && (build_step >= 3))
if(!user.unEquip(I))
if(!user.unequip(I))
return
build_step++
to_chat(user, "<span class='notice'>You complete the Securitron! Beep boop.</span>")
@@ -509,7 +509,7 @@
var/obj/item/griefsky_assembly/A = new /obj/item/griefsky_assembly(get_turf(src))
user.put_in_hands(A)
to_chat(user, "<span class='notice'>You adjust the arm slots for extra weapons!</span>")
user.unEquip(src, 1)
user.unequip(src, force = TRUE)
qdel(src)
update_appearance(UPDATE_NAME|UPDATE_OVERLAYS)
@@ -567,14 +567,14 @@
/obj/item/griefsky_assembly/attackby__legacy__attackchain(obj/item/I, mob/user, params)
..()
if((istype(I, /obj/item/melee/energy/sword)) && (build_step < 3))
if(!user.unEquip(I))
if(!user.unequip(I))
return
build_step++
to_chat(user, "<span class='notice'>You add an energy sword to [src]!.</span>")
qdel(I)
else if((istype(I, /obj/item/melee/energy/sword)) && (build_step == 3))
if(!user.unEquip(I))
if(!user.unequip(I))
return
to_chat(user, "<span class='notice'>You complete General Griefsky!.</span>")
new /mob/living/simple_animal/bot/secbot/griefsky(get_turf(src))
@@ -582,14 +582,14 @@
qdel(src)
else if((istype(I, /obj/item/toy/sword)) && (toy_step < 3))
if(!user.unEquip(I))
if(!user.unequip(I))
return
toy_step++
to_chat(user, "<span class='notice'>You add a toy sword to [src]!.</span>")
qdel(I)
else if((istype(I, /obj/item/toy/sword)) && (toy_step == 3))
if(!user.unEquip(I))
if(!user.unequip(I))
return
to_chat(user, "<span class='notice'>You complete Genewul Giftskee!.</span>")
new /mob/living/simple_animal/bot/secbot/griefsky/toy(get_turf(src))
@@ -626,7 +626,7 @@
qdel(W)
user.put_in_hands(A)
to_chat(user, "<span class='notice'>You add the robot arm to the honkbot.</span>")
user.unEquip(src, 1)
user.unequip(src, force = TRUE)
qdel(src)
/obj/item/honkbot_arm_assembly
@@ -644,21 +644,21 @@
..()
if(build_step == 0)
if(istype(W, /obj/item/assembly/prox_sensor))
if(!user.unEquip(W))
if(!user.unequip(W))
return
build_step++
to_chat(user, "<span class='notice'>You add the proximity sensor to [src].</span>")
qdel(W)
else if(build_step == 1)
if(istype(W, /obj/item/bikehorn))
if(!user.unEquip(W))
if(!user.unequip(W))
return
build_step++
to_chat(user, "<span class='notice'>You add the bikehorn to [src]! Honk!</span>")
qdel(W)
else if(build_step == 2)
if(istype(W, /obj/item/instrument/trombone))
if(!user.unEquip(W))
if(!user.unequip(W))
return
to_chat(user, "<span class='notice'>You add the trombone to [src]! Heeeenk!</span>")
qdel(W)
@@ -210,7 +210,7 @@
ADD_TRAIT(adult.mind, TRAIT_XENOBIO_SPAWNED_HUMAN, ROUNDSTART_TRAIT)
for(var/obj/item/W in contents)
unEquip(W)
drop_item_to_ground(W)
qdel(src)
return TRUE
@@ -224,7 +224,7 @@
return
return
if(user && !user.unEquip(item_to_add))
if(user && !user.drop_item_to_ground(item_to_add))
to_chat(user, "<span class='warning'>\The [item_to_add] is stuck to your hand, you cannot put it on [src]'s head!</span>")
return 0
@@ -241,7 +241,7 @@
mind.transfer_to(C)
if(pcollar)
var/the_collar = pcollar
unEquip(pcollar)
drop_item_to_ground(pcollar)
C.add_collar(the_collar)
qdel(src)
@@ -99,7 +99,7 @@
adult.real_name = adult.dna.species.get_random_name()
adult.name = adult.real_name
for(var/obj/item/W in contents)
unEquip(W)
drop_item_to_ground(W)
qdel(src)
return TRUE
@@ -470,7 +470,7 @@ Difficulty: Hard
/mob/living/simple_animal/hostile/megafauna/hierophant/devour(mob/living/L)
for(var/obj/item/W in L)
if(!L.unEquip(W))
if(!L.drop_item_to_ground(W))
qdel(W)
visible_message("<span class='hierophant_warning'>\"[pick(kill_phrases)]\"</span>")
visible_message("<span class='hierophant_warning'>[src] annihilates [L]!</span>","<span class='userdanger'>You annihilate [L], restoring your health!</span>")
@@ -582,7 +582,7 @@
if(C.r_hand && C.r_hand.w_class <= WEIGHT_CLASS_SMALL)
stolen_item = C.r_hand
if(stolen_item && C.unEquip(stolen_item))
if(stolen_item && C.drop_item_to_ground(stolen_item))
try_grab_item(stolen_item)
visible_message("<span class='notice'>[src] grabs [held_item] out of [C]'s hand!</span>", "<span class='notice'>You snag [held_item] out of [C]'s hand!</span>", "You hear the sounds of wings flapping furiously.")
return held_item
@@ -504,12 +504,12 @@
if(ITEM_SLOT_COLLAR)
add_collar(W)
/mob/living/simple_animal/unEquip(obj/item/I, force, silent = FALSE)
/mob/living/simple_animal/unequip_to(obj/item/target, atom/destination, force = FALSE, silent = FALSE, drop_inventory = TRUE, no_move = FALSE)
. = ..()
if(!. || !I)
if(!. || !target)
return
if(I == pcollar)
if(target == pcollar)
pcollar = null
regenerate_icons()
@@ -593,7 +593,7 @@
/mob/living/simple_animal/proc/add_collar(obj/item/petcollar/P, mob/user)
if(!istype(P) || QDELETED(P) || pcollar)
return
if(user && !user.unEquip(P))
if(user && !user.drop_item_to_ground(P))
return
P.forceMove(src)
P.equipped(src)
@@ -611,7 +611,7 @@
var/obj/old_collar = pcollar
unEquip(pcollar)
drop_item_to_ground(pcollar)
if(user)
user.put_in_hands(old_collar)
@@ -266,7 +266,7 @@
return
return ..()
/mob/living/simple_animal/slime/unEquip(obj/item/I, force, silent = FALSE)
/mob/living/simple_animal/slime/unequip_to(obj/item/target, atom/destination, force = FALSE, silent = FALSE, drop_inventory = TRUE, no_move = FALSE)
return
/mob/living/simple_animal/slime/start_pulling(atom/movable/AM, state, force = pull_force, show_message = FALSE)
+1 -1
View File
@@ -49,7 +49,7 @@
var/mob/M = src.loc //Get our mob holder (if any).
if(istype(M))
M.unEquip(src)
M.drop_item_to_ground(src)
to_chat(M, "[src] wriggles out of your grip!")
to_chat(L, "You wriggle out of [M]'s grip!")
else if(isitem(loc))
+8 -8
View File
@@ -11,7 +11,7 @@
if(notransform)
return
for(var/obj/item/W in src)
unEquip(W)
drop_item_to_ground(W)
notransform = TRUE
icon = null
invisibility = 101
@@ -56,7 +56,7 @@
if(notransform)
return
for(var/obj/item/W in src)
unEquip(W)
drop_item_to_ground(W)
notransform = TRUE
icon = null
@@ -124,7 +124,7 @@
if(notransform)
return
for(var/obj/item/W in src)
unEquip(W)
drop_item_to_ground(W)
regenerate_icons()
notransform = TRUE
icon = null
@@ -154,7 +154,7 @@
return
notransform = TRUE
for(var/obj/item/I in src)
unEquip(I)
drop_item_to_ground(I)
regenerate_icons()
icon = null
invisibility = INVISIBILITY_MAXIMUM
@@ -185,7 +185,7 @@
if(notransform)
return
for(var/obj/item/W in src)
unEquip(W)
drop_item_to_ground(W)
regenerate_icons()
notransform = TRUE
icon = null
@@ -211,7 +211,7 @@
if(notransform)
return
for(var/obj/item/W in src)
unEquip(W)
drop_item_to_ground(W)
regenerate_icons()
notransform = TRUE
@@ -250,7 +250,7 @@
if(notransform)
return
for(var/obj/item/W in src)
unEquip(W)
drop_item_to_ground(W)
regenerate_icons()
notransform = TRUE
icon = null
@@ -279,7 +279,7 @@
return
for(var/obj/item/W in get_all_slots())
unEquip(W)
drop_item_to_ground(W)
regenerate_icons()
notransform = TRUE