Skip to content

Commit

Permalink
Airlock fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AyIong committed Nov 12, 2023
1 parent 8786110 commit e06adac
Showing 1 changed file with 10 additions and 91 deletions.
101 changes: 10 additions & 91 deletions modular_bandastation/aesthetics/airlocks/code/airlock.dm
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
#define AIRLOCK_LIGHT_CLOSED "poweron"
#define AIRLOCK_LIGHT_OPENED "poweron_open"
#define AIRLOCK_LIGHT_BOLTS_OPEN "bolts_open"
#define AIRLOCK_LIGHT_EMERGENCY_OPEN "emergency_open"

#define AIRLOCK_FRAME_CLOSED "closed"
#define AIRLOCK_FRAME_CLOSING "closing"
#define AIRLOCK_FRAME_OPEN "open"
#define AIRLOCK_FRAME_OPENING "opening"

/obj/machinery/door/airlock
icon = 'modular_bandastation/aesthetics/airlocks/icons/station/public.dmi'
overlays_file = 'modular_bandastation/aesthetics/airlocks/icons/station/overlays.dmi'
Expand All @@ -18,92 +8,21 @@
boltUp = 'modular_bandastation/aesthetics/airlocks/sound/bolts_up.ogg'
boltDown = 'modular_bandastation/aesthetics/airlocks/sound/bolts_down.ogg'


/obj/machinery/door/airlock/update_overlays()
. = ..()

var/frame_state
if(!lights || !hasPower())
return
var/light_state
switch(airlock_state)
if(AIRLOCK_CLOSED)
light_state = AIRLOCK_LIGHT_CLOSED
frame_state = AIRLOCK_FRAME_CLOSED
if(locked)
light_state = AIRLOCK_LIGHT_BOLTS
else if(emergency)
light_state = AIRLOCK_LIGHT_EMERGENCY
if(AIRLOCK_DENY)
frame_state = AIRLOCK_FRAME_CLOSED
light_state = AIRLOCK_LIGHT_DENIED
if(AIRLOCK_EMAG)
frame_state = AIRLOCK_FRAME_CLOSED
if(AIRLOCK_CLOSING)
frame_state = AIRLOCK_FRAME_CLOSING
light_state = AIRLOCK_LIGHT_CLOSING
if(!locked && !emergency)
light_state = "poweron"
if(AIRLOCK_OPEN)
light_state = AIRLOCK_LIGHT_OPENED
frame_state = AIRLOCK_FRAME_OPEN
if(locked)
light_state = AIRLOCK_LIGHT_BOLTS_OPEN
light_state = "bolts_open"
else if(emergency)
light_state = AIRLOCK_LIGHT_EMERGENCY_OPEN
if(AIRLOCK_OPENING)
frame_state = AIRLOCK_FRAME_OPENING
light_state = AIRLOCK_LIGHT_OPENING

. += get_airlock_overlay(frame_state, icon, src, em_block = TRUE)
if(airlock_material)
. += get_airlock_overlay("[airlock_material]_[frame_state]", overlays_file, src, em_block = TRUE)
else
. += get_airlock_overlay("fill_[frame_state]", icon, src, em_block = TRUE)

if(lights && hasPower())
. += get_airlock_overlay("lights_[light_state]", overlays_file, src, em_block = FALSE)

if(panel_open)
. += get_airlock_overlay("panel_[frame_state][security_level ? "_protected" : null]", overlays_file, src, em_block = TRUE)
if(frame_state == AIRLOCK_FRAME_CLOSED && welded)
. += get_airlock_overlay("welded", overlays_file, src, em_block = TRUE)

if(airlock_state == AIRLOCK_EMAG)
. += get_airlock_overlay("sparks", overlays_file, src, em_block = FALSE)

if(hasPower())
if(frame_state == AIRLOCK_FRAME_CLOSED)
if(atom_integrity < integrity_failure * max_integrity)
. += get_airlock_overlay("sparks_broken", overlays_file, src, em_block = FALSE)
else if(atom_integrity < (0.75 * max_integrity))
. += get_airlock_overlay("sparks_damaged", overlays_file, src, em_block = FALSE)
else if(frame_state == AIRLOCK_FRAME_OPEN)
if(atom_integrity < (0.75 * max_integrity))
. += get_airlock_overlay("sparks_open", overlays_file, src, em_block = FALSE)

if(note)
. += get_airlock_overlay(get_note_state(frame_state), note_overlay_file, src, em_block = TRUE)

if(frame_state == AIRLOCK_FRAME_CLOSED && seal)
. += get_airlock_overlay("sealed", overlays_file, src, em_block = TRUE)

if(hasPower() && unres_sides)
for(var/heading in list(NORTH,SOUTH,EAST,WEST))
if(!(unres_sides & heading))
continue
var/mutable_appearance/floorlight = mutable_appearance('icons/obj/doors/airlocks/station/overlays.dmi', "unres_[heading]", FLOAT_LAYER, src, ABOVE_LIGHTING_PLANE)
switch (heading)
if (NORTH)
floorlight.pixel_x = 0
floorlight.pixel_y = 32
if (SOUTH)
floorlight.pixel_x = 0
floorlight.pixel_y = -32
if (EAST)
floorlight.pixel_x = 32
floorlight.pixel_y = 0
if (WEST)
floorlight.pixel_x = -32
floorlight.pixel_y = 0
. += floorlight

#undef AIRLOCK_FRAME_CLOSED
#undef AIRLOCK_FRAME_CLOSING
#undef AIRLOCK_FRAME_OPEN
#undef AIRLOCK_FRAME_OPENING
light_state = "emergency_open"
else
light_state = "poweron_open"
. += get_airlock_overlay("lights_[light_state]", overlays_file, src, em_block = FALSE)

0 comments on commit e06adac

Please sign in to comment.