1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

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).
This commit is contained in:
sfan5 2019-11-09 00:41:33 +01:00
parent 682b9de824
commit 3f271564e0
2 changed files with 7 additions and 0 deletions

View file

@ -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))