/tg/ Station 13 - Modules - TypesDefine Details

code/__DEFINES/MC.dm

MC_AVG_OVER_TIMEcreates a running average of "things elapsed" per time period when you need to count via a smaller time period. eg you want an average number of things happening per second but you measure the event every tick (50 milliseconds). make sure both time intervals are in the same units. doesnt work if current_duration > total_duration or if total_duration == 0
MC_RUNNINGReturns true if the MC is initialized and running. Optional argument init_stage controls what stage the mc must have initializted to count as initialized. Defaults to INITSTAGE_MAX if not specified.

SubSystem flags (Please design any new flags so that the default is off, to make adding flags to subsystems easier)

SS_NO_INITsubsystem does not initialize.
SS_NO_FIREsubsystem does not fire. (like can_fire = 0, but keeps it from getting added to the processing subsystems list) (Requires a MC restart to change)
SS_BACKGROUNDSubsystem only runs on spare cpu (after all non-background subsystems have ran that tick) SS_BACKGROUND has its own priority bracket, this overrides SS_TICKER's priority bump
SS_TICKERTreat wait as a tick count, not DS, run every wait ticks. (also forces it to run first in the tick (unless SS_BACKGROUND)) (We don't want to be choked out by other subsystems queuing into us) (implies all runlevels because of how it works) This is designed for basically anything that works as a mini-mc (like SStimer)
SS_KEEP_TIMINGkeep the subsystem's timing on point by firing early if it fired late last fire because of lag ie: if a 20ds subsystem fires say 5 ds late due to lag or what not, its next fire would be in 15ds, not 20ds.
SS_POST_FIRE_TIMINGCalculate its next fire after its fired. (IE: if a 5ds wait SS takes 2ds to run, its next fire should be 5ds away, not 3ds like it normally would be) This flag overrides SS_KEEP_TIMING
SS_OK_TO_FAIL_INITIf this subsystem doesn't initialize, it should not report as a hard error in CI. This should be used for subsystems that are flaky for complicated reasons, such as the Lua subsystem, which relies on auxtools, which is unstable. It should not be used simply to silence CI.

SUBSYSTEM STATES

SS_IDLEain't doing shit.
SS_QUEUEDqueued to run
SS_RUNNINGactively running
SS_PAUSEDpaused by mc_tick_check
SS_SLEEPINGfire() slept.
SS_PAUSINGin the middle of pausing
INITSTAGE_EARLYEarly init stuff that doesn't need to wait for mapload
INITSTAGE_MAINMain init stage
INITSTAGE_MAXHighest initstage.

Define Details

INITSTAGE_EARLY

Early init stuff that doesn't need to wait for mapload

INITSTAGE_MAIN

Main init stage

INITSTAGE_MAX

Highest initstage.

MC_AVG_OVER_TIME

creates a running average of "things elapsed" per time period when you need to count via a smaller time period. eg you want an average number of things happening per second but you measure the event every tick (50 milliseconds). make sure both time intervals are in the same units. doesnt work if current_duration > total_duration or if total_duration == 0

MC_RUNNING

Returns true if the MC is initialized and running. Optional argument init_stage controls what stage the mc must have initializted to count as initialized. Defaults to INITSTAGE_MAX if not specified.

SS_BACKGROUND

Subsystem only runs on spare cpu (after all non-background subsystems have ran that tick) SS_BACKGROUND has its own priority bracket, this overrides SS_TICKER's priority bump

SS_IDLE

ain't doing shit.

SS_KEEP_TIMING

keep the subsystem's timing on point by firing early if it fired late last fire because of lag ie: if a 20ds subsystem fires say 5 ds late due to lag or what not, its next fire would be in 15ds, not 20ds.

SS_NO_FIRE

subsystem does not fire. (like can_fire = 0, but keeps it from getting added to the processing subsystems list) (Requires a MC restart to change)

SS_NO_INIT

subsystem does not initialize.

SS_OK_TO_FAIL_INIT

If this subsystem doesn't initialize, it should not report as a hard error in CI. This should be used for subsystems that are flaky for complicated reasons, such as the Lua subsystem, which relies on auxtools, which is unstable. It should not be used simply to silence CI.

SS_PAUSED

paused by mc_tick_check

SS_PAUSING

in the middle of pausing

SS_POST_FIRE_TIMING

Calculate its next fire after its fired. (IE: if a 5ds wait SS takes 2ds to run, its next fire should be 5ds away, not 3ds like it normally would be) This flag overrides SS_KEEP_TIMING

SS_QUEUED

queued to run

SS_RUNNING

actively running

SS_SLEEPING

fire() slept.

SS_TICKER

Treat wait as a tick count, not DS, run every wait ticks. (also forces it to run first in the tick (unless SS_BACKGROUND)) (We don't want to be choked out by other subsystems queuing into us) (implies all runlevels because of how it works) This is designed for basically anything that works as a mini-mc (like SStimer)