summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGael-de-Sailly <gael.chretien@akeonet.com>2014-11-30 20:19:22 +0100
committerGael-de-Sailly <gael.chretien@akeonet.com>2014-11-30 20:19:22 +0100
commit200f482909931f8ca6241ae6ff733f2e4b89717a (patch)
tree5a0bfa9f30be67688e5533409fd6737dcb213d8e
parent66cf3fb3e036aa78156b99b3b625d440b260b5a4 (diff)
Added init.lua
-rw-r--r--init.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..77ce155
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,19 @@
+minetest.register_chatcommand("mapfix", {
+ params = "<size>",
+ description = "Recalculate the flowing liquids of a chunk",
+ func = function(name, param)
+ local pos = minetest.get_player_by_name(name):getpos()
+ local size = tonumber(param) or 40
+ if size > 50 and not minetest.check_player_privs(name, {server=true}) then
+ return false, "You need the server privilege to exceed the radius of 50 blocks"
+ end
+ local minp, maxp = {x = math.floor(pos.x - size), y = math.floor(pos.y - size), z = math.floor(pos.z - size)}, {x = math.ceil(pos.x + size), y = math.ceil(pos.y + size), z = math.ceil(pos.z + size)}
+ local vm = minetest.get_voxel_manip()
+ vm:read_from_map(minp, maxp)
+ vm:calc_lighting()
+ vm:update_liquids()
+ vm:write_to_map()
+ vm:update_map()
+ return true, "Done."
+ end,
+})