24 lines
760 B
GDScript3
24 lines
760 B
GDScript3
|
|
class_name VesselDefinitions
|
||
|
|
extends RefCounted
|
||
|
|
|
||
|
|
const ORDER: PackedStringArray = ["interceptor", "shield", "transporter"]
|
||
|
|
const DEFINITIONS: Dictionary = {
|
||
|
|
"interceptor": preload("res://InterceptorVesselDefinition.tres"),
|
||
|
|
"shield": preload("res://ShieldVesselDefinition.tres"),
|
||
|
|
"transporter": preload("res://TransporterVesselDefinition.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
|
||
|
|
|
||
|
|
static func with_capability(capability: String) -> Resource:
|
||
|
|
for definition in all():
|
||
|
|
if definition.has_capability(capability):
|
||
|
|
return definition
|
||
|
|
return null
|