init.lua 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  1. --[[
  2. --==========================================
  3. -- FreeGamers Candles Version -- FreeGamers.org
  4. -- Original Candles mod by darkrose
  5. -- Copyright (C) Lisa Milne 2013 <lisa@ltmnet.com>
  6. -- Code: GPL version 2
  7. -- http://www.gnu.org/licenses/>
  8. --==========================================
  9. --]]
  10. screwdriver = screwdriver or {}
  11. local candles = {}
  12. candles.types = {
  13. {
  14. unlit = "candles:candle",
  15. lit = "candles:candle_lit",
  16. name = "Candle",
  17. ingot = nil,
  18. image = "candles_candle"
  19. },
  20. {
  21. unlit = "candles:candle_floor_silver",
  22. lit = "candles:candle_floor_silver_lit",
  23. name = "Silver Candle Stick",
  24. ingot = "moreores:silver_ingot",
  25. image = "candles_candle_silver"
  26. },
  27. {
  28. unlit = "candles:candle_floor_gold",
  29. lit = "candles:candle_floor_gold_lit",
  30. name = "Gold Candle Stick",
  31. ingot = "default:gold_ingot",
  32. image = "candles_candle_gold"
  33. },
  34. {
  35. unlit = "candles:candle_floor_bronze",
  36. lit = "candles:candle_floor_bronze_lit",
  37. name = "Bronze Candle Stick",
  38. ingot = "default:bronze_ingot",
  39. image = "candles_candle_bronze"
  40. },
  41. {
  42. unlit = "candles:candle_wall_silver",
  43. lit = "candles:candle_wall_silver_lit",
  44. name = "Silver Wall-Mount Candle",
  45. ingot = "moreores:silver_ingot",
  46. image = "candles_candle_silver"
  47. },
  48. {
  49. unlit = "candles:candle_wall_gold",
  50. lit = "candles:candle_wall_gold_lit",
  51. name = "Gold Wall-Mount Candle",
  52. ingot = "default:gold_ingot",
  53. image = "candles_candle_gold"
  54. },
  55. {
  56. unlit = "candles:candle_wall_bronze",
  57. lit = "candles:candle_wall_bronze_lit",
  58. name = "Bronze Wall-Mount Candle",
  59. ingot = "default:bronze_ingot",
  60. image = "candles_candle_bronze"
  61. },
  62. {
  63. unlit = "candles:candelabra_silver",
  64. lit = "candles:candelabra_silver_lit",
  65. name = "Silver Candelebra",
  66. ingot = "moreores:silver_ingot",
  67. image = "candles_candelabra_silver"
  68. },
  69. {
  70. unlit = "candles:candelabra_gold",
  71. lit = "candles:candelabra_gold_lit",
  72. name = "Gold Candelebra",
  73. ingot = "default:gold_ingot",
  74. image = "candles_candelabra_gold"
  75. },
  76. {
  77. unlit = "candles:candelabra_bronze",
  78. lit = "candles:candelabra_bronze_lit",
  79. name = "Bronze Candelebra",
  80. ingot = "default:bronze_ingot",
  81. image = "candles_candelabra_bronze"
  82. },
  83. }
  84. candles.find_lit = function(name)
  85. for i,n in pairs(candles.types) do
  86. if n.unlit == name then
  87. return n.lit
  88. end
  89. end
  90. return nil
  91. end
  92. candles.find_unlit = function(name)
  93. for i,n in pairs(candles.types) do
  94. if n.lit == name then
  95. return n.unlit
  96. end
  97. end
  98. return nil
  99. end
  100. candles.light1 = function(pos, node, puncher)
  101. if not puncher or not node then
  102. return
  103. end
  104. local wield = puncher:get_wielded_item()
  105. if not wield then
  106. return
  107. end
  108. wield = wield:get_name()
  109. if wield and wield == "default:torch" then
  110. local litname = candles.find_lit(node.name)
  111. minetest.env:add_node(pos,{name=litname, param1=node.param1, param2=node.param2})
  112. local p1 = {x=pos.x, y=pos.y+1, z=pos.z}
  113. local n1 = minetest.get_node(p1)
  114. if n1.name == "air" then
  115. minetest.add_node(p1, {name="candles:candle_flame"})
  116. end
  117. end
  118. end
  119. candles.light2 = function(pos, node, puncher)
  120. if not puncher or not node then
  121. return
  122. end
  123. local wield = puncher:get_wielded_item()
  124. if not wield then
  125. return
  126. end
  127. wield = wield:get_name()
  128. if wield and wield == "default:torch" then
  129. local litname = candles.find_lit(node.name)
  130. minetest.env:add_node(pos,{name=litname, param1=node.param1, param2=node.param2})
  131. end
  132. end
  133. candles.light3 = function(pos, node, puncher)
  134. if not puncher or not node then
  135. return
  136. end
  137. local wield = puncher:get_wielded_item()
  138. if not wield then
  139. return
  140. end
  141. wield = wield:get_name()
  142. if wield and wield == "default:torch" then
  143. local litname = candles.find_lit(node.name)
  144. minetest.env:add_node(pos,{name=litname, param1=node.param1, param2=node.param2})
  145. local p1 = {x=pos.x, y=pos.y+1, z=pos.z}
  146. local n1 = minetest.get_node(p1)
  147. if n1.name == "air" then
  148. minetest.add_node(p1, {name="candles:candelabra_flame", param2 = 1})
  149. end
  150. end
  151. end
  152. candles.snuff1 = function(pos, node, puncher)
  153. if not puncher or not node then
  154. return
  155. end
  156. local wield = puncher:get_wielded_item()
  157. if not wield then
  158. return
  159. end
  160. wield = wield:get_name()
  161. if not wield or wield ~= "default:torch" then
  162. local unlitname = candles.find_unlit(node.name)
  163. minetest.env:add_node(pos,{name=unlitname, param1=node.param1, param2=node.param2})
  164. local p1 = {x=pos.x, y=pos.y+1, z=pos.z}
  165. local n1 = minetest.get_node(p1)
  166. if n1.name == "candles:candle_flame"then
  167. minetest.remove_node(p1, {name="candles:candle_flame"})
  168. end
  169. end
  170. end
  171. candles.snuff2 = function(pos, node, puncher)
  172. if not puncher or not node then
  173. return
  174. end
  175. local wield = puncher:get_wielded_item()
  176. if not wield then
  177. return
  178. end
  179. wield = wield:get_name()
  180. if not wield or wield ~= "default:torch" then
  181. local unlitname = candles.find_unlit(node.name)
  182. minetest.env:add_node(pos,{name=unlitname, param1=node.param1, param2=node.param2})
  183. end
  184. end
  185. candles.snuff3 = function(pos, node, puncher)
  186. if not puncher or not node then
  187. return
  188. end
  189. local wield = puncher:get_wielded_item()
  190. if not wield then
  191. return
  192. end
  193. wield = wield:get_name()
  194. if not wield or wield ~= "default:torch" then
  195. local unlitname = candles.find_unlit(node.name)
  196. minetest.env:add_node(pos,{name=unlitname, param1=node.param1, param2=node.param2})
  197. local p1 = {x=pos.x, y=pos.y+1, z=pos.z}
  198. local n1 = minetest.get_node(p1)
  199. if n1.name == "candles:candelabra_flame"then
  200. minetest.remove_node(p1, {name="candles:candelabra_flame"})
  201. end
  202. end
  203. end
  204. candles.create_wall = function(ctype)
  205. minetest.register_node(ctype.unlit, {
  206. description = ctype.name,
  207. tiles = {ctype.image.."_top.png",ctype.image.."_bottom.png",ctype.image..".png"},
  208. drawtype = "nodebox",
  209. paramtype = "light",
  210. paramtype2 = "facedir",
  211. groups = {crumbly=3,oddly_breakable_by_hand=1},
  212. on_punch = candles.light1,
  213. sunlight_propagates = true,
  214. walkable = false,
  215. sounds = default.node_sound_metal_defaults({
  216. dug = {name = "default_dig_crumbly", gain = 1.0},
  217. dig = {name = "default_dig_crumbly", gain = 0.1},
  218. }
  219. ),
  220. on_rotate = screwdriver.rotate_simple,
  221. node_box = {
  222. type = "fixed",
  223. fixed = {
  224. {-0.125, 0.0625, -0.125, 0.125, 0.125, 0.125},
  225. {-0.0625, -0.1875, -0.0625, 0.0625, 0.0625, 0.0625},
  226. {-0.125, -0.25, -0.125, 0.125, -0.125, 0.125},
  227. {-0.0625, -0.3125, -0.0625, 0.375, -0.25, 0.0625},
  228. {0.4375, -0.4375, -0.1875, 0.5, -0.125, 0.1875},
  229. {0.3125, -0.375, -0.125, 0.5, -0.1875, 0.125},
  230. {-0.0625, 0.125, -0.0625, 0.0625, 0.5, 0.0625},
  231. },
  232. },
  233. selection_box = {
  234. type = "fixed",
  235. fixed = {-0.1875, -0.5, -0.25, 0.5, 0.5, 0.25},
  236. },
  237. on_place = function(itemstack, placer, pointed_thing)
  238. local above = pointed_thing.above
  239. local under = pointed_thing.under
  240. local dir = {x = under.x - above.x,
  241. y = under.y - above.y,
  242. z = under.z - above.z}
  243. local wdir = minetest.dir_to_wallmounted(dir)
  244. local fdir = minetest.dir_to_facedir(dir)
  245. if wdir == 0 or wdir == 1 then
  246. return itemstack
  247. else
  248. fdir = fdir-1
  249. if fdir < 0 then
  250. fdir = 3
  251. end
  252. minetest.env:add_node(above, {name = itemstack:get_name(), param2 = fdir})
  253. itemstack:take_item()
  254. return itemstack
  255. end
  256. end
  257. })
  258. minetest.register_node(ctype.lit, {
  259. description = ctype.name,
  260. tiles = {ctype.image.."_top.png",ctype.image.."_bottom.png",ctype.image.."_lit.png"},
  261. drawtype = "nodebox",
  262. paramtype = "light",
  263. paramtype2 = "facedir",
  264. groups = {crumbly=3,oddly_breakable_by_hand=1, not_in_creative_inventory = 1},
  265. on_punch = candles.snuff1,
  266. sunlight_propagates = true,
  267. walkable = false,
  268. sounds = default.node_sound_metal_defaults({
  269. dug = {name = "default_dig_crumbly", gain = 1.0},
  270. dig = {name = "default_dig_crumbly", gain = 0.1},
  271. }
  272. ),
  273. on_rotate = screwdriver.rotate_simple,
  274. drop = ctype.unlit,
  275. node_box = {
  276. type = "fixed",
  277. fixed = {
  278. {-0.125, 0.0625, -0.125, 0.125, 0.125, 0.125},
  279. {-0.0625, -0.1875, -0.0625, 0.0625, 0.0625, 0.0625},
  280. {-0.125, -0.25, -0.125, 0.125, -0.125, 0.125},
  281. {-0.0625, -0.3125, -0.0625, 0.375, -0.25, 0.0625},
  282. {0.4375, -0.4375, -0.1875, 0.5, -0.125, 0.1875},
  283. {0.3125, -0.375, -0.125, 0.5, -0.1875, 0.125},
  284. {-0.0625, 0.125, -0.0625, 0.0625, 0.5, 0.0625},
  285. },
  286. },
  287. selection_box = {
  288. type = "fixed",
  289. fixed = {-0.1875, -0.5, -0.25, 0.5, 0.5, 0.25},
  290. },
  291. can_dig = function(pos,player)
  292. return false
  293. end,
  294. })
  295. minetest.register_craft({
  296. output = ctype.unlit,
  297. recipe = {
  298. {"","candles:candle",""},
  299. {"",ctype.ingot,ctype.ingot},
  300. }
  301. })
  302. end
  303. candles.create_floor= function(ctype)
  304. minetest.register_node(ctype.unlit, {
  305. description = ctype.name,
  306. tiles = {ctype.image.."_top.png",ctype.image.."_bottom.png",ctype.image..".png"},
  307. drawtype = "nodebox",
  308. paramtype = "light",
  309. paramtype2 = "facedir",
  310. groups = {crumbly=3,oddly_breakable_by_hand=1},
  311. on_punch = candles.light1,
  312. sunlight_propagates = true,
  313. walkable = false,
  314. sounds = default.node_sound_metal_defaults({
  315. dug = {name = "default_dig_crumbly", gain = 1.0},
  316. dig = {name = "default_dig_crumbly", gain = 0.1},
  317. }
  318. ),
  319. on_rotate = screwdriver.rotate_simple,
  320. node_box = {
  321. type = "fixed",
  322. fixed = {
  323. {-0.0625, -0.375, -0.0625, 0.0625, 0.5, 0.0625},
  324. {-0.125, 0.0625, -0.125, 0.125, 0.125, 0.125},
  325. {-0.1875, -0.5, -0.1875, 0.1875, -0.4375, 0.1875},
  326. {-0.125, -0.4375, -0.125, 0.125, -0.375, 0.125},
  327. },
  328. },
  329. selection_box = {
  330. type = "fixed",
  331. fixed = {
  332. {-0.1875, -0.5, -0.1875, 0.1875, 0.5, 0.1875},
  333. },
  334. },
  335. on_place = function(itemstack, placer, pointed_thing)
  336. local above = pointed_thing.above
  337. local under = pointed_thing.under
  338. local dir = {x = under.x - above.x,
  339. y = under.y - above.y,
  340. z = under.z - above.z}
  341. local wdir = minetest.dir_to_wallmounted(dir)
  342. local fdir = minetest.dir_to_facedir(dir)
  343. if wdir == 1 then
  344. minetest.env:add_node(above, {name = itemstack:get_name(), param2 = fdir})
  345. itemstack:take_item()
  346. end
  347. return itemstack
  348. end
  349. })
  350. minetest.register_node(ctype.lit, {
  351. description = ctype.name,
  352. tiles = {ctype.image.."_top.png",ctype.image.."_bottom.png",ctype.image.."_lit.png"},
  353. drawtype = "nodebox",
  354. paramtype = "light",
  355. paramtype2 = "facedir",
  356. groups = {crumbly=3,oddly_breakable_by_hand=1, not_in_creative_inventory = 1},
  357. on_punch = candles.snuff1,
  358. sunlight_propagates = true,
  359. walkable = false,
  360. sounds = default.node_sound_metal_defaults({
  361. dug = {name = "default_dig_crumbly", gain = 1.0},
  362. dig = {name = "default_dig_crumbly", gain = 0.1},
  363. }
  364. ),
  365. on_rotate = screwdriver.rotate_simple,
  366. drop = ctype.unlit,
  367. node_box = {
  368. type = "fixed",
  369. fixed = {
  370. {-0.0625, -0.375, -0.0625, 0.0625, 0.5, 0.0625},
  371. {-0.125, 0.0625, -0.125, 0.125, 0.125, 0.125},
  372. {-0.1875, -0.5, -0.1875, 0.1875, -0.4375, 0.1875},
  373. {-0.125, -0.4375, -0.125, 0.125, -0.375, 0.125},
  374. },
  375. },
  376. selection_box = {
  377. type = "fixed",
  378. fixed = {
  379. {-0.1875, -0.5, -0.1875, 0.1875, 0.5, 0.1875},
  380. },
  381. },
  382. can_dig = function(pos,player)
  383. return false
  384. end,
  385. })
  386. minetest.register_craft({
  387. output = ctype.unlit,
  388. recipe = {
  389. {"candles:candle"},
  390. {ctype.ingot},
  391. }
  392. })
  393. end
  394. candles.create_candelabra = function(ctype)
  395. minetest.register_node(ctype.unlit, {
  396. description = ctype.name,
  397. tiles = {ctype.image.."_top.png",ctype.image.."_bottom.png",ctype.image..".png"},
  398. drawtype = "nodebox",
  399. paramtype = "light",
  400. paramtype2 = "facedir",
  401. groups = {crumbly=3,oddly_breakable_by_hand=1},
  402. on_punch = candles.light3,
  403. sunlight_propagates = true,
  404. walkable = false,
  405. sounds = default.node_sound_metal_defaults({
  406. dug = {name = "default_dig_crumbly", gain = 1.0},
  407. dig = {name = "default_dig_crumbly", gain = 0.1},
  408. }
  409. ),
  410. on_rotate = screwdriver.rotate_simple,
  411. node_box = {
  412. type = "fixed",
  413. fixed = {
  414. {-0.0625, -0.375, -0.0625, 0.0625, 0.5, 0.0625},
  415. {-0.0625, 0.0625, -0.4375, 0.0625, 0.125, 0.4375},
  416. {-0.1875, -0.5, -0.1875, 0.1875, -0.4375, 0.1875},
  417. {-0.125, -0.4375, -0.125, 0.125, -0.375, 0.125},
  418. {-0.125, 0.125, 0.25, 0.125, 0.1875, 0.5},
  419. {-0.125, 0.125, -0.5, 0.125, 0.1875, -0.25},
  420. {-0.125, 0.125, -0.125, 0.125, 0.1875, 0.125},
  421. {-0.0625, 0.1875, 0.3125, 0.0625, 0.5, 0.4375},
  422. {-0.0625, 0.125, -0.4375, 0.0625, 0.5, -0.3125},
  423. {-0.4375, 0.0625, -0.0625, 0.4375, 0.125, 0.0625},
  424. {0.25, 0.125, -0.125, 0.5, 0.1875, 0.125},
  425. {0.3125, 0.1875, -0.0625, 0.4375, 0.5, 0.0625},
  426. {-0.5, 0.125, -0.125, -0.25, 0.1875, 0.125},
  427. {-0.4375, 0.1875, -0.0625, -0.3125, 0.5, 0.0625},
  428. },
  429. },
  430. selection_box = {
  431. type = "fixed",
  432. fixed = {-0.45, -0.45, -0.45, 0.45, 0.45, 0.45},
  433. },
  434. on_place = function(itemstack, placer, pointed_thing)
  435. local above = pointed_thing.above
  436. local under = pointed_thing.under
  437. local dir = {x = under.x - above.x,
  438. y = under.y - above.y,
  439. z = under.z - above.z}
  440. local wdir = minetest.dir_to_wallmounted(dir)
  441. local fdir = minetest.dir_to_facedir(dir)
  442. if wdir == 1 then
  443. minetest.env:add_node(above, {name = itemstack:get_name(), param2 = fdir})
  444. itemstack:take_item()
  445. end
  446. return itemstack
  447. end
  448. })
  449. minetest.register_node(ctype.lit, {
  450. description = ctype.name,
  451. tiles = {ctype.image.."_top.png",ctype.image.."_bottom.png",ctype.image.."_lit.png"},
  452. drawtype = "nodebox",
  453. paramtype = "light",
  454. paramtype2 = "facedir",
  455. groups = {crumbly=3,oddly_breakable_by_hand=1, not_in_creative_inventory = 1},
  456. on_punch = candles.snuff3,
  457. sunlight_propagates = true,
  458. walkable = false,
  459. sounds = default.node_sound_metal_defaults({
  460. dug = {name = "default_dig_crumbly", gain = 1.0},
  461. dig = {name = "default_dig_crumbly", gain = 0.1},
  462. }
  463. ),
  464. on_rotate = screwdriver.rotate_simple,
  465. drop = ctype.unlit,
  466. node_box = {
  467. type = "fixed",
  468. fixed = {
  469. {-0.0625, -0.375, -0.0625, 0.0625, 0.5, 0.0625},
  470. {-0.0625, 0.0625, -0.4375, 0.0625, 0.125, 0.4375},
  471. {-0.1875, -0.5, -0.1875, 0.1875, -0.4375, 0.1875},
  472. {-0.125, -0.4375, -0.125, 0.125, -0.375, 0.125},
  473. {-0.125, 0.125, 0.25, 0.125, 0.1875, 0.5},
  474. {-0.125, 0.125, -0.5, 0.125, 0.1875, -0.25},
  475. {-0.125, 0.125, -0.125, 0.125, 0.1875, 0.125},
  476. {-0.0625, 0.1875, 0.3125, 0.0625, 0.5, 0.4375},
  477. {-0.0625, 0.125, -0.4375, 0.0625, 0.5, -0.3125},
  478. {-0.4375, 0.0625, -0.0625, 0.4375, 0.125, 0.0625},
  479. {0.25, 0.125, -0.125, 0.5, 0.1875, 0.125},
  480. {0.3125, 0.1875, -0.0625, 0.4375, 0.5, 0.0625},
  481. {-0.5, 0.125, -0.125, -0.25, 0.1875, 0.125},
  482. {-0.4375, 0.1875, -0.0625, -0.3125, 0.5, 0.0625},
  483. },
  484. },
  485. selection_box = {
  486. type = "fixed",
  487. fixed = {-0.45, -0.45, -0.45, 0.45, 0.45, 0.45},
  488. },
  489. can_dig = function(pos,player)
  490. return false
  491. end,
  492. })
  493. minetest.register_craft({
  494. output = ctype.unlit,
  495. recipe = {
  496. {"candles:candle","candles:candle","candles:candle"},
  497. {ctype.ingot,ctype.ingot,ctype.ingot},
  498. }
  499. })
  500. end
  501. minetest.register_node("candles:candle", {
  502. description = "Candle",
  503. drawtype = "plantlike",
  504. tiles = {"candles_candle.png"},
  505. paramtype = "light",
  506. groups = {crumbly=3,oddly_breakable_by_hand=1},
  507. on_punch = candles.light2,
  508. sunlight_propagates = true,
  509. walkable = false,
  510. selection_box = {
  511. type = "fixed",
  512. fixed = {-0.1875, -0.5, -0.1875, 0.1875, 0.125, 0.1875},
  513. },
  514. on_place = function(itemstack, placer, pointed_thing)
  515. local above = pointed_thing.above
  516. local under = pointed_thing.under
  517. local dir = {x = under.x - above.x,
  518. y = under.y - above.y,
  519. z = under.z - above.z}
  520. local wdir = minetest.dir_to_wallmounted(dir)
  521. if wdir == 1 then
  522. minetest.env:add_node(above, {name = "candles:candle"})
  523. itemstack:take_item()
  524. end
  525. return itemstack
  526. end
  527. })
  528. minetest.register_node("candles:candle_lit", {
  529. description = "Candle",
  530. drawtype = "plantlike",
  531. tiles = {
  532. {name="candles_candle_lit.png", animation={type="vertical_frames", aspect_w=32, aspect_h=32, length=1}},
  533. },
  534. paramtype = "light",
  535. groups = {crumbly=3,oddly_breakable_by_hand=1, not_in_creative_inventory = 1},
  536. on_punch = candles.snuff2,
  537. sunlight_propagates = true,
  538. walkable = false,
  539. light_source = 11,
  540. drop = "candles:candle",
  541. selection_box = {
  542. type = "fixed",
  543. fixed = {-0.1875, -0.5, -0.1875, 0.1875, 0.125, 0.1875},
  544. },
  545. can_dig = function(pos,player)
  546. return false
  547. end,
  548. })
  549. minetest.register_node("candles:candle_flame", {
  550. drawtype = "plantlike",
  551. tiles = {
  552. {
  553. name = "candles_candle_flame.png",
  554. animation = {
  555. type = "vertical_frames",
  556. aspect_w = 16,
  557. aspect_h = 16,
  558. length = 1
  559. },
  560. },
  561. },
  562. paramtype = "light",
  563. light_source = 12,
  564. walkable = false,
  565. buildable_to = false,
  566. pointable = false,
  567. sunlight_propagates = true,
  568. damage_per_second = 1,
  569. groups = {torch = 1, dig_immediate = 3, not_in_creative_inventory = 1},
  570. drop = "",
  571. can_dig = function(pos,player)
  572. return false
  573. end,
  574. })
  575. minetest.register_node("candles:candelabra_flame", {
  576. drawtype = "plantlike",
  577. tiles = {
  578. {
  579. name = "candles_candelabra_flame.png",
  580. animation = {
  581. type = "vertical_frames",
  582. aspect_w = 16,
  583. aspect_h = 16,
  584. length = 1
  585. },
  586. },
  587. },
  588. paramtype = "light",
  589. paramtype2 = "meshoptions",
  590. place_param2 = 1,
  591. light_source = 14,
  592. walkable = false,
  593. buildable_to = false,
  594. pointable = false,
  595. sunlight_propagates = true,
  596. damage_per_second = 1,
  597. groups = {torch = 1, dig_immediate = 3, not_in_creative_inventory = 1},
  598. drop = "",
  599. can_dig = function(pos,player)
  600. return false
  601. end,
  602. })
  603. for i,n in pairs(candles.types) do
  604. if n.ingot then
  605. if string.find(n.unlit,"candle_wall") then
  606. candles.create_wall(n)
  607. end
  608. if string.find(n.unlit,"candelabra") then
  609. candles.create_candelabra(n)
  610. end
  611. if string.find(n.unlit,"candle_floor") then
  612. candles.create_floor(n)
  613. end
  614. end
  615. end
  616. -----------------
  617. -- Chandelier
  618. -----------------
  619. minetest.register_node("candles:gold_chandelier", {
  620. description = "Gold Chandelier",
  621. drawtype = "plantlike",
  622. paramtype = "light",
  623. sunlight_propagates = true,
  624. tiles = {{
  625. name = "candles_gold_chandelier_animated.png",
  626. animation = {
  627. type = "vertical_frames",
  628. aspect_w = 16,
  629. aspect_h = 16,
  630. length = 2.5
  631. }
  632. }},
  633. wield_image = "candles_gold_chandelier.png",
  634. inventory_image = "candles_gold_chandelier.png",
  635. selection_box = {
  636. type = "fixed",
  637. fixed = {-0.375, -0.5, -0.375, 0.375, 0.5, 0.375}
  638. },
  639. walkable = false,
  640. groups = {dig_immediate = 2},
  641. light_source = 10,
  642. groups = {cracky = 2, oddly_breakable_by_hand = 3},
  643. sounds = default.node_sound_glass_defaults(),
  644. })
  645. minetest.register_node("candles:gold_chandelier_unlit", {
  646. description = "Unlit Gold Chandelier",
  647. drawtype = "plantlike",
  648. paramtype = "light",
  649. sunlight_propagates = true,
  650. tiles = {"candles_gold_chandelier_unlit.png"},
  651. selection_box = {
  652. type = "fixed",
  653. fixed = {-0.375, -0.5, -0.375, 0.375, 0.5, 0.375}
  654. },
  655. walkable = false,
  656. groups = {dig_immediate = 2}
  657. })
  658. minetest.register_craft({
  659. output = "candles:gold_chandelier",
  660. recipe = {
  661. {"", "default:gold_ingot", ""},
  662. {"default:torch", "default:gold_ingot", "default:torch"}
  663. }
  664. })
  665. minetest.register_craft({
  666. output = "candles:gold_chandelier_unlit",
  667. recipe = {
  668. {"candles:candle", "default:gold_ingot", "candles:candle"},
  669. {"", "default:gold_ingot", ""},
  670. {"candles:candle", "", "candles:candle"}
  671. }
  672. })
  673. ------------------
  674. -- Craft Recipes
  675. ------------------
  676. minetest.register_craft({
  677. output = "candles:wax 2", --Palm Wax??? :)
  678. recipe = {
  679. {"default:jungleleaves", "default:jungleleaves", "default:jungleleaves"},
  680. {"default:jungleleaves", "default:jungleleaves", "default:jungleleaves"},
  681. {"default:jungleleaves", "default:jungleleaves", "default:jungleleaves"},
  682. }
  683. })
  684. minetest.register_craft({
  685. output = "candles:candle",
  686. recipe = {
  687. {"bees:wax", "farming:cotton", "bees:wax"},
  688. }
  689. })