aboutsummaryrefslogtreecommitdiff
path: root/clientmods/preview
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2019-11-09 00:41:33 +0100
committersfan5 <sfan5@live.de>2019-11-11 14:06:48 +0100
commit3f271564e08716cfeb4a966f4291524b0fac05d3 (patch)
tree7676e11117488b2cb851becd74ac7989b8490d6c /clientmods/preview
parent682b9de8246ce2c620f1cc5e4212e6378c2301ae (diff)
downloadminetest-3f271564e08716cfeb4a966f4291524b0fac05d3.tar.gz
minetest-3f271564e08716cfeb4a966f4291524b0fac05d3.tar.bz2
minetest-3f271564e08716cfeb4a966f4291524b0fac05d3.zip
Run on_item_use CSM callback even if item is not marked usable
Mods may want to to handle item interaction even if the item is not marked usable (= server-side callback exists).
Diffstat (limited to 'clientmods/preview')
-rw-r--r--clientmods/preview/init.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/clientmods/preview/init.lua b/clientmods/preview/init.lua
index 96deae074..dd856217f 100644
--- a/clientmods/preview/init.lua
+++ b/clientmods/preview/init.lua
@@ -66,6 +66,10 @@ core.register_on_item_use(function(itemstack, pointed_thing)
print("pointed_thing :" .. dump(pointed_thing))
print("item = " .. itemstack:get_name())
+ if not itemstack:is_empty() then
+ return false
+ end
+
local pos = vector.add(core.localplayer:get_pos(), core.camera:get_offset())
local pos2 = vector.add(pos, vector.multiply(core.camera:get_look_dir(), 100))