feat: add task duration and task commitment

This commit is contained in:
Rijad Zuzo
2026-06-20 20:43:21 +02:00
parent bdc1f88b6f
commit 8a85c6fbba
2 changed files with 66 additions and 30 deletions
+19 -5
View File
@@ -52,13 +52,21 @@ func simulate_tick() -> void:
tick_count += 1
print("--- Tick ", tick_count, " ---")
var village_was_changed := false
for npc in npcs:
var old_task := npc.current_task
var was_complete := npc.task_complete
npc.simulate_tick(village)
if old_task != npc.current_task:
npc_task_changed.emit(npc, old_task, npc.current_task)
if not was_complete and npc.task_complete:
village.apply_npc_task(npc)
village_was_changed = true
if DEBUG_LOGS:
print(
npc.npc_name,
@@ -66,15 +74,21 @@ func simulate_tick() -> void:
npc.profession,
" | task: ",
npc.current_task,
" | progress: ",
npc.task_progress,
"/",
npc.task_duration,
" | complete: ",
npc.task_complete,
" | hunger: ",
round(npc.hunger),
" | energy: ",
round(npc.energy)
)
for npc in npcs:
village.apply_npc_task(npc)
if village_was_changed:
village_changed.emit(village)
if DEBUG_LOGS:
print(village.get_summary())