Adds calls to mob_can_unequip() where appropriate

This commit is contained in:
mwerezak
2015-04-25 02:28:49 -04:00
parent 3a00fce32b
commit 4829f1d82d
5 changed files with 45 additions and 41 deletions
+11 -10
View File
@@ -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)
+2 -2
View File
@@ -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.
@@ -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 << "<span class='warning'>You fail to remove \the [strip_item] from [target]!</span>"
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 << "<span class='warning'>You fail to place \the [item] on [target]!</span>"
if(source && target)
if(source.machine == target)