diff --git a/world/resource_nodes/ResourceNode.gd b/world/resource_nodes/ResourceNode.gd index 7f75a32..a58c9a9 100644 --- a/world/resource_nodes/ResourceNode.gd +++ b/world/resource_nodes/ResourceNode.gd @@ -24,6 +24,12 @@ var reserved_by: int = -1 func _ready(): if node_id.is_empty(): push_error("ResourceNode at %s has empty node_id" % get_path()) + enabled = false + else: + var existing := get_by_id(node_id) + if existing != null: + push_error("Duplicate ResourceNode node_id '%s' at %s; first registered at %s" % [node_id, get_path(), existing.get_path()]) + enabled = false _all.append(self) add_to_group("resource_nodes") amount_changed.connect(_update_debug_label) @@ -93,7 +99,7 @@ static func find_available(action: StringName, agent_id: int, from_position: Vec continue if not node.is_available_for(agent_id): continue - var dist := from_position.distance_squared_to(node.global_position) + var dist := from_position.distance_squared_to(node.interaction_point.global_position) if dist < best_dist: best_dist = dist best = node