wip(0.S3): packages and examples migrated in one run - ludic migrate state packages <every example program> packages/ludic.lab/example/plate.ludic

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-25 15:02:45 +03:00
parent d490d4f9f1
commit 3eda72e8c2
172 changed files with 3094 additions and 2966 deletions

View file

@ -33,8 +33,10 @@ program NpcAiDemo {
@OnSpawn(Ally) handler AInit { }
@OnSpawn(Dummy) handler DInit { }
var spotted: int = 0
@On(TargetSpotted) handler OnSpot { spotted += 1 }
state NpcaidemoState {
spotted: int = 0
}
@On(TargetSpotted) handler OnSpot(npcaidemo_st: mut NpcaidemoState) { npcaidemo_st.spotted += 1 }
function tick_n(n: int) -> void { var i = 0; while i < n { tick_fixed(); i += 1 } }
function bi(b: bool) -> int { if b { return 1 }; return 0 }
@ -55,7 +57,7 @@ program NpcAiDemo {
return -1
}
entry {
entry (npcaidemo_st: NpcaidemoState) {
let PBr = World.prop_id("Brain")
Weapon.def("blaster", 4, 10, 10, 0, 1, 0)
@ -72,7 +74,7 @@ program NpcAiDemo {
# ---- A. perception: the enemy spots the hostile dummy -------------------
tick_n(4)
print(bi(spotted >= 1)) # 1 — TargetSpotted fired
print(bi(npcaidemo_st.spotted >= 1)) # 1 — TargetSpotted fired
print(bi(Ai.target(enemy) == dummy)) # 1 — remembers the right target
# ---- B. FSM attack: in range -> auto-aim + fire -> dummy takes damage ---