feat: introduce identity-backed goat
This commit is contained in:
@@ -59,6 +59,41 @@ func get_resource_index_stats() -> Dictionary:
|
||||
return _resource_index.get_stats()
|
||||
|
||||
|
||||
func get_animal_candidates(action_id: StringName) -> Array[Dictionary]:
|
||||
var candidates: Array[Dictionary] = []
|
||||
for node in AnimalNode.get_all():
|
||||
if not node.supports_action(action_id):
|
||||
continue
|
||||
(
|
||||
candidates
|
||||
. append(
|
||||
{
|
||||
"target_id": String(node.animal_id),
|
||||
"position": node.get_interaction_position(),
|
||||
"display_name": node.display_name,
|
||||
}
|
||||
)
|
||||
)
|
||||
return candidates
|
||||
|
||||
|
||||
func get_animal_nodes_in_radius(origin: Vector3, max_distance: float) -> Array[AnimalNode]:
|
||||
var nodes: Array[AnimalNode] = []
|
||||
var maximum_distance_squared := maxf(max_distance, 0.0) * maxf(max_distance, 0.0)
|
||||
for node in AnimalNode.get_all():
|
||||
if origin.distance_squared_to(node.get_interaction_position()) <= maximum_distance_squared:
|
||||
nodes.append(node)
|
||||
nodes.sort_custom(
|
||||
func(first: AnimalNode, second: AnimalNode) -> bool:
|
||||
var first_distance := origin.distance_squared_to(first.get_interaction_position())
|
||||
var second_distance := origin.distance_squared_to(second.get_interaction_position())
|
||||
if not is_equal_approx(first_distance, second_distance):
|
||||
return first_distance < second_distance
|
||||
return String(first.animal_id) < String(second.animal_id)
|
||||
)
|
||||
return nodes
|
||||
|
||||
|
||||
func get_activity_target(action_id: StringName, origin: Vector3 = Vector3.ZERO) -> Dictionary:
|
||||
var best_candidate: Dictionary = {}
|
||||
var best_distance := INF
|
||||
|
||||
Reference in New Issue
Block a user