Skip to content

Commit

Permalink
Generalizes the 'begin open' airlock behavior.
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 authored and comma committed Nov 19, 2023
1 parent 65a5118 commit 42f8ce1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 24 deletions.
16 changes: 13 additions & 3 deletions code/game/machinery/doors/_door.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
atmos_canpass = CANPASS_PROC

var/set_dir_on_update = TRUE
var/begins_closed = TRUE
var/icon_state_open = "door0"
var/icon_state_closed = "door1"

/obj/machinery/door/proc/can_operate(var/mob/user)
. = istype(user) && !user.restrained() && (!issmall(user) || ishuman(user) || issilicon(user) || isbot(user))
Expand All @@ -69,6 +72,13 @@
if(!populate_parts)
inherit_from_assembly(assembly)
set_extension(src, /datum/extension/penetration, /datum/extension/penetration/proc_call, .proc/CheckPenetration)

if(!begins_closed)
icon_state = icon_state_open
set_density(FALSE)
set_opacity(FALSE)
layer = open_layer

..()
. = INITIALIZE_HINT_LATELOAD

Expand Down Expand Up @@ -379,9 +389,9 @@

/obj/machinery/door/on_update_icon()
if(density)
icon_state = "door1"
icon_state = icon_state_closed
else
icon_state = "door0"
icon_state = icon_state_open

SSradiation.resistance_cache.Remove(get_turf(src))

Expand Down Expand Up @@ -412,7 +422,7 @@
operating = 1

do_animate("opening")
icon_state = "door0"
icon_state = icon_state_open
set_opacity(FALSE)

sleep(0.5 SECONDS)
Expand Down
14 changes: 10 additions & 4 deletions code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ var/global/list/airlock_overlays = list()
base_type = /obj/machinery/door/airlock
frame_type = /obj/structure/door_assembly

icon_state_open = "open"
icon_state_closed = "closed"

var/aiControlDisabled = 0 //If 1, AI control is disabled until the AI hacks back in and disables the lock. If 2, the AI has bypassed the lock. If -1, the control is enabled but the AI had bypassed it earlier, so if it is disabled again the AI would have no trouble getting back in.
var/hackProof = 0 // if 1, this door can't be hacked by the AI
var/electrified_until = 0 //World time when the door is no longer electrified. -1 if it is permanently electrified until someone fixes it.
Expand Down Expand Up @@ -300,15 +303,15 @@ About the new airlock wires panel:
switch(state)
if(0)
if(density)
icon_state = "closed"
icon_state = icon_state_closed
state = AIRLOCK_CLOSED
else
icon_state = "open"
icon_state = icon_state_open
state = AIRLOCK_OPEN
if(AIRLOCK_OPEN)
icon_state = "open"
icon_state = icon_state_open
if(AIRLOCK_CLOSED)
icon_state = "closed"
icon_state = icon_state_closed
if(AIRLOCK_OPENING, AIRLOCK_CLOSING, AIRLOCK_EMAG, AIRLOCK_DENY)
icon_state = ""

Expand Down Expand Up @@ -986,6 +989,7 @@ About the new airlock wires panel:

/obj/machinery/door/airlock/Initialize(var/mapload, var/d, var/populate_parts = TRUE, obj/structure/door_assembly/assembly = null)
. = ..()

//wires
var/turf/T = get_turf(loc)
if(T && isAdminLevel(T.z))
Expand All @@ -1003,6 +1007,8 @@ About the new airlock wires panel:
if(brace.electronics)
brace.req_access = get_req_access()
queue_icon_update()
else if(!begins_closed)
queue_icon_update()

if (glass)
paintable |= PAINT_WINDOW_PAINTABLE
Expand Down
11 changes: 5 additions & 6 deletions code/game/machinery/doors/airlock_subtypes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@

/obj/machinery/door/airlock/medical/open
icon_state = "open"

/obj/machinery/door/airlock/medical/open/Initialize()
set_density(FALSE)
set_opacity(FALSE)
layer = open_layer
return ..()
begins_closed = FALSE

/obj/machinery/door/airlock/virology
door_color = COLOR_WHITE
Expand Down Expand Up @@ -154,6 +149,10 @@
/decl/stock_part_preset/radio/event_transmitter/airlock/external_air = 1
)

/obj/machinery/door/airlock/external/open
icon_state = "open"
begins_closed = FALSE

/obj/machinery/door/airlock/external/get_auto_access()
. = ..()
var/area/A = get_area(src)
Expand Down
14 changes: 3 additions & 11 deletions code/game/machinery/doors/blast_door.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
can_open_manually = FALSE

// Icon states for different shutter types. Simply change this instead of rewriting the update_icon proc.
var/icon_state_open = null
icon_state_open = null
icon_state_closed = null
var/icon_state_opening = null
var/icon_state_closed = null
var/icon_state_closing = null

var/icon_state_open_broken = null
Expand All @@ -36,7 +36,6 @@
//turning this off prevents awkward zone geometry in places like medbay lobby, for example.
block_air_zones = 0

var/begins_closed = TRUE
var/decl/material/implicit_material
autoset_access = FALSE // Uses different system with buttons.
pry_mod = 1.35
Expand All @@ -55,15 +54,8 @@
base_type = /obj/machinery/door/blast

/obj/machinery/door/blast/Initialize()
. = ..()

if(!begins_closed)
icon_state = icon_state_open
set_density(0)
set_opacity(0)
layer = open_layer

implicit_material = GET_DECL(/decl/material/solid/metal/plasteel)
. = ..()

/obj/machinery/door/blast/examine(mob/user)
. = ..()
Expand Down

0 comments on commit 42f8ce1

Please sign in to comment.