weed.lua 944 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. minetest.register_node("farming:weed", {
  2. description = "Weed",
  3. drawtype = "raillike",
  4. paramtype = "light",
  5. sunlight_propagates = true,
  6. walkable = false,
  7. tiles = {"farming_weed.png"},
  8. inventory_image = "farming_weed.png",
  9. selection_box = {
  10. type = "fixed",
  11. fixed = {
  12. {-0.5, -0.5, -0.5, 0.5, -0.5, 0.5}
  13. },
  14. },
  15. groups = {snappy=3, flammable=2, attached_node=1},
  16. sounds = default.node_sound_leaves_defaults()
  17. })
  18. minetest.register_abm({
  19. nodenames = {"farming:soil_wet", "farming:soil"},
  20. interval = 50,
  21. chance = 10,
  22. action = function(pos, node)
  23. if minetest.env:find_node_near(pos, 4, {"farming:scarecrow", "farming:scarecrow_light"}) ~= nil then
  24. return
  25. end
  26. pos.y = pos.y+1
  27. if minetest.env:get_node(pos).name == "air" then
  28. node.name = "farming:weed"
  29. minetest.env:set_node(pos, node)
  30. end
  31. end
  32. })
  33. -- ========= FUEL =========
  34. minetest.register_craft({
  35. type = "fuel",
  36. recipe = "farming:weed",
  37. burntime = 1
  38. })