tarinai/js/tarinai_update_pipeline.js

30 lines
978 B
JavaScript
Raw Normal View History

2026-06-26 12:46:32 +09:00
"use strict";
// Layer: entity-runtime/tarinai/pipeline
2026-06-26 19:04:32 +09:00
// Owns the ordered Tarinai update pipeline. There is no monolithic fallback path:
// creature behavior must be handled by the explicit update steps below.
2026-06-26 12:46:32 +09:00
(function (global) {
const CONCRETE_STEP_NAMES = Object.freeze([
"TarinaiFrameUpdateStep",
"TarinaiAiUpdateStep",
"TarinaiEnvironmentUpdateStep",
"TarinaiMovementUpdateStep",
"TarinaiHealthUpdateStep",
]);
2026-07-01 14:41:05 +09:00
const runner = global.TarinaiUpdateStepPipelineRunner.create(
CONCRETE_STEP_NAMES,
(step, tarinai, dt, context) => step.update(tarinai, dt, context)
);
2026-06-26 12:46:32 +09:00
2026-06-26 19:04:32 +09:00
function updateOne(tarinai, dt, options = {}) {
2026-06-29 16:21:58 +09:00
if (!tarinai || tarinai.dead) return false;
2026-06-26 19:04:32 +09:00
const context = {
...(options.context || {}),
wasSleepingAtFrameStart: false,
};
2026-07-01 14:41:05 +09:00
return runner.run(tarinai, dt, context);
2026-06-26 12:46:32 +09:00
}
2026-06-29 16:21:58 +09:00
global.TarinaiUpdatePipeline = Object.freeze({ updateOne });
2026-06-26 12:46:32 +09:00
})(typeof window !== "undefined" ? window : globalThis);