class_name MapDataClass
extends Node

var cell_data: CellDataResource

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

	Global.map_data[x][z] = cell_data_res

func get_map_data(x, z) -> CellDataResource:
	if x < Global.map_data.size() and x >= 0:
		if z < Global.map_data[x].size() and z >= 0:
			return Global.map_data[x][z]
	
	return null
