Files
Paradise/code/controllers/subsystem/SSheartbeat.dm
AffectedArc07 9ccb9bddc4 2-way server heartbeats (plus bonus DMAPI update) (#21101)
* 2-way server heartbeats

* Upgrades people, upgrades

* DMAPI bump again

* How did this compile

* BALLS
2023-06-17 11:00:01 +01:00

21 lines
927 B
Plaintext

SUBSYSTEM_DEF(heartbeat)
name = "Heartbeat"
flags = SS_KEEP_TIMING
wait = 30 SECONDS
runlevels = RUNLEVEL_INIT | RUNLEVEL_LOBBY | RUNLEVEL_SETUP | RUNLEVEL_GAME | RUNLEVEL_POSTGAME // ALL THE THINGS
/// Last time we got a heartbeat from TGS
var/last_heartbeat = 0
/// Has a warning been sent this round?
var/warning_tripped = FALSE
/datum/controller/subsystem/heartbeat/Initialize()
// Disable if we arent running on TGS
if(!world.TgsAvailable())
flags |= SS_NO_FIRE
/datum/controller/subsystem/heartbeat/fire(resumed)
// If the last heartbeat is 0, we never got one this round
if(last_heartbeat != 0 && (last_heartbeat + 2 MINUTES < REALTIMEOFDAY) && !warning_tripped)
to_chat(GLOB.admins, "<hr><center><span class='userdanger'><big>--- CRITICAL ---</big></span><br>The server hasn't received an uptime check from the server daemon for over 2 minutes. Inform AA ASAP.</center><hr>")
warning_tripped = TRUE