Files
security-game/src/test/smoke_plan_verbs.gd
T
zwitschi f5ad1642b5
Full build / Import + headless tests (push) Successful in 26s
Full build / Full desktop build + optional release (push) Failing after 3m31s
Add PLAN verbs and fix dead incident recording
Verbs (PLAN levels 1-3)
- Eye contact: own Level 1 radial slice, logged as "eye contact".
- Recognition is a player decision: "Recognize" sets NPCController.player_recognized,
  writes access evidence, and GameManager only then appends a RECOGNITION artifact.
  It is no longer implied by NPC type.
- Body camera: real flag (off by default) driving the REC overlay; B toggles it and
  a formal warning arms it automatically, writing a body_camera incident event.
- Blocking stations the guard 0.9 m from the person toward the entrance and turns
  to face them, instead of only emitting the escalation level.
- Request reason: Level 3 ask answered from the NPC's seeded dialogue_lines.
- Radial grows to 12 slices (174 px outer radius, centered labels).

Incident recording fix
- IncidentRecorder.start_incident() was never called, so add_event /
  add_access_evidence / add_escalation silently no-opped and the shift review
  always reported zero incidents. Incidents now open on focus (guarded by
  has_open_incident), verbs call _ensure_incident, and ShiftCoordinator closes
  leftovers as "unresolved" before building the review.

Copy and docs
- 9 new string keys (eye contact, body camera, recognition, reason, station).
- README controls, 26-step smoke checklist, test count, status lists.
- TODO section moved to DONE; MEMORY records the verb design and the recorder bug.

Verification: headless 98/98, smoke_plan_verbs.gd + smoke_session_shell.gd +
windowed smoke_focus_radial.gd all pass. Version bumped to 0.2.3.
2026-10-31 20:29:50 +01:00

85 lines
2.8 KiB
GDScript

extends SceneTree
## PLAN-verb smoke: starts a shift, focuses one person, then exercises the verbs
## added after the radial pass — recognize, request reason, body camera, formal
## warning (which must arm the body camera), and blocking (which must move the
## guard between the person and the door). Also checks that an incident is
## actually recorded, then closing it at shift end.
##
## Usage:
## godot --headless --path . --script res://src/test/smoke_plan_verbs.gd
## Exit code 0 = pass, 1 = failure.
const MAX_FRAMES := 1200
var frame := 0
var gm: Node = null
var started := false
var step := 0
var failures: Array[String] = []
func _initialize() -> void:
root.size = Vector2i(1280, 720)
root.add_child(load("res://scenes/main.tscn").instantiate())
func _process(_delta: float) -> bool:
frame += 1
if gm == null:
gm = root.find_child("GameManager", true, false)
return false
if not started:
gm.call("_on_venue_selected", "hollywood_building")
started = true
return false
if frame > MAX_FRAMES:
_fail("timeout before the verbs ran")
return true
if frame < 200:
return false
if step == 0:
if gm.npcs.is_empty():
_fail("no NPCs spawned to test the verbs on")
return true
var npc: Node = gm.npcs[0]
gm.call("_on_guard_target", npc)
var controller: Object = npc.get_npc_controller()
gm.call("_recognize_target")
_check(controller.player_recognized, "recognize marks the person as recognized")
gm.call("_request_reason")
_check(typeof(controller.last_reason_reply) == TYPE_STRING, "reason request returns a reply")
gm.call("_set_body_camera", false, "smoke")
_check(not gm.body_camera_on, "body camera can be switched off")
gm.call("_apply_interaction", 2, "formal warning")
_check(gm.body_camera_on, "formal warning arms the body camera")
var before: Vector3 = gm.guard.global_position
gm.call("_apply_interaction", 3, "blocking")
_check(before.distance_to(gm.guard.global_position) > 0.05, "blocking moves the guard")
_check(gm.coordinator.recorder.open_incidents_count() > 0 or gm.coordinator.recorder.incidents.size() > 0,
"an incident was recorded")
gm.coordinator.call("_finish_shift")
_check(gm.coordinator.recorder.open_incidents_count() == 0, "open incidents close at shift end")
_check(gm.coordinator.recorder.incidents.size() > 0, "shift history keeps the incident")
step = 1
if step == 1:
_finish()
return true
return false
func _check(condition: bool, message: String) -> void:
if condition:
print("ok: " + message)
else:
_fail(message)
func _fail(message: String) -> void:
failures.append(message)
_finish()
func _finish() -> void:
if failures.is_empty():
print("SMOKE OK: PLAN verbs (recognize, reason, body camera, warning, blocking)")
quit(0)
else:
for message in failures:
printerr("SMOKE FAIL: " + message)
quit(1)