Struct ServerControlState
The operator-controlled lifecycle state of a world or scene server.
public readonly struct ServerControlState
- Inherited Members
Remarks
The database row is the authority for both fields, not the process. A server writes them
only when an operator asks it to; on every pulse it reads them back and adopts whatever it
finds. That inversion is what makes the controls usable at all — the previous arrangement
had each server write its own in-memory locked flag on every pulse, so anything
that set the column out of band was overwritten within five seconds, and nothing in the
process ever set the flag either. It also means any tool that can write the row (the
Discord bot, a CMS, psql) controls the servers, exactly as the kick-request table already
does for accounts.
Constructors
ServerControlState(bool, DateTime?)
Creates a control state.
public ServerControlState(bool locked, DateTime? shutdownAtUtc)
Parameters
lockedboolWhether the server is closed to new arrivals.
shutdownAtUtcDateTime?Scheduled stop time, or null.
Fields
Locked
Whether the server is closed to new arrivals.
public readonly bool Locked
Field Value
Remarks
A drain, not an eviction: players already on the server keep playing. Elevated accounts are admitted anyway, so locking a world does not lock out the operator who has to go in and look at it.
ShutdownAtUtc
When this server stops, or null when no shutdown is scheduled.
public readonly DateTime? ShutdownAtUtc
Field Value
Remarks
An absolute UTC instant rather than a remaining duration, so every process that reads it agrees on the deadline regardless of when it last pulsed, and a countdown survives a reader missing a beat.
Properties
HasShutdown
Whether a shutdown is scheduled at all.
public bool HasShutdown { get; }
Property Value
Methods
SecondsUntilShutdown(DateTime)
Seconds remaining until the scheduled shutdown, clamped at zero. Zero when no shutdown is scheduled or the deadline has passed.
public double SecondsUntilShutdown(DateTime nowUtc)
Parameters
nowUtcDateTimeCurrent time.