Files
room_glitch/tests/pcb/check_rfid_credit.gd
T
Jeff Luke c1b2195834 Expand Glitch operations hub, cabinet authoring, deployment, and RFID support
Operator hub
- Introduce Escape Gallery branding and Glitch: the Dark Machine room views
- Add cabinet illustrations, Pac-Man marquee/gameplay artwork, and waiting states
- Add device feedback panels with RFID readings, input/output states, and stale status
- Add logged operator hardware interventions with request deduplication

Room and cabinet authoring
- Add a visual custom-PCB connection editor with per-cabinet device inventory
- Support device IDs, bindings, wiring notes, input polarity, and validation
- Add physical-room label/dimension toggles and editable doorway annotations
- Preserve doorway changes through undo, save, and revert
- Expand cabinet profiles, room layout, and Glitch scenario resources

Scenarios and gameplay
- Add per-assignment game configuration and runtime feature validation
- Add timed test wins and Frogger individual-home objectives
- Add the three-cabinet timed/score/Frogger test scenario
- Add Cabinet 1 Pac-Man RFID credits, credit sound, and CREDIT 0/1 display
- Require physical Start after an accepted scan and prevent duplicate credits

Pi hardware and deployment
- Add GPIO feedback sampling and a separate multiplexed RFID helper
- Validate reader pin ownership and input/output conflicts
- Add SSH cabinet startup and Pi desktop-session service support
- Add master packaging, site setup, SSH enrollment, and staged cabinet releases
- Verify deployment manifests and support explicit activation/status/log commands

Documentation and verification
- Consolidate the root README around the current architecture and setup workflow
- Add the complete master/Pi/RFID export and deployment walkthrough
- Document network isolation, credentials, card identification, and rollback
- Add PCB, room-editor, feedback, credit, deployment, and controller tests
- Isolate protocol tests from designer-edited cabinet configurations

Known limitations
- RFID helper compilation and physical Pi commissioning remain unverified
- Fleet provisioning does not yet configure RFID-only installations completely
- Broader Pac-Man tests retain a ghost-capture assertion failure
- Staged exports must be rebuilt and checked before deploying runtime 2.3
2026-10-17 14:53:54 -07:00

43 lines
2.2 KiB
GDScript

extends SceneTree
var failures := 0
func check(ok: bool, message: String) -> void:
if not ok:
failures += 1
push_error(message)
func sample(id: String, uid := "1234ABCD", device := "cab1_rfid1", fresh := true, age := 0) -> Dictionary:
return {"fresh": fresh, "events": [{"id": id, "device": device, "kind": "rfid", "value": uid, "error": ""}], "devices": [{"id": device, "value": uid, "age_ms": age, "error": ""}]}
func _initialize() -> void:
call_deferred("run")
func run() -> void:
var game = load("res://games/pacman/pacman.gd").new()
root.add_child(game)
game.configure({"rfid_credit_device": "cab1_rfid1", "rfid_allowed_uids": ["1234ABCD"]})
check(not game.start_game(), "Start must require a credit")
game.receive_device_feedback({})
game.receive_device_feedback(sample("old"))
check(game.credits == 0, "First fresh snapshot must baseline historical scans")
game.receive_device_feedback(sample("wrong-reader", "1234ABCD", "other"))
game.receive_device_feedback(sample("wrong-card", "99999999"))
game.receive_device_feedback(sample("stale", "1234ABCD", "cab1_rfid1", true, 5000))
game.receive_device_feedback(sample("offline", "1234ABCD", "cab1_rfid1", false))
check(game.credits == 0, "Wrong reader/card, stale and offline samples must not credit")
game.receive_device_feedback(sample("scan"))
check(game.credits == 1 and game.view.credits == 1, "New accepted scan grants one visible credit")
game.receive_device_feedback(sample("scan"))
game.receive_device_feedback(sample("scan2"))
check(game.credits == 1, "Duplicate and additional scans must not stack credits")
check(game.start_game() and game.credits == 0, "Start consumes one credit")
game.receive_device_feedback(sample("during-play"))
check(game.credits == 0, "Playing scans must not bank credits")
game.reset_game()
game.receive_device_feedback(sample("scan"))
check(game.credits == 0, "Reset must not replay a prior event")
game.receive_device_feedback(sample("new-scan"))
check(game.credits == 1, "New scan works after reset")
game.configure({})
check(game.start_game(), "Ordinary non-RFID Pac-Man remains free start")
game.queue_free()
await process_frame
print("RFID credit tests: ", "PASS" if failures == 0 else "FAIL")
quit(1 if failures else 0)