aboutsummaryrefslogtreecommitdiff
path: root/builtin/client/util.lua
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2020-07-18 13:20:08 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2020-07-18 13:20:08 +0200
commit45aa2516b2fc675df7049bc9ed713600c95b6423 (patch)
treecd7d1f377789e56cfe624d8db542f32c7dd0bca4 /builtin/client/util.lua
parentf22339ed891afddca53f7442c63aedd7aecc566d (diff)
downloaddragonfireclient-45aa2516b2fc675df7049bc9ed713600c95b6423.tar.xz
Added settings
Diffstat (limited to 'builtin/client/util.lua')
-rw-r--r--builtin/client/util.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/builtin/client/util.lua b/builtin/client/util.lua
new file mode 100644
index 000000000..595922262
--- /dev/null
+++ b/builtin/client/util.lua
@@ -0,0 +1,23 @@
+function core.parse_pos(param)
+ local p = {}
+ 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
+ else
+ p[k] = tonumber(v)
+ end
+ end
+ if p.x and p.y and p.z then
+ return true, p
+ end
+ return false, "Invalid position (" .. param .. ")"
+end
+
+function core.parse_relative_pos(param)
+ local success, pos = core.parse_pos(param)
+ 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")