1 perlin = dofile(minetest.get_modpath("perlin") .. "/perlin.lua")
3 local start, height, stretch
5 minetest.register_chatcommand("perlin", {
6 description = "Start perlin terraforming",
7 param = "<height> <stretch>",
9 local sparam = param:split(" ")
10 start, height, stretch = math.floor(minetest.localplayer:get_pos().y), sparam[1], sparam[2]
14 minetest.register_chatcommand("perlinstop", {
15 description = "Abort perlin terraforming",
16 func = function(param)
17 start, height, stretch = nil
21 minetest.register_globalstep(function()
23 local player = minetest.localplayer
24 local pos = vector.floor(player:get_pos())
25 for x = pos.x - 1, pos.x + 1 do
26 for z = pos.z - 1, pos.z + 1 do
27 local y = math.floor(start + height * perlin:noise(x / stretch, z / stretch))
28 local p = vector.new(x, y, z)
29 minetest.place_node(p)