Loot tables

This commit is contained in:
2026-10-08 00:54:45 -03:00
parent 757ee74bc7
commit ec2b53c02a
45 changed files with 1733 additions and 150 deletions
+6
View File
@@ -20,6 +20,8 @@ export interface EntityHost {
send(player: ServerPlayer, message: ServerMessage): void;
hurt_player(player: ServerPlayer, amount: number, source: DamageSource): boolean;
on_entity_death?(entity: Entity, source: DamageSource): void;
// what it drops when it dies, from its loot table
entity_loot?(entity: Entity, source: DamageSource): ItemStack[];
}
// what a client was last told about an entity, so only changes get sent
@@ -154,6 +156,10 @@ export class EntityManager implements EntityLevel {
this.#host.on_entity_death?.(entity, source);
}
entity_loot(entity: Entity, source: DamageSource): ItemStack[] {
return this.#host.entity_loot?.(entity, source) ?? [];
}
// ticking
// every entity active says should move, with their passengers. entities removed along the way are forgotten