Getting the name of the node below a node?
I am trying to get whether or not a node has been placed in a spot where there is either dirt or dirt with grass directly underneath it. Here is the code I currently have, but it doesn't work. It only throws a lua exception.
The code after this is to make my sapling grow into a tree. It works. This is the section that I am having trouble getting to work. I'm not sure what's going wrong. It seems as if I have tried everything but the right way to get this to work. All help is much appreciated!
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
local nodePlantedPos = pos
nodePlantedPos.y = nodePlanted.y - 1
local nodePlanted = minetest.env:get_node(nodePlantedPos)
if (nodePlanted.name ~= "default:dirt" or "default:dirt_with_grass") then return end
The code after this is to make my sapling grow into a tree. It works. This is the section that I am having trouble getting to work. I'm not sure what's going wrong. It seems as if I have tried everything but the right way to get this to work. All help is much appreciated!