Loads of crap
This commit is contained in:
parent
b5bf7619e6
commit
1dc768ad27
725 changed files with 15096 additions and 191 deletions
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue