Added chatterbox connections

This commit is contained in:
Jeff Luke committed 2026-10-18 10:54:38 -07:00
1 parent 41ef12f954
commit e58ceeb192
58 files changed
+8931 -8

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
extends SceneTree
var failures := 0
func check(ok: bool, message: String) -> void:
if not ok:
failures += 1
push_error(message)
func _initialize() -> void: call_deferred("run")
func run() -> void:
var adapter = load("res://tests/odin_lab/cabinet.gd").new()
root.add_child(adapter)
adapter.set_process(false)
adapter.game.set_physics_process(false)
var now := int(Time.get_unix_time_from_system() * 1000)
var cmd := {"id": "power", "session": adapter.session, "expires_ms": now + 10000, "action": "power_on"}
check(adapter.execute(cmd).accepted, "Power on executes")
check(adapter.execute(cmd).duplicate, "Duplicate is acknowledged")
adapter.game._physics_process(4.0)
cmd = {"id": "scan", "session": adapter.session, "expires_ms": now + 10000, "action": "scan"}
check(adapter.execute(cmd).accepted and adapter.game.credits == 1, "Fixture goes through real RFID admission")
check(adapter.execute(cmd).duplicate and adapter.scans == 1, "Duplicate scan does not grant another credit")
cmd = {"id": "start", "session": adapter.session, "expires_ms": now + 10000, "action": "start"}
check(adapter.execute(cmd).accepted and adapter.phase == "playing", "Real game starts")
adapter.game.model._add_score(500)
check(adapter.phase == "won" and adapter.snapshot().score == 500, "Normal score objective propagates win")
adapter.reset()
adapter.inject_rfid = false
cmd = {"id": "no-fake", "session": adapter.session, "expires_ms": now + 10000, "action": "scan"}
check(not adapter.execute(cmd).accepted, "Physical mode rejects injected scans")
adapter.free()
await process_frame
print("GODOT LAB ADAPTER: ", "PASS" if failures == 0 else "FAIL")
quit(1 if failures else 0)