Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a cover lock for fire alarms, makes fire alarms trip the lock when a fire is encountered #11271

Merged
merged 5 commits into from
Aug 15, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions code/game/machinery/firealarm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
resistance_flags = FIRE_PROOF
layer = ABOVE_WINDOW_LAYER
zmm_flags = ZMM_MANGLE_PLANES
req_access = null

light_power = 0
light_range = 7
Expand All @@ -37,9 +38,12 @@
var/buildstage = 2 // 2 = complete, 1 = no wires, 0 = circuit gone
var/last_alarm = 0
var/area/myarea = null
var/locked = FALSE //Are we locked?

/obj/machinery/firealarm/Initialize(mapload, dir, building)
. = ..()
if (!req_access)
req_access = list(ACCESS_ATMOSPHERICS)
if(building)
buildstage = 0
panel_open = TRUE
Expand Down Expand Up @@ -118,6 +122,7 @@
/obj/machinery/firealarm/temperature_expose(datum/gas_mixture/air, temperature, volume)
if((temperature > T0C + 200 || temperature < BODYTEMP_COLD_DAMAGE_LIMIT) && (last_alarm+FIREALARM_COOLDOWN < world.time) && !(obj_flags & EMAGGED) && detecting && !machine_stat)
alarm()
try_lock(null, TRUE)
..()

/obj/machinery/firealarm/proc/alarm(mob/user)
Expand All @@ -138,13 +143,33 @@
if(user)
log_game("[user] reset a fire alarm at [COORD(src)]")

/obj/machinery/firealarm/proc/try_lock(mob/user, force_lock = FALSE)
if(allowed(user) || !user || force_lock)
if(!locked || force_lock)
locked = TRUE
balloon_alert(user, "Locked")
else
locked = FALSE
balloon_alert(user, "Unlocked")
playsound(src, 'sound/machines/beep.ogg', 50, 1)
else
balloon_alert(user, "Access Denied!")
playsound(src, 'sound/machines/terminal_error.ogg', 50, 1)

/obj/machinery/firealarm/AltClick(mob/user)
XeonMations marked this conversation as resolved.
Show resolved Hide resolved
try_lock(user)

/obj/machinery/firealarm/attack_hand(mob/user)
if(buildstage != 2)
return ..()
add_fingerprint(user)
play_click_sound("button")
var/area/A = get_area(src)
if(A.fire)
if(locked)
balloon_alert(user, "Cover is locked!")
playsound(loc, 'sound/effects/glassknock.ogg', 10, FALSE, frequency = 32000)
return
reset(user)
else
alarm(user)
Expand Down
Loading