Is there a way of introducing boolean conditions in order for things to change? Not just temporal conditions based on chance, but boolean conditions that may trigger some result.
I've tried to do it introducing the if-then-else structure inside an ABM, as follows:
Code: Select all
booleano = 1
minetest.register_abm({
nodenames = {"default:river_water_source", "default:river_water_flowing"},
interval = 5.0, -- Run every 5 seconds
chance = 2, -- Select every 1 in 2 nodes
action = function(pos, node, active_object_count, active_object_count_wider)
if(booleano == 1)
then
minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "default:dirt"})
booleano = 0
else
minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "default:stone_with_gold"})
booleano = 1
end
end
})