mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-09 16:07:40 +00:00
Merge pull request #14303 from DeltaFire15/wiring-skillgain
Adds state check callbacks to machine frame tool use
This commit is contained in:
@@ -117,12 +117,6 @@
|
||||
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))
|
||||
if(state == 4)
|
||||
|
||||
@@ -21,6 +21,11 @@
|
||||
circuit = null
|
||||
qdel(src)
|
||||
|
||||
//callback proc used on stacks use_tool to stop unnecessary amounts being wasted from spam clicking.
|
||||
/obj/structure/frame/proc/check_state(target_state)
|
||||
if(state == target_state)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/structure/frame/machine
|
||||
name = "machine frame"
|
||||
@@ -84,7 +89,7 @@
|
||||
if(!P.tool_start_check(user, amount=5))
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You start to add cables to the frame...</span>")
|
||||
if(P.use_tool(src, user, 20, volume=50, amount=5))
|
||||
if(P.use_tool(src, user, 20, volume=50, amount=5, extra_checks = CALLBACK(src, .proc/check_state, 1)))
|
||||
to_chat(user, "<span class='notice'>You add cables to the frame.</span>")
|
||||
state = 2
|
||||
icon_state = "box_1"
|
||||
@@ -93,25 +98,23 @@
|
||||
if(P.tool_behaviour == TOOL_SCREWDRIVER && !anchored)
|
||||
user.visible_message("<span class='warning'>[user] disassembles the frame.</span>", \
|
||||
"<span class='notice'>You start to disassemble the frame...</span>", "You hear banging and clanking.")
|
||||
if(P.use_tool(src, user, 40, volume=50))
|
||||
if(state == 1)
|
||||
to_chat(user, "<span class='notice'>You disassemble the frame.</span>")
|
||||
var/obj/item/stack/sheet/metal/M = new (loc, 5)
|
||||
M.add_fingerprint(user)
|
||||
qdel(src)
|
||||
if(P.use_tool(src, user, 40, volume=50, extra_checks = CALLBACK(src, .proc/check_state, 1)))
|
||||
to_chat(user, "<span class='notice'>You disassemble the frame.</span>")
|
||||
var/obj/item/stack/sheet/metal/M = new (loc, 5)
|
||||
M.add_fingerprint(user)
|
||||
qdel(src)
|
||||
return
|
||||
if(P.tool_behaviour == TOOL_WRENCH)
|
||||
to_chat(user, "<span class='notice'>You start [anchored ? "un" : ""]securing [name]...</span>")
|
||||
if(P.use_tool(src, user, 40, volume=75))
|
||||
if(state == 1)
|
||||
to_chat(user, "<span class='notice'>You [anchored ? "un" : ""]secure [name].</span>")
|
||||
setAnchored(!anchored)
|
||||
if(P.use_tool(src, user, 40, volume=75, extra_checks = CALLBACK(src, .proc/check_state, 1)))
|
||||
to_chat(user, "<span class='notice'>You [anchored ? "un" : ""]secure [name].</span>")
|
||||
setAnchored(!anchored)
|
||||
return
|
||||
|
||||
if(2)
|
||||
if(P.tool_behaviour == TOOL_WRENCH)
|
||||
to_chat(user, "<span class='notice'>You start [anchored ? "un" : ""]securing [name]...</span>")
|
||||
if(P.use_tool(src, user, 40, volume=75))
|
||||
if(P.use_tool(src, user, 40, volume=75, extra_checks = CALLBACK(src, .proc/check_state, 2)))
|
||||
to_chat(user, "<span class='notice'>You [anchored ? "un" : ""]secure [name].</span>")
|
||||
setAnchored(!anchored)
|
||||
return
|
||||
@@ -169,7 +172,7 @@
|
||||
|
||||
if(P.tool_behaviour == TOOL_WRENCH && !circuit.needs_anchored)
|
||||
to_chat(user, "<span class='notice'>You start [anchored ? "un" : ""]securing [name]...</span>")
|
||||
if(P.use_tool(src, user, 40, volume=75))
|
||||
if(P.use_tool(src, user, 40, volume=75, extra_checks = CALLBACK(src, .proc/check_state, 3)))
|
||||
to_chat(user, "<span class='notice'>You [anchored ? "un" : ""]secure [name].</span>")
|
||||
setAnchored(!anchored)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user