From bd41cfbfc50b311c2360a268ce5759eb7d2fd058 Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Sun, 17 Nov 2019 22:44:37 +0100
Subject: [PATCH] fixing a few minor issues with console frames building.
---
code/game/machinery/computer/buildandrepair.dm | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/code/game/machinery/computer/buildandrepair.dm b/code/game/machinery/computer/buildandrepair.dm
index c8a4d68575..056beb2e96 100644
--- a/code/game/machinery/computer/buildandrepair.dm
+++ b/code/game/machinery/computer/buildandrepair.dm
@@ -19,7 +19,7 @@
return
to_chat(user, "You start deconstructing the frame...")
- if(P.use_tool(src, user, 20, volume=50))
+ if(P.use_tool(src, user, 20, volume=50) && state == 0)
to_chat(user, "You deconstruct the frame.")
var/obj/item/stack/sheet/metal/M = new (drop_location(), 5)
M.add_fingerprint(user)
@@ -28,7 +28,7 @@
if(1)
if(istype(P, /obj/item/wrench))
to_chat(user, "You start to unfasten the frame...")
- if(P.use_tool(src, user, 20, volume=50))
+ if(P.use_tool(src, user, 20, volume=50) && state == 1)
to_chat(user, "You unfasten the frame.")
setAnchored(FALSE)
state = 0
@@ -72,9 +72,7 @@
if(!P.tool_start_check(user, amount=5))
return
to_chat(user, "You start adding cables to the frame...")
- if(P.use_tool(src, user, 20, volume=50, amount=5))
- if(state != 2)
- return
+ if(P.use_tool(src, user, 20, 5, 50, CALLBACK(src, .proc/check_state, 2)))
to_chat(user, "You add cables to the frame.")
state = 3
icon_state = "3"
@@ -94,9 +92,7 @@
return
playsound(src, 'sound/items/deconstruct.ogg', 50, 1)
to_chat(user, "You start to put in the glass panel...")
- if(P.use_tool(src, user, 20, amount=2))
- if(state != 3)
- return
+ if(P.use_tool(src, user, 20, 2, 0, CALLBACK(src, .proc/check_state, 3)))
to_chat(user, "You put in the glass panel.")
state = 4
src.icon_state = "4"
@@ -121,6 +117,11 @@
if(user.a_intent == INTENT_HARM)
return ..()
+//callback proc used on stacks use_tool to stop unnecessary amounts being wasted from spam clicking.
+/obj/structure/frame/computer/proc/check_state(target_state)
+ if(state == target_state)
+ return TRUE
+ return FALSE
/obj/structure/frame/computer/deconstruct(disassembled = TRUE)
if(!(flags_1 & NODECONSTRUCT_1))