byond - Modules - TypesVar Details - Proc Details

subsystem

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
costaverage time to execute
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.
initialization_failure_messageString to store an applicable error message for a subsystem crashing, used to help debug crashes in contexts such as Continuous Integration/Unit Tests
initializedThis var is set to TRUE after the subsystem has been initialized.
last_firelast world.time we called fire()
nameName of the subsystem - you must change this
next_firescheduled world.time for next fire()
paused_tick_usagetotal tick_usage of all of our runs while pausing this run
paused_ticksticks this ss is taking to run right now.
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
profiler_focusedboolean set by admins. if TRUE then this subsystem will stop the world profiler after ignite() returns and start it again when called. used so that you can audit a specific subsystem or group of subsystems' synchronous call chain.
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_prioritywe keep a running total to make the math easier, if priority changes mid-fire that would break our running total, so we store it here
queued_timetime we entered the queue, (for timing and priority reasons)
rolling_usageFlat list of usage and time, every odd index is a log time, every even index is a usage
runlevelsBitmap of what game states can this subsystem fire at. See [RUNLEVELS_DEFAULT] for more details.
slept_countTracks how many times a subsystem has ever slept in fire().
statetracks the current state of the ss, running, paused, etc.
tick_allocation_avgHow much of a tick (in percents of a tick) do we get allocated by the mc on avg.
tick_allocation_lastHow much of a tick (in percents of a tick) were we allocated last fire.
tick_overrunaverage tick usage
tick_usageaverage time to execute
tickshow many ticks does this ss take to run on avg.
times_firednumber of times we have called fire()
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()
enqueueQueue it to run. (we loop thru a linked list until we get to the end or find the right point) (this lets us sort our run order correctly without having to re-sort the entire already sorted list)
firepreviously, this would have been named 'process()' but that name is used everywhere for different things! fire() seems more suitable. This is the procedure that gets called every 'wait' deciseconds. Sleeping in here prevents future fires until returned..
igniteThis is used so the mc knows when the subsystem sleeps. do not override.
prune_rolling_usagePrunes out of date entries in our rolling usage list

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

average time to execute

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.

initialization_failure_message

String to store an applicable error message for a subsystem crashing, used to help debug crashes in contexts such as Continuous Integration/Unit Tests

initialized

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

last_fire

last world.time we called fire()

name

Name of the subsystem - you must change this

next_fire

scheduled world.time for next fire()

paused_tick_usage

total tick_usage of all of our runs while pausing this run

paused_ticks

ticks this ss is taking to run right now.

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

profiler_focused

boolean set by admins. if TRUE then this subsystem will stop the world profiler after ignite() returns and start it again when called. used so that you can audit a specific subsystem or group of subsystems' synchronous call chain.

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

we keep a running total to make the math easier, if priority changes mid-fire that would break our running total, so we store it here

queued_time

time we entered the queue, (for timing and priority reasons)

rolling_usage

Flat list of usage and time, every odd index is a log time, every even index is a usage

runlevels

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

slept_count

Tracks how many times a subsystem has ever slept in fire().

state

tracks the current state of the ss, running, paused, etc.

tick_allocation_avg

How much of a tick (in percents of a tick) do we get allocated by the mc on avg.

tick_allocation_last

How much of a tick (in percents of a tick) were we allocated last fire.

tick_overrun

average tick usage

tick_usage

average time to execute

ticks

how many ticks does this ss take to run on avg.

times_fired

number of times we have called fire()

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()

enqueue

Queue it to run. (we loop thru a linked list until we get to the end or find the right point) (this lets us sort our run order correctly without having to re-sort the entire already sorted list)

fire

previously, this would have been named 'process()' but that name is used everywhere for different things! fire() seems more suitable. This is the procedure that gets called every 'wait' deciseconds. Sleeping in here prevents future fires until returned..

ignite

This is used so the mc knows when the subsystem sleeps. do not override.

prune_rolling_usage

Prunes out of date entries in our rolling usage list