Move effects into the modding api
This commit is contained in:
@@ -64,7 +64,7 @@ import { LivingEntity } from "./entity/living_entity.ts";
|
||||
import { EntityManager } from "./entity/entity_manager.ts";
|
||||
import { NaturalSpawner } from "./natural_spawner.ts";
|
||||
import { create_entity, entity_type_ids } from "./entity/entity_types.ts";
|
||||
import { DAMAGE, type DamageSource, type SavedEntity } from "./entity/entity.ts";
|
||||
import { damage_source, type DamageSource, type SavedEntity } from "./entity/entity.ts";
|
||||
import { ATTRIBUTES } from "./entity/attributes.ts";
|
||||
|
||||
// how far from a player's eyes a block can be changed, a bit more than the client's reach
|
||||
@@ -1320,8 +1320,7 @@ export class GameServer {
|
||||
|
||||
// hurts a player, killing them at 0. cause is for mods and the death message, like "fall"
|
||||
damage_player(player: ServerPlayer, amount: number, cause: string) {
|
||||
const known: Record<string, DamageSource> = DAMAGE;
|
||||
player.hurt(amount, known[cause] ?? { cause, type: "physical" });
|
||||
player.hurt(amount, damage_source(cause));
|
||||
}
|
||||
|
||||
// everything that hurts a player ends up here, see ServerPlayer.hurt. mods can change or cancel it first
|
||||
|
||||
Reference in New Issue
Block a user