From 4b531c9d3e1fedc5a1f9ff27f33eab1fc9926f85 Mon Sep 17 00:00:00 2001
From: dragomagol <66640614+dragomagol@users.noreply.github.com>
Date: Thu, 22 Apr 2021 22:22:30 -0700
Subject: [PATCH] Changes reinforced window deconstruction to right click
(#58523)
---
code/game/objects/items/tools/weldingtool.dm | 30 ++++-----
code/game/objects/structures/tables_racks.dm | 29 +++++----
code/game/objects/structures/window.dm | 64 ++++++++++++--------
3 files changed, 67 insertions(+), 56 deletions(-)
diff --git a/code/game/objects/items/tools/weldingtool.dm b/code/game/objects/items/tools/weldingtool.dm
index 238b5fd90e0..057950e74d1 100644
--- a/code/game/objects/items/tools/weldingtool.dm
+++ b/code/game/objects/items/tools/weldingtool.dm
@@ -73,22 +73,22 @@
/obj/item/weldingtool/process(delta_time)
- switch(welding)
- if(0)
- force = 3
- damtype = BRUTE
- update_appearance()
- if(!can_off_process)
- STOP_PROCESSING(SSobj, src)
- return
+ if(welding)
+ force = 15
+ damtype = BURN
+ burned_fuel_for += delta_time
+ if(burned_fuel_for >= WELDER_FUEL_BURN_INTERVAL)
+ use(TRUE)
+ update_appearance()
+
//Welders left on now use up fuel, but lets not have them run out quite that fast
- if(1)
- force = 15
- damtype = BURN
- burned_fuel_for += delta_time
- if(burned_fuel_for >= WELDER_FUEL_BURN_INTERVAL)
- use(1)
- update_appearance()
+ else
+ force = 3
+ damtype = BRUTE
+ update_appearance()
+ if(!can_off_process)
+ STOP_PROCESSING(SSobj, src)
+ return
//This is to start fires. process() is only called if the welder is on.
open_flame()
diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm
index 791cf040a93..5858a4ea80c 100644
--- a/code/game/objects/structures/tables_racks.dm
+++ b/code/game/objects/structures/tables_racks.dm
@@ -509,22 +509,21 @@
else
return "The top cover is firmly welded on."
-/obj/structure/table/reinforced/attackby(obj/item/W, mob/living/user, params)
- var/list/modifiers = params2list(params)
- if(W.tool_behaviour == TOOL_WELDER && LAZYACCESS(modifiers, RIGHT_CLICK))
- if(!W.tool_start_check(user, amount=0))
- return
+/obj/structure/table/reinforced/attackby_secondary(obj/item/weapon, mob/user, params)
+ if(weapon.tool_behaviour == TOOL_WELDER)
+ if(weapon.tool_start_check(user, amount = 0))
+ if(deconstruction_ready)
+ to_chat(user, "You start strengthening the reinforced table...")
+ if (weapon.use_tool(src, user, 50, volume = 50))
+ to_chat(user, "You strengthen the table.")
+ deconstruction_ready = FALSE
+ else
+ to_chat(user, "You start weakening the reinforced table...")
+ if (weapon.use_tool(src, user, 50, volume = 50))
+ to_chat(user, "You weaken the table.")
+ deconstruction_ready = TRUE
+ return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
- if(deconstruction_ready)
- to_chat(user, "You start strengthening the reinforced table...")
- if (W.use_tool(src, user, 50, volume=50))
- to_chat(user, "You strengthen the table.")
- deconstruction_ready = 0
- else
- to_chat(user, "You start weakening the reinforced table...")
- if (W.use_tool(src, user, 50, volume=50))
- to_chat(user, "You weaken the table.")
- deconstruction_ready = 1
else
. = ..()
diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm
index 2534ae7ec93..b0f33e8a8e6 100644
--- a/code/game/objects/structures/window.dm
+++ b/code/game/objects/structures/window.dm
@@ -177,17 +177,17 @@
/obj/structure/window/attackby(obj/item/I, mob/living/user, params)
if(!can_be_reached(user))
- return 1 //skip the afterattack
+ return TRUE //skip the afterattack
add_fingerprint(user)
- if(I.tool_behaviour == TOOL_WELDER && !user.combat_mode)
+ if(I.tool_behaviour == TOOL_WELDER)
if(obj_integrity < max_integrity)
- if(!I.tool_start_check(user, amount=0))
+ if(!I.tool_start_check(user, amount = 0))
return
to_chat(user, "You begin repairing [src]...")
- if(I.use_tool(src, user, 40, volume=50))
+ if(I.use_tool(src, user, 40, volume = 50))
obj_integrity = max_integrity
update_nearby_icons()
to_chat(user, "You repair [src].")
@@ -395,51 +395,63 @@
//this is shitcode but all of construction is shitcode and needs a refactor, it works for now
//If you find this like 4 years later and construction still hasn't been refactored, I'm so sorry for this //Adding a timestamp, I found this in 2020, I hope it's from this year -Lemon
//2021 AND STILLLL GOING STRONG
-/obj/structure/window/reinforced/attackby(obj/item/I, mob/living/user, params)
+/obj/structure/window/reinforced/attackby_secondary(obj/item/tool, mob/user, params)
switch(state)
if(RWINDOW_SECURE)
- if(I.tool_behaviour == TOOL_WELDER && user.combat_mode)
- user.visible_message("[user] holds \the [I] to the security screws on \the [src]...",
- "You begin heating the security screws on \the [src]...")
- if(I.use_tool(src, user, 150, volume = 100))
- to_chat(user, "The security bolts are glowing white hot and look ready to be removed.")
+ if(tool.tool_behaviour == TOOL_WELDER)
+ var/obj/item/weldingtool/welder = tool
+ if(welder.isOn())
+ user.visible_message("[user] holds \the [tool] to the security screws on \the [src]...",
+ "You begin heating the security screws on \the [src]...")
+ if(tool.use_tool(src, user, 150, volume = 100))
+ to_chat(user, "The security screws are glowing white hot and look ready to be removed.")
state = RWINDOW_BOLTS_HEATED
addtimer(CALLBACK(src, .proc/cool_bolts), 300)
- return
+ else if (tool.tool_behaviour)
+ to_chat(user, "The security screws need to be heated first!")
+
if(RWINDOW_BOLTS_HEATED)
- if(I.tool_behaviour == TOOL_SCREWDRIVER)
+ if(tool.tool_behaviour == TOOL_SCREWDRIVER)
user.visible_message("[user] digs into the heated security screws and starts removing them...",
"You dig into the heated screws hard and they start turning...")
- if(I.use_tool(src, user, 50, volume = 50))
+ if(tool.use_tool(src, user, 50, volume = 50))
state = RWINDOW_BOLTS_OUT
to_chat(user, "The screws come out, and a gap forms around the edge of the pane.")
- return
+ else if (tool.tool_behaviour)
+ to_chat(user, "The security screws need to be removed first!")
+
if(RWINDOW_BOLTS_OUT)
- if(I.tool_behaviour == TOOL_CROWBAR)
- user.visible_message("[user] wedges \the [I] into the gap in the frame and starts prying...",
- "You wedge \the [I] into the gap in the frame and start prying...")
- if(I.use_tool(src, user, 40, volume = 50))
+ if(tool.tool_behaviour == TOOL_CROWBAR)
+ user.visible_message("[user] wedges \the [tool] into the gap in the frame and starts prying...",
+ "You wedge \the [tool] into the gap in the frame and start prying...")
+ if(tool.use_tool(src, user, 40, volume = 50))
state = RWINDOW_POPPED
to_chat(user, "The panel pops out of the frame, exposing some thin metal bars that looks like they can be cut.")
- return
+ else if (tool.tool_behaviour)
+ to_chat(user, "The gap needs to be pried first!")
+
if(RWINDOW_POPPED)
- if(I.tool_behaviour == TOOL_WIRECUTTER)
+ if(tool.tool_behaviour == TOOL_WIRECUTTER)
user.visible_message("[user] starts cutting the exposed bars on \the [src]...",
"You start cutting the exposed bars on \the [src]")
- if(I.use_tool(src, user, 20, volume = 50))
+ if(tool.use_tool(src, user, 20, volume = 50))
state = RWINDOW_BARS_CUT
to_chat(user, "The panels falls out of the way exposing the frame bolts.")
- return
+ else if (tool.tool_behaviour)
+ to_chat(user, "The bars need to be cut first!")
+
if(RWINDOW_BARS_CUT)
- if(I.tool_behaviour == TOOL_WRENCH)
+ if(tool.tool_behaviour == TOOL_WRENCH)
user.visible_message("[user] starts unfastening \the [src] from the frame...",
"You start unfastening the bolts from the frame...")
- if(I.use_tool(src, user, 40, volume = 50))
+ if(tool.use_tool(src, user, 40, volume = 50))
to_chat(user, "You unscrew the bolts from the frame and the window pops loose.")
state = WINDOW_OUT_OF_FRAME
set_anchored(FALSE)
- return
- return ..()
+ else if (tool.tool_behaviour)
+ to_chat(user, "The bolts need to be loosened first!")
+
+ return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
/obj/structure/window/proc/cool_bolts()
if(state == RWINDOW_BOLTS_HEATED)