Compose vessels from definitions and capabilities
This commit is contained in:
parent
0504b24d8d
commit
14081ad230
39 changed files with 705 additions and 386 deletions
24
VesselDefinitions.gd
Normal file
24
VesselDefinitions.gd
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
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
|
||||
Loading…
Reference in a new issue