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
Show file tree
Hide file tree
Changes from all 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
52 changes: 44 additions & 8 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 @@ -72,21 +76,27 @@
. += emissive_appearance(icon, "fire_[SEC_LEVEL_GREEN]", layer, alpha = 255)
ADD_LUM_SOURCE(src, LUM_SOURCE_MANAGED_OVERLAY)

if(!detecting || !A.fire) //If this is false, leave the green light missing. A good hint to anyone paying attention.
. += "fire_off"
. += mutable_appearance(icon, "fire_off")
. += emissive_appearance(icon, "fire_off", layer, alpha = 255)
ADD_LUM_SOURCE(src, LUM_SOURCE_MANAGED_OVERLAY)
else if(obj_flags & EMAGGED)
if(obj_flags & EMAGGED)
. += "fire_emagged"
. += mutable_appearance(icon, "fire_emagged")
. += emissive_appearance(icon, "fire_emagged", layer, alpha = 255)
ADD_LUM_SOURCE(src, LUM_SOURCE_MANAGED_OVERLAY)
else
return //If it's emagged, don't do anything else for overlays.
if(locked)
. += "fire_locked"
. += mutable_appearance(icon, "fire_locked", layer + 1) //If we are locked, overlay that over the fire_off
. += emissive_appearance(icon, "fire_locked", layer, alpha = 255)
ADD_LUM_SOURCE(src, LUM_SOURCE_MANAGED_OVERLAY)
if(detecting && A.fire)
. += "fire_on"
. += mutable_appearance(icon, "fire_on")
. += mutable_appearance(icon, "fire_on", layer + 2) //If we are locked and there is a fire, overlay the fire detection overlay ontop of the locked one.
. += emissive_appearance(icon, "fire_on", layer, alpha = 255)
ADD_LUM_SOURCE(src, LUM_SOURCE_MANAGED_OVERLAY)
else
. += "fire_off"
. += mutable_appearance(icon, "fire_off")
. += emissive_appearance(icon, "fire_off", layer, alpha = 255)
ADD_LUM_SOURCE(src, LUM_SOURCE_MANAGED_OVERLAY)

/obj/machinery/firealarm/emp_act(severity)
. = ..()
Expand All @@ -113,6 +123,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)
..()

/**
Expand All @@ -135,6 +146,7 @@
var/area/A = get_area(src)
A.firealert(src)
playsound(loc, 'goon/sound/machinery/FireAlarm.ogg', 75)
update_appearance()
if(user)
log_game("[user] triggered a fire alarm at [COORD(src)]")

Expand All @@ -143,16 +155,38 @@
return
var/area/A = get_area(src)
A.firereset(src)
update_appearance()
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)
update_appearance()

/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 All @@ -166,6 +200,8 @@
/obj/machinery/firealarm/attackby(obj/item/W, mob/user, params)
add_fingerprint(user)

if(istype(W, /obj/item/card/id)||istype(W, /obj/item/modular_computer/tablet/pda)) // trying to unlock the cover with an ID card
try_lock(user)
if(W.tool_behaviour == TOOL_SCREWDRIVER && buildstage == 2)
W.play_tool_sound(src)
panel_open = !panel_open
Expand Down
Binary file modified icons/obj/monitors.dmi
Binary file not shown.
Loading