aboutsummaryrefslogtreecommitdiff
path: root/builtin/common/misc_helpers.lua
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2020-10-18 16:18:07 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2020-10-18 16:18:07 +0200
commit1a7d3d8188d3f484b6c3f0f05fd057d543a34725 (patch)
treeeeb487998aa86e01c9a7d55d4ff1156cc598b349 /builtin/common/misc_helpers.lua
parent1e4f3549292472323d49ffad4e856ba60dd81e0c (diff)
downloaddragonfireclient-1a7d3d8188d3f484b6c3f0f05fd057d543a34725.tar.xz
Extended ClientObjectRef; Improved CrystalPvP
Diffstat (limited to 'builtin/common/misc_helpers.lua')
-rw-r--r--builtin/common/misc_helpers.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua
index f6ceda54d..64d67bc72 100644
--- a/builtin/common/misc_helpers.lua
+++ b/builtin/common/misc_helpers.lua
@@ -708,6 +708,19 @@ function core.get_translator(textdomain)
return function(str, ...) return core.translate(textdomain or "", str, ...) end
end
+function core.get_pointed_thing_position(pointed_thing, above)
+ if pointed_thing.type == "node" then
+ if above then
+ -- The position where a node would be placed
+ return pointed_thing.above
+ end
+ -- The position where a node would be dug
+ return pointed_thing.under
+ elseif pointed_thing.type == "object" then
+ return pointed_thing.ref and pointed_thing.ref:get_pos()
+ end
+end
+
--------------------------------------------------------------------------------
-- Returns the exact coordinate of a pointed surface
--------------------------------------------------------------------------------