From cdfce64ad065330d2b930d1f5e24845472ab3892 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Mon, 30 Mar 2015 22:05:00 -0400 Subject: [PATCH] Replaces uses of u_equip() with remove_from_mob() or drop_from_inventory(), where appropriate. --- .../gamemodes/changeling/changeling_powers.dm | 8 +--- code/game/gamemodes/cult/runes.dm | 2 +- code/game/machinery/bots/farmbot.dm | 10 ++--- .../machinery/computer/HolodeckControl.dm | 2 +- .../computer3/computers/HolodeckControl.dm | 2 +- code/game/objects/items/ashtray.dm | 2 +- .../objects/items/weapons/cigs_lighters.dm | 2 +- .../objects/items/weapons/gift_wrappaper.dm | 2 +- .../items/weapons/implants/implanter.dm | 2 +- .../objects/items/weapons/storage/bags.dm | 2 +- .../objects/items/weapons/storage/storage.dm | 2 +- code/game/objects/items/weapons/tools.dm | 6 +-- .../structures/stool_bed_chair_nest/stools.dm | 4 +- code/modules/admin/topic.dm | 32 +++------------ code/modules/destilery/main.dm | 8 ++-- code/modules/mining/satchel_ore_boxdm.dm | 2 +- code/modules/mob/inventory.dm | 1 + code/modules/mob/living/carbon/carbon.dm | 13 ++---- .../mob/living/carbon/human/human_defense.dm | 2 +- .../mob/living/carbon/monkey/inventory.dm | 40 +++---------------- code/modules/organs/organ_external.dm | 4 +- code/modules/power/antimatter/control.dm | 4 +- .../reagent_containers/food/snacks.dm | 4 +- .../reagents/reagent_containers/syringes.dm | 2 +- 24 files changed, 45 insertions(+), 113 deletions(-) diff --git a/code/game/gamemodes/changeling/changeling_powers.dm b/code/game/gamemodes/changeling/changeling_powers.dm index 8d15141df1..2d7ef7c020 100644 --- a/code/game/gamemodes/changeling/changeling_powers.dm +++ b/code/game/gamemodes/changeling/changeling_powers.dm @@ -388,13 +388,7 @@ del(animation) for(var/obj/item/W in src) - C.u_equip(W) - if (C.client) - C.client.screen -= W - if (W) - W.loc = C.loc - W.dropped(C) - W.layer = initial(W.layer) + C.drop_from_inventory(W) var/mob/living/carbon/human/O = new /mob/living/carbon/human( src ) if (C.dna.GetUIState(DNA_UI_GENDER)) diff --git a/code/game/gamemodes/cult/runes.dm b/code/game/gamemodes/cult/runes.dm index 88e16dbe46..2c2ca5b21b 100644 --- a/code/game/gamemodes/cult/runes.dm +++ b/code/game/gamemodes/cult/runes.dm @@ -798,7 +798,7 @@ var/list/sacrificed = list() if (cultist.legcuffed) cultist.drop_from_inventory(cultist.legcuffed) if (istype(cultist.wear_mask, /obj/item/clothing/mask/muzzle)) - cultist.u_equip(cultist.wear_mask) + cultist.drop_from_inventory(cultist.wear_mask) if(istype(cultist.loc, /obj/structure/closet)&&cultist.loc:welded) cultist.loc:welded = 0 if(istype(cultist.loc, /obj/structure/closet/secure_closet)&&cultist.loc:locked) diff --git a/code/game/machinery/bots/farmbot.dm b/code/game/machinery/bots/farmbot.dm index 4db416e7a6..812d8bb334 100644 --- a/code/game/machinery/bots/farmbot.dm +++ b/code/game/machinery/bots/farmbot.dm @@ -542,7 +542,7 @@ A.loc = src.loc user << "You add the robot arm to the [src]" src.loc = A //Place the water tank into the assembly, it will be needed for the finished bot - user.u_equip(S) + user.remove_from_mob(S) del(S) /obj/item/weapon/farmbot_arm_assembly/attackby(obj/item/weapon/W as obj, mob/user as mob) @@ -551,21 +551,21 @@ src.build_step++ user << "You add the plant analyzer to [src]!" src.name = "farmbot assembly" - user.u_equip(W) + user.remove_from_mob(W) del(W) else if(( istype(W, /obj/item/weapon/reagent_containers/glass/bucket)) && (src.build_step == 1)) src.build_step++ user << "You add a bucket to [src]!" src.name = "farmbot assembly with bucket" - user.u_equip(W) + user.remove_from_mob(W) del(W) else if(( istype(W, /obj/item/weapon/minihoe)) && (src.build_step == 2)) src.build_step++ user << "You add a minihoe to [src]!" src.name = "farmbot assembly with bucket and minihoe" - user.u_equip(W) + user.remove_from_mob(W) del(W) else if((isprox(W)) && (src.build_step == 3)) @@ -577,7 +577,7 @@ S.tank = wTank S.loc = get_turf(src) S.name = src.created_name - user.u_equip(W) + user.remove_from_mob(W) del(W) del(src) diff --git a/code/game/machinery/computer/HolodeckControl.dm b/code/game/machinery/computer/HolodeckControl.dm index e6075cb5a9..40a403a35f 100644 --- a/code/game/machinery/computer/HolodeckControl.dm +++ b/code/game/machinery/computer/HolodeckControl.dm @@ -233,7 +233,7 @@ var/global/list/holodeck_programs = list( if(isobj(obj)) var/mob/M = obj.loc if(ismob(M)) - M.u_equip(obj) + M.remove_from_mob(obj) M.update_icons() //so their overlays update if(!silent) diff --git a/code/game/machinery/computer3/computers/HolodeckControl.dm b/code/game/machinery/computer3/computers/HolodeckControl.dm index e650185f85..80d60afd07 100644 --- a/code/game/machinery/computer3/computers/HolodeckControl.dm +++ b/code/game/machinery/computer3/computers/HolodeckControl.dm @@ -154,7 +154,7 @@ if(isobj(obj)) var/mob/M = obj.loc if(ismob(M)) - M.u_equip(obj) + M.remove_from_mob(obj) M.update_icons() //so their overlays update if(!silent) diff --git a/code/game/objects/items/ashtray.dm b/code/game/objects/items/ashtray.dm index 1e48c49499..b2417f8af3 100644 --- a/code/game/objects/items/ashtray.dm +++ b/code/game/objects/items/ashtray.dm @@ -21,7 +21,7 @@ if (contents.len >= max_butts) user << "This ashtray is full." return - user.u_equip(W) + user.remove_from_mob(W) W.loc = src if (istype(W,/obj/item/clothing/mask/cigarette)) diff --git a/code/game/objects/items/weapons/cigs_lighters.dm b/code/game/objects/items/weapons/cigs_lighters.dm index 21c65905e4..da5ddfedbe 100644 --- a/code/game/objects/items/weapons/cigs_lighters.dm +++ b/code/game/objects/items/weapons/cigs_lighters.dm @@ -198,7 +198,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM if(ismob(loc)) var/mob/living/M = loc M << "Your [name] goes out." - M.u_equip(src) //un-equip it so the overlays can update + M.remove_from_mob(src) //un-equip it so the overlays can update M.update_inv_wear_mask(0) processing_objects.Remove(src) del(src) diff --git a/code/game/objects/items/weapons/gift_wrappaper.dm b/code/game/objects/items/weapons/gift_wrappaper.dm index e96d036721..b88832729e 100644 --- a/code/game/objects/items/weapons/gift_wrappaper.dm +++ b/code/game/objects/items/weapons/gift_wrappaper.dm @@ -109,7 +109,7 @@ if(!ispath(gift_type,/obj/item)) return var/obj/item/I = new gift_type(M) - M.u_equip(src) + M.remove_from_mob(src) M.put_in_hands(I) I.add_fingerprint(M) del(src) diff --git a/code/game/objects/items/weapons/implants/implanter.dm b/code/game/objects/items/weapons/implants/implanter.dm index 19cb00b999..e2f0382d01 100644 --- a/code/game/objects/items/weapons/implants/implanter.dm +++ b/code/game/objects/items/weapons/implants/implanter.dm @@ -123,7 +123,7 @@ c.scanned = A if(istype(A.loc,/mob/living/carbon/human)) var/mob/living/carbon/human/H = A.loc - H.u_equip(A) + H.remove_from_mob(A) else if(istype(A.loc,/obj/item/weapon/storage)) var/obj/item/weapon/storage/S = A.loc S.remove_from_storage(A) diff --git a/code/game/objects/items/weapons/storage/bags.dm b/code/game/objects/items/weapons/storage/bags.dm index 88db6abd3e..f6c49b0fe6 100644 --- a/code/game/objects/items/weapons/storage/bags.dm +++ b/code/game/objects/items/weapons/storage/bags.dm @@ -156,7 +156,7 @@ break if(!inserted || !S.amount) - usr.u_equip(S) + usr.remove_from_mob(S) usr.update_icons() //update our overlays if (usr.client && usr.s_active != src) usr.client.screen -= S diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm index 2e1d4d2a4c..c32dedbefa 100644 --- a/code/game/objects/items/weapons/storage/storage.dm +++ b/code/game/objects/items/weapons/storage/storage.dm @@ -256,7 +256,7 @@ /obj/item/weapon/storage/proc/handle_item_insertion(obj/item/W as obj, prevent_warning = 0) if(!istype(W)) return 0 if(usr) - usr.u_equip(W) + usr.remove_from_mob(W) usr.update_icons() //update our overlays W.loc = src W.on_enter_storage(src) diff --git a/code/game/objects/items/weapons/tools.dm b/code/game/objects/items/weapons/tools.dm index 14f9ad482a..f8618a89df 100644 --- a/code/game/objects/items/weapons/tools.dm +++ b/code/game/objects/items/weapons/tools.dm @@ -188,12 +188,12 @@ if (user.client) user.client.screen -= src if (user.r_hand == src) - user.u_equip(src) + user.remove_from_mob(src) else - user.u_equip(src) + user.remove_from_mob(src) src.master = F src.layer = initial(src.layer) - user.u_equip(src) + user.remove_from_mob(src) if (user.client) user.client.screen -= src src.loc = F diff --git a/code/game/objects/structures/stool_bed_chair_nest/stools.dm b/code/game/objects/structures/stool_bed_chair_nest/stools.dm index 027d382795..d898c82961 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/stools.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/stools.dm @@ -61,7 +61,7 @@ origin.loc = get_turf(src) if(user) - user.u_equip(src) + user.remove_from_mob(src) user.visible_message("\blue [user] puts [src] down.", "\blue You put [src] down.") del src @@ -78,7 +78,7 @@ /obj/item/weapon/stool/attack(mob/M as mob, mob/user as mob) if (prob(5) && istype(M,/mob/living)) user.visible_message("\red [user] breaks [src] over [M]'s back!") - user.u_equip(src) + user.remove_from_mob(src) var/obj/item/stack/sheet/metal/m = new/obj/item/stack/sheet/metal m.loc = get_turf(src) del src diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 1d5e0f7b05..a5c866b7ee 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1054,11 +1054,7 @@ //strip their stuff and stick it in the crate for(var/obj/item/I in M) - M.u_equip(I) - if(I) - I.loc = locker - I.layer = initial(I.layer) - I.dropped(M) + M.drop_from_inventory(I, locker) M.update_icons() //so they black out before warping @@ -1091,11 +1087,7 @@ return for(var/obj/item/I in M) - M.u_equip(I) - if(I) - I.loc = M.loc - I.layer = initial(I.layer) - I.dropped(M) + M.drop_from_inventory(I) M.Paralyse(5) sleep(5) @@ -1120,11 +1112,7 @@ return for(var/obj/item/I in M) - M.u_equip(I) - if(I) - I.loc = M.loc - I.layer = initial(I.layer) - I.dropped(M) + M.drop_from_inventory(I) M.Paralyse(5) sleep(5) @@ -1171,11 +1159,7 @@ return for(var/obj/item/I in M) - M.u_equip(I) - if(I) - I.loc = M.loc - I.layer = initial(I.layer) - I.dropped(M) + M.drop_from_inventory(I) if(istype(M, /mob/living/carbon/human)) var/mob/living/carbon/human/observer = M @@ -1961,13 +1945,7 @@ if(istype(W, /datum/organ/external)) continue //don't strip organs - H.u_equip(W) - if (H.client) - H.client.screen -= W - if (W) - W.loc = H.loc - W.dropped(H) - W.layer = initial(W.layer) + H.drop_from_inventory(W) //teleport person to cell H.loc = pick(prisonwarp) H.equip_to_slot_or_del(new /obj/item/clothing/under/color/orange(H), slot_w_uniform) diff --git a/code/modules/destilery/main.dm b/code/modules/destilery/main.dm index e6944724aa..ccceda5833 100644 --- a/code/modules/destilery/main.dm +++ b/code/modules/destilery/main.dm @@ -58,7 +58,7 @@ /obj/machinery/mill/attackby(var/obj/item/weapon/W as obj, mob/user as mob) if(istype(W,/obj/item/weapon/reagent_containers/food)) - user.u_equip(W) + user.remove_from_mob(W) W.loc = src input += W else @@ -128,7 +128,7 @@ /obj/machinery/fermenter/attackby(var/obj/item/weapon/W as obj, mob/user as mob) if(istype(W,/obj/item/weapon/reagent_containers/food)) - user.u_equip(W) + user.remove_from_mob(W) W.loc = src input += W else @@ -189,7 +189,7 @@ /obj/machinery/still/attackby(var/obj/item/weapon/W as obj, mob/user as mob) if(istype(W,/obj/item/weapon/reagent_containers/food)) - user.u_equip(W) + user.remove_from_mob(W) W.loc = src input += W else @@ -274,7 +274,7 @@ /obj/machinery/centrifuge/attackby(var/obj/item/weapon/W as obj, mob/user as mob) if(istype(W,/obj/item/weapon/reagent_containers/food)) - user.u_equip(W) + user.remove_from_mob(W) W.loc = src input += W else diff --git a/code/modules/mining/satchel_ore_boxdm.dm b/code/modules/mining/satchel_ore_boxdm.dm index eb59630915..5428f3f6c0 100644 --- a/code/modules/mining/satchel_ore_boxdm.dm +++ b/code/modules/mining/satchel_ore_boxdm.dm @@ -12,7 +12,7 @@ /obj/structure/ore_box/attackby(obj/item/weapon/W as obj, mob/user as mob) if (istype(W, /obj/item/weapon/ore)) - user.u_equip(W) + user.remove_from_mob(W) src.contents += W if (istype(W, /obj/item/weapon/storage)) var/obj/item/weapon/storage/S = W diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 34423228f4..55204634e8 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -173,6 +173,7 @@ var/list/slot_equipment_priority = list( \ //Removes the object from any slots the mob might have, calling the appropriate icon update proc. //Does nothing else. //DO NOT CALL THIS PROC DIRECTLY. It is meant to be called only by other inventory procs. +//The only exception to this is if you are transferring the item between slots on the same mob. //As far as I can tell the proc exists so that mobs with different inventory slots can override //the search through all the slots, without having to duplicate the rest of the item dropping. /mob/proc/u_equip(obj/W as obj) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index b1170468d8..7db6a2fe29 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -301,16 +301,9 @@ if(!item) return //Grab processing has a chance of returning null - item.layer = initial(item.layer) - u_equip(item) - update_icons() - - if (istype(usr, /mob/living/carbon)) //Check if a carbon mob is throwing. Modify/remove this line as required. - item.loc = src.loc - if(src.client) - src.client.screen -= item - if(istype(item, /obj/item)) - item:dropped(src) // let it know it's been dropped + + src.remove_from_mob(item) + item.loc = src.loc //actually throw it! if (item) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index de42bb0bfc..ebe84fa6d1 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -73,7 +73,7 @@ emp_act if(c_hand && (stun_amount || agony_amount > 10)) msg_admin_attack("[src.name] ([src.ckey]) was disarmed by a stun effect") - u_equip(c_hand) + drop_from_inventory(c_hand) if (affected.status & ORGAN_ROBOT) emote("me", 1, "drops what they were holding, their [affected.display_name] malfunctioning!") else diff --git a/code/modules/mob/living/carbon/monkey/inventory.dm b/code/modules/mob/living/carbon/monkey/inventory.dm index adeb4f903a..623b9a9d77 100644 --- a/code/modules/mob/living/carbon/monkey/inventory.dm +++ b/code/modules/mob/living/carbon/monkey/inventory.dm @@ -81,13 +81,7 @@ if(istype(target.wear_mask, /obj/item/clothing)&& !target.wear_mask:canremove) return var/obj/item/W = target.wear_mask - target.u_equip(W) - if (target.client) - target.client.screen -= W - if (W) - W.loc = target.loc - W.dropped(target) - W.layer = initial(W.layer) + target.drop_from_inventory(W) W.add_fingerprint(source) else if (istype(item, /obj/item/clothing/mask)) @@ -99,13 +93,7 @@ if("l_hand") if (target.l_hand) var/obj/item/W = target.l_hand - target.u_equip(W) - if (target.client) - target.client.screen -= W - if (W) - W.loc = target.loc - W.layer = initial(W.layer) - W.dropped(target) + target.drop_from_inventory(W) W.add_fingerprint(source) else if (istype(item, /obj/item)) @@ -119,13 +107,7 @@ if("r_hand") if (target.r_hand) var/obj/item/W = target.r_hand - target.u_equip(W) - if (target.client) - target.client.screen -= W - if (W) - W.loc = target.loc - W.layer = initial(W.layer) - W.dropped(target) + target.drop_from_inventory(W) W.add_fingerprint(source) else if (istype(item, /obj/item)) @@ -139,13 +121,7 @@ if("back") if (target.back) var/obj/item/W = target.back - target.u_equip(W) - if (target.client) - target.client.screen -= W - if (W) - W.loc = target.loc - W.dropped(target) - W.layer = initial(W.layer) + target.target.drop_from_inventory(W) W.add_fingerprint(source) else if ((istype(item, /obj/item) && item.slot_flags & SLOT_BACK )) @@ -157,13 +133,7 @@ if("handcuff") if (target.handcuffed) var/obj/item/W = target.handcuffed - target.u_equip(W) - if (target.client) - target.client.screen -= W - if (W) - W.loc = target.loc - W.dropped(target) - W.layer = initial(W.layer) + target.target.drop_from_inventory(W) W.add_fingerprint(source) else if (istype(item, /obj/item/weapon/handcuffs)) diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index a49ff2c408..e4506d8566 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -828,11 +828,11 @@ Note that amputating the affected organ does in fact remove the infection from t return if(is_broken()) - owner.u_equip(c_hand) + owner.drop_from_inventory(c_hand) var/emote_scream = pick("screams in pain and ", "lets out a sharp cry and ", "cries out and ") owner.emote("me", 1, "[(owner.species && owner.species.flags & NO_PAIN) ? "" : emote_scream ]drops what they were holding in their [hand_name]!") if(is_malfunctioning()) - owner.u_equip(c_hand) + owner.drop_from_inventory(c_hand) owner.emote("me", 1, "drops what they were holding, their [hand_name] malfunctioning!") var/datum/effect/effect/system/spark_spread/spark_system = new /datum/effect/effect/system/spark_spread() spark_system.set_up(5, 0, owner) diff --git a/code/modules/power/antimatter/control.dm b/code/modules/power/antimatter/control.dm index b6eb7915d2..1e99ad873a 100644 --- a/code/modules/power/antimatter/control.dm +++ b/code/modules/power/antimatter/control.dm @@ -171,10 +171,8 @@ user << "\red There is already a [fueljar] inside!" return fueljar = W + user.remove_from_mob(W) W.loc = src - if(user.client) - user.client.screen -= W - user.u_equip(W) user.update_icons() user.visible_message("[user.name] loads an [W.name] into the [src.name].", \ "You load an [W.name].", \ diff --git a/code/modules/reagents/reagent_containers/food/snacks.dm b/code/modules/reagents/reagent_containers/food/snacks.dm index 7aaad7a678..0ce1f1ee21 100644 --- a/code/modules/reagents/reagent_containers/food/snacks.dm +++ b/code/modules/reagents/reagent_containers/food/snacks.dm @@ -165,9 +165,7 @@ return user << "\red You slip [W] inside [src]." - user.u_equip(W) - if ((user.client && user.s_active != src)) - user.client.screen -= W + user.remove_from_mob(W) W.dropped(user) add_fingerprint(user) contents += W diff --git a/code/modules/reagents/reagent_containers/syringes.dm b/code/modules/reagents/reagent_containers/syringes.dm index 744e212e78..ccbbce738b 100644 --- a/code/modules/reagents/reagent_containers/syringes.dm +++ b/code/modules/reagents/reagent_containers/syringes.dm @@ -250,7 +250,7 @@ if (target != user && target.getarmor(target_zone, "melee") > 5 && prob(50)) for(var/mob/O in viewers(world.view, user)) O.show_message(text("\red [user] tries to stab [target] in \the [hit_area] with [src.name], but the attack is deflected by armor!"), 1) - user.u_equip(src) + user.remove_from_mob(src) del(src) return