This commit is contained in:
33333-33333 2026-06-26 19:04:32 +09:00
commit 077d4ab9ac
71 changed files with 2905 additions and 1063 deletions

View file

@ -1,10 +1,8 @@
"use strict";
// Layer: entity-runtime/items/pipeline
// Owns the ordered item lifecycle pipeline. Runtime calls this before falling
// back to the monolithic legacy Item.prototype.update body. Type-specific item
// methods still live on Item.prototype for compatibility while dispatch is moved
// into explicit lifecycle steps.
// Owns the ordered item lifecycle pipeline. There is no monolithic fallback path:
// every item update must be handled by the explicit lifecycle steps below.
(function (global) {
const CONCRETE_STEP_NAMES = Object.freeze([
"TarinaiItemFrameLifecycleStep",
@ -21,7 +19,9 @@
return concreteSteps().length === CONCRETE_STEP_NAMES.length;
}
function runConcrete(item, dt, worldRef, context) {
function updateOne(item, dt, worldRef, options = {}) {
if (!item || item.dead || !canRunConcretePipeline()) return false;
const context = options.context || {};
for (const step of concreteSteps()) {
const result = step.update(item, dt, worldRef, context) || {};
if (result.done) return result.ok !== false;
@ -29,21 +29,6 @@
return true;
}
function runLegacy(item, dt, worldRef, context) {
const step = global.TarinaiItemLegacyLifecycleStep;
if (step && typeof step.update === "function") return step.update(item, dt, worldRef, context).ok !== false;
const legacyUpdate = context.legacyUpdate;
if (typeof legacyUpdate !== "function") return false;
legacyUpdate.call(item, dt, worldRef);
return true;
}
function updateOne(item, dt, worldRef, options = {}) {
if (!item || item.dead) return false;
const context = { legacyUpdate: options.legacyUpdate };
return canRunConcretePipeline() ? runConcrete(item, dt, worldRef, context) : runLegacy(item, dt, worldRef, context);
}
global.TarinaiItemLifecyclePipeline = Object.freeze({
stepNames: CONCRETE_STEP_NAMES,
canRunConcretePipeline,