aboutsummaryrefslogtreecommitdiff
path: root/builtin/client/util.lua
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2020-07-18 20:01:17 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2020-07-18 20:01:17 +0200
commit5a8610c2f41e44c827912246b4f9437051d11621 (patch)
tree04fa785120501182e83c5b05515527bb0428aa63 /builtin/client/util.lua
parent83f59484d3b03e8964f1c7886dd1a0afd96ddd8d (diff)
downloaddragonfireclient-5a8610c2f41e44c827912246b4f9437051d11621.tar.xz
Added customizable keybindings, improved freecam, added special inventory keybind (by default ender inventory)
Diffstat (limited to 'builtin/client/util.lua')
-rw-r--r--builtin/client/util.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/builtin/client/util.lua b/builtin/client/util.lua
index 595922262..8bcac23b5 100644
--- a/builtin/client/util.lua
+++ b/builtin/client/util.lua
@@ -1,23 +1,24 @@
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")
+core.anticheat_protection = minetest.settings:get_bool("anticheat_protection") ~= false