mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 16:18:01 +01:00
[SEMI-MODULAR] APC/Air Alarm lighting and functionality (#20323)
* apc/airalarm * Apply suggestions from code review Co-authored-by: Pinta <68373373+softcerv@users.noreply.github.com> * brightness tweaks * Update modular_skyrat/modules/aesthetics/apc/code/apc.dm Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com> * remove duplicate fire alarm procs * tweak lighting color, power --------- Co-authored-by: Pinta <68373373+softcerv@users.noreply.github.com> Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com>
This commit is contained in:
co-authored by
Pinta
Zonespace
parent
59b53c7c25
commit
858e61aa76
@@ -524,7 +524,7 @@
|
||||
if(!nightshift_lights || (nightshift_lights && !low_power_nightshift_lights))
|
||||
low_power_nightshift_lights = TRUE
|
||||
INVOKE_ASYNC(src, PROC_REF(set_nightshift), TRUE)
|
||||
else if(cell.percent() < 15 && long_term_power < 0) // <15%, turn off lighting & equipment
|
||||
else if(cell.percent() < 7 && long_term_power < 0) // SKYRAT EDIT CHANGE - orig: 15
|
||||
equipment = autoset(equipment, AUTOSET_OFF)
|
||||
lighting = autoset(lighting, AUTOSET_OFF)
|
||||
environ = autoset(environ, AUTOSET_ON)
|
||||
@@ -532,9 +532,9 @@
|
||||
if(!nightshift_lights || (nightshift_lights && !low_power_nightshift_lights))
|
||||
low_power_nightshift_lights = TRUE
|
||||
INVOKE_ASYNC(src, PROC_REF(set_nightshift), TRUE)
|
||||
else if(cell.percent() < 30 && long_term_power < 0) // <30%, turn off equipment
|
||||
equipment = autoset(equipment, AUTOSET_OFF)
|
||||
lighting = autoset(lighting, AUTOSET_ON)
|
||||
else if(cell.percent() < 17 && long_term_power < 0) // SKYRAT EDIT CHANGE - orig: 30
|
||||
equipment = autoset(equipment, AUTOSET_ON) // SKYRAT EDIT CHANGE - orig: AUTOSET_OFF
|
||||
lighting = autoset(lighting, AUTOSET_OFF) // SKYRAT EDIT CHANGE - orig: AUTOSET_ON
|
||||
environ = autoset(environ, AUTOSET_ON)
|
||||
alarm_manager.send_alarm(ALARM_POWER)
|
||||
if(!nightshift_lights || (nightshift_lights && !low_power_nightshift_lights))
|
||||
|
||||
@@ -135,15 +135,21 @@
|
||||
/obj/machinery/light/update_icon_state()
|
||||
switch(status) // set icon_states
|
||||
if(LIGHT_OK)
|
||||
//var/area/local_area = get_area(src) SKYRAT EDIT REMOVAL
|
||||
// SKYRAT EDIT ADDITION BEGIN
|
||||
if(low_power_mode)
|
||||
icon_state = "[base_state]_lpower"
|
||||
else if(major_emergency)
|
||||
var/area/local_area = get_area(src)
|
||||
//SKYRAT EDIT BEGIN - Original
|
||||
/*
|
||||
if(low_power_mode || major_emergency || (local_area?.fire))
|
||||
icon_state = "[base_state]_emergency"
|
||||
// SKYRAT EDIT ADDITION END
|
||||
else
|
||||
icon_state = "[base_state]"
|
||||
*/
|
||||
if(low_power_mode)
|
||||
icon_state = "[base_state]_lpower"
|
||||
else if(major_emergency || (local_area?.fire))
|
||||
icon_state = "[base_state]_emergency"
|
||||
else
|
||||
icon_state = "[base_state]"
|
||||
// SKYRAT EDIT END
|
||||
if(LIGHT_EMPTY)
|
||||
icon_state = "[base_state]-empty"
|
||||
if(LIGHT_BURNED)
|
||||
@@ -161,7 +167,8 @@
|
||||
var/area/local_area = get_area(src)
|
||||
if(emergency_mode || (local_area?.fire))
|
||||
*/
|
||||
if(low_power_mode || major_emergency) // SKYRAT EDIT END
|
||||
var/area/local_area = get_area(src)
|
||||
if(low_power_mode || major_emergency || (local_area?.fire)) // SKYRAT EDIT END
|
||||
. += mutable_appearance(overlay_icon, "[base_state]_emergency")
|
||||
return
|
||||
if(nightshift_enabled)
|
||||
@@ -195,7 +202,7 @@
|
||||
|
||||
/obj/machinery/light/proc/handle_fire(area/source, new_fire)
|
||||
SIGNAL_HANDLER
|
||||
update()
|
||||
update(instant = TRUE, play_sound = FALSE) //SKYRAT EDIT CHANGE
|
||||
|
||||
// update the icon_state and luminosity of the light depending on its state
|
||||
/obj/machinery/light/proc/update(trigger = TRUE, instant = FALSE, play_sound = TRUE) //SKYRAT EDIT CHANGE
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
// Kneecapping light values every light at a time.
|
||||
/obj/machinery/light/dim
|
||||
brightness = 4
|
||||
nightshift_brightness = 4
|
||||
bulb_colour = "#f8faff"
|
||||
bulb_power = 0.4
|
||||
|
||||
/obj/machinery/light/small
|
||||
brightness = 5
|
||||
nightshift_brightness = 4.5
|
||||
bulb_colour = "#f8faff"
|
||||
bulb_power = 0.45
|
||||
bulb_power = 0.9
|
||||
|
||||
/obj/machinery/light/cold
|
||||
nightshift_light_color = null
|
||||
|
||||
@@ -2,5 +2,20 @@
|
||||
icon = 'modular_skyrat/modules/aesthetics/airalarm/icons/airalarm.dmi'
|
||||
var/light_mask = "alarm-light-mask"
|
||||
|
||||
/obj/machinery/airalarm/update_appearance(updates)
|
||||
. = ..()
|
||||
|
||||
if(panel_open || (machine_stat & (NOPOWER|BROKEN)) || shorted)
|
||||
set_light(0)
|
||||
return FALSE
|
||||
|
||||
var/color = LIGHT_COLOR_ELECTRIC_CYAN
|
||||
if(danger_level == AIR_ALARM_ALERT_HAZARD)
|
||||
color = LIGHT_COLOR_INTENSE_RED
|
||||
else if(danger_level == AIR_ALARM_ALERT_WARNING || my_area.active_alarms[ALARM_ATMOS])
|
||||
color = LIGHT_COLOR_ORANGE
|
||||
|
||||
set_light(1.5, 1, color)
|
||||
|
||||
/obj/item/wallframe/airalarm
|
||||
icon = 'icons/obj/monitors.dmi'
|
||||
|
||||
@@ -3,3 +3,28 @@
|
||||
|
||||
/obj/item/wallframe/apc
|
||||
icon = 'modular_skyrat/modules/aesthetics/apc/icons/apc.dmi'
|
||||
|
||||
/obj/machinery/power/apc/update_appearance(updates = check_updates())
|
||||
icon_update_needed = FALSE
|
||||
if(!updates)
|
||||
return FALSE
|
||||
|
||||
. = ..()
|
||||
// And now, separately for cleanness, the lighting changing
|
||||
if(!update_state)
|
||||
switch(charging)
|
||||
if(APC_NOT_CHARGING)
|
||||
set_light_color(LIGHT_COLOR_INTENSE_RED)
|
||||
if(APC_CHARGING)
|
||||
set_light_color(LIGHT_COLOR_ORANGE)
|
||||
if(APC_FULLY_CHARGED)
|
||||
set_light_color(LIGHT_COLOR_ELECTRIC_CYAN)
|
||||
set_light(light_on_range)
|
||||
return TRUE
|
||||
|
||||
if(update_state & UPSTATE_BLUESCREEN)
|
||||
set_light_color(LIGHT_COLOR_BLUE)
|
||||
set_light(light_on_range)
|
||||
return TRUE
|
||||
|
||||
set_light(0)
|
||||
|
||||
@@ -8,20 +8,23 @@
|
||||
/obj/machinery/light
|
||||
icon = 'modular_skyrat/modules/aesthetics/lights/icons/lighting.dmi'
|
||||
overlay_icon = 'modular_skyrat/modules/aesthetics/lights/icons/lighting_overlay.dmi'
|
||||
brightness = 5.5
|
||||
brightness = 6.5
|
||||
fire_brightness = 4.5
|
||||
fire_colour = "#D47F9B"
|
||||
bulb_colour = LIGHT_COLOR_FAINT_BLUE
|
||||
bulb_power = 1.15
|
||||
nightshift_light_color = null // Let the dynamic night shift color code handle this.
|
||||
bulb_low_power_colour = LIGHT_COLOR_DARK_BLUE
|
||||
bulb_low_power_brightness_mul = 0.45
|
||||
bulb_low_power_brightness_mul = 0.4
|
||||
bulb_low_power_pow_min = 0.4
|
||||
bulb_major_emergency_brightness_mul = 1 // don't dim in an emergency, why is that a thing
|
||||
bulb_emergency_colour = LIGHT_COLOR_INTENSE_RED
|
||||
bulb_major_emergency_brightness_mul = 0.7
|
||||
power_consumption_rate = 5.62
|
||||
var/maploaded = FALSE //So we don't have a lot of stress on startup.
|
||||
var/turning_on = FALSE //More stress stuff.
|
||||
var/constant_flickering = FALSE // Are we always flickering?
|
||||
var/flicker_timer = null
|
||||
var/roundstart_flicker = FALSE
|
||||
var/firealarm = FALSE
|
||||
|
||||
/obj/machinery/light/proc/turn_on(trigger, play_sound = TRUE)
|
||||
if(QDELETED(src))
|
||||
@@ -29,13 +32,15 @@
|
||||
turning_on = FALSE
|
||||
if(!on)
|
||||
return
|
||||
var/area/local_area = get_room_area(src)
|
||||
var/new_brightness = brightness
|
||||
var/new_power = bulb_power
|
||||
var/new_color = bulb_colour
|
||||
if(color)
|
||||
if (local_area?.fire)
|
||||
new_color = fire_colour
|
||||
new_brightness = fire_brightness
|
||||
else if(color)
|
||||
new_color = color
|
||||
if (firealarm)
|
||||
new_color = bulb_emergency_colour
|
||||
else if (nightshift_enabled)
|
||||
new_brightness -= new_brightness * NIGHTSHIFT_LIGHT_MODIFIER
|
||||
new_power -= new_power * NIGHTSHIFT_LIGHT_MODIFIER
|
||||
@@ -100,18 +105,6 @@
|
||||
alter_flicker(FALSE)
|
||||
flicker_timer = addtimer(CALLBACK(src, PROC_REF(flicker_on)), rand(5, 50))
|
||||
|
||||
/obj/machinery/light/proc/firealarm_on()
|
||||
SIGNAL_HANDLER
|
||||
|
||||
firealarm = TRUE
|
||||
update()
|
||||
|
||||
/obj/machinery/light/proc/firealarm_off()
|
||||
SIGNAL_HANDLER
|
||||
|
||||
firealarm = FALSE
|
||||
update()
|
||||
|
||||
/obj/machinery/light/Initialize(mapload = TRUE)
|
||||
. = ..()
|
||||
if(on)
|
||||
|
||||
Reference in New Issue
Block a user