mirror of
https://github.com/mt-mods/unifieddyes.git
synced 2024-11-22 23:43:45 +01:00
don't crash if the dye target is an unknown node :P
This commit is contained in:
parent
70b1f9fbc9
commit
978e88bda5
2
init.lua
2
init.lua
@ -505,6 +505,8 @@ function unifieddyes.on_use(itemstack, player, pointed_thing)
|
|||||||
local nodedef = minetest.registered_nodes[node.name]
|
local nodedef = minetest.registered_nodes[node.name]
|
||||||
local playername = player:get_player_name()
|
local playername = player:get_player_name()
|
||||||
|
|
||||||
|
if not nodedef then return end -- target was an unknown node, just bail out
|
||||||
|
|
||||||
-- if the node has an on_punch defined, bail out and call that instead, unless "sneak" is pressed.
|
-- if the node has an on_punch defined, bail out and call that instead, unless "sneak" is pressed.
|
||||||
if not player:get_player_control().sneak then
|
if not player:get_player_control().sneak then
|
||||||
local onpunch = nodedef.on_punch(pos, node, player, pointed_thing)
|
local onpunch = nodedef.on_punch(pos, node, player, pointed_thing)
|
||||||
|
Loading…
Reference in New Issue
Block a user