tarinai/js/item_lifecycle_pipeline.js
2026-07-01 14:41:05 +09:00

25 lines
915 B
JavaScript

"use strict";
// Layer: entity-runtime/items/pipeline
// Owns the ordered item lifecycle pipeline. There is no monolithic fallback path:
// every item update must be handled by the explicit lifecycle steps below.
(function (global) {
const CONCRETE_STEP_NAMES = Object.freeze([
"TarinaiItemFrameLifecycleStep",
"TarinaiItemDecayLifecycleStep",
"TarinaiItemDynamicLifecycleStep",
"TarinaiItemGrowthLifecycleStep",
]);
const runner = global.TarinaiUpdateStepPipelineRunner.create(
CONCRETE_STEP_NAMES,
(step, item, dt, worldRef, context) => step.update(item, dt, worldRef, context)
);
function updateOne(item, dt, worldRef, options = {}) {
if (!item || item.dead) return false;
return runner.run(item, dt, worldRef, options.context || {});
}
global.TarinaiItemLifecyclePipeline = Object.freeze({ updateOne });
})(typeof window !== "undefined" ? window : globalThis);