Changes reinforced window deconstruction to right click (#58523)

This commit is contained in:
dragomagol
2021-04-22 22:22:30 -07:00
committed by GitHub
parent e72c7a3832
commit 4b531c9d3e
3 changed files with 67 additions and 56 deletions
+14 -15
View File
@@ -509,22 +509,21 @@
else
return "<span class='notice'>The top cover is firmly <b>welded</b> on.</span>"
/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, "<span class='notice'>You start strengthening the reinforced table...</span>")
if (weapon.use_tool(src, user, 50, volume = 50))
to_chat(user, "<span class='notice'>You strengthen the table.</span>")
deconstruction_ready = FALSE
else
to_chat(user, "<span class='notice'>You start weakening the reinforced table...</span>")
if (weapon.use_tool(src, user, 50, volume = 50))
to_chat(user, "<span class='notice'>You weaken the table.</span>")
deconstruction_ready = TRUE
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
if(deconstruction_ready)
to_chat(user, "<span class='notice'>You start strengthening the reinforced table...</span>")
if (W.use_tool(src, user, 50, volume=50))
to_chat(user, "<span class='notice'>You strengthen the table.</span>")
deconstruction_ready = 0
else
to_chat(user, "<span class='notice'>You start weakening the reinforced table...</span>")
if (W.use_tool(src, user, 50, volume=50))
to_chat(user, "<span class='notice'>You weaken the table.</span>")
deconstruction_ready = 1
else
. = ..()
+38 -26
View File
@@ -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, "<span class='notice'>You begin repairing [src]...</span>")
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, "<span class='notice'>You repair [src].</span>")
@@ -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("<span class='notice'>[user] holds \the [I] to the security screws on \the [src]...</span>",
"<span class='notice'>You begin heating the security screws on \the [src]...</span>")
if(I.use_tool(src, user, 150, volume = 100))
to_chat(user, "<span class='notice'>The security bolts are glowing white hot and look ready to be removed.</span>")
if(tool.tool_behaviour == TOOL_WELDER)
var/obj/item/weldingtool/welder = tool
if(welder.isOn())
user.visible_message("<span class='notice'>[user] holds \the [tool] to the security screws on \the [src]...</span>",
"<span class='notice'>You begin heating the security screws on \the [src]...</span>")
if(tool.use_tool(src, user, 150, volume = 100))
to_chat(user, "<span class='notice'>The security screws are glowing white hot and look ready to be removed.</span>")
state = RWINDOW_BOLTS_HEATED
addtimer(CALLBACK(src, .proc/cool_bolts), 300)
return
else if (tool.tool_behaviour)
to_chat(user, "<span class='warning'>The security screws need to be heated first!</span>")
if(RWINDOW_BOLTS_HEATED)
if(I.tool_behaviour == TOOL_SCREWDRIVER)
if(tool.tool_behaviour == TOOL_SCREWDRIVER)
user.visible_message("<span class='notice'>[user] digs into the heated security screws and starts removing them...</span>",
"<span class='notice'>You dig into the heated screws hard and they start turning...</span>")
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, "<span class='notice'>The screws come out, and a gap forms around the edge of the pane.</span>")
return
else if (tool.tool_behaviour)
to_chat(user, "<span class='warning'>The security screws need to be removed first!</span>")
if(RWINDOW_BOLTS_OUT)
if(I.tool_behaviour == TOOL_CROWBAR)
user.visible_message("<span class='notice'>[user] wedges \the [I] into the gap in the frame and starts prying...</span>",
"<span class='notice'>You wedge \the [I] into the gap in the frame and start prying...</span>")
if(I.use_tool(src, user, 40, volume = 50))
if(tool.tool_behaviour == TOOL_CROWBAR)
user.visible_message("<span class='notice'>[user] wedges \the [tool] into the gap in the frame and starts prying...</span>",
"<span class='notice'>You wedge \the [tool] into the gap in the frame and start prying...</span>")
if(tool.use_tool(src, user, 40, volume = 50))
state = RWINDOW_POPPED
to_chat(user, "<span class='notice'>The panel pops out of the frame, exposing some thin metal bars that looks like they can be cut.</span>")
return
else if (tool.tool_behaviour)
to_chat(user, "<span class='warning'>The gap needs to be pried first!</span>")
if(RWINDOW_POPPED)
if(I.tool_behaviour == TOOL_WIRECUTTER)
if(tool.tool_behaviour == TOOL_WIRECUTTER)
user.visible_message("<span class='notice'>[user] starts cutting the exposed bars on \the [src]...</span>",
"<span class='notice'>You start cutting the exposed bars on \the [src]</span>")
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, "<span class='notice'>The panels falls out of the way exposing the frame bolts.</span>")
return
else if (tool.tool_behaviour)
to_chat(user, "<span class='warning'>The bars need to be cut first!</span>")
if(RWINDOW_BARS_CUT)
if(I.tool_behaviour == TOOL_WRENCH)
if(tool.tool_behaviour == TOOL_WRENCH)
user.visible_message("<span class='notice'>[user] starts unfastening \the [src] from the frame...</span>",
"<span class='notice'>You start unfastening the bolts from the frame...</span>")
if(I.use_tool(src, user, 40, volume = 50))
if(tool.use_tool(src, user, 40, volume = 50))
to_chat(user, "<span class='notice'>You unscrew the bolts from the frame and the window pops loose.</span>")
state = WINDOW_OUT_OF_FRAME
set_anchored(FALSE)
return
return ..()
else if (tool.tool_behaviour)
to_chat(user, "<span class='warning'>The bolts need to be loosened first!</span>")
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
/obj/structure/window/proc/cool_bolts()
if(state == RWINDOW_BOLTS_HEATED)