annotation
@Public
@Public @OnSpawn(Model) handler … { … }
@Public stacks in front of a lifecycle hook to also emit a well-named event at the same moment the hook fires, so other modules (or mods) can react without touching the original code. It turns a private hook into a public seam: @Public @OnSpawn(Model) emits model_<Model>_spawn, @OnDespawn emits model_<Model>_despawn, the property hooks emit prop_<Property>_attach/_detach/_enable/_disable, and @OnStart/@OnQuit emit program_start/program_quit. This is the same lowering the event system uses, so anyone can @On the generated event to extend behavior at that lifecycle point. Add it when a hook marks an extension point you want to keep open across a modular codebase.
Example
program PublicSpawn {
property Health { current: int = 0, maximum: int = 100 }
model Enemy { Health }
@Public @OnSpawn(Enemy) handler InitEnemy { # also emits model_Enemy_spawn
Health.current = Health.maximum
}
@On(model_Enemy_spawn) handler AnnounceEnemy { # another module hooks the public event
print(1) # 1 — reacts to every Enemy spawn
}
handler SpawnWave phase Start {
spawn Enemy { Health { current: 0, maximum: 100 } }
}
}