From 21ccda7002ed75123c486a3e80d0cd6de021f784 Mon Sep 17 00:00:00 2001 From: defiantGrace Date: Fri, 25 Oct 2019 19:33:08 -0400 Subject: [PATCH] Makes toilets and sinks constructable (#47320) * Makes toilets and sinks constructable * Update code/game/objects/structures/watercloset.dm Co-Authored-By: Emmett Gaines --- code/controllers/subsystem/materials.dm | 6 ++- code/game/objects/structures/watercloset.dm | 48 ++++++++++++++++----- 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/code/controllers/subsystem/materials.dm b/code/controllers/subsystem/materials.dm index 3f69e57a5cf..0dcc5e96997 100644 --- a/code/controllers/subsystem/materials.dm +++ b/code/controllers/subsystem/materials.dm @@ -14,7 +14,11 @@ SUBSYSTEM_DEF(materials) ///Dictionary of category || list of material refs var/list/materials_by_category = list() ///List of stackcrafting recipes for materials using rigid materials - var/list/rigid_stack_recipes = list(new/datum/stack_recipe("chair", /obj/structure/chair/greyscale, one_per_turf = TRUE, on_floor = TRUE, applies_mats = TRUE)) + var/list/rigid_stack_recipes = list( + new /datum/stack_recipe("chair", /obj/structure/chair/greyscale, one_per_turf = TRUE, on_floor = TRUE, applies_mats = TRUE), + new /datum/stack_recipe("toilet", /obj/structure/toilet/greyscale, one_per_turf = TRUE, on_floor = TRUE, applies_mats = TRUE), + new /datum/stack_recipe("sink", /obj/structure/sink/greyscale, one_per_turf = TRUE, on_floor = TRUE, applies_mats = TRUE), + ) /datum/controller/subsystem/materials/Initialize(timeofday) InitializeMaterials() diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index e5250a7c0fe..32c39d608da 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -9,7 +9,8 @@ var/cistern = 0 //if the cistern bit is open var/w_items = 0 //the combined w_class of all the items in the cistern var/mob/living/swirlie = null //the mob being given a swirlie - + var/buildstacktype = /obj/item/stack/sheet/metal //they're metal now, shut up + var/buildstackamount = 1 /obj/structure/toilet/Initialize() . = ..() @@ -70,9 +71,18 @@ update_icon() -/obj/structure/toilet/update_icon() +/obj/structure/toilet/update_icon_state() icon_state = "toilet[open][cistern]" +/obj/structure/toilet/deconstruct() + if(!(flags_1 & NODECONSTRUCT_1)) + if(buildstacktype) + new buildstacktype(loc,buildstackamount) + else + for(var/i in custom_materials) + var/datum/material/M = i + new M.sheet_type(loc, FLOOR(custom_materials[M] / MINERAL_MATERIAL_AMOUNT, 1)) + ..() /obj/structure/toilet/attackby(obj/item/I, mob/living/user, params) if(I.tool_behaviour == TOOL_CROWBAR) @@ -82,7 +92,9 @@ user.visible_message("[user] [cistern ? "replaces the lid on the cistern" : "lifts the lid off the cistern"]!", "You [cistern ? "replace the lid on the cistern" : "lift the lid off the cistern"]!", "You hear grinding porcelain.") cistern = !cistern update_icon() - + else if(I.tool_behaviour == TOOL_WRENCH && !(flags_1&NODECONSTRUCT_1)) + I.play_tool_sound(src) + deconstruct() else if(cistern) if(user.a_intent != INTENT_HARM) if(I.w_class > WEIGHT_CLASS_NORMAL) @@ -118,8 +130,9 @@ w_items += secret.w_class contents += secret - - +/obj/structure/toilet/greyscale + material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR + buildstacktype = null /obj/structure/urinal name = "urinal" @@ -223,6 +236,8 @@ anchored = TRUE var/busy = FALSE //Something's being washed at the moment var/dispensedreagent = /datum/reagent/water // for whenever plumbing happens + var/buildstacktype = /obj/item/stack/sheet/metal + var/buildstackamount = 1 /obj/structure/sink/attack_hand(mob/living/user) . = ..() @@ -300,6 +315,11 @@ playsound(loc, 'sound/effects/slosh.ogg', 25, TRUE) return + if(O.tool_behaviour == TOOL_WRENCH && !(flags_1&NODECONSTRUCT_1)) + O.play_tool_sound(src) + deconstruct() + return + if(istype(O, /obj/item/stack/medical/gauze)) var/obj/item/stack/medical/gauze/G = O new /obj/item/reagent_containers/glass/rag(src.loc) @@ -330,11 +350,15 @@ else return ..() -/obj/structure/sink/deconstruct(disassembled = TRUE) - new /obj/item/stack/sheet/metal (loc, 3) - qdel(src) - - +/obj/structure/sink/deconstruct() + if(!(flags_1 & NODECONSTRUCT_1)) + if(buildstacktype) + new buildstacktype(loc,buildstackamount) + else + for(var/i in custom_materials) + var/datum/material/M = i + new M.sheet_type(loc, FLOOR(custom_materials[M] / MINERAL_MATERIAL_AMOUNT, 1)) + ..() /obj/structure/sink/kitchen name = "kitchen sink" @@ -361,11 +385,13 @@ /obj/structure/sink/puddle/deconstruct(disassembled = TRUE) qdel(src) +/obj/structure/sink/greyscale + material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR + buildstacktype = null //Shower Curtains// //Defines used are pre-existing in layers.dm// - /obj/structure/curtain name = "curtain" desc = "Contains less than 1% mercury."