feat: add task duration and task commitment
This commit is contained in:
@@ -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())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user