Dépôt du mod sponge.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.0KB

  1. minetest.register_node("sponge:sponge", {
  2. description = "Sponge Dry",
  3. drawtype = "normal",
  4. tiles = {"sponge_sponge.png"},
  5. paramtype = 'light',
  6. walkable = true,
  7. pointable = true,
  8. diggable = true,
  9. buildable_to = false,
  10. stack_max = 99,
  11. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3,flammable=3},
  12. after_place_node = function(pos, placer, itemstack, pointed_thing)
  13. local pn = placer:get_player_name()
  14. if pointed_thing.type ~= "node" then
  15. return
  16. end
  17. if minetest.is_protected(pointed_thing.above, pn) then
  18. return
  19. end
  20. local change = false
  21. local on_water = false
  22. local p, n
  23. -- verifier si il est dans l'eau ou a cotée
  24. if string.find(minetest.get_node(pointed_thing.above).name, "water_source")
  25. or string.find(minetest.get_node(pointed_thing.above).name, "water_flowing") then
  26. on_water = true
  27. end
  28. for i=-1,1 do
  29. p = {x=pos.x+i, y=pos.y, z=pos.z}
  30. n = minetest.get_node(p)
  31. -- On verifie si il y a de l'eau
  32. if (n.name=="default:water_flowing") or (n.name == "default:water_source")
  33. or (n.name == "default:river_water_flowing") or (n.name == "default:river_water_source") then
  34. on_water = true
  35. end
  36. end
  37. for i=-1,1 do
  38. p = {x=pos.x, y=pos.y+i, z=pos.z}
  39. n = minetest.get_node(p)
  40. -- On verifie si il y a de l'eau
  41. if (n.name=="default:water_flowing") or (n.name == "default:water_source")
  42. or (n.name == "default:river_water_flowing") or (n.name == "default:river_water_source") then
  43. on_water = true
  44. end
  45. end
  46. for i=-1,1 do
  47. p = {x=pos.x, y=pos.y, z=pos.z+i}
  48. n = minetest.get_node(p)
  49. -- On verifie si il y a de l'eau
  50. if (n.name=="default:water_flowing") or (n.name == "default:water_source")
  51. or (n.name == "default:river_water_flowing") or (n.name == "default:river_water_source") then
  52. on_water = true
  53. end
  54. end
  55. if on_water == true then
  56. for i=-3,3 do
  57. for j=-3,3 do
  58. for k=-3,3 do
  59. p = {x=pos.x+i, y=pos.y+j, z=pos.z+k}
  60. n = minetest.get_node(p)
  61. -- On Supprime l'eau
  62. if (n.name=="default:water_flowing") or (n.name == "default:water_source")
  63. or (n.name == "default:river_water_flowing") or (n.name == "default:river_water_source") then
  64. minetest.add_node(p, {name="air"})
  65. change = true
  66. end
  67. end
  68. end
  69. end
  70. end
  71. if change then
  72. minetest.add_node(pos, {name = "sponge:sponge_wet"})
  73. end
  74. end
  75. })
  76. minetest.register_node("sponge:sponge_wet", {
  77. description = "Wet Sponge",
  78. drawtype = "normal",
  79. tiles = {"sponge_sponge_wet.png"},
  80. paramtype = 'light',
  81. walkable = true,
  82. pointable = true,
  83. diggable = true,
  84. buildable_to = false,
  85. stack_max = 99,
  86. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3},
  87. })
  88. -- Sponge wet back to Sponge Dry if coocked in a furnace
  89. minetest.register_craft({
  90. type = "cooking", output = "sponge:sponge", recipe = "sponge:sponge_wet",
  91. })
  92. minetest.register_craft({
  93. output = "sponge:sponge",
  94. recipe = {
  95. {"", "dye:black", ""},
  96. {"dye:yellow", "wool:white", "dye:yellow"},
  97. {"", "farming:wheat", ""},
  98. },
  99. })
  100. minetest.log("action", "[sponge] loaded.")