extends SceneTree const BUILDING_DEFINITIONS = preload("res://buildings/BuildingDefinitions.gd") func _initialize() -> void: var scene: PackedScene = load("res://buildings/Building.tscn") for definition in BUILDING_DEFINITIONS.all(): if definition.placement_mode != "space": continue var building: Node2D = scene.instantiate() building.definition_id = definition.definition_id building._ready() if building.definition == null \ or building.definition.definition_id != definition.definition_id \ or building.visual == null: _fail("%s did not compose its definition and visual (resolved=%s visual=%s)" % [ definition.definition_id, "null" if building.definition == null else building.definition.definition_id, building.visual, ]) return var provider: Node = building.visual.get_node_or_null("ActionProvider") if "transport_hub" in definition.capabilities: # #216: a hub has exactly one thing to press - how many # transporters to keep here. Its routes remain automatic, so a # manual transfer would still be wrong. if provider == null: _fail("transport hub has no way to set its crew") elif building.available_actions() != PackedStringArray(["staff"]): _fail("transport hub composed %s, expected only the crew menu" \ % [building.available_actions()]) return elif "planet_scanner" in definition.capabilities: if provider == null or not provider.actions.has("scanner") \ or provider.actions.has("transfer"): _fail("%s did not compose its scanner-only action" \ % definition.definition_id) return elif provider == null or not provider.actions.has("transfer"): _fail("%s has no composed transfer action" % definition.definition_id) return building.free() print("TEST_BUILDING_COMPOSITION: PASS") quit(0) func _fail(message: String) -> void: print("TEST_BUILDING_COMPOSITION: FAIL (%s)" % message) quit(1)