hmm?
This commit is contained in:
parent
9ef1b8dbb1
commit
d875df8600
22 changed files with 625 additions and 496 deletions
|
|
@ -400,23 +400,20 @@
|
|||
const result = repairPoint(ef, ef.size || 12);
|
||||
if (result === "delete") ef.life = 0;
|
||||
}
|
||||
const safeW = Math.max(pad * 2 + 1, Number(this.w || 1000) || 1000);
|
||||
const safeH = Math.max(pad * 2 + 1, Number(this.h || 720) || 720);
|
||||
const repairTarinai = (t) => {
|
||||
t.x = clamp(Number.isFinite(t.x) ? t.x : safeW * 0.5, pad, safeW - pad);
|
||||
t.y = clamp(Number.isFinite(t.y) ? t.y : safeH * 0.5, pad, safeH - pad);
|
||||
t.vx = 0;
|
||||
t.vy = 0;
|
||||
t.entryTimer = 0;
|
||||
t.lastOutOfBoundsRepairAt = this.time || 0;
|
||||
};
|
||||
for (const t of this.tarinai || []) {
|
||||
if (!t || t.dead) continue;
|
||||
const result = repairPoint(t, t.radius || 22);
|
||||
if (result === "delete") {
|
||||
t.x = clamp(Number.isFinite(t.x) ? t.x : this.w * 0.5, pad, this.w - pad);
|
||||
t.y = clamp(Number.isFinite(t.y) ? t.y : this.h * 0.5, pad, this.h - pad);
|
||||
t.vx = 0;
|
||||
t.vy = 0;
|
||||
t.entryTimer = 0;
|
||||
t.die(HEALTH?.CAUSES?.outOfBounds || "\u4ed5\u69d8\u306b\u3088\u308a\u753b\u9762\u5916\u3067\u524a\u9664");
|
||||
} else if (result === "moved") {
|
||||
t.x = clamp(Number.isFinite(t.x) ? t.x : this.w * 0.5, pad, this.w - pad);
|
||||
t.y = clamp(Number.isFinite(t.y) ? t.y : this.h * 0.5, pad, this.h - pad);
|
||||
t.vx = 0;
|
||||
t.vy = 0;
|
||||
t.entryTimer = 0;
|
||||
}
|
||||
if (result === "delete" || result === "moved") repairTarinai(t);
|
||||
}
|
||||
let changedAnts = false;
|
||||
for (const ant of this.ants || []) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue