Faster mapgen: use voxelmanip for scanning chunk below. Use sidelen not 80
This commit is contained in:
parent
bbb5bdca1c
commit
ff54f350e3
@ -1,4 +1,4 @@
|
|||||||
floatindev 0.3.0 by paramat
|
floatindev 0.3.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
|
||||||
|
20
init.lua
20
init.lua
@ -1,11 +1,14 @@
|
|||||||
-- floatindev 0.3.0 by paramat
|
-- floatindev 0.3.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
|
||||||
|
|
||||||
|
-- use voxelmanip for scanning chunk below
|
||||||
|
-- use sidelen, works with any chunksize
|
||||||
|
|
||||||
-- Parameters
|
-- Parameters
|
||||||
|
|
||||||
local YMIN = 1 -- Approximate realm limits.
|
local YMIN = 1 -- Approximate realm limits
|
||||||
local YMAX = 33000
|
local YMAX = 33000
|
||||||
local XMIN = -33000
|
local XMIN = -33000
|
||||||
local XMAX = 33000
|
local XMAX = 33000
|
||||||
@ -132,6 +135,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
local data = vm:get_data()
|
local data = vm:get_data()
|
||||||
|
|
||||||
local c_air = minetest.get_content_id("air")
|
local c_air = minetest.get_content_id("air")
|
||||||
|
local c_water = minetest.get_content_id("default:water_source")
|
||||||
|
|
||||||
local c_floatstone = minetest.get_content_id("floatindev:floatstone")
|
local c_floatstone = minetest.get_content_id("floatindev:floatstone")
|
||||||
local c_floatsand = minetest.get_content_id("floatindev:floatsand")
|
local c_floatsand = minetest.get_content_id("floatindev:floatsand")
|
||||||
@ -154,15 +158,17 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
local nixz = 1
|
local nixz = 1
|
||||||
local stable = {}
|
local stable = {}
|
||||||
for z = z0, z1 do -- for each xy plane progressing northwards
|
for z = z0, z1 do -- for each xy plane progressing northwards
|
||||||
|
local viu = area:index(x0, y0-1, z) -- initialise stability table
|
||||||
for x = x0, x1 do
|
for x = x0, x1 do
|
||||||
local si = x - x0 + 1
|
local si = x - x0 + 1
|
||||||
local nodename = minetest.get_node({x=x,y=y0-1,z=z}).name
|
local nodidu = data[viu]
|
||||||
if nodename == "air"
|
if nodidu == c_air
|
||||||
or nodename == "default:water_source" then
|
or nodidu == c_water then
|
||||||
stable[si] = 0
|
stable[si] = 0
|
||||||
else -- all else including ignore in ungenerated chunks
|
else -- all else including ignore in ungenerated chunks
|
||||||
stable[si] = 2
|
stable[si] = 2
|
||||||
end
|
end
|
||||||
|
viu = viu + 1
|
||||||
end
|
end
|
||||||
for y = y0, y1 do -- for each x row progressing upwards
|
for y = y0, y1 do -- for each x row progressing upwards
|
||||||
local vi = area:index(x0, y, z)
|
local vi = area:index(x0, y, z)
|
||||||
@ -200,9 +206,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
nixz = nixz + 1
|
nixz = nixz + 1
|
||||||
vi = vi + 1
|
vi = vi + 1
|
||||||
end
|
end
|
||||||
nixz = nixz - 80
|
nixz = nixz - sidelen
|
||||||
end
|
end
|
||||||
nixz = nixz + 80
|
nixz = nixz + sidelen
|
||||||
end
|
end
|
||||||
|
|
||||||
vm:set_data(data)
|
vm:set_data(data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user