Loads of crap
This commit is contained in:
parent
b5bf7619e6
commit
1dc768ad27
725 changed files with 15096 additions and 191 deletions
|
|
@ -9,3 +9,10 @@ extends Resource
|
|||
@export var ground_compaction: float = 0.0
|
||||
@export var water: float = 0
|
||||
@export var moisture_level: float = 0.6
|
||||
|
||||
@export var trees: Array = []
|
||||
|
||||
func add_trees(qty: int) -> void:
|
||||
for i in qty:
|
||||
var tree = TreeDataResource.new()
|
||||
trees.append(tree)
|
||||
|
|
|
|||
|
|
@ -1,19 +1,9 @@
|
|||
class_name MapDataClass
|
||||
extends Node
|
||||
|
||||
var map_data: Array
|
||||
var map_data: Array = Global.map_data
|
||||
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()
|
||||
|
||||
|
|
@ -39,9 +29,5 @@ 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()
|
||||
|
|
|
|||
27
Utilities/MapData/MapPopulation.gd
Normal file
27
Utilities/MapData/MapPopulation.gd
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
class_name MapPopulationClass
|
||||
extends Node
|
||||
|
||||
var map_data: Array = Global.map_data
|
||||
|
||||
## Generate the CellDataResource for a given cell
|
||||
## Setup the X and Z
|
||||
## If it's a path or water we do nothing else for now
|
||||
## If it's anything else then we need to:
|
||||
## Set grass density directly from the vegetation density
|
||||
## Then do the following:
|
||||
## Density < 0.5 - chance of spawning special stuff and nothing else
|
||||
## Density > 0.6 - add trees, varying quantity from 0.6 to 1
|
||||
## Density 0.1 to 0.6 - add bushes, varying quantity TBD
|
||||
## Density 0.1 to 0.4 - add flowers, varying quantity TBD
|
||||
|
||||
static func generate_cell(x: int, z: int, density: float, path: bool = false, water: bool = false):
|
||||
var cell_data = CellDataResource.new()
|
||||
cell_data.x = x
|
||||
cell_data.z = z
|
||||
cell_data.vegetation_density = density
|
||||
|
||||
if not (path or water):
|
||||
if density >= 0.6:
|
||||
cell_data.add_trees(int(density * 10 / 3))
|
||||
|
||||
Global.map_data[x][z] = cell_data
|
||||
1
Utilities/MapData/MapPopulation.gd.uid
Normal file
1
Utilities/MapData/MapPopulation.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://k0na6fmppqew
|
||||
Loading…
Add table
Add a link
Reference in a new issue