From e6a9e0888631c9e51f31c192dfcd737decd6d17a Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Tue, 11 Nov 2014 11:43:10 +0100 Subject: [PATCH] Shapely body bags. Body bags containing bodies now uses a previously unused icon_state with a more defined humanoid shape. --- code/game/objects/items/bodybag.dm | 86 ++++++++++--------- .../structures/crates_lockers/closets.dm | 30 ++++--- 2 files changed, 63 insertions(+), 53 deletions(-) diff --git a/code/game/objects/items/bodybag.dm b/code/game/objects/items/bodybag.dm index 574bfd19052..b1b46654bc5 100644 --- a/code/game/objects/items/bodybag.dm +++ b/code/game/objects/items/bodybag.dm @@ -40,54 +40,60 @@ var/item_path = /obj/item/bodybag density = 0 storage_capacity = (mob_size * 2) - 1 + var/contains_body = 0 - attackby(W as obj, mob/user as mob) - if (istype(W, /obj/item/weapon/pen)) - var/t = input(user, "What would you like the label to be?", text("[]", src.name), null) as text - if (user.get_active_hand() != W) - return - if (!in_range(src, user) && src.loc != user) - return - t = copytext(sanitize(t),1,MAX_MESSAGE_LEN) - if (t) - src.name = "body bag - " - src.name += t - src.overlays += image(src.icon, "bodybag_label") - else - src.name = "body bag" - //..() //Doesn't need to run the parent. Since when can fucking bodybags be welded shut? -Agouri +/obj/structure/closet/body_bag/attackby(W as obj, mob/user as mob) + if (istype(W, /obj/item/weapon/pen)) + var/t = input(user, "What would you like the label to be?", text("[]", src.name), null) as text + if (user.get_active_hand() != W) return - else if(istype(W, /obj/item/weapon/wirecutters)) - user << "You cut the tag off the bodybag" + if (!in_range(src, user) && src.loc != user) + return + t = copytext(sanitize(t),1,MAX_MESSAGE_LEN) + if (t) + src.name = "body bag - " + src.name += t + src.overlays += image(src.icon, "bodybag_label") + else src.name = "body bag" - src.overlays.Cut() - return + //..() //Doesn't need to run the parent. Since when can fucking bodybags be welded shut? -Agouri + return + else if(istype(W, /obj/item/weapon/wirecutters)) + user << "You cut the tag off the bodybag" + src.name = "body bag" + src.overlays.Cut() + return +/obj/structure/closet/body_bag/store_mobs(var/stored_units) + contains_body = ..() + return contains_body - close() - if(..()) - density = 0 - return 1 - return 0 +/obj/structure/closet/body_bag/close() + if(..()) + density = 0 + return 1 + return 0 +/obj/structure/closet/body_bag/MouseDrop(over_object, src_location, over_location) + ..() + if((over_object == usr && (in_range(src, usr) || usr.contents.Find(src)))) + if(!ishuman(usr)) return + if(opened) return 0 + if(contents.len) return 0 + visible_message("[usr] folds up the [src.name]") + new item_path(get_turf(src)) + spawn(0) + del(src) + return - MouseDrop(over_object, src_location, over_location) - ..() - if((over_object == usr && (in_range(src, usr) || usr.contents.Find(src)))) - if(!ishuman(usr)) return - if(opened) return 0 - if(contents.len) return 0 - visible_message("[usr] folds up the [src.name]") - new item_path(get_turf(src)) - spawn(0) - del(src) - return - -/obj/structure/closet/bodybag/update_icon() - if(!opened) - icon_state = icon_closed - else +/obj/structure/closet/body_bag/update_icon() + if(opened) icon_state = icon_opened + else + if(contains_body > 0) + icon_state = "bodybag_closed1" + else + icon_state = icon_closed /obj/item/bodybag/cryobag diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 637b7627067..3189b09a972 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -87,11 +87,11 @@ var/stored_units = 0 if(store_misc) - stored_units = store_misc(stored_units) + stored_units += store_misc(stored_units) if(store_items) - stored_units = store_items(stored_units) + stored_units += store_items(stored_units) if(store_mobs) - stored_units = store_mobs(stored_units) + stored_units += store_mobs(stored_units) src.icon_state = src.icon_closed src.opened = 0 @@ -102,26 +102,29 @@ //Cham Projector Exception /obj/structure/closet/proc/store_misc(var/stored_units) + var/added_units = 0 for(var/obj/effect/dummy/chameleon/AD in src.loc) - if(stored_units > storage_capacity) + if((stored_units + added_units) > storage_capacity) break AD.loc = src - stored_units++ - return stored_units + added_units++ + return added_units /obj/structure/closet/proc/store_items(var/stored_units) + var/added_units = 0 for(var/obj/item/I in src.loc) var/item_size = Ceiling(I.w_class / 2) - if(stored_units + item_size > storage_capacity) + if(stored_units + added_units + item_size > storage_capacity) continue if(!I.anchored) I.loc = src - stored_units += item_size - return stored_units + added_units += item_size + return added_units /obj/structure/closet/proc/store_mobs(var/stored_units) + var/added_units = 0 for(var/mob/M in src.loc) - if(stored_units + mob_size > storage_capacity) + if(stored_units + added_units + mob_size > storage_capacity) break if(istype (M, /mob/dead/observer)) continue @@ -133,13 +136,14 @@ M.client.eye = src M.loc = src - stored_units += mob_size - return stored_units + added_units += mob_size + return added_units /obj/structure/closet/proc/toggle(mob/user as mob) if(!(src.opened ? src.close() : src.open())) user << "It won't budge!" - return + return + update_icon() // this should probably use dump_contents() /obj/structure/closet/ex_act(severity)