Files
Aurora.3/code/datums/wires/alarm.dm
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

90 lines
1.9 KiB
Plaintext

/datum/wires/alarm
proper_name = "Air Alarm"
holder_type = /obj/structure/machinery/alarm
/datum/wires/airalarm/New(atom/holder)
wires = list(
WIRE_POWER,
WIRE_IDSCAN, WIRE_AI,
WIRE_PANIC, WIRE_ALARM
)
add_duds(3)
..()
/datum/wires/airalarm/interactable(mob/user)
if(!..())
return FALSE
var/obj/structure/machinery/alarm/A = holder
if(A.panel_open && A.buildstage == 2)
return TRUE
/datum/wires/alarm/get_status()
var/obj/structure/machinery/alarm/A = holder
. = ..()
. += A.locked ? "The air alarm is locked." : "The air alarm is unlocked."
. += (A.shorted || (A.stat & (NOPOWER|BROKEN))) ? "The Air Alarm is offline." : "The Air Alarm is working properly!"
. += A.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on."
/datum/wires/alarm/on_cut(wire, mend, source)
var/obj/structure/machinery/alarm/A = holder
switch(wire)
if(WIRE_IDSCAN)
if(!mend)
A.locked = 1
if(WIRE_POWER)
A.shock(usr, 50)
A.shorted = !mend
A.update_icon()
if (WIRE_AI)
if (A.aidisabled == !mend)
A.aidisabled = mend
if(WIRE_PANIC)
if(!mend)
A.mode = 3 // AALARM_MODE_PANIC
A.apply_mode()
if(WIRE_ALARM)
if (A.alarm_area.atmosalert(2, A))
A.post_alert(2)
A.update_icon()
/datum/wires/alarm/on_pulse(wire)
var/obj/structure/machinery/alarm/A = holder
switch(wire)
if(WIRE_IDSCAN)
A.locked = !A.locked
if (WIRE_POWER)
if(A.shorted == 0)
A.shorted = 1
A.update_icon()
spawn(12000)
if(A.shorted == 1)
A.shorted = 0
A.update_icon()
if (WIRE_AI)
if (A.aidisabled == 0)
A.aidisabled = 1
A.updateDialog()
spawn(100)
if (A.aidisabled == 1)
A.aidisabled = 0
if(WIRE_PANIC)
if(A.mode == 1) // AALARM_MODE_SCRUB
A.mode = 3 // AALARM_MODE_PANIC
else
A.mode = 1 // AALARM_MODE_SCRUB
A.apply_mode()
if(WIRE_ALARM)
if (A.alarm_area.atmosalert(0, A))
A.post_alert(0)
A.update_icon()