stable
This commit is contained in:
parent
fbdac9ebf1
commit
86226ccc94
97 changed files with 5790 additions and 2307 deletions
21
js/tarinai_update_step_environment.js
Normal file
21
js/tarinai_update_step_environment.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"use strict";
|
||||
|
||||
// Layer: entity-runtime/tarinai/update-step
|
||||
// Owns low-frequency local environment effects around a Tarinai.
|
||||
(function (global) {
|
||||
function update(t, dt, context = {}) {
|
||||
if (!t || t.dead) return { done: true };
|
||||
t.envTimer += dt;
|
||||
const urgentAi = Boolean(context.urgentAi);
|
||||
const envInterval = 3.0 + stableUnit(t.familyKey || t.id, "env-phase") * 1.4;
|
||||
if (t.envTimer >= envInterval && t.world.spendScheduledWork?.("env", urgentAi || t.world.selected === t) !== false) {
|
||||
const envDt = Math.min(t.envTimer, 1.2);
|
||||
t.envTimer = 0;
|
||||
if (global.TarinaiLocalEnvironmentSystem?.updateOne) global.TarinaiLocalEnvironmentSystem.updateOne(t, envDt);
|
||||
else t.applyEnvironment?.(envDt);
|
||||
}
|
||||
return { done: false };
|
||||
}
|
||||
|
||||
global.TarinaiEnvironmentUpdateStep = Object.freeze({ update });
|
||||
})(typeof window !== "undefined" ? window : globalThis);
|
||||
Loading…
Add table
Add a link
Reference in a new issue