Fixes bodybag examine text (#9066)

It was incorrectly using closet examine code and it incorrectly kept displaying it as empty.

This should resolve that issue.

Also tides up code here and there and some cleanup.

PR'd again, in an attempt to stop travis cloning itself.

Also makes a proc out of the examine to make things cleaner I guess
This commit is contained in:
Wowzewow (Wezzy)
2020-06-10 14:03:13 +08:00
committed by GitHub
parent 953d87df0c
commit f882fc0762
4 changed files with 84 additions and 26 deletions
+30 -16
View File
@@ -6,12 +6,14 @@
icon = 'icons/obj/bodybag.dmi'
icon_state = "bodybag_folded"
w_class = 2.0
drop_sound = 'sound/items/drop/cloth.ogg'
pickup_sound = 'sound/items/pickup/cloth.ogg'
attack_self(mob/user)
var/obj/structure/closet/body_bag/R = new /obj/structure/closet/body_bag(user.loc)
R.add_fingerprint(user)
qdel(src)
/obj/item/bodybag/attack_self(mob/user)
var/obj/structure/closet/body_bag/R = new /obj/structure/closet/body_bag(user.loc)
R.add_fingerprint(user)
playsound(src, 'sound/items/drop/cloth.ogg', 30)
qdel(src)
/obj/item/storage/box/bodybags
name = "body bags"
@@ -27,7 +29,6 @@
new /obj/item/bodybag(src)
new /obj/item/bodybag(src)
/obj/structure/closet/body_bag
name = "body bag"
desc = "A plastic bag designed for the storage and transportation of cadavers."
@@ -37,11 +38,24 @@
icon_opened = "bodybag_open"
open_sound = 'sound/items/zip.ogg'
close_sound = 'sound/items/zip.ogg'
var/item_path = /obj/item/bodybag
density = 0
storage_capacity = 30
var/item_path = /obj/item/bodybag
var/contains_body = 0
/obj/structure/closet/body_bag/content_info(mob/user, content_size)
if(!content_size && !contains_body)
to_chat(user, "\The [src] is empty.")
else if(storage_capacity > content_size*4)
to_chat(user, "\The [src] is barely filled.")
else if(storage_capacity > content_size*2)
to_chat(user, "\The [src] is less than half full.")
else if(storage_capacity > content_size)
to_chat(user, "\The [src] still has some free space.")
else
to_chat(user, "\The [src] is full.")
to_chat(user, "It [contains_body ? "contains" : "does not contain"] a body.")
/obj/structure/closet/body_bag/attackby(var/obj/item/W, mob/user as mob)
if (W.ispen())
var/t = input(user, "What would you like the label to be?", text("[]", src.name), null) as text
@@ -53,13 +67,15 @@
if (t)
src.name = "body bag - "
src.name += t
playsound(src, pick('sound/bureaucracy/pen1.ogg','sound/bureaucracy/pen2.ogg'), 20)
add_overlay("bodybag_label")
else
src.name = "body bag"
//..() //Doesn't need to run the parent. Since when can fucking bodybags be welded shut? -Agouri
return
else if(W.iswirecutter())
to_chat(user, "You cut the tag off the bodybag")
to_chat(user, "You cut the tag off the bodybag.")
playsound(src.loc, 'sound/items/Wirecutter.ogg', 50, 1)
src.name = "body bag"
cut_overlays()
return
@@ -80,7 +96,7 @@
if(!ishuman(usr)) return
if(opened) return 0
if(contents.len) return 0
visible_message("[usr] folds up the [src.name]")
playsound(src, 'sound/items/pickup/cloth.ogg', 15)
new item_path(get_turf(src))
spawn(0)
qdel(src)
@@ -95,9 +111,8 @@
else
icon_state = icon_closed
/obj/item/bodybag/cryobag
name = "stasis bag"
name = "cryogenic stasis bag"
desc = "A folded, non-reusable bag designed to prevent additional damage to an occupant at the cost of genetic damage."
icon = 'icons/obj/cryobag.dmi'
icon_state = "bodybag_folded"
@@ -105,12 +120,11 @@
/obj/item/bodybag/cryobag/attack_self(mob/user)
var/obj/structure/closet/body_bag/cryobag/R = new /obj/structure/closet/body_bag/cryobag(user.loc)
R.add_fingerprint(user)
playsound(src, 'sound/items/drop/cloth.ogg', 30)
qdel(src)
/obj/structure/closet/body_bag/cryobag
name = "stasis bag"
name = "cryogenic stasis bag"
desc = "A non-reusable plastic bag designed to prevent additional damage to an occupant at the cost of genetic damage."
icon = 'icons/obj/cryobag.dmi'
item_path = /obj/item/bodybag/cryobag
@@ -125,11 +139,11 @@
O.name = "used stasis bag"
O.icon = src.icon
O.icon_state = "bodybag_used"
O.desc = "Pretty useless now.."
O.desc = "Pretty useless now."
qdel(src)
/obj/structure/closet/body_bag/cryobag/MouseDrop(over_object, src_location, over_location)
if((over_object == usr && (in_range(src, usr) || usr.contents.Find(src))))
if(!ishuman(usr)) return
to_chat(usr, "<span class='warning'>You can't fold that up anymore..</span>")
to_chat(usr, SPAN_WARNING("You can't fold that up anymore."))
..()
@@ -51,22 +51,25 @@
// Fill lockers with this.
/obj/structure/closet/proc/fill()
/obj/structure/closet/proc/content_info(mob/user, content_size)
if(!content_size)
to_chat(user, "\The [src] is empty.")
else if(storage_capacity > content_size*4)
to_chat(user, "\The [src] is barely filled.")
else if(storage_capacity > content_size*2)
to_chat(user, "\The [src] is less than half full.")
else if(storage_capacity > content_size)
to_chat(user, "\The [src] still has some free space.")
else
to_chat(user, "\The [src] is full.")
/obj/structure/closet/examine(mob/user)
if(..(user, 1) && !opened)
var/content_size = 0
for(var/obj/item/I in contents)
if(!I.anchored)
content_size += Ceiling(I.w_class/2)
if(!content_size)
to_chat(user, "It is empty.")
else if(storage_capacity > content_size*4)
to_chat(user, "It is barely filled.")
else if(storage_capacity > content_size*2)
to_chat(user, "It is less than half full.")
else if(storage_capacity > content_size)
to_chat(user, "There is still some free space.")
else
to_chat(user, "It is full.")
content_info(user, content_size)
/obj/structure/closet/proc/stored_weight()
var/content_size = 0
+41
View File
@@ -0,0 +1,41 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
# balance
# admin
# backend
# security
# refactor
#################################
# Your name.
author: Wowzewow (Wezzy)
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- bugfix: "Fixed bodybag examine text."
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 778 B