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

@ -12,26 +12,18 @@
"TarinaiHealthUpdateStep",
]);
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, tarinai, dt, context) => step.update(tarinai, dt, context)
);
function updateOne(tarinai, dt, options = {}) {
if (!tarinai || tarinai.dead) return false;
const steps = concreteSteps();
if (steps.length !== CONCRETE_STEP_NAMES.length) return false;
const context = {
...(options.context || {}),
wasSleepingAtFrameStart: false,
};
for (const step of steps) {
const result = step.update(tarinai, dt, context) || {};
if (result.done) return result.ok !== false;
}
return true;
return runner.run(tarinai, dt, context);
}
global.TarinaiUpdatePipeline = Object.freeze({ updateOne });