This line
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
if (nodePlanted.name ~= "default:dirt" or "default:dirt_with_grass") then return end
Should be
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
if (nodePlanted.name ~= "default:dirt" and nodePlanted.name ~= "default:dirt_with_grass") then return end
In the top code "default:dirt_with_grass" will always be true... there is no real evaluation going on, and since you were using an 'or' either side can evaluate to true and it will execute the code after 'then'... so that line of code will always 'return end'
The bottom code will only 'return end' if both sides of the 'and' are true.
Good catch on the typo, lkjoel. I didn't see that one, I make that mistake a lot too especially with languages where the variables are case sensitive... (ie nodePlanted is not the same as nodeplanted)