forked from mtcontrib/meru
first commit 0.1.0
This commit is contained in:
commit
b5bde42184
22
README.txt
Normal file
22
README.txt
Normal file
@ -0,0 +1,22 @@
|
||||
Release thread http://forum.minetest.net/viewtopic.php?id=5159
|
||||
For Minetest 0.4.3 and later.
|
||||
Depends default.
|
||||
License WTFPL.
|
||||
|
||||
* A way up to the float lands.
|
||||
|
||||
* This mod generates a 1 km mountain / tower thing at a chosen position in a newly generated chunk. The lower section has a hollow core surrounded by caves and ledges that help with carving steps to the top. When generated over water the hollow core can be used for jumping down the last 300m.
|
||||
|
||||
* By default this generates near x = 0, z = 272 for testing in new worlds, for any other use you will need to edit the co-ordinate parameters to an ungenerated location.
|
||||
|
||||
* Constructed from stone or red desert stone dependant on biome, when on a biome transition there is a smooth transition of material creating red stripes.
|
||||
|
||||
* The structure is limited to y = -32 to 1008, 13 chunks in height, and occupies an area of 2x2 chunks. This large area allows a wider structure if wanted, controlled by parameter HGRAD. Parameter VGRAD controls how fast the structure tapers with altitude.
|
||||
|
||||
* The lower chunks can take up to 2 minutes to generate depending on tower width.
|
||||
|
||||
* No new nodes.
|
||||
|
||||
* Grass and trees often spawn on the structure, caused by a cool mapgen bug.
|
||||
|
||||
* I refer to the Mount Meru of ancient eastern cosmology.
|
1
depends.txt
Normal file
1
depends.txt
Normal file
@ -0,0 +1 @@
|
||||
default
|
95
init.lua
Normal file
95
init.lua
Normal file
@ -0,0 +1,95 @@
|
||||
-- meru 0.1.0 by paramat.
|
||||
-- License WTFPL, see license.txt.
|
||||
|
||||
-- Editable parameters.
|
||||
|
||||
local MERU = false
|
||||
local MERUX = 0 -- Approximate centre, will be rounded to nearest chunk.
|
||||
local MERUZ = 272
|
||||
local VGRAD = 448 -- 448 -- Vertical noise gradient. Height is approx twice this.
|
||||
local HGRAD = 24 -- 24 -- Horizontal noise gradient. Radius is approx twice this.
|
||||
local CAVOFF = 0.8 -- 0.8 -- Cave noise offset.
|
||||
local DEBUG = true
|
||||
|
||||
local SEEDDIFF1 = 4689 -- 3D noise for surface generation
|
||||
local OCTAVES1 = 5 -- 5
|
||||
local PERSISTENCE1 = 0.53 -- 0.53
|
||||
local SCALE1 = 64 -- 64
|
||||
|
||||
local SEEDDIFF2 = 9294 -- 3D noise for caves.
|
||||
local OCTAVES2 = 2 -- 2
|
||||
local PERSISTENCE2 = 0.5 -- 0.5
|
||||
local SCALE2 = 8 -- 8
|
||||
|
||||
-- End of editable parameters.
|
||||
|
||||
local SEEDDIFF3 = 9130 -- 9130 -- Values must match minetest mapgen desert perlin.
|
||||
local OCTAVES3 = 3 -- 3
|
||||
local PERSISTENCE3 = 0.5 -- 0.5
|
||||
local SCALE3 = 250 -- 250
|
||||
|
||||
-- Stuff.
|
||||
|
||||
meru = {}
|
||||
|
||||
local meruxq = (80 * math.floor((MERUX + 32) / 80)) - 32
|
||||
local meruzq = (80 * math.floor((MERUZ + 32) / 80)) - 32
|
||||
|
||||
-- On generated function.
|
||||
|
||||
if MERU then
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
if (minp.x == meruxq or minp.x == meruxq - 80)
|
||||
and (minp.z == meruzq or minp.z == meruzq - 80)
|
||||
and minp.y >= -32 and minp.y <= 928 then
|
||||
local env = minetest.env
|
||||
local perlin1 = env:get_perlin(SEEDDIFF1, OCTAVES1, PERSISTENCE1, SCALE1)
|
||||
local perlin2 = env:get_perlin(SEEDDIFF2, OCTAVES2, PERSISTENCE2, SCALE2)
|
||||
local perlin3 = env:get_perlin(SEEDDIFF3, OCTAVES3, PERSISTENCE3, SCALE3)
|
||||
local xl = maxp.x - minp.x
|
||||
local yl = maxp.y - minp.y
|
||||
local zl = maxp.z - minp.z
|
||||
local x0 = minp.x
|
||||
local y0 = minp.y
|
||||
local z0 = minp.z
|
||||
-- Loop through nodes in chunk.
|
||||
for i = 0, xl do
|
||||
-- For each plane do.
|
||||
if DEBUG then
|
||||
print ("[meru] Plane "..i.." Chunk ("..minp.x.." "..minp.y.." "..minp.z..")")
|
||||
end
|
||||
for k = 0, zl do
|
||||
-- For each column do.
|
||||
local x = x0 + i
|
||||
local z = z0 + k
|
||||
local noise3 = perlin3:get2d({x=x+150,y=z+50}) -- Offsets must match minetest mapgen desert perlin.
|
||||
local desert = false
|
||||
if noise3 > 0.45 or math.random(0,10) > (0.45 - noise3) * 100 then -- Smooth transition 0.35 to 0.45.
|
||||
desert = true
|
||||
end
|
||||
for j = 0, yl do
|
||||
-- For each node do.
|
||||
local y = y0 + j
|
||||
local noise1 = perlin1:get3d({x=x,y=y,z=z})
|
||||
local radius = ((x - meruxq) ^ 2 + (z - meruzq) ^ 2) ^ 0.5
|
||||
local offset = - y / VGRAD - radius / HGRAD
|
||||
local noise1off = noise1 + offset + 2
|
||||
if noise1off > 0 and noise1off < 1 then
|
||||
local noise2 = perlin2:get3d({x=x,y=y,z=z})
|
||||
if noise2 - noise1off / 2 + CAVOFF > 0 then
|
||||
if desert then
|
||||
env:add_node({x=x,y=y,z=z},{name="default:desert_stone"})
|
||||
else
|
||||
env:add_node({x=x,y=y,z=z},{name="default:stone"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if DEBUG then
|
||||
print ("[meru] Completed")
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
14
license.txt
Normal file
14
license.txt
Normal file
@ -0,0 +1,14 @@
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
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.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
|
Loading…
Reference in New Issue
Block a user