A util collection for everything around the mapgen.
The Ramps mod allwos to easily create, register and place ramps in the world during or after world generation. You can even inject ramps into already existing games, for example minetest-game. You simply need to add something like this to the init.lua (and copy the worldgen-utils mode into the game, obviously):
local nodes = {}
nodes = tableutil.merge(nodes, ramputil.register_ramps_for_node("default:dirt_with_grass", "worldgen_utils:dirt_with_grass", true, 6))
nodes = tableutil.merge(nodes, ramputil.register_ramps_for_node("default:stone", "worldgen_utils:stone", true, 6))
nodes = tableutil.merge(nodes, ramputil.register_ramps_for_node("default:dirt", "worldgen_utils:dirt", true, 6))
minetest.register_on_generated(function(minp, maxp, seed)
local manipulator = MapManipulator:new()
rampgen.run(manipulator, minp, maxp, nodes)
manipulator:set_data()
end)
You can also register an ABM/callback on some node and use the run_on_node function directly:
some_node.after_dig_node(function(pos, oldnode, oldmetadata, digger)
local manipulator = DirectMapManipulator:new()
for x = pos.x - 1, pos.x + 1, 1 do
for z = pos.z - 1, pos.z + 1, 1 do
for y = pos.y - 1, pos.y + 1, 1 do
rampgen.run_on_node(manipulator, x, z, y, nodes)
end
end
end
end