More pathing
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
import { ATTRIBUTES, type AttributeType } from "./attributes.ts";
|
||||
import { type DamageSource, Entity, finite } from "./entity.ts";
|
||||
import { GoalSelector } from "./goals.ts";
|
||||
import { PathNavigation } from "./navigation.ts";
|
||||
import { ItemEntity } from "./item_entity.ts";
|
||||
import { EQUIPMENT_SLOTS, type EquipmentSlot, LivingEntity, type SavedLivingEntity } from "./living_entity.ts";
|
||||
import type { EntityData } from "@/common/protocol.ts";
|
||||
@@ -72,6 +73,8 @@ export abstract class Mob extends LivingEntity {
|
||||
last_attacker: LivingEntity | undefined;
|
||||
times_hurt_by_attacker = 0;
|
||||
|
||||
// follows paths, giving the move control one waypoint at a time
|
||||
navigation = new PathNavigation(this);
|
||||
move_control = new MoveControl(this);
|
||||
look_control = new LookControl(this);
|
||||
jump_control = new JumpControl(this);
|
||||
@@ -128,7 +131,7 @@ export abstract class Mob extends LivingEntity {
|
||||
return super.move();
|
||||
}
|
||||
|
||||
// the goals, then the controls, like minecraft's Mob.serverAiStep
|
||||
// the goals, then the path they asked for, then the controls, like minecraft's Mob.serverAiStep
|
||||
override server_ai_step() {
|
||||
if (!this.#registered_goals) {
|
||||
this.#registered_goals = true;
|
||||
@@ -137,6 +140,7 @@ export abstract class Mob extends LivingEntity {
|
||||
this.no_action_time += 1;
|
||||
this.target_goals.tick();
|
||||
this.goals.tick();
|
||||
this.navigation.tick();
|
||||
this.move_control.tick();
|
||||
this.look_control.tick();
|
||||
this.jump_control.tick();
|
||||
|
||||
Reference in New Issue
Block a user