Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add air layer option in HeightmapGenerators #152

Merged
merged 1 commit into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,8 @@ func _set_grid_area(area: Rect2i) -> void:
for y in range(area.position.y, area.end.y):
if y > -height and y <= -settings.min_height:
grid.set_valuexy(x, y, settings.tile)

if y == -height and settings.air_layer:
grid.set_valuexy(x, y, null)


Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ extends GeneratorSettings2D
@export var height_intensity := 20
## Negative values means the HeightmapGenerator will go below y=0.
@export var min_height := 0
## If [code]true[/code], adds a layer of air ([code]null[/code] tiles above the generated terrain.
@export var air_layer := true
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,6 @@ func _set_grid_area(area: AABB) -> void:
for y in range(area.position.y, area.end.y):
if y <= height and y >= settings.min_height:
grid.set_valuexyz(x, y, z, settings.tile)

if y == height and settings.air_layer:
grid.set_valuexyz(x, y, z, null)
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ extends GeneratorSettings3D
@export var height_intensity := 20
## Negative values means the HeightmapGenerator will go below y=0.
@export var min_height := 0
## If [code]true[/code], adds a layer of air ([code]null[/code] tiles above the generated terrain.
@export var air_layer := true
@export_group("Falloff", "falloff_")
## Enables the usage of a [FalloffMap], which makes tiles
## farther away from the center be lower in the heightmap,
Expand Down
2 changes: 2 additions & 0 deletions scenes/demos/heightmap/terraria-like_generation_settings.tres
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ salt = 3487287303
enabled = true
affected_layers = Array[int]([0])
filter_type = 3
filter_layers = Array[int]([])

[sub_resource type="FastNoiseLite" id="FastNoiseLite_mwtbk"]
noise_type = 3
Expand All @@ -228,4 +229,5 @@ world_length = 128
height_offset = 160
height_intensity = 25
min_height = -32
air_layer = true
modifiers = Array[Resource("res://addons/gaea/modifiers/2D/modifier_2d.gd")]([SubResource("Resource_pu43q"), SubResource("Resource_855mm"), SubResource("Resource_q887n"), SubResource("Resource_2w3lo"), SubResource("Resource_08u4d"), SubResource("Resource_f4y1w")])