y
This commit is contained in:
parent
61718e2981
commit
f657b6a4a4
94 changed files with 3970 additions and 1241 deletions
|
|
@ -73,14 +73,14 @@
|
|||
this.adjustPersonality("sociability", -dt * 0.0018, "after having no friends.");
|
||||
}
|
||||
let grassComfort = 0;
|
||||
for (const it of this.world.nearbyItems(this.x, this.y, 105)) {
|
||||
for (const it of (this.world.nearbyGrass?.(this.x, this.y, 105) || this.world.nearbyItems(this.x, this.y, 105))) {
|
||||
if (it.type !== "grass" || it.dead) continue;
|
||||
const d = distXY(this.x, this.y, it.x, it.y);
|
||||
const lush = clamp((it.growth ?? it.amount / 120) * (it.health ?? 1), 0, 1.2);
|
||||
grassComfort += clamp(1 - d / 105, 0, 1) * lush;
|
||||
}
|
||||
let nestComfort = 0;
|
||||
for (const it of this.world.nearbyItems(this.x, this.y, 120)) {
|
||||
for (const it of (this.world.nearbyNonGrassItems?.(this.x, this.y, 120) || this.world.nearbyItems(this.x, this.y, 120))) {
|
||||
if (!it || it.dead || it.type !== "nest_box") continue;
|
||||
nestComfort += clamp(1 - distXY(this.x, this.y, it.x, it.y) / 120, 0, 1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue