cauldron.lua 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. minetest.register_node("lottpotion:cauldron_full",{
  2. drawtype="nodebox",
  3. description= "Filled Cauldron",
  4. tiles = {"lottpotion_cauldron_top.png", "lottpotion_cauldron_side.png", "lottpotion_cauldron_side.png",
  5. "lottpotion_cauldron_side.png", "lottpotion_cauldron_side.png", "lottpotion_cauldron_side.png"},
  6. paramtype = "light",
  7. paramtype2 = "facedir",
  8. groups = {cracky=1},
  9. legacy_facedir_simple = true,
  10. node_box = {
  11. type = "fixed",
  12. fixed = {
  13. {-0.5, -0.5, -0.5, -0.375, 0.5, -0.375},
  14. {0.375, -0.5, -0.5, 0.5, 0.5, -0.375},
  15. {0.375, -0.5, 0.375, 0.5, 0.5, 0.5},
  16. {-0.5, -0.5, 0.375, -0.375, 0.5, 0.5},
  17. {-0.375, -0.375, -0.375, 0.375, -0.3125, 0.375},
  18. {-0.5, -0.375, -0.375, -0.375, 0.4375, 0.375},
  19. {0.375, -0.375, -0.375, 0.5, 0.4375, 0.375},
  20. {-0.375, -0.375, 0.375, 0.375, 0.4375, 0.5},
  21. {-0.375, -0.375, -0.5, 0.375, 0.4375, -0.375},
  22. {-0.375, 0.25, -0.375, 0.375, 0.3125, 0.375},
  23. }
  24. },
  25. on_punch = function(pos, node, player)
  26. local player_inv = player:get_inventory()
  27. local itemstack = player:get_wielded_item()
  28. if itemstack:get_name() == "vessels:glass_bottle" then
  29. minetest.set_node(pos, {name="lottpotion:cauldron_two_third_full"})
  30. if player_inv:room_for_item("main", 1) then
  31. itemstack:take_item(1)
  32. player_inv:add_item("main", "lottpotion:glass_bottle_water")
  33. end
  34. player:set_wielded_item(itemstack)
  35. end
  36. end,
  37. })
  38. minetest.register_node("lottpotion:cauldron_two_third_full",{
  39. drawtype="nodebox",
  40. description= "Two Third Filled Cauldron",
  41. tiles = {"lottpotion_cauldron_top.png", "lottpotion_cauldron_side.png", "lottpotion_cauldron_side.png",
  42. "lottpotion_cauldron_side.png", "lottpotion_cauldron_side.png", "lottpotion_cauldron_side.png"},
  43. paramtype = "light",
  44. paramtype2 = "facedir",
  45. groups = {cracky=1, not_in_creative_inventory=1},
  46. node_box = {
  47. type = "fixed",
  48. fixed = {
  49. {-0.5, -0.5, -0.5, -0.375, 0.5, -0.375},
  50. {0.375, -0.5, -0.5, 0.5, 0.5, -0.375},
  51. {0.375, -0.5, 0.375, 0.5, 0.5, 0.5},
  52. {-0.5, -0.5, 0.375, -0.375, 0.5, 0.5},
  53. {-0.375, -0.375, -0.375, 0.375, -0.3125, 0.375},
  54. {-0.5, -0.375, -0.375, -0.375, 0.4375, 0.375},
  55. {0.375, -0.375, -0.375, 0.5, 0.4375, 0.375},
  56. {-0.375, -0.375, 0.375, 0.375, 0.4375, 0.5},
  57. {-0.375, -0.375, -0.5, 0.375, 0.4375, -0.375},
  58. {-0.375, 0.0625, -0.375, 0.375, 0.125, 0.375},
  59. }
  60. },
  61. on_punch = function(pos, node, player)
  62. local player_inv = player:get_inventory()
  63. local itemstack = player:get_wielded_item()
  64. if itemstack:get_name() == "vessels:glass_bottle" then
  65. minetest.set_node(pos, {name="lottpotion:cauldron_one_third_full"})
  66. if player_inv:room_for_item("main", 1) then
  67. itemstack:take_item(1)
  68. player_inv:add_item("main", "lottpotion:glass_bottle_water")
  69. end
  70. player:set_wielded_item(itemstack)
  71. end
  72. end,
  73. })
  74. minetest.register_node("lottpotion:cauldron_one_third_full",{
  75. drawtype="nodebox",
  76. description= "One Third Filled Cauldron",
  77. tiles = {"lottpotion_cauldron_top.png", "lottpotion_cauldron_side.png", "lottpotion_cauldron_side.png",
  78. "lottpotion_cauldron_side.png", "lottpotion_cauldron_side.png", "lottpotion_cauldron_side.png"},
  79. paramtype = "light",
  80. paramtype2 = "facedir",
  81. groups = {cracky=1, not_in_creative_inventory=1},
  82. node_box = {
  83. type = "fixed",
  84. fixed = {
  85. {-0.5, -0.5, -0.5, -0.375, 0.5, -0.375},
  86. {0.375, -0.5, -0.5, 0.5, 0.5, -0.375},
  87. {0.375, -0.5, 0.375, 0.5, 0.5, 0.5},
  88. {-0.5, -0.5, 0.375, -0.375, 0.5, 0.5},
  89. {-0.375, -0.375, -0.375, 0.375, -0.3125, 0.375},
  90. {-0.5, -0.375, -0.375, -0.375, 0.4375, 0.375},
  91. {0.375, -0.375, -0.375, 0.5, 0.4375, 0.375},
  92. {-0.375, -0.375, 0.375, 0.375, 0.4375, 0.5},
  93. {-0.375, -0.375, -0.5, 0.375, 0.4375, -0.375},
  94. {-0.375, -0.125, -0.375, 0.375, -0.0625, 0.375},
  95. }
  96. },
  97. on_punch = function(pos, node, player)
  98. local player_inv = player:get_inventory()
  99. local itemstack = player:get_wielded_item()
  100. if itemstack:get_name() == "vessels:glass_bottle" then
  101. minetest.set_node(pos, {name="lottpotion:cauldron_empty"})
  102. if player_inv:room_for_item("main", 1) then
  103. itemstack:take_item(1)
  104. player_inv:add_item("main", "lottpotion:glass_bottle_water")
  105. end
  106. player:set_wielded_item(itemstack)
  107. end
  108. end,
  109. })
  110. minetest.register_node("lottpotion:cauldron_empty",{
  111. drawtype="nodebox",
  112. description= "Cauldron",
  113. tiles = {"lottpotion_cauldron_side.png"},
  114. paramtype = "light",
  115. paramtype2 = "facedir",
  116. groups = {cracky=1,level=2},
  117. node_box = {
  118. type = "fixed",
  119. fixed = {
  120. {-0.5, -0.5, -0.5, -0.375, 0.5, -0.375},
  121. {0.375, -0.5, -0.5, 0.5, 0.5, -0.375},
  122. {0.375, -0.5, 0.375, 0.5, 0.5, 0.5},
  123. {-0.5, -0.5, 0.375, -0.375, 0.5, 0.5},
  124. {-0.375, -0.375, -0.375, 0.375, -0.3125, 0.375},
  125. {-0.5, -0.375, -0.375, -0.375, 0.4375, 0.375},
  126. {0.375, -0.375, -0.375, 0.5, 0.4375, 0.375},
  127. {-0.375, -0.375, 0.375, 0.375, 0.4375, 0.5},
  128. {-0.375, -0.375, -0.5, 0.375, 0.4375, -0.375},
  129. {-0.375, -0.125, -0.375, 0.375, -0.25, 0.375},
  130. },
  131. },
  132. on_rightclick = function(pos, node, clicker, itemstack)
  133. if itemstack:get_name() == "bucket:bucket_water" then
  134. minetest.set_node(pos, {name="lottpotion:cauldron_full"})
  135. return {name="bucket:bucket_empty"}
  136. end
  137. end
  138. })
  139. minetest.register_node("lottpotion:glass_bottle_water", {
  140. description = "Glass Bottle (Water)",
  141. drawtype = "plantlike",
  142. tiles = {"vessels_glass_bottle.png^lottpotion_water.png"},
  143. inventory_image = "vessels_glass_bottle_inv.png^lottpotion_water.png",
  144. wield_image = "vessels_glass_bottle_inv.png^lottpotion_water.png",
  145. paramtype = "light",
  146. walkable = false,
  147. selection_box = {
  148. type = "fixed",
  149. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  150. },
  151. groups = {vessel=1,dig_immediate=3,attached_node=1},
  152. sounds = default.node_sound_glass_defaults(),
  153. })
  154. minetest.register_node(":vessels:drinking_glass", {
  155. description = "Drinking Glass (empty)",
  156. drawtype = "plantlike",
  157. tiles = {"vessels_drinking_glass.png"},
  158. inventory_image = "vessels_drinking_glass_inv.png",
  159. wield_image = "vessels_drinking_glass.png",
  160. paramtype = "light",
  161. walkable = false,
  162. selection_box = {
  163. type = "fixed",
  164. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  165. },
  166. groups = {vessel=1,dig_immediate=3,attached_node=1},
  167. sounds = default.node_sound_glass_defaults(),
  168. on_use = function(itemstack, user, pointed_thing)
  169. pos = pointed_thing.above
  170. if pos == nil then return itemstack end
  171. pos.y = pos.y - 1
  172. if (minetest.get_node(pos).name == "lottpotion:cauldron_full") then
  173. minetest.remove_node(pos)
  174. minetest.set_node(pos, {name="lottpotion:cauldron_two_third_full"})
  175. itemstack:take_item()
  176. user:get_inventory():add_item('main', "lottpotion:drinking_glass_water")
  177. return itemstack
  178. end
  179. if (minetest.get_node(pos).name == "lottpotion:cauldron_two_third_full") then
  180. minetest.remove_node(pos)
  181. minetest.set_node(pos, {name="lottpotion:cauldron_one_third_full"})
  182. itemstack:take_item()
  183. user:get_inventory():add_item('main', "lottpotion:drinking_glass_water")
  184. return itemstack
  185. end
  186. if (minetest.get_node(pos).name == "lottpotion:cauldron_one_third_full") then
  187. minetest.remove_node(pos)
  188. minetest.set_node(pos, {name="lottpotion:cauldron_empty"})
  189. itemstack:take_item()
  190. user:get_inventory():add_item('main', "lottpotion:drinking_glass_water")
  191. return itemstack
  192. end
  193. end
  194. })
  195. minetest.register_node("lottpotion:drinking_glass_water", {
  196. description = "Drinking Glass (Water)",
  197. drawtype = "plantlike",
  198. tiles = {"lottpotion_glass_water.png"},
  199. inventory_image = "lottpotion_glass_water.png",
  200. wield_image = "lottpotion_glass_water.png",
  201. paramtype = "light",
  202. walkable = false,
  203. selection_box = {
  204. type = "fixed",
  205. fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
  206. },
  207. groups = {vessel=1,dig_immediate=3,attached_node=1},
  208. sounds = default.node_sound_glass_defaults(),
  209. })
  210. minetest.register_craft( {
  211. type = "shapeless",
  212. output = "vessels:glass_fragments",
  213. recipe = {
  214. "group:vessel",
  215. "group:vessel",
  216. },
  217. })
  218. minetest.register_craft({
  219. output = 'lottpotion:cauldron_empty',
  220. recipe = {
  221. {'default:steel_ingot', '', 'default:steel_ingot'},
  222. {'default:steel_ingot', '', 'default:steel_ingot'},
  223. {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
  224. }
  225. })