diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index 8ab3dd0b966..dbce1932045 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -331,26 +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) - . = 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()