renew/dry_dirt.lua

38 lines
1.2 KiB
Lua

-- Renew mod for Minetest
-- Copyright © 2020 Alex Yst <https://y.st./>
-- This program is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
-- This software is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
-- You should have received a copy of the GNU Lesser General Public
-- License along with this program. If not, see
-- <https://www.gnu.org./licenses/>.
minetest.register_abm({
label = "Soil Moisture Loss",
nodenames = {
"default:dry_grass_1",
"default:dry_grass_2",
"default:dry_grass_3",
"default:dry_grass_4",
"default:dry_grass_5",
},
neighbors = {"default:dirt"},
interval = 1800,
chance = 900,
catch_up = true,
action = function(pos)
pos.y = pos.y - 1
if minetest.get_node(pos).name == "default:dirt" then
minetest.set_node(pos, {name = "default:dry_dirt_with_dry_grass"})
end
end,
})