Generate complete freshwater and elevated terrain features

This commit is contained in:
Alexander Sellite 2026-08-22 18:38:17 -04:00
parent 219c462181
commit f2b96f2c1f
7 changed files with 2105 additions and 141 deletions

View file

@ -356,7 +356,14 @@ func _configure_fresh_water(records: Array[Dictionary]) -> void:
var surface_size: Vector2 = record.get(
"water_surface_size", Vector2.ZERO
)
if surface_size.x <= 0.0 or surface_size.y <= 0.0:
var surface_polygon: PackedVector2Array = record.get(
"water_surface_polygon",
PackedVector2Array(),
)
if (
(surface_size.x <= 0.0 or surface_size.y <= 0.0)
and surface_polygon.size() < 3
):
continue
var body := WATER_BODY_SCENE.instantiate() as WaterBodyAuthoring
if body == null:
@ -379,7 +386,10 @@ func _configure_fresh_water(records: Array[Dictionary]) -> void:
+ Vector3.UP * WATER_HEIGHT
)
body.rotation.y = angle
body.surface_size = surface_size
if surface_polygon.size() >= 3:
body.surface_polygon = surface_polygon
else:
body.surface_size = surface_size
body.visual_surface_enabled = false
body.water_material = _fresh_water_material()
body.water_type = WaterType.Type.FRESH_WATER
@ -394,6 +404,8 @@ func _fresh_water_location_tags(tags: PackedStringArray) -> Array[StringName]:
result.append(&"pond")
if "river" in tags:
result.append(&"river")
if "lake" in tags:
result.append(&"lake")
return result

View file

@ -31,16 +31,23 @@ gatherable_anchor_root = NodePath("GatherableAnchors")
unique_name_in_owner = true
script = ExtResource("2_generator")
catalog = ExtResource("3_catalog")
grid_size = Vector2i(15, 13)
grid_size = Vector2i(20, 20)
generation_seed = 13001
generate_on_ready = false
build_collision = true
force_center_chunk_id = &"chunk_spawn"
required_chunk_ids = PackedStringArray("chunk_spawn", "chunk_0001", "chunk_0002", "chunk_0003", "chunk_0004")
grass_sand_smoothing_enabled = true
lake_feature_enabled = true
lake_minimum_size = 7
lake_maximum_size = 8
river_feature_enabled = true
river_minimum_length = 7
river_maximum_length = 8
elevated_cliff_feature_enabled = true
elevated_cliff_coastal_feature_required = true
required_chunk_weight_multiplier = 64.0
maximum_backtracks = 100000
maximum_backtracks = 1000
[node name="WaterBodies" type="Node3D" parent="."]

File diff suppressed because it is too large Load diff