]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - builtin/client/util.lua
Added cheat Menu
[dragonfireclient.git] / builtin / client / util.lua
index 595922262641cfd1c754f2c413bdc4f38747e09a..8956092885de844485a37a75968196134d450a65 100644 (file)
@@ -1,23 +1,22 @@
 function core.parse_pos(param)
        local p = {}
+       local playerpos = core.localplayer:get_pos()
        p.x, p.y, p.z = string.match(param, "^([~|%d.-]+)[, ] *([~|%d.-]+)[, ] *([~|%d.-]+)$")
        for k, v in pairs(p) do
                if p[k] == "~" then
-                       p[k] = 0
+                       p[k] = playerpos[k]
                else
                        p[k] = tonumber(v)
                end
        end
        if p.x and p.y and p.z then
-               return true, p
+               return true, vector.round(p)
        end
        return false, "Invalid position (" .. param .. ")"
 end 
 
 function core.parse_relative_pos(param)
-       local success, pos = core.parse_pos(param)
+       local success, pos = core.parse_pos(param:gsub("~", "0"))
        if success then pos = vector.round(vector.add(core.localplayer:get_pos(), pos)) end
        return success, pos
 end 
-
-core.anticheat_protection = minetest.settings:get_bool("anticheat_protection")