refactored proc

This commit is contained in:
TDSSS
2021-02-27 00:39:53 +01:00
parent b2bf6ae1de
commit fd8e1a1a3e
+30 -16
View File
@@ -331,28 +331,42 @@
if(default_deconstruction_screwdriver(user, "panel", "close", I))
I.play_tool_sound(user, I.tool_volume)
/**
* Tries to store the item into whatever slot it can go, returns true if the item is stored successfully.
*
**/
/obj/machinery/suit_storage_unit/proc/store_item(obj/item/I, mob/user)
if(!user.canUnEquip(I))
return
. = FALSE
if(istype(I, /obj/item/clothing/suit) && !suit)
suit = I
. = TRUE
if(try_store_item(I, user))
suit = I
return TRUE
if(istype(I, /obj/item/clothing/head) && !helmet)
helmet = I
. = TRUE
if(try_store_item(I, user))
helmet = I
return TRUE
if(istype(I, /obj/item/clothing/mask) && !mask)
mask = I
. = TRUE
if(try_store_item(I, user))
mask = I
return TRUE
if(istype(I, /obj/item/clothing/shoes) && !boots)
boots = I
. = TRUE
if((istype(I, /obj/item/tank) || I.w_class <= WEIGHT_CLASS_SMALL) && !storage && !.)
storage = I
. = TRUE
if(.)
user.drop_item()
if(try_store_item(I, user))
boots = I
return TRUE
if((istype(I, /obj/item/tank) || I.w_class <= WEIGHT_CLASS_SMALL) && !storage)
if(try_store_item(I, user))
storage = I
return TRUE
return FALSE
/**
* Tries to store the item, returns true if it's moved successfully, false otherwise (because of nodrop etc)
*
**/
/obj/machinery/suit_storage_unit/proc/try_store_item(obj/item/I, mob/user)
if(user.drop_item())
I.forceMove(src)
return TRUE
return FALSE
/obj/machinery/suit_storage_unit/power_change()