Shiptest 13 - Modules - TypesVar Details - Proc Details

Subsystem base class

Defines a subsystem to be managed by the Master Controller

Simply define a child of this subsystem, using the [SUBSYSTEM_DEF] macro, and the MC will handle registration. Changing the name is required

Vars

can_fireSet to 0 to prevent fire() calls, mostly for admin use or subsystems that may be resumed later use the SS_NO_FIRE flag instead for systems that never fire to keep it from even being added to list that is checked every tick
costRunning average of the amount of milliseconds it takes the subsystem to complete a run (including all resumes but not the time spent paused)
failure_strikesHow many times we suspect a subsystem type has crashed the MC, 3 strikes and you're out!
flagsSubsystem Flags 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)
init_orderOrder 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.
init_stageWhich stage does this subsystem init at. Earlier stages can fire while later stages init.
initializedThis var is set to TRUE after the subsystem has been initialized.
last_fireLast world.time the subsystem completed a run (as in wasn't paused by [MC_TICK_CHECK])
nameName of the subsystem - you must change this
next_fireScheduled world.time for next fire()
paused_tick_usageTracks how much of a tick the subsystem has consumed in the current run
paused_ticksTracks how many fires the subsystem has consecutively paused on in the current run
postponed_firesHow many fires have we been requested to postpone
priorityPriority 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
queue_nextNext subsystem in the queue of subsystems to run this tick
queue_prevPrevious subsystem in the queue of subsystems to run this tick
queued_priorityPriority at the time the subsystem entered the queue. Needed to avoid changes in priority (by admins and the like) from breaking things.
queued_timeTime the subsystem entered the queue, (for timing and priority reasons)
runlevelsBitmap of what game states can this subsystem fire at. See [RUNLEVELS_DEFAULT] for more details.
ss_idThe unique ID of the subsystem - you must change this
stateTracks 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
tick_overrunRunning average of the amount of tick usage (in percents of a game tick) the subsystem has spent past its allocated time without pausing
tick_usageRunning average of the amount of tick usage in percents of a tick it takes the subsystem to complete a run
ticksTracks how many fires the subsystem takes to complete a run on average.
times_firedTracks the amount of completed runs for the subsystem
waitTime to wait (in deciseconds) between each call to fire(). Must be a positive integer.

Procs

OnConfigLoadCalled after the config has been loaded or reloaded.
PreInitdatum/controller/subsystem/New()
get_metricsReturns the metrics for the subsystem.

Var Details

can_fire

Set to 0 to prevent fire() calls, mostly for admin use or subsystems that may be resumed later use the SS_NO_FIRE flag instead for systems that never fire to keep it from even being added to list that is checked every tick

cost

Running average of the amount of milliseconds it takes the subsystem to complete a run (including all resumes but not the time spent paused)

failure_strikes

How many times we suspect a subsystem type has crashed the MC, 3 strikes and you're out!

flags

Subsystem Flags 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)

init_order

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.

init_stage

Which stage does this subsystem init at. Earlier stages can fire while later stages init.

initialized

This var is set to TRUE after the subsystem has been initialized.

last_fire

Last world.time the subsystem completed a run (as in wasn't paused by [MC_TICK_CHECK])

name

Name of the subsystem - you must change this

next_fire

Scheduled world.time for next fire()

paused_tick_usage

Tracks how much of a tick the subsystem has consumed in the current run

paused_ticks

Tracks how many fires the subsystem has consecutively paused on in the current run

postponed_fires

How many fires have we been requested to postpone

priority

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

queue_next

Next subsystem in the queue of subsystems to run this tick

queue_prev

Previous subsystem in the queue of subsystems to run this tick

queued_priority

Priority at the time the subsystem entered the queue. Needed to avoid changes in priority (by admins and the like) from breaking things.

queued_time

Time the subsystem entered the queue, (for timing and priority reasons)

runlevels

Bitmap of what game states can this subsystem fire at. See [RUNLEVELS_DEFAULT] for more details.

ss_id

The unique ID of the subsystem - you must change this

state

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

tick_overrun

Running average of the amount of tick usage (in percents of a game tick) the subsystem has spent past its allocated time without pausing

tick_usage

Running average of the amount of tick usage in percents of a tick it takes the subsystem to complete a run

ticks

Tracks how many fires the subsystem takes to complete a run on average.

times_fired

Tracks the amount of completed runs for the subsystem

wait

Time to wait (in deciseconds) between each call to fire(). Must be a positive integer.

Proc Details

OnConfigLoad

Called after the config has been loaded or reloaded.

PreInit

datum/controller/subsystem/New()

get_metrics

Returns the metrics for the subsystem.

This can be overriden on subtypes for variables that could affect tick usage Example: ATs on SSair