2014-04-20 09:13:14 +02:00
|
|
|
-- watershed 0.3.13 by paramat
|
2014-02-15 10:50:29 +01:00
|
|
|
-- For latest stable Minetest and back to 0.4.8
|
2014-04-04 03:34:26 +02:00
|
|
|
-- Depends default bucket
|
2014-04-09 07:06:10 +02:00
|
|
|
-- License: code WTFPL, textures CC BY-SA
|
2014-04-16 09:33:08 +02:00
|
|
|
-- Red cobble texture CC BY-SA by brunob.santos
|
2014-04-09 07:06:10 +02:00
|
|
|
|
2014-04-20 09:13:14 +02:00
|
|
|
-- y = 47 bugfix: add snowblocks in chunk above
|
2014-02-15 10:50:29 +01:00
|
|
|
|
|
|
|
-- Parameters
|
|
|
|
|
2014-04-01 02:39:57 +02:00
|
|
|
local YMIN = -33000 -- Approximate base of realm stone
|
|
|
|
local YMAX = 33000 -- Approximate top of atmosphere / mountains / floatlands
|
|
|
|
local TERCEN = -160 -- Terrain 'centre', average seabed level
|
|
|
|
local YWAT = 1 -- Sea surface y
|
2014-04-15 09:03:32 +02:00
|
|
|
local YSAV = 5 -- Average sandline y, dune grasses above this
|
|
|
|
local SAMP = 3 -- Sandline amplitude
|
|
|
|
local YCLOMIN = 207 -- Minimum height of mod clouds
|
2014-04-09 07:06:10 +02:00
|
|
|
local CLOUDS = true -- Mod clouds?
|
2014-02-20 13:24:02 +01:00
|
|
|
|
2014-03-25 05:08:40 +01:00
|
|
|
local TERSCA = 512 -- Vertical terrain scale
|
|
|
|
local XLSAMP = 0.2 -- Extra large scale height variation amplitude
|
2014-02-24 12:56:37 +01:00
|
|
|
local BASAMP = 0.4 -- Base terrain amplitude
|
2014-03-25 05:08:40 +01:00
|
|
|
local CANAMP = 0.4 -- Canyon terrain amplitude
|
2014-02-19 02:16:19 +01:00
|
|
|
local CANEXP = 1.33 -- Canyon shape exponent
|
2014-04-16 13:31:00 +02:00
|
|
|
local ATANAMP = 1.1 -- Arctan function amplitude, smaller = more and larger floatlands above ridges
|
2014-02-20 13:24:02 +01:00
|
|
|
|
2014-04-11 06:57:49 +02:00
|
|
|
local TSTONE = 0.02 -- Density threshold for stone, depth of soil at TERCEN
|
2014-04-02 03:44:33 +02:00
|
|
|
local TRIV = -0.02 -- Maximum densitybase threshold for river water
|
|
|
|
local TSAND = -0.025 -- Maximum densitybase threshold for river sand
|
2014-04-04 03:34:26 +02:00
|
|
|
local TLAVA = 2.3 -- Maximum densitybase threshold for lava, small because grad is non-linear
|
2014-04-14 07:01:05 +02:00
|
|
|
local FISEXP = 0.03 -- Fissure expansion rate under surface
|
2014-04-11 06:57:49 +02:00
|
|
|
local ORETHI = 0.002 -- Ore seam thickness tuner
|
2014-04-12 11:29:02 +02:00
|
|
|
local SEAMT = 0.2 -- Seam threshold, width of seams
|
2014-04-16 09:33:08 +02:00
|
|
|
local BERGDEP = 32 -- Maximum iceberg depth
|
2014-02-25 19:14:54 +01:00
|
|
|
|
2014-04-01 11:12:30 +02:00
|
|
|
local HITET = 0.35 -- High temperature threshold
|
|
|
|
local LOTET = -0.35 -- Low ..
|
2014-04-16 13:31:00 +02:00
|
|
|
local ICETET = -0.7 -- Ice ..
|
2014-04-01 11:12:30 +02:00
|
|
|
local HIHUT = 0.35 -- High humidity threshold
|
|
|
|
local LOHUT = -0.35 -- Low ..
|
2014-04-14 07:01:05 +02:00
|
|
|
local BLEND = 0.03 -- Biome blend randomness
|
2014-02-19 02:16:19 +01:00
|
|
|
|
2014-04-04 03:34:26 +02:00
|
|
|
local PINCHA = 36 -- Pine tree 1/x chance per node
|
|
|
|
local APTCHA = 36 -- Appletree
|
2014-02-19 23:28:36 +01:00
|
|
|
local FLOCHA = 36 -- Flower
|
|
|
|
local FOGCHA = 9 -- Forest grass
|
2014-04-16 13:31:00 +02:00
|
|
|
local GRACHA = 5 -- Grassland grasses
|
2014-02-19 23:28:36 +01:00
|
|
|
local JUTCHA = 16 -- Jungletree
|
|
|
|
local JUGCHA = 9 -- Junglegrass
|
2014-02-20 13:24:02 +01:00
|
|
|
local CACCHA = 841 -- Cactus
|
|
|
|
local DRYCHA = 169 -- Dry shrub
|
2014-04-13 11:03:51 +02:00
|
|
|
local PAPCHA = 2 -- Papyrus
|
2014-04-16 13:31:00 +02:00
|
|
|
local ACACHA = 841 -- Acacia tree
|
|
|
|
local GOGCHA = 5 -- Golden grass
|
|
|
|
local DUGCHA = 5 -- Dune grass
|
2014-02-15 10:50:29 +01:00
|
|
|
|
|
|
|
-- 3D noise for rough terrain
|
|
|
|
|
2014-02-17 15:43:35 +01:00
|
|
|
local np_rough = {
|
2014-02-15 10:50:29 +01:00
|
|
|
offset = 0,
|
|
|
|
scale = 1,
|
2014-02-17 15:43:35 +01:00
|
|
|
spread = {x=512, y=512, z=512},
|
|
|
|
seed = 593,
|
2014-02-15 10:50:29 +01:00
|
|
|
octaves = 6,
|
2014-04-19 20:52:33 +02:00
|
|
|
persist = 0.67
|
2014-02-15 10:50:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
-- 3D noise for smooth terrain
|
|
|
|
|
2014-02-17 15:43:35 +01:00
|
|
|
local np_smooth = {
|
2014-02-15 10:50:29 +01:00
|
|
|
offset = 0,
|
|
|
|
scale = 1,
|
2014-02-17 15:43:35 +01:00
|
|
|
spread = {x=512, y=512, z=512},
|
|
|
|
seed = 593,
|
2014-04-19 20:52:33 +02:00
|
|
|
octaves = 5,
|
|
|
|
persist = 0.33
|
|
|
|
}
|
|
|
|
|
|
|
|
-- 3D noise for alt rough terrain
|
|
|
|
|
|
|
|
local np_roughalt = {
|
|
|
|
offset = 0,
|
|
|
|
scale = 1,
|
|
|
|
spread = {x=414, y=414, z=414},
|
|
|
|
seed = -9003,
|
2014-04-14 07:01:05 +02:00
|
|
|
octaves = 6,
|
2014-04-19 20:52:33 +02:00
|
|
|
persist = 0.67
|
|
|
|
}
|
|
|
|
|
|
|
|
-- 3D noise for alt smooth terrain
|
|
|
|
|
|
|
|
local np_smoothalt = {
|
|
|
|
offset = 0,
|
|
|
|
scale = 1,
|
|
|
|
spread = {x=414, y=414, z=414},
|
|
|
|
seed = -9003,
|
|
|
|
octaves = 5,
|
2014-04-16 13:31:00 +02:00
|
|
|
persist = 0.33
|
2014-03-22 07:40:39 +01:00
|
|
|
}
|
|
|
|
|
2014-02-19 23:28:36 +01:00
|
|
|
-- 3D noise for fissures
|
2014-02-19 09:19:17 +01:00
|
|
|
|
2014-02-19 23:28:36 +01:00
|
|
|
local np_fissure = {
|
2014-02-19 09:19:17 +01:00
|
|
|
offset = 0,
|
|
|
|
scale = 1,
|
2014-02-19 23:28:36 +01:00
|
|
|
spread = {x=256, y=512, z=256},
|
|
|
|
seed = 20099,
|
|
|
|
octaves = 5,
|
|
|
|
persist = 0.5
|
2014-02-19 09:19:17 +01:00
|
|
|
}
|
|
|
|
|
2014-02-25 19:14:54 +01:00
|
|
|
-- 3D noise for temperature
|
2014-02-24 12:56:37 +01:00
|
|
|
|
2014-02-25 19:14:54 +01:00
|
|
|
local np_temp = {
|
2014-02-24 12:56:37 +01:00
|
|
|
offset = 0,
|
|
|
|
scale = 1,
|
2014-02-25 19:14:54 +01:00
|
|
|
spread = {x=512, y=512, z=512},
|
|
|
|
seed = 9130,
|
2014-04-16 13:31:00 +02:00
|
|
|
octaves = 3,
|
2014-02-25 19:14:54 +01:00
|
|
|
persist = 0.5
|
|
|
|
}
|
|
|
|
|
|
|
|
-- 3D noise for humidity
|
|
|
|
|
|
|
|
local np_humid = {
|
|
|
|
offset = 0,
|
|
|
|
scale = 1,
|
|
|
|
spread = {x=512, y=512, z=512},
|
|
|
|
seed = -55500,
|
2014-04-16 13:31:00 +02:00
|
|
|
octaves = 3,
|
2014-02-24 12:56:37 +01:00
|
|
|
persist = 0.5
|
|
|
|
}
|
|
|
|
|
2014-04-09 07:06:10 +02:00
|
|
|
-- 3D noise for ore seam networks
|
2014-03-05 11:41:34 +01:00
|
|
|
|
2014-04-09 07:06:10 +02:00
|
|
|
local np_seam = {
|
2014-03-05 11:41:34 +01:00
|
|
|
offset = 0,
|
|
|
|
scale = 1,
|
2014-04-10 06:27:59 +02:00
|
|
|
spread = {x=256, y=256, z=256},
|
2014-03-05 11:41:34 +01:00
|
|
|
seed = -992221,
|
2014-03-08 08:31:41 +01:00
|
|
|
octaves = 2,
|
|
|
|
persist = 0.5
|
|
|
|
}
|
|
|
|
|
2014-04-09 07:06:10 +02:00
|
|
|
-- 3D noise for rock strata inclination
|
2014-03-08 08:31:41 +01:00
|
|
|
|
|
|
|
local np_strata = {
|
|
|
|
offset = 0,
|
|
|
|
scale = 1,
|
2014-04-10 06:27:59 +02:00
|
|
|
spread = {x=512, y=512, z=512},
|
2014-03-08 08:31:41 +01:00
|
|
|
seed = 92219,
|
2014-04-16 13:31:00 +02:00
|
|
|
octaves = 3,
|
2014-03-05 11:41:34 +01:00
|
|
|
persist = 0.5
|
|
|
|
}
|
|
|
|
|
2014-04-11 06:57:49 +02:00
|
|
|
-- 2D noise for base terrain / riverbed height, terrain blend, river and river sand depth
|
2014-02-15 10:50:29 +01:00
|
|
|
|
2014-02-17 15:43:35 +01:00
|
|
|
local np_base = {
|
2014-02-15 10:50:29 +01:00
|
|
|
offset = 0,
|
|
|
|
scale = 1,
|
2014-02-17 15:43:35 +01:00
|
|
|
spread = {x=4096, y=4096, z=4096},
|
|
|
|
seed = 8890,
|
2014-02-19 02:16:19 +01:00
|
|
|
octaves = 4,
|
2014-04-16 13:31:00 +02:00
|
|
|
persist = 0.33
|
2014-02-15 10:50:29 +01:00
|
|
|
}
|
|
|
|
|
2014-02-19 09:19:17 +01:00
|
|
|
-- 2D noise for extra large scale height variation
|
|
|
|
|
|
|
|
local np_xlscale = {
|
|
|
|
offset = 0,
|
|
|
|
scale = 1,
|
|
|
|
spread = {x=8192, y=8192, z=8192},
|
|
|
|
seed = -72,
|
|
|
|
octaves = 3,
|
|
|
|
persist = 0.4
|
|
|
|
}
|
|
|
|
|
2014-04-02 03:44:33 +02:00
|
|
|
-- 2D noise for magma surface
|
2014-03-31 10:33:38 +02:00
|
|
|
|
|
|
|
local np_magma = {
|
|
|
|
offset = 0,
|
|
|
|
scale = 1,
|
|
|
|
spread = {x=128, y=128, z=128},
|
|
|
|
seed = -13,
|
2014-04-02 12:26:42 +02:00
|
|
|
octaves = 2,
|
2014-03-31 10:33:38 +02:00
|
|
|
persist = 0.5
|
|
|
|
}
|
|
|
|
|
2014-02-15 10:50:29 +01:00
|
|
|
-- Stuff
|
|
|
|
|
|
|
|
watershed = {}
|
|
|
|
|
2014-02-19 02:16:19 +01:00
|
|
|
dofile(minetest.get_modpath("watershed").."/nodes.lua")
|
|
|
|
dofile(minetest.get_modpath("watershed").."/functions.lua")
|
2014-02-15 10:50:29 +01:00
|
|
|
|
|
|
|
-- On generated function
|
|
|
|
|
|
|
|
minetest.register_on_generated(function(minp, maxp, seed)
|
|
|
|
if minp.y < YMIN or maxp.y > YMAX then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
local t1 = os.clock()
|
|
|
|
local x1 = maxp.x
|
|
|
|
local y1 = maxp.y
|
|
|
|
local z1 = maxp.z
|
|
|
|
local x0 = minp.x
|
|
|
|
local y0 = minp.y
|
|
|
|
local z0 = minp.z
|
|
|
|
|
|
|
|
print ("[watershed] chunk minp ("..x0.." "..y0.." "..z0..")")
|
2014-04-03 06:37:53 +02:00
|
|
|
-- voxelmanip stuff
|
2014-04-17 15:16:51 +02:00
|
|
|
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip") -- min, max points for emerged area/voxelarea
|
|
|
|
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax} -- voxelarea helper for indexes
|
|
|
|
local data = vm:get_data() -- get flat array of voxelarea content ids
|
|
|
|
-- content ids
|
2014-02-15 10:50:29 +01:00
|
|
|
local c_air = minetest.get_content_id("air")
|
2014-03-08 08:31:41 +01:00
|
|
|
local c_water = minetest.get_content_id("default:water_source")
|
|
|
|
local c_sand = minetest.get_content_id("default:sand")
|
|
|
|
local c_desand = minetest.get_content_id("default:desert_sand")
|
|
|
|
local c_snowblock = minetest.get_content_id("default:snowblock")
|
|
|
|
local c_ice = minetest.get_content_id("default:ice")
|
|
|
|
local c_dirtsnow = minetest.get_content_id("default:dirt_with_snow")
|
|
|
|
local c_jungrass = minetest.get_content_id("default:junglegrass")
|
|
|
|
local c_dryshrub = minetest.get_content_id("default:dry_shrub")
|
2014-03-22 07:40:39 +01:00
|
|
|
local c_danwhi = minetest.get_content_id("flowers:dandelion_white")
|
|
|
|
local c_danyel = minetest.get_content_id("flowers:dandelion_yellow")
|
|
|
|
local c_rose = minetest.get_content_id("flowers:rose")
|
|
|
|
local c_tulip = minetest.get_content_id("flowers:tulip")
|
|
|
|
local c_geranium = minetest.get_content_id("flowers:geranium")
|
|
|
|
local c_viola = minetest.get_content_id("flowers:viola")
|
2014-02-19 23:28:36 +01:00
|
|
|
local c_stodiam = minetest.get_content_id("default:stone_with_diamond")
|
2014-03-08 08:31:41 +01:00
|
|
|
local c_mese = minetest.get_content_id("default:mese")
|
2014-02-19 23:28:36 +01:00
|
|
|
local c_stogold = minetest.get_content_id("default:stone_with_gold")
|
|
|
|
local c_stocopp = minetest.get_content_id("default:stone_with_copper")
|
|
|
|
local c_stoiron = minetest.get_content_id("default:stone_with_iron")
|
|
|
|
local c_stocoal = minetest.get_content_id("default:stone_with_coal")
|
2014-03-05 11:41:34 +01:00
|
|
|
local c_sandstone = minetest.get_content_id("default:sandstone")
|
2014-03-08 08:31:41 +01:00
|
|
|
local c_gravel = minetest.get_content_id("default:gravel")
|
2014-03-12 02:01:46 +01:00
|
|
|
local c_clay = minetest.get_content_id("default:clay")
|
2014-03-31 06:16:20 +02:00
|
|
|
local c_grass5 = minetest.get_content_id("default:grass_5")
|
2014-04-01 11:12:30 +02:00
|
|
|
local c_obsidian = minetest.get_content_id("default:obsidian")
|
2014-02-17 15:43:35 +01:00
|
|
|
|
2014-04-09 07:06:10 +02:00
|
|
|
local c_wsfreshwater = minetest.get_content_id("watershed:freshwater")
|
2014-03-08 08:31:41 +01:00
|
|
|
local c_wsstone = minetest.get_content_id("watershed:stone")
|
|
|
|
local c_wsredstone = minetest.get_content_id("watershed:redstone")
|
|
|
|
local c_wsgrass = minetest.get_content_id("watershed:grass")
|
|
|
|
local c_wsdrygrass = minetest.get_content_id("watershed:drygrass")
|
2014-04-09 07:06:10 +02:00
|
|
|
local c_wsgoldengrass = minetest.get_content_id("watershed:goldengrass")
|
2014-03-08 08:31:41 +01:00
|
|
|
local c_wsdirt = minetest.get_content_id("watershed:dirt")
|
|
|
|
local c_wspermafrost = minetest.get_content_id("watershed:permafrost")
|
2014-03-30 08:34:18 +02:00
|
|
|
local c_wslava = minetest.get_content_id("watershed:lava")
|
2014-04-09 07:06:10 +02:00
|
|
|
local c_wsfreshice = minetest.get_content_id("watershed:freshice")
|
|
|
|
local c_wscloud = minetest.get_content_id("watershed:cloud")
|
2014-04-10 06:27:59 +02:00
|
|
|
local c_wsluxoreoff = minetest.get_content_id("watershed:luxoreoff")
|
2014-04-19 20:52:33 +02:00
|
|
|
local c_wsicydirt = minetest.get_content_id("watershed:icydirt")
|
2014-04-03 06:37:53 +02:00
|
|
|
-- perlinmap stuff
|
2014-04-17 15:16:51 +02:00
|
|
|
local sidelen = x1 - x0 + 1 -- chunk sidelength
|
|
|
|
local chulens = {x=sidelen, y=sidelen+2, z=sidelen} -- chunk dimensions, '+2' for overgeneration
|
|
|
|
local minposxyz = {x=x0, y=y0-1, z=z0} -- 3D and 2D perlinmaps start from these co-ordinates, '-1' for overgeneration
|
2014-02-15 10:50:29 +01:00
|
|
|
local minposxz = {x=x0, y=z0}
|
2014-04-17 15:16:51 +02:00
|
|
|
-- 3D and 2D perlinmaps
|
2014-02-17 15:43:35 +01:00
|
|
|
local nvals_rough = minetest.get_perlin_map(np_rough, chulens):get3dMap_flat(minposxyz)
|
|
|
|
local nvals_smooth = minetest.get_perlin_map(np_smooth, chulens):get3dMap_flat(minposxyz)
|
2014-04-19 20:52:33 +02:00
|
|
|
local nvals_roughalt = minetest.get_perlin_map(np_roughalt, chulens):get3dMap_flat(minposxyz)
|
|
|
|
local nvals_smoothalt = minetest.get_perlin_map(np_smoothalt, chulens):get3dMap_flat(minposxyz)
|
2014-02-19 23:28:36 +01:00
|
|
|
local nvals_fissure = minetest.get_perlin_map(np_fissure, chulens):get3dMap_flat(minposxyz)
|
2014-02-25 19:14:54 +01:00
|
|
|
local nvals_temp = minetest.get_perlin_map(np_temp, chulens):get3dMap_flat(minposxyz)
|
|
|
|
local nvals_humid = minetest.get_perlin_map(np_humid, chulens):get3dMap_flat(minposxyz)
|
2014-04-09 07:06:10 +02:00
|
|
|
local nvals_seam = minetest.get_perlin_map(np_seam, chulens):get3dMap_flat(minposxyz)
|
2014-03-08 08:31:41 +01:00
|
|
|
local nvals_strata = minetest.get_perlin_map(np_strata, chulens):get3dMap_flat(minposxyz)
|
2014-02-15 10:50:29 +01:00
|
|
|
|
2014-02-17 15:43:35 +01:00
|
|
|
local nvals_base = minetest.get_perlin_map(np_base, chulens):get2dMap_flat(minposxz)
|
2014-02-19 09:19:17 +01:00
|
|
|
local nvals_xlscale = minetest.get_perlin_map(np_xlscale, chulens):get2dMap_flat(minposxz)
|
2014-03-31 10:33:38 +02:00
|
|
|
local nvals_magma = minetest.get_perlin_map(np_magma, chulens):get2dMap_flat(minposxz)
|
2014-02-15 10:50:29 +01:00
|
|
|
|
2014-03-29 01:57:57 +01:00
|
|
|
local ungen = false -- ungenerated chunk below?
|
|
|
|
if minetest.get_node({x=x0, y=y0-1, z=z0}).name == "ignore" then
|
|
|
|
ungen = true
|
|
|
|
end
|
2014-04-03 06:37:53 +02:00
|
|
|
-- mapgen loop
|
2014-04-17 15:16:51 +02:00
|
|
|
local nixyz = 1 -- 3D and 2D perlinmap indexes
|
2014-02-15 10:50:29 +01:00
|
|
|
local nixz = 1
|
2014-04-12 11:29:02 +02:00
|
|
|
local stable = {} -- stability table of true/false. is node supported from below by 2 stone or nodes on 2 stone?
|
2014-04-03 06:37:53 +02:00
|
|
|
local under = {} -- biome table. biome number of previous fine material placed in column
|
2014-02-15 10:50:29 +01:00
|
|
|
for z = z0, z1 do -- for each xy plane progressing northwards
|
2014-03-29 01:57:57 +01:00
|
|
|
for y = y0 - 1, y1 + 1 do -- for each x row progressing upwards
|
2014-04-17 15:16:51 +02:00
|
|
|
local vi = area:index(x0, y, z) -- voxelmanip index for first node in this x row
|
|
|
|
local viu = area:index(x0, y-1, z) -- index for under node
|
2014-02-15 10:50:29 +01:00
|
|
|
for x = x0, x1 do -- for each node do
|
2014-04-03 06:37:53 +02:00
|
|
|
local si = x - x0 + 1 -- stable, under tables index
|
2014-04-17 15:16:51 +02:00
|
|
|
-- noise values for node
|
|
|
|
local n_rough = nvals_rough[nixyz]
|
2014-04-12 11:29:02 +02:00
|
|
|
local n_smooth = nvals_smooth[nixyz]
|
2014-04-19 20:52:33 +02:00
|
|
|
local n_roughalt = nvals_roughalt[nixyz]
|
|
|
|
local n_smoothalt = nvals_smoothalt[nixyz]
|
2014-04-12 11:29:02 +02:00
|
|
|
local n_fissure = nvals_fissure[nixyz]
|
2014-04-16 09:33:08 +02:00
|
|
|
local n_temp = nvals_temp[nixyz]
|
|
|
|
local n_humid = nvals_humid[nixyz]
|
2014-04-12 11:29:02 +02:00
|
|
|
local n_seam = nvals_seam[nixyz]
|
2014-04-11 06:57:49 +02:00
|
|
|
local n_strata = nvals_strata[nixyz]
|
2014-04-12 11:29:02 +02:00
|
|
|
|
|
|
|
local n_base = nvals_base[nixz]
|
|
|
|
local n_xlscale = nvals_xlscale[nixz]
|
|
|
|
local n_magma = nvals_magma[nixz]
|
2014-04-14 07:01:05 +02:00
|
|
|
-- get densitybase and density
|
|
|
|
local grad = math.atan((TERCEN - y) / TERSCA) * ATANAMP -- vertical density gradient
|
2014-04-17 15:16:51 +02:00
|
|
|
local densitybase = (1 - math.abs(n_base)) * BASAMP + n_xlscale * XLSAMP + grad -- base terrain
|
|
|
|
local terblen = math.max(1 - math.abs(n_base), 0) -- canyon terrain blend of rough and smooth
|
2014-04-19 20:52:33 +02:00
|
|
|
local density = densitybase + -- add canyon terrain
|
|
|
|
math.abs((n_rough + n_roughalt) * 0.5 * terblen +
|
|
|
|
(n_smooth + n_smoothalt) * 0.25 * (1 - terblen)) ^ CANEXP * CANAMP
|
2014-04-17 15:16:51 +02:00
|
|
|
-- other values
|
|
|
|
local triv = TRIV * (1 - terblen) -- river threshold
|
|
|
|
local tsand = TSAND * (1 - terblen) -- sand threshold
|
|
|
|
local tstone = TSTONE * (1 + grad * 0.5) -- stone threshold
|
|
|
|
local tlava = TLAVA * (1 - n_magma ^ 4 * terblen ^ 16 * 0.5) -- lava threshold
|
|
|
|
local ysand = YSAV + n_fissure * SAMP + math.random() * 2 -- sandline
|
|
|
|
local bergdep = math.abs(n_seam) * BERGDEP -- iceberg depth
|
2014-04-09 07:06:10 +02:00
|
|
|
|
|
|
|
local nofis = false -- set fissure bool
|
2014-04-12 11:29:02 +02:00
|
|
|
if math.abs(n_fissure) > math.sqrt(density) * FISEXP then
|
2014-04-09 07:06:10 +02:00
|
|
|
nofis = true
|
2014-02-19 23:28:36 +01:00
|
|
|
end
|
2014-04-16 09:33:08 +02:00
|
|
|
|
|
|
|
local biome = false -- select biome for node
|
|
|
|
if n_temp < LOTET + (math.random() - 0.5) * BLEND then
|
|
|
|
if n_humid < LOHUT + (math.random() - 0.5) * BLEND then
|
|
|
|
biome = 1 -- tundra
|
|
|
|
elseif n_humid > HIHUT + (math.random() - 0.5) * BLEND then
|
|
|
|
biome = 3 -- taiga
|
|
|
|
else
|
|
|
|
biome = 2 -- snowy plains
|
|
|
|
end
|
|
|
|
elseif n_temp > HITET + (math.random() - 0.5) * BLEND then
|
|
|
|
if n_humid < LOHUT + (math.random() - 0.5) * BLEND then
|
|
|
|
biome = 7 -- desert
|
|
|
|
elseif n_humid > HIHUT + (math.random() - 0.5) * BLEND then
|
|
|
|
biome = 9 -- rainforest
|
|
|
|
else
|
|
|
|
biome = 8 -- savanna
|
|
|
|
end
|
|
|
|
else
|
|
|
|
if n_humid < LOHUT then
|
|
|
|
biome = 4 -- dry grassland
|
|
|
|
elseif n_humid > HIHUT then
|
|
|
|
biome = 6 -- deciduous forest
|
|
|
|
else
|
|
|
|
biome = 5 -- grassland
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-04-04 03:34:26 +02:00
|
|
|
-- overgeneration and in-chunk generation
|
2014-04-16 13:31:00 +02:00
|
|
|
if y == y0 - 1 then -- node layer below chunk, initialise tables
|
2014-04-20 09:13:14 +02:00
|
|
|
under[si] = 0
|
2014-03-29 01:57:57 +01:00
|
|
|
if ungen then
|
2014-04-16 09:33:08 +02:00
|
|
|
if nofis and density >= 0 then -- if node solid
|
2014-03-29 01:57:57 +01:00
|
|
|
stable[si] = 2
|
|
|
|
else
|
|
|
|
stable[si] = 0
|
|
|
|
end
|
2014-04-09 07:06:10 +02:00
|
|
|
else -- scan top layer of chunk below
|
2014-03-29 01:57:57 +01:00
|
|
|
local nodename = minetest.get_node({x=x,y=y,z=z}).name
|
|
|
|
if nodename == "watershed:stone"
|
|
|
|
or nodename == "watershed:redstone"
|
|
|
|
or nodename == "watershed:dirt"
|
|
|
|
or nodename == "watershed:permafrost"
|
2014-04-16 09:33:08 +02:00
|
|
|
or nodename == "watershed:luxoreoff"
|
2014-03-29 01:57:57 +01:00
|
|
|
or nodename == "default:sand"
|
|
|
|
or nodename == "default:desert_sand"
|
2014-04-16 09:33:08 +02:00
|
|
|
or nodename == "default:mese"
|
|
|
|
or nodename == "default:stone_with_diamond"
|
|
|
|
or nodename == "default:stone_with_gold"
|
|
|
|
or nodename == "default:stone_with_copper"
|
|
|
|
or nodename == "default:stone_with_iron"
|
|
|
|
or nodename == "default:stone_with_coal"
|
|
|
|
or nodename == "default:sandstone"
|
|
|
|
or nodename == "default:gravel"
|
|
|
|
or nodename == "default:clay"
|
|
|
|
or nodename == "default:obsidian" then
|
2014-03-29 01:57:57 +01:00
|
|
|
stable[si] = 2
|
|
|
|
else
|
|
|
|
stable[si] = 0
|
|
|
|
end
|
2014-02-25 19:14:54 +01:00
|
|
|
end
|
2014-04-16 09:33:08 +02:00
|
|
|
elseif y >= y0 and y <= y1 then -- chunk
|
2014-04-13 11:03:51 +02:00
|
|
|
-- add nodes and flora
|
2014-04-03 06:37:53 +02:00
|
|
|
if densitybase >= tlava then -- lava
|
2014-04-02 12:26:42 +02:00
|
|
|
if densitybase >= 0 then
|
2014-04-01 11:12:30 +02:00
|
|
|
data[vi] = c_wslava
|
|
|
|
end
|
2014-03-31 10:33:38 +02:00
|
|
|
stable[si] = 0
|
|
|
|
under[si] = 0
|
2014-04-04 08:17:26 +02:00
|
|
|
elseif densitybase >= tlava - math.min(0.6 + density * 6, 0.6) and density < tstone then -- obsidian
|
2014-04-01 11:12:30 +02:00
|
|
|
data[vi] = c_obsidian
|
|
|
|
stable[si] = 1
|
|
|
|
under[si] = 0
|
2014-03-31 10:33:38 +02:00
|
|
|
elseif density >= tstone and nofis -- stone cut by fissures
|
2014-04-11 06:57:49 +02:00
|
|
|
or (density >= tstone and density < TSTONE * 2 and y <= YWAT) -- stone around water
|
|
|
|
or (density >= tstone and density < TSTONE * 2 and densitybase >= triv ) then -- stone around river
|
|
|
|
local densitystr = n_strata * 0.25 + (TERCEN - y) / TERSCA
|
2014-03-29 01:57:57 +01:00
|
|
|
local densityper = densitystr - math.floor(densitystr) -- periodic strata 'density'
|
2014-04-11 06:57:49 +02:00
|
|
|
if (densityper >= 0.05 and densityper <= 0.09) -- sandstone strata
|
|
|
|
or (densityper >= 0.25 and densityper <= 0.28)
|
2014-03-29 01:57:57 +01:00
|
|
|
or (densityper >= 0.45 and densityper <= 0.47)
|
2014-04-11 06:57:49 +02:00
|
|
|
or (densityper >= 0.74 and densityper <= 0.76)
|
|
|
|
or (densityper >= 0.77 and densityper <= 0.79)
|
2014-03-29 01:57:57 +01:00
|
|
|
or (densityper >= 0.84 and densityper <= 0.87)
|
2014-04-11 06:57:49 +02:00
|
|
|
or (densityper >= 0.95 and densityper <= 0.98) then
|
2014-03-29 01:57:57 +01:00
|
|
|
data[vi] = c_sandstone
|
2014-04-13 11:03:51 +02:00
|
|
|
elseif biome == 7 and density < TSTONE * 4 then -- desert stone as surface layer
|
2014-03-29 01:57:57 +01:00
|
|
|
data[vi] = c_wsredstone
|
2014-04-17 15:16:51 +02:00
|
|
|
elseif math.abs(n_seam) < SEAMT then
|
|
|
|
if densityper >= 0 and densityper <= ORETHI * 4 then -- ore seams
|
2014-04-11 06:57:49 +02:00
|
|
|
data[vi] = c_stocoal
|
|
|
|
elseif densityper >= 0.3 and densityper <= 0.3 + ORETHI * 4 then
|
2014-03-29 01:57:57 +01:00
|
|
|
data[vi] = c_stocoal
|
|
|
|
elseif densityper >= 0.5 and densityper <= 0.5 + ORETHI * 4 then
|
2014-04-11 06:57:49 +02:00
|
|
|
data[vi] = c_stocoal
|
|
|
|
elseif densityper >= 0.8 and densityper <= 0.8 + ORETHI * 4 then
|
|
|
|
data[vi] = c_stocoal
|
|
|
|
elseif densityper >= 0.55 and densityper <= 0.55 + ORETHI * 2 then
|
2014-03-29 01:57:57 +01:00
|
|
|
data[vi] = c_gravel
|
2014-04-11 06:57:49 +02:00
|
|
|
elseif densityper >= 0.1 and densityper <= 0.1 + ORETHI * 2 then
|
|
|
|
data[vi] = c_wsluxoreoff
|
|
|
|
elseif densityper >= 0.2 and densityper <= 0.2 + ORETHI * 2
|
2014-04-17 15:16:51 +02:00
|
|
|
and math.random(2) == 2 then
|
|
|
|
data[vi] = c_stoiron
|
|
|
|
elseif densityper >= 0.65 and densityper <= 0.65 + ORETHI * 2
|
2014-04-10 06:27:59 +02:00
|
|
|
and math.random(2) == 2 then
|
2014-03-29 01:57:57 +01:00
|
|
|
data[vi] = c_stoiron
|
2014-04-11 06:57:49 +02:00
|
|
|
elseif densityper >= 0.4 and densityper <= 0.4 + ORETHI * 2
|
2014-04-10 06:27:59 +02:00
|
|
|
and math.random(3) == 2 then
|
2014-03-29 01:57:57 +01:00
|
|
|
data[vi] = c_stocopp
|
2014-04-11 06:57:49 +02:00
|
|
|
elseif densityper >= 0.6 and densityper <= 0.6 + ORETHI
|
|
|
|
and math.random(5) == 2 then
|
|
|
|
data[vi] = c_stogold
|
|
|
|
elseif densityper >= 0.7 and densityper <= 0.7 + ORETHI
|
2014-04-10 06:27:59 +02:00
|
|
|
and math.random(7) == 2 then
|
2014-03-29 01:57:57 +01:00
|
|
|
data[vi] = c_mese
|
2014-04-11 06:57:49 +02:00
|
|
|
elseif densityper >= 0.9 and densityper <= 0.9 + ORETHI
|
|
|
|
and math.random(11) == 2 then
|
|
|
|
data[vi] = c_stodiam
|
2014-03-29 01:57:57 +01:00
|
|
|
else
|
|
|
|
data[vi] = c_wsstone
|
|
|
|
end
|
2014-03-08 08:31:41 +01:00
|
|
|
else
|
|
|
|
data[vi] = c_wsstone
|
|
|
|
end
|
2014-03-29 01:57:57 +01:00
|
|
|
stable[si] = stable[si] + 1
|
|
|
|
under[si] = 0
|
|
|
|
elseif density >= 0 and density < tstone and stable[si] >= 2 then -- fine materials
|
|
|
|
if y == YWAT - 2 and math.abs(n_temp) < 0.05 then -- clay
|
|
|
|
data[vi] = c_clay
|
2014-04-15 09:03:32 +02:00
|
|
|
elseif y <= ysand then -- seabed/beach/dune sand not cut by fissures
|
2014-04-13 11:03:51 +02:00
|
|
|
data[vi] = c_sand
|
|
|
|
under[si] = 10 -- beach/dunes
|
|
|
|
elseif densitybase >= tsand + math.random() * 0.003 then -- river sand not cut by fissures
|
2014-03-29 01:57:57 +01:00
|
|
|
data[vi] = c_sand
|
2014-04-13 11:03:51 +02:00
|
|
|
under[si] = 11 -- riverbank
|
2014-03-29 01:57:57 +01:00
|
|
|
elseif nofis then -- fine materials cut by fissures
|
2014-04-01 05:28:21 +02:00
|
|
|
if biome == 1 then
|
|
|
|
data[vi] = c_wspermafrost
|
|
|
|
under[si] = 1 -- tundra
|
|
|
|
elseif biome == 2 then
|
2014-03-29 01:57:57 +01:00
|
|
|
data[vi] = c_wsdirt
|
2014-04-01 05:28:21 +02:00
|
|
|
under[si] = 2 -- snowy plains
|
2014-03-29 01:57:57 +01:00
|
|
|
elseif biome == 3 then
|
|
|
|
data[vi] = c_wsdirt
|
2014-04-01 05:28:21 +02:00
|
|
|
under[si] = 3 -- taiga
|
2014-03-29 01:57:57 +01:00
|
|
|
elseif biome == 4 then
|
|
|
|
data[vi] = c_wsdirt
|
2014-04-01 05:28:21 +02:00
|
|
|
under[si] = 4 -- dry grassland
|
2014-03-29 01:57:57 +01:00
|
|
|
elseif biome == 5 then
|
|
|
|
data[vi] = c_wsdirt
|
2014-04-01 05:28:21 +02:00
|
|
|
under[si] = 5 -- grassland
|
|
|
|
elseif biome == 6 then
|
|
|
|
data[vi] = c_wsdirt
|
|
|
|
under[si] = 6 -- forest
|
|
|
|
elseif biome == 7 then
|
|
|
|
data[vi] = c_desand
|
|
|
|
under[si] = 7 -- desert
|
|
|
|
elseif biome == 8 then
|
|
|
|
data[vi] = c_wsdirt
|
|
|
|
under[si] = 8 -- savanna
|
|
|
|
elseif biome == 9 then
|
2014-03-29 01:57:57 +01:00
|
|
|
data[vi] = c_wsdirt
|
2014-04-01 05:28:21 +02:00
|
|
|
under[si] = 9 -- rainforest
|
2014-03-29 01:57:57 +01:00
|
|
|
end
|
|
|
|
else -- fissure
|
|
|
|
stable[si] = 0
|
|
|
|
under[si] = 0
|
|
|
|
end
|
2014-04-16 09:33:08 +02:00
|
|
|
elseif y >= YWAT - bergdep and y <= YWAT + bergdep / 8 and n_temp < ICETET -- iceberg
|
|
|
|
and density < tstone and math.abs(n_fissure) > 0.01 then
|
|
|
|
data[vi] = c_ice
|
|
|
|
under[si] = 12
|
2014-02-19 23:28:36 +01:00
|
|
|
stable[si] = 0
|
2014-04-16 09:33:08 +02:00
|
|
|
elseif y <= YWAT and density < tstone then -- sea water
|
|
|
|
data[vi] = c_water
|
2014-02-19 23:28:36 +01:00
|
|
|
under[si] = 0
|
2014-04-16 09:33:08 +02:00
|
|
|
stable[si] = 0
|
|
|
|
elseif densitybase >= triv and density < tstone then -- river water not in fissures
|
2014-03-29 01:57:57 +01:00
|
|
|
if n_temp < ICETET then
|
2014-04-09 07:06:10 +02:00
|
|
|
data[vi] = c_wsfreshice
|
2014-03-29 01:57:57 +01:00
|
|
|
else
|
2014-04-09 07:06:10 +02:00
|
|
|
data[vi] = c_wsfreshwater
|
2014-02-20 08:18:40 +01:00
|
|
|
end
|
2014-03-29 01:57:57 +01:00
|
|
|
stable[si] = 0
|
|
|
|
under[si] = 0
|
2014-04-15 09:03:32 +02:00
|
|
|
elseif CLOUDS and y == y1 and y >= YCLOMIN then -- clouds
|
2014-03-29 01:57:57 +01:00
|
|
|
local xrq = 16 * math.floor((x - x0) / 16) -- quantise to 16x16 lattice
|
|
|
|
local zrq = 16 * math.floor((z - z0) / 16)
|
2014-04-09 07:06:10 +02:00
|
|
|
local yrq = 79
|
|
|
|
local qixyz = zrq * 6400 + yrq * 80 + xrq + 1 -- quantised 3D index
|
|
|
|
if math.abs(nvals_fissure[qixyz]) < nvals_humid[qixyz] * 0.1 then
|
|
|
|
data[vi] = c_wscloud
|
2014-03-05 11:41:34 +01:00
|
|
|
end
|
2014-03-29 01:57:57 +01:00
|
|
|
stable[si] = 0
|
|
|
|
under[si] = 0
|
|
|
|
else -- possible above surface air node
|
2014-04-16 09:33:08 +02:00
|
|
|
if y > YWAT and under[si] ~= 0 then
|
2014-04-15 09:03:32 +02:00
|
|
|
local fnoise = n_fissure -- noise for flower colours
|
2014-03-29 01:57:57 +01:00
|
|
|
if under[si] == 1 then
|
2014-04-19 20:52:33 +02:00
|
|
|
data[viu] = c_wsicydirt
|
|
|
|
if math.random(DRYCHA) == 2 then
|
|
|
|
data[vi] = c_dryshrub
|
2014-03-29 01:57:57 +01:00
|
|
|
end
|
|
|
|
elseif under[si] == 2 then
|
2014-04-01 05:28:21 +02:00
|
|
|
data[viu] = c_dirtsnow
|
|
|
|
data[vi] = c_snowblock
|
|
|
|
elseif under[si] == 3 then
|
|
|
|
if math.random(PINCHA) == 2 then
|
2014-03-29 01:57:57 +01:00
|
|
|
watershed_pinetree(x, y, z, area, data)
|
|
|
|
else
|
|
|
|
data[viu] = c_dirtsnow
|
|
|
|
data[vi] = c_snowblock
|
|
|
|
end
|
2014-04-01 05:28:21 +02:00
|
|
|
elseif under[si] == 4 then
|
2014-02-25 19:14:54 +01:00
|
|
|
data[viu] = c_wsdrygrass
|
2014-03-29 01:57:57 +01:00
|
|
|
if math.random(GRACHA) == 2 then
|
|
|
|
if math.random(5) == 2 then
|
2014-04-09 07:06:10 +02:00
|
|
|
data[vi] = c_wsgoldengrass
|
2014-03-29 01:57:57 +01:00
|
|
|
else
|
|
|
|
data[vi] = c_dryshrub
|
|
|
|
end
|
2014-02-25 19:14:54 +01:00
|
|
|
end
|
2014-04-01 05:28:21 +02:00
|
|
|
elseif under[si] == 5 then
|
2014-02-19 02:16:19 +01:00
|
|
|
data[viu] = c_wsgrass
|
2014-02-19 09:19:17 +01:00
|
|
|
if math.random(FLOCHA) == 2 then
|
2014-03-22 07:40:39 +01:00
|
|
|
watershed_flower(data, vi, fnoise)
|
2014-03-29 01:57:57 +01:00
|
|
|
elseif math.random(GRACHA) == 2 then
|
2014-03-31 06:16:20 +02:00
|
|
|
data[vi] = c_grass5
|
2014-02-19 09:19:17 +01:00
|
|
|
end
|
2014-04-01 05:28:21 +02:00
|
|
|
elseif under[si] == 6 then
|
|
|
|
if math.random(APTCHA) == 2 then
|
|
|
|
watershed_appletree(x, y, z, area, data)
|
2014-02-19 02:16:19 +01:00
|
|
|
else
|
2014-03-29 01:57:57 +01:00
|
|
|
data[viu] = c_wsgrass
|
2014-04-01 05:28:21 +02:00
|
|
|
if math.random(FLOCHA) == 2 then
|
|
|
|
data[viu] = c_wsgrass
|
|
|
|
watershed_flower(data, vi, fnoise)
|
|
|
|
elseif math.random(FOGCHA) == 2 then
|
|
|
|
data[viu] = c_wsgrass
|
|
|
|
data[vi] = c_grass5
|
2014-03-29 01:57:57 +01:00
|
|
|
end
|
|
|
|
end
|
2014-04-01 05:28:21 +02:00
|
|
|
elseif under[si] == 7 and n_temp < HITET + 0.1 then
|
|
|
|
if math.random(CACCHA) == 2 then
|
|
|
|
watershed_cactus(x, y, z, area, data)
|
|
|
|
elseif math.random(DRYCHA) == 2 then
|
|
|
|
data[vi] = c_dryshrub
|
|
|
|
end
|
|
|
|
elseif under[si] == 8 then
|
2014-03-29 01:57:57 +01:00
|
|
|
if math.random(ACACHA) == 2 then
|
|
|
|
watershed_acaciatree(x, y, z, area, data)
|
|
|
|
else
|
|
|
|
data[viu] = c_wsdrygrass
|
|
|
|
if math.random(GOGCHA) == 2 then
|
2014-04-09 07:06:10 +02:00
|
|
|
data[vi] = c_wsgoldengrass
|
2014-03-29 01:57:57 +01:00
|
|
|
end
|
|
|
|
end
|
2014-04-01 05:28:21 +02:00
|
|
|
elseif under[si] == 9 then
|
|
|
|
if math.random(JUTCHA) == 2 then
|
|
|
|
watershed_jungletree(x, y, z, area, data)
|
|
|
|
else
|
|
|
|
data[viu] = c_wsgrass
|
|
|
|
if math.random(JUGCHA) == 2 then
|
|
|
|
data[vi] = c_jungrass
|
|
|
|
end
|
2014-02-19 02:16:19 +01:00
|
|
|
end
|
2014-04-16 09:33:08 +02:00
|
|
|
elseif under[si] == 10 then -- dunes
|
2014-04-15 09:03:32 +02:00
|
|
|
if math.random(DUGCHA) == 2 and y > YSAV
|
|
|
|
and biome >= 4 then
|
|
|
|
data[vi] = c_wsgoldengrass
|
|
|
|
end
|
2014-04-19 20:52:33 +02:00
|
|
|
elseif under[si] == 11 and n_temp > HITET then -- hot biome riverbank
|
2014-04-13 11:03:51 +02:00
|
|
|
if math.random(PAPCHA) == 2 then
|
|
|
|
watershed_papyrus(x, y, z, area, data)
|
|
|
|
end
|
2014-04-19 20:52:33 +02:00
|
|
|
elseif under[si] == 12 and n_humid > LOHUT then -- snowy iceberg
|
2014-04-16 09:33:08 +02:00
|
|
|
data[vi] = c_snowblock
|
2014-02-19 02:16:19 +01:00
|
|
|
end
|
2014-03-29 01:57:57 +01:00
|
|
|
end
|
|
|
|
stable[si] = 0
|
|
|
|
under[si] = 0
|
|
|
|
end
|
|
|
|
elseif y == y1 + 1 then -- plane of nodes above chunk
|
|
|
|
if density < 0 and y >= YWAT + 1 and under[si] ~= 0 then -- if air above fine materials
|
|
|
|
if under[si] == 1 then -- add surface nodes to chunk top layer
|
2014-04-19 20:52:33 +02:00
|
|
|
data[viu] = c_wsicydirt
|
2014-03-29 01:57:57 +01:00
|
|
|
elseif under[si] == 2 then
|
|
|
|
data[viu] = c_dirtsnow
|
2014-04-20 09:13:14 +02:00
|
|
|
data[vi] = c_snowblock -- snowblocks in chunk above
|
2014-03-29 01:57:57 +01:00
|
|
|
elseif under[si] == 3 then
|
2014-04-01 11:12:30 +02:00
|
|
|
data[viu] = c_dirtsnow
|
2014-04-20 09:13:14 +02:00
|
|
|
data[vi] = c_snowblock
|
2014-02-19 02:16:19 +01:00
|
|
|
elseif under[si] == 4 then
|
2014-04-01 11:12:30 +02:00
|
|
|
data[viu] = c_wsdrygrass
|
|
|
|
elseif under[si] == 5 then
|
2014-02-25 19:14:54 +01:00
|
|
|
data[viu] = c_wsgrass
|
2014-04-01 11:12:30 +02:00
|
|
|
elseif under[si] == 6 then
|
2014-03-29 01:57:57 +01:00
|
|
|
data[viu] = c_wsgrass
|
2014-04-01 11:12:30 +02:00
|
|
|
elseif under[si] == 8 then
|
2014-03-29 01:57:57 +01:00
|
|
|
data[viu] = c_wsdrygrass
|
2014-04-01 11:12:30 +02:00
|
|
|
elseif under[si] == 9 then
|
|
|
|
data[viu] = c_wsgrass
|
2014-02-19 02:16:19 +01:00
|
|
|
end
|
|
|
|
end
|
2014-02-15 10:50:29 +01:00
|
|
|
end
|
2014-04-17 15:16:51 +02:00
|
|
|
nixyz = nixyz + 1 -- increment perlinmap and voxelarea indexes along x row
|
2014-02-19 09:19:17 +01:00
|
|
|
nixz = nixz + 1
|
2014-02-15 10:50:29 +01:00
|
|
|
vi = vi + 1
|
2014-02-19 02:16:19 +01:00
|
|
|
viu = viu + 1
|
2014-02-15 10:50:29 +01:00
|
|
|
end
|
2014-02-19 09:19:17 +01:00
|
|
|
nixz = nixz - 80
|
2014-02-15 10:50:29 +01:00
|
|
|
end
|
2014-02-19 09:19:17 +01:00
|
|
|
nixz = nixz + 80
|
2014-02-15 10:50:29 +01:00
|
|
|
end
|
2014-04-03 06:37:53 +02:00
|
|
|
-- voxelmanip stuff
|
2014-02-15 10:50:29 +01:00
|
|
|
vm:set_data(data)
|
2014-04-11 07:43:57 +02:00
|
|
|
vm:set_lighting({day=0, night=0})
|
|
|
|
vm:calc_lighting()
|
2014-02-15 10:50:29 +01:00
|
|
|
vm:write_to_map(data)
|
2014-04-03 06:37:53 +02:00
|
|
|
|
|
|
|
local chugent = math.ceil((os.clock() - t1) * 1000) -- chunk generation time
|
2014-02-17 15:43:35 +01:00
|
|
|
print ("[watershed] "..chugent.." ms")
|
2014-02-15 10:50:29 +01:00
|
|
|
end)
|