mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Adds lighting for air alarms and fire alarms
This commit is contained in:
@@ -302,22 +302,30 @@
|
|||||||
/obj/machinery/alarm/update_icon()
|
/obj/machinery/alarm/update_icon()
|
||||||
if(wiresexposed)
|
if(wiresexposed)
|
||||||
icon_state = "alarmx"
|
icon_state = "alarmx"
|
||||||
|
set_light(0)
|
||||||
return
|
return
|
||||||
if((stat & (NOPOWER|BROKEN)) || shorted)
|
if((stat & (NOPOWER|BROKEN)) || shorted)
|
||||||
icon_state = "alarmp"
|
icon_state = "alarmp"
|
||||||
|
set_light(0)
|
||||||
return
|
return
|
||||||
|
|
||||||
var/icon_level = danger_level
|
var/icon_level = danger_level
|
||||||
if (alarm_area.atmosalm)
|
if (alarm_area.atmosalm)
|
||||||
icon_level = max(icon_level, 1) //if there's an atmos alarm but everything is okay locally, no need to go past yellow
|
icon_level = max(icon_level, 1) //if there's an atmos alarm but everything is okay locally, no need to go past yellow
|
||||||
|
|
||||||
|
var/new_color = null
|
||||||
switch(icon_level)
|
switch(icon_level)
|
||||||
if (0)
|
if (0)
|
||||||
icon_state = "alarm0"
|
icon_state = "alarm0"
|
||||||
|
new_color = "#03A728"
|
||||||
if (1)
|
if (1)
|
||||||
icon_state = "alarm2" //yes, alarm2 is yellow alarm
|
icon_state = "alarm2" //yes, alarm2 is yellow alarm
|
||||||
|
new_color = "#EC8B2F"
|
||||||
if (2)
|
if (2)
|
||||||
icon_state = "alarm1"
|
icon_state = "alarm1"
|
||||||
|
new_color = "#DA0205"
|
||||||
|
|
||||||
|
set_light(l_range = 2, l_power = 0.5, l_color = new_color)
|
||||||
|
|
||||||
/obj/machinery/alarm/receive_signal(datum/signal/signal)
|
/obj/machinery/alarm/receive_signal(datum/signal/signal)
|
||||||
if(stat & (NOPOWER|BROKEN))
|
if(stat & (NOPOWER|BROKEN))
|
||||||
@@ -888,8 +896,11 @@ FIRE ALARM
|
|||||||
var/last_process = 0
|
var/last_process = 0
|
||||||
var/wiresexposed = 0
|
var/wiresexposed = 0
|
||||||
var/buildstage = 2 // 2 = complete, 1 = no wires, 0 = circuit gone
|
var/buildstage = 2 // 2 = complete, 1 = no wires, 0 = circuit gone
|
||||||
|
var/seclevel
|
||||||
|
|
||||||
/obj/machinery/firealarm/update_icon()
|
/obj/machinery/firealarm/update_icon()
|
||||||
|
overlays.Cut()
|
||||||
|
|
||||||
if(wiresexposed)
|
if(wiresexposed)
|
||||||
switch(buildstage)
|
switch(buildstage)
|
||||||
if(2)
|
if(2)
|
||||||
@@ -898,17 +909,28 @@ FIRE ALARM
|
|||||||
icon_state="fire_b1"
|
icon_state="fire_b1"
|
||||||
if(0)
|
if(0)
|
||||||
icon_state="fire_b0"
|
icon_state="fire_b0"
|
||||||
|
set_light(0)
|
||||||
return
|
return
|
||||||
|
|
||||||
if(stat & BROKEN)
|
if(stat & BROKEN)
|
||||||
icon_state = "firex"
|
icon_state = "firex"
|
||||||
|
set_light(0)
|
||||||
else if(stat & NOPOWER)
|
else if(stat & NOPOWER)
|
||||||
icon_state = "firep"
|
icon_state = "firep"
|
||||||
else if(!src.detecting)
|
set_light(0)
|
||||||
icon_state = "fire1"
|
|
||||||
else
|
else
|
||||||
icon_state = "fire0"
|
if(!src.detecting)
|
||||||
|
icon_state = "fire1"
|
||||||
|
set_light(l_range = 4, l_power = 2, l_color = "#ff0000")
|
||||||
|
else
|
||||||
|
icon_state = "fire0"
|
||||||
|
switch(seclevel)
|
||||||
|
if("green") set_light(l_range = 2, l_power = 0.5, l_color = "#00ff00")
|
||||||
|
if("blue") set_light(l_range = 2, l_power = 0.5, l_color = "#1024A9")
|
||||||
|
if("red") set_light(l_range = 4, l_power = 2, l_color = "#ff0000")
|
||||||
|
if("delta") set_light(l_range = 4, l_power = 2, l_color = "#FF6633")
|
||||||
|
|
||||||
|
src.overlays += image('icons/obj/monitors.dmi', "overlay_[seclevel]")
|
||||||
|
|
||||||
/obj/machinery/firealarm/fire_act(datum/gas_mixture/air, temperature, volume)
|
/obj/machinery/firealarm/fire_act(datum/gas_mixture/air, temperature, volume)
|
||||||
if(src.detecting)
|
if(src.detecting)
|
||||||
@@ -1120,14 +1142,14 @@ FIRE ALARM
|
|||||||
pixel_x = (dir & 3)? 0 : (dir == 4 ? -24 : 24)
|
pixel_x = (dir & 3)? 0 : (dir == 4 ? -24 : 24)
|
||||||
pixel_y = (dir & 3)? (dir ==1 ? -24 : 24) : 0
|
pixel_y = (dir & 3)? (dir ==1 ? -24 : 24) : 0
|
||||||
|
|
||||||
|
/obj/machinery/firealarm/proc/set_security_level(var/newlevel)
|
||||||
|
if(seclevel != newlevel)
|
||||||
|
seclevel = newlevel
|
||||||
|
update_icon()
|
||||||
|
|
||||||
/obj/machinery/firealarm/initialize()
|
/obj/machinery/firealarm/initialize()
|
||||||
if(z in config.contact_levels)
|
if(z in config.contact_levels)
|
||||||
if(security_level)
|
set_security_level(security_level? get_security_level() : "green")
|
||||||
src.overlays += image('icons/obj/monitors.dmi', "overlay_[get_security_level()]")
|
|
||||||
else
|
|
||||||
src.overlays += image('icons/obj/monitors.dmi', "overlay_green")
|
|
||||||
|
|
||||||
update_icon()
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
FIRE ALARM CIRCUIT
|
FIRE ALARM CIRCUIT
|
||||||
|
|||||||
@@ -7,11 +7,19 @@
|
|||||||
var/list/light_sources
|
var/list/light_sources
|
||||||
|
|
||||||
/atom/proc/set_light(l_range, l_power, l_color)
|
/atom/proc/set_light(l_range, l_power, l_color)
|
||||||
if(l_power != null) light_power = l_power
|
. = 0 //make it less costly if nothing's changed
|
||||||
if(l_range != null) light_range = l_range
|
|
||||||
if(l_color != null) light_color = l_color
|
|
||||||
|
|
||||||
update_light()
|
if(l_power != null && l_power != light_power)
|
||||||
|
light_power = l_power
|
||||||
|
. = 1
|
||||||
|
if(l_range != null && l_range != light_range)
|
||||||
|
light_range = l_range
|
||||||
|
. = 1
|
||||||
|
if(l_color != null && l_color != light_color)
|
||||||
|
light_color = l_color
|
||||||
|
. = 1
|
||||||
|
|
||||||
|
if(.) update_light()
|
||||||
|
|
||||||
/atom/proc/update_light()
|
/atom/proc/update_light()
|
||||||
if(!light_power || !light_range)
|
if(!light_power || !light_range)
|
||||||
|
|||||||
@@ -25,46 +25,31 @@
|
|||||||
if(SEC_LEVEL_GREEN)
|
if(SEC_LEVEL_GREEN)
|
||||||
security_announcement_down.Announce("[config.alert_desc_green]", "Attention! Security level lowered to green")
|
security_announcement_down.Announce("[config.alert_desc_green]", "Attention! Security level lowered to green")
|
||||||
security_level = SEC_LEVEL_GREEN
|
security_level = SEC_LEVEL_GREEN
|
||||||
for(var/obj/machinery/firealarm/FA in machines)
|
|
||||||
if(FA.z in config.contact_levels)
|
|
||||||
FA.overlays = list()
|
|
||||||
FA.overlays += image('icons/obj/monitors.dmi', "overlay_green")
|
|
||||||
if(SEC_LEVEL_BLUE)
|
if(SEC_LEVEL_BLUE)
|
||||||
if(security_level < SEC_LEVEL_BLUE)
|
if(security_level < SEC_LEVEL_BLUE)
|
||||||
security_announcement_up.Announce("[config.alert_desc_blue_upto]", "Attention! Security level elevated to blue")
|
security_announcement_up.Announce("[config.alert_desc_blue_upto]", "Attention! Security level elevated to blue")
|
||||||
else
|
else
|
||||||
security_announcement_down.Announce("[config.alert_desc_blue_downto]", "Attention! Security level lowered to blue")
|
security_announcement_down.Announce("[config.alert_desc_blue_downto]", "Attention! Security level lowered to blue")
|
||||||
security_level = SEC_LEVEL_BLUE
|
security_level = SEC_LEVEL_BLUE
|
||||||
for(var/obj/machinery/firealarm/FA in machines)
|
|
||||||
if(FA.z in config.contact_levels)
|
|
||||||
FA.overlays = list()
|
|
||||||
FA.overlays += image('icons/obj/monitors.dmi', "overlay_blue")
|
|
||||||
if(SEC_LEVEL_RED)
|
if(SEC_LEVEL_RED)
|
||||||
if(security_level < SEC_LEVEL_RED)
|
if(security_level < SEC_LEVEL_RED)
|
||||||
security_announcement_up.Announce("[config.alert_desc_red_upto]", "Attention! Code red!")
|
security_announcement_up.Announce("[config.alert_desc_red_upto]", "Attention! Code red!")
|
||||||
else
|
else
|
||||||
security_announcement_down.Announce("[config.alert_desc_red_downto]", "Attention! Code red!")
|
security_announcement_down.Announce("[config.alert_desc_red_downto]", "Attention! Code red!")
|
||||||
security_level = SEC_LEVEL_RED
|
security_level = SEC_LEVEL_RED
|
||||||
|
|
||||||
/* - At the time of commit, setting status displays didn't work properly
|
/* - At the time of commit, setting status displays didn't work properly
|
||||||
var/obj/machinery/computer/communications/CC = locate(/obj/machinery/computer/communications,world)
|
var/obj/machinery/computer/communications/CC = locate(/obj/machinery/computer/communications,world)
|
||||||
if(CC)
|
if(CC)
|
||||||
CC.post_status("alert", "redalert")*/
|
CC.post_status("alert", "redalert")*/
|
||||||
|
|
||||||
for(var/obj/machinery/firealarm/FA in machines)
|
|
||||||
if(FA.z in config.contact_levels)
|
|
||||||
FA.overlays = list()
|
|
||||||
FA.overlays += image('icons/obj/monitors.dmi', "overlay_red")
|
|
||||||
|
|
||||||
if(SEC_LEVEL_DELTA)
|
if(SEC_LEVEL_DELTA)
|
||||||
security_announcement_up.Announce("[config.alert_desc_delta]", "Attention! Delta security level reached!", new_sound = 'sound/effects/siren.ogg')
|
security_announcement_up.Announce("[config.alert_desc_delta]", "Attention! Delta security level reached!", new_sound = 'sound/effects/siren.ogg')
|
||||||
security_level = SEC_LEVEL_DELTA
|
security_level = SEC_LEVEL_DELTA
|
||||||
for(var/obj/machinery/firealarm/FA in machines)
|
|
||||||
if(FA.z in config.contact_levels)
|
var/newlevel = get_security_level()
|
||||||
FA.overlays = list()
|
for(var/obj/machinery/firealarm/FA in machines)
|
||||||
FA.overlays += image('icons/obj/monitors.dmi', "overlay_delta")
|
if(FA.z in config.contact_levels)
|
||||||
else
|
FA.set_security_level(newlevel)
|
||||||
return
|
|
||||||
|
|
||||||
/proc/get_security_level()
|
/proc/get_security_level()
|
||||||
switch(security_level)
|
switch(security_level)
|
||||||
|
|||||||
Reference in New Issue
Block a user