mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-14 16:44:33 +01:00
26a884e70a
* Gravity generator, Atmos Control Computers, and Station Alert Computers now work by area rather than Z_level
* Cameras get added to network depending on ancestor area
* Station Alert console work by area
* Adds a check so we don't get_area on a null variable
* Gravgen also checks for z level. Area check now includes some types of ruins that weren't checked
* Keeps everything on the Z level. Atmos alert computer now iterates over alarm, but still presesents area names
* Engineering monitor gets networks from the area it is placed in
* Adds missing area prototype to the prototype list
* moves the area check to a function
* reject legs, return to snek.
* Revert "reject legs, return to snek."
This reverts commit 1dfc2c4454.
* I don't know what happened with paradise.dme, but it seems ok now
* Requested style changes and remove redundant nulls
* oops
* Another empty line removed
99 lines
2.8 KiB
Plaintext
99 lines
2.8 KiB
Plaintext
|
|
/obj/machinery/computer/station_alert
|
|
name = "station alert console"
|
|
desc = "Used to access the station's automated alert system."
|
|
icon_keyboard = "tech_key"
|
|
icon_screen = "alert:0"
|
|
light_color = LIGHT_COLOR_CYAN
|
|
circuit = /obj/item/circuitboard/stationalert_engineering
|
|
var/list/alarms_listend_for = list("Fire", "Atmosphere", "Power")
|
|
var/parent_area_type
|
|
var/list/areas = list()
|
|
|
|
/obj/machinery/computer/station_alert/Initialize(mapload)
|
|
. = ..()
|
|
RegisterSignal(GLOB.alarm_manager, COMSIG_TRIGGERED_ALARM, PROC_REF(alarm_triggered))
|
|
RegisterSignal(GLOB.alarm_manager, COMSIG_CANCELLED_ALARM, PROC_REF(alarm_cancelled))
|
|
|
|
var/area/machine_area = get_area(src)
|
|
parent_area_type = machine_area.get_top_parent_type()
|
|
if(parent_area_type)
|
|
areas = typesof(parent_area_type)
|
|
|
|
|
|
/obj/machinery/computer/station_alert/attack_ai(mob/user)
|
|
add_fingerprint(user)
|
|
if(stat & (BROKEN|NOPOWER))
|
|
return
|
|
ui_interact(user)
|
|
|
|
/obj/machinery/computer/station_alert/attack_hand(mob/user)
|
|
add_fingerprint(user)
|
|
if(stat & (BROKEN|NOPOWER))
|
|
return
|
|
ui_interact(user)
|
|
|
|
/obj/machinery/computer/station_alert/ui_state(mob/user)
|
|
return GLOB.default_state
|
|
|
|
/obj/machinery/computer/station_alert/ui_interact(mob/user, datum/tgui/ui = null)
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if(!ui)
|
|
ui = new(user, src, "StationAlertConsole", name)
|
|
ui.open()
|
|
|
|
/obj/machinery/computer/station_alert/ui_data(mob/user)
|
|
var/list/data = list()
|
|
|
|
data["alarms"] = list()
|
|
for(var/class in GLOB.alarm_manager.alarms)
|
|
if(!(class in alarms_listend_for))
|
|
continue
|
|
data["alarms"][class] = list()
|
|
for(var/area in GLOB.alarm_manager.alarms[class])
|
|
for(var/thing in GLOB.alarm_manager.alarms[class][area][3])
|
|
var/atom/A = locateUID(thing)
|
|
if(A && ((get_area(A)).type in areas) && A.z == z)
|
|
data["alarms"][class] += area
|
|
|
|
return data
|
|
|
|
/obj/machinery/computer/station_alert/proc/alarm_triggered(src, class, area/A, list/O, obj/alarmsource)
|
|
if(!(class in alarms_listend_for))
|
|
return
|
|
if(alarmsource.z != z)
|
|
return
|
|
if(stat & (BROKEN))
|
|
return
|
|
update_icon()
|
|
|
|
/obj/machinery/computer/station_alert/proc/alarm_cancelled(src, class, area/A, obj/origin, cleared)
|
|
if(!(class in alarms_listend_for))
|
|
return
|
|
if(origin.z != z)
|
|
return
|
|
if(stat & (BROKEN))
|
|
return
|
|
update_icon()
|
|
|
|
/obj/machinery/computer/station_alert/update_icon_state()
|
|
var/active_alarms = FALSE
|
|
var/list/list/temp_alarm_list = GLOB.alarm_manager.alarms.Copy()
|
|
for(var/cat in temp_alarm_list)
|
|
if(!(cat in alarms_listend_for))
|
|
continue
|
|
var/list/list/L = temp_alarm_list[cat].Copy()
|
|
for(var/alarm in L)
|
|
var/list/list/alm = L[alarm].Copy()
|
|
var/list/list/sources = alm[3].Copy()
|
|
for(var/thing in sources)
|
|
var/atom/A = locateUID(thing)
|
|
if(A && A.z != z)
|
|
L -= alarm
|
|
if(length(L))
|
|
active_alarms = TRUE
|
|
if(active_alarms)
|
|
icon_screen = "alert:2"
|
|
else
|
|
icon_screen = "alert:0"
|