Finish Ground Zero playable map resources
This commit is contained in:
@@ -2,6 +2,12 @@ import unreal
|
||||
|
||||
|
||||
MAP_PATH = "/Game/Agrarian/Maps/L_GroundZeroTerrain_Test"
|
||||
MATERIALS = {
|
||||
"wood": "/Game/Agrarian/Materials/M_AGR_GZ_Wood_Resource",
|
||||
"fiber": "/Game/Agrarian/Materials/M_AGR_GZ_Fiber_Resource",
|
||||
"food": "/Game/Agrarian/Materials/M_AGR_GZ_EdiblePlant_Resource",
|
||||
"stone": "/Game/Agrarian/Materials/M_AGR_GZ_Stone_Sandstone",
|
||||
}
|
||||
|
||||
EXPECTED_RESOURCE_LABELS = {
|
||||
"wood": [
|
||||
@@ -31,6 +37,12 @@ EXPECTED_RESOURCE_LABELS = {
|
||||
}
|
||||
|
||||
|
||||
def material_path(material):
|
||||
if not material:
|
||||
return ""
|
||||
return material.get_path_name().split(".", 1)[0]
|
||||
|
||||
|
||||
def get_actor_label(actor):
|
||||
try:
|
||||
return actor.get_actor_label()
|
||||
@@ -48,6 +60,10 @@ def main():
|
||||
if not unreal.EditorLevelLibrary.load_level(MAP_PATH):
|
||||
raise RuntimeError(f"Could not load map: {MAP_PATH}")
|
||||
|
||||
for path in MATERIALS.values():
|
||||
if not unreal.EditorAssetLibrary.load_asset(path):
|
||||
raise RuntimeError(f"Missing required resource material: {path}")
|
||||
|
||||
actors_by_label = {get_actor_label(actor): actor for actor in unreal.EditorLevelLibrary.get_all_level_actors()}
|
||||
failures = []
|
||||
|
||||
@@ -69,6 +85,14 @@ def main():
|
||||
if persistence_node_id != label:
|
||||
failures.append(f"{label} persistence node id expected {label}, got {persistence_node_id}")
|
||||
|
||||
mesh_components = actor.get_components_by_class(unreal.StaticMeshComponent)
|
||||
if not mesh_components:
|
||||
failures.append(f"{label} has no static mesh component for MVP resource readability")
|
||||
continue
|
||||
expected_material = MATERIALS[expected_item_id]
|
||||
if not any(material_path(component.get_material(0)) == expected_material for component in mesh_components):
|
||||
failures.append(f"{label} expected readable material {expected_material}")
|
||||
|
||||
if failures:
|
||||
raise RuntimeError("Ground Zero resource verification failed: " + "; ".join(failures))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user