From 870ef7bf91e59e285a5f563df89d93550f76163d Mon Sep 17 00:00:00 2001 From: hal9000PR Date: Sat, 20 Nov 2021 12:32:43 +0000 Subject: [PATCH] fix and refactor --- code/game/objects/structures/bedsheet_bin.dm | 27 ++++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/code/game/objects/structures/bedsheet_bin.dm b/code/game/objects/structures/bedsheet_bin.dm index 9c517f39c69..9cceefc1448 100644 --- a/code/game/objects/structures/bedsheet_bin.dm +++ b/code/game/objects/structures/bedsheet_bin.dm @@ -242,6 +242,12 @@ LINEN BINS var/list/sheets = list() var/obj/item/hidden = null +/obj/structure/bedsheetbin/Destroy() + QDEL_LIST(sheets) + hidden.forceMove(get_turf(src)) + hidden = null + return ..() + /obj/structure/bedsheetbin/examine(mob/user) . = ..() @@ -255,9 +261,12 @@ LINEN BINS /obj/structure/bedsheetbin/update_icon() switch(amount) - if(0) icon_state = "linenbin-empty" - if(1 to amount / 2) icon_state = "linenbin-half" - else icon_state = "linenbin-full" + if(0) + icon_state = "linenbin-empty" + if(1 to amount / 2) + icon_state = "linenbin-half" + else + icon_state = "linenbin-full" /obj/structure/bedsheetbin/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume, global_overlay = TRUE) @@ -271,22 +280,24 @@ LINEN BINS extinguish() update_icon() -/obj/structure/bedsheetbin/attackby(obj/item/I as obj, mob/user as mob, params) +/obj/structure/bedsheetbin/attackby(obj/item/I, mob/user, params) if(istype(I, /obj/item/bedsheet)) user.drop_item() - I.loc = src + I.forceMove(src) sheets.Add(I) amount++ to_chat(user, "You put [I] in [src].") else if(amount && !hidden && I.w_class < WEIGHT_CLASS_BULKY) //make sure there's sheets to hide it among, make sure nothing else is hidden in there. + if(I.flags & ABSTRACT) + return user.drop_item() - I.loc = src + I.forceMove(src) hidden = I to_chat(user, "You hide [I] among the sheets.") -/obj/structure/bedsheetbin/attack_hand(mob/user as mob) +/obj/structure/bedsheetbin/attack_hand(mob/user) if(amount >= 1) amount-- @@ -311,7 +322,7 @@ LINEN BINS add_fingerprint(user) -/obj/structure/bedsheetbin/attack_tk(mob/user as mob) +/obj/structure/bedsheetbin/attack_tk(mob/user) if(amount >= 1) amount--