Fix heirloom bodybags being destroyed by use (#43262)

* Fix heirloom bodybags being destroyed by use

* Destroy folded bag if it hasn't been moved back into the world
This commit is contained in:
Tad Hardesty
2019-03-23 16:36:40 -04:00
committed by ShizCalev
parent 5990b089e1
commit 956acb2d8e
2 changed files with 13 additions and 4 deletions
@@ -13,8 +13,15 @@
delivery_icon = null //unwrappable
anchorable = FALSE
var/foldedbag_path = /obj/item/bodybag
var/obj/item/bodybag/foldedbag_instance = null
var/tagged = 0 // so closet code knows to put the tag overlay back
/obj/structure/closet/body_bag/Destroy()
// If we have a stored bag, and it's in nullspace (not in someone's hand), delete it.
if (foldedbag_instance && !foldedbag_instance.loc)
QDEL_NULL(foldedbag_instance)
return ..()
/obj/structure/closet/body_bag/attackby(obj/item/I, mob/user, params)
if (istype(I, /obj/item/pen) || istype(I, /obj/item/toy/crayon))
if(!user.is_literate())
@@ -59,7 +66,7 @@
if(contents.len)
return 0
visible_message("<span class='notice'>[usr] folds up [src].</span>")
var/obj/item/bodybag/B = new foldedbag_path(get_turf(src))
var/obj/item/bodybag/B = foldedbag_instance || new foldedbag_path
usr.put_in_hands(B)
qdel(src)
@@ -87,7 +94,7 @@
to_chat(usr, "<span class='warning'>You can't recursively fold bluespace body bags!</span>" )
return 0
visible_message("<span class='notice'>[usr] folds up [src].</span>")
var/obj/item/bodybag/B = new foldedbag_path(get_turf(src))
var/obj/item/bodybag/B = foldedbag_instance || new foldedbag_path
usr.put_in_hands(B)
for(var/atom/movable/A in contents)
A.forceMove(B)