Move effects into the modding api

This commit is contained in:
2026-10-02 11:53:44 -03:00
parent 4309c700d2
commit e5dcb97643
33 changed files with 458 additions and 109 deletions
+7 -1
View File
@@ -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;