Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Airlock/status light overlays maintenance #2184

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions code/__DEFINES/~nova_defines/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
#define AIRLOCK_LIGHT_POWER 0.5
#define AIRLOCK_LIGHT_RANGE 2
#define AIRLOCK_LIGHT_ENGINEERING "engineering"
#define AIRLOCK_LIGHT_FIRE "fire"
#define AIRLOCK_LIGHT_POWERON "poweron"
#define AIRLOCK_POWERON_LIGHT_COLOR "#3aa7c2"
#define AIRLOCK_FIRE_LIGHT_COLOR "#eaeaea"
#define AIRLOCK_BOLTS_LIGHT_COLOR "#c22323"
#define AIRLOCK_ACCESS_LIGHT_COLOR "#57e69c"
#define AIRLOCK_EMERGENCY_LIGHT_COLOR "#d1d11d"
Expand Down
132 changes: 71 additions & 61 deletions modular_nova/modules/aesthetics/airlock/code/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,17 @@
doorClose = 'modular_nova/modules/aesthetics/airlock/sound/close.ogg'
boltUp = 'modular_nova/modules/aesthetics/airlock/sound/bolts_up.ogg'
boltDown = 'modular_nova/modules/aesthetics/airlock/sound/bolts_down.ogg'
//noPower = 'sound/machines/doorclick.ogg'
var/forcedOpen = 'modular_nova/modules/aesthetics/airlock/sound/open_force.ogg' //Come on guys, why aren't all the sound files like this.
var/forcedClosed = 'modular_nova/modules/aesthetics/airlock/sound/close_force.ogg'

/// For those airlocks you might want to have varying "fillings" for, without having to
/// have an icon file per door with a different filling.
var/fill_state_suffix = null
/// For the airlocks that use greyscale lights, set this to the color you want your lights to be.
var/greyscale_lights_color = null
/// For the airlocks that use a greyscale accent door color, set this color to the accent color you want it to be.
var/greyscale_accent_color = null

var/has_environment_lights = TRUE //Does this airlock emit a light?
var/light_color_poweron = AIRLOCK_POWERON_LIGHT_COLOR
var/light_color_bolts = AIRLOCK_BOLTS_LIGHT_COLOR
var/light_color_access = AIRLOCK_ACCESS_LIGHT_COLOR
var/light_color_emergency = AIRLOCK_EMERGENCY_LIGHT_COLOR
var/light_color_engineering = AIRLOCK_ENGINEERING_LIGHT_COLOR
var/light_color_deny = AIRLOCK_DENY_LIGHT_COLOR
var/door_light_range = AIRLOCK_LIGHT_RANGE
var/door_light_power = AIRLOCK_LIGHT_POWER
///Is this door external? E.g. does it lead to space? Shuttle docking systems bolt doors with this flag.
/// Does this airlock emit a light?
var/has_environment_lights = TRUE
/// Is this door external? E.g. does it lead to space? Shuttle docking systems bolt doors with this flag.
var/external = FALSE

/obj/machinery/door/airlock/external
Expand All @@ -39,90 +28,74 @@

/obj/machinery/door/airlock/update_overlays()
. = ..()
var/pre_light_range = 0
var/pre_light_power = 0
var/pre_light_color = initial(light_color)
var/lights_overlay = ""

var/frame_state
var/light_state
var/light_state = AIRLOCK_LIGHT_POWERON
var/pre_light_color
switch(airlock_state)
if(AIRLOCK_CLOSED)
frame_state = AIRLOCK_FRAME_CLOSED
if(locked)
light_state = AIRLOCK_LIGHT_BOLTS
lights_overlay = "lights_bolts"
pre_light_color = light_color_bolts
pre_light_color = AIRLOCK_BOLTS_LIGHT_COLOR
else if(emergency)
light_state = AIRLOCK_LIGHT_EMERGENCY
lights_overlay = "lights_emergency"
pre_light_color = light_color_emergency
pre_light_color = AIRLOCK_EMERGENCY_LIGHT_COLOR
else if(fire_active)
light_state = AIRLOCK_LIGHT_FIRE
pre_light_color = AIRLOCK_FIRE_LIGHT_COLOR
else if(engineering_override)
light_state = AIRLOCK_LIGHT_ENGINEERING
lights_overlay = "lights_engineering"
pre_light_color = light_color_engineering
pre_light_color = AIRLOCK_ENGINEERING_LIGHT_COLOR
else
lights_overlay = "lights_poweron"
pre_light_color = light_color_poweron
pre_light_color = AIRLOCK_POWERON_LIGHT_COLOR
if(AIRLOCK_DENY)
frame_state = AIRLOCK_FRAME_CLOSED
light_state = AIRLOCK_LIGHT_DENIED
lights_overlay = "lights_denied"
pre_light_color = light_color_deny
pre_light_color = AIRLOCK_DENY_LIGHT_COLOR
if(AIRLOCK_EMAG)
frame_state = AIRLOCK_FRAME_CLOSED
if(AIRLOCK_CLOSING)
frame_state = AIRLOCK_FRAME_CLOSING
light_state = AIRLOCK_LIGHT_CLOSING
lights_overlay = "lights_closing"
pre_light_color = light_color_access
pre_light_color = AIRLOCK_ACCESS_LIGHT_COLOR
if(AIRLOCK_OPEN)
frame_state = AIRLOCK_FRAME_OPEN
if(locked)
lights_overlay = "lights_bolts_open"
pre_light_color = light_color_bolts
light_state = AIRLOCK_LIGHT_BOLTS
pre_light_color = AIRLOCK_BOLTS_LIGHT_COLOR
else if(emergency)
lights_overlay = "lights_emergency_open"
pre_light_color = light_color_emergency
light_state = AIRLOCK_LIGHT_EMERGENCY
pre_light_color = AIRLOCK_EMERGENCY_LIGHT_COLOR
else if(fire_active)
light_state = AIRLOCK_LIGHT_FIRE
pre_light_color = AIRLOCK_FIRE_LIGHT_COLOR
else if(engineering_override)
light_state = AIRLOCK_LIGHT_ENGINEERING
pre_light_color = AIRLOCK_ENGINEERING_LIGHT_COLOR
else
lights_overlay = "lights_poweron_open"
pre_light_color = light_color_poweron
pre_light_color = AIRLOCK_POWERON_LIGHT_COLOR
light_state += "_open"
if(AIRLOCK_OPENING)
frame_state = AIRLOCK_FRAME_OPENING
light_state = AIRLOCK_LIGHT_OPENING
lights_overlay = "lights_opening"
pre_light_color = light_color_access
pre_light_color = AIRLOCK_ACCESS_LIGHT_COLOR

. += 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 + fill_state_suffix]", icon, src, em_block = TRUE)

if(greyscale_lights_color && !light_state)
lights_overlay += "_greyscale"

if(lights && hasPower())
if(lights && hasPower() && has_environment_lights)
. += get_airlock_overlay("lights_[light_state]", overlays_file, src, em_block = FALSE)
pre_light_range = door_light_range
pre_light_power = door_light_power
if(has_environment_lights)
set_light(l_range = pre_light_range, l_power = pre_light_power, l_color = pre_light_color, l_on = TRUE)
if(multi_tile)
filler.set_light(l_range = pre_light_range, l_power = pre_light_power, l_color = pre_light_color, l_on = TRUE)
else
lights_overlay = ""
set_light(l_on = FALSE)
. += emissive_appearance(overlays_file, "lights_[light_state]", src, alpha = src.alpha)

var/mutable_appearance/lights_appearance = mutable_appearance(overlays_file, lights_overlay, FLOAT_LAYER, src, ABOVE_LIGHTING_PLANE)
if(multi_tile)
filler.set_light(l_range = AIRLOCK_LIGHT_RANGE, l_power = AIRLOCK_LIGHT_POWER, l_color = pre_light_color, l_on = TRUE)

if(greyscale_lights_color && !light_state)
lights_appearance.color = greyscale_lights_color

if(multi_tile)
lights_appearance.dir = dir

. += lights_appearance
set_light(l_range = AIRLOCK_LIGHT_RANGE, l_power = AIRLOCK_LIGHT_POWER, l_color = pre_light_color, l_on = TRUE)
else
set_light(l_on = FALSE)

if(greyscale_accent_color)
. += get_airlock_overlay("[frame_state]_accent", overlays_file, src, em_block = TRUE, state_color = greyscale_accent_color)
Expand Down Expand Up @@ -359,6 +332,43 @@
icon = 'modular_nova/modules/aesthetics/airlock/icons/airlocks/highsec/highsec.dmi'
overlays_file = 'modular_nova/modules/aesthetics/airlock/icons/airlocks/highsec/overlays.dmi'

//TITANIUM / SHUTTLE
/obj/machinery/door/airlock/titanium
icon = 'modular_nova/modules/aesthetics/airlock/icons/airlocks/shuttle/shuttle.dmi'
overlays_file = 'modular_nova/modules/aesthetics/airlock/icons/airlocks/shuttle/overlays.dmi'

/obj/machinery/door/airlock/shuttle
icon = 'modular_nova/modules/aesthetics/airlock/icons/airlocks/shuttle/shuttle.dmi'
overlays_file = 'modular_nova/modules/aesthetics/airlock/icons/airlocks/shuttle/overlays.dmi'

//SHUTTLE2
/obj/machinery/door/airlock/shuttle/ferry
icon = 'modular_nova/modules/aesthetics/airlock/icons/airlocks/shuttle2/erokez.dmi'
overlays_file = 'modular_nova/modules/aesthetics/airlock/icons/airlocks/shuttle2/overlays.dmi'

/obj/machinery/door/airlock/external/wagon
icon = 'modular_nova/modules/aesthetics/airlock/icons/airlocks/shuttle2/wagon.dmi'
overlays_file = 'modular_nova/modules/aesthetics/airlock/icons/airlocks/shuttle2/overlays.dmi'

//SURVIVAL
/obj/machinery/door/airlock/survival_pod
overlays_file = 'modular_nova/modules/aesthetics/airlock/icons/airlocks/survival/overlays.dmi'

//ABDUCTOR
/obj/machinery/door/airlock/abductor
overlays_file = 'modular_nova/modules/aesthetics/airlock/icons/airlocks/abductor/overlays.dmi'

//CULT
/obj/machinery/door/airlock/cult
overlays_file = 'modular_nova/modules/aesthetics/airlock/icons/airlocks/cult/runed/overlays.dmi'

/obj/machinery/door/airlock/cult/unruned
overlays_file = 'modular_nova/modules/aesthetics/airlock/icons/airlocks/cult/unruned/overlays.dmi'

//CLOCKWORK
/obj/machinery/door/airlock/bronze
overlays_file = 'modular_nova/modules/aesthetics/airlock/icons/airlocks/clockwork/overlays.dmi'

//MULTI-TILE

/obj/machinery/door/airlock/multi_tile
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified modular_nova/modules/aesthetics/firealarm/icons/firealarm.dmi
Binary file not shown.
3 changes: 2 additions & 1 deletion modular_nova/modules/aesthetics/firedoor/code/firedoor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
if(istype(src, /obj/machinery/door/firedoor/border_only))
return
if(density) // if the door is closed, add the bottom blinking overlay -- and only if it's closed
. += "firelock_alarm_type_bottom"
. += mutable_appearance(icon, "firelock_alarm_type_bottom")
. += emissive_appearance(icon, "firelock_alarm_type_bottom", src, alpha = src.alpha)

/obj/machinery/door/firedoor/open()
playsound(loc, door_open_sound, 100, TRUE)
Expand Down
Binary file modified modular_nova/modules/aesthetics/firedoor/icons/firedoor.dmi
Binary file not shown.
Binary file modified modular_nova/modules/aesthetics/firedoor/icons/firedoor_glass.dmi
Binary file not shown.
53 changes: 46 additions & 7 deletions modular_nova/modules/airlock_override/code/airlock_override.dm
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,15 @@
/obj/machinery/door/airlock
/// Determines if engineers get access to this door on orange alert
var/engineering_override = FALSE
/// If there is an active fire alarm in the door's area
var/fire_active = FALSE
/// Area the door is located in
var/area/door_area

/obj/machinery/door/airlock/Initialize(mapload)
. = ..()
door_area = get_area(src)
RegisterSignal(door_area, COMSIG_AREA_FIRE_CHANGED, PROC_REF(update_fire_status))
RegisterSignal(SSdcs, COMSIG_GLOB_FORCE_ENG_OVERRIDE, PROC_REF(force_eng_override))

///Check for the three states of open access. Emergency, Unrestricted, and Engineering Override
Expand All @@ -83,7 +89,7 @@
if(unrestricted_side(user))
return TRUE

if(engineering_override)
if(engineering_override || fire_active)
var/mob/living/carbon/human/interacting_human = user
if(!istype(interacting_human))
return ..()
Expand All @@ -101,6 +107,9 @@
if(!source_area.engineering_override_eligible)
return

if(isnull(req_access) && isnull(req_one_access)) // no restrictions, no problem
return

if(level != SEC_LEVEL_ORANGE && GLOB.force_eng_override)
return

Expand All @@ -111,7 +120,9 @@
return

engineering_override = FALSE
normalspeed = TRUE
if(!fire_active)
normalspeed = TRUE

update_appearance()
return

Expand Down Expand Up @@ -150,17 +161,45 @@ GLOBAL_VAR_INIT(force_eng_override, FALSE)
/obj/machinery/door/airlock/proc/force_eng_override(datum/source, status)
SIGNAL_HANDLER

if(!status)
engineering_override = FALSE
if(isnull(req_access) && isnull(req_one_access)) // no restrictions, no problem
return

engineering_override = status
if(!engineering_override && !fire_active)
normalspeed = TRUE
update_appearance()
return

var/area/source_area = get_area(src)
if(!source_area.engineering_override_eligible)
if(!door_area.engineering_override_eligible)
return

normalspeed = FALSE
update_appearance()

/**
* Change the airlock's fire_active status, triggered by COMSIG_AREA_FIRE_CHANGED
* Activates fire status overlay and increases door speed.
*
* Arguments:
* * source - The /area with changed fire status
* * fire - the new fire status (TRUE/FALSE)
*
*/
/obj/machinery/door/airlock/proc/update_fire_status(datum/source, fire)
SIGNAL_HANDLER

if(isnull(req_access) && isnull(req_one_access)) // no restrictions, no problem
return

fire_active = fire
if(!fire_active && !engineering_override)
normalspeed = TRUE
update_appearance()
return

if(!door_area.engineering_override_eligible)
return

engineering_override = TRUE
normalspeed = FALSE
update_appearance()

Expand Down
Loading