Files
Bubberstation/code/datums/wires/firealarm.dm
MrMelbert b19160619e Fire alarm attackby + screentips + new wires (#91569)
## About The Pull Request

1. Adds 4 wires to fire alarms

trigger - triggers the fire alarm on pulse, disables trigger on cut
reset - resets the fire alarm on pulse, disables reset on cut
toggle - takes the old multitool act on pulse (toggling auto fire
detection), does similar on cut
dud - does nothing

2. Fire alarm attackby -> tool and item interactions

3. Fire alarm screentips

4. Changed fire alarm trigger on damage from flat 33% to (3 * damage)%

## Why It's Good For The Game

1. Allows for more assembly shenanigans - maybe cutting the reset wire
and having a signaller on pulse

2. Cleaner

3. Helpful

4. allows you to consistently rely on the behavior by using higher force
weapons (such as guns) (this was a request)

## Changelog

🆑 Melbert
add: Fire alarms now has wires
add: Fire alarm trigger on damage now scales based on damage dealt,
rather than being a flat 33%
qol: Fire alarm screentips
refactor: Refactored fire alarms de/assembly, report any oddities
/🆑
2025-06-25 23:28:37 +02:00

60 lines
2.1 KiB
Plaintext

/datum/wires/firealarm
holder_type = /obj/machinery/firealarm
proper_name = "Fire Alarm"
/datum/wires/firealarm/New(atom/holder)
wires = list(
WIRE_FIRE_DETECT, // toggles whether it can activate automatically
WIRE_FIRE_RESET, // resets fire alarm
WIRE_FIRE_TRIGGER, // triggers fire alarm
)
add_duds(1)
return ..()
/datum/wires/firealarm/interactable(mob/user)
var/obj/machinery/firealarm/alarm = holder
return ..() && alarm.panel_open && alarm.buildstage == FIRE_ALARM_BUILD_SECURED
/datum/wires/firealarm/get_status()
var/obj/machinery/airalarm/alarm = holder
var/list/status = list()
status += "The thermal sensor light is [alarm.my_area?.fire_detect ? "on" : "off"]."
return status
/datum/wires/firealarm/on_pulse(wire, mob/living/user)
var/obj/machinery/firealarm/alarm = holder
switch(wire)
if(WIRE_FIRE_DETECT)
alarm.toggle_fire_detect(user, silent = TRUE)
if(WIRE_FIRE_TRIGGER)
alarm.alarm(user, silent = TRUE)
if(WIRE_FIRE_RESET)
alarm.reset(user, silent = TRUE)
/datum/wires/firealarm/on_cut(wire, mend, mob/living/source)
var/obj/machinery/firealarm/alarm = holder
switch(wire)
if(WIRE_FIRE_DETECT)
// blocks multitool toggle, though wirecutter toggle "bypasses" this
alarm.can_toggle_detection = !mend
var/num_cut = 0
for(var/obj/machinery/firealarm/firealarm in alarm.my_area?.firealarms)
if(WIRE_FIRE_DETECT in firealarm.wires?.cut_wires)
num_cut += 1
// if mending, restore fire detection
if(mend)
alarm.enable_fire_detect(source)
// or if cutting and all fire alarms in the area are cut, disable fire detection
else if(length(alarm.my_area?.firealarms) == num_cut)
alarm.disable_fire_detect(source)
if(WIRE_FIRE_TRIGGER)
// does not reset() or alarm() - it's now stuck on or off
alarm.can_trigger = !mend
if(WIRE_FIRE_RESET)
// does not reset() or alarm() - it's now stuck on or off
alarm.can_reset = !mend
/datum/wires/firealarm/always_reveal_wire(color)
// to maintain previous behavior of "anyone can multitool a fire alarm to disable it"
return get_color_of_wire(WIRE_FIRE_DETECT) == color