Files
security-game/src/core/door_state.gd
T
zwitschi 1e972a7490
CI / headless-tests (push) Successful in 55s
Implement TODO backlog: LATE phase fix, protester, CALL_SOMEONE, door lock, flashlight, persistence, navmesh, JSON localization, and release tooling
- 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
2026-10-31 12:51:13 +01:00

24 lines
697 B
GDScript

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"}