More reliable tunnel lights. Add bridge spine. Remove column noise. Add tarmac texture. Improve license docs
This commit is contained in:
parent
a7a92c960a
commit
c0d22c3395
@ -1,5 +1,9 @@
|
|||||||
roadv7 0.1.0 by paramat
|
roadv7 0.1.1 by paramat
|
||||||
For Minetest 0.4.13 and later
|
For Minetest 0.4.13 and later
|
||||||
Depends default
|
Depends default
|
||||||
Licenses: code LGPL 2.1
|
Licenses: Source code LGPL 2.1. Media (textures) CC BY-SA 3.0
|
||||||
See license.txt for license information
|
See license.txt for license information
|
||||||
|
|
||||||
|
Use with mapgen v7 only.
|
||||||
|
Creates a worldwide network of roads, bridges and tunnels.
|
||||||
|
'np_alt' noise parameters must match any custom 'terrain_alt' noise parameters used in mgv7.
|
||||||
|
103
init.lua
103
init.lua
@ -1,9 +1,10 @@
|
|||||||
-- Parameters
|
-- Parameters
|
||||||
|
|
||||||
local DEBUG = true
|
local DEBUG = false
|
||||||
|
|
||||||
|
|
||||||
-- 2D noise for mgv7 terrain_alt
|
-- 2D noise for lower terrain
|
||||||
|
-- Must match 'terrain_alt' noise parameters used in mgv7
|
||||||
|
|
||||||
local np_alt = {
|
local np_alt = {
|
||||||
offset = 4,
|
offset = 4,
|
||||||
@ -58,17 +59,6 @@ local np_pathd = {
|
|||||||
persist = 0.4
|
persist = 0.4
|
||||||
}
|
}
|
||||||
|
|
||||||
-- 2D noise for columns
|
|
||||||
|
|
||||||
local np_column = {
|
|
||||||
offset = 0,
|
|
||||||
scale = 1,
|
|
||||||
spread = {x = 8, y = 8, z = 8},
|
|
||||||
seed = 1728833,
|
|
||||||
octaves = 3,
|
|
||||||
persist = 2
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
-- Do files
|
-- Do files
|
||||||
|
|
||||||
@ -110,7 +100,6 @@ local nobj_patha = nil
|
|||||||
local nobj_pathb = nil
|
local nobj_pathb = nil
|
||||||
local nobj_pathc = nil
|
local nobj_pathc = nil
|
||||||
local nobj_pathd = nil
|
local nobj_pathd = nil
|
||||||
local nobj_column = nil
|
|
||||||
|
|
||||||
|
|
||||||
-- Localise noise buffers
|
-- Localise noise buffers
|
||||||
@ -120,7 +109,6 @@ local nbuf_patha
|
|||||||
local nbuf_pathb
|
local nbuf_pathb
|
||||||
local nbuf_pathc
|
local nbuf_pathc
|
||||||
local nbuf_pathd
|
local nbuf_pathd
|
||||||
local nbuf_column
|
|
||||||
|
|
||||||
|
|
||||||
-- On generated function
|
-- On generated function
|
||||||
@ -139,9 +127,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
local y0 = minp.y
|
local y0 = minp.y
|
||||||
local z0 = minp.z
|
local z0 = minp.z
|
||||||
|
|
||||||
local sidelen = x1 - x0 + 1
|
local sidelen = x1 - x0 + 1
|
||||||
local emerlen = sidelen + 32
|
local emerlen = sidelen + 32
|
||||||
local overlen = sidelen + 9
|
local overlen = sidelen + 9
|
||||||
local pmapdims = {x = overlen, y = overlen, z = 1}
|
local pmapdims = {x = overlen, y = overlen, z = 1}
|
||||||
local pmapminp = {x = x0 - 5, y = z0 - 5}
|
local pmapminp = {x = x0 - 5, y = z0 - 5}
|
||||||
|
|
||||||
@ -150,14 +138,12 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
nobj_pathb = nobj_pathb or minetest.get_perlin_map(np_pathb, pmapdims)
|
nobj_pathb = nobj_pathb or minetest.get_perlin_map(np_pathb, pmapdims)
|
||||||
nobj_pathc = nobj_pathc or minetest.get_perlin_map(np_pathc, pmapdims)
|
nobj_pathc = nobj_pathc or minetest.get_perlin_map(np_pathc, pmapdims)
|
||||||
nobj_pathd = nobj_pathd or minetest.get_perlin_map(np_pathd, pmapdims)
|
nobj_pathd = nobj_pathd or minetest.get_perlin_map(np_pathd, pmapdims)
|
||||||
nobj_column = nobj_column or minetest.get_perlin_map(np_column, pmapdims)
|
|
||||||
|
|
||||||
local nvals_alt = nobj_alt :get2dMap_flat(pmapminp, nbuf_alt)
|
local nvals_alt = nobj_alt :get2dMap_flat(pmapminp, nbuf_alt)
|
||||||
local nvals_patha = nobj_patha :get2dMap_flat(pmapminp, nbuf_patha)
|
local nvals_patha = nobj_patha :get2dMap_flat(pmapminp, nbuf_patha)
|
||||||
local nvals_pathb = nobj_pathb :get2dMap_flat(pmapminp, nbuf_pathb)
|
local nvals_pathb = nobj_pathb :get2dMap_flat(pmapminp, nbuf_pathb)
|
||||||
local nvals_pathc = nobj_pathc :get2dMap_flat(pmapminp, nbuf_pathc)
|
local nvals_pathc = nobj_pathc :get2dMap_flat(pmapminp, nbuf_pathc)
|
||||||
local nvals_pathd = nobj_pathd :get2dMap_flat(pmapminp, nbuf_pathd)
|
local nvals_pathd = nobj_pathd :get2dMap_flat(pmapminp, nbuf_pathd)
|
||||||
local nvals_column = nobj_column:get2dMap_flat(pmapminp, nbuf_column)
|
|
||||||
|
|
||||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
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}
|
||||||
@ -181,7 +167,6 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
local n_zprepathd = nvals_pathd[(ni - overlen)]
|
local n_zprepathd = nvals_pathd[(ni - overlen)]
|
||||||
|
|
||||||
if x >= x0 - 4 and z >= z0 - 4 then
|
if x >= x0 - 4 and z >= z0 - 4 then
|
||||||
local abscol = math.abs(nvals_column[ni])
|
|
||||||
local tlevel = math.floor(nvals_alt[ni])
|
local tlevel = math.floor(nvals_alt[ni])
|
||||||
local pathy = math.min(math.max(tlevel, 7), 42)
|
local pathy = math.min(math.max(tlevel, 7), 42)
|
||||||
|
|
||||||
@ -223,54 +208,64 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if tunnel then
|
if tunnel then
|
||||||
excatop = pathy + 5 -- tunnel
|
excatop = pathy + 5
|
||||||
else
|
else
|
||||||
excatop = y1 -- excavate to mapchunk top
|
excatop = y1
|
||||||
end
|
end
|
||||||
-- place path node brush
|
-- place path node brush
|
||||||
local vi = area:index(x, pathy, z)
|
local vi = area:index(x, pathy, z)
|
||||||
data[vi] = c_roadwhite
|
data[vi] = c_roadwhite
|
||||||
|
|
||||||
for i = -4, 4 do
|
|
||||||
for k = -4, 4 do
|
for k = -4, 4 do
|
||||||
local radsq = (math.abs(i)) ^ 2 + (math.abs(k)) ^ 2
|
local vi = area:index(x - 4, pathy, z + k)
|
||||||
if radsq <= 13 then
|
for i = -4, 4 do
|
||||||
local vi = area:index(x + i, pathy, z + k)
|
local radsq = (math.abs(i)) ^ 2 + (math.abs(k)) ^ 2
|
||||||
local nodid = data[vi]
|
if radsq <= 13 then
|
||||||
if nodid ~= c_roadwhite then
|
local nodid = data[vi]
|
||||||
data[vi] = c_roadblack
|
if nodid ~= c_roadwhite then
|
||||||
end
|
data[vi] = c_roadblack
|
||||||
elseif radsq <= 25 then
|
end
|
||||||
local vi = area:index(x + i, pathy, z + k)
|
elseif radsq <= 25 then
|
||||||
local nodid = data[vi]
|
local nodid = data[vi]
|
||||||
if nodid ~= c_roadblack
|
if nodid ~= c_roadblack
|
||||||
and nodid ~= c_roadwhite then
|
and nodid ~= c_roadwhite then
|
||||||
data[vi] = c_roadslab
|
data[vi] = c_roadslab
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
vi = vi + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
-- foundations or bridge structure
|
||||||
-- foundations
|
|
||||||
for i = -4, 4 do
|
|
||||||
for k = -4, 4 do
|
for k = -4, 4 do
|
||||||
local radsq = (math.abs(i)) ^ 2 + (math.abs(k)) ^ 2
|
local vi = area:index(x - 4, pathy - 1, z + k)
|
||||||
if radsq <= 25 then
|
for i = -4, 4 do
|
||||||
local vi = area:index(x + i, pathy - 1, z + k)
|
local radsq = (math.abs(i)) ^ 2 + (math.abs(k)) ^ 2
|
||||||
local nodid = data[vi]
|
if radsq <= 25 then
|
||||||
if nodid ~= c_roadblack
|
local nodid = data[vi]
|
||||||
and nodid ~= c_roadwhite
|
if nodid ~= c_roadblack
|
||||||
and nodid ~= c_roadslab then
|
and nodid ~= c_roadwhite
|
||||||
data[vi] = c_concrete
|
and nodid ~= c_roadslab then
|
||||||
|
data[vi] = c_concrete
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
if radsq <= 2 then
|
||||||
|
local viu = vi - emerlen
|
||||||
|
local nodid = data[viu]
|
||||||
|
if nodid ~= c_roadblack
|
||||||
|
and nodid ~= c_roadwhite
|
||||||
|
and nodid ~= c_roadslab then
|
||||||
|
data[viu] = c_concrete
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vi = vi + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
-- bridge columns
|
-- bridge columns
|
||||||
if abscol < 0.3 then
|
if math.random() <= 0.0625 then
|
||||||
for xx = x - 1, x + 1 do
|
for xx = x - 1, x + 1 do
|
||||||
for zz = z - 1, z + 1 do
|
for zz = z - 1, z + 1 do
|
||||||
local vi = area:index(xx, pathy - 2, zz)
|
local vi = area:index(xx, pathy - 3, zz)
|
||||||
for y = pathy - 2, y0 - 16, -1 do
|
for y = pathy - 3, y0 - 16, -1 do
|
||||||
local nodid = data[vi]
|
local nodid = data[vi]
|
||||||
if nodid == c_stone
|
if nodid == c_stone
|
||||||
or nodid == c_destone
|
or nodid == c_destone
|
||||||
@ -294,7 +289,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
if nodid ~= c_air
|
if nodid ~= c_air
|
||||||
and nodid ~= c_ignore
|
and nodid ~= c_ignore
|
||||||
and nodid ~= c_meselamp then
|
and nodid ~= c_meselamp then
|
||||||
if math.random() < 0.02 then
|
if (math.abs(zz - z) == 4
|
||||||
|
or math.abs(xx - x) == 4)
|
||||||
|
and math.random() <= 0.2 then
|
||||||
data[vi] = c_meselamp
|
data[vi] = c_meselamp
|
||||||
else
|
else
|
||||||
data[vi] = c_concrete
|
data[vi] = c_concrete
|
||||||
|
54
license.txt
54
license.txt
@ -2,16 +2,48 @@ License of source code
|
|||||||
----------------------
|
----------------------
|
||||||
Copyright (C) 2016 paramat
|
Copyright (C) 2016 paramat
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify it under the terms
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
of the GNU Lesser General Public License as published by the Free Software Foundation;
|
||||||
the Free Software Foundation; either version 2.1 of the License, or
|
either version 2.1 of the License, or (at your option) any later version.
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
See the GNU Lesser General Public License for more details:
|
||||||
GNU Lesser General Public License for more details.
|
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
|
||||||
|
|
||||||
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.,
|
License of media (textures)
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
---------------------------
|
||||||
|
Copyright (C) 2016 paramat
|
||||||
|
|
||||||
|
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||||
|
|
||||||
|
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/
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 480 B |
Loading…
x
Reference in New Issue
Block a user