2026-06-26 12:46:32 +09:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
// Layer: entity-runtime/tarinai
|
2026-06-26 19:04:32 +09:00
|
|
|
// Owns the public Tarinai update boundary. Tarinai.prototype.update routes
|
|
|
|
|
// directly through the explicit creature update pipeline.
|
2026-06-26 12:46:32 +09:00
|
|
|
(function (global) {
|
|
|
|
|
function installPrototypeBoundary() {
|
|
|
|
|
const proto = global.Tarinai?.prototype;
|
|
|
|
|
if (!proto || proto._tarinaiCreatureRuntimeInstalled) return false;
|
|
|
|
|
proto.update = function update(dt) {
|
|
|
|
|
return global.TarinaiCreatureRuntime.updateOne(this, dt);
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(proto, "_tarinaiCreatureRuntimeInstalled", {
|
|
|
|
|
value: true,
|
|
|
|
|
configurable: true,
|
|
|
|
|
writable: true,
|
|
|
|
|
});
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function updateOne(tarinai, dt) {
|
2026-06-26 19:04:32 +09:00
|
|
|
if (!tarinai || tarinai.dead || !global.TarinaiUpdatePipeline?.updateOne) return false;
|
|
|
|
|
return global.TarinaiUpdatePipeline.updateOne(tarinai, dt) !== false;
|
2026-06-26 12:46:32 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function updateBatch(tarinaiList, dt) {
|
|
|
|
|
if (!Array.isArray(tarinaiList)) return 0;
|
|
|
|
|
let ran = 0;
|
|
|
|
|
for (const t of tarinaiList) if (updateOne(t, dt)) ran += 1;
|
|
|
|
|
return ran;
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-26 19:04:32 +09:00
|
|
|
global.TarinaiCreatureRuntime = Object.freeze({ installPrototypeBoundary, updateOne, updateBatch });
|
2026-06-26 12:46:32 +09:00
|
|
|
installPrototypeBoundary();
|
|
|
|
|
})(typeof window !== "undefined" ? window : globalThis);
|