stable
This commit is contained in:
parent
86226ccc94
commit
077d4ab9ac
71 changed files with 2905 additions and 1063 deletions
|
|
@ -1,29 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
// Layer: entity-runtime/tarinai
|
||||
// Owns the public Tarinai update boundary. Tarinai.prototype.update remains a
|
||||
// compatibility facade; concrete behavior now routes through TarinaiUpdatePipeline
|
||||
// when available, with the captured legacy update kept as a fallback.
|
||||
// Owns the public Tarinai update boundary. Tarinai.prototype.update routes
|
||||
// directly through the explicit creature update pipeline.
|
||||
(function (global) {
|
||||
let legacyUpdate = null;
|
||||
|
||||
function preferredLegacyUpdate(proto) {
|
||||
const systemLegacy = global.TarinaiLegacyUpdateSystem?.updateWithThis;
|
||||
if (typeof systemLegacy === "function") return systemLegacy;
|
||||
return proto?.update || legacyUpdate;
|
||||
}
|
||||
|
||||
function installPrototypeBoundary() {
|
||||
const proto = global.Tarinai?.prototype;
|
||||
if (!proto || proto._tarinaiCreatureRuntimeInstalled) return false;
|
||||
legacyUpdate = preferredLegacyUpdate(proto);
|
||||
if (typeof legacyUpdate === "function" && !proto._tarinaiLegacyUpdate) {
|
||||
Object.defineProperty(proto, "_tarinaiLegacyUpdate", {
|
||||
value: legacyUpdate,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
});
|
||||
}
|
||||
proto.update = function update(dt) {
|
||||
return global.TarinaiCreatureRuntime.updateOne(this, dt);
|
||||
};
|
||||
|
|
@ -36,13 +19,8 @@
|
|||
}
|
||||
|
||||
function updateOne(tarinai, dt) {
|
||||
const fn = tarinai?._tarinaiLegacyUpdate || legacyUpdate || global.TarinaiLegacyUpdateSystem?.updateWithThis;
|
||||
if (!tarinai || tarinai.dead || typeof fn !== "function") return false;
|
||||
if (global.TarinaiUpdatePipeline?.updateOne) {
|
||||
return global.TarinaiUpdatePipeline.updateOne(tarinai, dt, { legacyUpdate: fn }) !== false;
|
||||
}
|
||||
fn.call(tarinai, dt);
|
||||
return true;
|
||||
if (!tarinai || tarinai.dead || !global.TarinaiUpdatePipeline?.updateOne) return false;
|
||||
return global.TarinaiUpdatePipeline.updateOne(tarinai, dt) !== false;
|
||||
}
|
||||
|
||||
function updateBatch(tarinaiList, dt) {
|
||||
|
|
@ -52,10 +30,6 @@
|
|||
return ran;
|
||||
}
|
||||
|
||||
global.TarinaiCreatureRuntime = Object.freeze({
|
||||
installPrototypeBoundary,
|
||||
updateOne,
|
||||
updateBatch,
|
||||
});
|
||||
global.TarinaiCreatureRuntime = Object.freeze({ installPrototypeBoundary, updateOne, updateBatch });
|
||||
installPrototypeBoundary();
|
||||
})(typeof window !== "undefined" ? window : globalThis);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue