Files
Bubberstation/code/modules/power/lighting
LemonInTheDark 1f51bd797e Firelock optimization and behavior changes (#66250)
* Firedoor optimizations

Ok so firedoors were eating up a lot of cpu.
They were doing this for one main reason.

Clearing a fire alarm in an area involved doing a
for(var/obj/machinery/light/light in src) loop.

For those not in the know, in src in the context of areas involves
filtering ALL the objects in an area. This is REALLY nasty.

This fix reduced the total cpu of firedoor closing by a factor of 100.
I am not kidding
Edit: I was kidding, ghil fixed the oversight that caused this in the
first place already
My change is still good tho, it wasn't good even if only called
occasionally

I replaced it with a signal that lights register for on area change.

I had to do some finicking to make the existing area sensitivity that
machines have behave with this, but it's not too messy.

I did the same signal treamtment to firealarms to clean them up a bit.
I also did some futzing around in firedoor code to make changing behavior inside it easier.

* Changes how fire alarms work slightly

Rather then fully resetting alarms, and relying on the door itself to
close back up, they will force all doors open for 3 seconds (down from a
cooldown of 5 because 5 felt way too long) and then drop again if the
firedoor has any well, actual problems.

This meant adding two new vars, active and ignore_alarms.
It also meant sightly changing the meaning of alarm_type, from the
alarm that's activating us right now, to our current alarm.

I think this is generally positive, since it makes the variable a bit
easier to reason about.

Oh and I reworked an existing cooldown to make it fit better into this
mold.

Ah and we can no longer drop atmos problems. This was an issue before,
it was possible for a firelock to be in a problem state, but be unable
to reflect that because of something that blocked the event reception,
but no longer

* Pain

* Ensures area sensitivity will only be added if we do not already have the trait from innate state
2022-05-06 17:51:27 -07:00
..