//erode → river: Change only 1 height at a time for extra granularity

this also simplifies it a bit too
This commit is contained in:
Starbeamrainbowlabs 2021-05-30 00:04:01 +01:00
parent 9ecdd01914
commit 00a60eba17
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
1 changed files with 2 additions and 10 deletions

View File

@ -76,18 +76,10 @@ function worldeditadditions.erode.river(heightmap_initial, heightmap, heightmap_
end
if action == "fill" then
local above_us = wea.table_filter(adjacent_heights,
function(height) return height > thisheight end
)
local above_us_next = wea.min(above_us)
heightmap[hi] = above_us_next
heightmap[hi] = heightmap[hi] + 1
filled = filled + 1
elseif action == "remove" then
local below_us = wea.table_filter(adjacent_heights,
function(height) return height < thisheight end
)
local below_us_next = wea.max(below_us)
heightmap[hi] = below_us_next
heightmap[hi] = heightmap[hi] - 1
removed = removed + 1
end
end