code/__DEFINES/MC.dm
![code/__DEFINES/MC.dm](git.png)
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. |
SubSystem flags (Please design any new flags so that the default is off, to make adding flags to subsystems easier) | |
SS_NO_INIT | subsystem does not initialize. |
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_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_NO_TICK_CHECK | subsystem does not tick check, and should not run unless there is enough time (or its running behind (unless background)) |
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)) (implies all runlevels because of how it works) This is designed for basically anything that works as a mini-mc (like SStimer) |
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_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 |
SUBSYSTEM STATES | |
SS_IDLE | aint doing shit. |
SS_QUEUED | queued to run |
SS_RUNNING | actively running |
SS_PAUSED | paused by mc_tick_check |
SS_SLEEPING | fire() slept. |
SS_PAUSING | in the middle of pausing |
INITSTAGE_EARLY | Early init stuff that doesn't need to wait for mapload |
INITSTAGE_MAIN | Main init stage |
INITSTAGE_MAX | Highest 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
aint 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_NO_TICK_CHECK
subsystem does not tick check, and should not run unless there is enough time (or its running behind (unless background))
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)) (implies all runlevels because of how it works) This is designed for basically anything that works as a mini-mc (like SStimer)