summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradrido <robots_only_adrido@gmx.com>2017-02-21 07:46:38 -0500
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-02-21 07:46:38 -0500
commit34299b01a065c58c36c0947388b81bb5b8926634 (patch)
tree4ceb145275283bad953df888c110e7266b50100b
parent295cd027f288e48c0809a9b6d4c3626e15f1b993 (diff)
downloadunifieddyes-34299b01a065c58c36c0947388b81bb5b8926634.tar
unifieddyes-34299b01a065c58c36c0947388b81bb5b8926634.tar.gz
unifieddyes-34299b01a065c58c36c0947388b81bb5b8926634.tar.bz2
unifieddyes-34299b01a065c58c36c0947388b81bb5b8926634.tar.xz
unifieddyes-34299b01a065c58c36c0947388b81bb5b8926634.zip
fix not being able to pick up dropped objects while wielding dye
-rw-r--r--init.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/init.lua b/init.lua
index 6b5ed13..76b849e 100644
--- a/init.lua
+++ b/init.lua
@@ -342,7 +342,12 @@ end
function unifieddyes.on_use(itemstack, player, pointed_thing)
- if not pointed_thing or pointed_thing.type == "nothing" then return end -- if "using" the dye on air
+ if pointed_thing and pointed_thing.type == "object" then
+ pointed_thing.ref:punch(player, 0, itemstack:get_tool_capabilities())
+ return player:get_wielded_item() -- punch may modified the wielded item, load the new and return it
+ end
+
+ if not (pointed_thing and pointed_thing.type == "node") then return end -- if "using" the dye not on a node
local pos = minetest.get_pointed_thing_position(pointed_thing)
local node = minetest.get_node(pos)