mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-12-24 17:50:37 +01:00
Adding mapfix mod
- Adding the mapfix mod to repair shadow-ed areas on a map (eg. after using worldedit). Signed-off-by: LeMagnesium <mg.minetest@gmail.com>
This commit is contained in:
parent
eeb0f0be09
commit
8cc99d05a8
0
mods/mapfix/depends.txt
Normal file
0
mods/mapfix/depends.txt
Normal file
19
mods/mapfix/init.lua
Normal file
19
mods/mapfix/init.lua
Normal file
@ -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,
|
||||
})
|
Loading…
Reference in New Issue
Block a user