mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 06:00:16 +01:00
[MIRROR] firedoor pr (#368)
* firedoor pr (#52689) * firedoor pr Co-authored-by: Tlaltecuhtli <33834933+Tlaltecuhtli@users.noreply.github.com>
This commit is contained in:
co-authored by
Tlaltecuhtli
parent
dad0ff3074
commit
b93a75baa0
@@ -1,8 +1,6 @@
|
||||
#define CONSTRUCTION_COMPLETE 0 //No construction done - functioning as normal
|
||||
#define CONSTRUCTION_PANEL_OPEN 1 //Maintenance panel is open, still functioning
|
||||
#define CONSTRUCTION_WIRES_EXPOSED 2 //Cover plate is removed, wires are available
|
||||
#define CONSTRUCTION_GUTTED 3 //Wires are removed, circuit ready to remove
|
||||
#define CONSTRUCTION_NOCIRCUIT 4 //Circuit board removed, can safely weld apart
|
||||
#define CONSTRUCTION_NO_CIRCUIT 2 //Circuit board removed, can safely weld apart
|
||||
#define DEFAULT_STEP_TIME 20 /// default time for each step
|
||||
|
||||
/obj/machinery/door/firedoor
|
||||
name = "firelock"
|
||||
@@ -21,7 +19,7 @@
|
||||
layer = BELOW_OPEN_DOOR_LAYER
|
||||
closingLayer = CLOSED_FIREDOOR_LAYER
|
||||
assemblytype = /obj/structure/firelock_frame
|
||||
armor = list("melee" = 30, "bullet" = 30, "laser" = 20, "energy" = 20, "bomb" = 10, "bio" = 100, "rad" = 100, "fire" = 95, "acid" = 70)
|
||||
armor = list("melee" = 10, "bullet" = 30, "laser" = 20, "energy" = 20, "bomb" = 30, "bio" = 100, "rad" = 100, "fire" = 95, "acid" = 70)
|
||||
interaction_flags_machine = INTERACT_MACHINE_WIRES_IF_OPEN | INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OPEN_SILICON | INTERACT_MACHINE_REQUIRES_SILICON | INTERACT_MACHINE_OPEN
|
||||
var/nextstate = null
|
||||
var/boltslocked = TRUE
|
||||
@@ -95,7 +93,6 @@
|
||||
add_fingerprint(user)
|
||||
if(operating)
|
||||
return
|
||||
|
||||
if(welded)
|
||||
if(C.tool_behaviour == TOOL_WRENCH)
|
||||
if(boltslocked)
|
||||
@@ -104,7 +101,7 @@
|
||||
C.play_tool_sound(src)
|
||||
user.visible_message("<span class='notice'>[user] starts undoing [src]'s bolts...</span>", \
|
||||
"<span class='notice'>You start unfastening [src]'s floor bolts...</span>")
|
||||
if(!C.use_tool(src, user, 50))
|
||||
if(!C.use_tool(src, user, DEFAULT_STEP_TIME))
|
||||
return
|
||||
playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, TRUE)
|
||||
user.visible_message("<span class='notice'>[user] unfastens [src]'s bolts.</span>", \
|
||||
@@ -117,7 +114,6 @@
|
||||
C.play_tool_sound(src)
|
||||
boltslocked = !boltslocked
|
||||
return
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/machinery/door/firedoor/try_to_activate_door(mob/user)
|
||||
@@ -127,7 +123,7 @@
|
||||
if(!W.tool_start_check(user, amount=0))
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] starts [welded ? "unwelding" : "welding"] [src].</span>", "<span class='notice'>You start welding [src].</span>")
|
||||
if(W.use_tool(src, user, 40, volume=50))
|
||||
if(W.use_tool(src, user, DEFAULT_STEP_TIME, volume=50))
|
||||
welded = !welded
|
||||
to_chat(user, "<span class='danger'>[user] [welded?"welds":"unwelds"] [src].</span>", "<span class='notice'>You [welded ? "weld" : "unweld"] [src].</span>")
|
||||
update_icon()
|
||||
@@ -193,13 +189,17 @@
|
||||
|
||||
/obj/machinery/door/firedoor/deconstruct(disassembled = TRUE)
|
||||
if(!(flags_1 & NODECONSTRUCT_1))
|
||||
var/obj/structure/firelock_frame/F = new assemblytype(get_turf(src))
|
||||
if(disassembled)
|
||||
F.constructionStep = CONSTRUCTION_PANEL_OPEN
|
||||
var/turf/T = get_turf(src)
|
||||
if(disassembled || prob(40))
|
||||
var/obj/structure/firelock_frame/F = new assemblytype(T)
|
||||
if(disassembled)
|
||||
F.constructionStep = CONSTRUCTION_PANEL_OPEN
|
||||
else
|
||||
F.constructionStep = CONSTRUCTION_NO_CIRCUIT
|
||||
F.obj_integrity = F.max_integrity * 0.5
|
||||
F.update_icon()
|
||||
else
|
||||
F.constructionStep = CONSTRUCTION_WIRES_EXPOSED
|
||||
F.obj_integrity = F.max_integrity * 0.5
|
||||
F.update_icon()
|
||||
new /obj/item/electronics/firelock (T)
|
||||
qdel(src)
|
||||
|
||||
|
||||
@@ -268,22 +268,18 @@
|
||||
icon_state = "frame1"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
var/constructionStep = CONSTRUCTION_NOCIRCUIT
|
||||
var/constructionStep = CONSTRUCTION_NO_CIRCUIT
|
||||
var/reinforced = 0
|
||||
|
||||
/obj/structure/firelock_frame/examine(mob/user)
|
||||
. = ..()
|
||||
switch(constructionStep)
|
||||
if(CONSTRUCTION_PANEL_OPEN)
|
||||
. += "<span class='notice'>It is <i>unbolted</i> from the floor. A small <b>loosely connected</b> metal plate is covering the wires.</span>"
|
||||
. += "<span class='notice'>It is <i>unbolted</i> from the floor. The circuit could be removed with a <b>crowbar</b>.</span>"
|
||||
if(!reinforced)
|
||||
. += "<span class='notice'>It could be reinforced with plasteel.</span>"
|
||||
if(CONSTRUCTION_WIRES_EXPOSED)
|
||||
. += "<span class='notice'>The maintenance plate has been <i>pried away</i>, and <b>wires</b> are trailing.</span>"
|
||||
if(CONSTRUCTION_GUTTED)
|
||||
. += "<span class='notice'>The maintenance panel is missing <i>wires</i> and the circuit board is <b>loosely connected</b>.</span>"
|
||||
if(CONSTRUCTION_NOCIRCUIT)
|
||||
. += "<span class='notice'>There are no <i>firelock electronics</i> in the frame. The frame could be <b>cut</b> apart.</span>"
|
||||
if(CONSTRUCTION_NO_CIRCUIT)
|
||||
. += "<span class='notice'>There are no <i>firelock electronics</i> in the frame. The frame could be <b>welded</b> apart .</span>"
|
||||
|
||||
/obj/structure/firelock_frame/update_icon_state()
|
||||
icon_state = "frame[constructionStep]"
|
||||
@@ -293,16 +289,17 @@
|
||||
if(CONSTRUCTION_PANEL_OPEN)
|
||||
if(C.tool_behaviour == TOOL_CROWBAR)
|
||||
C.play_tool_sound(src)
|
||||
user.visible_message("<span class='notice'>[user] starts prying something out from [src]...</span>", \
|
||||
"<span class='notice'>You begin prying out the wire cover...</span>")
|
||||
if(!C.use_tool(src, user, 50))
|
||||
user.visible_message("<span class='notice'>[user] begins removing the circuit board from [src]...</span>", \
|
||||
"<span class='notice'>You begin prying out the circuit board from [src]...</span>")
|
||||
if(!C.use_tool(src, user, DEFAULT_STEP_TIME))
|
||||
return
|
||||
if(constructionStep != CONSTRUCTION_PANEL_OPEN)
|
||||
return
|
||||
playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, TRUE)
|
||||
user.visible_message("<span class='notice'>[user] pries out a metal plate from [src], exposing the wires.</span>", \
|
||||
"<span class='notice'>You remove the cover plate from [src], exposing the wires.</span>")
|
||||
constructionStep = CONSTRUCTION_WIRES_EXPOSED
|
||||
user.visible_message("<span class='notice'>[user] removes [src]'s circuit board.</span>", \
|
||||
"<span class='notice'>You remove the circuit board from [src].</span>")
|
||||
new /obj/item/electronics/firelock(drop_location())
|
||||
constructionStep = CONSTRUCTION_NO_CIRCUIT
|
||||
update_icon()
|
||||
return
|
||||
if(C.tool_behaviour == TOOL_WRENCH)
|
||||
@@ -312,7 +309,7 @@
|
||||
C.play_tool_sound(src)
|
||||
user.visible_message("<span class='notice'>[user] starts bolting down [src]...</span>", \
|
||||
"<span class='notice'>You begin bolting [src]...</span>")
|
||||
if(!C.use_tool(src, user, 30))
|
||||
if(!C.use_tool(src, user, DEFAULT_STEP_TIME))
|
||||
return
|
||||
if(locate(/obj/machinery/door/firedoor) in get_turf(src))
|
||||
return
|
||||
@@ -336,7 +333,7 @@
|
||||
user.visible_message("<span class='notice'>[user] begins reinforcing [src]...</span>", \
|
||||
"<span class='notice'>You begin reinforcing [src]...</span>")
|
||||
playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, TRUE)
|
||||
if(do_after(user, 60, target = src))
|
||||
if(do_after(user, DEFAULT_STEP_TIME, target = src))
|
||||
if(constructionStep != CONSTRUCTION_PANEL_OPEN || reinforced || P.get_amount() < 2 || !P)
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] reinforces [src].</span>", \
|
||||
@@ -345,77 +342,29 @@
|
||||
P.use(2)
|
||||
reinforced = 1
|
||||
return
|
||||
|
||||
if(CONSTRUCTION_WIRES_EXPOSED)
|
||||
if(C.tool_behaviour == TOOL_WIRECUTTER)
|
||||
C.play_tool_sound(src)
|
||||
user.visible_message("<span class='notice'>[user] starts cutting the wires from [src]...</span>", \
|
||||
"<span class='notice'>You begin removing [src]'s wires...</span>")
|
||||
if(!C.use_tool(src, user, 60))
|
||||
return
|
||||
if(constructionStep != CONSTRUCTION_WIRES_EXPOSED)
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] removes the wires from [src].</span>", \
|
||||
"<span class='notice'>You remove the wiring from [src], exposing the circuit board.</span>")
|
||||
new/obj/item/stack/cable_coil(get_turf(src), 5)
|
||||
constructionStep = CONSTRUCTION_GUTTED
|
||||
update_icon()
|
||||
return
|
||||
if(C.tool_behaviour == TOOL_CROWBAR)
|
||||
C.play_tool_sound(src)
|
||||
user.visible_message("<span class='notice'>[user] starts prying a metal plate into [src]...</span>", \
|
||||
"<span class='notice'>You begin prying the cover plate back onto [src]...</span>")
|
||||
if(!C.use_tool(src, user, 80))
|
||||
return
|
||||
if(constructionStep != CONSTRUCTION_WIRES_EXPOSED)
|
||||
return
|
||||
if(CONSTRUCTION_NO_CIRCUIT)
|
||||
if(istype(C, /obj/item/electronics/firelock))
|
||||
user.visible_message("<span class='notice'>[user] starts adding [C] to [src]...</span>", \
|
||||
"<span class='notice'>You begin adding a circuit board to [src]...</span>")
|
||||
playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, TRUE)
|
||||
if(!do_after(user, DEFAULT_STEP_TIME, target = src))
|
||||
return
|
||||
if(constructionStep != CONSTRUCTION_NO_CIRCUIT)
|
||||
return
|
||||
qdel(C)
|
||||
user.visible_message("<span class='notice'>[user] adds a circuit to [src].</span>", \
|
||||
"<span class='notice'>You insert and secure [C].</span>")
|
||||
playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, TRUE)
|
||||
user.visible_message("<span class='notice'>[user] pries the metal plate into [src].</span>", \
|
||||
"<span class='notice'>You pry [src]'s cover plate into place, hiding the wires.</span>")
|
||||
constructionStep = CONSTRUCTION_PANEL_OPEN
|
||||
update_icon()
|
||||
return
|
||||
if(CONSTRUCTION_GUTTED)
|
||||
if(C.tool_behaviour == TOOL_CROWBAR)
|
||||
user.visible_message("<span class='notice'>[user] begins removing the circuit board from [src]...</span>", \
|
||||
"<span class='notice'>You begin prying out the circuit board from [src]...</span>")
|
||||
if(!C.use_tool(src, user, 50, volume=50))
|
||||
return
|
||||
if(constructionStep != CONSTRUCTION_GUTTED)
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] removes [src]'s circuit board.</span>", \
|
||||
"<span class='notice'>You remove the circuit board from [src].</span>")
|
||||
new /obj/item/electronics/firelock(drop_location())
|
||||
constructionStep = CONSTRUCTION_NOCIRCUIT
|
||||
update_icon()
|
||||
return
|
||||
if(istype(C, /obj/item/stack/cable_coil))
|
||||
var/obj/item/stack/cable_coil/B = C
|
||||
if(B.get_amount() < 5)
|
||||
to_chat(user, "<span class='warning'>You need more wires to add wiring to [src].</span>")
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] begins wiring [src]...</span>", \
|
||||
"<span class='notice'>You begin adding wires to [src]...</span>")
|
||||
playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, TRUE)
|
||||
if(do_after(user, 60, target = src))
|
||||
if(constructionStep != CONSTRUCTION_GUTTED || B.get_amount() < 5 || !B)
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] adds wires to [src].</span>", \
|
||||
"<span class='notice'>You wire [src].</span>")
|
||||
playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, TRUE)
|
||||
B.use(5)
|
||||
constructionStep = CONSTRUCTION_WIRES_EXPOSED
|
||||
update_icon()
|
||||
return
|
||||
if(CONSTRUCTION_NOCIRCUIT)
|
||||
if(C.tool_behaviour == TOOL_WELDER)
|
||||
if(!C.tool_start_check(user, amount=1))
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] begins cutting apart [src]'s frame...</span>", \
|
||||
"<span class='notice'>You begin slicing [src] apart...</span>")
|
||||
|
||||
if(C.use_tool(src, user, 40, volume=50, amount=1))
|
||||
if(constructionStep != CONSTRUCTION_NOCIRCUIT)
|
||||
if(C.use_tool(src, user, DEFAULT_STEP_TIME, volume=50, amount=1))
|
||||
if(constructionStep != CONSTRUCTION_NO_CIRCUIT)
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] cuts apart [src]!</span>", \
|
||||
"<span class='notice'>You cut [src] into metal.</span>")
|
||||
@@ -425,28 +374,13 @@
|
||||
new /obj/item/stack/sheet/plasteel(T, 2)
|
||||
qdel(src)
|
||||
return
|
||||
if(istype(C, /obj/item/electronics/firelock))
|
||||
user.visible_message("<span class='notice'>[user] starts adding [C] to [src]...</span>", \
|
||||
"<span class='notice'>You begin adding a circuit board to [src]...</span>")
|
||||
playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, TRUE)
|
||||
if(!do_after(user, 40, target = src))
|
||||
return
|
||||
if(constructionStep != CONSTRUCTION_NOCIRCUIT)
|
||||
return
|
||||
qdel(C)
|
||||
user.visible_message("<span class='notice'>[user] adds a circuit to [src].</span>", \
|
||||
"<span class='notice'>You insert and secure [C].</span>")
|
||||
playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, TRUE)
|
||||
constructionStep = CONSTRUCTION_GUTTED
|
||||
update_icon()
|
||||
return
|
||||
if(istype(C, /obj/item/electroadaptive_pseudocircuit))
|
||||
var/obj/item/electroadaptive_pseudocircuit/P = C
|
||||
if(!P.adapt_circuit(user, 30))
|
||||
if(!P.adapt_circuit(user, DEFAULT_STEP_TIME * 0.5))
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] fabricates a circuit and places it into [src].</span>", \
|
||||
"<span class='notice'>You adapt a firelock circuit and slot it into the assembly.</span>")
|
||||
constructionStep = CONSTRUCTION_GUTTED
|
||||
constructionStep = CONSTRUCTION_PANEL_OPEN
|
||||
update_icon()
|
||||
return
|
||||
return ..()
|
||||
@@ -454,7 +388,7 @@
|
||||
/obj/structure/firelock_frame/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd)
|
||||
if(the_rcd.mode == RCD_DECONSTRUCT)
|
||||
return list("mode" = RCD_DECONSTRUCT, "delay" = 50, "cost" = 16)
|
||||
else if((constructionStep == CONSTRUCTION_NOCIRCUIT) && (the_rcd.upgrade & RCD_UPGRADE_SIMPLE_CIRCUITS))
|
||||
else if((constructionStep == CONSTRUCTION_NO_CIRCUIT) && (the_rcd.upgrade & RCD_UPGRADE_SIMPLE_CIRCUITS))
|
||||
return list("mode" = RCD_UPGRADE_SIMPLE_CIRCUITS, "delay" = 20, "cost" = 1)
|
||||
return FALSE
|
||||
|
||||
@@ -463,7 +397,7 @@
|
||||
if(RCD_UPGRADE_SIMPLE_CIRCUITS)
|
||||
user.visible_message("<span class='notice'>[user] fabricates a circuit and places it into [src].</span>", \
|
||||
"<span class='notice'>You adapt a firelock circuit and slot it into the assembly.</span>")
|
||||
constructionStep = CONSTRUCTION_GUTTED
|
||||
constructionStep = CONSTRUCTION_PANEL_OPEN
|
||||
update_icon()
|
||||
return TRUE
|
||||
if(RCD_DECONSTRUCT)
|
||||
@@ -476,8 +410,5 @@
|
||||
name = "heavy firelock frame"
|
||||
reinforced = TRUE
|
||||
|
||||
#undef CONSTRUCTION_COMPLETE
|
||||
#undef CONSTRUCTION_PANEL_OPEN
|
||||
#undef CONSTRUCTION_WIRES_EXPOSED
|
||||
#undef CONSTRUCTION_GUTTED
|
||||
#undef CONSTRUCTION_NOCIRCUIT
|
||||
#undef CONSTRUCTION_NO_CIRCUIT
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
Reference in New Issue
Block a user