Add /fixlight chat command
authorDániel Juhász <juhdanad@gmail.com>
Fri, 21 Apr 2017 10:56:10 +0000 (12:56 +0200)
committerparamat <mat.gregory@virginmedia.com>
Sat, 22 Apr 2017 00:24:41 +0000 (01:24 +0100)
builtin/game/chatcommands.lua

index 25cc06178e13d04b992d77cc00c2313449179014..84f2c3fed74ae6e90c8dbdb34c6ae3a94925d409 100644 (file)
@@ -487,6 +487,25 @@ core.register_chatcommand("deleteblocks", {
        end,
 })
 
+core.register_chatcommand("fixlight", {
+       params = "(here [radius]) | (<pos1> <pos2>)",
+       description = "Resets lighting in the area between pos1 and pos2",
+       privs = {server = true},
+       func = function(name, param)
+               local p1, p2 = parse_range_str(name, param)
+               if p1 == false then
+                       return false, p2
+               end
+
+               if core.fix_light(p1, p2) then
+                       return true, "Successfully reset light in the area ranging from " ..
+                               core.pos_to_string(p1, 1) .. " to " .. core.pos_to_string(p2, 1)
+               else
+                       return false, "Failed to load one or more blocks in area"
+               end
+       end,
+})
+
 core.register_chatcommand("mods", {
        params = "",
        description = "List mods installed on the server",