Adds basic camp generation and placement
Adds basic camp generation and placement logic to the map generation process. It attempts to place the camp in a valid location, avoiding paths and water bodies. It also sets the player's spawn point to the center of the generated camp, including some basic camp props like a tent, campfire, and bed. Additionally, vegetation spawning is now dependent on the `should_spawn_*` methods of the `CellDataResource`, allowing more control over what spawns where.
This commit is contained in:
parent
3959333534
commit
a1efaf6294
8 changed files with 402 additions and 125 deletions
|
|
@ -45,13 +45,13 @@ func spawn_content():
|
|||
if cell_info == null:
|
||||
return
|
||||
|
||||
if tree_spawner:
|
||||
if tree_spawner and cell_info.should_spawn_trees():
|
||||
tree_spawner.spawn_trees_for_cell(cell_info)
|
||||
if grass_spawner:
|
||||
if grass_spawner and cell_info.should_spawn_grass():
|
||||
grass_spawner.spawn_grass_for_cell(cell_info)
|
||||
if bush_spawner:
|
||||
if bush_spawner and cell_info.should_spawn_bushes():
|
||||
bush_spawner.spawn_bushes_for_cell(cell_info)
|
||||
if flower_spawner:
|
||||
if flower_spawner and cell_info.should_spawn_flowers():
|
||||
flower_spawner.spawn_flowers_for_cell(cell_info)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ func spawn_trees_for_cell(cell_info: CellDataResource):
|
|||
|
||||
attempts += 1
|
||||
|
||||
Log.pr("Spawned %d of %d trees in cell" % [spawned_count, cell_info.trees.size()])
|
||||
#Log.pr("Spawned %d of %d trees in cell" % [spawned_count, cell_info.trees.size()])
|
||||
|
||||
func get_random_position() -> Vector3:
|
||||
var rng = parent_ground_tile.get_rng()
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ extends CharacterBody3D
|
|||
var target_velocity = Vector3.ZERO
|
||||
|
||||
func _ready() -> void:
|
||||
position = Vector3.ZERO
|
||||
position = Global.spawn_point
|
||||
%Camp.position = Global.spawn_point
|
||||
|
||||
func _physics_process(delta):
|
||||
RenderingServer.global_shader_parameter_set("player_position", position)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue