Merge pull request #6992 from PsiOmegaDelta/BodyBag

Shapely body bags.
This commit is contained in:
Chinsky
2014-11-12 23:45:36 +03:00
2 changed files with 63 additions and 53 deletions

View File

@@ -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

View File

@@ -85,11 +85,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
@@ -100,26 +100,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
@@ -131,13 +134,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 << "<span class='notice'>It won't budge!</span>"
return
return
update_icon()
// this should probably use dump_contents()
/obj/structure/closet/ex_act(severity)