hm
This commit is contained in:
parent
7455d630fc
commit
4d3fc2cd47
84 changed files with 3429 additions and 3480 deletions
|
|
@ -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 });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue