removed unused processesseessess
This commit is contained in:
parent
348f355eb2
commit
4fdc567e08
158 changed files with 1317 additions and 3351 deletions
|
|
@ -5,10 +5,10 @@
|
|||
// thinking/environment work, while visible movement can still be integrated
|
||||
// every frame via the smooth-motion pass.
|
||||
(function (global) {
|
||||
const helpers = () => global.TarinaiSimulationRuntime?.helpers || {};
|
||||
const helpers = global.TarinaiSimulationRuntime.helpers;
|
||||
|
||||
function behaviorOf(tarinai) {
|
||||
return typeof currentTarinaiBehavior === "function" ? currentTarinaiBehavior(tarinai) : tarinai?.behavior;
|
||||
return currentTarinaiBehavior(tarinai);
|
||||
}
|
||||
|
||||
function behaviorId(tarinai) {
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
}
|
||||
|
||||
function visible(worldRef, tarinai, visibleRect) {
|
||||
return Boolean(helpers().pointInRect?.(tarinai.x || 0, tarinai.y || 0, visibleRect));
|
||||
return Boolean(helpers.pointInRect(tarinai.x || 0, tarinai.y || 0, visibleRect));
|
||||
}
|
||||
|
||||
function hasMotionNeed(tarinai) {
|
||||
|
|
@ -34,12 +34,12 @@
|
|||
const radius = Math.max(150, (Number(tarinai.radius) || 22) + 190);
|
||||
const source = worldRef.nearbyItems?.(tarinai.x || 0, tarinai.y || 0, radius, true) || worldRef.items || [];
|
||||
for (const it of source) {
|
||||
if (!it || it.dead || !global.TarinaiMechanicalSystem?.isMechanicalType?.(it.type)) continue;
|
||||
const reach = global.TarinaiMechanicalSystem?.reach?.(it) || Math.max(64, it.r || 64);
|
||||
if (!it || it.dead || !global.TarinaiMechanicalSystem.isMechanicalType(it.type)) continue;
|
||||
const reach = global.TarinaiMechanicalSystem.reach(it) || Math.max(64, it.r || 64);
|
||||
if (Math.hypot((tarinai.x || 0) - (it.x || 0), (tarinai.y || 0) - (it.y || 0)) > reach + radius) continue;
|
||||
if (it.type === "rotator" || it.type === "reciprocator") return true;
|
||||
if (global.TarinaiMechanicalSystem?.passiveItemAwake?.(it)) return true;
|
||||
const body = global.TarinaiPhysicsBodySystem?.ensureBody?.(it, worldRef, { syncFromLegacy: false });
|
||||
if (global.TarinaiMechanicalSystem.passiveItemAwake(it)) return true;
|
||||
const body = global.TarinaiPhysicsBodySystem.ensureBody(it, worldRef, { syncFromLegacy: false });
|
||||
const vel = body?.velocity || {};
|
||||
if (Math.hypot(Number(vel.x || it.vx || 0) || 0, Number(vel.y || it.vy || 0) || 0) + Math.abs(Number(vel.angular || it.spin || 0) || 0) * 64 > 0.8) return true;
|
||||
}
|
||||
|
|
@ -70,12 +70,12 @@
|
|||
|
||||
const id = behaviorId(tarinai);
|
||||
const state = String(tarinai.state || id || "");
|
||||
const tier = global.TarinaiPerf?.renderQualityTier?.() || "high";
|
||||
const tier = global.TarinaiPerf.renderQualityTier() || "high";
|
||||
const count = (worldRef.tarinai || []).length;
|
||||
const mobile = Boolean(global.TarinaiInputMode?.snapshot?.().touchFirst || (global.innerWidth || 9999) <= 760);
|
||||
const mobile = Boolean(global.TarinaiInputMode.snapshot().touchFirst || (global.innerWidth || 9999) <= 760);
|
||||
const isVisible = visible(worldRef, tarinai, visibleRect);
|
||||
const farRect = isVisible ? visibleRect : (helpers().updateVisibleWorldRect?.(worldRef, 520) || visibleRect);
|
||||
const isNear = isVisible || Boolean(helpers().pointInRect?.(tarinai.x || 0, tarinai.y || 0, farRect));
|
||||
const farRect = isVisible ? visibleRect : helpers.updateVisibleWorldRect(worldRef, 520);
|
||||
const isNear = isVisible || Boolean(helpers.pointInRect(tarinai.x || 0, tarinai.y || 0, farRect));
|
||||
const motionNeed = hasMotionNeed(tarinai);
|
||||
|
||||
const nestEntryActive = Boolean(tarinai.insideNestBoxId && (typeof tarinai.nestBoxEntryActive === "function" ? tarinai.nestBoxEntryActive() : ((worldRef.time || 0) < (tarinai._nestBoxEntrySmoothUntil || -Infinity) || ((tarinai.nestFade || 0) > 0.01 && (tarinai.nestFade || 0) < 0.985))));
|
||||
|
|
@ -140,18 +140,8 @@
|
|||
return { interval, lane, smoothMotion, visible: isVisible, urgent: false, sleepPhysical, eatPhysical, passivePhysicsNeed };
|
||||
}
|
||||
|
||||
function updateInterval(worldRef, tarinai, visibleRect) {
|
||||
return cadence(worldRef, tarinai, visibleRect).interval;
|
||||
}
|
||||
|
||||
function shouldRunRealtime(worldRef, tarinai, visibleRect) {
|
||||
return updateInterval(worldRef, tarinai, visibleRect) <= 0;
|
||||
}
|
||||
|
||||
global.TarinaiCreatureUpdatePolicy = Object.freeze({
|
||||
updateInterval,
|
||||
updateCadence: cadence,
|
||||
behaviorId,
|
||||
shouldRunRealtime,
|
||||
});
|
||||
})(typeof window !== "undefined" ? window : globalThis);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue