This commit is contained in:
33333-33333 2026-07-10 16:40:06 +09:00
commit 2636d580a8
75 changed files with 3890 additions and 1084 deletions

View file

@ -7,13 +7,10 @@
Object.defineProperties(World.prototype, Object.getOwnPropertyDescriptors({
beginFramePerformanceBudgets() {
const count = Math.max(1, (this.tarinai || []).length || 1);
const mobile = Boolean(global.TarinaiInputMode?.snapshot?.().touchFirst || (global.innerWidth || 9999) <= 760);
const aiCap = mobile ? 8 : 12;
const envCap = mobile ? 4 : 6;
const profile = global.TarinaiPerf?.performanceProfile?.() || {};
this.workBudget = {
ai: Math.max(1, Math.min(aiCap, Math.ceil(count / 2))),
env: Math.max(1, Math.min(envCap, Math.ceil(count / 3))),
ai: Math.max(1, Number(profile.aiBudget || 10)),
env: Math.max(1, Number(profile.envBudget || 5)),
aiUsed: 0,
envUsed: 0,
};
@ -122,6 +119,7 @@
scheduler: this._itemUpdateSchedulerStats || null,
creatures: this._creatureUpdateStats || null,
effects: this._effectUpdateStats || null,
effectRender: this._effectRenderStats || null,
terrain: this.terrainDirtyStatsThisFrame || null,
nearby: this.nearbyQueryStatsThisFrame || null,
constraintDirty: this.constraintDirtyStatsThisFrame || null,
@ -366,14 +364,17 @@
if (!this.itemTypeBuckets) this.itemTypeBuckets = new Map();
if (!this.itemIdMap) this.itemIdMap = new Map();
if (!this.itemOwnerBuckets) this.itemOwnerBuckets = new Map();
if (!this.carriedPlushies) this.carriedPlushies = [];
for (const key of Object.keys(counts)) counts[key] = 0;
this.itemTypeBuckets.clear();
this.itemIdMap.clear();
this.itemOwnerBuckets.clear();
this.carriedPlushies.length = 0;
for (const it of this.items) {
if (!it || it.dead) continue;
counts[it.type] = (counts[it.type] || 0) + 1;
if (it.id != null) this.itemIdMap.set(it.id, it);
if (it.isStructure && it.type === "plushie" && it.carriedById) this.carriedPlushies.push(it);
if (it.ownerId) {
let ownerBucket = this.itemOwnerBuckets.get(it.ownerId);
if (!ownerBucket) {
@ -417,21 +418,6 @@
return changed;
},
compactEffects() {
const limit = CONFIG.effectLimit ?? 96;
if (Number.isFinite(limit) && this.effects.length > limit) {
this.effects.sort((a, b) => (a.life / Math.max(a.maxLife || 1, 0.001)) - (b.life / Math.max(b.maxLife || 1, 0.001)));
const remove = this.effects.length - limit;
for (let i = 0; i < remove; i++) this.effects[i].life = 0;
}
let write = 0;
for (let read = 0; read < this.effects.length; read++) {
const ef = this.effects[read];
if (!ef.dead) this.effects[write++] = ef;
}
this.effects.length = write;
},
compactTarinai() {
let write = 0;
for (let read = 0; read < this.tarinai.length; read++) {