stable
This commit is contained in:
parent
86226ccc94
commit
077d4ab9ac
71 changed files with 2905 additions and 1063 deletions
|
|
@ -1,9 +1,8 @@
|
|||
"use strict";
|
||||
|
||||
// Layer: entity-runtime/tarinai/pipeline
|
||||
// Owns the ordered Tarinai update pipeline. Runtime calls this instead of
|
||||
// depending on the monolithic prototype update body. The legacy step is retained
|
||||
// as a compatibility fallback while concrete steps are split out incrementally.
|
||||
// Owns the ordered Tarinai update pipeline. There is no monolithic fallback path:
|
||||
// creature behavior must be handled by the explicit update steps below.
|
||||
(function (global) {
|
||||
const CONCRETE_STEP_NAMES = Object.freeze([
|
||||
"TarinaiFrameUpdateStep",
|
||||
|
|
@ -21,7 +20,12 @@
|
|||
return concreteSteps().length === CONCRETE_STEP_NAMES.length;
|
||||
}
|
||||
|
||||
function runConcrete(tarinai, dt, context) {
|
||||
function updateOne(tarinai, dt, options = {}) {
|
||||
if (!tarinai || tarinai.dead || !canRunConcretePipeline()) return false;
|
||||
const context = {
|
||||
...(options.context || {}),
|
||||
wasSleepingAtFrameStart: false,
|
||||
};
|
||||
for (const step of concreteSteps()) {
|
||||
const result = step.update(tarinai, dt, context) || {};
|
||||
if (result.done) return result.ok !== false;
|
||||
|
|
@ -29,24 +33,6 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
function runLegacy(tarinai, dt, context) {
|
||||
const step = global.TarinaiLegacyUpdateStep;
|
||||
if (step && typeof step.update === "function") return step.update(tarinai, dt, context).ok !== false;
|
||||
const legacyUpdate = context.legacyUpdate;
|
||||
if (typeof legacyUpdate !== "function") return false;
|
||||
legacyUpdate.call(tarinai, dt);
|
||||
return true;
|
||||
}
|
||||
|
||||
function updateOne(tarinai, dt, options = {}) {
|
||||
if (!tarinai || tarinai.dead) return false;
|
||||
const context = {
|
||||
legacyUpdate: options.legacyUpdate,
|
||||
wasSleepingAtFrameStart: false,
|
||||
};
|
||||
return canRunConcretePipeline() ? runConcrete(tarinai, dt, context) : runLegacy(tarinai, dt, context);
|
||||
}
|
||||
|
||||
global.TarinaiUpdatePipeline = Object.freeze({
|
||||
stepNames: CONCRETE_STEP_NAMES,
|
||||
canRunConcretePipeline,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue