soil.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. minetest.register_node("farming:soil", {
  2. tiles = {"farming_soil.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png"},
  3. drop = "default:dirt",
  4. groups = {crumbly=3, not_in_creative_inventory=1},
  5. sounds = default.node_sound_dirt_defaults({
  6. footstep = {name="default_grass_footstep", gain=0.4},
  7. }),
  8. })
  9. minetest.register_node("farming:soil_wet", {
  10. tiles = {"farming_soil_wet.png", "farming_soil_wet_side.png", "farming_soil_wet_side.png", "farming_soil_wet_side.png", "farming_soil_wet_side.png", "farming_soil_wet_side.png"},
  11. drop = "default:dirt",
  12. groups = {crumbly=3, not_in_creative_inventory=1},
  13. sounds = default.node_sound_dirt_defaults({
  14. footstep = {name="default_grass_footstep", gain=0.4},
  15. }),
  16. })
  17. minetest.register_abm({
  18. nodenames = {"farming:soil"},
  19. interval = 15,
  20. chance = 3,
  21. action = function(pos, node)
  22. if minetest.env:find_node_near(pos, 4, {"default:water_source", "default:water_flowing"}) then
  23. node.name = "farming:soil_wet"
  24. minetest.env:set_node(pos, node)
  25. end
  26. end,
  27. })
  28. -- ========= EXPERIMENTAL =========
  29. -- This will turn soil to dirt when walking over it
  30. --[[minetest.register_abm({
  31. nodenames = {"farming:soil", "farming:soil_wet"},
  32. interval = 2,
  33. chance = 2,
  34. action = function(pos, node)
  35. pos.y = pos.y+1
  36. if #(minetest.env:get_objects_inside_radius(pos, 0.8)) > 0 then
  37. pos.y = pos.y-1
  38. node.name = "default:dirt"
  39. minetest.env:set_node(pos, node)
  40. end
  41. end,
  42. })]]