8 lines
19 KiB
HTML
8 lines
19 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><base href="../../"><link rel="stylesheet" href="dmdoc.css"><title>/datum/controller/subsystem - /tg/ Station 13</title></head><body><header><a href="index.html">/tg/ Station 13</a> - <a href="index.html#modules">Modules</a> - <a href="index.html#types">Types</a> — <a href="datum/controller/subsystem.html#var">Var Details</a> - <a href="datum/controller/subsystem.html#proc">Proc Details</a></header><main><h1>Subsystem base class <aside>/<a href="datum.html">datum</a>/<a href="datum/controller/subsystem.html">controller/subsystem</a></aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L10"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 10"></a></h1><p>Defines a subsystem to be managed by the <a href="datum/controller/master.html" title="/datum/controller/master">Master Controller</a></p>
|
||
<p>Simply define a child of this subsystem, using the [SUBSYSTEM_DEF] macro, and the MC will handle registration.
|
||
Changing the name is required</p><table class="summary" cellspacing="0"><tr><td colspan="2"><h2>Vars</h2></td></tr><tr><th><a href="datum/controller/subsystem.html#var/can_fire">can_fire</a></th><td>Set to 0 to prevent fire() calls, mostly for admin use or subsystems that may be resumed later
|
||
use the <a href="code/__DEFINES/MC.html#define/SS_NO_FIRE" title="SS_NO_FIRE">SS_NO_FIRE</a> flag instead for systems that never fire to keep it from even being added to list that is checked every tick</td></tr><tr><th><a href="datum/controller/subsystem.html#var/cost">cost</a></th><td>Running average of the amount of milliseconds it takes the subsystem to complete a run (including all resumes but not the time spent paused)</td></tr><tr><th><a href="datum/controller/subsystem.html#var/failure_strikes">failure_strikes</a></th><td>How many times we suspect a subsystem type has crashed the MC, 3 strikes and you're out!</td></tr><tr><th><a href="datum/controller/subsystem.html#var/flags">flags</a></th><td><a href="code/__DEFINES/MC.html#define/SS_NO_INIT" title="SS_NO_INIT">Subsystem Flags</a> to control binary behavior. Flags must be set at compile time or before preinit finishes to take full effect. (You can also restart the mc to force them to process again)</td></tr><tr><th><a href="datum/controller/subsystem.html#var/init_order">init_order</a></th><td>Order of initialization. Higher numbers are initialized first, lower numbers later. Use or create defines such as [INIT_ORDER_DEFAULT] so we can see the order in one file.</td></tr><tr><th><a href="datum/controller/subsystem.html#var/initialized">initialized</a></th><td>This var is set to TRUE after the subsystem has been initialized.</td></tr><tr><th><a href="datum/controller/subsystem.html#var/last_fire">last_fire</a></th><td>Last world.time the subsystem completed a run (as in wasn't paused by [MC_TICK_CHECK])</td></tr><tr><th><a href="datum/controller/subsystem.html#var/name">name</a></th><td>Name of the subsystem - you must change this</td></tr><tr><th><a href="datum/controller/subsystem.html#var/next_fire">next_fire</a></th><td>Scheduled world.time for next fire()</td></tr><tr><th><a href="datum/controller/subsystem.html#var/paused_tick_usage">paused_tick_usage</a></th><td>Tracks how much of a tick the subsystem has consumed in the current run</td></tr><tr><th><a href="datum/controller/subsystem.html#var/paused_ticks">paused_ticks</a></th><td>Tracks how many fires the subsystem has consecutively paused on in the current run</td></tr><tr><th><a href="datum/controller/subsystem.html#var/postponed_fires">postponed_fires</a></th><td>How many fires have we been requested to postpone</td></tr><tr><th><a href="datum/controller/subsystem.html#var/priority">priority</a></th><td>Priority Weight: When mutiple subsystems need to run in the same tick, higher priority subsystems will be given a higher share of the tick before MC_TICK_CHECK triggers a sleep, higher priority subsystems also run before lower priority subsystems</td></tr><tr><th><a href="datum/controller/subsystem.html#var/queue_next">queue_next</a></th><td>Next subsystem in the queue of subsystems to run this tick</td></tr><tr><th><a href="datum/controller/subsystem.html#var/queue_prev">queue_prev</a></th><td>Previous subsystem in the queue of subsystems to run this tick</td></tr><tr><th><a href="datum/controller/subsystem.html#var/queued_priority">queued_priority</a></th><td>Priority at the time the subsystem entered the queue. Needed to avoid changes in priority (by admins and the like) from breaking things.</td></tr><tr><th><a href="datum/controller/subsystem.html#var/queued_time">queued_time</a></th><td>Time the subsystem entered the queue, (for timing and priority reasons)</td></tr><tr><th><a href="datum/controller/subsystem.html#var/runlevels">runlevels</a></th><td>Bitmap of what game states can this subsystem fire at. See [RUNLEVELS_DEFAULT] for more details.</td></tr><tr><th><a href="datum/controller/subsystem.html#var/state">state</a></th><td>Tracks the current execution state of the subsystem. Used to handle subsystems that sleep in fire so the mc doesn't run them again while they are sleeping</td></tr><tr><th><a href="datum/controller/subsystem.html#var/tick_overrun">tick_overrun</a></th><td>Running average of the amount of tick usage (in percents of a game tick) the subsystem has spent past its allocated time without pausing</td></tr><tr><th><a href="datum/controller/subsystem.html#var/tick_usage">tick_usage</a></th><td>Running average of the amount of tick usage in percents of a tick it takes the subsystem to complete a run</td></tr><tr><th><a href="datum/controller/subsystem.html#var/ticks">ticks</a></th><td>Tracks how many fires the subsystem takes to complete a run on average.</td></tr><tr><th><a href="datum/controller/subsystem.html#var/times_fired">times_fired</a></th><td>Tracks the amount of completed runs for the subsystem</td></tr><tr><th><a href="datum/controller/subsystem.html#var/wait">wait</a></th><td>Time to wait (in deciseconds) between each call to fire(). Must be a positive integer.</td></tr><tr><td colspan="2"><h2>Procs</h2></td></tr><tr><th><a href="datum/controller/subsystem.html#proc/OnConfigLoad">OnConfigLoad</a></th><td>Called after the config has been loaded or reloaded.</td></tr><tr><th><a href="datum/controller/subsystem.html#proc/PreInit">PreInit</a></th><td>datum/controller/subsystem/New()</td></tr><tr><th><a href="datum/controller/subsystem.html#proc/postpone">postpone</a></th><td>Causes the next "cycle" fires to be missed. Effect is accumulative but can reset by calling update_nextfire(reset_time = TRUE)</td></tr><tr><th><a href="datum/controller/subsystem.html#proc/update_nextfire">update_nextfire</a></th><td></td></tr></table><h2 id="var">Var Details</h2><h3 id="var/can_fire"><aside class="declaration">var </aside>can_fire <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L33"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 33"></a></h3><p>Set to 0 to prevent fire() calls, mostly for admin use or subsystems that may be resumed later
|
||
use the <a href="code/__DEFINES/MC.html#define/SS_NO_FIRE" title="SS_NO_FIRE">SS_NO_FIRE</a> flag instead for systems that never fire to keep it from even being added to list that is checked every tick</p><h3 id="var/cost"><aside class="declaration">var </aside>cost <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L49"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 49"></a></h3><p>Running average of the amount of milliseconds it takes the subsystem to complete a run (including all resumes but not the time spent paused)</p><h3 id="var/failure_strikes"><aside class="declaration">var </aside>failure_strikes <aside>– /static/list</aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L82"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 82"></a></h3><p>How many times we suspect a subsystem type has crashed the MC, 3 strikes and you're out!</p><h3 id="var/flags"><aside class="declaration">var </aside>flags <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L26"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 26"></a></h3><p><a href="code/__DEFINES/MC.html#define/SS_NO_INIT" title="SS_NO_INIT">Subsystem Flags</a> to control binary behavior. Flags must be set at compile time or before preinit finishes to take full effect. (You can also restart the mc to force them to process again)</p><h3 id="var/init_order"><aside class="declaration">var </aside>init_order <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L17"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 17"></a></h3><p>Order of initialization. Higher numbers are initialized first, lower numbers later. Use or create defines such as [INIT_ORDER_DEFAULT] so we can see the order in one file.</p><h3 id="var/initialized"><aside class="declaration">var </aside>initialized <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L29"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 29"></a></h3><p>This var is set to TRUE after the subsystem has been initialized.</p><h3 id="var/last_fire"><aside class="declaration">var </aside>last_fire <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L43"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 43"></a></h3><p>Last world.time the subsystem completed a run (as in wasn't paused by [MC_TICK_CHECK])</p><h3 id="var/name">name <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L14"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 14"></a></h3><p>Name of the subsystem - you must change this</p><h3 id="var/next_fire"><aside class="declaration">var </aside>next_fire <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L46"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 46"></a></h3><p>Scheduled world.time for next fire()</p><h3 id="var/paused_tick_usage"><aside class="declaration">var </aside>paused_tick_usage <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L64"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 64"></a></h3><p>Tracks how much of a tick the subsystem has consumed in the current run</p><h3 id="var/paused_ticks"><aside class="declaration">var </aside>paused_ticks <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L61"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 61"></a></h3><p>Tracks how many fires the subsystem has consecutively paused on in the current run</p><h3 id="var/postponed_fires"><aside class="declaration">var </aside>postponed_fires <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L73"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 73"></a></h3><p>How many fires have we been requested to postpone</p><h3 id="var/priority"><aside class="declaration">var </aside>priority <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L23"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 23"></a></h3><p>Priority Weight: When mutiple subsystems need to run in the same tick, higher priority subsystems will be given a higher share of the tick before MC_TICK_CHECK triggers a sleep, higher priority subsystems also run before lower priority subsystems</p><h3 id="var/queue_next"><aside class="declaration">var </aside>queue_next <aside>– /<a href="datum.html">datum</a>/<a href="datum/controller/subsystem.html">controller/subsystem</a></aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L85"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 85"></a></h3><p>Next subsystem in the queue of subsystems to run this tick</p><h3 id="var/queue_prev"><aside class="declaration">var </aside>queue_prev <aside>– /<a href="datum.html">datum</a>/<a href="datum/controller/subsystem.html">controller/subsystem</a></aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L94"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 94"></a></h3><p>Previous subsystem in the queue of subsystems to run this tick</p><h3 id="var/queued_priority"><aside class="declaration">var </aside>queued_priority <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L79"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 79"></a></h3><p>Priority at the time the subsystem entered the queue. Needed to avoid changes in priority (by admins and the like) from breaking things.</p><h3 id="var/queued_time"><aside class="declaration">var </aside>queued_time <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L76"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 76"></a></h3><p>Time the subsystem entered the queue, (for timing and priority reasons)</p><h3 id="var/runlevels"><aside class="declaration">var </aside>runlevels <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L36"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 36"></a></h3><p>Bitmap of what game states can this subsystem fire at. See [RUNLEVELS_DEFAULT] for more details.</p><h3 id="var/state"><aside class="declaration">var </aside>state <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L58"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 58"></a></h3><p>Tracks the current execution state of the subsystem. Used to handle subsystems that sleep in fire so the mc doesn't run them again while they are sleeping</p><h3 id="var/tick_overrun"><aside class="declaration">var </aside>tick_overrun <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L55"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 55"></a></h3><p>Running average of the amount of tick usage (in percents of a game tick) the subsystem has spent past its allocated time without pausing</p><h3 id="var/tick_usage"><aside class="declaration">var </aside>tick_usage <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L52"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 52"></a></h3><p>Running average of the amount of tick usage in percents of a tick it takes the subsystem to complete a run</p><h3 id="var/ticks"><aside class="declaration">var </aside>ticks <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L67"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 67"></a></h3><p>Tracks how many fires the subsystem takes to complete a run on average.</p><h3 id="var/times_fired"><aside class="declaration">var </aside>times_fired <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L70"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 70"></a></h3><p>Tracks the amount of completed runs for the subsystem</p><h3 id="var/wait"><aside class="declaration">var </aside>wait <aside>– </aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L20"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 20"></a></h3><p>Time to wait (in deciseconds) between each call to fire(). Must be a positive integer.</p><h2 id="proc">Proc Details</h2><h3 id="proc/OnConfigLoad"><aside class="declaration">proc </aside>OnConfigLoad<aside>() <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L241"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 241"></a></aside></h3><p>Called after the config has been loaded or reloaded.</p><h3 id="proc/PreInit"><aside class="declaration">proc </aside>PreInit<aside>() <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L99"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 99"></a></aside></h3><p>datum/controller/subsystem/New()</p><h3 id="proc/postpone"><aside class="declaration">proc </aside>postpone<aside>(cycles) <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L277"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 277"></a></aside></h3><p>Causes the next "cycle" fires to be missed. Effect is accumulative but can reset by calling update_nextfire(reset_time = TRUE)</p><h3 id="proc/update_nextfire"><aside class="declaration">proc </aside>update_nextfire<aside>(reset_time) <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/controllers/subsystem.dm#L136"><img src="git.png" width="16" height="16" title="code/controllers/subsystem.dm 136"></a></aside></h3><ul>
|
||
<li>Update next_fire for the next run.</li>
|
||
<li>reset_time (bool) - Ignore things that would normally alter the next fire, like tick_overrun, and last_fire. (also resets postpone)</li>
|
||
</ul></main><footer>tgstation.dme <a href="https://github.com/evilew/GS13-Citadel/tree/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e">e8e0068</a> (master) — <a href="https://github.com/SpaceManiac/SpacemanDMM/blob/master/crates/dmdoc/README.md">dmdoc 1.9.0</a></footer></body></html> |