From 2e89b7c718b5e4cf24549f7414fb98c7219bd173 Mon Sep 17 00:00:00 2001 From: PsiOmegaDelta Date: Wed, 30 Dec 2015 11:16:53 +0100 Subject: [PATCH] Fixes the canUnEquip() proc. It now only checks state, it doesn't change it. Fixes a number pf odd item/bag interactions. --- code/game/objects/items.dm | 2 +- code/game/objects/items/weapons/storage/storage.dm | 2 +- code/modules/mob/inventory.dm | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 240aa6783e3..3aa221400b7 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -206,7 +206,7 @@ else if(success) user << "You put some things in [S]." else - user << "You fail to pick anything up with [S]." + user << "You fail to pick anything up with \the [S]." else if(S.can_be_inserted(src)) S.handle_item_insertion(src) diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm index fd5e6874d00..3cb92b0a3c9 100644 --- a/code/game/objects/items/weapons/storage/storage.dm +++ b/code/game/objects/items/weapons/storage/storage.dm @@ -227,7 +227,7 @@ /obj/item/weapon/storage/proc/can_be_inserted(obj/item/W as obj, stop_messages = 0) if(!istype(W)) return //Not an item - if(!usr.canUnEquip(W)) + if(usr.isEquipped(W) && !usr.canUnEquip(W)) return 0 if(src.loc == W) diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index b2e8c3ca0e0..c998ad1bd07 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -216,19 +216,20 @@ var/list/slot_equipment_priority = list( \ wear_mask = null update_inv_wear_mask(0) return + +/mob/proc/isEquipped(obj/item/I) + if(!I) + return 0 + return get_inventory_slot(I) != 0 /mob/proc/canUnEquip(obj/item/I) if(!I) //If there's nothing to drop, the drop is automatically successful. return 1 var/slot = get_inventory_slot(I) - if(slot && !I.mob_can_unequip(src, slot)) - return 0 - - drop_from_inventory(I) - return 1 + return slot && I.mob_can_unequip(src, slot) /mob/proc/get_inventory_slot(obj/item/I) - var/slot + var/slot = 0 for(var/s in slot_back to slot_tie) //kind of worries me if(get_equipped_item(s) == I) slot = s