Guest User

Lottery mod

a guest
Jul 21st, 2012
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.52 KB | None | 0 0
  1. --
  2. -- Lottery mod
  3. --
  4. -- cactuz_pl
  5. --
  6. -- Licence: WTFPL
  7.  
  8. --Ticket
  9.  
  10. minetest.register_node("lottery:ticket", {
  11. description = "Put and wait.",
  12. tile_images = {"quest.png"},
  13. is_ground_content = true,
  14. groups = { choppy = 3, oddly_breakable_by_hand = 1.5},
  15. })
  16.  
  17. minetest.register_craft({
  18.     output = 'lottery:ticket 1',
  19.     recipe = {
  20.         {'default:mese', 'default:wood'},
  21.     },
  22. })
  23.  
  24. --Rewards
  25. --1 mese
  26. minetest.register_node("lottery:1mese", {
  27. description = "Craft to receive revard!",
  28. tile_images = {"reward.png"},
  29. is_ground_content = true,
  30. groups = { choppy = 3, oddly_breakable_by_hand = 1.5},
  31. })
  32.  
  33. minetest.register_craft({
  34.     output = 'default:mese 1',
  35.     recipe = {
  36.         {'lottery:1mese'},
  37.     },
  38. })
  39. --5 mese
  40. minetest.register_node("lottery:5mese", {
  41. description = "Craft to receive revard!",
  42. tile_images = {"reward.png"},
  43. is_ground_content = true,
  44. groups = { choppy = 3, oddly_breakable_by_hand = 1.5},
  45. })
  46.  
  47. minetest.register_craft({
  48.     output = 'default:mese 5',
  49.     recipe = {
  50.         {'lottery:5mese'},
  51.     },
  52. })
  53. --20 mese
  54. minetest.register_node("lottery:20mese", {
  55. description = "Craft to receive revard!",
  56. tile_images = {"reward.png"},
  57. is_ground_content = true,
  58. groups = { choppy = 3, oddly_breakable_by_hand = 1.5},
  59. })
  60.  
  61. minetest.register_craft({
  62.     output = 'default:mese 20',
  63.     recipe = {
  64.         {'lottery:20mese'},
  65.     },
  66. })
  67. --50 mese
  68. minetest.register_node("lottery:50mese", {
  69. description = "Craft to receive revard!",
  70. tile_images = {"reward.png"},
  71. is_ground_content = true,
  72. groups = { choppy = 3, oddly_breakable_by_hand = 1.5},
  73. })
  74.  
  75. minetest.register_craft({
  76.     output = 'default:mese 50',
  77.     recipe = {
  78.         {'lottery:50mese'},
  79.     },
  80. })
  81. --99 mese
  82. minetest.register_node("lottery:99mese", {
  83. description = "Craft to receive revard!",
  84. tile_images = {"reward.png"},
  85. is_ground_content = true,
  86. groups = { choppy = 3, oddly_breakable_by_hand = 1.5},
  87. })
  88.  
  89. minetest.register_craft({
  90.     output = 'default:mese 99',
  91.     recipe = {
  92.         {'lottery:99mese'},
  93.     },
  94. })
  95. --99 coal
  96. minetest.register_node("lottery:99coal", {
  97. description = "Craft to receive revard!",
  98. tile_images = {"reward.png"},
  99. is_ground_content = true,
  100. groups = { choppy = 3, oddly_breakable_by_hand = 1.5},
  101. })
  102.  
  103. minetest.register_craft({
  104.     output = 'default:coal_lump 99',
  105.     recipe = {
  106.         {'lottery:99coal'},
  107.     },
  108. })
  109. --99 wood
  110. minetest.register_node("lottery:99wood", {
  111. description = "Craft to receive revard!",
  112. tile_images = {"reward.png"},
  113. is_ground_content = true,
  114. groups = { choppy = 3, oddly_breakable_by_hand = 1.5},
  115. })
  116.  
  117. minetest.register_craft({
  118.     output = 'default:wood 99',
  119.     recipe = {
  120.         {'lottery:99wood'},
  121.     },
  122. })
  123. --99 ingots
  124. minetest.register_node("lottery:99ingot", {
  125. description = "Craft to receive revard!",
  126. tile_images = {"reward.png"},
  127. is_ground_content = true,
  128. groups = { choppy = 3, oddly_breakable_by_hand = 1.5},
  129. })
  130.  
  131. minetest.register_craft({
  132.     output = 'default:steel_ingot 99',
  133.     recipe = {
  134.         {'lottery:99ingot'},
  135.     },
  136. })
  137. --99 sapling
  138. minetest.register_node("lottery:99sapling", {
  139. description = "Craft to receive revard!",
  140. tile_images = {"reward.png"},
  141. is_ground_content = true,
  142. groups = { choppy = 3, oddly_breakable_by_hand = 1.5},
  143. })
  144.  
  145. minetest.register_craft({
  146.     output = 'default:sapling 99',
  147.     recipe = {
  148.         {'lottery:99sapling'},
  149.     },
  150. })
  151. --1 apple
  152. minetest.register_node("lottery:apple", {
  153. description = "Craft to receive revard!",
  154. tile_images = {"reward.png"},
  155. is_ground_content = true,
  156. groups = { choppy = 3, oddly_breakable_by_hand = 1.5},
  157. })
  158.  
  159. minetest.register_craft({
  160.     output = 'default:apple 1',
  161.     recipe = {
  162.         {'lottery:apple'},
  163.     },
  164. })
  165.  
  166. --ABM
  167.  
  168. minetest.register_abm(
  169.         {nodenames = {"lottery:ticket"},
  170.         interval = 0,
  171.         chance = 1,
  172.         action = function(pos)
  173. local i = math.random(1,999)
  174.        
  175. if i<500 then
  176. minetest.env:add_node(pos,{name="lottery:apple"})
  177. end
  178.  
  179. if i>499 and i<750 then
  180. minetest.env:add_node(pos,{name="lottery:1mese"})
  181. end
  182.  
  183. if i>749 and i<770 then
  184. minetest.env:add_node(pos,{name="lottery:5mese"})
  185. end
  186.  
  187. if i>769 and i<777 then
  188. minetest.env:add_node(pos,{name="lottery:20mese"})
  189. end
  190.  
  191. if i>776 and i<780 then
  192. minetest.env:add_node(pos,{name="lottery:50mese"})
  193. end
  194.  
  195. if i==780 then
  196. minetest.env:add_node(pos,{name="lottery:99mese"})
  197. end
  198.  
  199. if i>780 and i<841 then
  200. minetest.env:add_node(pos,{name="lottery:99coal"})
  201. end
  202.  
  203. if i>840 and i<901 then
  204. minetest.env:add_node(pos,{name="lottery:99wood"})
  205. end
  206.  
  207. if i>900 and i<951 then
  208. minetest.env:add_node(pos,{name="lottery:99ingot"})
  209. end
  210.  
  211. if i>950 then
  212. minetest.env:add_node(pos,{name="lottery:99ingot"})
  213. end
  214.  
  215. end
  216. })
Advertisement
Add Comment
Please, Sign In to add comment