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
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:
1 parent
c808165302
commit
1e972a7490
27 files changed
+1044
-340
No files matched your search
@@ -12,6 +12,10 @@ var target_position: Vector3 = Vector3.ZERO
|
||||
var door_position: Vector3 = Vector3(0, 0.5, 1.2)
|
||||
var awaiting_interaction := false
|
||||
var arrived := false
|
||||
var agent: NavigationAgent3D = null
|
||||
## Set once the nav agent proves it has a path; direct movement is the fallback.
|
||||
var _nav_usable := false
|
||||
var _nav_try_frames := 0
|
||||
|
||||
const TYPE_COLORS := {
|
||||
Rules.NpcType.TOURIST: Color(0.90, 0.75, 0.55),
|
||||
@@ -26,6 +30,7 @@ const TYPE_COLORS := {
|
||||
Rules.NpcType.AUTHORIZED_GUEST: Color(0.60, 0.85, 0.65),
|
||||
Rules.NpcType.DELIVERY: Color(0.80, 0.70, 0.40),
|
||||
Rules.NpcType.RESPONDER: Color(0.25, 0.30, 0.85),
|
||||
Rules.NpcType.PROTESTER: Color(0.90, 0.40, 0.20),
|
||||
}
|
||||
|
||||
func _init() -> void:
|
||||
@@ -42,6 +47,15 @@ func setup(profile: NpcProfile, intent: String, seed_value: int, p_spawn: Vector
|
||||
position = p_spawn
|
||||
npc.fsm.state_changed.connect(_on_state_changed)
|
||||
_build_body(profile.npc_type)
|
||||
_nav_usable = false
|
||||
_nav_try_frames = 0
|
||||
agent = NavigationAgent3D.new()
|
||||
agent.name = "NavAgent"
|
||||
agent.path_desired_distance = 0.4
|
||||
agent.target_desired_distance = 4.0
|
||||
agent.radius = 0.35
|
||||
agent.height = 1.2
|
||||
add_child(agent)
|
||||
|
||||
# Normalize intent targets: approach the entrance, stop near the door.
|
||||
var collider := CollisionShape3D.new()
|
||||
@@ -96,6 +110,40 @@ func _advance_fsm(delta: float) -> void:
|
||||
awaiting_interaction = true
|
||||
|
||||
func _move_toward_target(delta: float) -> void:
|
||||
if agent == null:
|
||||
_move_direct(delta)
|
||||
return
|
||||
agent.target_position = target_position
|
||||
if agent.is_navigation_finished():
|
||||
if (global_position - target_position).length() < 3.0:
|
||||
_arrive()
|
||||
else:
|
||||
# Path finished but we are far away: navigation is unusable, fall back.
|
||||
_move_direct(delta)
|
||||
return
|
||||
# Learn whether the navmesh actually serves this spot.
|
||||
if not _nav_usable:
|
||||
_nav_try_frames += 1
|
||||
if agent.is_target_reachable():
|
||||
_nav_usable = true
|
||||
elif _nav_try_frames > 10:
|
||||
_move_direct(delta)
|
||||
return
|
||||
var next := agent.get_next_path_position()
|
||||
var dir := (next - global_position)
|
||||
dir.y = 0.0
|
||||
if dir.length() < 0.2:
|
||||
velocity = Vector3.ZERO
|
||||
return
|
||||
dir = dir.normalized()
|
||||
velocity.x = dir.x * 1.3
|
||||
velocity.z = dir.z * 1.3
|
||||
velocity.y -= 9.8 * delta
|
||||
look_at(global_position + Vector3(dir.x, 0, dir.z), Vector3.UP)
|
||||
move_and_slide()
|
||||
|
||||
## Fallback used when no navigation mesh is available (e.g. minimal scenes).
|
||||
func _move_direct(delta: float) -> void:
|
||||
var to_target := target_position - global_position
|
||||
to_target.y = 0.0
|
||||
var dist := to_target.length()
|
||||
|
||||
Reference in new issue
Block a user