diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 4f62a9a01ed..55728fa2c03 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -271,6 +271,18 @@ /obj/item/proc/equipped(var/mob/user, var/slot) return +//returns 1 if the item is equipped by a mob, 0 otherwise. +//This might need some error trapping, not sure if get_equipped_items() is safe for non-human mobs. +/obj/item/proc/is_equipped() + if(!ismob(loc)) + return 0 + + var/mob/M = loc + if(src in M.get_equipped_items()) + return 1 + else + return 0 + //the mob M is attempting to equip this item into the slot passed through as 'slot'. Return 1 if it can do this and 0 if it can't. //If you are making custom procs but would like to retain partial or complete functionality of this one, include a 'return ..()' to where you want this to happen. //Set disable_warning to 1 if you wish it to not give you outputs. diff --git a/code/game/objects/items/weapons/storage/belt.dm b/code/game/objects/items/weapons/storage/belt.dm index daeae3bf901..86404cc54a4 100644 --- a/code/game/objects/items/weapons/storage/belt.dm +++ b/code/game/objects/items/weapons/storage/belt.dm @@ -10,12 +10,7 @@ /obj/item/weapon/storage/belt/proc/can_use() - if(!ismob(loc)) return 0 - var/mob/M = loc - if(src in M.get_equipped_items()) - return 1 - else - return 0 + return is_equipped() /obj/item/weapon/storage/belt/MouseDrop(obj/over_object as obj, src_location, over_location) diff --git a/code/modules/clothing/spacesuits/alien.dm b/code/modules/clothing/spacesuits/alien.dm index 97446a95d27..a2842397b39 100644 --- a/code/modules/clothing/spacesuits/alien.dm +++ b/code/modules/clothing/spacesuits/alien.dm @@ -155,17 +155,6 @@ species_restricted = list("Vox") action_button_name = "Toggle the magclaws" -//make sure these can only be used when equipped. -/obj/item/clothing/shoes/magboots/vox/proc/can_use() - if(!ismob(loc)) - return 0 - - var/mob/M = loc - if(src in M.get_equipped_items()) - return 1 - else - return 0 - /obj/item/clothing/shoes/magboots/vox/attack_self(mob/user) if(src.magpulse) flags &= ~NOSLIP @@ -173,7 +162,8 @@ canremove = 1 user << "You relax your deathgrip on the flooring." else - if (!can_use()) + //make sure these can only be used when equipped. + if (!is_equipped()) user << "You will have to put on the [src] before you can do that." return @@ -185,6 +175,7 @@ //In case they somehow come off while enabled. /obj/item/clothing/shoes/magboots/vox/dropped(mob/user as mob) + ..() if(src.magpulse) user.visible_message("The [src] go limp as they are removed from [usr]'s feet.", "The [src] go limp as they are removed from your feet.") flags &= ~NOSLIP