Lifecycle hooks: @OnStart/@OnQuit, @OnDespawn, @OnAttach (like @OnSpawn)
Adds the rest of the game/entity/property lifecycle as @-hooks, each firing at one timeline moment and reducing to ordinary code: - @OnStart / @OnQuit (program): @OnStart aliases the Start phase; @OnQuit runs in the frame loop's done: block, after the loop stops and before teardown. - @OnDespawn(Model) (entity): a destructor. Despawn doesn't statically know the entity's model, so hooks compile to @on_despawn_<Model>(entity) functions and emit_despawn dispatches on @L_kind. Symmetric with @OnSpawn. - @OnAttach(Property): fires in emit_init_component once a property is attached and seeded, with the property bound by name. Registries + parsing mirror @OnSpawn. examples/lifecycle.ludic narrates the whole timeline (output 1 700 50 950 2). Behaviour-preserving (goldens byte-identical, despawn users unaffected when no hooks registered); test.sh 16/16, fixpoint holds. Deferred: @OnDetach (per-property runtime dispatch) and scene @OnEnter/@OnExit (need scene support in the compiler). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
28abd3a2c3
commit
6e11212cf2
8 changed files with 3993 additions and 3258 deletions
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue