tarinai/js/simulation.js
2026-06-26 12:46:32 +09:00

23 lines
774 B
JavaScript

"use strict";
// Layer: simulation
// Single update entrypoint. World owns state; phase modules own the ordered update work.
(function (global) {
function update(worldRef, dt) {
const order = global.TarinaiSystemOrder;
if (order?.update) return order.update(worldRef, dt);
const phases = global.TarinaiWorldUpdatePhases;
if (!phases?.update) throw new Error("TarinaiWorldUpdatePhases is not available");
return phases.update(worldRef, dt);
}
function phases() {
return global.TarinaiWorldUpdatePhases?.phases || null;
}
function systemOrder() {
return global.TarinaiSystemOrder?.names || null;
}
global.TarinaiSimulation = Object.freeze({ update, phases, systemOrder });
})(typeof window !== "undefined" ? window : globalThis);