Makes toilets and sinks constructable (#47320)

* Makes toilets and sinks constructable

* Update code/game/objects/structures/watercloset.dm

Co-Authored-By: Emmett Gaines <ninjanomnom@gmail.com>
This commit is contained in:
defiantGrace
2019-10-25 19:33:08 -04:00
committed by Rob Bailey
parent 6f2b82ba3a
commit 21ccda7002
2 changed files with 42 additions and 12 deletions

View File

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

View File

@@ -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("<span class='notice'>[user] [cistern ? "replaces the lid on the cistern" : "lifts the lid off the cistern"]!</span>", "<span class='notice'>You [cistern ? "replace the lid on the cistern" : "lift the lid off the cistern"]!</span>", "<span class='hear'>You hear grinding porcelain.</span>")
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."