Skip to content

Instantly share code, notes, and snippets.

@juhdanad
Created April 16, 2017 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juhdanad/8d52aed02fcfd9d59c0364dc786d45c4 to your computer and use it in GitHub Desktop.
Save juhdanad/8d52aed02fcfd9d59c0364dc786d45c4 to your computer and use it in GitHub Desktop.
local fix = function(name, param)
local x, y, z = string.match(param, "(%d+) (%d+) (%d+)")
local pos
if x==nil or y==nil or z==nil then
local player = minetest.get_player_by_name(name)
if not player then
return false, "Player not found"
end
pos = player:getpos()
else
pos = {["x"] = 16*x, ["y"] = 16*y, ["z"] = 16*z}
end
local px=math.floor(pos.x/16)
local py=math.floor(pos.y/16)
local pz=math.floor(pos.z/16)
minetest.chat_send_all("Fixing: " .. px .. " " .. py .. " " .. pz)
minetest.fix_light({["x"]=px, ["y"]=py, ["z"]=pz})
return true, "Done."
end
minetest.register_chatcommand("fixlight", {
params = "[<x> <y> <z>]",
description = "",
func = fix,
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment