Jester time

This commit is contained in:
2026-11-21 23:07:42 -03:00
parent 0c711b8163
commit f308ab52f1
14 changed files with 3317 additions and 395 deletions
+4
View File
@@ -82,6 +82,10 @@ interface LivingRef {
effect(id: Id): { readonly amplifier: number; readonly duration: number } | undefined;
damage(amount: number, cause?: string): void; // cause is for events and the death message
heal(amount: number): void;
// its attributes and their modifiers, like a player's (see players.md). a mob's modifiers are saved with it
attribute(id: Id): number;
add_modifier(attribute: Id, modifier: AttributeModifier): void;
remove_modifier(attribute: Id, id: string): boolean;
}
```
+10 -1
View File
@@ -169,10 +169,19 @@ interface MobRef extends LivingRef {
look_at(x: number, y: number, z: number): void; // for a couple of ticks, so call it every tick
jump(): void; // this tick, or swims up in water
attack(target: Player | MobRef): void; // swings and hits with its attack_damage
// what clients see of its state, for its animator, see Animators
get_client_data<T>(field: string): T | undefined;
set_client_data(field: string, value: unknown): void;
}
```
Each mob has one `MobRef`, so `mob.target === player` works.
Each mob has one `MobRef`, so `mob.target === player` works. Like any living entity, it has attributes that modifiers
change, so a mob that speeds up the longer it chases can do it with a modifier on its speed:
```ts
mob.add_modifier("cubi:movement_speed", { id: "my_mod:rush", amount: 0.4, operation: "add_multiplied_total" });
mob.remove_modifier("cubi:movement_speed", "my_mod:rush");
```
## Getting Around