Add z scanning. White line

This commit is contained in:
paramat 2014-05-18 23:00:01 +01:00
parent a4922c6a95
commit ecb737c172
2 changed files with 10 additions and 8 deletions

View File

@ -1,4 +1,4 @@
noisegrid 0.2.4 by paramat path 0.1.1 by paramat
For latest stable Minetest back to 0.4.8 For latest stable Minetest back to 0.4.8
Depends default Depends default
Licenses: code WTFPL Licenses: code WTFPL

View File

@ -1,20 +1,18 @@
-- path 0.1.0 by paramat -- path 0.1.1 by paramat
-- For latest stable Minetest and back to 0.4.8 -- For latest stable Minetest and back to 0.4.8
-- Depends default -- Depends default
-- License: code WTFPL -- License: code WTFPL
-- Parameters -- Parameters
local TPATH = 0.002
-- 2D noise for base terrain -- 2D noise for base terrain
local np_base = { local np_base = {
offset = 0, offset = 0,
scale = 1, scale = 1,
spread = {x=1024, y=1024, z=1024}, spread = {x=512, y=512, z=512},
seed = -9111, seed = -9111,
octaves = 5, octaves = 4,
persist = 0.5 persist = 0.5
} }
@ -94,14 +92,18 @@ minetest.register_on_generated(function(minp, maxp, seed)
for z = z0, z1 do for z = z0, z1 do
for y = y0, y1 do for y = y0, y1 do
local vi = area:index(x0, y, z) local vi = area:index(x0, y, z)
local n_xprebase local n_xprebase = false
for x = x0, x1 do for x = x0, x1 do
local nodid = data[vi] local nodid = data[vi]
local n_base = nvals_base[nixz] local n_base = nvals_base[nixz]
local n_zprebase = nvals_base[(nixz - 80)]
if y == 1 then if y == 1 then
if (x - x0 > 0 if (x - x0 > 0
and ((n_base >= 0 and n_xprebase < 0) and ((n_base >= 0 and n_xprebase < 0)
or (n_base < 0 and n_xprebase >= 0))) then or (n_base < 0 and n_xprebase >= 0)))
or (z - z0 > 0
and ((n_base >= 0 and n_zprebase < 0)
or (n_base < 0 and n_zprebase >= 0))) then
data[vi] = c_roadwhite data[vi] = c_roadwhite
for i = -3, 3 do for i = -3, 3 do
for k = -3, 3 do for k = -3, 3 do