Files
Paradise/code/datums/cache/powermonitor.dm
Contrabang 48d7b00a0d CI now bans the use of weird spacing in conditionals (#22777)
* no more spaces

* Matthew 10:22

* fixes

* dgamerl review

* Update code/modules/hydroponics/plant_genes.dm

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>

* Update code/modules/mob/living/simple_animal/bot/ed209bot.dm

* Update code/modules/mob/mob.dm

* Update code/modules/mob/mob.dm

* Update code/modules/mob/mob.dm

* Update code/modules/mob/mob.dm

* Update code/modules/mob/mob.dm

* Update code/modules/pda/PDA.dm

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>

* fuck

* bah

* Update tools/ci/check_grep2.py

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>

* oops

* guh

---------

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>
2023-11-12 20:59:43 +00:00

25 lines
755 B
Plaintext

GLOBAL_DATUM_INIT(powermonitor_repository, /datum/repository/powermonitor, new())
/datum/repository/powermonitor/proc/powermonitor_data(refresh = 0)
var/pMonData[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
for(var/obj/machinery/computer/monitor/pMon in GLOB.power_monitors)
if(!(pMon.stat & (NOPOWER|BROKEN)) && !pMon.is_secret_monitor)
pMonData[++pMonData.len] = list ("Area" = get_area_name(pMon), "uid" = "[pMon.UID()]")
cache_entry.timestamp = world.time //+ 30 SECONDS
cache_entry.data = pMonData
return pMonData
/datum/repository/powermonitor/proc/update_cache()
return powermonitor_data(refresh = 1)