Files
BatrachophrenoandGitHub 4ecb0bc21c Repath obj/machinery to obj/structure/machinery [MDB Ignore] (#22500)
Repaths obj/machinery to obj/structure/machinery. **Note for
reviewers:** the only meaningful changed code exists within
**code/game/objects/structures.dm** and
**code/game/objects/structures/_machinery.dm**, largely concerning
damage procs. With the exception of moving airlock defines to their own
file, ALL OTHER CHANGES ARE STRICTLY PATH CHANGES.

Objects, _categorically_, are largely divided between those you can hold
in your hand/inventory and those you can't. Machinery objects are
already subtypes of Structures behaviorally, this PR just makes their
pathing reflect that, and allows for future work (tool actions, more
health/destruction functionality) to be developed without unnecessary
code duplication.

I have tested this PR by loading up the Horizon and dismantling various
machines and structures with tools, shooting guns of various types
throughout the ship, and detonating a bunch of explosions throughout the
ship.
2026-05-26 19:35:48 +00:00

75 lines
2.3 KiB
Plaintext

//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31
GLOBAL_LIST_EMPTY(priority_air_alarms)
GLOBAL_LIST_EMPTY(minor_air_alarms)
/obj/structure/machinery/computer/atmos_alert
name = "atmospheric alert computer"
desc = "Used to access atmospheric sensors."
circuit = /obj/item/circuitboard/atmos_alert
icon_screen = "alert:0"
icon_keyboard = "cyan_key"
icon_keyboard_emis = "cyan_key_mask"
light_color = LIGHT_COLOR_CYAN
/obj/structure/machinery/computer/atmos_alert/Initialize()
. = ..()
GLOB.atmosphere_alarm.register_alarm(src, TYPE_PROC_REF(/atom, update_icon))
/obj/structure/machinery/computer/atmos_alert/Destroy()
GLOB.atmosphere_alarm.unregister_alarm(src)
return ..()
/obj/structure/machinery/computer/atmos_alert/attack_hand(mob/user)
ui_interact(user)
/obj/structure/machinery/computer/atmos_alert/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "AtmosAlertComputer")
ui.open()
/obj/structure/machinery/computer/atmos_alert/ui_data(mob/user)
var/list/data = list()
var/list/major_alarms = list()
var/list/minor_alarms = list()
for(var/datum/alarm/alarm in GLOB.atmosphere_alarm.major_alarms())
major_alarms += list(list("name" = sanitize(alarm.alarm_name()), "ref" = REF(alarm)))
for(var/datum/alarm/alarm in GLOB.atmosphere_alarm.minor_alarms())
minor_alarms += list(list("name" = sanitize(alarm.alarm_name()), "ref" = REF(alarm)))
data["priority_alarms"] = major_alarms
data["minor_alarms"] = minor_alarms
return data
/obj/structure/machinery/computer/atmos_alert/update_icon()
if(!(stat & (NOPOWER|BROKEN)))
var/list/alarms = GLOB.atmosphere_alarm.major_alarms()
if(alarms.len)
icon_screen = "alert:2"
else
alarms = GLOB.atmosphere_alarm.minor_alarms()
if(alarms.len)
icon_screen = "alert:1"
else
icon_screen = initial(icon_screen)
..()
/obj/structure/machinery/computer/atmos_alert/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return
if(action == "clear_alarm")
var/datum/alarm/alarm = locate(params["ref"]) in GLOB.atmosphere_alarm.alarms
if(alarm)
for(var/datum/alarm_source/alarm_source in alarm.sources)
var/obj/structure/machinery/alarm/air_alarm = alarm_source.source
if(istype(air_alarm))
air_alarm.alarm_reset()
return TRUE