Add natural mob spawning for rotwalker

This commit is contained in:
2026-09-30 22:15:42 -03:00
parent 0052faa24d
commit a6fd508529
22 changed files with 714 additions and 7 deletions
+7
View File
@@ -35,6 +35,9 @@ export interface SavedMob extends SavedLivingEntity {
drop_chances?: Partial<Record<EquipmentSlot, number>>;
}
// what natural spawning counts a mob as, like minecraft's MobCategory
export type MobCategory = "monster" | "creature";
export abstract class Mob extends LivingEntity {
// doesn't think or move at all, not even falling
no_ai = false;
@@ -75,6 +78,10 @@ export abstract class Mob extends LivingEntity {
];
}
get category(): MobCategory {
return "creature";
}
#registered_goals = false;
// adds the kind's goals, see goals.ts. runs before its first thought, once the kind's fields are set
+5 -1
View File
@@ -15,7 +15,7 @@ import {
RandomLookAroundGoal,
RandomStrollGoal,
} from "./goals.ts";
import { Mob } from "./mob.ts";
import { Mob, type MobCategory } from "./mob.ts";
// the entity's class. the attributes are read while LivingEntity is being built, before any field of a subclass is
// set, so each kind gets its own class that has its json already
@@ -32,6 +32,10 @@ export function mod_entity_factory(json: EntityJson): EntityFactory {
override height = json.height;
override eye_height = json.height * 0.85;
override get category(): MobCategory {
return monster ? "monster" : "creature";
}
override default_attributes(): [AttributeType, number?][] {
return [
...super.default_attributes(),