30 lines
978 B
JavaScript
30 lines
978 B
JavaScript
"use strict";
|
|
|
|
// Layer: entity-runtime/tarinai/pipeline
|
|
// 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",
|
|
"TarinaiAiUpdateStep",
|
|
"TarinaiEnvironmentUpdateStep",
|
|
"TarinaiMovementUpdateStep",
|
|
"TarinaiHealthUpdateStep",
|
|
]);
|
|
|
|
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 context = {
|
|
...(options.context || {}),
|
|
wasSleepingAtFrameStart: false,
|
|
};
|
|
return runner.run(tarinai, dt, context);
|
|
}
|
|
|
|
global.TarinaiUpdatePipeline = Object.freeze({ updateOne });
|
|
})(typeof window !== "undefined" ? window : globalThis);
|