This commit is contained in:
33333-33333 2026-06-26 19:04:32 +09:00
commit 077d4ab9ac
71 changed files with 2905 additions and 1063 deletions

View file

@ -7,14 +7,18 @@
interactWithOthers(dt) {
let closeCount = 0;
const scanLimit = 8;
const selfRadius = Math.max(12, Number(this.radius || 22) || 22);
const scanRadius = Math.max(96, selfRadius * 2.4 + 88);
let scanned = 0;
for (const o of this.world.nearbyTarinai(this.x, this.y, 78)) {
for (const o of this.world.nearbyTarinai(this.x, this.y, scanRadius, true)) {
if (o === this || o.dead) continue;
if (scanned >= scanLimit && this.fightTimer <= 0.04 && this.birthRitualTimer <= 0.04) break;
scanned += 1;
const dx = o.x - this.x, dy = o.y - this.y;
const d = Math.hypot(dx, dy);
if (d < 0.01 || d > 74) continue;
const otherRadius = Math.max(12, Number(o.radius || 22) || 22);
const bodyContactRange = Math.max(74, selfRadius + otherRadius + 18);
if (d < 0.01 || d > bodyContactRange) continue;
closeCount += 1;
const fightMochiContact = this.world.canFightPair?.(this, o) && (this.hasFightMochiEffect() || o.hasFightMochiEffect());
@ -69,7 +73,7 @@
this.vy += (dy / d) * dt * 4.8;
}
if (d < 60) {
if (d < Math.max(60, selfRadius + otherRadius + 8)) {
const rel = this.relationTo(o.id);
const pdef = this.personalityProfile();
this.loneliness -= dt * 1.65 * this.trait.social;
@ -192,19 +196,13 @@
if (this.state === "sunbath") {
this.target = null;
this.vx = 0;
this.vy = 0;
const pad = Math.max(28, CONFIG.worldPadding || 30);
const safeW = Math.max(pad * 2 + 1, Number(this.world?.w || 1000) || 1000);
const safeH = Math.max(pad * 2 + 1, Number(this.world?.h || 720) || 720);
const fallbackX = Number.isFinite(this._lastSunbathDrawX) ? this._lastSunbathDrawX : (Number.isFinite(this._lastValidX) ? this._lastValidX : (Number.isFinite(this.x) ? this.x : pad));
const fallbackY = Number.isFinite(this._lastSunbathDrawY) ? this._lastSunbathDrawY : (Number.isFinite(this._lastValidY) ? this._lastValidY : (Number.isFinite(this.y) ? this.y : pad));
if (!Number.isFinite(this.sunbathAnchorX)) this.sunbathAnchorX = fallbackX;
if (!Number.isFinite(this.sunbathAnchorY)) this.sunbathAnchorY = fallbackY;
this.sunbathAnchorX = clamp(this.sunbathAnchorX, pad, safeW - pad);
this.sunbathAnchorY = clamp(this.sunbathAnchorY, pad, safeH - pad);
this.x = this.sunbathAnchorX;
this.y = this.sunbathAnchorY;
this.x = clamp(Number.isFinite(this.x) ? this.x : (Number.isFinite(this.sunbathAnchorX) ? this.sunbathAnchorX : pad), pad, safeW - pad);
this.y = clamp(Number.isFinite(this.y) ? this.y : (Number.isFinite(this.sunbathAnchorY) ? this.sunbathAnchorY : pad), pad, safeH - pad);
this.sunbathAnchorX = this.x;
this.sunbathAnchorY = this.y;
this._lastSunbathDrawX = this.x;
this._lastSunbathDrawY = this.y;
this._lastValidX = this.x;
@ -430,6 +428,17 @@
this.dead = true;
this.deathReason = finalReason;
this.world.deadCount += 1;
for (const item of this.world.items || []) {
if (!item || item.dead || !item.isStructure || item.type !== "plushie" || item.ownerId !== this.id) continue;
item.dead = true;
item.hp = 0;
item.amount = 0;
item.carriedById = "";
item.onHead = false;
}
this.world.drawListDirty = true;
this.world.markItemBucketsDirty?.("tarinai-death-plushie-cleanup");
this.world.markSpatialDirty?.("tarinai-death-plushie-cleanup");
this.world.addItem?.(new Item("trace", this.x, this.y), "tarinai-death-trace") || this.world.items.push(new Item("trace", this.x, this.y));
this.world.addItem?.(new Item("splat", this.x, this.y), "tarinai-death-splat") || this.world.items.push(new Item("splat", this.x, this.y));
if (Math.random() < 0.55) {