Add wildlife navigation support

This commit is contained in:
2026-05-16 11:23:17 -07:00
parent 82463f3b99
commit 578220cf60
7 changed files with 295 additions and 12 deletions
+11 -3
View File
@@ -3,7 +3,7 @@ import unreal
MAP_PATH = "/Game/Agrarian/Maps/L_GroundZeroTerrain_Test"
CHARACTER_CLASS_PATH = "/Game/Agrarian/Blueprints/Characters/BP_AgrarianPlayerCharacter"
RABBIT_LABEL = "AGR_RabbitWildlife_01"
RABBIT_LABELS = ["AGR_DemoRabbitWildlife_01", "AGR_RabbitWildlife_01"]
def get_actor_label(actor):
@@ -27,6 +27,14 @@ def find_actor_by_label(label):
return None
def find_actor_by_any_label(labels):
for label in labels:
actor = find_actor_by_label(label)
if actor:
return actor
return None
def enum_name(value):
return str(value).split(".")[-1].lower()
@@ -45,9 +53,9 @@ def main():
raise RuntimeError(f"Could not load map: {MAP_PATH}")
character_class = load_blueprint_class(CHARACTER_CLASS_PATH)
rabbit = find_actor_by_label(RABBIT_LABEL)
rabbit = find_actor_by_any_label(RABBIT_LABELS)
if not rabbit:
raise RuntimeError(f"Could not find placed rabbit wildlife: {RABBIT_LABEL}")
raise RuntimeError(f"Could not find placed rabbit wildlife by labels: {RABBIT_LABELS}")
character = unreal.AgrarianEditorAutomationLibrary.spawn_actor_in_editor_world(
character_class,