Make growth tool work on dirt and swamp dirt

This commit is contained in:
Wuzzy 2022-05-22 18:14:24 +02:00
parent 0026fc0874
commit 74c8ac9fc1

View File

@ -29,6 +29,18 @@ minetest.register_craftitem(
local used = false
if minetest.get_item_group(unode.name, "sapling") ~= 0 then
used = default.grow_sapling(upos)
elseif diff.y > 0 and unode.name == "rp_default:dirt" and anode.name == "air" then
local biomedata = minetest.get_biome_data(upos)
local biome = minetest.get_biome_name(biomedata.biome)
if default.is_dry_biome(biome) then
minetest.set_node(upos, {name="rp_default:dirt_with_dry_grass"})
else
minetest.set_node(upos, {name="rp_default:dirt_with_grass"})
end
used = true
elseif diff.y > 0 and unode.name == "rp_default:swamp_dirt" and anode.name == "air" then
minetest.set_node(upos, {name="rp_default:dirt_with_swamp_grass"})
used = true
elseif diff.y > 0 and unode.name == "rp_default:dirt_with_grass" and anode.name == "air" then
minetest.set_node(apos, {name="rp_default:grass"})
used = true