Fix air alarms to work correctly while connected to a gas sensor (#86958)

## About The Pull Request
This fixes a bug that was hard to troubleshoot. While I was testing my
other PR, I noticed that I was getting inconsistent atmos readouts while
using a gas sensor hooked to an air alarm. Sometimes I would get the
readout from the tile of the air alarm, and other times it would give me
the readout of the gas sensor... I tracked it down and the root cause
was the `COMSIG_TURF_EXPOSE` signal not being properly reassigned when a
gas sensor was connected.

My fix is to transfer the signal from the air alarm to the air sensor
and vice versa when they are connected/disconnected. I also added some
redundancies in place to limit air sensors to be only connected to one
air alarm at a time. I threw in a mapping check to make sure one air
alarm isn't linked to multiple sensors to catch some accidents.

Another small fix is that air alarms now can be relinked to other air
sensors if the sensor is reset. This was a problem for round-start
linked air alarms that were paired with sensors since you could turn off
or break a sensor and then the air alarm would have it's link severed
without being able to link to any new sensors.

## Why It's Good For The Game
Air alarms are becoming more robust!

## Changelog
🆑
fix: Fix air alarms to work correctly while connected to a gas sensor
fix: Fix paired air alarms and sensors to be able to relink to other
devices if turned off, reset, or destroyed.
/🆑
This commit is contained in:
Tim
2024-10-04 02:50:07 +02:00
committed by GitHub
parent 4437bb5ebf
commit f7c53dec8e
3 changed files with 47 additions and 12 deletions
+4 -4
View File
@@ -326,9 +326,6 @@
if(target.syndicate_access + target.away_general_access + target.engine_access + target.mixingchamber_access + target.all_access > 1)
CRASH("Tried to combine incompatible air alarm access helpers!")
if(target.air_sensor_chamber_id)
target.setup_chamber_link()
target.update_appearance()
qdel(src)
@@ -418,6 +415,7 @@
/obj/effect/mapping_helpers/airalarm/link
name = "airalarm link helper"
icon_state = "airalarm_link_helper"
late = TRUE
var/chamber_id = ""
var/allow_link_change = FALSE
@@ -427,13 +425,15 @@
log_mapping("[src] spawned outside of mapload!")
return INITIALIZE_HINT_QDEL
/obj/effect/mapping_helpers/airalarm/link/LateInitialize(mapload)
var/obj/machinery/airalarm/alarm = locate(/obj/machinery/airalarm) in loc
if(!isnull(alarm))
alarm.air_sensor_chamber_id = chamber_id
alarm.allow_link_change = allow_link_change
alarm.setup_chamber_link()
else
log_mapping("[src] failed to find air alarm at [AREACOORD(src)].")
return INITIALIZE_HINT_QDEL
qdel(src)
//apc helpers
/obj/effect/mapping_helpers/apc