Preserve packed definition arrays in exports
This commit is contained in:
parent
a17fe88197
commit
546107efb9
6 changed files with 29 additions and 5 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
@export var actions: PackedStringArray = []
|
# Explicit empty PackedStringArray defaults are not export-safe for custom
|
||||||
|
# scripted objects in Godot 4.7.1.
|
||||||
|
@export var actions: PackedStringArray
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,9 @@ extends Resource
|
||||||
@export var action_icon: int
|
@export var action_icon: int
|
||||||
@export var menu_icon: int
|
@export var menu_icon: int
|
||||||
@export var visual_scene: PackedScene
|
@export var visual_scene: PackedScene
|
||||||
@export var capabilities: PackedStringArray = []
|
# No explicit empty default: Godot 4.7.1 can lose the value when exporting a
|
||||||
|
# custom resource to binary .res.
|
||||||
|
@export var capabilities: PackedStringArray
|
||||||
@export var logistics: Resource
|
@export var logistics: Resource
|
||||||
@export var map_color: Color = Color.WHITE
|
@export var map_color: Color = Color.WHITE
|
||||||
@export var map_sides: int = 4
|
@export var map_sides: int = 4
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,9 @@ extends Resource
|
||||||
# converter does not require another resource-type branch in transport code.
|
# converter does not require another resource-type branch in transport code.
|
||||||
|
|
||||||
@export var input_buffers: Dictionary = {}
|
@export var input_buffers: Dictionary = {}
|
||||||
@export var collected_outputs: PackedStringArray = []
|
# See BuildingDefinition.capabilities: an explicit empty packed-array default
|
||||||
|
# is not export-safe in Godot 4.7.1 custom resources.
|
||||||
|
@export var collected_outputs: PackedStringArray
|
||||||
@export var conversion_input: String = ""
|
@export var conversion_input: String = ""
|
||||||
@export var conversion_output: String = ""
|
@export var conversion_output: String = ""
|
||||||
@export var conversion_rate: float = 0.0
|
@export var conversion_rate: float = 0.0
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ static func faults() -> PackedStringArray:
|
||||||
var found: PackedStringArray = PackedStringArray()
|
var found: PackedStringArray = PackedStringArray()
|
||||||
_check_vessels(found)
|
_check_vessels(found)
|
||||||
_check_buildings(found)
|
_check_buildings(found)
|
||||||
|
_check_planets(found)
|
||||||
return found
|
return found
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -107,6 +108,12 @@ static func _check_buildings(found: PackedStringArray) -> void:
|
||||||
# rather than a thing standing in the world, and has no scene.
|
# rather than a thing standing in the world, and has no scene.
|
||||||
if definition.placement_mode == "space" and definition.visual_scene == null:
|
if definition.placement_mode == "space" and definition.visual_scene == null:
|
||||||
found.append("building %s stands in space with nothing to draw" % id)
|
found.append("building %s stands in space with nothing to draw" % id)
|
||||||
|
if definition.visual_scene != null:
|
||||||
|
var visual: Node = definition.visual_scene.instantiate()
|
||||||
|
var provider: Node = visual.get_node_or_null("ActionProvider")
|
||||||
|
if provider != null and Array(provider.actions).is_empty():
|
||||||
|
found.append("building %s has an action provider with no actions" % id)
|
||||||
|
visual.free()
|
||||||
for field in ["menu_button_name", "menu_label_name", "menu_cost_name"]:
|
for field in ["menu_button_name", "menu_label_name", "menu_cost_name"]:
|
||||||
if str(definition.get(field)).strip_edges() == "":
|
if str(definition.get(field)).strip_edges() == "":
|
||||||
found.append("building %s has no %s - the build menu could not place it" % [id, field])
|
found.append("building %s has no %s - the build menu could not place it" % [id, field])
|
||||||
|
|
@ -127,3 +134,10 @@ static func _check_buildings(found: PackedStringArray) -> void:
|
||||||
found.append("building %s converts but lists no collected outputs - what it makes would never be fetched" % id)
|
found.append("building %s converts but lists no collected outputs - what it makes would never be fetched" % id)
|
||||||
if _list(logistics, "input_buffers").is_empty():
|
if _list(logistics, "input_buffers").is_empty():
|
||||||
found.append("building %s converts with no input buffer" % id)
|
found.append("building %s converts with no input buffer" % id)
|
||||||
|
|
||||||
|
|
||||||
|
static func _check_planets(found: PackedStringArray) -> void:
|
||||||
|
for definition in PlanetDefinitions.DEFINITIONS.values():
|
||||||
|
var id: String = String(definition.definition_id)
|
||||||
|
if definition.names.is_empty():
|
||||||
|
found.append("planet %s has no generated names" % id)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,9 @@ extends Resource
|
||||||
|
|
||||||
@export var definition_id: String = "rocky"
|
@export var definition_id: String = "rocky"
|
||||||
@export var display_name: String = "Rocky planet"
|
@export var display_name: String = "Rocky planet"
|
||||||
@export var names: PackedStringArray = []
|
# Keep this implicit default export-safe; explicit empty PackedStringArray
|
||||||
|
# defaults can replace authored values during Godot 4.7.1 binary conversion.
|
||||||
|
@export var names: PackedStringArray
|
||||||
@export var visual_scene: PackedScene
|
@export var visual_scene: PackedScene
|
||||||
@export var surface_profile_id: String = "rocky"
|
@export var surface_profile_id: String = "rocky"
|
||||||
@export var resource_id: String = "ore"
|
@export var resource_id: String = "ore"
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,9 @@ extends Resource
|
||||||
# gun is the case that does.
|
# gun is the case that does.
|
||||||
@export var garrison_ammo_resource: String = ""
|
@export var garrison_ammo_resource: String = ""
|
||||||
@export var garrison_ammo_capacity: int = 0
|
@export var garrison_ammo_capacity: int = 0
|
||||||
@export var capabilities: PackedStringArray = []
|
# Do not add an explicit `= []` default here. Godot 4.7.1 can discard a
|
||||||
|
# PackedStringArray override while converting custom resources to binary .res.
|
||||||
|
@export var capabilities: PackedStringArray
|
||||||
@export var component_scenes: Array[PackedScene] = []
|
@export var component_scenes: Array[PackedScene] = []
|
||||||
@export var base_stats: Dictionary = {}
|
@export var base_stats: Dictionary = {}
|
||||||
@export var minimum_stats: Dictionary = {}
|
@export var minimum_stats: Dictionary = {}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue