lamps.lua 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. minetest.register_alias("lottother:blue_torch", "lottblocks:elf_torch")
  2. minetest.register_alias("lottother:orc_torch", "lottblocks:orc_torch")
  3. minetest.register_alias("lottother:lamp_wood", "lottblocks:lamp_wood")
  4. minetest.register_alias("lottother:lamp_middle_wood", "lottblocks:lamp_middle_wood")
  5. minetest.register_alias("lottother:lamp_top_wood", "lottblocks:lamp_top_wood")
  6. minetest.register_alias("lottother:tiny_lamp_wood", "lottblocks:small_lamp_wood")
  7. minetest.register_alias("lottother:lamp_wood_alder", "lottblocks:lamp_alder")
  8. minetest.register_alias("lottother:lamp_middle_wood_alder", "lottblocks:lamp_middle_alder")
  9. minetest.register_alias("lottother:lamp_top_wood_alder", "lottblocks:lamp_top_alder")
  10. minetest.register_alias("lottother:tiny_lamp_wood_alder", "lottblocks:small_lamp_alder")
  11. minetest.register_alias("lottother:lamp_wood_birch", "lottblocks:lamp_birch")
  12. minetest.register_alias("lottother:lamp_middle_wood_birch", "lottblocks:lamp_middle_birch")
  13. minetest.register_alias("lottother:lamp_top_wood_birch", "lottblocks:lamp_top_birch")
  14. minetest.register_alias("lottother:tiny_lamp_wood_birch", "lottblocks:small_lamp_birch")
  15. minetest.register_alias("lottother:lamp_wood_lebethron", "lottblocks:lamp_lebethron")
  16. minetest.register_alias("lottother:lamp_middle_wood_lebethron", "lottblocks:lamp_middle_lebethron")
  17. minetest.register_alias("lottother:lamp_top_wood_lebethron", "lottblocks:lamp_top_lebethron")
  18. minetest.register_alias("lottother:tiny_lamp_wood_lebethron", "lottblocks:small_lamp_lebethron")
  19. minetest.register_alias("lottother:lamp_wood_mallorn", "lottblocks:lamp_mallorn")
  20. minetest.register_alias("lottother:lamp_middle_wood_mallorn", "lottblocks:lamp_middle_mallorn")
  21. minetest.register_alias("lottother:lamp_top_wood_mallorn", "lottblocks:lamp_top_mallorn")
  22. minetest.register_alias("lottother:tiny_lamp_wood_mallorn", "lottblocks:small_lamp_mallorn")
  23. function lottblocks.register_lamp(material, description, inv_texture, post1_texture, post2_texture, top_texture, texture, material_code_name, race)
  24. local node_bottom = "lottblocks:lamp_" .. material
  25. local node_middle = "lottblocks:lamp_middle_" .. material
  26. local node_top = "lottblocks:lamp_top_" .. material
  27. local node_small = "lottblocks:small_lamp_" .. material
  28. minetest.register_node(node_bottom, {
  29. drop = "",
  30. description = description .. " Lamppost",
  31. tiles = {post1_texture},
  32. inventory_image = inv_texture,
  33. wield_image = inv_texture,
  34. groups = {choppy=2,oddly_breakable_by_hand=1,flammable=2},
  35. paramtype = "light",
  36. drawtype = "nodebox",
  37. node_box = {
  38. type = "fixed",
  39. fixed = {
  40. {-0.15,-0.5,-0.15,0.15,0.4,0.15},
  41. {-0.1,0.4,-0.1,0.1,0.5,0.1}
  42. }
  43. },
  44. on_place = function(itemstack, placer, pointed_thing)
  45. local pos = pointed_thing.above;
  46. if(minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air") or (minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z}).name ~= "air") then
  47. minetest.chat_send_player( placer:get_player_name(), 'Not enough space for lamppost to be placed' )
  48. return;
  49. end
  50. return minetest.item_place(itemstack, placer, pointed_thing);
  51. end,
  52. after_place_node = function(pos,placer,itemstack)
  53. minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z},{name = node_middle})
  54. minetest.set_node({x = pos.x, y = pos.y + 2, z = pos.z},{name = node_top})
  55. end,
  56. })
  57. minetest.register_node(node_middle, {
  58. drop = "",
  59. groups = {choppy=2,oddly_breakable_by_hand=1,flammable=2, not_in_creative_inventory = 1},
  60. tiles = {post2_texture},
  61. paramtype = "light",
  62. drawtype = "nodebox",
  63. pointable = false,
  64. node_box = {
  65. type = "fixed",
  66. fixed = {
  67. {-0.1,-0.5,-0.1,0.1,0.5,0.1}
  68. }
  69. }
  70. })
  71. minetest.register_node(node_top, {
  72. drop = "lottblocks:lamp_" .. material,
  73. groups = {choppy=2,oddly_breakable_by_hand=1,flammable=2, not_in_creative_inventory = 1},
  74. tiles = {
  75. top_texture, top_texture,
  76. {
  77. image = texture,
  78. backface_culling = false,
  79. animation = {
  80. type = "vertical_frames",
  81. aspect_w = 16,
  82. aspect_h = 16,
  83. length = 1.5
  84. },
  85. }
  86. },
  87. paramtype = "light",
  88. drawtype = "nodebox",
  89. light_source = 14,
  90. node_box = {
  91. type = "fixed",
  92. fixed = {
  93. {-0.1,-0.5,-0.1,0.1,-0.4,0.1},
  94. {-0.3,-0.4,-0.3,0.3,0.5,0.3}
  95. }
  96. },
  97. selection_box = {
  98. type = "fixed",
  99. fixed = {
  100. {-0.3,0.5,-0.3,0.3,-2.5,0.3},
  101. }
  102. },
  103. after_dig_node = function(pos)
  104. minetest.remove_node({x = pos.x, y = pos.y - 1, z = pos.z})
  105. minetest.remove_node({x = pos.x, y = pos.y - 2, z = pos.z})
  106. end
  107. })
  108. minetest.register_node(node_small, {
  109. description = description .. " Small Lamp",
  110. groups = {choppy=2,oddly_breakable_by_hand=1,flammable=2},
  111. tiles = {
  112. top_texture, top_texture,
  113. {
  114. image = texture,
  115. backface_culling = false,
  116. animation = {
  117. type = "vertical_frames",
  118. aspect_w = 16,
  119. aspect_h = 16,
  120. length = 1.5
  121. },
  122. },
  123. },
  124. paramtype = "light",
  125. drawtype = "nodebox",
  126. light_source = 14,
  127. node_box = {
  128. type = "fixed",
  129. fixed = {
  130. {-0.1,-0.5,-0.1,0.1,-0.4,0.1},
  131. {-0.3,-0.4,-0.3,0.3,0.5,0.3}
  132. }
  133. },
  134. selection_box = {
  135. type = "fixed",
  136. fixed = {
  137. {-0.1,-0.5,-0.1,0.1,-0.4,0.1},
  138. {-0.3,-0.4,-0.3,0.3,0.5,0.3}
  139. }
  140. },
  141. })
  142. if race == "elf" then
  143. minetest.register_craft({
  144. output = node_bottom,
  145. recipe = {
  146. {node_small},
  147. {material_code_name},
  148. {"default:stonebrick"},
  149. }
  150. })
  151. minetest.register_craft({
  152. output = node_small,
  153. recipe = {
  154. {material_code_name, material_code_name, material_code_name},
  155. {material_code_name, "lottblocks:elf_torch", material_code_name},
  156. {material_code_name, material_code_name, material_code_name},
  157. }
  158. })
  159. elseif race == "orc" then
  160. minetest.register_craft({
  161. output = node_bottom,
  162. recipe = {
  163. {node_small},
  164. {material_code_name},
  165. {"lottblocks:orc_brick"},
  166. }
  167. })
  168. minetest.register_craft({
  169. output = node_small,
  170. recipe = {
  171. {material_code_name, material_code_name, material_code_name},
  172. {material_code_name, "lottblocks:orc_torch", material_code_name},
  173. {material_code_name, material_code_name, material_code_name},
  174. }
  175. })
  176. end
  177. end
  178. lottblocks.register_lamp("wood", "Wood", "lottblocks_lamp_inv_wood.png", "default_stone_brick.png", "default_wood.png", "default_wood.png", "lottblocks_lamp_active_wood.png", "default:wood", "elf")
  179. lottblocks.register_lamp("alder", "Alder", "lottblocks_lamp_inv_alder.png", "default_stone_brick.png", "lottplants_alderwood.png", "lottplants_alderwood.png", "lottblocks_lamp_active_alder.png", "lottplants:alderwood", "elf")
  180. lottblocks.register_lamp("junglewood", "Junglewood", "lottblocks_lamp_inv_junglewood.png", "default_stone_brick.png", "default_junglewood.png", "default_junglewood.png", "lottblocks_lamp_active_junglewood.png", "default:junglewood", "elf")
  181. lottblocks.register_lamp("birch", "Birch", "lottblocks_lamp_inv_birch.png", "default_stone_brick.png", "lottplants_birchwood.png", "lottplants_birchwood.png", "lottblocks_lamp_active_birch.png", "lottplants:birchwood", "elf")
  182. lottblocks.register_lamp("pine", "Pine", "lottblocks_lamp_inv_pine.png", "default_stone_brick.png", "lottplants_pinewood.png", "lottplants_pinewood.png", "lottblocks_lamp_active_pine.png", "lottplants:pinewood", "elf")
  183. lottblocks.register_lamp("lebethron", "Lebethron", "lottblocks_lamp_inv_lebethron.png", "default_stone_brick.png", "lottplants_lebethronwood.png", "lottplants_lebethronwood.png", "lottblocks_lamp_active_lebethron.png", "lottplants:lebethronwood", "elf")
  184. lottblocks.register_lamp("mallorn", "Mallorn", "lottblocks_lamp_inv_mallorn.png", "default_stone_brick.png", "lottplants_mallornwood.png", "lottplants_mallornwood.png", "lottblocks_lamp_active_mallorn.png", "lottplants:mallornwood", "elf")
  185. --Orc lamps
  186. lottblocks.register_lamp("wood_orc", "Mordor Wooden", "lottblocks_orc_lamp_inv.png", "lottblocks_orc_brick.png", "default_wood.png", "default_wood.png", "lottblocks_orc_lamp_active.png", "default:wood", "orc")
  187. lottblocks.register_lamp("alder_orc", "Mordor Alder", "lottblocks_orc_lamp_inv_alder.png", "lottblocks_orc_brick.png", "lottplants_alderwood.png", "lottplants_alderwood.png", "lottblocks_orc_lamp_active_alder.png", "lottplants:alderwood", "orc")
  188. lottblocks.register_lamp("junglewood_orc", "Mordor Junglewood", "lottblocks_orc_lamp_inv_junglewood.png", "lottblocks_orc_brick.png", "default_junglewood.png", "default_junglewood.png", "lottblocks_orc_lamp_active_junglewood.png", "default:junglewood", "orc")
  189. lottblocks.register_lamp("birch_orc", "Mordor Birch", "lottblocks_orc_lamp_inv_birch.png", "lottblocks_orc_brick.png", "lottplants_birchwood.png", "lottplants_birchwood.png", "lottblocks_orc_lamp_active_birch.png", "lottplants:birchwood", "orc")
  190. lottblocks.register_lamp("pine_orc", "Mordor Pine", "lottblocks_orc_lamp_inv_pine.png", "lottblocks_orc_brick.png", "lottplants_pinewood.png", "lottplants_pinewood.png", "lottblocks_orc_lamp_active_pine.png", "lottplants:pinewood", "orc")
  191. lottblocks.register_lamp("lebethron_orc", "Mordor Lebethron", "lottblocks_orc_lamp_inv_lebethron.png", "lottblocks_orc_brick.png", "lottplants_lebethronwood.png", "lottplants_lebethronwood.png", "lottblocks_orc_lamp_active_lebethron.png", "lottplants:lebethronwood", "orc")
  192. -- Made by lumidify - lottblocks_mithril_stonelamp.png
  193. -- created by modifying darkage_lamp.png
  194. minetest.register_node("lottblocks:mithril_stonelamp", {
  195. description = "Mithril Stonelamp",
  196. tiles = { "lottblocks_mithril_stonelamp.png" },
  197. paramtype = "light",
  198. sunlight_propagates = true,
  199. light_source = LIGHT_MAX,
  200. groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
  201. sounds = default.node_sound_glass_defaults(),
  202. })
  203. minetest.register_craft({
  204. output = "lottblocks:mithril_stonelamp 2",
  205. recipe = {
  206. {"default:stone", "default:stone","default:stone"},
  207. {"default:stone", "lottores:mithril_ingot", "default:stone"},
  208. {"default:stone", "default:torch", "default:stone"},
  209. }
  210. })