feat: add structured economic events

This commit is contained in:
2026-07-05 18:04:11 +02:00
parent ebf70a711a
commit f9601a67d1
11 changed files with 358 additions and 17 deletions
+8
View File
@@ -12,6 +12,7 @@ const DEBUG_LOGS := true
@export var stuck_timeout := 1.5
@onready var nav_agent: NavigationAgent3D = $NavigationAgent3D
@onready var carried_food_visual: MeshInstance3D = $CarriedFood
var has_reported_arrival := false
var sim_id: int = -1
@@ -41,6 +42,12 @@ func setup_from_sim(npc: SimNPC) -> void:
npc_name = npc.npc_name
profession = npc.profession
name = "NPC_%s_%s" % [sim_id, npc_name]
set_carried_food_visible(
npc.get_inventory_amount(SimulationIds.RESOURCE_FOOD) > 0.0
)
func set_carried_food_visible(is_visible: bool) -> void:
carried_food_visual.visible = is_visible and not is_dead_visual
func set_target_position(pos: Vector3) -> void:
path_request_id += 1
@@ -167,6 +174,7 @@ func _report_navigation_failure_once() -> void:
func apply_dead_visual_state() -> void:
is_dead_visual = true
carried_food_visual.visible = false
path_request_id += 1
velocity = Vector3.ZERO
current_path = PackedVector3Array()