From c6ed8a7fad4dca4e0c50484fcb61edb730481e8a Mon Sep 17 00:00:00 2001
From: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com>
Date: Tue, 8 Sep 2020 23:09:01 -0400
Subject: [PATCH] Improves cardboard box consistency. (#53525)
* Improves cardboard box consistency
* Also gives them cardboard datum mats.
---
code/game/objects/items/crayons.dm | 12 ++++++++++++
code/game/objects/items/storage/fancy.dm | 15 +++++++++++++--
code/modules/food_and_drinks/pizzabox.dm | 7 +++++++
3 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/code/game/objects/items/crayons.dm b/code/game/objects/items/crayons.dm
index 5bc04648583..498da928812 100644
--- a/code/game/objects/items/crayons.dm
+++ b/code/game/objects/items/crayons.dm
@@ -585,6 +585,7 @@
icon = 'icons/obj/crayons.dmi'
icon_state = "crayonbox"
w_class = WEIGHT_CLASS_SMALL
+ custom_materials = list(/datum/material/cardboard = 2000)
/obj/item/storage/crayons/Initialize()
. = ..()
@@ -622,6 +623,17 @@
return
return ..()
+/obj/item/storage/crayons/attack_self(mob/user)
+ . = ..()
+ if(contents.len > 0)
+ to_chat(user, "You can't fold down [src] with crayons inside!")
+ return
+
+ var/obj/item/stack/sheet/cardboard/cardboard = new /obj/item/stack/sheet/cardboard(user.drop_location())
+ to_chat(user, "You fold the [src] into cardboard.")
+ user.put_in_active_hand(cardboard)
+ qdel(src)
+
//Spraycan stuff
/obj/item/toy/crayon/spraycan
diff --git a/code/game/objects/items/storage/fancy.dm b/code/game/objects/items/storage/fancy.dm
index 9d4d44c9d85..c91828f4f46 100644
--- a/code/game/objects/items/storage/fancy.dm
+++ b/code/game/objects/items/storage/fancy.dm
@@ -17,9 +17,11 @@
/obj/item/storage/fancy
icon = 'icons/obj/food/containers.dmi'
resistance_flags = FLAMMABLE
+ custom_materials = list(/datum/material/cardboard = 2000)
var/icon_type = "donut"
var/spawn_type = null
var/fancy_open = FALSE
+ var/obj/fold_result = /obj/item/stack/sheet/cardboard
/obj/item/storage/fancy/PopulateContents()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
@@ -44,6 +46,11 @@
fancy_open = !fancy_open
update_icon()
. = ..()
+ if(!contents.len)
+ new fold_result(user.drop_location())
+ to_chat(user, "You fold the [src] into [initial(fold_result.name)].")
+ user.put_in_active_hand(fold_result)
+ qdel(src)
/obj/item/storage/fancy/Exited()
. = ..()
@@ -149,8 +156,12 @@
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 5
-/obj/item/storage/fancy/candle_box/attack_self(mob_user)
- return
+/obj/item/storage/fancy/candle_box/attack_self(mob/user)
+ if(!contents.len)
+ new fold_result(user.drop_location())
+ to_chat(user, "You fold the [src] into [initial(fold_result.name)].")
+ user.put_in_active_hand(fold_result)
+ qdel(src)
////////////
//CIG PACK//
diff --git a/code/modules/food_and_drinks/pizzabox.dm b/code/modules/food_and_drinks/pizzabox.dm
index d67de067ee1..0226590a785 100644
--- a/code/modules/food_and_drinks/pizzabox.dm
+++ b/code/modules/food_and_drinks/pizzabox.dm
@@ -14,6 +14,7 @@
inhand_icon_state = "pizzabox"
lefthand_file = 'icons/mob/inhands/misc/food_lefthand.dmi'
righthand_file = 'icons/mob/inhands/misc/food_righthand.dmi'
+ custom_materials = list(/datum/material/cardboard = 2000)
var/open = FALSE
var/can_open_on_fall = TRUE //if FALSE, this pizza box will never open if it falls from a stack
@@ -106,6 +107,12 @@
audible_message("[icon2html(src, hearers(src))] *beep*")
bomb_active = TRUE
START_PROCESSING(SSobj, src)
+ else if(!open && !pizza && !bomb)
+ var/obj/item/stack/sheet/cardboard/cardboard = new /obj/item/stack/sheet/cardboard(user.drop_location())
+ to_chat(user, "You fold [src] into [cardboard].")
+ user.put_in_active_hand(cardboard)
+ qdel(src)
+ return
update_icon()
//ATTACK HAND IGNORING PARENT RETURN VALUE