Implement TODO backlog: LATE phase fix, protester, CALL_SOMEONE, door lock, flashlight, persistence, navmesh, JSON localization, and release tooling
CI / headless-tests (push) Successful in 55s

- Fix LATE shift phase (start 700s) so the violent-threat event is reachable
- Add PROTESTER archetype (rules, profile, colors, events in public venues)
- Add CALL_SOMEONE reaction (FSM -> ARGUING, influencer/trespasser/protester weights)
- Door lock: DoorState core class, L binding, red/green visual indicator,
  locked doors thwart FORCE_ENTRY
- Flashlight: G binding, SpotLight3D, perception radius bonus at evening/late
- Persistence: save shift results via Save autoload, history + best score on
  review screen, round-trip test
- Navigation: flat NavigationRegion3D navmesh, NavigationAgent3D path following
  with direct-movement fallback; steps made visual-only so NPCs reach entrance
- Localization: strings moved to content/strings.en.json (loader keeps
  lookup/fmt signatures; coverage test over all keys)
- Distribution: export_presets.cfg (Linux/Windows/macOS), tools/build_releases.sh,
  docs/RELEASING.md, prominent README Downloads section
- Remove stale signal_bus.gd (invalid static-signal experiment)
- Tests: 53 passing across 9 suites
This commit is contained in:
zwitschi committed 2026-10-31 12:51:13 +01:00
1 parent c808165302
commit 1e972a7490
27 files changed
+1044 -340

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
class_name DoorState
extends RefCounted
## Door lock/secure mechanic (PLAN.md: Level 3 — lock or secure the door).
## Pure logic: GameManager and WorldBuilder only mirror state visually.
var locked := false
func _init(p_start_locked: bool = false) -> void:
locked = p_start_locked
func toggle() -> bool:
locked = not locked
return locked
func set_locked(value: bool) -> void:
locked = value
## A force-entry attempt. Returns { succeeded: bool, outcome: String }.
## Locked doors thwart attempts; unlocked doors admit the forced entry.
func attempt_force() -> Dictionary:
if locked:
return {"succeeded": false, "outcome": "thwarted"}
return {"succeeded": true, "outcome": "entered"}
+6 -2
View File
@@ -114,6 +114,9 @@ func _update_state_for_reaction(r: int) -> void:
fsm.transition_to("LOITERING_DISTANT")
will_return = true
return_delay_s = _roll_return_delay()
Rules.Reaction.CALL_SOMEONE:
# The NPC stops to call someone for help (PLAN.md: Level 2 reactions).
fsm.transition_to("ARGUING")
_:
pass
@@ -153,12 +156,13 @@ func decide_leave() -> bool:
## Perception pass: given the guard's distance (meters), return a perception
## result describing how the NPC reacts to the guard's presence. Pure and
## headless-testable; the presentation layer feeds it the real distance.
## bonus_range widens awareness when the guard uses a flashlight at night.
## Returns { noticed: bool, band: String, reaction: int }.
func perceive_guard(distance: float) -> Dictionary:
func perceive_guard(distance: float, bonus_range: float = 0.0) -> Dictionary:
var band := "unaware"
if distance <= NEAR_RADIUS:
band = "near"
elif distance <= AWARE_RADIUS:
elif distance <= AWARE_RADIUS + bonus_range:
band = "aware"
var noticed := band != "unaware"
if noticed and not guard_noticed:
+3
View File
@@ -37,6 +37,7 @@ enum NpcType {
AUTHORIZED_GUEST,
DELIVERY,
RESPONDER,
PROTESTER,
}
const NPC_TYPE_NAMES := {
@@ -52,6 +53,7 @@ const NPC_TYPE_NAMES := {
NpcType.AUTHORIZED_GUEST: "Authorized Guest",
NpcType.DELIVERY: "Delivery",
NpcType.RESPONDER: "Responder",
NpcType.PROTESTER: "Protester",
}
## Access artifact kinds used by AccessVerifier.
@@ -103,6 +105,7 @@ enum Reaction {
THREATEN = 5,
RETURN_LATER = 6,
FORCE_ENTRY = 7,
CALL_SOMEONE = 8,
}
## Player dialogue tones.
-21
View File
@@ -1,21 +0,0 @@
class_name SignalBus
extends RefCounted
## Static signal bus (ADR-0005 spirit: decoupled, deterministic).
## Unlike an autoload, `SignalBus` resolves at parse time through preloads,
## so it works identically under `--script`, in headless CI, and in the game.
static signal incident_recorded(incident: Dictionary)
static signal player_action(action: Dictionary)
static signal escalation_changed(payload: Dictionary)
static signal radio_call(call: Dictionary)
static signal responder_arrived(responder: Dictionary)
static signal npc_state_changed(payload: Dictionary)
static signal shift_state_changed(payload: Dictionary)
static signal reputation_changed(payload: Dictionary)
static signal crowd_changed(payload: Dictionary)
static signal access_decided(payload: Dictionary)
static signal shift_review_ready(review: Dictionary)
static signal anything_happened(value: String)
func _init() -> void:
push_error("SignalBus is a static utility class; use SignalBus.<signal> directly.")
+33 -52
View File
@@ -1,64 +1,45 @@
class_name Strings
## Centralized UI and dialogue text table (PLAN.md: Polish and Accessibility —
## localization). All user-facing strings live here so they can be swapped for
## a localized table later. Keys are stable identifiers; values are English.
## localization). English strings live in an editable JSON file so they can be
## swapped or translated without touching code. Keys are stable identifiers.
const TABLE := {
# HUD / controls
"hud.controls": "Q polite direction · 1-3 simple gestures · 4 warning · 5 block · 6 assist · R emergency · E inspect / close · W wand · A allow · D deny · T tone · F debug",
"hud.tone_prefix": "Tone: %s",
"hud.escalation_prefix": "Escalation: %s",
"hud.cooldown": "EMERGENCY RADIO COOLDOWN: %.0fs",
"hud.aim_first": "Aim at someone first.",
"hud.no_one_nearby": "No one nearby.",
"hud.targeting": "Targeting %s (Tab to cycle).",
"hud.no_wand": "No wand at this venue.",
"hud.screen_first": "Screen this guest with the wand (W) before admitting them.",
const DEFAULT_LOCALE := "en"
const TABLE_PATH := "res://content/strings.%s.json"
# Access decisions
"access.granted": "Entry granted: %s",
"access.denied": "Entry denied: %s",
"access.policy_satisfied": "policy satisfied",
"access.wrong_grant": "You granted entry despite verification failure!",
"access.wrong_deny": "You denied entry despite valid verification!",
## Populated lazily from the JSON table. Kept public so tests and tooling can
## enumerate keys (e.g. coverage checks).
static var TABLE: Dictionary = {}
static var _load_attempted := false
# Wand screening
"wand.admitted_prohibited": "You admitted %s with a prohibited item!",
"wand.denied_false_alarm": "You denied %s over a harmless item.",
"wand.cleared": "%s cleared the wand check.",
"wand.refused": "%s refused entry after the wand check.",
# Radio
"radio.address_first": "Address someone first before calling.",
"radio.blocked": "Radio blocked: %s",
"radio.inaccurate": "Dispatch flags inaccuracies in your report (-%d).",
"radio.received": "Dispatch received your report. Assistance en route.",
"radio.emergency_dispatched": "Emergency responder dispatched.",
# Responder
"responder.arrived": "Responder arrives and %ss the situation.",
# Reactions
"react.comply": "%s complies and steps back.",
"react.leave": "%s turns and leaves.",
"react.argue": "%s argues with you.",
"react.record": "%s starts filming you.",
"react.ignore": "%s ignores you.",
"react.threaten": "%s is threatening you. Emergency radio (R) is justified now.",
"react.force_entry": "%s is forcing the door!",
"react.return_later": "%s leaves but may come back.",
"react.none": "No reaction (yet).",
# Perception
"perception.near": "%s notices you standing close.",
"perception.aware": "%s notices you watching.",
}
static func _ensure_loaded() -> void:
if _load_attempted:
return
_load_attempted = true
var path := TABLE_PATH % DEFAULT_LOCALE
if not FileAccess.file_exists(path):
push_error("Strings table missing: %s" % path)
return
var text := FileAccess.get_file_as_string(path)
var parsed = JSON.parse_string(text)
if parsed is Dictionary:
TABLE = parsed
else:
push_error("Strings table malformed: %s" % path)
## Look up a string by key. Returns the key itself when missing (fail-safe).
## Absolute keys (locale.table.key) bypass the default table lookup.
static func lookup(key: String) -> String:
if key.begins_with("locale."):
return key
_ensure_loaded()
return TABLE.get(key, key)
## Format a string by key with positional arguments.
static func fmt(key: String, args: Array) -> String:
var template: String = TABLE.get(key, key)
return template % args
var template := lookup(key)
if template == key:
return template
return template % args
func _init() -> void:
push_error("Strings is a static utility class; use Strings.lookup / Strings.fmt.")