This commit is contained in:
33333-33333 2026-07-01 14:41:05 +09:00
commit 4d3fc2cd47
84 changed files with 3429 additions and 3480 deletions

View file

@ -11,23 +11,14 @@
"TarinaiItemGrowthLifecycleStep",
]);
let cachedSteps = null;
function concreteSteps() {
if (!cachedSteps) cachedSteps = CONCRETE_STEP_NAMES.map(name => global[name]);
return cachedSteps;
}
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;
const steps = concreteSteps();
if (steps.length !== CONCRETE_STEP_NAMES.length) return false;
const context = options.context || {};
for (const step of steps) {
const result = step.update(item, dt, worldRef, context) || {};
if (result.done) return result.ok !== false;
}
return true;
return runner.run(item, dt, worldRef, options.context || {});
}
global.TarinaiItemLifecyclePipeline = Object.freeze({ updateOne });