lag r
This commit is contained in:
parent
d875df8600
commit
2741b93dea
31 changed files with 751 additions and 546 deletions
|
|
@ -94,7 +94,8 @@ class AntActor {
|
|||
}
|
||||
|
||||
homeNest() {
|
||||
return (this.world?.items || []).find(it => it && !it.dead && it.id === this.homeId && it.type === "ant_nest") || null;
|
||||
const nest = this.world?.itemById?.(this.homeId) || null;
|
||||
return nest && nest.type === "ant_nest" ? nest : null;
|
||||
}
|
||||
|
||||
adoptableNest() {
|
||||
|
|
@ -165,7 +166,8 @@ class AntActor {
|
|||
// filter or rank candidates here while preserving sleep-disease hauling.
|
||||
let best = null;
|
||||
let bestScore = Infinity;
|
||||
for (const t of this.world?.tarinai || []) {
|
||||
const candidates = this.world?.nearbyTarinai?.(this.x, this.y, maxDist, true) || this.world?.tarinai || [];
|
||||
for (const t of candidates) {
|
||||
if (!t || t.dead || t.insideNestBoxId || t.isZunchiSlave) continue;
|
||||
const d = distXY(this.x, this.y, t.x, t.y);
|
||||
if (d > maxDist) continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue