broken_seals/game/tw/new_terramanlevelgenerator.gd

14 lines
537 B
GDScript

tool
extends TerramanLevelGenerator
func _generate_chunk(chunk: TerraChunk) -> void:
chunk.channel_ensure_allocated(TerraChunkDefault.DEFAULT_CHANNEL_TYPE, 1)
chunk.channel_ensure_allocated(TerraChunkDefault.DEFAULT_CHANNEL_ISOLEVEL, 0)
var s : OpenSimplexNoise = OpenSimplexNoise.new()
for x in range(-chunk.margin_start, chunk.size_x + chunk.margin_end):
for z in range(-chunk.margin_start, chunk.size_x + chunk.margin_end):
chunk.set_voxel(s.get_noise_2d(x, z) * 10.0, x, z, TerraChunkDefault.DEFAULT_CHANNEL_ISOLEVEL)