Mapgen mod for Minetest 0.4.12+. Work in progress, not finished. Mod created by Gael-de-Sailly and now developed by Gael-de-Sailly, duane-r and vlapsley.
/mods
directory of Minetest.Git is a very useful tool to manage repositories such as Valleys Mapgen.
Open the terminal (in Linux) or the Git shell (Windows), and set the working directory (the mods folder) using cd
: for example cd /home/gael/.minetest/mods
or cd C:\Users\gael\minetest-0.4.13\mods
.
Download Valleys Mapgen: git clone https://github.com/Gael-de-Sailly/valleys_mapgen.git
.
Next time, you can automatically update VMG with the same cd
command, and git pull origin master
.
Keep in mind that mapgen mods as this one are very powerful mods, that may interfere with some other mods. So, be careful when enabling many mods, the result might be unplayable. Valleys Mapgen is incompatible with all other "complete" mapgens like Watershed, Ethereal, Nore's Mg. Some mods that only partially rewrite the terrain will work with VMG: (Cave Realms, Darkage, More Ores, Nether (in this case you must add valleys_mapgen?
in nether/depends.txt)). Plantlife and More Trees work but the respective biomes of the plants are not respected.
It's still compatible with most of the mods that don't affect mapgen (Areas, World Edit, Mesecons, Home decor, …)
There are many settings that can be changed by the user. There are 3 ways to change the settings:
vmg_river_size
, so you need to write: vmg_river_size = 8
. If this setting is already present, simply modify it instead of adding a new line. It will work ONLY for new worlds.minetest/worlds/test_world
). If this file doesn't exist you can create it. It works the same way, except than we don't write the vmg_
prefix, like river_size = 8
. It will work ONLY for this world.The Plants API has been introduced on October 24th, 2015. It allow mods to generate plants directly on the map.
First, make sure that you've added the valleys_mapgen
dependancy in your depends.txt (followed by a question mark if optional)
The only function is vmg.register_plant
. It registers a plant that will be generated during mapgen. All plant parameters are passed to this function.
Syntax (example for jungle tree)
vmg.register_plant({
nodes = {
trunk = "default:jungletree",
leaves = "default:jungleleaves",
air = "air", ignore = "ignore",
},
cover = 0.5,
density = 0.06,
priority = 73,
check = function(t, pos)
return t.v15 < 0.7 and t.temp >= 1.9 and t.humidity > 2 and t.v16 > 2
end,
grow = function(nodes, pos, data, area)
local rand = math.random()
local height = math.floor(8 + 4 * rand)
local radius = 5 + 3 * rand
vmg.make_jungle_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
})
List of nodes that will be used, could be a table or a simple string. In this table, all strings are converted into content IDs.
Many syntaxes are possible, with their default behaviour (see grow):
nodes = "default:dry_shrub"
: simply generate a dry shrub.nodes = {"default:papyrus", n=4}
: generate 4 papyrus nodes vertically.nodes = {"default:grass_1", "default:grass_2", "default:grass_3", "default:grass_4", "default:grass_5"}
: generate one grass node, randomly chosen between the 5 nodes.nodes = {"default:grass_1", "default:grass_2", "default:grass_3", "default:grass_4", "default:grass_5, n=3"}
: generate 3 grass nodes vertically (my example is a bit silly…), randomly chosen between the 5 nodes (chosen once, not 3 times).All cases are possible, but other cases can't be managed by default and need a grow
function (see grow), like the example above with jungle tree. Anyway, the strings in this table are recursively converted into map content IDs.
Decimal number between 0 and 1, which determines the proportion of surface nodes that are "reserved" for the plant. This doesn't necessarily mean that there is a plant on the node (see density), but this "cover" prevents other plants with lower priority from spawning on said nodes.
Number between 0 and cover. Proportion of nodes that are effectively covered by the plant.
Examples:
cover = 0.8 ; density = 0.8
: the plant is present on 80% of the nodes, so extremely dense. Other plants can't take more than the remaining 20% if they have a lower priority
.cover = 0.8 ; density = 0.1
: the plant is present on 10% of the nodes, so more scattered, but other plants can't take more than 20% if they have a lower priority
. Params like this are suitable for a plant that naturally needs much space.cover = 0.1 ; density = 0.1
: the plant is present on 10% of the nodes as in the previous case, but other plants are much more common (max 90% of the nodes).Integer generally between 0 and 100 (no strict rule :) to determine which plants are dominating the others. The dominant plants (with higher priority) impose their cover on the others.
Function to check the conditions. Should return a boolean: true, the plant can spawn here ; false, the plant can't spawn and doesn't impose its cover. It takes 2 parameters:
t
: table containing all possible conditions: all noises (t.v1
to t.v20
), dirt thickness t.thickness
, temperature t.temp
, humidity t.humidity
, humidity from sea t.sea_water
, from rivers t.river_water
, from sea and rivers t.water
.pos
: position of the future plant, above the dirt node.check = function(t, pos)
return t.v15 < 0.7 and t.temp >= 1.9 and t.humidity > 2 and t.v16 > 2
end,
Optional function to override the default behaviour (see nodes) for complex plants like trees. It should "simply" generate the plant. It takes 5 parameters:
nodes
: table of map content IDs, see nodes.pos
: position of the future plant, above the dirt node.data
: VoxelManip data (array of content IDs)area
: VoxelAreai
: index of the data array matching the position pos
. In other terms, area:indexp(pos) = i
.t
: table containing all possible conditions (the same t
as above)grow = function(nodes, pos, data, area)
local rand = math.random()
local height = math.floor(8 + 4 * rand)
local radius = 5 + 3 * rand
vmg.make_jungle_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
minetest.generate_ores
. I advise you to update your MT version to a recent build (03/11 or later) or the ores overlapping problem will reappear.water_level
to set water level (default is 1)math.random
too large interval (2³² → 2²⁴)chunksize
(previously the mod was only working for 5)Version of March 2016 initially considered as a developement version, and finally released after a 2 years long hiatus
vmg.conf.example
to settingtypes.txt
to be compatible with settings API (for recent builds)vmg.get_noise
. Humidity calculation is now correct after mapgen.mod.conf