level building tool good enough for first cave draft

This commit is contained in:
2026-02-06 02:17:33 +11:00
parent 126c2fd72d
commit 2bacff5b7d
15 changed files with 483 additions and 51 deletions

View File

@@ -3,3 +3,25 @@ extends Resource
@export var nodes: Array[FlowNodeData]
@export var grids: int = 0
func to_dict() -> Dictionary:
var dict: Dictionary = {}
for node: FlowNodeData in nodes:
dict[node.node_id] = node.to_dict()
dict["grids"] = grids
return dict
static func from_dict(dict: Dictionary) -> FlowFieldData:
var flow: FlowFieldData = FlowFieldData.new()
var unpopulated: Dictionary[FlowNodeData, Dictionary] = {}
for key: String in dict.keys():
if key.is_valid_int():
var data: FlowNodeData = FlowNodeData.from_dict(dict[key])
flow.nodes.append(data)
unpopulated[data] = dict[key]
for key: FlowNodeData in unpopulated.keys():
key.populate_connections(unpopulated[key], flow.nodes)
flow.grids = dict["grids"]
return flow