Make players mobs too !
This commit is contained in:
@@ -9,6 +9,7 @@ import type { BlockRegistry } from "$/common/everything_registry.ts";
|
||||
import type { ItemStack } from "$/common/inventory.ts";
|
||||
import { type Collisions, move_body } from "$/common/physics.ts";
|
||||
import type { EntityData, EntityInfo } from "$/common/protocol.ts";
|
||||
import type { ServerPlayer } from "../player.ts";
|
||||
|
||||
// below this, entities have fallen out of the world
|
||||
export const VOID_Y = -64;
|
||||
@@ -27,11 +28,6 @@ export interface Attacker {
|
||||
readonly z: number;
|
||||
}
|
||||
|
||||
// a player as entities see them, ServerPlayer is one
|
||||
export interface PlayerTarget extends Attacker {
|
||||
readonly name: string;
|
||||
}
|
||||
|
||||
export type DamageType = "physical" | "arcane" | "absolute";
|
||||
|
||||
// what hurt something. cause is for mods and death messages, like "fall", "drown" or "mob_attack"
|
||||
@@ -68,8 +64,9 @@ export interface EntityLevel {
|
||||
get_entity(id: string): Entity | undefined;
|
||||
// entities whose feet are within the box around x, y, z
|
||||
entities_near(x: number, y: number, z: number, radius: number): Entity[];
|
||||
nearest_player(x: number, y: number, z: number, max_distance: number): PlayerTarget | undefined;
|
||||
damage_player(id: string, amount: number, source: DamageSource): void;
|
||||
nearest_player(x: number, y: number, z: number, max_distance: number): ServerPlayer | undefined;
|
||||
// what ServerPlayer.hurt does: mods get a say, then they're hurt. returns whether they were
|
||||
hurt_player(player: ServerPlayer, amount: number, source: DamageSource): boolean;
|
||||
spawn_item(x: number, y: number, z: number, stack: ItemStack, pickup_delay?: number): Entity;
|
||||
// an item on the ground was picked up whole by who, clients see it fly to them. it's gone after
|
||||
take_item(item: Entity, by: string): void;
|
||||
|
||||
Reference in New Issue
Block a user