class_name MapDataClass extends Node var map_data: Array var cell_data: CellDataResource func _init() -> void: map_data.resize(500) # First resize the main array for y in range(500): map_data[y] = [] map_data[y].resize(500) func _ready() -> void: Log.pr('MapData class ready...') func setup_cell_data(x, z, density, path = false, water = false): var cell_data_res = CellDataResource.new() cell_data_res.x = x cell_data_res.z = z if path or water: cell_data_res.vegetation_density = 0 else: cell_data_res.vegetation_density = density if path: cell_data_res.ground_compaction = 1 # Set water level if water: cell_data_res.water = 100 cell_data_res.moisture_level = 100 map_data[x][z] = cell_data_res func get_map_data(x, z) -> CellDataResource: if x < map_data.size() and x >= 0: if z < map_data[x].size() and z >= 0: return map_data[x][z] else: Log.pr("Z index out of bounds") else: Log.pr("X index out of bounds") return CellDataResource.new()