Move effects into the modding api
This commit is contained in:
@@ -37,7 +37,7 @@ export interface DamageSource {
|
||||
// who did it, which knockback pushes away from
|
||||
attacker?: Attacker;
|
||||
by_player?: boolean;
|
||||
// fire resistance stops it
|
||||
// it's fire, like burning
|
||||
fire?: boolean;
|
||||
// even invulnerable entities are hurt, like falling out of the world
|
||||
bypasses_invulnerability?: boolean;
|
||||
@@ -52,6 +52,12 @@ export const DAMAGE = {
|
||||
magic: { cause: "magic", type: "arcane" },
|
||||
} satisfies Record<string, DamageSource>;
|
||||
|
||||
// a cause from a script, like "magic": the engine's source for it, or physical damage under that name
|
||||
export function damage_source(cause: string): DamageSource {
|
||||
const known: Record<string, DamageSource> = DAMAGE;
|
||||
return known[cause] ?? { cause, type: "physical" };
|
||||
}
|
||||
|
||||
// what entities can see and do in the world, the entity manager is one
|
||||
export interface EntityLevel {
|
||||
readonly current_tick: number;
|
||||
|
||||
Reference in New Issue
Block a user