tarinai/js/item_lifecycle_pipeline.js

25 lines
915 B
JavaScript
Raw Normal View History

2026-06-26 12:46:32 +09:00
"use strict";
// Layer: entity-runtime/items/pipeline
2026-06-26 19:04:32 +09:00
// Owns the ordered item lifecycle pipeline. There is no monolithic fallback path:
// every item update must be handled by the explicit lifecycle steps below.
2026-06-26 12:46:32 +09:00
(function (global) {
const CONCRETE_STEP_NAMES = Object.freeze([
"TarinaiItemFrameLifecycleStep",
"TarinaiItemDecayLifecycleStep",
"TarinaiItemDynamicLifecycleStep",
"TarinaiItemGrowthLifecycleStep",
]);
2026-07-01 14:41:05 +09:00
const runner = global.TarinaiUpdateStepPipelineRunner.create(
CONCRETE_STEP_NAMES,
(step, item, dt, worldRef, context) => step.update(item, dt, worldRef, context)
);
2026-06-26 12:46:32 +09:00
2026-06-26 19:04:32 +09:00
function updateOne(item, dt, worldRef, options = {}) {
2026-06-29 16:21:58 +09:00
if (!item || item.dead) return false;
2026-07-01 14:41:05 +09:00
return runner.run(item, dt, worldRef, options.context || {});
2026-06-26 12:46:32 +09:00
}
2026-06-29 16:21:58 +09:00
global.TarinaiItemLifecyclePipeline = Object.freeze({ updateOne });
2026-06-26 12:46:32 +09:00
})(typeof window !== "undefined" ? window : globalThis);