Installs runFixedStep as scheduler.onFixedStep and returns a
function that puts the previous callback back.
This is the whole of D5's seam: the scheduler is not modified, imported
from, or subclassed — its public callback property is assigned, exactly as
SchedulerOptions.onFixedStep would.
The returned detach is idempotent and defensive: if something else has
since replaced onFixedStep, detaching leaves that newer callback alone
rather than clobbering it (WP-1.11 decision).
Unregisters every system, calling each dispose once, in reverse
registry order — descending priority, with equal priorities disposed in
reverse registration order — so teardown mirrors the §39 execution order,
as disposeAll (§83) mirrors construction for resources. A dispose that
throws does not stop the rest; the first thrown value is re-thrown
afterwards.
Registers system, calls its initialize exactly once, and returns an
idempotent unregister function.
initialize is called after the system is inserted, so it may query
the registry (including registering further systems) from the context.
Runs every registered system's fixedUpdate once, in registry order.
Error if called while a fixed step is already running. A nested
fixed step would advance the simulation twice for one TimeState and break
replay (§34), and unlike a re-entrant event (§6b rule 4) there is no
meaningful "later" to defer it to — the scheduler owns the step cadence
(WP-1.11 decision).
Unregisters system and calls its dispose exactly once. Returns whether
it was registered. Safe to call from inside a fixed step (rule 4).
The §39 ordered set of simulation systems.
Ordering rules:
priority.Mutation rules, mirroring
EventEmitter(§6b rule 3) so the two lifecycle surfaces behave the same way:disposeruns immediately at the moment of unregistration.Failure rule:
finally, so the nextrunFixedStepruns the full set again. A simulation step that failed halfway is not silently completed: swallowing the error would leave the world in a half-stepped state that later steps would build on (WP-1.11 decision; matchesEventEmitter's dispatch).