Compare commits
5 Commits
22a1397030
...
b06e40a5ed
Author | SHA1 | Date |
---|---|---|
paramat | b06e40a5ed | |
paramat | c536b9c2c9 | |
Mat | a582d315fd | |
Mat | b9d9b1ed5c | |
Mat | 1d55495506 |
20
README.txt
20
README.txt
|
@ -1,4 +1,18 @@
|
|||
noisegrid 0.3.6 by paramat
|
||||
For latest stable Minetest back to 0.4.8
|
||||
noisegrid 0.4.0 by paramat
|
||||
For Minetest 0.4.12 and later
|
||||
Depends default
|
||||
Licenses: code WTFPL
|
||||
Licenses: Code LGPL 2.1, textures CC BY-SA
|
||||
|
||||
For use with 'singlenode' mapgen.
|
||||
City street grid areas, coastal intercity roads, tunnel roads, 2 dirt paths, wooden bridges over fissures.
|
||||
Underground fissure system.
|
||||
All default ores.
|
||||
White lines, raised half-slab pavements.
|
||||
Mountains up to y = 256.
|
||||
Tree, grass and flower areas with varying density.
|
||||
Mod's own appletree drops saplings that are grown by voxelmanip.
|
||||
Overgeneration is used in x and z axes for continuous roads and paths over chunk borders.
|
||||
|
||||
Spawnplayer function randomly searches a large area for land to spawn players on.
|
||||
Players are spawned scattered up to 1280 nodes from world centre.
|
||||
The player scatter from world centre can be set by parameter 'PSCA' in the functions.lua file, since oceans can be up to 2kn across searches will fail when PSCA is set too small.
|
||||
|
|
122
functions.lua
122
functions.lua
|
@ -2,19 +2,20 @@ function noisegrid_appletree(x, y, z, area, data)
|
|||
local c_tree = minetest.get_content_id("default:tree")
|
||||
local c_apple = minetest.get_content_id("default:apple")
|
||||
local c_appleaf = minetest.get_content_id("noisegrid:appleleaf")
|
||||
for j = -2, 4 do
|
||||
if j == 3 or j == 4 then
|
||||
local top = 3 + math.random(2)
|
||||
for j = -2, top do
|
||||
if j == top - 1 or j == top then
|
||||
for i = -2, 2 do
|
||||
for k = -2, 2 do
|
||||
local vi = area:index(x + i, y + j, z + k)
|
||||
if math.random(50) == 2 then
|
||||
if j == top - 1 and math.random() < 0.04 then
|
||||
data[vi] = c_apple
|
||||
elseif math.random(5) ~= 2 then
|
||||
data[vi] = c_appleaf
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif j == 2 then
|
||||
elseif j == top - 2 then
|
||||
for i = -1, 1 do
|
||||
for k = -1, 1 do
|
||||
if math.abs(i) + math.abs(k) == 2 then
|
||||
|
@ -30,6 +31,7 @@ function noisegrid_appletree(x, y, z, area, data)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
function noisegrid_grass(data, vi)
|
||||
local c_grass1 = minetest.get_content_id("default:grass_1")
|
||||
local c_grass2 = minetest.get_content_id("default:grass_2")
|
||||
|
@ -50,6 +52,7 @@ function noisegrid_grass(data, vi)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
function noisegrid_flower(data, vi)
|
||||
local c_danwhi = minetest.get_content_id("flowers:dandelion_white")
|
||||
local c_danyel = minetest.get_content_id("flowers:dandelion_yellow")
|
||||
|
@ -73,125 +76,28 @@ function noisegrid_flower(data, vi)
|
|||
end
|
||||
end
|
||||
|
||||
-- ABM
|
||||
|
||||
-- Appletree sapling
|
||||
-- Appletree sapling ABM
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"noisegrid:appling"},
|
||||
interval = 31,
|
||||
chance = 5,
|
||||
chance = 7,
|
||||
action = function(pos, node)
|
||||
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-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 + 5, 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()
|
||||
|
||||
noisegrid_appletree(x, y, z, area, data)
|
||||
|
||||
vm:set_data(data)
|
||||
vm:write_to_map()
|
||||
vm:update_map()
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"noisegrid:lightoff"},
|
||||
interval = 5,
|
||||
chance = 8,
|
||||
action = function(pos, node)
|
||||
minetest.add_node(pos, {name="noisegrid:lighton"})
|
||||
nodeupdate(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Set mapgen parameters
|
||||
|
||||
minetest.register_on_mapgen_init(function(mgparams)
|
||||
minetest.set_mapgen_params({mgname="singlenode"})
|
||||
end)
|
||||
|
||||
-- Spawn player
|
||||
|
||||
function spawnplayer(player)
|
||||
-- Parameters
|
||||
local PSCA = 16 -- Player scatter. Maximum distance in chunks (80 nodes) of player spawn from (0, 0, 0)
|
||||
local YFLAT = 7 -- Flat area elevation
|
||||
local TERSCA = 192 -- Vertical terrain scale
|
||||
local TFLAT = 0.2 -- Flat area width
|
||||
|
||||
local xsp
|
||||
local ysp
|
||||
local zsp
|
||||
local np_base = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=2048, y=2048, z=2048},
|
||||
seed = -9111,
|
||||
octaves = 6,
|
||||
persist = 0.6
|
||||
}
|
||||
for chunk = 1, 128 do
|
||||
print ("[noisegrid] searching for spawn "..chunk)
|
||||
local x0 = 80 * math.random(-PSCA, PSCA) - 32
|
||||
local z0 = 80 * math.random(-PSCA, PSCA) - 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 minposxz = {x=x0, y=z0}
|
||||
|
||||
local nvals_base = minetest.get_perlin_map(np_base, chulens):get2dMap_flat(minposxz)
|
||||
|
||||
local nixz = 1
|
||||
for z = z0, z1 do
|
||||
for x = x0, x1 do
|
||||
local ysurf
|
||||
local n_base = nvals_base[nixz]
|
||||
local n_absbase = math.abs(n_base)
|
||||
if n_base > TFLAT then
|
||||
ysurf = YFLAT + math.floor((n_base - TFLAT) * TERSCA)
|
||||
elseif n_base < -TFLAT then
|
||||
ysurf = YFLAT - math.floor((-TFLAT - n_base) * TERSCA)
|
||||
else
|
||||
ysurf = YFLAT
|
||||
end
|
||||
if ysurf >= 1 then
|
||||
ysp = ysurf + 1
|
||||
xsp = x
|
||||
zsp = z
|
||||
break
|
||||
end
|
||||
nixz = nixz + 1
|
||||
end
|
||||
if ysp then
|
||||
break
|
||||
end
|
||||
end
|
||||
if ysp then
|
||||
break
|
||||
end
|
||||
end
|
||||
if ysp then
|
||||
print ("[noisegrid] spawn player ("..xsp.." "..ysp.." "..zsp..")")
|
||||
player:setpos({x=xsp, y=ysp, z=zsp})
|
||||
else
|
||||
print ("[noisegrid] no suitable spawn found")
|
||||
player:setpos({x=0, y=2, z=0})
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_on_newplayer(function(player)
|
||||
spawnplayer(player)
|
||||
end)
|
||||
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
spawnplayer(player)
|
||||
return true
|
||||
end)
|
499
init.lua
499
init.lua
|
@ -1,34 +1,31 @@
|
|||
-- noisegrid 0.3.6 by paramat
|
||||
-- For latest stable Minetest and back to 0.4.8
|
||||
-- Depends default
|
||||
-- License: code WTFPL
|
||||
|
||||
-- fix grid element indexes again
|
||||
-- tune noise params
|
||||
-- 2 paths with 512n scale
|
||||
|
||||
-- Parameters
|
||||
|
||||
local YFLAT = 7 -- Flat area elevation y
|
||||
local YSAND = 4 -- Top of beach y
|
||||
local TERSCA = 192 -- Vertical terrain scale in nodes
|
||||
local STODEP = 5 -- Stone depth below surface in nodes at sea level
|
||||
local TGRID = 0.18 -- Grid area width
|
||||
local TGRID = 0.18 -- City grid area width
|
||||
local TFLAT = 0.2 -- Flat coastal area width
|
||||
local TCITY = 0.3 -- City size. 0.3 = 1/3 of coastal land area, 0 = 1/2 of coastal land area
|
||||
|
||||
local TFIS = 0.02 -- Fissure width
|
||||
local ORECHA = 1 / 5 ^ 3 -- Ore chance per stone node. 1 / n ^ 3 where n = average distance between ores
|
||||
local APPCHA = 1 / 4 ^ 2 -- Appletree maximum chance per grass node. 1 / n ^ 2 where n = minimum average distance between flora
|
||||
local TCITY = 0 -- City size.
|
||||
-- 0.3 = 1/3 of coastal land area, 0 = 1/2 of coastal land area.
|
||||
local TFIS = 0.01 -- Fissure width
|
||||
local TTUN = 0.02 -- Tunnel width
|
||||
local LUXCHA = 1 / 9 ^ 3 -- Luxore chance per stone node.
|
||||
local ORECHA = 1 / 5 ^ 3 -- Ore chance per stone node.
|
||||
-- 1 / n ^ 3 where n = average distance between ores.
|
||||
local APPCHA = 1 / 4 ^ 2 -- Appletree maximum chance per grass node.
|
||||
-- 1 / n ^ 2 where n = minimum average distance between flora.
|
||||
local FLOCHA = 1 / 13 ^ 2 -- Flowers maximum chance per grass node
|
||||
local GRACHA = 1 / 5 ^ 2 -- Grasses maximum chance per grass node
|
||||
local PSCA = 16 -- Player scatter. Maximum distance in chunks (80 nodes)
|
||||
-- of player spawn points from (0, 0, 0).
|
||||
|
||||
-- 2D noise for base terrain
|
||||
|
||||
local np_base = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=2048, y=2048, z=2048},
|
||||
spread = {x = 2048, y = 2048, z = 2048},
|
||||
seed = -9111,
|
||||
octaves = 6,
|
||||
persist = 0.6
|
||||
|
@ -39,9 +36,9 @@ local np_base = {
|
|||
local np_road = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=2048, y=2048, z=2048},
|
||||
seed = -9111,
|
||||
octaves = 4,
|
||||
spread = {x = 2048, y = 2048, z = 2048},
|
||||
seed = -9111, -- same seed as above for similar structre but smoother
|
||||
octaves = 5,
|
||||
persist = 0.5
|
||||
}
|
||||
|
||||
|
@ -50,7 +47,7 @@ local np_road = {
|
|||
local np_alt = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=1024, y=1024, z=1024},
|
||||
spread = {x = 1024, y = 1024, z = 1024},
|
||||
seed = 11,
|
||||
octaves = 3,
|
||||
persist = 0.4
|
||||
|
@ -61,7 +58,7 @@ local np_alt = {
|
|||
local np_city = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=1024, y=1024, z=1024},
|
||||
spread = {x = 1024, y = 1024, z = 1024},
|
||||
seed = 3166616,
|
||||
octaves = 2,
|
||||
persist = 0.5
|
||||
|
@ -72,7 +69,7 @@ local np_city = {
|
|||
local np_path = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=512, y=512, z=512},
|
||||
spread = {x = 512, y = 512, z = 512},
|
||||
seed = 7000023,
|
||||
octaves = 4,
|
||||
persist = 0.4
|
||||
|
@ -81,7 +78,7 @@ local np_path = {
|
|||
local np_path2 = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=512, y=512, z=512},
|
||||
spread = {x = 512, y = 512, z = 512},
|
||||
seed = -2315551,
|
||||
octaves = 4,
|
||||
persist = 0.4
|
||||
|
@ -92,7 +89,7 @@ local np_path2 = {
|
|||
local np_tree = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=256, y=256, z=256},
|
||||
spread = {x = 256, y = 256, z = 256},
|
||||
seed = 133338,
|
||||
octaves = 3,
|
||||
persist = 0.5
|
||||
|
@ -103,7 +100,7 @@ local np_tree = {
|
|||
local np_grass = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=256, y=256, z=256},
|
||||
spread = {x = 256, y = 256, z = 256},
|
||||
seed = 133,
|
||||
octaves = 2,
|
||||
persist = 0.5
|
||||
|
@ -114,37 +111,91 @@ local np_grass = {
|
|||
local np_flower = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=256, y=256, z=256},
|
||||
spread = {x = 256, y = 256, z = 256},
|
||||
seed = -70008,
|
||||
octaves = 2,
|
||||
octaves = 1,
|
||||
persist = 0.5
|
||||
}
|
||||
|
||||
|
||||
-- 3D noise for fissures
|
||||
|
||||
local np_fissure = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=192, y=192, z=192},
|
||||
spread = {x = 384, y = 384, z = 384},
|
||||
seed = 2001,
|
||||
octaves = 4,
|
||||
persist = 0.5
|
||||
}
|
||||
|
||||
-- Stuff
|
||||
-- 3D noise for web a
|
||||
|
||||
noisegrid = {}
|
||||
local np_weba = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x = 192, y = 192, z = 192},
|
||||
seed = 5900033,
|
||||
octaves = 3,
|
||||
persist = 0.5
|
||||
}
|
||||
|
||||
dofile(minetest.get_modpath("noisegrid").."/functions.lua")
|
||||
dofile(minetest.get_modpath("noisegrid").."/nodes.lua")
|
||||
-- 3D noise for web b
|
||||
|
||||
local np_webb = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x = 191, y = 191, z = 191},
|
||||
seed = 33,
|
||||
octaves = 3,
|
||||
persist = 0.5
|
||||
}
|
||||
|
||||
-- 3D noise for web c
|
||||
|
||||
local np_webc = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x = 190, y = 190, z = 190},
|
||||
seed = -18000001,
|
||||
octaves = 3,
|
||||
persist = 0.5
|
||||
}
|
||||
|
||||
|
||||
-- Do files
|
||||
|
||||
dofile(minetest.get_modpath("noisegrid") .. "/functions.lua")
|
||||
dofile(minetest.get_modpath("noisegrid") .. "/nodes.lua")
|
||||
|
||||
|
||||
-- Set mapgen parameters
|
||||
|
||||
minetest.register_on_mapgen_init(function(mgparams)
|
||||
minetest.set_mapgen_params({mgname = "singlenode", flags = "nolight"})
|
||||
end)
|
||||
|
||||
|
||||
-- Initialize noise objects to nil
|
||||
|
||||
local nobj_base = nil
|
||||
local nobj_road = nil
|
||||
local nobj_alt = nil
|
||||
local nobj_city = nil
|
||||
local nobj_path = nil
|
||||
local nobj_path2 = nil
|
||||
local nobj_tree = nil
|
||||
local nobj_grass = nil
|
||||
local nobj_flower = nil
|
||||
|
||||
local nobj_fissure = nil
|
||||
local nobj_weba = nil
|
||||
local nobj_webb = nil
|
||||
local nobj_webc = nil
|
||||
|
||||
-- On generated function
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
if minp.y > 208 then
|
||||
return
|
||||
end
|
||||
|
||||
local t1 = os.clock()
|
||||
local x1 = maxp.x
|
||||
local y1 = maxp.y
|
||||
|
@ -153,25 +204,25 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
local y0 = minp.y
|
||||
local z0 = minp.z
|
||||
|
||||
print ("[noisegrid] chunk minp ("..x0.." "..y0.." "..z0..")")
|
||||
|
||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
||||
local area = VoxelArea:new{MinEdge = emin, MaxEdge = emax}
|
||||
local data = vm:get_data()
|
||||
|
||||
local c_air = minetest.get_content_id("air")
|
||||
local c_grass = minetest.get_content_id("noisegrid:grass")
|
||||
local c_dirt = minetest.get_content_id("noisegrid:dirt")
|
||||
local c_stone = minetest.get_content_id("noisegrid:stone")
|
||||
local c_air = minetest.get_content_id("air")
|
||||
local c_grass = minetest.get_content_id("noisegrid:grass")
|
||||
local c_dirt = minetest.get_content_id("noisegrid:dirt")
|
||||
local c_stone = minetest.get_content_id("noisegrid:stone")
|
||||
local c_roadblack = minetest.get_content_id("noisegrid:roadblack")
|
||||
local c_roadwhite = minetest.get_content_id("noisegrid:roadwhite")
|
||||
local c_slab = minetest.get_content_id("noisegrid:slab")
|
||||
local c_path = minetest.get_content_id("noisegrid:path")
|
||||
local c_light = minetest.get_content_id("noisegrid:lightoff")
|
||||
local c_concrete = minetest.get_content_id("noisegrid:concrete")
|
||||
local c_slab = minetest.get_content_id("noisegrid:slab")
|
||||
local c_path = minetest.get_content_id("noisegrid:path")
|
||||
local c_concrete = minetest.get_content_id("noisegrid:concrete")
|
||||
local c_light = minetest.get_content_id("noisegrid:light")
|
||||
local c_luxore = minetest.get_content_id("noisegrid:luxore")
|
||||
|
||||
local c_water = minetest.get_content_id("default:water_source")
|
||||
local c_sand = minetest.get_content_id("default:sand")
|
||||
local c_water = minetest.get_content_id("default:water_source")
|
||||
local c_sand = minetest.get_content_id("default:sand")
|
||||
local c_wood = minetest.get_content_id("default:wood")
|
||||
local c_stodiam = minetest.get_content_id("default:stone_with_diamond")
|
||||
local c_stomese = minetest.get_content_id("default:stone_with_mese")
|
||||
local c_stogold = minetest.get_content_id("default:stone_with_gold")
|
||||
|
@ -180,49 +231,68 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
local c_stocoal = minetest.get_content_id("default:stone_with_coal")
|
||||
|
||||
local sidelen = x1 - x0 + 1
|
||||
local chulensxyz = {x=sidelen+1, y=sidelen, z=sidelen+1}
|
||||
local minposxyz = {x=x0-1, y=y0, z=z0-1}
|
||||
local chulensxz = {x=sidelen+1, y=sidelen+1, z=sidelen} -- different because here x=x, y=z
|
||||
local minposxz = {x=x0-1, y=z0-1}
|
||||
local overlen = sidelen + 1
|
||||
local chulensxyz = {x = overlen, y = sidelen, z = overlen}
|
||||
local minposxyz = {x = x0 - 1, y = y0, z = z0 - 1}
|
||||
local chulensxz = {x = overlen, y = overlen, z = 1} -- different because here x=x, y=z
|
||||
local minposxz = {x = x0 - 1, y = z0 - 1}
|
||||
|
||||
local nvals_base = minetest.get_perlin_map(np_base, chulensxz):get2dMap_flat(minposxz)
|
||||
local nvals_road = minetest.get_perlin_map(np_road, chulensxz):get2dMap_flat(minposxz)
|
||||
local nvals_alt = minetest.get_perlin_map(np_alt, chulensxz):get2dMap_flat(minposxz)
|
||||
local nvals_city = minetest.get_perlin_map(np_city, chulensxz):get2dMap_flat(minposxz)
|
||||
local nvals_path = minetest.get_perlin_map(np_path, chulensxz):get2dMap_flat(minposxz)
|
||||
local nvals_path2 = minetest.get_perlin_map(np_path2, chulensxz):get2dMap_flat(minposxz)
|
||||
local nvals_tree = minetest.get_perlin_map(np_tree, chulensxz):get2dMap_flat(minposxz)
|
||||
local nvals_grass = minetest.get_perlin_map(np_grass, chulensxz):get2dMap_flat(minposxz)
|
||||
local nvals_flower = minetest.get_perlin_map(np_flower, chulensxz):get2dMap_flat(minposxz)
|
||||
nobj_base = nobj_base or minetest.get_perlin_map(np_base, chulensxz)
|
||||
nobj_road = nobj_road or minetest.get_perlin_map(np_road, chulensxz)
|
||||
nobj_alt = nobj_alt or minetest.get_perlin_map(np_alt, chulensxz)
|
||||
nobj_city = nobj_city or minetest.get_perlin_map(np_city, chulensxz)
|
||||
nobj_path = nobj_path or minetest.get_perlin_map(np_path, chulensxz)
|
||||
nobj_path2 = nobj_path2 or minetest.get_perlin_map(np_path2, chulensxz)
|
||||
nobj_tree = nobj_tree or minetest.get_perlin_map(np_tree, chulensxz)
|
||||
nobj_grass = nobj_grass or minetest.get_perlin_map(np_grass, chulensxz)
|
||||
nobj_flower = nobj_flower or minetest.get_perlin_map(np_flower, chulensxz)
|
||||
|
||||
local nvals_fissure = minetest.get_perlin_map(np_fissure, chulensxyz):get3dMap_flat(minposxyz)
|
||||
nobj_fissure = nobj_fissure or minetest.get_perlin_map(np_fissure, chulensxyz)
|
||||
nobj_weba = nobj_weba or minetest.get_perlin_map(np_weba, chulensxyz)
|
||||
nobj_webb = nobj_webb or minetest.get_perlin_map(np_webb, chulensxyz)
|
||||
nobj_webc = nobj_webc or minetest.get_perlin_map(np_webc, chulensxyz)
|
||||
|
||||
local cross = math.abs(nvals_base[3281]) < TGRID and nvals_city[3281] > TCITY -- grid elements enabled per chunk
|
||||
local nroad = math.abs(nvals_base[6521]) < TGRID and nvals_city[6521] > TCITY
|
||||
local eroad = math.abs(nvals_base[3321]) < TGRID and nvals_city[3321] > TCITY
|
||||
local sroad = math.abs(nvals_base[122]) < TGRID and nvals_city[122] > TCITY
|
||||
local nvals_base = nobj_base :get2dMap_flat(minposxz)
|
||||
local nvals_road = nobj_road :get2dMap_flat(minposxz)
|
||||
local nvals_alt = nobj_alt :get2dMap_flat(minposxz)
|
||||
local nvals_city = nobj_city :get2dMap_flat(minposxz)
|
||||
local nvals_path = nobj_path :get2dMap_flat(minposxz)
|
||||
local nvals_path2 = nobj_path2 :get2dMap_flat(minposxz)
|
||||
local nvals_tree = nobj_tree :get2dMap_flat(minposxz)
|
||||
local nvals_grass = nobj_grass :get2dMap_flat(minposxz)
|
||||
local nvals_flower = nobj_flower:get2dMap_flat(minposxz)
|
||||
|
||||
local nvals_fissure = nobj_fissure:get3dMap_flat(minposxyz)
|
||||
local nvals_weba = nobj_weba :get3dMap_flat(minposxyz)
|
||||
local nvals_webb = nobj_webb :get3dMap_flat(minposxyz)
|
||||
local nvals_webc = nobj_webc :get3dMap_flat(minposxyz)
|
||||
|
||||
local cross = math.abs(nvals_base[3281]) < TGRID and nvals_city[3281] > TCITY -- grid elements
|
||||
local nroad = math.abs(nvals_base[6521]) < TGRID and nvals_city[6521] > TCITY -- enabled per chunk,
|
||||
local eroad = math.abs(nvals_base[3321]) < TGRID and nvals_city[3321] > TCITY -- dependant on
|
||||
local sroad = math.abs(nvals_base[122]) < TGRID and nvals_city[122] > TCITY -- chunksize = 5.
|
||||
local wroad = math.abs(nvals_base[3242]) < TGRID and nvals_city[3242] > TCITY
|
||||
|
||||
local nixz = 1
|
||||
local nixyz = 1
|
||||
local stable = {}
|
||||
for z = z0-1, z1 do
|
||||
for x = x0-1, x1 do
|
||||
local si = x - x0 + 2
|
||||
for z = z0 - 1, z1 do
|
||||
for x = x0 - 1, x1 do
|
||||
local si = x - x0 + 2 -- +2 because overgeneration
|
||||
stable[si] = 2
|
||||
end
|
||||
for y = y0, y1 do
|
||||
local vi = area:index(x0-1, y, z)
|
||||
local via = area:index(x0-1, y+1, z)
|
||||
local vi = area:index(x0 - 1, y, z)
|
||||
local via = area:index(x0 - 1, y + 1, z)
|
||||
local n_xprepath = false
|
||||
local n_xprepath2 = false
|
||||
local n_xpreroad = false
|
||||
local n_xprealt = false
|
||||
for x = x0-1, x1 do
|
||||
for x = x0 - 1, x1 do
|
||||
local nodid = data[vi]
|
||||
local si = x - x0 + 2
|
||||
local xr = x - x0
|
||||
local zr = z - z0
|
||||
local si = xr + 2
|
||||
local chunk = (x >= x0 and z >= z0)
|
||||
|
||||
local sea = false
|
||||
|
@ -240,8 +310,15 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
flat = true
|
||||
end
|
||||
|
||||
local weba = math.abs(nvals_weba[nixyz]) < TTUN
|
||||
local webb = math.abs(nvals_webb[nixyz]) < TTUN
|
||||
local webc = math.abs(nvals_webc[nixyz]) < TTUN
|
||||
|
||||
local n_fissure = nvals_fissure[nixyz]
|
||||
local nofis = math.abs(n_fissure) > TFIS
|
||||
local n_absfissure = math.abs(n_fissure)
|
||||
local nofis = n_absfissure > TFIS and
|
||||
not (weba and webb) and not (weba and webc)
|
||||
local wood = n_absfissure < TFIS * 2 and not flat
|
||||
|
||||
local n_city = nvals_city[nixz]
|
||||
local city = n_city > TCITY
|
||||
|
@ -252,55 +329,65 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
|
||||
local n_path = nvals_path[nixz]
|
||||
local n_abspath = math.abs(n_path)
|
||||
local n_zprepath = nvals_path[(nixz - 81)]
|
||||
local n_zprepath = nvals_path[(nixz - overlen)]
|
||||
|
||||
local n_path2 = nvals_path2[nixz]
|
||||
local n_abspath2 = math.abs(n_path2)
|
||||
local n_zprepath2 = nvals_path2[(nixz - 81)]
|
||||
local n_zprepath2 = nvals_path2[(nixz - overlen)]
|
||||
|
||||
local n_road = nvals_road[nixz]
|
||||
local n_absroad = math.abs(n_road)
|
||||
local n_zpreroad = nvals_road[(nixz - 81)]
|
||||
local n_zpreroad = nvals_road[(nixz - overlen)]
|
||||
|
||||
local n_alt = nvals_alt[nixz]
|
||||
local n_absalt = math.abs(n_alt)
|
||||
local n_zprealt = nvals_alt[(nixz - 81)]
|
||||
local n_zprealt = nvals_alt[(nixz - overlen)]
|
||||
|
||||
local stodep = math.max(STODEP * (TERSCA - y) / TERSCA, 1)
|
||||
|
||||
if chunk then
|
||||
if y == YFLAT and n_base > -TGRID -- tunnel road
|
||||
and (((n_alt >= 0 and n_xprealt < 0)
|
||||
or (n_alt < 0 and n_xprealt >= 0))
|
||||
or ((n_alt >= 0 and n_zprealt < 0)
|
||||
or (n_alt < 0 and n_zprealt >= 0))) then
|
||||
-- tunnel road
|
||||
if y == YFLAT and n_base > -TGRID and
|
||||
(((n_alt >= 0 and n_xprealt < 0) or
|
||||
(n_alt < 0 and n_xprealt >= 0)) or
|
||||
((n_alt >= 0 and n_zprealt < 0) or
|
||||
(n_alt < 0 and n_zprealt >= 0))) then
|
||||
data[vi] = c_roadwhite
|
||||
for i = -3, 3 do
|
||||
for k = -3, 3 do
|
||||
if (math.abs(i)) ^ 2 + (math.abs(k)) ^ 2 <= 13 then
|
||||
local vi = area:index(x+i, y, z+k)
|
||||
local via = area:index(x+i, y+1, z+k)
|
||||
local vi = area:index(x + i, y, z + k)
|
||||
local via = area:index(x + i, y + 1, z + k)
|
||||
local nodid = data[vi]
|
||||
if nodid ~= c_roadwhite then
|
||||
data[vi] = c_roadblack
|
||||
end
|
||||
data[via] = c_air
|
||||
data[via] = c_air -- to remove pavements
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif y <= ysurf and y >= YFLAT + 1 and y <= YFLAT + 4 and n_absalt < 0.025 then -- tunnel air
|
||||
-- tunnel air
|
||||
elseif y <= ysurf and y >= YFLAT + 1 and y <= YFLAT + 4 and
|
||||
n_absalt < 0.025 then
|
||||
data[vi] = c_air
|
||||
stable[si] = 0
|
||||
elseif y <= ysurf - 1 and y == YFLAT + 5 and n_absalt > 0.003 and n_absalt < 0.007 then -- tunnel lights
|
||||
-- tunnel lights
|
||||
elseif y <= ysurf - 1 and y == YFLAT + 5 and n_absalt > 0.003 and
|
||||
n_absalt < 0.007 then
|
||||
data[vi] = c_light
|
||||
stable[si] = stable[si] + 1
|
||||
elseif y <= ysurf and y >= YFLAT and y <= YFLAT + 6 -- tunnel concrete
|
||||
and n_absalt < 0.035 and n_base > TFLAT and nodid ~= c_roadblack then
|
||||
-- tunnel concrete
|
||||
elseif y <= ysurf and y >= YFLAT and y <= YFLAT + 6 and
|
||||
n_absalt < 0.035 and n_base > TFLAT and
|
||||
nodid ~= c_roadblack then
|
||||
data[vi] = c_concrete
|
||||
stable[si] = stable[si] + 1
|
||||
elseif y <= ysurf - stodep and (nofis or ((flat or sea) -- stone
|
||||
and y >= ysurf - 16)) and nodid ~= c_roadblack then
|
||||
if math.random() < ORECHA then
|
||||
-- stone and ores
|
||||
elseif y <= ysurf - stodep and nodid ~= c_roadblack and
|
||||
(nofis or ((flat or sea) and y >= ysurf - 16)) then
|
||||
if math.random() < LUXCHA then
|
||||
data[vi] = c_luxore
|
||||
elseif math.random() < ORECHA then
|
||||
local osel = math.random(24)
|
||||
if osel == 24 then
|
||||
data[vi] = c_stodiam
|
||||
|
@ -319,15 +406,19 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
data[vi] = c_stone
|
||||
end
|
||||
stable[si] = stable[si] + 1
|
||||
elseif y == ysurf and y > YSAND then -- surface layer
|
||||
if ((n_road >= 0 and n_xpreroad < 0) or (n_road < 0 and n_xpreroad >= 0)) -- intercity road
|
||||
or ((n_road >= 0 and n_zpreroad < 0) or (n_road < 0 and n_zpreroad >= 0)) then
|
||||
-- surface layer
|
||||
elseif y == ysurf and y > YSAND then
|
||||
-- intercity road
|
||||
if ((n_road >= 0 and n_xpreroad < 0) or
|
||||
(n_road < 0 and n_xpreroad >= 0)) or
|
||||
((n_road >= 0 and n_zpreroad < 0) or
|
||||
(n_road < 0 and n_zpreroad >= 0)) then
|
||||
data[vi] = c_roadwhite
|
||||
for i = -3, 3 do
|
||||
for k = -3, 3 do
|
||||
if (math.abs(i)) ^ 2 + (math.abs(k)) ^ 2 <= 13 then
|
||||
local vi = area:index(x+i, y, z+k)
|
||||
local via = area:index(x+i, y+1, z+k)
|
||||
local vi = area:index(x + i, y, z + k)
|
||||
local via = area:index(x + i, y + 1, z + k)
|
||||
local nodid = data[vi]
|
||||
if nodid ~= c_roadwhite then
|
||||
data[vi] = c_roadblack
|
||||
|
@ -336,15 +427,19 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
end
|
||||
end
|
||||
end
|
||||
elseif xr >= 36 and xr <= 42 and zr >= 36 and zr <= 42 -- city grid
|
||||
and (nroad or eroad or sroad or wroad) and cross and nodid ~= c_roadblack then -- junction
|
||||
-- city grid
|
||||
-- junction
|
||||
elseif xr >= 36 and xr <= 42 and zr >= 36 and zr <= 42 and
|
||||
(nroad or eroad or sroad or wroad) and
|
||||
cross and nodid ~= c_roadblack then
|
||||
if xr == 39 and zr == 39 then
|
||||
data[vi] = c_roadwhite
|
||||
else
|
||||
data[vi] = c_roadblack
|
||||
end
|
||||
elseif xr >= 33 and xr <= 45 and zr >= 43 -- north road
|
||||
and nroad and cross and nodid ~= c_roadblack then
|
||||
-- north road
|
||||
elseif xr >= 33 and xr <= 45 and zr >= 43 and nroad and
|
||||
cross and nodid ~= c_roadblack then
|
||||
if xr == 39 then
|
||||
data[vi] = c_roadwhite
|
||||
elseif xr >= 36 and xr <= 42 then
|
||||
|
@ -353,8 +448,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
data[vi] = c_dirt
|
||||
data[via] = c_slab
|
||||
end
|
||||
elseif xr >= 43 and zr >= 33 and zr <= 45 -- east road
|
||||
and eroad and cross and nodid ~= c_roadblack then
|
||||
-- east road
|
||||
elseif xr >= 43 and zr >= 33 and zr <= 45 and eroad and
|
||||
cross and nodid ~= c_roadblack then
|
||||
if zr == 39 then
|
||||
data[vi] = c_roadwhite
|
||||
elseif zr >= 36 and zr <= 42 then
|
||||
|
@ -363,8 +459,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
data[vi] = c_dirt
|
||||
data[via] = c_slab
|
||||
end
|
||||
elseif xr >= 33 and xr <= 45 and zr <= 35 -- south road
|
||||
and sroad and cross and nodid ~= c_roadblack then
|
||||
-- south road
|
||||
elseif xr >= 33 and xr <= 45 and zr <= 35 and sroad and
|
||||
cross and nodid ~= c_roadblack then
|
||||
if xr == 39 then
|
||||
data[vi] = c_roadwhite
|
||||
elseif xr >= 36 and xr <= 42 then
|
||||
|
@ -373,8 +470,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
data[vi] = c_dirt
|
||||
data[via] = c_slab
|
||||
end
|
||||
elseif xr <= 35 and zr >= 33 and zr <= 45 -- west road
|
||||
and wroad and cross and nodid ~= c_roadblack then
|
||||
-- west road
|
||||
elseif xr <= 35 and zr >= 33 and zr <= 45 and wroad and
|
||||
cross and nodid ~= c_roadblack then
|
||||
if zr == 39 then
|
||||
data[vi] = c_roadwhite
|
||||
elseif zr >= 36 and zr <= 42 then
|
||||
|
@ -383,63 +481,104 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
data[vi] = c_dirt
|
||||
data[via] = c_slab
|
||||
end
|
||||
elseif xr >= 33 and xr <= 45 and zr >= 33 and zr <= 45 -- pavement in junction gaps
|
||||
and (nroad or eroad or sroad or wroad) and cross and nodid ~= c_roadblack then
|
||||
-- pavement in junction gaps
|
||||
elseif xr >= 33 and xr <= 45 and zr >= 33 and zr <= 45 and
|
||||
(nroad or eroad or sroad or wroad) and
|
||||
cross and nodid ~= c_roadblack then
|
||||
data[vi] = c_dirt
|
||||
data[via] = c_slab
|
||||
elseif (n_absroad < 0.01 or n_absalt < 0.02) and flat and city and nodid ~= c_roadblack then
|
||||
data[vi] = c_dirt -- pavement of intercity road and tunnel road in city
|
||||
data[via] = c_slab
|
||||
elseif ((n_path >= 0 and n_xprepath < 0) or (n_path < 0 and n_xprepath >= 0)) -- path
|
||||
or ((n_path >= 0 and n_zprepath < 0) or (n_path < 0 and n_zprepath >= 0)) then
|
||||
-- path 1
|
||||
elseif ((n_path >= 0 and n_xprepath < 0) or
|
||||
(n_path < 0 and n_xprepath >= 0)) or
|
||||
((n_path >= 0 and n_zprepath < 0) or
|
||||
(n_path < 0 and n_zprepath >= 0)) then
|
||||
if wood then
|
||||
local viu = area:index(x, y - 1, z)
|
||||
local viuu = area:index(x, y - 2, z)
|
||||
data[viu] = c_wood
|
||||
data[viuu] = c_wood
|
||||
end
|
||||
for i = -1, 1 do
|
||||
for k = -1, 1 do
|
||||
local vi = area:index(x+i, y, z+k)
|
||||
local vi = area:index(x + i, y, z + k)
|
||||
local nodid = data[vi]
|
||||
if nodid ~= c_roadwhite and nodid ~= c_roadblack then
|
||||
data[vi] = c_path
|
||||
if nodid ~= c_roadwhite and
|
||||
nodid ~= c_roadblack then
|
||||
if wood then
|
||||
data[vi] = c_wood
|
||||
else
|
||||
data[vi] = c_path
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif ((n_path2 >= 0 and n_xprepath2 < 0) or (n_path2 < 0 and n_xprepath2 >= 0)) -- path 2
|
||||
or ((n_path2 >= 0 and n_zprepath2 < 0) or (n_path2 < 0 and n_zprepath2 >= 0)) then
|
||||
-- path 2
|
||||
elseif ((n_path2 >= 0 and n_xprepath2 < 0) or
|
||||
(n_path2 < 0 and n_xprepath2 >= 0)) or
|
||||
((n_path2 >= 0 and n_zprepath2 < 0) or
|
||||
(n_path2 < 0 and n_zprepath2 >= 0)) then
|
||||
if wood then
|
||||
local viu = area:index(x, y - 1, z)
|
||||
local viuu = area:index(x, y - 2, z)
|
||||
data[viu] = c_wood
|
||||
data[viuu] = c_wood
|
||||
end
|
||||
for i = -1, 1 do
|
||||
for k = -1, 1 do
|
||||
local vi = area:index(x+i, y, z+k)
|
||||
local vi = area:index(x + i, y, z + k)
|
||||
local nodid = data[vi]
|
||||
if nodid ~= c_roadwhite and nodid ~= c_roadblack then
|
||||
data[vi] = c_path
|
||||
if nodid ~= c_roadwhite and
|
||||
nodid ~= c_roadblack then
|
||||
if wood then
|
||||
data[vi] = c_wood
|
||||
else
|
||||
data[vi] = c_path
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif stable[si] >= 2 and nodid ~= c_roadblack and nodid ~= c_path then -- dirt with grass
|
||||
if math.random() < APPCHA * n_tree -- appletree
|
||||
and n_abspath > 0.015 and n_abspath2 > 0.015 and n_absroad > 0.02
|
||||
and (n_absalt > 0.04 or y > YFLAT) then
|
||||
noisegrid_appletree(x, y+1, z, area, data)
|
||||
-- stable dirt with grass
|
||||
elseif stable[si] >= 2 and nodid ~= c_roadblack and
|
||||
nodid ~= c_path then
|
||||
-- appletrees
|
||||
if math.random() < APPCHA * n_tree and
|
||||
n_abspath > 0.015 and
|
||||
n_abspath2 > 0.015 and
|
||||
n_absroad > 0.02 and
|
||||
(n_absalt > 0.04 or y > YFLAT) then
|
||||
noisegrid_appletree(x, y + 1, z, area, data)
|
||||
else
|
||||
data[vi] = c_grass
|
||||
if math.random() < FLOCHA * n_flower and n_absroad > 0.015
|
||||
and n_absalt > 0.03 then -- flowers
|
||||
-- flowers
|
||||
if math.random() < FLOCHA * n_flower and
|
||||
n_absroad > 0.015 and
|
||||
n_absalt > 0.03 then
|
||||
noisegrid_flower(data, via)
|
||||
elseif math.random() < GRACHA * n_grass and n_absroad > 0.015
|
||||
and n_absalt > 0.03 then -- grasses
|
||||
-- grasses
|
||||
elseif math.random() < GRACHA * n_grass and
|
||||
n_absroad > 0.015 and
|
||||
n_absalt > 0.03 then
|
||||
noisegrid_grass(data, via)
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif y <= ysurf and y >= ysurf - 16 and y <= YSAND and sea and stable[si] >= 2 then -- sand
|
||||
-- sand
|
||||
elseif y <= ysurf and y >= ysurf - 16 and y <= YSAND then
|
||||
data[vi] = c_sand
|
||||
elseif y < ysurf and y > ysurf - stodep and (nofis or flat) and stable[si] >= 2
|
||||
and nodid ~= c_roadblack then -- dirt
|
||||
-- stable dirt
|
||||
elseif y < ysurf and y > ysurf - stodep and stable[si] >= 2 and
|
||||
nodid ~= c_roadblack then
|
||||
data[vi] = c_dirt
|
||||
elseif y <= 1 and y > ysurf then -- water
|
||||
-- water
|
||||
elseif y <= 1 and y > ysurf then
|
||||
data[vi] = c_water
|
||||
stable[si] = 0
|
||||
else -- air
|
||||
-- air
|
||||
else
|
||||
stable[si] = 0
|
||||
end
|
||||
end
|
||||
|
||||
n_xprepath = n_path
|
||||
n_xprepath2 = n_path2
|
||||
n_xpreroad = n_road
|
||||
|
@ -449,15 +588,89 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
vi = vi + 1
|
||||
via = via + 1
|
||||
end
|
||||
nixz = nixz - 81
|
||||
nixz = nixz - overlen
|
||||
end
|
||||
nixz = nixz + 81
|
||||
nixz = nixz + overlen
|
||||
end
|
||||
|
||||
vm:set_data(data)
|
||||
vm:set_lighting({day=0, night=0})
|
||||
vm:calc_lighting()
|
||||
vm:write_to_map(data)
|
||||
vm:update_liquids()
|
||||
|
||||
local chugent = math.ceil((os.clock() - t1) * 1000)
|
||||
print ("[noisegrid] "..chugent.." ms")
|
||||
end)
|
||||
print ("[noisegrid] " .. chugent .. " ms")
|
||||
end)
|
||||
|
||||
|
||||
-- Spawn player function
|
||||
|
||||
local function noisegrid_spawnplayer(player)
|
||||
local xsp
|
||||
local ysp
|
||||
local zsp
|
||||
local nobj_base = nil
|
||||
|
||||
for chunk = 1, 128 do
|
||||
print ("[noisegrid] searching for spawn " .. chunk)
|
||||
local x0 = 80 * math.random(-PSCA, PSCA) - 32
|
||||
local z0 = 80 * math.random(-PSCA, PSCA) - 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 = 1}
|
||||
local minposxz = {x = x0, y = z0}
|
||||
|
||||
nobj_base = nobj_base or minetest.get_perlin_map(np_base, chulens)
|
||||
|
||||
local nvals_base = nobj_base:get2dMap_flat(minposxz)
|
||||
|
||||
local nixz = 1
|
||||
for z = z0, z1 do
|
||||
for x = x0, x1 do
|
||||
local ysurf
|
||||
local n_base = nvals_base[nixz]
|
||||
local n_absbase = math.abs(n_base)
|
||||
if n_base > TFLAT then
|
||||
ysurf = YFLAT + math.floor((n_base - TFLAT) * TERSCA)
|
||||
elseif n_base < -TFLAT then
|
||||
ysurf = YFLAT - math.floor((-TFLAT - n_base) * TERSCA)
|
||||
else
|
||||
ysurf = YFLAT
|
||||
end
|
||||
if ysurf >= 1 then
|
||||
ysp = ysurf + 1
|
||||
xsp = x
|
||||
zsp = z
|
||||
break
|
||||
end
|
||||
nixz = nixz + 1
|
||||
end
|
||||
if ysp then
|
||||
break
|
||||
end
|
||||
end
|
||||
if ysp then
|
||||
break
|
||||
end
|
||||
end
|
||||
if ysp then
|
||||
print ("[noisegrid] spawn player (" .. xsp .. " " .. ysp .. " " .. zsp .. ")")
|
||||
player:setpos({x = xsp, y = ysp, z = zsp})
|
||||
else
|
||||
print ("[noisegrid] no suitable spawn found")
|
||||
player:setpos({x = 0, y = 2, z = 0})
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_on_newplayer(function(player)
|
||||
noisegrid_spawnplayer(player)
|
||||
end)
|
||||
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
noisegrid_spawnplayer(player)
|
||||
return true
|
||||
end)
|
||||
|
|
31
license.txt
31
license.txt
|
@ -1,14 +1,25 @@
|
|||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
License of source code
|
||||
----------------------
|
||||
Copyright (C) 2014-2015 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.
|
||||
|
||||
License of media (textures)
|
||||
---------------------------
|
||||
Copyright (C) 2014-2015 paramat
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
|
||||
|
|
62
nodes.lua
62
nodes.lua
|
@ -2,10 +2,10 @@ minetest.register_node("noisegrid: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},
|
||||
}),
|
||||
})
|
||||
|
||||
|
@ -13,7 +13,7 @@ minetest.register_node("noisegrid: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(),
|
||||
})
|
||||
|
@ -22,7 +22,7 @@ minetest.register_node("noisegrid:path", {
|
|||
description = "Dirt Path",
|
||||
tiles = {"noisegrid_path.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly=3},
|
||||
groups = {crumbly = 3},
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
|
||||
|
@ -30,7 +30,7 @@ minetest.register_node("noisegrid: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(),
|
||||
})
|
||||
|
@ -39,7 +39,7 @@ minetest.register_node("noisegrid:roadblack", {
|
|||
description = "Road Black",
|
||||
tiles = {"noisegrid_roadblack.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky=2},
|
||||
groups = {cracky = 2},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
|
@ -47,7 +47,7 @@ minetest.register_node("noisegrid:roadwhite", {
|
|||
description = "Road White",
|
||||
tiles = {"noisegrid_roadwhite.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky=2},
|
||||
groups = {cracky = 2},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
|
@ -58,7 +58,6 @@ minetest.register_node("noisegrid:slab", {
|
|||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
sunlight_propagates = true,
|
||||
buildable_to = true,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
|
@ -71,7 +70,7 @@ minetest.register_node("noisegrid:slab", {
|
|||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5}
|
||||
},
|
||||
},
|
||||
groups = {cracky=2},
|
||||
groups = {cracky = 2},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
|
@ -82,11 +81,11 @@ minetest.register_node("noisegrid:appleleaf", {
|
|||
tiles = {"default_leaves.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=3, flammable=2},
|
||||
groups = {snappy = 3, flammable = 2},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{items = {"noisegrid:appling"},rarity = 20},
|
||||
{items = {"noisegrid:appling"}, rarity = 20},
|
||||
{items = {"noisegrid:appleleaf"}}
|
||||
}
|
||||
},
|
||||
|
@ -107,23 +106,17 @@ minetest.register_node("noisegrid: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("noisegrid:lightoff", {
|
||||
minetest.register_node("noisegrid:light", {
|
||||
description = "Light",
|
||||
tiles = {"noisegrid_light.png"},
|
||||
paramtype = "light",
|
||||
light_source = 14,
|
||||
groups = {cracky=3,oddly_breakable_by_hand=3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("noisegrid:lighton", {
|
||||
description = "Light",
|
||||
tiles = {"noisegrid_light.png"},
|
||||
light_source = 14,
|
||||
groups = {cracky=3,oddly_breakable_by_hand=3},
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 3, oddly_breakable_by_hand = 3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
|
@ -131,6 +124,27 @@ minetest.register_node("noisegrid:concrete", {
|
|||
description = "Sandy Concrete",
|
||||
tiles = {"noisegrid_concrete.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky=3},
|
||||
groups = {cracky = 3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_node("noisegrid:luxore", {
|
||||
description = "Lux Ore",
|
||||
tiles = {"noisegrid_luxore.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
light_source = 14,
|
||||
groups = {cracky = 3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
-- Crafting.
|
||||
|
||||
minetest.register_craft({
|
||||
output = "noisegrid:light 8",
|
||||
recipe = {
|
||||
{"default:glass", "default:glass", "default:glass"},
|
||||
{"default:glass", "noisegrid:luxore", "default:glass"},
|
||||
{"default:glass", "default:glass", "default:glass"},
|
||||
},
|
||||
})
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 311 B |
Loading…
Reference in New Issue