feat: add behaviour events from the simulation results
This commit is contained in:
@@ -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)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user