diff options
Diffstat (limited to 'soil.lua')
-rw-r--r-- | soil.lua | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -3,8 +3,7 @@ minetest.register_node("farming:soil", { description = "Soil", tiles = {"farming_soil.png", "default_dirt.png"}, drop = "default:dirt", - is_ground_content = true, - groups = {crumbly=3, not_in_creative_inventory=1, soil=2}, + groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 2}, sounds = default.node_sound_dirt_defaults(), }) @@ -16,8 +15,7 @@ minetest.register_node("farming:soil_wet", { description = "Wet Soil", tiles = {"farming_soil_wet.png", "farming_soil_wet_side.png"}, drop = "default:dirt", - is_ground_content = true, - groups = {crumbly=3, not_in_creative_inventory=1, soil=3}, + groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 3}, sounds = default.node_sound_dirt_defaults(), }) minetest.register_alias("farming:desert_sand_soil_wet", "farming:soil_wet") @@ -29,13 +27,17 @@ minetest.register_abm({ chance = 4, action = function(pos, node) - local nn = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name + pos.y = pos.y + 1 + local nn = minetest.get_node_or_nil(pos) + pos.y = pos.y - 1 + + if nn then nn = nn.name else return end -- what's on top of soil, if solid/not plant change soil to dirt if minetest.registered_nodes[nn] and minetest.registered_nodes[nn].walkable and minetest.get_item_group(nn, "plant") == 0 then - minetest.set_node(pos, {name="default:dirt"}) + minetest.set_node(pos, {name = "default:dirt"}) return end @@ -47,12 +49,12 @@ minetest.register_abm({ -- check if there is water nearby and change soil accordingly if minetest.find_node_near(pos, 3, {"group:water"}) then if node.name == "farming:soil" then - minetest.set_node(pos, {name="farming:soil_wet"}) + minetest.set_node(pos, {name = "farming:soil_wet"}) end elseif node.name == "farming:soil_wet" then - minetest.set_node(pos, {name="farming:soil"}) + minetest.set_node(pos, {name = "farming:soil"}) elseif node.name == "farming:soil" then - minetest.set_node(pos, {name="default:dirt"}) + minetest.set_node(pos, {name = "default:dirt"}) end end, -}) +})
\ No newline at end of file |