spaceship/BuildingDefinitions.gd

21 lines
855 B
GDScript3
Raw Normal View History

class_name BuildingDefinitions
extends RefCounted
const ORDER: PackedStringArray = ["mothership", "ship_crafter", "command_center", "extractor", "transport_hub", "ship_lab"]
const DEFINITIONS: Dictionary = {
"mothership": preload("res://MothershipBuildingDefinition.tres"),
"ship_crafter": preload("res://CrafterBuildingDefinition.tres"),
"command_center": preload("res://CommandBuildingDefinition.tres"),
"extractor": preload("res://ExtractorBuildingDefinition.tres"),
"transport_hub": preload("res://TransportHubBuildingDefinition.tres"),
"ship_lab": preload("res://ShipLabBuildingDefinition.tres"),
}
static func get_definition(definition_id: String) -> Resource:
return DEFINITIONS.get(definition_id)
static func all() -> Array:
var result: Array = []
for definition_id in ORDER:
result.append(DEFINITIONS[definition_id])
return result