#79 — Input.axis_i(neg,pos) -> int returns a -1/0/1 movement intent from the multi-key device set, so WASD-to-movement needs no bool->int glue and feeds an int mover directly (dx = Input.axis_i('a','d')). #84 — a Bounds config entity (rect + policy, from ludic.core) drives the engine-owned world-bounds system (LateUpdate): clamp / wrap / bounce (clamp + flip Body velocity) / kill (despawn a body fully outside). Reads the Collider size so the box stays inside; off by default, spliced only when Bounds is declared (byte-identical otherwise). Adds World.despawn(e) — the by-id reflective despawn (runs @OnDespawn + frees) via a new world_despawn intrinsic whose @fn_world_despawn helper is emitted in emit_program's tail once a use is seen (the g_uses_* prelude pattern), used by the kill policy and callable from any system. Examples input_movement + world_bounds. Full suite 112/0, goldens byte-identical, fixpoint holds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
0497029dae
commit
ad3be0c53c
17 changed files with 30435 additions and 29731 deletions
28
docs/language/world/world-despawn.md
Normal file
28
docs/language/world/world-despawn.md
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
id: world-despawn
|
||||
name: World.despawn
|
||||
category: world
|
||||
kind: namespace-method
|
||||
tokens: World.despawn
|
||||
sig: World.despawn(entity)
|
||||
tip: Despawn an entity by id — runs its @OnDespawn hooks and frees the slot.
|
||||
order: 16
|
||||
ns: World
|
||||
member: despawn
|
||||
---
|
||||
|
||||
Despawns an entity by id: it runs the entity's model <code>@OnDespawn</code> hook (with reason <code>Despawned</code>), sweeps any entity-scoped event listeners, and frees the slot back to the pool for reuse — the reflective, by-id form of the <code>despawn</code> statement. Use it from a system that has an entity id in hand (the engine world-bounds kill policy uses it, #84) or wherever you would write <code>despawn e</code> but only have the id.
|
||||
|
||||
```ludic
|
||||
program Demo {
|
||||
property Mob { hp: int = 0 }
|
||||
model M { Mob }
|
||||
entry {
|
||||
spawn M { Mob { hp: 1 } }
|
||||
let pm = World.prop_id("Mob")
|
||||
let e = World.query_next(pm, 0)
|
||||
World.despawn(e)
|
||||
print(World.query_next(pm, 0)) # -1 — none left
|
||||
}
|
||||
}
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue