Implements procedural ground tile generation
Adds procedural ground tile generation with chunking for improved performance. Includes: - Ground tile entity with debug text and cell information - Grass and tree placement based on cell data - Ground shader for visual representation - Chunk loading and unloading system based on player position
This commit is contained in:
parent
95665f54eb
commit
b5bf7619e6
21 changed files with 532 additions and 149 deletions
|
|
@ -1,26 +1,29 @@
|
|||
# GroundTile.gd
|
||||
class_name GroundTile
|
||||
extends Node3D
|
||||
|
||||
@onready var debug_text: Label = $DebugText/DebugTextLabel
|
||||
|
||||
@onready var debug_text: Label = $DebugText/DebugTextViewport/DebugTextLabel
|
||||
var grid_x: int
|
||||
var grid_z: int
|
||||
var cell_info: CellDataResource
|
||||
var cell_info: CellDataResource = null:
|
||||
set(value):
|
||||
cell_info = value
|
||||
if cell_info != null:
|
||||
cell_info_updated.emit(value)
|
||||
|
||||
var rng: RandomClass = RandomClass.new()
|
||||
|
||||
signal cell_info_updated(value)
|
||||
|
||||
func _ready() -> void:
|
||||
if cell_info != null:
|
||||
update_text_label()
|
||||
rng.set_seed(cell_info.cell_seed)
|
||||
|
||||
func set_grid_location(x, z) -> void:
|
||||
grid_x = x
|
||||
grid_z = z
|
||||
cell_info = MapData.get_map_data(grid_x, grid_z)
|
||||
|
||||
var debug_dict = {}
|
||||
if cell_info.get_script():
|
||||
var script_properties = cell_info.get_script().get_script_property_list()
|
||||
for prop in script_properties:
|
||||
debug_dict[prop.name] = cell_info.get(prop.name)
|
||||
Log.pr(debug_dict)
|
||||
|
||||
func update_text_label() -> void:
|
||||
debug_text.text = str(grid_x) + ', ' + str(grid_z) + ', ' + str(cell_info.cell_seed)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue