Compare commits
10 Commits
7f28c5b849
...
9ed70192aa
Author | SHA1 | Date | |
---|---|---|---|
|
9ed70192aa | ||
|
c65ce34226 | ||
|
2c41bf50d4 | ||
|
7ecd043206 | ||
|
c9a2401fd4 | ||
|
6b675f18fd | ||
|
59c558d193 | ||
|
a5e58a4e7c | ||
|
a2de0ee125 | ||
|
2d786b8318 |
@ -1,4 +1,4 @@
|
||||
watershed 0.5.0 by paramat
|
||||
For latest stable Minetest back to 0.4.8
|
||||
Depends default stairs
|
||||
Licenses: code WTFPL, textures CC BY-SA
|
||||
watershed 0.7.2 by paramat
|
||||
For Minetest 0.4.13 and later
|
||||
Depends default stairs bucket
|
||||
Licenses: Source code LGPL (2.1). Media (textures) CC BY-SA (3.0)
|
||||
|
179
functions.lua
179
functions.lua
@ -210,137 +210,6 @@ function watershed_papyrus(x, y, z, area, data)
|
||||
end
|
||||
end
|
||||
|
||||
-- Singlenode option
|
||||
|
||||
local SINGLENODE = true
|
||||
|
||||
if SINGLENODE then
|
||||
-- Set mapgen parameters
|
||||
|
||||
minetest.register_on_mapgen_init(function(mgparams)
|
||||
minetest.set_mapgen_params({mgname="singlenode"})
|
||||
end)
|
||||
|
||||
-- Spawn player
|
||||
|
||||
function spawnplayer(player)
|
||||
local TERCEN = -128 -- Terrain 'centre', average seabed level
|
||||
local TERSCA = 512 -- Vertical terrain scale
|
||||
local XLSAMP = 0.1 -- Extra large scale height variation amplitude
|
||||
local BASAMP = 0.3 -- Base terrain amplitude
|
||||
local MIDAMP = 0.1 -- Mid terrain amplitude
|
||||
local CANAMP = 0.4 -- Canyon terrain maximum amplitude
|
||||
local ATANAMP = 1.1
|
||||
local BLENEXP = 2
|
||||
local xsp
|
||||
local ysp
|
||||
local zsp
|
||||
local np_terrain = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=384, y=192, z=384},
|
||||
seed = 593,
|
||||
octaves = 5,
|
||||
persist = 0.67
|
||||
}
|
||||
local np_mid = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=768, y=768, z=768},
|
||||
seed = 85546,
|
||||
octaves = 5,
|
||||
persist = 0.5
|
||||
}
|
||||
local np_base = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=4096, y=4096, z=4096},
|
||||
seed = 8890,
|
||||
octaves = 3,
|
||||
persist = 0.33
|
||||
}
|
||||
local np_xlscale = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=8192, y=8192, z=8192},
|
||||
seed = -72,
|
||||
octaves = 3,
|
||||
persist = 0.33
|
||||
}
|
||||
for chunk = 1, 64 do
|
||||
print ("[watershed] searching for spawn "..chunk)
|
||||
local x0 = 80 * math.random(-32, 32) - 32
|
||||
local z0 = 80 * math.random(-32, 32) - 32
|
||||
local y0 = -32
|
||||
local x1 = x0 + 79
|
||||
local z1 = z0 + 79
|
||||
local y1 = 47
|
||||
|
||||
local sidelen = 80
|
||||
local chulens = {x=sidelen, y=sidelen, z=sidelen}
|
||||
local minposxyz = {x=x0, y=y0, z=z0}
|
||||
local minposxz = {x=x0, y=z0}
|
||||
|
||||
local nvals_terrain = minetest.get_perlin_map(np_terrain, chulens):get3dMap_flat(minposxyz)
|
||||
local nvals_mid = minetest.get_perlin_map(np_mid, chulens):get2dMap_flat(minposxz)
|
||||
local nvals_base = minetest.get_perlin_map(np_base, chulens):get2dMap_flat(minposxz)
|
||||
local nvals_xlscale = minetest.get_perlin_map(np_xlscale, chulens):get2dMap_flat(minposxz)
|
||||
|
||||
local nixz = 1
|
||||
local nixyz = 1
|
||||
for z = z0, z1 do
|
||||
for y = y0, y1 do
|
||||
for x = x0, x1 do
|
||||
local n_absterrain = math.abs(nvals_terrain[nixyz])
|
||||
local n_absmid = math.abs(nvals_mid[nixz])
|
||||
local n_absbase = math.abs(nvals_base[nixz])
|
||||
local n_xlscale = nvals_xlscale[nixz]
|
||||
|
||||
local n_invbase = (1 - n_absbase)
|
||||
local terblen = (math.max(n_invbase, 0)) ^ BLENEXP
|
||||
local grad = math.atan((TERCEN - y) / TERSCA) * ATANAMP
|
||||
local densitybase = n_invbase * BASAMP + n_xlscale * XLSAMP + grad
|
||||
local densitymid = n_absmid * MIDAMP + densitybase
|
||||
local canexp = 0.5 + terblen * 0.5
|
||||
local canamp = terblen * CANAMP
|
||||
local density = n_absterrain ^ canexp * canamp * n_absmid + densitymid
|
||||
|
||||
if y >= 1 and density > -0.01 and density < 0 then
|
||||
ysp = y + 1
|
||||
xsp = x
|
||||
zsp = z
|
||||
break
|
||||
end
|
||||
nixz = nixz + 1
|
||||
nixyz = nixyz + 1
|
||||
end
|
||||
if ysp then
|
||||
break
|
||||
end
|
||||
nixz = nixz - 80
|
||||
end
|
||||
if ysp then
|
||||
break
|
||||
end
|
||||
nixz = nixz + 80
|
||||
end
|
||||
if ysp then
|
||||
break
|
||||
end
|
||||
end
|
||||
print ("[watershed] spawn player ("..xsp.." "..ysp.." "..zsp..")")
|
||||
player:setpos({x=xsp, y=ysp, z=zsp})
|
||||
end
|
||||
|
||||
minetest.register_on_newplayer(function(player)
|
||||
spawnplayer(player)
|
||||
end)
|
||||
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
spawnplayer(player)
|
||||
return true
|
||||
end)
|
||||
end
|
||||
|
||||
-- ABM
|
||||
|
||||
@ -351,21 +220,9 @@ minetest.register_abm({
|
||||
neighbors = {"group:water"},
|
||||
interval = 11,
|
||||
chance = 64,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.add_node(pos, {name="default:obsidian"})
|
||||
minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.25})
|
||||
end,
|
||||
})
|
||||
|
||||
-- Update luxore light
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"watershed:luxoreoff"},
|
||||
interval = 5,
|
||||
chance = 8,
|
||||
action = function(pos, node)
|
||||
minetest.add_node(pos, {name="watershed:luxore"})
|
||||
nodeupdate(pos)
|
||||
action = function(pos)
|
||||
minetest.add_node(pos, {name = "default:obsidian"})
|
||||
minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.25})
|
||||
end,
|
||||
})
|
||||
|
||||
@ -380,10 +237,10 @@ minetest.register_abm({
|
||||
local y = pos.y
|
||||
local z = pos.z
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local pos1 = {x=x-2, y=y-2, z=z-2}
|
||||
local pos2 = {x=x+2, y=y+4, z=z+2}
|
||||
local pos1 = {x = x - 2, y = y - 2, z = z - 2}
|
||||
local pos2 = {x = x + 2, y = y + 4, z = z + 2}
|
||||
local emin, emax = vm:read_from_map(pos1, pos2)
|
||||
local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
|
||||
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
|
||||
local data = vm:get_data()
|
||||
watershed_appletree(x, y, z, area, data)
|
||||
vm:set_data(data)
|
||||
@ -398,15 +255,15 @@ minetest.register_abm({
|
||||
nodenames = {"watershed:pineling"},
|
||||
interval = 59,
|
||||
chance = 3,
|
||||
action = function(pos, node)
|
||||
action = function(pos)
|
||||
local x = pos.x
|
||||
local y = pos.y
|
||||
local z = pos.z
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local pos1 = {x=x-2, y=y-4, z=z-2}
|
||||
local pos2 = {x=x+2, y=y+17, z=z+2}
|
||||
local pos1 = {x = x - 2, y = y - 4, z = z - 2}
|
||||
local pos2 = {x = x + 2, y = y + 17, z = z + 2}
|
||||
local emin, emax = vm:read_from_map(pos1, pos2)
|
||||
local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
|
||||
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
|
||||
local data = vm:get_data()
|
||||
watershed_pinetree(x, y, z, area, data)
|
||||
vm:set_data(data)
|
||||
@ -421,15 +278,15 @@ minetest.register_abm({
|
||||
nodenames = {"watershed:acacialing"},
|
||||
interval = 61,
|
||||
chance = 3,
|
||||
action = function(pos, node)
|
||||
action = function(pos)
|
||||
local x = pos.x
|
||||
local y = pos.y
|
||||
local z = pos.z
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local pos1 = {x=x-4, y=y-3, z=z-4}
|
||||
local pos2 = {x=x+4, y=y+6, z=z+4}
|
||||
local pos1 = {x = x - 4, y = y - 3, z = z - 4}
|
||||
local pos2 = {x = x + 4, y = y + 6, z = z + 4}
|
||||
local emin, emax = vm:read_from_map(pos1, pos2)
|
||||
local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
|
||||
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
|
||||
local data = vm:get_data()
|
||||
watershed_acaciatree(x, y, z, area, data)
|
||||
vm:set_data(data)
|
||||
@ -444,15 +301,15 @@ minetest.register_abm({
|
||||
nodenames = {"watershed:jungling"},
|
||||
interval = 63,
|
||||
chance = 3,
|
||||
action = function(pos, node)
|
||||
action = function(pos)
|
||||
local x = pos.x
|
||||
local y = pos.y
|
||||
local z = pos.z
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local pos1 = {x=x-2, y=y-5, z=z-2}
|
||||
local pos2 = {x=x+2, y=y+23, z=z+2}
|
||||
local pos1 = {x = x - 2, y = y - 5, z = z - 2}
|
||||
local pos2 = {x = x + 2, y = y + 23, z = z + 2}
|
||||
local emin, emax = vm:read_from_map(pos1, pos2)
|
||||
local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
|
||||
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
|
||||
local data = vm:get_data()
|
||||
watershed_jungletree(x, y, z, area, data)
|
||||
vm:set_data(data)
|
||||
|
528
init.lua
528
init.lua
@ -1,17 +1,6 @@
|
||||
-- watershed 0.5.0 by paramat
|
||||
-- For latest stable Minetest and back to 0.4.8
|
||||
-- Depends default bucket
|
||||
-- License: code WTFPL, textures CC BY-SA
|
||||
|
||||
-- New in 0.5.0:
|
||||
-- add 'update_liquids()' to make rivers flow
|
||||
-- liquid range 2
|
||||
-- double biome size
|
||||
-- more volcanos, 1 per kn on ridge
|
||||
-- regeneration by chat command '/regen'
|
||||
|
||||
-- Parameters
|
||||
|
||||
local SINGLENODE = true -- Use singlenode mapgen and spawnplayer function
|
||||
local YMIN = -33000 -- Approximate base of realm stone
|
||||
local YMAX = 33000 -- Approximate top of atmosphere / mountains / floatlands
|
||||
local TERCEN = -128 -- Terrain zero level, average seabed
|
||||
@ -26,7 +15,8 @@ local XLSAMP = 0.1 -- Extra large scale height variation amplitude
|
||||
local BASAMP = 0.3 -- Base terrain amplitude
|
||||
local MIDAMP = 0.1 -- Mid terrain amplitude
|
||||
local CANAMP = 0.4 -- Canyon terrain maximum amplitude
|
||||
local ATANAMP = 1.1 -- Arctan function amplitude, smaller = more and larger floatlands above ridges
|
||||
local ATANAMP = 1.1 -- Arctan function amplitude,
|
||||
-- smaller = more and larger floatlands above ridges
|
||||
local BLENEXP = 2 -- Terrain blend exponent
|
||||
|
||||
local TSTONE = 0.02 -- Density threshold for stone, depth of soil at TERCEN
|
||||
@ -34,7 +24,8 @@ local TRIVER = -0.028 -- Densitybase threshold for river surface
|
||||
local TRSAND = -0.035 -- Densitybase threshold for river sand
|
||||
local TSTREAM = -0.004 -- Densitymid threshold for stream surface
|
||||
local TSSAND = -0.005 -- Densitymid threshold for stream sand
|
||||
local TLAVA = 2 -- Maximum densitybase threshold for lava, small because grad is non-linear
|
||||
local TLAVA = 2 -- Maximum densitybase threshold for lava,
|
||||
-- small because grad is non-linear
|
||||
local TFIS = 0.01 -- Fissure threshold, controls width
|
||||
local TSEAM = 0.2 -- Seam threshold, width of seams
|
||||
local ORESCA = 512 -- Seam system vertical scale
|
||||
@ -42,33 +33,39 @@ local ORETHI = 0.002 -- Ore seam thickness tuner
|
||||
local BERGDEP = 32 -- Maximum iceberg depth
|
||||
local TFOG = -0.04 -- Fog top densitymid threshold
|
||||
|
||||
local HITET = 0.35 -- High temperature threshold
|
||||
local LOTET = -0.35 -- Low ..
|
||||
local ICETET = -0.7 -- Ice ..
|
||||
local HIHUT = 0.35 -- High humidity threshold
|
||||
local LOHUT = -0.35 -- Low ..
|
||||
local FOGHUT = 1.0 -- Fog ..
|
||||
local BLEND = 0.02 -- Biome blend randomness
|
||||
local biomeparams = {
|
||||
HITET = 0.35, -- High temperature threshold
|
||||
LOTET = -0.35, -- Low ..
|
||||
ICETET = -0.7, -- Ice ..
|
||||
HIHUT = 0.35, -- High humidity threshold
|
||||
LOHUT = -0.35, -- Low ..
|
||||
FOGHUT = 1.0, -- Fog ..
|
||||
BLEND = 0.02, -- Biome blend randomness
|
||||
}
|
||||
|
||||
local PINCHA = 36 -- Pine tree 1/x chance per node
|
||||
local APTCHA = 36 -- Appletree
|
||||
local FLOCHA = 289 -- Flower
|
||||
local GRACHA = 36 -- Grassland grasses
|
||||
local JUTCHA = 16 -- Jungletree
|
||||
local JUGCHA = 16 -- Junglegrass
|
||||
local CACCHA = 2209 -- Cactus
|
||||
local DRYCHA = 121 -- Dry shrub
|
||||
local ACACHA = 1369 -- Acacia tree
|
||||
local GOGCHA = 9 -- Golden grass
|
||||
local PAPCHA = 4 -- Papyrus
|
||||
local DUGCHA = 16 -- Dune grass
|
||||
local flora = {
|
||||
PINCHA = 36, -- Pine tree 1/x chance per node
|
||||
APTCHA = 36, -- Appletree
|
||||
FLOCHA = 289, -- Flower
|
||||
GRACHA = 36, -- Grassland grasses
|
||||
JUTCHA = 16, -- Jungletree
|
||||
JUGCHA = 16, -- Junglegrass
|
||||
CACCHA = 2209, -- Cactus
|
||||
DRYCHA = 121, -- Dry shrub
|
||||
ACACHA = 1369, -- Acacia tree
|
||||
GOGCHA = 9, -- Golden grass
|
||||
PAPCHA = 4, -- Papyrus
|
||||
DUGCHA = 16, -- Dune grass
|
||||
}
|
||||
|
||||
-- 3D noises
|
||||
|
||||
-- 3D noise for terrain
|
||||
|
||||
local np_terrain = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=384, y=192, z=384},
|
||||
spread = {x = 384, y = 192, z = 384},
|
||||
seed = 593,
|
||||
octaves = 5,
|
||||
persist = 0.67
|
||||
@ -79,7 +76,7 @@ local np_terrain = {
|
||||
local np_fissure = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=256, y=512, z=256},
|
||||
spread = {x = 256, y = 512, z = 256},
|
||||
seed = 20099,
|
||||
octaves = 5,
|
||||
persist = 0.5
|
||||
@ -90,7 +87,7 @@ local np_fissure = {
|
||||
local np_temp = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=1024, y=1024, z=1024},
|
||||
spread = {x = 1024, y = 1024, z = 1024},
|
||||
seed = 9130,
|
||||
octaves = 3,
|
||||
persist = 0.5
|
||||
@ -101,7 +98,7 @@ local np_temp = {
|
||||
local np_humid = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=1024, y=1024, z=1024},
|
||||
spread = {x = 1024, y = 1024, z = 1024},
|
||||
seed = -55500,
|
||||
octaves = 3,
|
||||
persist = 0.5
|
||||
@ -112,7 +109,7 @@ local np_humid = {
|
||||
local np_seam = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=512, y=512, z=512},
|
||||
spread = {x = 512, y = 512, z = 512},
|
||||
seed = -992221,
|
||||
octaves = 2,
|
||||
persist = 0.5
|
||||
@ -123,18 +120,20 @@ local np_seam = {
|
||||
local np_strata = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=512, y=512, z=512},
|
||||
spread = {x = 512, y = 512, z = 512},
|
||||
seed = 92219,
|
||||
octaves = 3,
|
||||
persist = 0.5
|
||||
}
|
||||
|
||||
-- 2D noises
|
||||
|
||||
-- 2D noise for mid terrain / streambed height
|
||||
|
||||
local np_mid = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=768, y=768, z=768},
|
||||
spread = {x = 768, y = 768, z = 768},
|
||||
seed = 85546,
|
||||
octaves = 5,
|
||||
persist = 0.5
|
||||
@ -145,7 +144,7 @@ local np_mid = {
|
||||
local np_base = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=4096, y=4096, z=4096},
|
||||
spread = {x = 4096, y = 4096, z = 4096},
|
||||
seed = 8890,
|
||||
octaves = 3,
|
||||
persist = 0.33
|
||||
@ -156,7 +155,7 @@ local np_base = {
|
||||
local np_xlscale = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=8192, y=8192, z=8192},
|
||||
spread = {x = 8192, y = 8192, z = 8192},
|
||||
seed = -72,
|
||||
octaves = 3,
|
||||
persist = 0.33
|
||||
@ -167,16 +166,52 @@ local np_xlscale = {
|
||||
local np_magma = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=128, y=128, z=128},
|
||||
spread = {x = 128, y = 128, z = 128},
|
||||
seed = -13,
|
||||
octaves = 2,
|
||||
persist = 0.5
|
||||
}
|
||||
|
||||
-- Stuff
|
||||
|
||||
dofile(minetest.get_modpath("watershed").."/nodes.lua")
|
||||
dofile(minetest.get_modpath("watershed").."/functions.lua")
|
||||
-- Do files
|
||||
|
||||
dofile(minetest.get_modpath("watershed") .. "/nodes.lua")
|
||||
dofile(minetest.get_modpath("watershed") .. "/functions.lua")
|
||||
|
||||
-- Initialize 3D and 2D noise objects to nil
|
||||
|
||||
local nobj_terrain = nil
|
||||
local nobj_fissure = nil
|
||||
local nobj_temp = nil
|
||||
local nobj_humid = nil
|
||||
local nobj_seam = nil
|
||||
local nobj_strata = nil
|
||||
|
||||
local nobj_mid = nil
|
||||
local nobj_base = nil
|
||||
local nobj_xlscale = nil
|
||||
local nobj_magma = nil
|
||||
|
||||
|
||||
-- Localise noise buffers
|
||||
|
||||
local nbuf_terrain = {}
|
||||
local nbuf_fissure = {}
|
||||
local nbuf_temp = {}
|
||||
local nbuf_humid = {}
|
||||
local nbuf_seam = {}
|
||||
local nbuf_strata = {}
|
||||
|
||||
local nbuf_mid = {}
|
||||
local nbuf_base = {}
|
||||
local nbuf_xlscale = {}
|
||||
local nbuf_magma = {}
|
||||
|
||||
|
||||
-- Localise data buffer
|
||||
|
||||
local dbuf = {}
|
||||
|
||||
|
||||
-- Mapchunk generation function
|
||||
|
||||
@ -221,39 +256,58 @@ function watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
|
||||
local c_wslava = minetest.get_content_id("watershed:lava")
|
||||
local c_wsfreshice = minetest.get_content_id("watershed:freshice")
|
||||
local c_wscloud = minetest.get_content_id("watershed:cloud")
|
||||
local c_wsluxore = minetest.get_content_id("watershed:luxoreoff")
|
||||
local c_wsluxore = minetest.get_content_id("watershed:luxore")
|
||||
local c_wsicydirt = minetest.get_content_id("watershed:icydirt")
|
||||
|
||||
-- perlinmap stuff
|
||||
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}
|
||||
local minposxz = {x=x0, y=z0}
|
||||
-- 3D and 2D perlinmaps
|
||||
local nvals_terrain = minetest.get_perlin_map(np_terrain, chulens):get3dMap_flat(minposxyz)
|
||||
local nvals_fissure = minetest.get_perlin_map(np_fissure, chulens):get3dMap_flat(minposxyz)
|
||||
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)
|
||||
local nvals_seam = minetest.get_perlin_map(np_seam, chulens):get3dMap_flat(minposxyz)
|
||||
local nvals_strata = minetest.get_perlin_map(np_strata, chulens):get3dMap_flat(minposxyz)
|
||||
local sidelen = x1 - x0 + 1
|
||||
local chulensxyz = {x = sidelen, y = sidelen + 2, z = sidelen}
|
||||
local chulensxz = {x = sidelen, y = sidelen, z = 1}
|
||||
local minposxyz = {x = x0, y = y0 - 1, z = z0}
|
||||
local minposxz = {x = x0, y = z0}
|
||||
|
||||
-- 3D and 2D noise objects created once on first mapchunk generation only
|
||||
nobj_terrain = nobj_terrain or minetest.get_perlin_map(np_terrain, chulensxyz)
|
||||
nobj_fissure = nobj_fissure or minetest.get_perlin_map(np_fissure, chulensxyz)
|
||||
nobj_temp = nobj_temp or minetest.get_perlin_map(np_temp, chulensxyz)
|
||||
nobj_humid = nobj_humid or minetest.get_perlin_map(np_humid, chulensxyz)
|
||||
nobj_seam = nobj_seam or minetest.get_perlin_map(np_seam, chulensxyz)
|
||||
nobj_strata = nobj_strata or minetest.get_perlin_map(np_strata, chulensxyz)
|
||||
|
||||
local nvals_mid = minetest.get_perlin_map(np_mid, chulens):get2dMap_flat(minposxz)
|
||||
local nvals_base = minetest.get_perlin_map(np_base, chulens):get2dMap_flat(minposxz)
|
||||
local nvals_xlscale = minetest.get_perlin_map(np_xlscale, chulens):get2dMap_flat(minposxz)
|
||||
local nvals_magma = minetest.get_perlin_map(np_magma, chulens):get2dMap_flat(minposxz)
|
||||
nobj_mid = nobj_mid or minetest.get_perlin_map(np_mid, chulensxz)
|
||||
nobj_base = nobj_base or minetest.get_perlin_map(np_base, chulensxz)
|
||||
nobj_xlscale = nobj_xlscale or minetest.get_perlin_map(np_xlscale, chulensxz)
|
||||
nobj_magma = nobj_magma or minetest.get_perlin_map(np_magma, chulensxz)
|
||||
|
||||
-- 3D and 2D perlinmaps created per mapchunk
|
||||
local nvals_terrain = nobj_terrain:get3dMap_flat(minposxyz, nbuf_terrain)
|
||||
local nvals_fissure = nobj_fissure:get3dMap_flat(minposxyz, nbuf_fissure)
|
||||
local nvals_temp = nobj_temp :get3dMap_flat(minposxyz, nbuf_temp)
|
||||
local nvals_humid = nobj_humid :get3dMap_flat(minposxyz, nbuf_humid)
|
||||
local nvals_seam = nobj_seam :get3dMap_flat(minposxyz, nbuf_seam)
|
||||
local nvals_strata = nobj_strata :get3dMap_flat(minposxyz, nbuf_strata)
|
||||
|
||||
local viu = area:index(x0, y0-1, z0) -- ungenerated chunk below?
|
||||
local nvals_mid = nobj_mid :get2dMap_flat(minposxz, nbuf_mid)
|
||||
local nvals_base = nobj_base :get2dMap_flat(minposxz, nbuf_base)
|
||||
local nvals_xlscale = nobj_xlscale:get2dMap_flat(minposxz, nbuf_xlscale)
|
||||
local nvals_magma = nobj_magma :get2dMap_flat(minposxz, nbuf_magma)
|
||||
|
||||
-- ungenerated chunk below?
|
||||
local viu = area:index(x0, y0 - 1, z0)
|
||||
local ungen = data[viu] == c_ignore
|
||||
|
||||
-- mapgen loop
|
||||
local nixyz = 1 -- 3D and 2D perlinmap indexes
|
||||
local nixz = 1
|
||||
local stable = {} -- stability table of true/false. is node supported from below by 2 stone or nodes on 2 stone?
|
||||
local under = {} -- biome table. biome number of previous fine material placed in column
|
||||
for z = z0, z1 do -- for each xy plane progressing northwards
|
||||
for y = y0 - 1, y1 + 1 do -- for each x row progressing upwards
|
||||
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
|
||||
for x = x0, x1 do -- for each node do
|
||||
local stable = {} -- stability table of true/false.
|
||||
-- is node supported from below by 2 stone or nodes on 2 stone?
|
||||
local under = {} -- biome table.
|
||||
-- biome number of previous fine material placed in column
|
||||
for z = z0, z1 do
|
||||
for y = y0 - 1, y1 + 1 do
|
||||
local vi = area:index(x0, y, z)
|
||||
local viu = area:index(x0, y - 1, z)
|
||||
for x = x0, x1 do
|
||||
local si = x - x0 + 1 -- stable, under tables index
|
||||
-- noise values for node
|
||||
local n_absterrain = math.abs(nvals_terrain[nixyz])
|
||||
@ -292,26 +346,32 @@ function watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
|
||||
end
|
||||
|
||||
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
|
||||
if n_temp < biomeparams.LOTET +
|
||||
(math.random() - 0.5) * biomeparams.BLEND then
|
||||
if n_humid < biomeparams.LOHUT +
|
||||
(math.random() - 0.5) * biomeparams.BLEND then
|
||||
biome = 1 -- tundra
|
||||
elseif n_humid > HIHUT + (math.random() - 0.5) * BLEND then
|
||||
elseif n_humid > biomeparams.HIHUT +
|
||||
(math.random() - 0.5) * biomeparams.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
|
||||
elseif n_temp > biomeparams.HITET +
|
||||
(math.random() - 0.5) * biomeparams.BLEND then
|
||||
if n_humid < biomeparams.LOHUT +
|
||||
(math.random() - 0.5) * biomeparams.BLEND then
|
||||
biome = 7 -- desert
|
||||
elseif n_humid > HIHUT + (math.random() - 0.5) * BLEND then
|
||||
elseif n_humid > biomeparams.HIHUT +
|
||||
(math.random() - 0.5) * biomeparams.BLEND then
|
||||
biome = 9 -- rainforest
|
||||
else
|
||||
biome = 8 -- savanna
|
||||
end
|
||||
else
|
||||
if n_humid < LOHUT then
|
||||
if n_humid < biomeparams.LOHUT then
|
||||
biome = 4 -- dry grassland
|
||||
elseif n_humid > HIHUT then
|
||||
elseif n_humid > biomeparams.HIHUT then
|
||||
biome = 6 -- deciduous forest
|
||||
else
|
||||
biome = 5 -- grassland
|
||||
@ -330,22 +390,22 @@ function watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
|
||||
else -- scan top layer of chunk below
|
||||
local nodid = data[vi]
|
||||
if nodid == c_wsstone
|
||||
or nodid == c_wsredstone
|
||||
or nodid == c_wsdirt
|
||||
or nodid == c_wspermafrost
|
||||
or nodid == c_wsluxore
|
||||
or nodid == c_sand
|
||||
or nodid == c_desand
|
||||
or nodid == c_mese
|
||||
or nodid == c_stodiam
|
||||
or nodid == c_stogold
|
||||
or nodid == c_stocopp
|
||||
or nodid == c_stoiron
|
||||
or nodid == c_stocoal
|
||||
or nodid == c_sandstone
|
||||
or nodid == c_gravel
|
||||
or nodid == c_clay
|
||||
or nodid == c_obsidian then
|
||||
or nodid == c_wsredstone
|
||||
or nodid == c_wsdirt
|
||||
or nodid == c_wspermafrost
|
||||
or nodid == c_wsluxore
|
||||
or nodid == c_sand
|
||||
or nodid == c_desand
|
||||
or nodid == c_mese
|
||||
or nodid == c_stodiam
|
||||
or nodid == c_stogold
|
||||
or nodid == c_stocopp
|
||||
or nodid == c_stoiron
|
||||
or nodid == c_stocoal
|
||||
or nodid == c_sandstone
|
||||
or nodid == c_gravel
|
||||
or nodid == c_clay
|
||||
or nodid == c_obsidian then
|
||||
stable[si] = 2
|
||||
else
|
||||
stable[si] = 0
|
||||
@ -359,56 +419,75 @@ function watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
|
||||
end
|
||||
stable[si] = 0
|
||||
under[si] = 0
|
||||
elseif densitybase >= tlava - math.min(0.6 + density * 6, 0.6) and density < tstone then -- obsidian
|
||||
elseif densitybase >= tlava - math.min(0.6 + density * 6, 0.6)
|
||||
and density < tstone then -- obsidian
|
||||
data[vi] = c_obsidian
|
||||
stable[si] = 1
|
||||
under[si] = 0
|
||||
elseif density >= tstone and nofis -- stone cut by fissures
|
||||
or (density >= tstone and density < TSTONE * 1.2 and y <= YWAT) -- stone around water
|
||||
or (density >= tstone and density < TSTONE * 1.2 and densitybase >= triver ) -- stone around river
|
||||
or (density >= tstone and density < TSTONE * 1.2 and densitymid >= tstream ) then -- stone around stream
|
||||
or (density >= tstone and density < TSTONE * 1.2 and
|
||||
y <= YWAT) -- stone around water
|
||||
or (density >= tstone and density < TSTONE * 1.2 and
|
||||
densitybase >= triver ) -- stone around river
|
||||
or (density >= tstone and density < TSTONE * 1.2 and
|
||||
densitymid >= tstream ) then -- stone around stream
|
||||
local densitystr = n_strata * 0.25 + (TERCEN - y) / ORESCA
|
||||
local densityper = densitystr - math.floor(densitystr) -- periodic strata 'density'
|
||||
-- periodic strata 'density'
|
||||
local densityper = densitystr - math.floor(densitystr)
|
||||
if (densityper >= 0.05 and densityper <= 0.09) -- sandstone strata
|
||||
or (densityper >= 0.25 and densityper <= 0.28)
|
||||
or (densityper >= 0.45 and densityper <= 0.47)
|
||||
or (densityper >= 0.74 and densityper <= 0.76)
|
||||
or (densityper >= 0.77 and densityper <= 0.79)
|
||||
or (densityper >= 0.84 and densityper <= 0.87)
|
||||
or (densityper >= 0.95 and densityper <= 0.98) then
|
||||
or (densityper >= 0.25 and densityper <= 0.28)
|
||||
or (densityper >= 0.45 and densityper <= 0.47)
|
||||
or (densityper >= 0.74 and densityper <= 0.76)
|
||||
or (densityper >= 0.77 and densityper <= 0.79)
|
||||
or (densityper >= 0.84 and densityper <= 0.87)
|
||||
or (densityper >= 0.95 and densityper <= 0.98) then
|
||||
data[vi] = c_sandstone
|
||||
elseif biome == 7 and density < TSTONE * 3 then -- desert stone as surface layer
|
||||
elseif biome == 7 and density < TSTONE * 3 then
|
||||
-- desert stone as surface layer
|
||||
data[vi] = c_wsredstone
|
||||
elseif math.abs(n_seam) < TSEAM then
|
||||
if densityper >= 0 and densityper <= ORETHI * 4 then -- ore seams
|
||||
-- ore seams
|
||||
if densityper >= 0 and
|
||||
densityper <= ORETHI * 4 then
|
||||
data[vi] = c_stocoal
|
||||
elseif densityper >= 0.3 and densityper <= 0.3 + ORETHI * 4 then
|
||||
elseif densityper >= 0.3 and
|
||||
densityper <= 0.3 + ORETHI * 4 then
|
||||
data[vi] = c_stocoal
|
||||
elseif densityper >= 0.5 and densityper <= 0.5 + ORETHI * 4 then
|
||||
elseif densityper >= 0.5 and
|
||||
densityper <= 0.5 + ORETHI * 4 then
|
||||
data[vi] = c_stocoal
|
||||
elseif densityper >= 0.8 and densityper <= 0.8 + ORETHI * 4 then
|
||||
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
|
||||
elseif densityper >= 0.55 and
|
||||
densityper <= 0.55 + ORETHI * 2 then
|
||||
data[vi] = c_gravel
|
||||
elseif densityper >= 0.1 and densityper <= 0.1 + ORETHI * 2 then
|
||||
elseif densityper >= 0.1 and
|
||||
densityper <= 0.1 + ORETHI * 2 then
|
||||
data[vi] = c_wsluxore
|
||||
elseif densityper >= 0.2 and densityper <= 0.2 + ORETHI * 2
|
||||
and math.random(2) == 2 then
|
||||
elseif densityper >= 0.2 and
|
||||
densityper <= 0.2 + ORETHI * 2 and
|
||||
math.random(2) == 2 then
|
||||
data[vi] = c_stoiron
|
||||
elseif densityper >= 0.65 and densityper <= 0.65 + ORETHI * 2
|
||||
and math.random(2) == 2 then
|
||||
elseif densityper >= 0.65 and
|
||||
densityper <= 0.65 + ORETHI * 2 and
|
||||
math.random(2) == 2 then
|
||||
data[vi] = c_stoiron
|
||||
elseif densityper >= 0.4 and densityper <= 0.4 + ORETHI * 2
|
||||
and math.random(3) == 2 then
|
||||
elseif densityper >= 0.4 and
|
||||
densityper <= 0.4 + ORETHI * 2 and
|
||||
math.random(3) == 2 then
|
||||
data[vi] = c_stocopp
|
||||
elseif densityper >= 0.6 and densityper <= 0.6 + ORETHI
|
||||
and math.random(5) == 2 then
|
||||
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
|
||||
and math.random(7) == 2 then
|
||||
elseif densityper >= 0.7 and
|
||||
densityper <= 0.7 + ORETHI and
|
||||
math.random(7) == 2 then
|
||||
data[vi] = c_mese
|
||||
elseif densityper >= 0.9 and densityper <= 0.9 + ORETHI
|
||||
and math.random(11) == 2 then
|
||||
elseif densityper >= 0.9 and
|
||||
densityper <= 0.9 + ORETHI and
|
||||
math.random(11) == 2 then
|
||||
data[vi] = c_stodiam
|
||||
else
|
||||
data[vi] = c_wsstone
|
||||
@ -418,7 +497,8 @@ function watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
|
||||
end
|
||||
stable[si] = stable[si] + 1
|
||||
under[si] = 0
|
||||
elseif density >= 0 and density < tstone and stable[si] >= 2 then -- fine materials
|
||||
-- fine materials
|
||||
elseif density >= 0 and density < tstone and stable[si] >= 2 then
|
||||
if y == YWAT - 2 and math.abs(n_temp) < 0.05 then -- clay
|
||||
data[vi] = c_clay
|
||||
elseif y <= ysand then -- seabed/beach/dune sand not cut by fissures
|
||||
@ -463,8 +543,9 @@ function watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
|
||||
stable[si] = 0
|
||||
under[si] = 0
|
||||
end
|
||||
elseif y >= YWAT - bergdep and y <= YWAT + bergdep / 8 and n_temp < ICETET -- icesheet
|
||||
and density < tstone and math.abs(n_fissure) > 0.01 then
|
||||
elseif y >= YWAT - bergdep and y <= YWAT + bergdep / 8 -- icesheet
|
||||
and n_temp < biomeparams.ICETET and density < tstone
|
||||
and math.abs(n_fissure) > 0.01 then
|
||||
data[vi] = c_ice
|
||||
under[si] = 12
|
||||
stable[si] = 0
|
||||
@ -472,8 +553,9 @@ function watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
|
||||
data[vi] = c_water
|
||||
under[si] = 0
|
||||
stable[si] = 0
|
||||
elseif densitybase >= triver and density < tstone then -- river water not in fissures
|
||||
if n_temp < ICETET then
|
||||
-- river water not in fissures
|
||||
elseif densitybase >= triver and density < tstone then
|
||||
if n_temp < biomeparams.ICETET then
|
||||
data[vi] = c_wsfreshice
|
||||
else
|
||||
if y == YWAT + 1 then
|
||||
@ -484,8 +566,9 @@ function watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
|
||||
end
|
||||
stable[si] = 0
|
||||
under[si] = 0
|
||||
elseif densitymid >= tstream and density < tstone then -- stream water not in fissures
|
||||
if n_temp < ICETET then
|
||||
-- stream water not in fissures
|
||||
elseif densitymid >= tstream and density < tstone then
|
||||
if n_temp < biomeparams.ICETET then
|
||||
data[vi] = c_wsfreshice
|
||||
else
|
||||
if y == YWAT + 1 then
|
||||
@ -496,18 +579,19 @@ function watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
|
||||
end
|
||||
stable[si] = 0
|
||||
under[si] = 0
|
||||
elseif density < 0 and y >= YWAT and under[si] ~= 0 then -- air above surface node
|
||||
-- air above surface node
|
||||
elseif density < 0 and y >= YWAT and under[si] ~= 0 then
|
||||
local fnoise = n_fissure -- noise for flower colours
|
||||
if under[si] == 1 then
|
||||
data[viu] = c_wsicydirt
|
||||
if math.random(DRYCHA) == 2 then
|
||||
if math.random(flora.DRYCHA) == 2 then
|
||||
data[vi] = c_dryshrub
|
||||
end
|
||||
elseif under[si] == 2 then
|
||||
data[viu] = c_dirtsnow
|
||||
data[vi] = c_snowblock
|
||||
elseif under[si] == 3 then
|
||||
if math.random(PINCHA) == 2 then
|
||||
if math.random(flora.PINCHA) == 2 then
|
||||
watershed_pinetree(x, y, z, area, data)
|
||||
else
|
||||
data[viu] = c_dirtsnow
|
||||
@ -515,67 +599,69 @@ function watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
|
||||
end
|
||||
elseif under[si] == 4 then
|
||||
data[viu] = c_wsdrygrass
|
||||
if math.random(DRYCHA) == 2 then
|
||||
if math.random(flora.DRYCHA) == 2 then
|
||||
data[vi] = c_dryshrub
|
||||
end
|
||||
elseif under[si] == 5 then
|
||||
data[viu] = c_wsgrass
|
||||
if math.random(FLOCHA) == 2 then
|
||||
if math.random(flora.FLOCHA) == 2 then
|
||||
watershed_flower(data, vi, fnoise)
|
||||
elseif math.random(GRACHA) == 2 then
|
||||
elseif math.random(flora.GRACHA) == 2 then
|
||||
data[vi] = c_grass5
|
||||
end
|
||||
elseif under[si] == 6 then
|
||||
if math.random(APTCHA) == 2 then
|
||||
if math.random(flora.APTCHA) == 2 then
|
||||
watershed_appletree(x, y, z, area, data)
|
||||
else
|
||||
data[viu] = c_wsgrass
|
||||
if math.random(FLOCHA) == 2 then
|
||||
if math.random(flora.FLOCHA) == 2 then
|
||||
watershed_flower(data, vi, fnoise)
|
||||
elseif math.random(GRACHA) == 2 then
|
||||
elseif math.random(flora.GRACHA) == 2 then
|
||||
data[vi] = c_grass5
|
||||
end
|
||||
end
|
||||
elseif under[si] == 7 and n_temp < HITET + 0.1 then
|
||||
if math.random(CACCHA) == 2 then
|
||||
elseif under[si] == 7 and n_temp < biomeparams.HITET + 0.1 then
|
||||
if math.random(flora.CACCHA) == 2 then
|
||||
watershed_cactus(x, y, z, area, data)
|
||||
elseif math.random(DRYCHA) == 2 then
|
||||
elseif math.random(flora.DRYCHA) == 2 then
|
||||
data[vi] = c_dryshrub
|
||||
end
|
||||
elseif under[si] == 8 then
|
||||
if math.random(ACACHA) == 2 then
|
||||
if math.random(flora.ACACHA) == 2 then
|
||||
watershed_acaciatree(x, y, z, area, data)
|
||||
else
|
||||
data[viu] = c_wsdrygrass
|
||||
if math.random(GOGCHA) == 2 then
|
||||
if math.random(flora.GOGCHA) == 2 then
|
||||
data[vi] = c_wsgoldengrass
|
||||
end
|
||||
end
|
||||
elseif under[si] == 9 then
|
||||
if math.random(JUTCHA) == 2 then
|
||||
if math.random(flora.JUTCHA) == 2 then
|
||||
watershed_jungletree(x, y, z, area, data)
|
||||
else
|
||||
data[viu] = c_wsgrass
|
||||
if math.random(JUGCHA) == 2 then
|
||||
if math.random(flora.JUGCHA) == 2 then
|
||||
data[vi] = c_jungrass
|
||||
end
|
||||
end
|
||||
elseif under[si] == 10 then -- dunes
|
||||
if math.random(DUGCHA) == 2 and y > YSAV
|
||||
and biome >= 4 then
|
||||
if math.random(flora.DUGCHA) == 2 and y > YSAV
|
||||
and biome >= 4 then
|
||||
data[vi] = c_wsgoldengrass
|
||||
end
|
||||
elseif under[si] == 11 and n_temp > HITET then -- hot biome riverbank
|
||||
if math.random(PAPCHA) == 2 then
|
||||
elseif under[si] == 11 and n_temp > biomeparams.HITET then -- hot biome riverbank
|
||||
if math.random(flora.PAPCHA) == 2 then
|
||||
watershed_papyrus(x, y, z, area, data)
|
||||
end
|
||||
elseif under[si] == 12
|
||||
and n_humid > LOHUT + (math.random() - 0.5) * BLEND then -- snowy iceberg
|
||||
-- snowy iceberg
|
||||
elseif under[si] == 12 and n_humid > biomeparams.LOHUT +
|
||||
(math.random() - 0.5) * biomeparams.BLEND then
|
||||
data[vi] = c_snowblock
|
||||
end
|
||||
stable[si] = 0
|
||||
under[si] = 0
|
||||
elseif density < 0 and densitymid > TFOG and n_humid > FOGHUT then -- fog
|
||||
elseif density < 0 and densitymid > TFOG and
|
||||
n_humid > biomeparams.FOGHUT then -- fog
|
||||
data[vi] = c_wscloud
|
||||
stable[si] = 0
|
||||
under[si] = 0
|
||||
@ -594,7 +680,8 @@ function watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
|
||||
under[si] = 0
|
||||
end
|
||||
elseif y == y1 + 1 then -- plane of nodes above chunk
|
||||
if density < 0 and y >= YWAT and under[si] ~= 0 then -- if air above fine materials
|
||||
-- if air above fine materials
|
||||
if density < 0 and y >= YWAT and under[si] ~= 0 then
|
||||
if under[si] == 1 then -- add surface nodes to chunk top layer
|
||||
data[viu] = c_wsicydirt
|
||||
elseif under[si] == 2 then
|
||||
@ -616,7 +703,7 @@ function watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
|
||||
end
|
||||
end
|
||||
end
|
||||
nixyz = nixyz + 1 -- increment perlinmap and voxelarea indexes along x row
|
||||
nixyz = nixyz + 1
|
||||
nixz = nixz + 1
|
||||
vi = vi + 1
|
||||
viu = viu + 1
|
||||
@ -627,11 +714,12 @@ function watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Regenerate chunk by chat command. Dependant on chunksize = 5.
|
||||
|
||||
minetest.register_chatcommand("regen",{
|
||||
description = "Regenerate player's current mapchunk",
|
||||
privs = {privs = server, rollback},
|
||||
privs = {server = true, rollback = true},
|
||||
func = function(name, params)
|
||||
local t1 = os.clock()
|
||||
|
||||
@ -657,8 +745,8 @@ minetest.register_chatcommand("regen",{
|
||||
local pos1 = {x = x0, y = y0 - 1, z = z0}
|
||||
local pos2 = {x = x1, y = y1 + 1, z = z1}
|
||||
local emin, emax = vm:read_from_map(pos1, pos2)
|
||||
local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
|
||||
local data = vm:get_data()
|
||||
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
|
||||
local data = vm:get_data(dbuf)
|
||||
|
||||
watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
|
||||
|
||||
@ -667,10 +755,11 @@ minetest.register_chatcommand("regen",{
|
||||
vm:update_map()
|
||||
|
||||
local chugent = math.ceil((os.clock() - t1) * 1000)
|
||||
print ("[watershed] "..chugent.." ms")
|
||||
print ("[watershed] " .. chugent .. " ms")
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
-- On generated function
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
@ -686,22 +775,129 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
local x0 = minp.x
|
||||
local y0 = minp.y
|
||||
local z0 = minp.z
|
||||
|
||||
print ("[watershed] generate mapchunk minp ("..x0.." "..y0.." "..z0..")")
|
||||
|
||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
||||
local data = vm:get_data()
|
||||
local area = VoxelArea:new{MinEdge = emin, MaxEdge = emax}
|
||||
local data = vm:get_data(dbuf)
|
||||
|
||||
watershed_chunkgen(x0, y0, z0, x1, y1, z1, area, data)
|
||||
|
||||
vm:set_data(data)
|
||||
vm:set_lighting({day=0, night=0})
|
||||
if not SINGLENODE then
|
||||
vm:set_lighting({day = 0, night = 0}) -- remove incorrect precalculated light
|
||||
end
|
||||
vm:calc_lighting()
|
||||
vm:write_to_map(data)
|
||||
vm:update_liquids()
|
||||
|
||||
local chugent = math.ceil((os.clock() - t1) * 1000)
|
||||
print ("[watershed] "..chugent.." ms")
|
||||
print ("[watershed] " .. chugent .. " ms")
|
||||
end)
|
||||
|
||||
|
||||
-- Singlenode option
|
||||
|
||||
if SINGLENODE then
|
||||
-- Set mapgen parameters
|
||||
|
||||
minetest.set_mapgen_params({mgname = "singlenode", flags = "nolight"})
|
||||
|
||||
|
||||
-- Spawn player function. Requires chunksize = 80 nodes (the default)
|
||||
|
||||
function spawnplayer(player)
|
||||
local xsp
|
||||
local ysp
|
||||
local zsp
|
||||
|
||||
local nobj_terrain = nil
|
||||
local nobj_mid = nil
|
||||
local nobj_base = nil
|
||||
local nobj_xlscale = nil
|
||||
|
||||
local nbuf_terrain
|
||||
local nbuf_mid
|
||||
local nbuf_base
|
||||
local nbuf_xlscale
|
||||
|
||||
for chunk = 1, 128 do
|
||||
print ("[watershed] searching for spawn "..chunk)
|
||||
local x0 = 80 * math.random(-32, 32) - 32
|
||||
local z0 = 80 * math.random(-32, 32) - 32
|
||||
local y0 = -32
|
||||
local x1 = x0 + 79
|
||||
local z1 = z0 + 79
|
||||
local y1 = 47
|
||||
local sidelen = 80
|
||||
local chulensxyz = {x = sidelen, y = sidelen + 2, z = sidelen}
|
||||
local chulensxz = {x = sidelen, y = sidelen, z = 1}
|
||||
local minposxyz = {x = x0, y = y0 - 1, z = z0}
|
||||
local minposxz = {x = x0, y = z0}
|
||||
|
||||
nobj_terrain = nobj_terrain or minetest.get_perlin_map(np_terrain, chulensxyz)
|
||||
nobj_mid = nobj_mid or minetest.get_perlin_map(np_mid, chulensxz)
|
||||
nobj_base = nobj_base or minetest.get_perlin_map(np_base, chulensxz)
|
||||
nobj_xlscale = nobj_xlscale or minetest.get_perlin_map(np_xlscale, chulensxz)
|
||||
|
||||
local nvals_terrain = nobj_terrain:get3dMap_flat(minposxyz, nbuf_terrain)
|
||||
local nvals_mid = nobj_mid :get2dMap_flat(minposxz, nbuf_mid)
|
||||
local nvals_base = nobj_base :get2dMap_flat(minposxz, nbuf_base)
|
||||
local nvals_xlscale = nobj_xlscale:get2dMap_flat(minposxz, nbuf_xlscale)
|
||||
|
||||
local nixz = 1
|
||||
local nixyz = 1
|
||||
for z = z0, z1 do
|
||||
for y = y0, y1 do
|
||||
for x = x0, x1 do
|
||||
local n_absterrain = math.abs(nvals_terrain[nixyz])
|
||||
local n_absmid = math.abs(nvals_mid[nixz])
|
||||
local n_absbase = math.abs(nvals_base[nixz])
|
||||
local n_xlscale = nvals_xlscale[nixz]
|
||||
|
||||
local n_invbase = (1 - n_absbase)
|
||||
local terblen = (math.max(n_invbase, 0)) ^ BLENEXP
|
||||
local grad = math.atan((TERCEN - y) / TERSCA) * ATANAMP
|
||||
local densitybase = n_invbase * BASAMP + n_xlscale * XLSAMP +
|
||||
grad
|
||||
local densitymid = n_absmid * MIDAMP + densitybase
|
||||
local canexp = 0.5 + terblen * 0.5
|
||||
local canamp = terblen * CANAMP
|
||||
local density = n_absterrain ^ canexp * canamp * n_absmid +
|
||||
densitymid
|
||||
|
||||
if y >= 1 and density > -0.005 and density < 0 then
|
||||
ysp = y + 1
|
||||
xsp = x
|
||||
zsp = z
|
||||
break
|
||||
end
|
||||
nixz = nixz + 1
|
||||
nixyz = nixyz + 1
|
||||
end
|
||||
if ysp then
|
||||
break
|
||||
end
|
||||
nixz = nixz - 80
|
||||
end
|
||||
if ysp then
|
||||
break
|
||||
end
|
||||
nixz = nixz + 80
|
||||
end
|
||||
if ysp then
|
||||
break
|
||||
end
|
||||
end
|
||||
print ("[watershed] spawn player (" .. xsp .. " " .. ysp .. " " .. zsp .. ")")
|
||||
player:setpos({x = xsp, y = ysp, z = zsp})
|
||||
end
|
||||
|
||||
minetest.register_on_newplayer(function(player)
|
||||
spawnplayer(player)
|
||||
end)
|
||||
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
spawnplayer(player)
|
||||
return true
|
||||
end)
|
||||
end
|
||||
|
59
license.txt
59
license.txt
@ -1,14 +1,53 @@
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
License of source code
|
||||
----------------------
|
||||
GNU Lesser General Public License (2.1)
|
||||
Copyright (C) 2014-2017 paramat.
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
|
||||
|
||||
License of media (textures)
|
||||
---------------------------
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
Copyright (C) 2014-2017 paramat
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
||||
The licensor cannot revoke these freedoms as long as you follow the license terms.
|
||||
|
||||
Under the following terms:
|
||||
|
||||
Attribution — You must give appropriate credit, provide a link to the license, and
|
||||
indicate if changes were made. You may do so in any reasonable manner, but not in any way
|
||||
that suggests the licensor endorses you or your use.
|
||||
|
||||
ShareAlike — If you remix, transform, or build upon the material, you must distribute
|
||||
your contributions under the same license as the original.
|
||||
|
||||
No additional restrictions — You may not apply legal terms or technological measures that
|
||||
legally restrict others from doing anything the license permits.
|
||||
|
||||
Notices:
|
||||
|
||||
You do not have to comply with the license for elements of the material in the public
|
||||
domain or where your use is permitted by an applicable exception or limitation.
|
||||
No warranties are given. The license may not give you all of the permissions necessary
|
||||
for your intended use. For example, other rights such as publicity, privacy, or moral
|
||||
rights may limit how you use the material.
|
||||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
240
nodes.lua
240
nodes.lua
@ -9,7 +9,7 @@ minetest.register_node("watershed:appleleaf", {
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{items = {"watershed:appling"},rarity = 20},
|
||||
{items = {"watershed:appling"}, rarity = 20},
|
||||
{items = {"watershed:appleleaf"}}
|
||||
}
|
||||
},
|
||||
@ -30,16 +30,17 @@ minetest.register_node("watershed:appling", {
|
||||
type = "fixed",
|
||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||
},
|
||||
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
|
||||
groups = {snappy = 2, dig_immediate = 3, flammable = 2, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("watershed:acaciatree", {
|
||||
description = "Acacia tree",
|
||||
tiles = {"watershed_acaciatreetop.png", "watershed_acaciatreetop.png", "watershed_acaciatree.png"},
|
||||
tiles = {"watershed_acaciatreetop.png", "watershed_acaciatreetop.png",
|
||||
"watershed_acaciatree.png"},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
|
||||
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_place = minetest.rotate_node
|
||||
})
|
||||
@ -51,11 +52,11 @@ minetest.register_node("watershed:acacialeaf", {
|
||||
tiles = {"watershed_acacialeaf.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=3, flammable=2, leaves=1},
|
||||
groups = {snappy = 3, flammable = 2, leaves = 1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{items = {"watershed:acacialing"},rarity = 20},
|
||||
{items = {"watershed:acacialing"}, rarity = 20},
|
||||
{items = {"watershed:acacialeaf"}}
|
||||
}
|
||||
},
|
||||
@ -76,16 +77,17 @@ minetest.register_node("watershed:acacialing", {
|
||||
type = "fixed",
|
||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||
},
|
||||
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
|
||||
groups = {snappy = 2, dig_immediate = 3, flammable = 2, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("watershed:pinetree", {
|
||||
description = "Pine tree",
|
||||
tiles = {"watershed_pinetreetop.png", "watershed_pinetreetop.png", "watershed_pinetree.png"},
|
||||
tiles = {"watershed_pinetreetop.png", "watershed_pinetreetop.png",
|
||||
"watershed_pinetree.png"},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
|
||||
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_place = minetest.rotate_node
|
||||
})
|
||||
@ -97,11 +99,11 @@ minetest.register_node("watershed:needles", {
|
||||
tiles = {"watershed_needles.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=3},
|
||||
groups = {snappy = 3},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{items = {"watershed:pineling"},rarity = 20},
|
||||
{items = {"watershed:pineling"}, rarity = 20},
|
||||
{items = {"watershed:needles"}}
|
||||
}
|
||||
},
|
||||
@ -122,7 +124,7 @@ minetest.register_node("watershed:pineling", {
|
||||
type = "fixed",
|
||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||
},
|
||||
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
|
||||
groups = {snappy = 2, dig_immediate = 3, flammable = 2, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
@ -133,11 +135,11 @@ minetest.register_node("watershed:jungleleaf", {
|
||||
tiles = {"default_jungleleaves.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=3, flammable=2, leaves=1},
|
||||
groups = {snappy = 3, flammable = 2, leaves = 1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{items = {"watershed:jungling"},rarity = 20},
|
||||
{items = {"watershed:jungling"}, rarity = 20},
|
||||
{items = {"watershed:jungleleaf"}}
|
||||
}
|
||||
},
|
||||
@ -158,7 +160,7 @@ minetest.register_node("watershed:jungling", {
|
||||
type = "fixed",
|
||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||
},
|
||||
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
|
||||
groups = {snappy = 2, dig_immediate = 3, flammable = 2, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
@ -166,7 +168,7 @@ minetest.register_node("watershed:dirt", {
|
||||
description = "Dirt",
|
||||
tiles = {"default_dirt.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly=3,soil=1},
|
||||
groups = {crumbly = 3, soil = 1},
|
||||
drop = "default:dirt",
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
@ -175,11 +177,11 @@ minetest.register_node("watershed:icydirt", {
|
||||
description = "Icy dirt",
|
||||
tiles = {"watershed_icydirt.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly=1},
|
||||
groups = {crumbly = 1},
|
||||
drop = "default:dirt",
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_snow_footstep", gain=0.15},
|
||||
dug = {name="default_snow_footstep", gain=0.45},
|
||||
footstep = {name = "default_snow_footstep", gain = 0.15},
|
||||
dug = {name = "default_snow_footstep", gain = 0.45},
|
||||
}),
|
||||
})
|
||||
|
||||
@ -187,10 +189,10 @@ minetest.register_node("watershed:grass", {
|
||||
description = "Grass",
|
||||
tiles = {"default_grass.png", "default_dirt.png", "default_grass.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly=3,soil=1},
|
||||
groups = {crumbly = 3, soil = 1},
|
||||
drop = "default:dirt",
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_grass_footstep", gain=0.25},
|
||||
footstep = {name = "default_grass_footstep", gain = 0.25},
|
||||
}),
|
||||
})
|
||||
|
||||
@ -198,7 +200,7 @@ minetest.register_node("watershed:redstone", {
|
||||
description = "Red stone",
|
||||
tiles = {"default_desert_stone.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky=3},
|
||||
groups = {cracky = 3},
|
||||
drop = "watershed:redcobble",
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
@ -207,7 +209,7 @@ minetest.register_node("watershed:redcobble", {
|
||||
description = "Red cobblestone",
|
||||
tiles = {"watershed_redcobble.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky=3, stone=2},
|
||||
groups = {cracky = 3, stone = 2},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
@ -215,17 +217,18 @@ minetest.register_node("watershed:stone", {
|
||||
description = "Stone",
|
||||
tiles = {"default_stone.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky=3},
|
||||
groups = {cracky = 3},
|
||||
drop = "default:cobble",
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("watershed:cactus", {
|
||||
description = "Cactus",
|
||||
tiles = {"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"},
|
||||
tiles = {"default_cactus_top.png", "default_cactus_top.png",
|
||||
"default_cactus_side.png"},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=1,choppy=3,flammable=2},
|
||||
groups = {snappy = 1, choppy = 3, flammable = 2},
|
||||
drop = "default:cactus",
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_place = minetest.rotate_node
|
||||
@ -241,11 +244,11 @@ minetest.register_node("watershed:goldengrass", {
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
groups = {snappy=3,flammable=3,flora=1,attached_node=1},
|
||||
groups = {snappy = 3, flammable = 3, flora = 1, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -0.3125, 0.5},
|
||||
},
|
||||
})
|
||||
|
||||
@ -253,10 +256,10 @@ minetest.register_node("watershed:drygrass", {
|
||||
description = "Dry grass",
|
||||
tiles = {"watershed_drygrass.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly=1,soil=1},
|
||||
groups = {crumbly = 1, soil = 1},
|
||||
drop = "default:dirt",
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_grass_footstep", gain=0.4},
|
||||
footstep = {name = "default_grass_footstep", gain = 0.4},
|
||||
}),
|
||||
})
|
||||
|
||||
@ -264,7 +267,7 @@ minetest.register_node("watershed:permafrost", {
|
||||
description = "Permafrost",
|
||||
tiles = {"watershed_permafrost.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly=1},
|
||||
groups = {crumbly = 1},
|
||||
drop = "default:dirt",
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
@ -279,7 +282,7 @@ minetest.register_node("watershed:vine", {
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
groups = {not_in_creative_inventory=1},
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
})
|
||||
|
||||
minetest.register_node("watershed:freshice", {
|
||||
@ -287,7 +290,7 @@ minetest.register_node("watershed:freshice", {
|
||||
tiles = {"watershed_freshice.png"},
|
||||
is_ground_content = false,
|
||||
paramtype = "light",
|
||||
groups = {cracky=3},
|
||||
groups = {cracky = 3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
@ -302,23 +305,16 @@ minetest.register_node("watershed:cloud", {
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
post_effect_color = {a=23, r=241, g=248, b=255},
|
||||
floodable = true,
|
||||
post_effect_color = {a = 23, r = 241, g = 248, b = 255},
|
||||
})
|
||||
|
||||
minetest.register_node("watershed:luxore", {
|
||||
description = "Lux ore",
|
||||
tiles = {"watershed_luxore.png"},
|
||||
paramtype = "light",
|
||||
light_source = 14,
|
||||
groups = {cracky=3},
|
||||
drop = "watershed:luxcrystal 8",
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("watershed:luxoreoff", {
|
||||
description = "Dark lux ore",
|
||||
tiles = {"watershed_luxore.png"},
|
||||
light_source = 14,
|
||||
groups = {cracky=3},
|
||||
groups = {cracky = 3},
|
||||
drop = "watershed:luxcrystal 8",
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
@ -326,43 +322,41 @@ minetest.register_node("watershed:luxoreoff", {
|
||||
minetest.register_node("watershed:light", {
|
||||
description = "Light",
|
||||
tiles = {"watershed_light.png"},
|
||||
paramtype = "light",
|
||||
light_source = 14,
|
||||
groups = {cracky=3},
|
||||
groups = {cracky = 3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("watershed:acaciawood", {
|
||||
description = "Acacia wood planks",
|
||||
tiles = {"watershed_acaciawood.png"},
|
||||
groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("watershed:pinewood", {
|
||||
description = "Pine wood planks",
|
||||
tiles = {"watershed_pinewood.png"},
|
||||
groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_node("watershed:freshwater", {
|
||||
description = "Freshwater source",
|
||||
inventory_image = minetest.inventorycube("watershed_freshwater.png"),
|
||||
drawtype = "liquid",
|
||||
tiles = {
|
||||
{
|
||||
name="watershed_freshwateranim.png",
|
||||
animation={type="vertical_frames",
|
||||
aspect_w=16, aspect_h=16, length=2.0}
|
||||
name = "watershed_freshwateranim.png",
|
||||
animation = {type = "vertical_frames",
|
||||
aspect_w = 16, aspect_h = 16, length = 2.0}
|
||||
}
|
||||
},
|
||||
special_tiles = {
|
||||
{
|
||||
name="watershed_freshwateranim.png",
|
||||
animation={type="vertical_frames",
|
||||
aspect_w=16, aspect_h=16, length=2.0},
|
||||
name = "watershed_freshwateranim.png",
|
||||
animation = {type = "vertical_frames",
|
||||
aspect_w = 16, aspect_h = 16, length = 2.0},
|
||||
backface_culling = false,
|
||||
}
|
||||
},
|
||||
@ -381,25 +375,26 @@ minetest.register_node("watershed:freshwater", {
|
||||
liquid_viscosity = WATER_VISC,
|
||||
liquid_renewable = false,
|
||||
liquid_range = 2,
|
||||
post_effect_color = {a=64, r=100, g=150, b=200},
|
||||
groups = {water=3, liquid=3, puts_out_fire=1},
|
||||
post_effect_color = {a = 64, r = 100, g = 150, b = 200},
|
||||
groups = {water = 3, liquid = 3, puts_out_fire = 1},
|
||||
})
|
||||
|
||||
minetest.register_node("watershed:freshwaterflow", {
|
||||
description = "Flowing freshwater",
|
||||
inventory_image = minetest.inventorycube("watershed_freshwater.png"),
|
||||
drawtype = "flowingliquid",
|
||||
tiles = {"watershed_freshwater.png"},
|
||||
special_tiles = {
|
||||
{
|
||||
image="watershed_freshwaterflowanim.png",
|
||||
backface_culling=false,
|
||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8}
|
||||
image = "watershed_freshwaterflowanim.png",
|
||||
backface_culling = false,
|
||||
animation = {type = "vertical_frames",
|
||||
aspect_w = 16, aspect_h = 16, length = 0.8}
|
||||
},
|
||||
{
|
||||
image="watershed_freshwaterflowanim.png",
|
||||
backface_culling=true,
|
||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8}
|
||||
image = "watershed_freshwaterflowanim.png",
|
||||
backface_culling = true,
|
||||
animation = {type = "vertical_frames",
|
||||
aspect_w = 16, aspect_h = 16, length = 0.8}
|
||||
},
|
||||
},
|
||||
alpha = WATER_ALPHA,
|
||||
@ -418,22 +413,25 @@ minetest.register_node("watershed:freshwaterflow", {
|
||||
liquid_viscosity = WATER_VISC,
|
||||
liquid_renewable = false,
|
||||
liquid_range = 2,
|
||||
post_effect_color = {a=64, r=100, g=150, b=200},
|
||||
groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1},
|
||||
post_effect_color = {a = 64, r = 100, g = 150, b = 200},
|
||||
groups = {water = 3, liquid = 3, puts_out_fire = 1,
|
||||
not_in_creative_inventory = 1},
|
||||
})
|
||||
|
||||
minetest.register_node("watershed:lava", {
|
||||
description = "Lava source",
|
||||
inventory_image = minetest.inventorycube("default_lava.png"),
|
||||
drawtype = "liquid",
|
||||
tiles = {
|
||||
{name="default_lava_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}
|
||||
{
|
||||
name = "default_lava_source_animated.png",
|
||||
animation = {type = "vertical_frames",
|
||||
aspect_w = 16, aspect_h = 16, length = 3.0}}
|
||||
},
|
||||
special_tiles = {
|
||||
{
|
||||
name="default_lava_source_animated.png",
|
||||
animation={type="vertical_frames",
|
||||
aspect_w=16, aspect_h=16, length=3.0},
|
||||
name = "default_lava_source_animated.png",
|
||||
animation = {type = "vertical_frames",
|
||||
aspect_w = 16, aspect_h = 16, length = 3.0},
|
||||
backface_culling = false,
|
||||
}
|
||||
},
|
||||
@ -453,27 +451,26 @@ minetest.register_node("watershed:lava", {
|
||||
liquid_renewable = false,
|
||||
liquid_range = 2,
|
||||
damage_per_second = 8,
|
||||
post_effect_color = {a=192, r=255, g=64, b=0},
|
||||
groups = {lava=3, liquid=2, hot=3, igniter=1},
|
||||
post_effect_color = {a = 192, r = 255, g = 64, b = 0},
|
||||
groups = {lava = 3, liquid = 2, hot = 3, igniter = 1},
|
||||
})
|
||||
|
||||
minetest.register_node("watershed:lavaflow", {
|
||||
description = "Flowing lava",
|
||||
inventory_image = minetest.inventorycube("default_lava.png"),
|
||||
drawtype = "flowingliquid",
|
||||
tiles = {"default_lava.png"},
|
||||
special_tiles = {
|
||||
{
|
||||
image="default_lava_flowing_animated.png",
|
||||
backface_culling=false,
|
||||
animation={type="vertical_frames",
|
||||
aspect_w=16, aspect_h=16, length=3.3}
|
||||
image = "default_lava_flowing_animated.png",
|
||||
backface_culling = false,
|
||||
animation = {type = "vertical_frames",
|
||||
aspect_w = 16, aspect_h = 16, length = 3.3}
|
||||
},
|
||||
{
|
||||
image="default_lava_flowing_animated.png",
|
||||
backface_culling=true,
|
||||
animation={type="vertical_frames",
|
||||
aspect_w=16, aspect_h=16, length=3.3}
|
||||
image = "default_lava_flowing_animated.png",
|
||||
backface_culling = true,
|
||||
animation = {type = "vertical_frames",
|
||||
aspect_w = 16, aspect_h = 16, length = 3.3}
|
||||
},
|
||||
},
|
||||
paramtype = "light",
|
||||
@ -493,26 +490,26 @@ minetest.register_node("watershed:lavaflow", {
|
||||
liquid_renewable = false,
|
||||
liquid_range = 2,
|
||||
damage_per_second = 8,
|
||||
post_effect_color = {a=192, r=255, g=64, b=0},
|
||||
groups = {lava=3, liquid=2, hot=3, igniter=1, not_in_creative_inventory=1},
|
||||
post_effect_color = {a = 192, r = 255, g = 64, b = 0},
|
||||
groups = {lava = 3, liquid = 2, hot =3, igniter = 1,
|
||||
not_in_creative_inventory = 1},
|
||||
})
|
||||
|
||||
minetest.register_node("watershed:mixwater", {
|
||||
description = "Mixed water source",
|
||||
inventory_image = minetest.inventorycube("watershed_mixwater.png"),
|
||||
drawtype = "liquid",
|
||||
tiles = {
|
||||
{
|
||||
name="watershed_mixwateranim.png",
|
||||
animation={type="vertical_frames",
|
||||
aspect_w=16, aspect_h=16, length=2.0}
|
||||
name = "watershed_mixwateranim.png",
|
||||
animation = {type = "vertical_frames",
|
||||
aspect_w = 16, aspect_h = 16, length = 2.0}
|
||||
}
|
||||
},
|
||||
special_tiles = {
|
||||
{
|
||||
name="watershed_mixwateranim.png",
|
||||
animation={type="vertical_frames",
|
||||
aspect_w=16, aspect_h=16, length=2.0},
|
||||
name = "watershed_mixwateranim.png",
|
||||
animation = {type = "vertical_frames",
|
||||
aspect_w = 16, aspect_h = 16, length = 2.0},
|
||||
backface_culling = false,
|
||||
}
|
||||
},
|
||||
@ -531,25 +528,26 @@ minetest.register_node("watershed:mixwater", {
|
||||
liquid_viscosity = WATER_VISC,
|
||||
liquid_renewable = false,
|
||||
liquid_range = 2,
|
||||
post_effect_color = {a=64, r=100, g=120, b=200},
|
||||
groups = {water=3, liquid=3, puts_out_fire=1},
|
||||
post_effect_color = {a = 64, r = 100, g = 120, b = 200},
|
||||
groups = {water = 3, liquid = 3, puts_out_fire = 1},
|
||||
})
|
||||
|
||||
minetest.register_node("watershed:mixwaterflow", {
|
||||
description = "Flowing mixed water",
|
||||
inventory_image = minetest.inventorycube("watershed_mixwater.png"),
|
||||
drawtype = "flowingliquid",
|
||||
tiles = {"watershed_mixwater.png"},
|
||||
special_tiles = {
|
||||
{
|
||||
image="watershed_mixwaterflowanim.png",
|
||||
backface_culling=false,
|
||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8}
|
||||
image = "watershed_mixwaterflowanim.png",
|
||||
backface_culling = false,
|
||||
animation = {type = "vertical_frames",
|
||||
aspect_w = 16, aspect_h = 16, length = 0.8}
|
||||
},
|
||||
{
|
||||
image="watershed_mixwaterflowanim.png",
|
||||
backface_culling=true,
|
||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8}
|
||||
image = "watershed_mixwaterflowanim.png",
|
||||
backface_culling = true,
|
||||
animation = {type = "vertical_frames",
|
||||
aspect_w = 16, aspect_h = 16, length = 0.8}
|
||||
},
|
||||
},
|
||||
alpha = WATER_ALPHA,
|
||||
@ -568,10 +566,12 @@ minetest.register_node("watershed:mixwaterflow", {
|
||||
liquid_viscosity = WATER_VISC,
|
||||
liquid_renewable = false,
|
||||
liquid_range = 2,
|
||||
post_effect_color = {a=64, r=100, g=120, b=200},
|
||||
groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1},
|
||||
post_effect_color = {a = 64, r = 100, g = 120, b = 200},
|
||||
groups = {water = 3, liquid = 3, puts_out_fire = 1,
|
||||
not_in_creative_inventory = 1},
|
||||
})
|
||||
|
||||
|
||||
-- Items
|
||||
|
||||
minetest.register_craftitem("watershed:luxcrystal", {
|
||||
@ -579,6 +579,7 @@ minetest.register_craftitem("watershed:luxcrystal", {
|
||||
inventory_image = "watershed_luxcrystal.png",
|
||||
})
|
||||
|
||||
|
||||
-- Crafting
|
||||
|
||||
minetest.register_craft({
|
||||
@ -610,6 +611,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
-- Buckets
|
||||
|
||||
bucket.register_liquid(
|
||||
@ -628,6 +630,7 @@ bucket.register_liquid(
|
||||
"WS Lava Bucket"
|
||||
)
|
||||
|
||||
|
||||
-- Fuel
|
||||
|
||||
minetest.register_craft({
|
||||
@ -637,18 +640,25 @@ minetest.register_craft({
|
||||
replacements = {{"watershed:bucket_lava", "bucket:bucket_empty"}},
|
||||
})
|
||||
|
||||
|
||||
-- Register stairs and slabs
|
||||
|
||||
stairs.register_stair_and_slab("acaciawood", "watershed:acaciawood",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
||||
{"watershed_acaciawood.png"},
|
||||
"Acaciawood stair",
|
||||
"Acaciawood slab",
|
||||
default.node_sound_wood_defaults())
|
||||
stairs.register_stair_and_slab(
|
||||
"acaciawood",
|
||||
"watershed:acaciawood",
|
||||
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
|
||||
{"watershed_acaciawood.png"},
|
||||
"Acaciawood stair",
|
||||
"Acaciawood slab",
|
||||
default.node_sound_wood_defaults()
|
||||
)
|
||||
|
||||
stairs.register_stair_and_slab("pinewood", "watershed:pinewood",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
||||
{"watershed_pinewood.png"},
|
||||
"Pinewood stair",
|
||||
"Pinewood slab",
|
||||
default.node_sound_wood_defaults())
|
||||
stairs.register_stair_and_slab(
|
||||
"pinewood",
|
||||
"watershed:pinewood",
|
||||
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
|
||||
{"watershed_pinewood.png"},
|
||||
"Pinewood stair",
|
||||
"Pinewood slab",
|
||||
default.node_sound_wood_defaults()
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user