diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm
index 1d24074caa..1dcdef8f03 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -147,11 +147,8 @@
src.throwing = 0
if (src.loc == user)
- //canremove==0 means that object may not be removed. You can still wear it. This only applies to clothing. /N
- if(!src.canremove)
+ if(!user.unEquip(src))
return
- else
- user.u_equip(src)
else
if(isliving(src.loc))
return
@@ -161,7 +158,6 @@
src.pickup(user)
return
-
/obj/item/attack_ai(mob/user as mob)
if (istype(src.loc, /obj/item/weapon/robot_module))
//If the item is part of a cyborg module, equip it
diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm
index 495d4d7516..70c387da9c 100644
--- a/code/game/objects/items/weapons/storage/storage.dm
+++ b/code/game/objects/items/weapons/storage/storage.dm
@@ -30,7 +30,7 @@
if (ishuman(usr) || issmall(usr)) //so monkeys can take off their backpacks -- Urist
- if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech
+ if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech. why?
return
if(over_object == usr && Adjacent(usr)) // this must come before the screen objects only block
@@ -44,18 +44,21 @@
//there's got to be a better way of doing this.
if (!(src.loc == usr) || (src.loc && src.loc.loc == usr))
return
-
- if (!( usr.restrained() ) && !( usr.stat ))
- switch(over_object.name)
- if("r_hand")
- usr.u_equip(src)
- usr.put_in_r_hand(src)
- if("l_hand")
- usr.u_equip(src)
- usr.put_in_l_hand(src)
- src.add_fingerprint(usr)
+
+ if (( usr.restrained() ) || ( usr.stat ))
return
- return
+
+ if ((src.loc == usr) && !usr.unEquip(src))
+ return
+
+ switch(over_object.name)
+ if("r_hand")
+ usr.u_equip(src)
+ usr.put_in_r_hand(src)
+ if("l_hand")
+ usr.u_equip(src)
+ usr.put_in_l_hand(src)
+ src.add_fingerprint(usr)
/obj/item/weapon/storage/proc/return_inv()
diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm
index 2cd1450a97..7d442c2074 100644
--- a/code/modules/clothing/clothing.dm
+++ b/code/modules/clothing/clothing.dm
@@ -464,17 +464,18 @@ BLIND // can't see anything
if (!(src.loc == usr))
return
- if (!( usr.restrained() ) && !( usr.stat ))
- switch(over_object.name)
- if("r_hand")
- usr.u_equip(src)
- usr.put_in_r_hand(src)
- if("l_hand")
- usr.u_equip(src)
- usr.put_in_l_hand(src)
- src.add_fingerprint(usr)
+ if (( usr.restrained() ) || ( usr.stat ))
return
- return
+
+ if (!usr.unEquip(src))
+ return
+
+ switch(over_object.name)
+ if("r_hand")
+ usr.put_in_r_hand(src)
+ if("l_hand")
+ usr.put_in_l_hand(src)
+ src.add_fingerprint(usr)
/obj/item/clothing/under/examine(mob/user)
..(user)
diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm
index 026773b9c7..a8f6aac9fb 100644
--- a/code/modules/mob/inventory.dm
+++ b/code/modules/mob/inventory.dm
@@ -201,7 +201,7 @@ var/list/slot_equipment_priority = list( \
update_inv_wear_mask(0)
return
-//This differs from remove_from_mob() in that it checks canremove first.
+//This differs from remove_from_mob() in that it checks if the item can be unequipped first.
/mob/proc/unEquip(obj/item/I, force = 0) //Force overrides NODROP for things like wizarditis and admin undress.
if(!I) //If there's nothing to drop, the drop is automatically successful.
return 1
@@ -215,7 +215,7 @@ var/list/slot_equipment_priority = list( \
if(slot && !I.mob_can_unequip(src, slot))
return 0
- remove_from_mob(I)
+ drop_from_inventory(I)
return 1
//Attemps to remove an object on a mob. Will not move it to another area or such, just removes from the mob.
diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm
index 6ecaaa1704..d41baafa88 100644
--- a/code/modules/mob/living/carbon/human/inventory.dm
+++ b/code/modules/mob/living/carbon/human/inventory.dm
@@ -608,7 +608,7 @@ It can still be worn/put on as normal.
if ((source.restrained() || source.stat)) return //Source restrained or unconscious / dead
var/slot_to_process
- var/strip_item //this will tell us which item we will be stripping - if any.
+ var/obj/item/strip_item //this will tell us which item we will be stripping - if any.
switch(place) //here we go again...
if("mask")
@@ -790,17 +790,21 @@ It can still be worn/put on as normal.
target.internals.icon_state = "internal1"
if(slot_to_process)
if(strip_item) //Stripping an item from the mob
- var/obj/item/W = strip_item
- target.remove_from_mob(W)
- W.add_fingerprint(source)
- if(slot_to_process == slot_l_store) //pockets! Needs to process the other one too. Snowflake code, wooo! It's not like anyone will rewrite this anytime soon. If I'm wrong then... CONGRATULATIONS! ;)
- if(target.r_store)
- target.remove_from_mob(target.r_store) //At this stage l_store is already processed by the code above, we only need to process r_store.
- else
- if(item && target.has_organ_for_slot(slot_to_process)) //Placing an item on the mob
- if(item.mob_can_equip(target, slot_to_process, 0))
- source.remove_from_mob(item)
- target.equip_to_slot_if_possible(item, slot_to_process, 0, 1, 1)
+ if(strip_item.mob_can_unequip(target, slot_to_process, 0))
+ target.drop_from_inventory(strip_item)
+ source.put_in_hands(strip_item)
+ strip_item.add_fingerprint(source)
+ if(slot_to_process == slot_l_store) //pockets! Needs to process the other one too. Snowflake code, wooo! It's not like anyone will rewrite this anytime soon. If I'm wrong then... CONGRATULATIONS! ;)
+ if(target.r_store)
+ target.drop_from_inventory(target.r_store) //At this stage l_store is already processed by the code above, we only need to process r_store.
+ else
+ source << "You fail to remove \the [strip_item] from [target]!"
+ else if(item)
+ if(target.has_organ_for_slot(slot_to_process) && item.mob_can_equip(target, slot_to_process, 0)) //Placing an item on the mob
+ source.drop_from_inventory(item)
+ target.equip_to_slot_if_possible(item, slot_to_process, 0, 1, 1)
+ else
+ source << "You fail to place \the [item] on [target]!"
if(source && target)
if(source.machine == target)