feat: assign NPC home positions near village houses

Add home_positions export to SimulationManager. When configured, NPCs get homes assigned from the array wrapping around for more NPCs than homes. main.tscn now sets 6 home positions near the three village houses, so each NPC has a real home to walk to at night. Empty home_positions leaves the spawn-point-as-home backward-compatible behavior.
This commit is contained in:
2026-07-08 18:32:08 +02:00
parent cab732a977
commit adedf28417
2 changed files with 24 additions and 17 deletions
+6
View File
@@ -18,6 +18,7 @@ var npcs: Array[SimNPC] = []
@export var cycle_duration_seconds := 240.0
@export var debug_logs := true
@export var active_world_adapter: Node
@export var home_positions: Array[Vector3] = []
var clock: SimulationClock
var tick_count := 0
@@ -80,6 +81,11 @@ func generate_npcs() -> void:
npcs.append(npc)
wander_random_sources[i] = _create_random_source(i, 1)
var home_count := home_positions.size()
if home_count > 0:
for i in range(npcs.size()):
npcs[i].home_position = home_positions[i % home_count]
func _create_random_source(npc_id: int, stream_id: int) -> RandomNumberGenerator:
var source := RandomNumberGenerator.new()