Loads of stuff
This commit is contained in:
parent
f3af522683
commit
66ce3ff503
413 changed files with 14802 additions and 0 deletions
11
Utilities/MapData/CellDataResource.gd
Normal file
11
Utilities/MapData/CellDataResource.gd
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
class_name CellDataResource
|
||||
extends Resource
|
||||
|
||||
@export var cell_seed: int = randi()
|
||||
@export var x: int = 0
|
||||
@export var z: int = 0
|
||||
|
||||
@export var vegetation_density: float = 0.5
|
||||
@export var ground_compaction: float = 0.0
|
||||
@export var water: float = 0
|
||||
@export var moisture_level: float = 0.6
|
||||
1
Utilities/MapData/CellDataResource.gd.uid
Normal file
1
Utilities/MapData/CellDataResource.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bpmhfilky6i5i
|
||||
47
Utilities/MapData/MapData.gd
Normal file
47
Utilities/MapData/MapData.gd
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
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()
|
||||
1
Utilities/MapData/MapData.gd.uid
Normal file
1
Utilities/MapData/MapData.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://d3fnwa2bomu2m
|
||||
Loading…
Add table
Add a link
Reference in a new issue