Skip to content

Commit

Permalink
Door Speed (#3883)
Browse files Browse the repository at this point in the history
## About The Pull Request
refactors some door code
makes it so you can change how fast a door should close with airlock
electronics

## Why It's Good For The Game

engineering improvement + mapping stuff

## Changelog

:cl:
add: you can now change how fast a door should close with the door
electronics
/:cl:

---------

Signed-off-by: Erika Fox <[email protected]>
Co-authored-by: Mark Suckerberg <[email protected]>
  • Loading branch information
Erikafox and MarkSuckerberg authored Dec 21, 2024
1 parent 3ee6298 commit 75150ee
Show file tree
Hide file tree
Showing 11 changed files with 199 additions and 152 deletions.
14 changes: 7 additions & 7 deletions _maps/shuttles/independent/independent_shetland.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@
/obj/machinery/door/airlock/engineering{
dir = 4;
name = "Engineering";
normalspeed = 0;
fast_close = 1;
req_access_txt = "10"
},
/obj/effect/turf_decal/industrial/warning/fulltile,
Expand All @@ -647,7 +647,7 @@
/obj/machinery/door/airlock/engineering{
dir = 4;
name = "Engineering";
normalspeed = 0;
fast_close = 1;
req_access_txt = "10"
},
/obj/machinery/door/firedoor/border_only{
Expand Down Expand Up @@ -1727,7 +1727,7 @@
/obj/machinery/door/airlock/engineering{
dir = 4;
name = "Engine Room";
normalspeed = 0;
fast_close = 1;
req_access_txt = "10"
},
/obj/effect/turf_decal/industrial/warning/fulltile,
Expand Down Expand Up @@ -2062,7 +2062,7 @@
/obj/machinery/door/airlock/engineering{
dir = 4;
name = "Engineering";
normalspeed = 0;
fast_close = 1;
req_access_txt = "10"
},
/obj/effect/turf_decal/industrial/warning/fulltile,
Expand Down Expand Up @@ -2323,7 +2323,7 @@
/obj/machinery/door/airlock/engineering{
dir = 4;
name = "Engineering";
normalspeed = 0;
fast_close = 1;
req_access_txt = "10"
},
/obj/effect/turf_decal/industrial/warning/fulltile,
Expand Down Expand Up @@ -3861,7 +3861,7 @@
/obj/machinery/door/airlock/engineering{
dir = 4;
name = "Engine Room";
normalspeed = 0;
fast_close = 1;
req_access_txt = "10"
},
/obj/effect/turf_decal/industrial/warning/fulltile,
Expand Down Expand Up @@ -4379,7 +4379,7 @@
/obj/machinery/door/airlock/engineering{
dir = 4;
name = "Electrical";
normalspeed = 0;
fast_close = 1;
req_access_txt = "10"
},
/obj/effect/turf_decal/industrial/warning/fulltile,
Expand Down
4 changes: 2 additions & 2 deletions _maps/shuttles/inteq/inteq_talos.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@
/obj/machinery/door/airlock/engineering{
dir = 4;
name = "Engineering";
normalspeed = 0;
fast_close = 1;
req_access_txt = "10"
},
/obj/effect/turf_decal/industrial/warning/fulltile,
Expand Down Expand Up @@ -1614,7 +1614,7 @@
/obj/machinery/door/airlock/engineering{
dir = 4;
name = "Engineering";
normalspeed = 0;
fast_close = 1;
req_access_txt = "10"
},
/obj/effect/turf_decal/industrial/warning/fulltile,
Expand Down
16 changes: 8 additions & 8 deletions _maps/shuttles/syndicate/syndicate_ngr_derecho.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
/obj/machinery/door/airlock/hatch{
dir = 4;
name = "Command Deck";
normalspeed = 0;
fast_close = 1;
req_access_txt = "19"
},
/turf/open/floor/plasteel/tech/grid,
Expand Down Expand Up @@ -197,7 +197,7 @@
"bW" = (
/obj/machinery/door/airlock/hatch{
name = "Foreman's Office";
normalspeed = 0;
fast_close = 1;
req_access_txt = "56"
},
/turf/open/floor/plasteel/tech/grid,
Expand Down Expand Up @@ -826,7 +826,7 @@
/obj/machinery/door/airlock/hatch{
dir = 4;
name = "Life Support";
normalspeed = 0;
fast_close = 1;
req_access_txt = "10"
},
/obj/effect/decal/cleanable/dirt,
Expand Down Expand Up @@ -1534,7 +1534,7 @@
/obj/machinery/door/airlock/hatch{
dir = 1;
name = "Engineering";
normalspeed = 0;
fast_close = 1;
req_access_txt = "10"
},
/obj/effect/decal/cleanable/dirt,
Expand Down Expand Up @@ -2170,7 +2170,7 @@
/obj/machinery/door/airlock/hatch{
dir = 4;
name = "Control Room";
normalspeed = 0;
fast_close = 1;
req_access_txt = "10"
},
/turf/open/floor/plasteel/tech/grid,
Expand Down Expand Up @@ -2834,7 +2834,7 @@
"xQ" = (
/obj/machinery/door/airlock/hatch{
name = "Foreman's Office";
normalspeed = 0;
fast_close = 1;
req_access_txt = "56"
},
/obj/machinery/door/firedoor/border_only{
Expand Down Expand Up @@ -3243,7 +3243,7 @@
/obj/machinery/door/airlock/hatch{
dir = 4;
name = "Bridge";
normalspeed = 0;
fast_close = 1;
req_access_txt = "19"
},
/turf/open/floor/plasteel/tech/grid,
Expand Down Expand Up @@ -5547,7 +5547,7 @@
/obj/machinery/door/airlock/hatch{
dir = 4;
name = "Command Deck";
normalspeed = 0;
fast_close = 1;
req_access_txt = "19"
},
/obj/structure/sign/directions/command{
Expand Down
14 changes: 7 additions & 7 deletions _maps/shuttles/syndicate/syndicate_ngr_kaliandhi.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@
/obj/machinery/door/airlock/hatch{
dir = 8;
name = "Armory";
normalspeed = 0;
fast_close = 1;
req_access = list(3)
},
/obj/machinery/door/firedoor/border_only{
Expand Down Expand Up @@ -2169,7 +2169,7 @@
"oc" = (
/obj/machinery/door/airlock/hatch{
name = "Bridge";
normalspeed = 0;
fast_close = 1;
req_access_txt = "19"
},
/obj/machinery/door/firedoor/border_only{
Expand Down Expand Up @@ -3156,7 +3156,7 @@
/obj/machinery/door/airlock/hatch{
dir = 8;
name = "Armory";
normalspeed = 0;
fast_close = 1;
req_access = list(3)
},
/obj/structure/cable{
Expand Down Expand Up @@ -5536,7 +5536,7 @@
},
/obj/machinery/door/airlock/hatch{
name = "Control Room";
normalspeed = 0;
fast_close = 1;
req_access_txt = "10"
},
/obj/machinery/atmospherics/pipe/simple/supply/hidden/layer2{
Expand Down Expand Up @@ -5865,7 +5865,7 @@
"MS" = (
/obj/machinery/door/airlock/hatch{
name = "Command Deck";
normalspeed = 0;
fast_close = 1;
req_access_txt = "19"
},
/obj/structure/cable{
Expand Down Expand Up @@ -5905,7 +5905,7 @@
/obj/machinery/door/airlock/hatch{
dir = 4;
name = "Engineering";
normalspeed = 0;
fast_close = 1;
req_access_txt = "10"
},
/obj/structure/cable{
Expand Down Expand Up @@ -7629,7 +7629,7 @@
},
/obj/machinery/door/airlock/hatch{
name = "Life Support";
normalspeed = 0;
fast_close = 1;
req_access_txt = "10"
},
/obj/machinery/door/firedoor/border_only,
Expand Down
4 changes: 2 additions & 2 deletions code/datums/wires/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
status += "The AI connection light is [A.aiControlDisabled || (A.obj_flags & EMAGGED) ? "off" : "on"]."
status += "The check wiring light is [A.safe ? "off" : "on"]."
status += "The timer is powered [A.autoclose ? "on" : "off"]."
status += "The speed light is [A.normalspeed ? "on" : "off"]."
status += "The speed light is [A.fast_close ? "on" : "off"]."
status += "The emergency light is [A.emergency ? "on" : "off"]."
return status

Expand Down Expand Up @@ -94,7 +94,7 @@
if(!A.density)
A.close()
if(WIRE_TIMING)
A.normalspeed = !A.normalspeed
A.fast_close = !A.fast_close
if(WIRE_LIGHT)
A.lights = !A.lights
A.update_appearance()
Expand Down
10 changes: 6 additions & 4 deletions code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@
autoclose = TRUE
secondsElectrified = MACHINE_NOT_ELECTRIFIED //How many seconds remain until the door is no longer electrified. -1/MACHINE_ELECTRIFIED_PERMANENT = permanently electrified until someone fixes it.
assemblytype = /obj/structure/door_assembly
normalspeed = 1
fast_close = FALSE
explosion_block = 1
hud_possible = list(DIAG_AIRLOCK_HUD)
req_ship_access = TRUE

close_speed = 150

smoothing_groups = list(SMOOTH_GROUP_AIRLOCK)

FASTDMM_PROP(\
Expand Down Expand Up @@ -1260,7 +1262,7 @@
playsound(src, pry_open_sound, 30, TRUE, mono_adj = TRUE)

if(autoclose)
autoclose_in(normalspeed ? 150 : 15)
autoclose_in(fast_close ? clamp(close_speed/10, 10, 300) : close_speed)

if(!density)
return TRUE
Expand Down Expand Up @@ -1565,7 +1567,7 @@
data["locked"] = locked // bolted
data["lights"] = lights // bolt lights
data["safe"] = safe // safeties
data["speed"] = normalspeed // safe speed
data["operation speed"] = fast_close // safe speed
data["welded"] = welded // welded
data["opened"] = !density // opened

Expand Down Expand Up @@ -1633,7 +1635,7 @@
safe = !safe
. = TRUE
if("speed-toggle")
normalspeed = !normalspeed
fast_close = !fast_close
. = TRUE
if("open-close")
user_toggle_open(usr)
Expand Down
15 changes: 15 additions & 0 deletions code/game/machinery/doors/airlock_electronics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
name = "airlock electronics"
req_access = list(ACCESS_MAINT_TUNNELS)
custom_price = 50
///how fast the constructed airlock will close
var/close_speed = 15 SECONDS
/// A list of all granted accesses
var/list/accesses = list()
/// If the airlock should require ALL or only ONE of the listed accesses
Expand Down Expand Up @@ -47,6 +49,7 @@

/obj/item/electronics/airlock/ui_data()
var/list/data = list()
data["close_speed"] = close_speed
data["accesses"] = accesses
data["oneAccess"] = one_access
data["unres_direction"] = unres_sides
Expand Down Expand Up @@ -91,6 +94,18 @@
return
accesses -= get_region_accesses(region)
. = TRUE
if("close_speed")
var/tune = params["tune"]
var/adjust = text2num(params["adjust"])
if(adjust)
tune = close_speed + adjust SECONDS
. = TRUE
else if(text2num(tune) != null)
tune = tune SECONDS
. = TRUE
if(.)
close_speed = clamp(tune, 0, 300)
. = TRUE

/obj/item/electronics/airlock/ui_host()
if(holder)
Expand Down
7 changes: 5 additions & 2 deletions code/game/machinery/doors/door.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
var/operating = FALSE
var/glass = FALSE
var/welded = FALSE
var/normalspeed = 1
///does this airlock close quickly
var/fast_close = 0
///how long this door takes to close, if it is autoclosing
var/close_speed = 6 SECONDS
var/heat_proof = FALSE // For rglass-windowed airlocks and firedoors
var/emergency = FALSE // Emergency access override
var/sub_door = FALSE // true if it's meant to go under another door.
Expand Down Expand Up @@ -353,7 +356,7 @@
for(var/atom/movable/M in get_turf(src))
if(M.density && M != src) //something is blocking the door
if(autoclose)
autoclose_in(60)
autoclose_in(fast_close ? close_speed/10 : close_speed)
return

operating = TRUE
Expand Down
Loading

0 comments on commit 75150ee

Please sign in to comment.