2021-07-13 01:15:23 +02:00
|
|
|
local wea = worldeditadditions
|
2022-09-19 02:16:22 +02:00
|
|
|
local wea_c = worldeditadditions_core
|
2021-07-13 01:15:23 +02:00
|
|
|
|
|
|
|
local White = dofile(wea.modpath.."/lib/noise/engines/white.lua")
|
|
|
|
|
|
|
|
local Red = {}
|
|
|
|
Red.__index = Red
|
|
|
|
|
|
|
|
|
|
|
|
function Red.new(seed)
|
|
|
|
local result = {
|
|
|
|
seed = seed or math.random(),
|
|
|
|
white = White.new(seed)
|
|
|
|
}
|
|
|
|
setmetatable(result, Red)
|
|
|
|
return result
|
|
|
|
end
|
|
|
|
|
|
|
|
function Red:noise( x, y, z )
|
|
|
|
local values = {
|
|
|
|
self.white:noise(x, y, z),
|
|
|
|
self.white:noise(x + 1, y, z),
|
|
|
|
self.white:noise(x, y + 1, z),
|
|
|
|
self.white:noise(x, y, z + 1),
|
|
|
|
self.white:noise(x - 1, y, z),
|
|
|
|
self.white:noise(x, y - 1, z),
|
|
|
|
self.white:noise(x, y, z - 1),
|
|
|
|
self.white:noise(x, y - 1, z - 1),
|
|
|
|
self.white:noise(x - 1, y, z - 1),
|
|
|
|
self.white:noise(x - 1, y - 1, z),
|
|
|
|
self.white:noise(x - 1, y - 1, z - 1),
|
|
|
|
self.white:noise(x, y + 1, z + 1),
|
|
|
|
self.white:noise(x + 1, y, z + 1),
|
|
|
|
self.white:noise(x + 1, y + 1, z),
|
|
|
|
self.white:noise(x + 1, y + 1, z + 1),
|
|
|
|
}
|
2022-09-19 02:16:22 +02:00
|
|
|
return wea_c.average(values)
|
2021-07-13 01:15:23 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
return Red
|