"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", ]); function concreteSteps() { return CONCRETE_STEP_NAMES.map(name => global[name]).filter(step => step && typeof step.update === "function"); } function canRunConcretePipeline() { return concreteSteps().length === CONCRETE_STEP_NAMES.length; } 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; } return true; } global.TarinaiUpdatePipeline = Object.freeze({ stepNames: CONCRETE_STEP_NAMES, canRunConcretePipeline, updateOne, }); })(typeof window !== "undefined" ? window : globalThis);