Files
Paradise/code/datums/cache/air_alarm.dm
T
Mark van Alphen 697bb8eee5 More Lavaland fixes:
- Air alarm computers will no longer display alarms that can't be remote controlled
- Survival capsules now have a NanoMed
- Fixed the disk compartmentalizer not having a sprite when something is put in
- Fixed the drying rack not having a sprite when something is put in
- Turned water bottles into glass containers so they have more functionality
- Hairless hide can now be made wet using water
- Reagents in glass containers can now be fed to others
2019-06-02 23:29:50 +02:00

32 lines
1.4 KiB
Plaintext

var/global/datum/repository/air_alarm/air_alarm_repository = new()
/datum/repository/air_alarm/proc/air_alarm_data(var/list/monitored_alarms, var/refresh = 0, var/obj/machinery/alarm/passed_alarm)
var/alarms[0]
var/datum/cache_entry/cache_entry = cache_data
if(!cache_entry)
cache_entry = new/datum/cache_entry
cache_data = cache_entry
if(!refresh)
return cache_entry.data
if(SSticker && SSticker.current_state < GAME_STATE_PLAYING && istype(passed_alarm)) // Generating the list for the first time as the game hasn't started - no need to run through the machines list everything every time
alarms = cache_entry.data // Don't deleate the list
if(is_station_contact(passed_alarm.z) && passed_alarm.remote_control) // Still need sanity checks
alarms[++alarms.len] = passed_alarm.get_nano_data_console()
else
for(var/obj/machinery/alarm/alarm in (monitored_alarms ? monitored_alarms : GLOB.air_alarms)) // Generating the whole list again is a bad habit but I can't be bothered to fix it right now
if(!monitored_alarms && !is_station_contact(alarm.z))
continue
if(!alarm.remote_control)
continue
alarms[++alarms.len] = alarm.get_nano_data_console()
cache_entry.timestamp = world.time //+ 10 SECONDS
cache_entry.data = alarms
return alarms
/datum/repository/air_alarm/proc/update_cache(var/obj/machinery/alarm/alarm)
return air_alarm_data(refresh = 1, passed_alarm = alarm)