aaa
This commit is contained in:
parent
f1c3af2b89
commit
2636d580a8
75 changed files with 3890 additions and 1084 deletions
|
|
@ -71,12 +71,14 @@
|
|||
|
||||
const id = behaviorId(tarinai);
|
||||
const state = String(tarinai.state || id || "");
|
||||
const count = (worldRef.tarinai || []).length;
|
||||
const mobile = Boolean(global.TarinaiInputMode.snapshot().touchFirst || (global.innerWidth || 9999) <= 760);
|
||||
const isVisible = visible(worldRef, tarinai, visibleRect);
|
||||
const farRect = isVisible ? visibleRect : (nearVisibleRect || helpers.updateVisibleWorldRect(worldRef, 520));
|
||||
const isNear = isVisible || Boolean(Geometry.pointInRect(tarinai.x || 0, tarinai.y || 0, farRect));
|
||||
const motionNeed = hasMotionNeed(tarinai);
|
||||
const perfProfile = global.TarinaiPerf?.performanceProfile?.();
|
||||
if (perfProfile?.simulationThrottled === false) {
|
||||
return { interval: 0, lane: "quality-high", smoothMotion: false, visible: isVisible, near: isNear, urgent: false };
|
||||
}
|
||||
|
||||
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))));
|
||||
if (nestEntryActive) return { interval: 0, lane: "nest-entry", smoothMotion: false, visible: true, urgent: true };
|
||||
|
|
@ -95,7 +97,8 @@
|
|||
// runs on visible skipped frames.
|
||||
const panicUrgent = (tarinai.fearTimer || 0) > 0.20 || /panic/i.test(id);
|
||||
if (panicUrgent) {
|
||||
const interval = isVisible ? (mobile ? 0.13 : 0.08) : (isNear ? (mobile ? 0.24 : 0.18) : (mobile ? 0.46 : 0.36));
|
||||
const baseInterval = isVisible ? 0.08 : (isNear ? 0.18 : 0.36);
|
||||
const interval = baseInterval * Math.max(1, Number(global.TarinaiPerf?.performanceProfile?.().creatureCadenceScale || 1));
|
||||
return { interval, lane: "panic", smoothMotion: Boolean(isVisible && !worldRef.isTarinaiHiddenInNestBox?.(tarinai)), visible: isVisible, urgent: true };
|
||||
}
|
||||
|
||||
|
|
@ -116,21 +119,17 @@
|
|||
interval = isVisible ? 0.42 : (isNear ? 0.70 : 1.10);
|
||||
} else if (/idle|none/.test(id) || state === "idle") {
|
||||
lane = "idle";
|
||||
if (isVisible) interval = count > 28 ? 0.16 : 0.12;
|
||||
if (isVisible) interval = 0.12;
|
||||
else interval = isNear ? 0.55 : 1.10;
|
||||
} else if (isVisible) {
|
||||
lane = "visible";
|
||||
interval = count > 36 ? 0.11 : (count > 24 ? 0.08 : 0.05);
|
||||
interval = 0.05;
|
||||
} else {
|
||||
lane = isNear ? "near" : "far";
|
||||
interval = isNear ? 0.30 : 0.90;
|
||||
}
|
||||
|
||||
if (Number.isFinite(interval) && !/birth|eat|sleep/.test(lane)) {
|
||||
if (count > 54) interval *= 1.26;
|
||||
else if (count > 38) interval *= 1.14;
|
||||
}
|
||||
if (mobile && Number.isFinite(interval)) interval *= count > 24 ? 1.35 : 1.18;
|
||||
if (Number.isFinite(interval)) interval *= Math.max(1, Number(perfProfile?.creatureCadenceScale || 1));
|
||||
const passivePhysicsNeed = hasPassivePhysicsNeed(tarinai, worldRef, isVisible);
|
||||
const sleepPhysical = lane === "sleep" && passivePhysicsNeed;
|
||||
const eatPhysical = lane === "eat" && passivePhysicsNeed;
|
||||
|
|
@ -141,7 +140,7 @@
|
|||
&& interval <= 0.75
|
||||
&& !worldRef.isTarinaiHiddenInNestBox?.(tarinai)
|
||||
&& ((smoothAllowed && motionNeed) || sleepPhysical || eatPhysical));
|
||||
return { interval, lane, smoothMotion, visible: isVisible, urgent: false, sleepPhysical, eatPhysical, passivePhysicsNeed };
|
||||
return { interval, lane, smoothMotion, visible: isVisible, near: isNear, urgent: false, sleepPhysical, eatPhysical, passivePhysicsNeed };
|
||||
}
|
||||
|
||||
global.TarinaiCreatureUpdatePolicy = Object.freeze({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue