Merge pull request #773 from DragonTrance/deconstructing

Adds the Ability to deconstruct various objects
This commit is contained in:
QuoteFox
2020-12-28 19:34:37 +00:00
committed by GitHub
4 changed files with 209 additions and 53 deletions
@@ -17,30 +17,34 @@
* Metal
*/
GLOBAL_LIST_INIT(metal_recipes, list ( \
new/datum/stack_recipe("stool", /obj/structure/chair/stool, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("bar stool", /obj/structure/chair/stool/bar, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("chair", /obj/structure/chair, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("bed", /obj/structure/bed, 2, one_per_turf = TRUE, on_floor = TRUE), \
//CIT CHANGE - adds sofas to metal recipe list
new/datum/stack_recipe_list("sofas", list( \
new /datum/stack_recipe("sofa (middle)", /obj/structure/chair/sofa, one_per_turf = TRUE, on_floor = TRUE), \
new /datum/stack_recipe("sofa (left)", /obj/structure/chair/sofa/left, one_per_turf = TRUE, on_floor = TRUE), \
new /datum/stack_recipe("sofa (right)", /obj/structure/chair/sofa/right, one_per_turf = TRUE, on_floor = TRUE), \
new /datum/stack_recipe("sofa (corner)", /obj/structure/chair/sofa/corner, one_per_turf = TRUE, on_floor = TRUE), \
)), \
//END OF CIT CHANGES
null, \
new/datum/stack_recipe_list("office chairs", list( \
new/datum/stack_recipe_list("seats", \
list( \
new/datum/stack_recipe("stool", /obj/structure/chair/stool, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("bar stool", /obj/structure/chair/stool/bar, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("chair", /obj/structure/chair, one_per_turf = TRUE, on_floor = TRUE), \
null, \
new/datum/stack_recipe("dark office chair", /obj/structure/chair/office/dark, 5, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("light office chair", /obj/structure/chair/office/light, 5, one_per_turf = TRUE, on_floor = TRUE), \
)), \
new/datum/stack_recipe_list("comfy chairs", list( \
null, \
new/datum/stack_recipe("beige comfy chair", /obj/structure/chair/comfy/beige, 2, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("black comfy chair", /obj/structure/chair/comfy/black, 2, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("brown comfy chair", /obj/structure/chair/comfy/brown, 2, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("lime comfy chair", /obj/structure/chair/comfy/lime, 2, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("teal comfy chair", /obj/structure/chair/comfy/teal, 2, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("teal comfy chair", /obj/structure/chair/comfy/teal, 2, one_per_turf = TRUE, on_floor = TRUE) \
)), \
//CIT CHANGE - adds sofas to metal recipe list
new/datum/stack_recipe_list("sofas", \
list( \
new/datum/stack_recipe("sofa (middle)", /obj/structure/chair/sofa, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("sofa (left)", /obj/structure/chair/sofa/left, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("sofa (right)", /obj/structure/chair/sofa/right, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("sofa (corner)", /obj/structure/chair/sofa/corner, one_per_turf = TRUE, on_floor = TRUE) \
)), \
//END OF CIT CHANGES
new/datum/stack_recipe("bed", /obj/structure/bed, 2, one_per_turf = TRUE, on_floor = TRUE), \
null, \
//add this when I can find a way to make them easily constructible > new/datum/stack_recipe("sink", /obj/structure/sink, 2, one_per_turf = TRUE, on_floor = TRUE),
new/datum/stack_recipe("shower", /obj/machinery/shower/crafted, 2, one_per_turf = TRUE, on_floor = TRUE), \
null, \
new/datum/stack_recipe("rack parts", /obj/item/rack_parts), \
new/datum/stack_recipe("closet", /obj/structure/closet, 2, time = 15, one_per_turf = TRUE, on_floor = TRUE), \
@@ -56,7 +60,8 @@ GLOBAL_LIST_INIT(metal_recipes, list ( \
new/datum/stack_recipe("modular console", /obj/machinery/modular_computer/console/buildable/, 10, time = 25, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("machine frame", /obj/structure/frame/machine, 5, time = 25, one_per_turf = TRUE, on_floor = TRUE), \
null, \
new /datum/stack_recipe_list("airlock assemblies", list( \
new /datum/stack_recipe_list("airlock assemblies", \
list( \
new /datum/stack_recipe("standard airlock assembly", /obj/structure/door_assembly, 4, time = 50, one_per_turf = 1, on_floor = 1), \
new /datum/stack_recipe("public airlock assembly", /obj/structure/door_assembly/door_assembly_public, 4, time = 50, one_per_turf = 1, on_floor = 1), \
new /datum/stack_recipe("command airlock assembly", /obj/structure/door_assembly/door_assembly_com, 4, time = 50, one_per_turf = 1, on_floor = 1), \
@@ -74,7 +79,7 @@ GLOBAL_LIST_INIT(metal_recipes, list ( \
new /datum/stack_recipe("external maintenance airlock assembly", /obj/structure/door_assembly/door_assembly_extmai, 4, time = 50, one_per_turf = 1, on_floor = 1), \
new /datum/stack_recipe("airtight hatch assembly", /obj/structure/door_assembly/door_assembly_hatch, 4, time = 50, one_per_turf = 1, on_floor = 1), \
new /datum/stack_recipe("maintenance hatch assembly", /obj/structure/door_assembly/door_assembly_mhatch, 4, time = 50, one_per_turf = 1, on_floor = 1), \
)), \
)), \
null, \
new/datum/stack_recipe("firelock frame", /obj/structure/firelock_frame, 3, time = 50, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("turret frame", /obj/machinery/porta_turret_construct, 5, time = 25, one_per_turf = TRUE, on_floor = TRUE), \
+44 -10
View File
@@ -8,14 +8,48 @@
density = TRUE
anchored = TRUE
/obj/structure/loom/attackby(obj/item/stack/sheet/W, mob/user)
if(W.is_fabric && W.amount > 1)
user.show_message("<span class='notice'>You start weaving the [W.name] through the loom..</span>", 1)
if(W.use_tool(src, user, W.pull_effort))
new W.loom_result(drop_location())
user.show_message("<span class='notice'>You weave the [W.name] into a workable fabric.</span>", 1)
W.amount = (W.amount - 2)
if(W.amount < 1)
qdel(W)
/obj/structure/loom/attackby(obj/item/I, mob/user)
if (user.a_intent != INTENT_HELP)
return ..()
if (istype(I, /obj/item/stack/sheet))
if (!anchored)
return to_chat(user, "<span class='notice'>You have to anchor [src] first!</span>")
var/obj/item/stack/sheet/W = I
if(W.is_fabric && W.amount > 1)
user.visible_message("<span class='notice'[user] starts weaving [W.name] through the loom.</span>",
"<span class='notice'>You start weaving the [W.name] through the loom.</span>")
if(W.use_tool(src, user, W.pull_effort))
new W.loom_result(drop_location())
to_chat(user, "<span class='notice'>You weave the [W.name] into a workable fabric.</span>")
W.amount = (W.amount - 2)
if(W.amount < 1)
qdel(W)
else
to_chat("<span class='notice'>You need at least 2 [W.name] to loom into fabric!</span>")
else
user.show_message("<span class='notice'>You need a valid fabric and at least 2 of said fabric before using this.</span>", 1)
switch (I.tool_behaviour)
if (TOOL_SCREWDRIVER)
user.visible_message("<span class='info'>[user] starts disassembling [src]...</span>",
"<span class='info'>You start disassembling [src]...</span>")
I.play_tool_sound(src)
if(I.use_tool(src, user, 60))
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, TRUE)
deconstruct(TRUE)
return
if (TOOL_WRENCH)
if (anchored)
to_chat(user, "<span class='notice'>You unsecure the [src].</span>")
I.play_tool_sound(src)
anchored = FALSE
else
to_chat(user, "<span class='notice'>You secure the [src].</span>")
I.play_tool_sound(src)
anchored = TRUE
return
return ..()
/obj/structure/loom/deconstruct(disassembled = TRUE)
new /obj/item/stack/sheet/mineral/wood (get_turf(src), 10)
qdel(src)
+107 -21
View File
@@ -219,6 +219,9 @@
var/watertemp = "normal" //freezing, normal, or boiling
var/datum/looping_sound/showering/soundloop
/obj/machinery/shower/crafted //When created from sheets of metal
anchored = FALSE
/obj/machinery/shower/Initialize()
. = ..()
soundloop = new(list(src), FALSE)
@@ -227,6 +230,29 @@
QDEL_NULL(soundloop)
return ..()
/obj/machinery/shower/deconstruct(disassembled = TRUE)
new /obj/item/stack/sheet/metal (get_turf(src), 2)
Destroy()
//Copy from /obj/structure/chair
/obj/machinery/shower/ComponentInitialize()
. = ..()
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE, CALLBACK(src, .proc/can_user_rotate),CALLBACK(src, .proc/can_be_rotated),null)
/obj/machinery/shower/proc/can_be_rotated(mob/user)
return !anchored
/obj/machinery/shower/proc/can_user_rotate(mob/user)
if(istype(user, /mob/living))
if(!user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
return FALSE
else
return TRUE
else if(isobserver(user) && CONFIG_GET(flag/ghost_interaction))
return TRUE
return FALSE
////
/obj/effect/mist
name = "mist"
icon = 'icons/obj/watercloset.dmi'
@@ -236,6 +262,8 @@
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
/obj/machinery/shower/interact(mob/M)
if (!anchored)
return to_chat(M, "<span class='warning'>You have to connect [src] to the floor first!</span>")
on = !on
update_icon()
add_fingerprint(M)
@@ -258,25 +286,56 @@
/obj/machinery/shower/attackby(obj/item/I, mob/user, params)
if(I.type == /obj/item/analyzer)
to_chat(user, "<span class='notice'>The water temperature seems to be [watertemp].</span>")
else
to_chat(user, "<span class='notice'>The water temperature seems to be <span class='bold'>[watertemp]</span>.</span>")
return
if (user.a_intent != INTENT_HELP)
return ..()
/obj/machinery/shower/wrench_act(mob/living/user, obj/item/I)
to_chat(user, "<span class='notice'>You begin to adjust the temperature valve with \the [I]...</span>")
if(I.use_tool(src, user, 50))
switch(watertemp)
if("normal")
watertemp = "freezing"
if("freezing")
watertemp = "boiling"
if("boiling")
watertemp = "normal"
user.visible_message("<span class='notice'>[user] adjusts the shower with \the [I].</span>", "<span class='notice'>You adjust the shower with \the [I] to [watertemp] temperature.</span>")
log_game("[key_name(user)] has wrenched a shower to [watertemp] at ([x],[y],[z])")
add_hiddenprint(user)
return TRUE
switch (I.tool_behaviour)
if (TOOL_WRENCH)
if (!anchored)
user.visible_message("<span class='notice'>[user] starts to take apart [src]...</span>", "<span class='notice'>You start dismantling [src]...</span>")
I.play_tool_sound(src)
if(I.use_tool(src, user, 20))
deconstruct(TRUE)
else
to_chat(user, "<span class='notice'>You begin to adjust the temperature valve with \the [I]...</span>")
if(I.use_tool(src, user, 50))
switch(watertemp)
if("normal")
watertemp = "freezing"
if("freezing")
watertemp = "boiling"
if("boiling")
watertemp = "normal"
user.visible_message("<span class='notice'>[user] adjusts the shower with \the [I].</span>", "<span class='notice'>You adjust the shower with \the [I] to [watertemp] temperature.</span>")
log_game("[key_name(user)] has wrenched a shower to [watertemp] at ([x],[y],[z])")
add_hiddenprint(user)
if (TOOL_SCREWDRIVER)
if (!anchored)
to_chat(user, "<span class='notice'>You begin screwing in [src] to the floor...</span>")
I.play_tool_sound(src)
if(I.use_tool(src, user, 30))
user.visible_message("<span class='notice'>[user] connects [src] to the floor.</span>", "<span class='notice'>You connect [src] to the floor.</span>")
anchored = TRUE
else
to_chat(user, "<span class='notice'>You start to take out [src]'s screws...</span>")
on = FALSE
soundloop.stop()
update_icon()
I.play_tool_sound(src)
if(I.use_tool(src, user, 20))
user.visible_message("<span class='notice'>[user] disconnects [src] from the floor.</span>", "<span class='notice'>You disconnect [src] from the floor.</span>")
anchored = FALSE
/obj/machinery/shower/examine()
. += ..()
if (anchored)
. += "<span class='info'>It looks like it can be taken apart with a <span class='bold'>screwdriver</span>...</span>"
else
. += "<span class='info'>Its <span class='bold'>screws</span> are out of place, allowing it to be <span class='bold'>dismantled with a wrench</span>.</span>"
/obj/machinery/shower/update_icon() //this is terribly unreadable, but basically it makes the shower mist up
cut_overlays() //once it's been on for a while, in addition to handling the water overlay.
@@ -463,6 +522,27 @@
anchored = TRUE
var/busy = FALSE //Something's being washed at the moment
var/dispensedreagent = /datum/reagent/water // for whenever plumbing happens
layer = WALL_OBJ_LAYER
/*/obj/structure/sink/Initialize() //This doesn't work in the slightest. It used to at some point through development, but that made it so you cant interact with the object whatsoever. I hate this.
. = ..()
switch (dir) //Thinking about moving this into its own construction sequence so it can actually work, like using a screwdriver will set its pixel offset, but I feel like that's too much
if (NORTH) //Or maybe putting it in lateinit... but that's sloppy and I feel like it wont work when spawning it in after the round starts
pixel_x = pixel_y = 0
layer = WALL_OBJ_LAYER
if (EAST)
pixel_x = 12
pixel_y = 3
layer = WALL_OBJ_LAYER
if (SOUTH)
pixel_y = 24
pixel_x = 0
layer = ABOVE_OBJ_LAYER
if (WEST)
pixel_x = -12
pixel_y = 3
layer = WALL_OBJ_LAYER
*/
/obj/structure/sink/attack_hand(mob/living/user)
@@ -509,7 +589,16 @@
/obj/structure/sink/attackby(obj/item/O, mob/living/user, params)
if(busy)
to_chat(user, "<span class='warning'>Someone's already washing here!</span>")
to_chat(user, "<span class='warning'>Someone's already washing here.</span>")
return
if (istype(O, /obj/item/wrench) && user.a_intent == INTENT_HELP)
to_chat(user, "<span class='notice'>You start deconstructing [src]...</span>")
O.play_tool_sound(src)
if(O.use_tool(src, user, 20))
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, TRUE)
deconstruct(TRUE)
return
if(istype(O, /obj/item/reagent_containers))
@@ -574,16 +663,13 @@
return ..()
/obj/structure/sink/deconstruct(disassembled = TRUE)
new /obj/item/stack/sheet/metal (loc, 3)
new /obj/item/stack/sheet/metal (loc, 2)
qdel(src)
/obj/structure/sink/kitchen
name = "kitchen sink"
icon_state = "sink_alt"
/obj/structure/sink/puddle //splishy splashy ^_^
name = "puddle"
desc = "A puddle used for washing one's hands and face."
+34 -3
View File
@@ -38,8 +38,10 @@
playsound(src, 'sound/effects/bubbles.ogg', 50, TRUE)
/obj/structure/fermenting_barrel/attackby(obj/item/I, mob/user, params)
var/obj/item/reagent_containers/food/snacks/grown/fruit = I
if(istype(fruit))
if (user.a_intent != INTENT_HELP)
return ..()
if (istype(I, /obj/item/reagent_containers/food/snacks/grown))
var/obj/item/reagent_containers/food/snacks/grown/fruit = I
if(!fruit.can_distill)
to_chat(user, "<span class='warning'>You can't distill this into anything...</span>")
return TRUE
@@ -50,7 +52,32 @@
addtimer(CALLBACK(src, .proc/makeWine, fruit), rand(80, 120) * speed_multiplier)
return TRUE
else
return ..()
switch (I.tool_behaviour)
if (TOOL_SCREWDRIVER)
user.visible_message("<span class='info'>[user] starts disassembling [src]...</span>",
"<span class='info'>You start disassembling [src]...</span>")
var/reagent_calculation = 1
if (reagents.total_volume)
user.visible_message("<span class='warning'>Liquid starts pouring out [src] as [user] starts disassembling it!</span>",
"<span class='warning'>Liquid starts pouring out [src], maybe you should think about this...</span>")
reagent_calculation += 2+round(reagents.total_volume/100)/2
I.play_tool_sound(src)
if(I.use_tool(src, user, 30*reagent_calculation))
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, TRUE)
if (reagents.total_volume)
chem_splash(loc, round(reagent_calculation*0.75), list(reagents))
deconstruct(TRUE)
else if (reagents.total_volume)
visible_message("<span class='info'>[user] stops disassembling [src].</span>")
if (TOOL_WRENCH)
if (anchored) //Imaginary bolts on the ground, just like anything else that can get wrenched
to_chat(user, "<span class='notice'>You unsecure [src].</span>")
I.play_tool_sound(src)
anchored = FALSE
else
to_chat(user, "<span class='notice'>You secure [src].</span>")
I.play_tool_sound(src)
anchored = TRUE
/obj/structure/fermenting_barrel/attack_hand(mob/user)
open = !open
@@ -69,3 +96,7 @@
icon_state = "barrel_open"
else
icon_state = "barrel"
/obj/structure/fermenting_barrel/deconstruct(disassembled = TRUE)
new /obj/item/stack/sheet/mineral/wood (get_turf(src), 10)
qdel(src)