feat: add behaviour events from the simulation results

This commit is contained in:
Rijad Zuzo
2026-06-19 10:42:11 +02:00
parent af3495f4e3
commit c37eb9bd3d
4 changed files with 63 additions and 26 deletions
+20 -11
View File
@@ -1,5 +1,8 @@
extends Node
signal npc_task_changed(npc: SimNPC, old_task: String, new_task: String)
const DEBUG_LOGS := true
var npcs: Array[SimNPC] = []
var tick_interval := 1.0
var tick_timer := 0.0
@@ -47,15 +50,21 @@ func simulate_tick() -> void:
print("--- Tick ", tick_count, " ---")
for npc in npcs:
var old_task := npc.current_task
npc.simulate_tick()
print(
npc.npc_name,
" | ",
npc.profession,
" | task: ",
npc.current_task,
" | hunger: ",
round(npc.hunger),
" | energy: ",
round(npc.energy)
)
if old_task != npc.current_task:
npc_task_changed.emit(npc, old_task, npc.current_task)
if DEBUG_LOGS:
print(
npc.npc_name,
" | ",
npc.profession,
" | task: ",
npc.current_task,
" | hunger: ",
round(npc.hunger),
" | energy: ",
round(npc.energy)
)