InfinityProject wrote:Tried that but then it says the same thing as before but with puncher instead of player. My complete code:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
function corruptor (pos, node, puncher)
if
node.name == 'cyro:corruptor'
then
corrupt (pos, node)
end
end
minetest.register_on_punchnode(corruptor)
function corrupt (pos, node)
if puncher:get_inventory():contains_item("main", "cyro:cmatter") then
puncher:get_inventory():remove_item("main", "cyro:cmatter") do
puncher:get_inventory():add_item("main", "cyro:kyro_matter")
end
end
end
Look at this:
function corruptor (pos, node,
puncher)
and then at this:
function corrupt (pos, node)
Puncher is missing in the 2nd definition
So, you need to change "function corrupt (pos, node)"
and "corrupt (pos, node)" to "function corrupt (pos, node, puncher)" and "corrupt (pos, node, puncher)"