too
This commit is contained in:
parent
4fdc567e08
commit
e00bfd8879
51 changed files with 1203 additions and 833 deletions
|
|
@ -370,7 +370,13 @@
|
|||
}
|
||||
|
||||
if (this.target && !this.target.dead) {
|
||||
const moveTarget = this.state === "seek_bed" && this.isSleepFurniture(this.target) ? this.sleepSpotFor(this.target) : this.target;
|
||||
const baseMoveTarget = this.state === "seek_bed" && this.isSleepFurniture(this.target) ? this.sleepSpotFor(this.target) : this.target;
|
||||
const routeStates = new Set(["seek_food", "seek_water", "seek_bed", "seek_material", "build", "follow_parent", "seek_friend", "seek_enemy", "fight", "play_ball", "ant_attack"]);
|
||||
const routeTargetItem = this.target?.hostItem || this.target;
|
||||
const waypoint = routeStates.has(this.state) && this.world?.findTarinaiPathWaypoint
|
||||
? this.world.findTarinaiPathWaypoint(this, baseMoveTarget, { targetItem: routeTargetItem, padding: Math.max(18, (this.radius || 20) * 0.82), state: this.state })
|
||||
: null;
|
||||
const moveTarget = waypoint || baseMoveTarget;
|
||||
const dx = moveTarget.x - this.x;
|
||||
const dy = moveTarget.y - this.y;
|
||||
const d = Math.hypot(dx, dy) || 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue