init.lua 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882
  1. -- This file supplies the majority of homedecor's lighting
  2. local S = minetest.get_translator("homedecor_lighting")
  3. homedecor_lighting = {}
  4. local function is_protected(pos, clicker)
  5. if minetest.is_protected(pos, clicker:get_player_name()) then
  6. minetest.record_protection_violation(pos,
  7. clicker:get_player_name())
  8. return true
  9. end
  10. return false
  11. end
  12. local hd_mesecons = minetest.get_modpath("mesecons")
  13. -- control and brightness for dimmable lamps
  14. local word_to_bright = {
  15. ["off"] = 0,
  16. ["low"] = 3,
  17. ["med"] = 7,
  18. ["hi"] = 11,
  19. ["on"] = 14,
  20. ["max"] = 14,
  21. }
  22. local rules_alldir = {
  23. {x = 0, y = 0, z = 1},
  24. {x = -1, y = 0, z = 0},
  25. {x = 1, y = 0, z = 0},
  26. {x = 0, y = 0, z = -1}, -- borrowed from lightstones
  27. {x = 0, y = 1, z = 1},
  28. {x = -1, y = 1, z = 0},
  29. {x = 0, y = 1, z = 0},
  30. {x = 1, y = 1, z = 0},
  31. {x = 0, y = 1, z = -1},
  32. {x = 0, y = -1, z = 1},
  33. {x = -1, y = -1, z = 0},
  34. {x = 0, y = -1, z = 0},
  35. {x = 1, y = -1, z = 0},
  36. {x = 0, y = -1, z = -1},
  37. }
  38. -- mesecons compatibility
  39. local actions
  40. if hd_mesecons then
  41. actions = {
  42. action_off = function(pos, node)
  43. local sep = string.find(node.name, "_", -5)
  44. if minetest.get_meta(pos):get_int("toggled") > 0 then
  45. minetest.swap_node(pos, {
  46. name = string.sub(node.name, 1, sep - 1).."_off",
  47. param2 = node.param2
  48. })
  49. end
  50. end,
  51. action_on = function(pos, node)
  52. minetest.get_meta(pos):set_int("toggled", 1)
  53. local sep = string.find(node.name, "_", -5)
  54. minetest.swap_node(pos, {
  55. name = string.sub(node.name, 1, sep - 1).."_on",
  56. param2 = node.param2
  57. })
  58. end
  59. }
  60. homedecor_lighting.mesecon_wall_light = {
  61. effector = table.copy(actions)
  62. }
  63. homedecor_lighting.mesecon_wall_light.effector.rules = mesecon.rules.wallmounted_get
  64. homedecor_lighting.mesecon_alldir_light = {
  65. effector = table.copy(actions),
  66. }
  67. homedecor_lighting.mesecon_alldir_light.effector.rules = rules_alldir
  68. end
  69. -- digilines compatibility
  70. -- this one is based on the so-named one in Jeija's digilines mod
  71. local player_last_clicked = {}
  72. local digiline_on_punch
  73. if minetest.get_modpath("digilines") then
  74. local on_digiline_receive_string = function(pos, node, channel, msg)
  75. if not msg or not channel then return end
  76. local meta = minetest.get_meta(pos)
  77. local setchan = meta:get_string("channel")
  78. if setchan ~= channel then return end
  79. if msg ~= "" and (type(msg) == "string" or type(msg) == "number" ) then
  80. local n = tonumber(msg)
  81. local suff = word_to_bright[msg] or "invalid"
  82. local basename = string.sub(node.name, 1, string.find(node.name, "_", -5) - 1)
  83. if minetest.registered_nodes[basename.."_"..msg] then
  84. minetest.swap_node(pos, {name = basename.."_"..msg, param2 = node.param2})
  85. elseif minetest.registered_nodes[basename.."_"..suff] then
  86. minetest.swap_node(pos, {name = basename.."_"..suff, param2 = node.param2})
  87. elseif minetest.registered_nodes[basename.."_on"]
  88. and (msg == "med" or msg == "hi" or msg == "max" or (n and n > 3)) then
  89. minetest.swap_node(pos, {name = basename.."_on", param2 = node.param2})
  90. elseif minetest.registered_nodes[basename.."_off"]
  91. and (msg == "low" or (n and n < 4)) then
  92. minetest.swap_node(pos, {name = basename.."_off", param2 = node.param2})
  93. end
  94. end
  95. end
  96. minetest.register_on_player_receive_fields(function(player, formname, fields)
  97. local name = player:get_player_name()
  98. local pos = player_last_clicked[name]
  99. if pos and formname == "homedecor:lamp_set_channel" then
  100. if is_protected(pos, player) then return end
  101. if (fields.channel) then
  102. local meta = minetest.get_meta(pos)
  103. meta:set_string("channel", fields.channel)
  104. end
  105. end
  106. end)
  107. if hd_mesecons then
  108. homedecor_lighting.digiline_wall_light = {
  109. effector = {
  110. action = on_digiline_receive_string,
  111. },
  112. wire = {
  113. rules = mesecon.rules.wallmounted_get
  114. }
  115. }
  116. else
  117. homedecor_lighting.digiline_wall_light = {
  118. effector = {
  119. action = on_digiline_receive_string,
  120. },
  121. wire = {
  122. rules = rules_alldir
  123. }
  124. }
  125. end
  126. homedecor_lighting.digiline_alldir_light = {
  127. effector = {
  128. action = on_digiline_receive_string,
  129. },
  130. wire = {
  131. rules = rules_alldir
  132. }
  133. }
  134. function digiline_on_punch(pos, node, puncher, pointed_thing)
  135. if is_protected(pos, puncher) then return end
  136. if puncher:get_player_control().sneak then
  137. local name = puncher:get_player_name()
  138. player_last_clicked[name] = pos
  139. local form = "field[channel;Channel;]"
  140. minetest.show_formspec(name, "homedecor:lamp_set_channel", form)
  141. end
  142. end
  143. end
  144. -- turn on/off, cycle brightness
  145. function homedecor_lighting.toggle_light(pos, node, clicker, itemstack, pointed_thing)
  146. if is_protected(pos, clicker) then return end
  147. local sep = string.find(node.name, "_", -5)
  148. local level = string.sub(node.name, sep + 1)
  149. local n = tonumber(level) or 0
  150. local newsuff
  151. if level == "on" then
  152. newsuff = "_off"
  153. elseif level == "off" then
  154. newsuff = "_on"
  155. elseif n > 3 then
  156. newsuff = "_0"
  157. else
  158. newsuff = "_14"
  159. end
  160. minetest.swap_node(pos, {name = string.sub(node.name, 1, sep - 1)..newsuff, param2 = node.param2})
  161. end
  162. ------------------
  163. -- Dimmable lights
  164. --for light_brightn_name in pairs(word_to_bright) do
  165. for brightness_level = 0, 14 do
  166. local tiles
  167. local overlay
  168. local onflag = (brightness_level > 0)
  169. local nici = (brightness_level ~= 14) and 1 or nil
  170. local gen_ls_tex_white = "homedecor_generic_light_source_off.png"
  171. if onflag then gen_ls_tex_white = "homedecor_generic_light_source_white.png" end
  172. local gen_ls_tex_yellow = "homedecor_generic_light_source_off.png"
  173. if onflag then gen_ls_tex_yellow = "homedecor_generic_light_source_yellow.png" end
  174. local h = (brightness_level == 0) and "0" or string.format("%x", brightness_level+1)
  175. local brightness_hex = tonumber("0xff"..string.rep(h, 6))
  176. local glowlight_nodebox = {
  177. half = homedecor.nodebox.slab_y(1/2),
  178. quarter = homedecor.nodebox.slab_y(1/4),
  179. small_cube = {
  180. type = "fixed",
  181. fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
  182. },
  183. }
  184. local base = "homedecor_glowlight_base.png"
  185. local tb_edges = "homedecor_glowlight_tb_edges.png"
  186. local sides_edges = "homedecor_glowlight_thick_sides_edges.png"
  187. local sides_glare = "homedecor_glowlight_thick_sides_glare.png"
  188. if onflag then
  189. tiles = {
  190. "("..base.."^"..tb_edges..")^[brighten",
  191. "("..base.."^"..tb_edges..")^[brighten",
  192. "("..base.."^"..sides_edges..")^[brighten",
  193. "("..base.."^"..sides_edges..")^[brighten",
  194. "("..base.."^"..sides_edges..")^[brighten",
  195. "("..base.."^"..sides_edges..")^[brighten",
  196. }
  197. overlay = {
  198. { name = "homedecor_glowlight_top_glare.png", color = "white"},
  199. "",
  200. { name = sides_glare, color = "white"},
  201. { name = sides_glare, color = "white"},
  202. { name = sides_glare, color = "white"},
  203. { name = sides_glare, color = "white"},
  204. }
  205. else
  206. tiles = {
  207. base.."^"..tb_edges,
  208. base.."^"..tb_edges,
  209. base.."^"..sides_edges,
  210. base.."^"..sides_edges,
  211. base.."^"..sides_edges,
  212. base.."^"..sides_edges,
  213. }
  214. overlay = nil
  215. end
  216. minetest.register_node(":homedecor:glowlight_half_"..brightness_level, {
  217. description = S("Thick Glowlight"),
  218. tiles = tiles,
  219. overlay_tiles = overlay,
  220. use_texture_alpha = true,
  221. drawtype = "nodebox",
  222. paramtype = "light",
  223. paramtype2 = "colorwallmounted",
  224. palette = "unifieddyes_palette_colorwallmounted.png",
  225. selection_box = {
  226. type = "wallmounted",
  227. wall_top = { -0.5, 0, -0.5, 0.5, 0.5, 0.5 },
  228. wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 },
  229. wall_side = { -0.5, -0.5, -0.5, 0, 0.5, 0.5 }
  230. },
  231. node_box = glowlight_nodebox.half,
  232. groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = nici },
  233. light_source = brightness_level,
  234. sounds = default.node_sound_glass_defaults(),
  235. after_place_node = function(pos, placer, itemstack, pointed_thing)
  236. unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
  237. end,
  238. on_dig = unifieddyes.on_dig,
  239. on_rightclick = homedecor_lighting.toggle_light,
  240. drop = {
  241. items = {
  242. {items = {"homedecor:glowlight_half_on"}, inherit_color = true },
  243. }
  244. },
  245. mesecons = homedecor_lighting.mesecon_wall_light,
  246. digiline = homedecor_lighting.digiline_wall_light,
  247. on_punch = digiline_on_punch
  248. })
  249. sides_edges = "homedecor_glowlight_thin_sides_edges.png"
  250. sides_glare = "homedecor_glowlight_thin_sides_glare.png"
  251. if onflag then
  252. tiles = {
  253. "("..base.."^"..tb_edges..")^[brighten",
  254. "("..base.."^"..tb_edges..")^[brighten",
  255. "("..base.."^"..sides_edges..")^[brighten",
  256. "("..base.."^"..sides_edges..")^[brighten",
  257. "("..base.."^"..sides_edges..")^[brighten",
  258. "("..base.."^"..sides_edges..")^[brighten",
  259. }
  260. overlay = {
  261. { name = "homedecor_glowlight_top_glare.png", color = "white"},
  262. "",
  263. { name = sides_glare, color = "white"},
  264. { name = sides_glare, color = "white"},
  265. { name = sides_glare, color = "white"},
  266. { name = sides_glare, color = "white"},
  267. }
  268. else
  269. tiles = {
  270. base.."^"..tb_edges,
  271. base.."^"..tb_edges,
  272. base.."^"..sides_edges,
  273. base.."^"..sides_edges,
  274. base.."^"..sides_edges,
  275. base.."^"..sides_edges,
  276. }
  277. overlay = nil
  278. end
  279. minetest.register_node(":homedecor:glowlight_quarter_"..brightness_level, {
  280. description = S("Thin Glowlight"),
  281. tiles = tiles,
  282. overlay_tiles = overlay,
  283. use_texture_alpha = true,
  284. drawtype = "nodebox",
  285. paramtype = "light",
  286. paramtype2 = "colorwallmounted",
  287. palette = "unifieddyes_palette_colorwallmounted.png",
  288. selection_box = {
  289. type = "wallmounted",
  290. wall_top = { -0.5, 0.25, -0.5, 0.5, 0.5, 0.5 },
  291. wall_bottom = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 },
  292. wall_side = { -0.5, -0.5, -0.5, -0.25, 0.5, 0.5 }
  293. },
  294. node_box = glowlight_nodebox.quarter,
  295. groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = nici },
  296. light_source = brightness_level,
  297. sounds = default.node_sound_glass_defaults(),
  298. after_place_node = function(pos, placer, itemstack, pointed_thing)
  299. unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
  300. end,
  301. on_dig = unifieddyes.on_dig,
  302. on_rightclick = homedecor_lighting.toggle_light,
  303. drop = {
  304. items = {
  305. {items = {"homedecor:glowlight_quarter_on"}, inherit_color = true },
  306. }
  307. },
  308. mesecons = homedecor_lighting.mesecon_wall_light,
  309. digiline = homedecor_lighting.digiline_wall_light,
  310. on_punch = digiline_on_punch
  311. })
  312. tb_edges = "homedecor_glowlight_cube_tb_edges.png"
  313. sides_edges = "homedecor_glowlight_cube_sides_edges.png"
  314. sides_glare = "homedecor_glowlight_cube_sides_glare.png"
  315. if onflag then
  316. tiles = {
  317. "("..base.."^"..tb_edges..")^[brighten",
  318. "("..base.."^"..tb_edges..")^[brighten",
  319. "("..base.."^"..sides_edges..")^[brighten",
  320. "("..base.."^"..sides_edges..")^[brighten",
  321. "("..base.."^"..sides_edges..")^[brighten",
  322. "("..base.."^"..sides_edges..")^[brighten",
  323. }
  324. overlay = {
  325. { name = "homedecor_glowlight_cube_top_glare.png", color = "white"},
  326. "",
  327. { name = sides_glare, color = "white"},
  328. { name = sides_glare, color = "white"},
  329. { name = sides_glare, color = "white"},
  330. { name = sides_glare, color = "white"},
  331. }
  332. else
  333. tiles = {
  334. base.."^"..tb_edges,
  335. base.."^"..tb_edges,
  336. base.."^"..sides_edges,
  337. base.."^"..sides_edges,
  338. base.."^"..sides_edges,
  339. base.."^"..sides_edges,
  340. }
  341. overlay = nil
  342. end
  343. minetest.register_node(":homedecor:glowlight_small_cube_"..brightness_level, {
  344. description = S("Small Glowlight Cube"),
  345. tiles = tiles,
  346. overlay_tiles = overlay,
  347. use_texture_alpha = true,
  348. paramtype = "light",
  349. paramtype2 = "colorwallmounted",
  350. drawtype = "nodebox",
  351. palette = "unifieddyes_palette_colorwallmounted.png",
  352. selection_box = {
  353. type = "wallmounted",
  354. wall_top = { -0.25, 0, -0.25, 0.25, 0.5, 0.25 },
  355. wall_bottom = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 },
  356. wall_side = { -0.5, -0.25, -0.25, 0, 0.25, 0.25 }
  357. },
  358. node_box = glowlight_nodebox.small_cube,
  359. groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = nici },
  360. light_source = brightness_level,
  361. sounds = default.node_sound_glass_defaults(),
  362. after_place_node = function(pos, placer, itemstack, pointed_thing)
  363. unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
  364. end,
  365. on_dig = unifieddyes.on_dig,
  366. on_rightclick = homedecor_lighting.toggle_light,
  367. drop = {
  368. items = {
  369. {items = {"homedecor:glowlight_small_cube_on"}, inherit_color = true },
  370. }
  371. },
  372. mesecons = homedecor_lighting.mesecon_wall_light,
  373. digiline = homedecor_lighting.digiline_wall_light,
  374. on_punch = digiline_on_punch
  375. })
  376. local lighttex
  377. if onflag then
  378. local b = (brightness_level > 6) and brightness_level or 6
  379. local brightened = "^[multiply:#"..string.rep(string.format("%x", b), 6)
  380. lighttex = {
  381. name="homedecor_plasma_storm.png"..brightened,
  382. animation={type="vertical_frames", aspect_w=48, aspect_h=48, length=2.0},
  383. }
  384. else
  385. lighttex = "homedecor_plasma_lamp_off.png"
  386. end
  387. homedecor.register("plasma_lamp_"..brightness_level, {
  388. description = S("Plasma Lamp/Light"),
  389. drawtype = "mesh",
  390. mesh = "plasma_lamp.obj",
  391. tiles = {
  392. "default_gold_block.png",
  393. lighttex
  394. },
  395. use_texture_alpha = true,
  396. light_source = brightness_level,
  397. sunlight_propagates = true,
  398. groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory = nici},
  399. sounds = default.node_sound_glass_defaults(),
  400. on_rightclick = homedecor_lighting.toggle_light,
  401. drop = {
  402. items = {
  403. {items = {"homedecor:plasma_lamp_on"}},
  404. }
  405. },
  406. mesecons = homedecor_lighting.mesecon_alldir_light,
  407. digiline = homedecor_lighting.digiline_alldir_light,
  408. on_punch = digiline_on_punch
  409. })
  410. local gl_cbox = {
  411. type = "fixed",
  412. fixed = { -0.25, -0.5, -0.25, 0.25, 0.45, 0.25 },
  413. }
  414. homedecor.register("ground_lantern_"..brightness_level, {
  415. description = S("Ground Lantern/Light"),
  416. mesh = "homedecor_ground_lantern.obj",
  417. tiles = { gen_ls_tex_yellow, "homedecor_generic_metal_wrought_iron.png" },
  418. use_texture_alpha = true,
  419. inventory_image = "homedecor_ground_lantern_inv.png",
  420. wield_image = "homedecor_ground_lantern_inv.png",
  421. groups = {snappy=3, not_in_creative_inventory = nici},
  422. light_source = brightness_level,
  423. selection_box = gl_cbox,
  424. walkable = false,
  425. on_rightclick = homedecor_lighting.toggle_light,
  426. drop = {
  427. items = {
  428. {items = {"homedecor:ground_lantern_on"}},
  429. }
  430. },
  431. mesecons = homedecor_lighting.mesecon_alldir_light,
  432. digiline = homedecor_lighting.digiline_alldir_light,
  433. on_punch = digiline_on_punch
  434. })
  435. local hl_cbox = {
  436. type = "fixed",
  437. fixed = { -0.25, -0.5, -0.2, 0.25, 0.5, 0.5 },
  438. }
  439. homedecor.register("hanging_lantern_"..brightness_level, {
  440. description = S("Hanging Lantern/Light"),
  441. mesh = "homedecor_hanging_lantern.obj",
  442. tiles = { "homedecor_generic_metal_wrought_iron.png", gen_ls_tex_yellow },
  443. use_texture_alpha = true,
  444. inventory_image = "homedecor_hanging_lantern_inv.png",
  445. wield_image = "homedecor_hanging_lantern_inv.png",
  446. groups = {snappy=3, not_in_creative_inventory = nici},
  447. light_source = brightness_level,
  448. selection_box = hl_cbox,
  449. walkable = false,
  450. on_rightclick = homedecor_lighting.toggle_light,
  451. drop = {
  452. items = {
  453. {items = {"homedecor:hanging_lantern_on"}},
  454. }
  455. },
  456. mesecons = homedecor_lighting.mesecon_alldir_light,
  457. digiline = homedecor_lighting.digiline_alldir_light,
  458. on_punch = digiline_on_punch
  459. })
  460. local cl_cbox = {
  461. type = "fixed",
  462. fixed = { -0.35, -0.45, -0.35, 0.35, 0.5, 0.35 }
  463. }
  464. homedecor.register("ceiling_lantern_"..brightness_level, {
  465. drawtype = "mesh",
  466. mesh = "homedecor_ceiling_lantern.obj",
  467. tiles = { gen_ls_tex_yellow, "homedecor_generic_metal_wrought_iron.png" },
  468. use_texture_alpha = true,
  469. inventory_image = "homedecor_ceiling_lantern_inv.png",
  470. description = S("Ceiling Lantern/Light"),
  471. groups = {snappy=3, not_in_creative_inventory = nici},
  472. light_source = brightness_level,
  473. selection_box = cl_cbox,
  474. walkable = false,
  475. on_rightclick = homedecor_lighting.toggle_light,
  476. drop = {
  477. items = {
  478. {items = {"homedecor:ceiling_lantern_on"}},
  479. }
  480. },
  481. mesecons = homedecor_lighting.mesecon_alldir_light,
  482. digiline = homedecor_lighting.digiline_alldir_light,
  483. on_punch = digiline_on_punch
  484. })
  485. if not minetest.get_modpath("darkage") then
  486. homedecor.register("lattice_lantern_large_"..brightness_level, {
  487. description = S("Lattice lantern/Light (large)"),
  488. tiles = { gen_ls_tex_yellow.."^homedecor_lattice_lantern_large_overlay.png" },
  489. groups = { snappy = 3, not_in_creative_inventory = nici },
  490. light_source = brightness_level,
  491. sounds = default.node_sound_glass_defaults(),
  492. on_rightclick = homedecor_lighting.toggle_light,
  493. drop = {
  494. items = {
  495. {items = {"homedecor:lattice_lantern_large_on"}},
  496. }
  497. },
  498. mesecons = homedecor_lighting.mesecon_alldir_light,
  499. digiline = homedecor_lighting.digiline_alldir_light,
  500. on_punch = digiline_on_punch
  501. })
  502. end
  503. local lighttex_tb
  504. local lighttex_sides
  505. if onflag then
  506. lighttex_tb = "homedecor_lattice_lantern_small_tb_light.png"
  507. lighttex_sides = "homedecor_lattice_lantern_small_sides_light.png"
  508. else
  509. lighttex_tb = "homedecor_generic_light_source_off.png"
  510. lighttex_sides = "homedecor_generic_light_source_off.png"
  511. end
  512. homedecor.register("lattice_lantern_small_"..brightness_level, {
  513. description = S("Lattice lantern/light (small)"),
  514. tiles = {
  515. lighttex_tb.."^homedecor_lattice_lantern_small_tb_overlay.png",
  516. lighttex_tb.."^homedecor_lattice_lantern_small_tb_overlay.png",
  517. lighttex_sides.."^homedecor_lattice_lantern_small_sides_overlay.png"
  518. },
  519. selection_box = {
  520. type = "fixed",
  521. fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
  522. },
  523. node_box = {
  524. type = "fixed",
  525. fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
  526. },
  527. groups = { snappy = 3, not_in_creative_inventory = nici },
  528. light_source = brightness_level,
  529. sounds = default.node_sound_glass_defaults(),
  530. on_place = minetest.rotate_node,
  531. on_rightclick = homedecor_lighting.toggle_light,
  532. drop = {
  533. items = {
  534. {items = {"homedecor:lattice_lantern_small_on"}},
  535. }
  536. },
  537. mesecons = homedecor_lighting.mesecon_alldir_light,
  538. digiline = homedecor_lighting.digiline_alldir_light,
  539. on_punch = digiline_on_punch
  540. })
  541. -- "gooseneck" style desk lamps
  542. local dlamp_cbox = {
  543. type = "wallmounted",
  544. wall_side = { -0.2, -0.5, -0.15, 0.32, 0.12, 0.15 },
  545. }
  546. homedecor.register("desk_lamp_"..brightness_level, {
  547. description = S("Desk Lamp/Light"),
  548. mesh = "homedecor_desk_lamp.obj",
  549. tiles = {
  550. "homedecor_generic_metal.png",
  551. "homedecor_generic_metal.png",
  552. { name = "homedecor_generic_metal.png", color = homedecor.color_med_grey },
  553. { name = gen_ls_tex_white, color = brightness_hex },
  554. },
  555. inventory_image = "homedecor_desk_lamp_inv.png",
  556. paramtype = "light",
  557. paramtype2 = "colorwallmounted",
  558. palette = "unifieddyes_palette_colorwallmounted.png",
  559. selection_box = dlamp_cbox,
  560. node_box = dlamp_cbox,
  561. walkable = false,
  562. groups = {snappy=3, ud_param2_colorable = 1, not_in_creative_inventory = nici},
  563. after_place_node = function(pos, placer, itemstack, pointed_thing)
  564. unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
  565. end,
  566. on_dig = unifieddyes.on_dig,
  567. on_rotate = unifieddyes.fix_after_screwdriver_nsew,
  568. light_source = brightness_level,
  569. on_rightclick = homedecor_lighting.toggle_light,
  570. drop = {
  571. items = {
  572. {items = {"homedecor:desk_lamp_on"}, inherit_color = true },
  573. }
  574. },
  575. mesecons = homedecor_lighting.mesecon_alldir_light,
  576. digiline = homedecor_lighting.digiline_alldir_light,
  577. on_punch = digiline_on_punch
  578. })
  579. -- "kitchen"/"dining room" ceiling lamp
  580. homedecor.register("ceiling_lamp_"..brightness_level, {
  581. description = S("Ceiling Lamp/Light"),
  582. mesh = "homedecor_ceiling_lamp.obj",
  583. tiles = {
  584. "homedecor_generic_metal_brass.png",
  585. "homedecor_ceiling_lamp_glass.png",
  586. gen_ls_tex_white,
  587. { name = "homedecor_generic_plastic.png", color = 0xff442d04 },
  588. },
  589. inventory_image = "homedecor_ceiling_lamp_inv.png",
  590. light_source = brightness_level,
  591. groups = {snappy=3, not_in_creative_inventory = nici},
  592. walkable = false,
  593. on_rightclick = homedecor_lighting.toggle_light,
  594. drop = {
  595. items = {
  596. {items = {"homedecor:ceiling_lamp_on"}},
  597. }
  598. },
  599. mesecons = homedecor_lighting.mesecon_alldir_light,
  600. digiline = homedecor_lighting.digiline_alldir_light,
  601. on_punch = digiline_on_punch
  602. })
  603. local tlamp_cbox = {
  604. type = "fixed",
  605. fixed = { -0.25, -0.5, -0.25, 0.25, 0.5, 0.25 }
  606. }
  607. local slamp_cbox = {
  608. type = "fixed",
  609. fixed = { -0.25, -0.5, -0.25, 0.25, 1.5, 0.25 }
  610. }
  611. local wool_brightened = "wool_grey.png^[colorize:#ffffff:"..(brightness_level * 15)
  612. homedecor.register("table_lamp_"..brightness_level, {
  613. description = S("Table Lamp/Light"),
  614. mesh = "homedecor_table_lamp.obj",
  615. tiles = {
  616. wool_brightened,
  617. { name = gen_ls_tex_white, color = brightness_hex },
  618. { name = "homedecor_generic_wood_red.png", color = 0xffffffff },
  619. { name = "homedecor_generic_metal.png", color = homedecor.color_black },
  620. },
  621. inventory_image = "homedecor_table_lamp_foot_inv.png^homedecor_table_lamp_top_inv.png",
  622. paramtype = "light",
  623. paramtype2 = "color",
  624. palette = "unifieddyes_palette_extended.png",
  625. walkable = false,
  626. light_source = brightness_level,
  627. selection_box = tlamp_cbox,
  628. sounds = default.node_sound_wood_defaults(),
  629. groups = {cracky=2,oddly_breakable_by_hand=1, ud_param2_colorable = 1, not_in_creative_inventory=nici },
  630. drop = {
  631. items = {
  632. {items = {"homedecor:table_lamp_hi"}, inherit_color = true },
  633. }
  634. },
  635. digiline = homedecor_lighting.digiline_alldir_light,
  636. mesecons = homedecor_lighting.mesecon_wall_light,
  637. on_rightclick = homedecor_lighting.toggle_light,
  638. on_punch = digiline_on_punch,
  639. on_dig = unifieddyes.on_dig,
  640. })
  641. homedecor.register("standing_lamp_"..brightness_level, {
  642. description = S("Standing Lamp/Light"),
  643. mesh = "homedecor_standing_lamp.obj",
  644. tiles = {
  645. wool_brightened,
  646. { name = gen_ls_tex_white, color = brightness_hex },
  647. { name = "homedecor_generic_wood_red.png", color = 0xffffffff },
  648. { name = "homedecor_generic_metal.png", color = homedecor.color_black },
  649. },
  650. inventory_image = "homedecor_standing_lamp_foot_inv.png^homedecor_standing_lamp_top_inv.png",
  651. paramtype = "light",
  652. paramtype2 = "color",
  653. palette = "unifieddyes_palette_extended.png",
  654. walkable = false,
  655. light_source = brightness_level,
  656. groups = {cracky=2,oddly_breakable_by_hand=1, ud_param2_colorable = 1, not_in_creative_inventory=nici },
  657. selection_box = slamp_cbox,
  658. sounds = default.node_sound_wood_defaults(),
  659. on_rotate = minetest.get_modpath("screwdriver") and screwdriver.rotate_simple or nil,
  660. --expand = { top="air" },
  661. drop = {
  662. items = {
  663. {items = {"homedecor:standing_lamp_hi"}, inherit_color = true },
  664. }
  665. },
  666. digiline = homedecor_lighting.digiline_alldir_light,
  667. mesecons = homedecor_lighting.mesecon_wall_light,
  668. on_rightclick = homedecor_lighting.toggle_light,
  669. on_punch = digiline_on_punch,
  670. on_dig = unifieddyes.on_dig,
  671. })
  672. end
  673. ------------------------------------------
  674. -- Simple non-dimmable, on/off-only lights
  675. for _, light_brightn_name in ipairs({"off", "on"}) do
  676. local onflag = (light_brightn_name == "on")
  677. local nici = (light_brightn_name == "off") and 1 or nil
  678. local nici_m = (light_brightn_name == "off") and 1 or nil
  679. local on_rc = homedecor_lighting.toggle_light
  680. local di = "on"
  681. if hd_mesecons then
  682. nici_m = (light_brightn_name ~= "off") and 1 or nil
  683. on_rc = nil
  684. di = "off"
  685. end
  686. local gen_ls_tex_white = "homedecor_generic_light_source_off.png"
  687. if onflag then gen_ls_tex_white = "homedecor_generic_light_source_white.png" end
  688. local gen_ls_tex_yellow = "homedecor_generic_light_source_off.png"
  689. if onflag then gen_ls_tex_yellow = "homedecor_generic_light_source_yellow.png" end
  690. local lighttex = "homedecor_blanktile.png"
  691. if onflag then
  692. lighttex = {
  693. name = "homedecor_plasma_ball_streamers.png",
  694. animation={type="vertical_frames", aspect_w=48, aspect_h=48, length=2.0},
  695. }
  696. end
  697. homedecor.register("plasma_ball_"..light_brightn_name, {
  698. description = S("Plasma Ball/light"),
  699. mesh = "homedecor_plasma_ball.obj",
  700. tiles = {
  701. { name = "homedecor_generic_plastic.png", color = homedecor.color_black },
  702. lighttex,
  703. "homedecor_plasma_ball_glass.png"
  704. },
  705. inventory_image = "homedecor_plasma_ball_inv.png",
  706. selection_box = {
  707. type = "fixed",
  708. fixed = { -0.1875, -0.5, -0.1875, 0.1875, 0, 0.1875 }
  709. },
  710. walkable = false,
  711. use_texture_alpha = true,
  712. light_source = onflag and (default.LIGHT_MAX - 5) or nil,
  713. sunlight_propagates = true,
  714. groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory = nici},
  715. sounds = default.node_sound_glass_defaults(),
  716. on_rightclick = homedecor_lighting.toggle_light,
  717. drop = {
  718. items = {
  719. {items = {"homedecor:plasma_ball_on"}},
  720. }
  721. },
  722. mesecons = homedecor_lighting.mesecon_alldir_light,
  723. digiline = homedecor_lighting.digiline_alldir_light,
  724. on_punch = digiline_on_punch
  725. })
  726. local wl_cbox = {
  727. type = "fixed",
  728. fixed = { -0.2, -0.5, 0, 0.2, 0.5, 0.5 },
  729. }
  730. -- rope lighting
  731. minetest.register_node(":homedecor:rope_light_on_floor_"..light_brightn_name, {
  732. description = S("Rope lighting (on floor)"),
  733. inventory_image = "homedecor_rope_light_on_floor.png",
  734. paramtype = "light",
  735. light_source = word_to_bright[light_brightn_name],
  736. walkable = false,
  737. sunlight_propagates = true,
  738. tiles = { gen_ls_tex_white },
  739. drawtype = "nodebox",
  740. node_box = {
  741. type = "connected",
  742. fixed = {},
  743. connect_front = { -1/16, -8/16, -8/16, 1/16, -6/16, 1/16 },
  744. connect_left = { -8/16, -8/16, -1/16, 1/16, -6/16, 1/16 },
  745. connect_back = { -1/16, -8/16, -1/16, 1/16, -6/16, 8/16 },
  746. connect_right = { -1/16, -8/16, -1/16, 8/16, -6/16, 1/16 },
  747. disconnected_sides = {
  748. { -6/16, -8/16, -6/16, -4/16, -6/16, 6/16 },
  749. { 4/16, -8/16, -6/16, 6/16, -6/16, 6/16 },
  750. { -6/16, -8/16, -6/16, 6/16, -6/16, -4/16 },
  751. { -6/16, -8/16, 4/16, 6/16, -6/16, 6/16 }
  752. },
  753. },
  754. connects_to = {
  755. "homedecor:rope_light_on_floor_on",
  756. "homedecor:rope_light_on_floor_off",
  757. "group:mesecon_conductor_craftable"
  758. },
  759. groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory = nici_m},
  760. sounds = default.node_sound_stone_defaults(),
  761. drop = {
  762. items = {
  763. {items = {"homedecor:rope_light_on_floor_"..di} },
  764. }
  765. },
  766. on_rightclick = on_rc,
  767. mesecons = hd_mesecons and {
  768. conductor = {
  769. state = mesecon and (onflag and mesecon.state.on or mesecon.state.off),
  770. onstate = "homedecor:rope_light_on_floor_on",
  771. offstate = "homedecor:rope_light_on_floor_off",
  772. rules = rules_alldir
  773. },
  774. } or nil,
  775. })
  776. minetest.register_node(":homedecor:rope_light_on_ceiling_"..light_brightn_name, {
  777. description = S("Rope lighting (on ceiling)"),
  778. inventory_image = "homedecor_rope_light_on_ceiling.png",
  779. paramtype = "light",
  780. light_source = word_to_bright[light_brightn_name],
  781. walkable = false,
  782. sunlight_propagates = true,
  783. tiles = { gen_ls_tex_white },
  784. drawtype = "nodebox",
  785. node_box = {
  786. type = "connected",
  787. fixed = {},
  788. connect_front = { -1/16, 8/16, -8/16, 1/16, 6/16, 1/16 },
  789. connect_left = { -8/16, 8/16, -1/16, 1/16, 6/16, 1/16 },
  790. connect_back = { -1/16, 8/16, -1/16, 1/16, 6/16, 8/16 },
  791. connect_right = { -1/16, 8/16, -1/16, 8/16, 6/16, 1/16 },
  792. disconnected_sides = {
  793. { -6/16, 8/16, -6/16, -4/16, 6/16, 6/16 },
  794. { 4/16, 8/16, -6/16, 6/16, 6/16, 6/16 },
  795. { -6/16, 8/16, -6/16, 6/16, 6/16, -4/16 },
  796. { -6/16, 8/16, 4/16, 6/16, 6/16, 6/16 }
  797. },
  798. },
  799. connects_to = {
  800. "homedecor:rope_light_on_ceiling_on",
  801. "homedecor:rope_light_on_ceiling_off",
  802. "group:mesecon_conductor_craftable"
  803. },
  804. groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory = nici_m},
  805. sounds = default.node_sound_stone_defaults(),
  806. drop = {
  807. items = {
  808. {items = {"homedecor:rope_light_on_ceiling_"..di}},
  809. }
  810. },
  811. on_rightclick = on_rc,
  812. mesecons = hd_mesecons and {
  813. conductor = {
  814. state = mesecon and (onflag and mesecon.state.on or mesecon.state.off),
  815. onstate = "homedecor:rope_light_on_ceiling_on",
  816. offstate = "homedecor:rope_light_on_ceiling_off",
  817. rules = rules_alldir
  818. },
  819. } or nil,
  820. })
  821. homedecor.register("wall_lamp_"..light_brightn_name, {
  822. description = S("Wall Lamp/light"),
  823. mesh = "homedecor_wall_lamp.obj",
  824. tiles = {
  825. { name = "homedecor_generic_metal.png", color = homedecor.color_med_grey },
  826. homedecor.lux_wood,
  827. gen_ls_tex_yellow,
  828. "homedecor_generic_metal_wrought_iron.png"
  829. },
  830. use_texture_alpha = true,
  831. inventory_image = "homedecor_wall_lamp_inv.png",
  832. groups = {snappy=3, not_in_creative_inventory = nici},
  833. light_source = onflag and (default.LIGHT_MAX - 3) or nil,
  834. selection_box = wl_cbox,
  835. walkable = false,
  836. drop = {
  837. items = {
  838. {items = {"homedecor:wall_lamp_on"}},
  839. }
  840. },
  841. on_rightclick = homedecor_lighting.toggle_light,
  842. mesecons = homedecor_lighting.mesecon_alldir_light,
  843. digiline = homedecor_lighting.digiline_alldir_light,
  844. on_punch = digiline_on_punch
  845. })
  846. end
  847. -------------------------------------------------------
  848. -- Light sources and other items that don't turn on/off
  849. local tc_cbox = {
  850. type = "fixed",
  851. fixed = {
  852. { -0.1875, -0.5, -0.1875, 0.1875, 0.375, 0.1875 },
  853. }
  854. }
  855. homedecor.register("candle", {
  856. description = S("Thick Candle"),
  857. mesh = "homedecor_candle_thick.obj",
  858. tiles = {
  859. 'homedecor_candle_sides.png',
  860. {name="homedecor_candle_flame.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
  861. },
  862. inventory_image = "homedecor_candle_inv.png",
  863. selection_box = tc_cbox,
  864. walkable = false,
  865. groups = { snappy = 3 },
  866. light_source = default.LIGHT_MAX-4,
  867. })
  868. local c_cbox = {
  869. type = "fixed",
  870. fixed = {
  871. { -0.125, -0.5, -0.125, 0.125, 0.05, 0.125 },
  872. }
  873. }
  874. homedecor.register("candle_thin", {
  875. description = S("Thin Candle"),
  876. mesh = "homedecor_candle_thin.obj",
  877. tiles = {
  878. 'homedecor_candle_sides.png',
  879. {name="homedecor_candle_flame.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
  880. },
  881. inventory_image = "homedecor_candle_thin_inv.png",
  882. selection_box = c_cbox,
  883. walkable = false,
  884. groups = { snappy = 3 },
  885. light_source = default.LIGHT_MAX-4,
  886. })
  887. local cs_cbox = {
  888. type = "fixed",
  889. fixed = {
  890. { -0.15625, -0.5, -0.15625, 0.15625, 0.3125, 0.15625 },
  891. }
  892. }
  893. homedecor.register("candlestick_wrought_iron", {
  894. description = S("Candlestick (wrought iron)"),
  895. mesh = "homedecor_candlestick.obj",
  896. tiles = {
  897. "homedecor_candle_sides.png",
  898. {name="homedecor_candle_flame.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
  899. "homedecor_generic_metal_wrought_iron.png",
  900. },
  901. inventory_image = "homedecor_candlestick_wrought_iron_inv.png",
  902. selection_box = cs_cbox,
  903. walkable = false,
  904. groups = { snappy = 3 },
  905. light_source = default.LIGHT_MAX-4,
  906. })
  907. homedecor.register("candlestick_brass", {
  908. description = S("Candlestick (brass)"),
  909. mesh = "homedecor_candlestick.obj",
  910. tiles = {
  911. "homedecor_candle_sides.png",
  912. {name="homedecor_candle_flame.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
  913. "homedecor_generic_metal_brass.png",
  914. },
  915. inventory_image = "homedecor_candlestick_brass_inv.png",
  916. selection_box = cs_cbox,
  917. walkable = false,
  918. groups = { snappy = 3 },
  919. light_source = default.LIGHT_MAX-4,
  920. })
  921. homedecor.register("wall_sconce", {
  922. description = S("Wall sconce"),
  923. mesh = "homedecor_wall_sconce.obj",
  924. tiles = {
  925. 'homedecor_candle_sides.png',
  926. {name="homedecor_candle_flame.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
  927. 'homedecor_wall_sconce_back.png',
  928. 'homedecor_generic_metal_wrought_iron.png',
  929. },
  930. inventory_image = "homedecor_wall_sconce_inv.png",
  931. selection_box = {
  932. type = "fixed",
  933. fixed = { -0.1875, -0.25, 0.3125, 0.1875, 0.25, 0.5 }
  934. },
  935. walkable = false,
  936. groups = { snappy = 3 },
  937. light_source = default.LIGHT_MAX-4,
  938. })
  939. local ol_cbox = {
  940. type = "fixed",
  941. fixed = {
  942. { -5/16, -8/16, -3/16, 5/16, 4/16, 3/16 },
  943. }
  944. }
  945. homedecor.register("oil_lamp", {
  946. description = S("Oil lamp/Light (hurricane)"),
  947. mesh = "homedecor_oil_lamp.obj",
  948. tiles = {
  949. "homedecor_generic_metal_brass.png",
  950. { name = "homedecor_generic_metal.png", color = homedecor.color_black },
  951. { name = "homedecor_generic_metal.png", color = 0xffa00000 },
  952. "homedecor_oil_lamp_wick.png",
  953. { name = "homedecor_generic_metal.png", color = 0xffa00000 },
  954. "homedecor_oil_lamp_glass.png",
  955. },
  956. use_texture_alpha = true,
  957. inventory_image = "homedecor_oil_lamp_inv.png",
  958. selection_box = ol_cbox,
  959. walkable = false,
  960. groups = { snappy = 3 },
  961. light_source = default.LIGHT_MAX-3,
  962. sounds = default.node_sound_glass_defaults(),
  963. })
  964. homedecor.register("oil_lamp_tabletop", {
  965. description = S("Oil Lamp/Light (tabletop)"),
  966. mesh = "homedecor_oil_lamp_tabletop.obj",
  967. tiles = {"homedecor_oil_lamp_tabletop.png"},
  968. inventory_image = "homedecor_oil_lamp_tabletop_inv.png",
  969. selection_box = ol_cbox,
  970. collision_box = ol_cbox,
  971. groups = { snappy = 3 },
  972. light_source = default.LIGHT_MAX-3,
  973. sounds = default.node_sound_glass_defaults(),
  974. })
  975. local topchains_sbox = {
  976. type = "fixed",
  977. fixed = {
  978. { -0.25, 0.35, -0.25, 0.25, 0.5, 0.25 },
  979. { -0.1, -0.5, -0.1, 0.1, 0.4, 0.1 }
  980. }
  981. }
  982. minetest.register_node(":homedecor:chain_steel_top", {
  983. description = S("Hanging chain (ceiling mount, steel)"),
  984. drawtype = "mesh",
  985. mesh = "homedecor_chains_top.obj",
  986. tiles = {"basic_materials_chain_steel.png"},
  987. walkable = false,
  988. climbable = true,
  989. sunlight_propagates = true,
  990. paramtype = "light",
  991. inventory_image = "basic_materials_chain_steel_inv.png",
  992. groups = {cracky=3},
  993. selection_box = topchains_sbox,
  994. })
  995. minetest.register_node(":homedecor:chain_brass_top", {
  996. description = S("Hanging chain (ceiling mount, brass)"),
  997. drawtype = "mesh",
  998. mesh = "homedecor_chains_top.obj",
  999. tiles = {"basic_materials_chain_brass.png"},
  1000. walkable = false,
  1001. climbable = true,
  1002. sunlight_propagates = true,
  1003. paramtype = "light",
  1004. inventory_image = "basic_materials_chain_brass_inv.png",
  1005. groups = {cracky=3},
  1006. selection_box = topchains_sbox,
  1007. })
  1008. minetest.register_node(":homedecor:chandelier_steel", {
  1009. description = S("Chandelier (steel)"),
  1010. paramtype = "light",
  1011. light_source = 12,
  1012. walkable = false,
  1013. climbable = true,
  1014. sunlight_propagates = true,
  1015. tiles = {
  1016. "basic_materials_chain_steel.png",
  1017. "homedecor_candle_flat.png",
  1018. {
  1019. name="homedecor_candle_flame.png",
  1020. animation={
  1021. type="vertical_frames",
  1022. aspect_w=16,
  1023. aspect_h=16,
  1024. length=3.0
  1025. }
  1026. }
  1027. },
  1028. drawtype = "mesh",
  1029. mesh = "homedecor_chandelier.obj",
  1030. groups = {cracky=3},
  1031. sounds = default.node_sound_stone_defaults(),
  1032. })
  1033. minetest.register_node(":homedecor:chandelier_brass", {
  1034. description = S("Chandelier (brass)"),
  1035. paramtype = "light",
  1036. light_source = 12,
  1037. walkable = false,
  1038. climbable = true,
  1039. sunlight_propagates = true,
  1040. tiles = {
  1041. "basic_materials_chain_brass.png",
  1042. "homedecor_candle_flat.png",
  1043. {
  1044. name="homedecor_candle_flame.png",
  1045. animation={
  1046. type="vertical_frames",
  1047. aspect_w=16,
  1048. aspect_h=16,
  1049. length=3.0
  1050. }
  1051. }
  1052. },
  1053. drawtype = "mesh",
  1054. mesh = "homedecor_chandelier.obj",
  1055. groups = {cracky=3},
  1056. sounds = default.node_sound_stone_defaults(),
  1057. })
  1058. homedecor.register("torch_wall", {
  1059. description = S("Wall Torch"),
  1060. mesh = "forniture_torch.obj",
  1061. tiles = {
  1062. {
  1063. name="forniture_torch_flame.png",
  1064. animation={
  1065. type="vertical_frames",
  1066. aspect_w=40,
  1067. aspect_h=40,
  1068. length=1.0,
  1069. },
  1070. },
  1071. { name = "homedecor_generic_metal.png", color = homedecor.color_black },
  1072. { name = "homedecor_generic_metal.png", color = homedecor.color_med_grey },
  1073. "forniture_coal.png",
  1074. },
  1075. inventory_image="forniture_torch_inv.png",
  1076. walkable = false,
  1077. light_source = 14,
  1078. selection_box = {
  1079. type = "fixed",
  1080. fixed = { -0.15, -0.45, 0.15, 0.15,0.35, 0.5 },
  1081. },
  1082. groups = {cracky=3},
  1083. })
  1084. -- table lamps and standing lamps
  1085. local lamp_colors = {
  1086. "white",
  1087. "blue",
  1088. "green",
  1089. "pink",
  1090. "red",
  1091. "violet",
  1092. }
  1093. -- conversion LBM for param2 coloring
  1094. homedecor_lighting.old_static_nodes = {
  1095. "homedecor:glowlight_quarter_white",
  1096. "homedecor:glowlight_quarter_yellow",
  1097. "homedecor:glowlight_half_white",
  1098. "homedecor:glowlight_half_yellow",
  1099. "homedecor:glowlight_small_cube_white",
  1100. "homedecor:glowlight_small_cube_yellow"
  1101. }
  1102. local lamp_power = {"off", "low", "med", "hi", "max"}
  1103. for _, power in ipairs(lamp_power) do
  1104. for _, color in ipairs(lamp_colors) do
  1105. table.insert(homedecor_lighting.old_static_nodes, "homedecor:table_lamp_"..color.."_"..power)
  1106. table.insert(homedecor_lighting.old_static_nodes, "homedecor:standing_lamp_"..color.."_"..power)
  1107. end
  1108. end
  1109. minetest.register_lbm({
  1110. name = ":homedecor:convert_lighting",
  1111. label = "Convert homedecor glowlights, table lamps, and standing lamps to use param2 color",
  1112. run_at_every_load = false,
  1113. nodenames = homedecor_lighting.old_static_nodes,
  1114. action = function(pos, node)
  1115. local name = node.name
  1116. local newname
  1117. local color
  1118. if string.find(name, "small_cube") then
  1119. newname = "homedecor:glowlight_small_cube"
  1120. elseif string.find(name, "glowlight_half") then
  1121. newname = "homedecor:glowlight_half"
  1122. elseif string.find(name, "glowlight_quarter") then
  1123. newname = "homedecor:glowlight_quarter"
  1124. end
  1125. local lampname
  1126. if string.find(name, "standing_lamp") then
  1127. lampname = "homedecor:standing_lamp"
  1128. elseif string.find(name, "table_lamp") then
  1129. lampname = "homedecor:table_lamp"
  1130. end
  1131. if lampname then
  1132. newname = lampname
  1133. if string.find(name, "_off") then
  1134. newname = newname.."_off"
  1135. elseif string.find(name, "_low") then
  1136. newname = newname.."_low"
  1137. elseif string.find(name, "_med") then
  1138. newname = newname.."_med"
  1139. elseif string.find(name, "_hi") then
  1140. newname = newname.."_hi"
  1141. elseif string.find(name, "_max") then
  1142. newname = newname.."_max"
  1143. end
  1144. end
  1145. if string.find(name, "red") then
  1146. color = "red"
  1147. elseif string.find(name, "pink") then
  1148. color = "pink"
  1149. elseif string.find(name, "green") then
  1150. color = "green"
  1151. elseif string.find(name, "blue") then
  1152. color = "blue"
  1153. elseif string.find(name, "yellow") then
  1154. color = "yellow"
  1155. elseif string.find(name, "violet") then
  1156. color = "violet"
  1157. else
  1158. color = "white"
  1159. end
  1160. local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, "extended")
  1161. local old_fdir
  1162. local new_node = newname
  1163. local new_fdir = 1
  1164. local param2
  1165. if string.find(name, "glowlight") then
  1166. paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, "wallmounted")
  1167. old_fdir = math.floor(node.param2 / 4)
  1168. if old_fdir == 5 then
  1169. new_fdir = 0
  1170. elseif old_fdir == 1 then
  1171. new_fdir = 5
  1172. elseif old_fdir == 2 then
  1173. new_fdir = 4
  1174. elseif old_fdir == 3 then
  1175. new_fdir = 3
  1176. elseif old_fdir == 4 then
  1177. new_fdir = 2
  1178. elseif old_fdir == 0 then
  1179. new_fdir = 1
  1180. end
  1181. param2 = paletteidx + new_fdir
  1182. else
  1183. param2 = paletteidx
  1184. end
  1185. local meta = minetest.get_meta(pos)
  1186. if string.find(name, "table_lamp") or string.find(name, "standing_lamp") then
  1187. meta:set_string("palette", "ext")
  1188. end
  1189. minetest.set_node(pos, { name = new_node, param2 = param2 })
  1190. meta:set_string("dye", "unifieddyes:"..color)
  1191. end
  1192. })
  1193. -- this one's for the small "gooseneck" desk lamps
  1194. homedecor_lighting.old_static_desk_lamps = {
  1195. "homedecor:desk_lamp_red",
  1196. "homedecor:desk_lamp_blue",
  1197. "homedecor:desk_lamp_green",
  1198. "homedecor:desk_lamp_violet",
  1199. }
  1200. minetest.register_lbm({
  1201. name = ":homedecor:convert_desk_lamps",
  1202. label = "Convert homedecor desk lamps to use param2 color",
  1203. run_at_every_load = false,
  1204. nodenames = homedecor_lighting.old_static_desk_lamps,
  1205. action = function(pos, node)
  1206. local name = node.name
  1207. local color = string.sub(name, string.find(name, "_", -8) + 1)
  1208. if color == "green" then
  1209. color = "medium_green"
  1210. elseif color == "violet" then
  1211. color = "magenta"
  1212. end
  1213. local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, "wallmounted")
  1214. local old_fdir = math.floor(node.param2 % 32)
  1215. local new_fdir = 3
  1216. if old_fdir == 0 then
  1217. new_fdir = 3
  1218. elseif old_fdir == 1 then
  1219. new_fdir = 4
  1220. elseif old_fdir == 2 then
  1221. new_fdir = 2
  1222. elseif old_fdir == 3 then
  1223. new_fdir = 5
  1224. end
  1225. local param2 = paletteidx + new_fdir
  1226. minetest.set_node(pos, { name = "homedecor:desk_lamp", param2 = param2 })
  1227. local meta = minetest.get_meta(pos)
  1228. meta:set_string("dye", "unifieddyes:"..color)
  1229. end
  1230. })
  1231. -- crafting
  1232. minetest.register_craft({
  1233. output = 'homedecor:chain_steel_top',
  1234. recipe = {
  1235. {'default:steel_ingot'},
  1236. {'basic_materials:chainlink_steel'},
  1237. },
  1238. })
  1239. minetest.register_craft({
  1240. output = 'homedecor:chandelier_steel',
  1241. recipe = {
  1242. {'', 'basic_materials:chainlink_steel', ''},
  1243. {'default:torch', 'basic_materials:chainlink_steel', 'default:torch'},
  1244. {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
  1245. }
  1246. })
  1247. -- brass versions
  1248. minetest.register_craft({
  1249. output = 'homedecor:chain_brass_top',
  1250. recipe = {
  1251. {'basic_materials:brass_ingot'},
  1252. {'basic_materials:chainlink_brass'},
  1253. },
  1254. })
  1255. minetest.register_craft({
  1256. output = 'homedecor:chandelier_brass',
  1257. recipe = {
  1258. {'', 'basic_materials:chainlink_brass', ''},
  1259. {'default:torch', 'basic_materials:chainlink_brass', 'default:torch'},
  1260. {'basic_materials:brass_ingot', 'basic_materials:brass_ingot', 'basic_materials:brass_ingot'},
  1261. }
  1262. })
  1263. -- candles
  1264. minetest.register_craft({
  1265. output = "homedecor:candle_thin 4",
  1266. recipe = {
  1267. {"farming:string" },
  1268. {"basic_materials:paraffin" }
  1269. }
  1270. })
  1271. minetest.register_craft({
  1272. output = "homedecor:candle 2",
  1273. recipe = {
  1274. {"farming:string" },
  1275. {"basic_materials:paraffin" },
  1276. {"basic_materials:paraffin" }
  1277. }
  1278. })
  1279. minetest.register_craft({
  1280. output = "homedecor:wall_sconce 2",
  1281. recipe = {
  1282. {"default:iron_lump", "", ""},
  1283. {"default:iron_lump", "homedecor:candle", ""},
  1284. {"default:iron_lump", "", ""},
  1285. }
  1286. })
  1287. minetest.register_craft({
  1288. output = "homedecor:candlestick_wrought_iron",
  1289. recipe = {
  1290. {""},
  1291. {"homedecor:candle_thin"},
  1292. {"default:iron_lump"},
  1293. }
  1294. })
  1295. minetest.register_craft({
  1296. output = "homedecor:candlestick_brass",
  1297. recipe = {
  1298. {""},
  1299. {"homedecor:candle_thin"},
  1300. {"basic_materials:brass_ingot"},
  1301. }
  1302. })
  1303. minetest.register_craft({
  1304. output = "homedecor:oil_lamp",
  1305. recipe = {
  1306. { "", "vessels:glass_bottle", "" },
  1307. { "", "farming:string", "" },
  1308. { "default:steel_ingot", "basic_materials:oil_extract", "default:steel_ingot" }
  1309. }
  1310. })
  1311. minetest.register_craft({
  1312. output = "homedecor:oil_lamp_tabletop",
  1313. recipe = {
  1314. { "", "vessels:glass_bottle", "" },
  1315. { "", "farming:string", "" },
  1316. { "default:iron_lump", "basic_materials:oil_extract", "default:iron_lump" }
  1317. }
  1318. })
  1319. -- Wrought-iron wall latern
  1320. minetest.register_craft({
  1321. output = "homedecor:ground_lantern",
  1322. recipe = {
  1323. { "default:iron_lump", "default:iron_lump", "default:iron_lump" },
  1324. { "default:iron_lump", "default:torch", "default:iron_lump" },
  1325. { "", "default:iron_lump", "" }
  1326. }
  1327. })
  1328. -- wood-lattice lamps
  1329. if minetest.get_modpath("darkage") then
  1330. minetest.register_craft( {
  1331. output = "homedecor:lattice_lantern_small 8",
  1332. recipe = {
  1333. { "darkage:lamp" },
  1334. },
  1335. })
  1336. minetest.register_craft( {
  1337. output = "darkage:lamp",
  1338. type = "shapeless",
  1339. recipe = {
  1340. "homedecor:lattice_lantern_small",
  1341. "homedecor:lattice_lantern_small",
  1342. "homedecor:lattice_lantern_small",
  1343. "homedecor:lattice_lantern_small",
  1344. "homedecor:lattice_lantern_small",
  1345. "homedecor:lattice_lantern_small",
  1346. "homedecor:lattice_lantern_small",
  1347. "homedecor:lattice_lantern_small",
  1348. },
  1349. })
  1350. else
  1351. minetest.register_craft( {
  1352. output = "homedecor:lattice_lantern_large 2",
  1353. recipe = {
  1354. { "dye:black", "dye:yellow", "dye:black" },
  1355. { "group:stick", "building_blocks:woodglass", "group:stick" },
  1356. { "group:stick", "basic_materials:energy_crystal_simple", "group:stick" }
  1357. },
  1358. })
  1359. minetest.register_craft( {
  1360. output = "homedecor:lattice_lantern_small 8",
  1361. recipe = {
  1362. { "homedecor:lattice_lantern_large" },
  1363. },
  1364. })
  1365. minetest.register_craft( {
  1366. output = "homedecor:lattice_lantern_large",
  1367. type = "shapeless",
  1368. recipe = {
  1369. "homedecor:lattice_lantern_small",
  1370. "homedecor:lattice_lantern_small",
  1371. "homedecor:lattice_lantern_small",
  1372. "homedecor:lattice_lantern_small",
  1373. "homedecor:lattice_lantern_small",
  1374. "homedecor:lattice_lantern_small",
  1375. "homedecor:lattice_lantern_small",
  1376. "homedecor:lattice_lantern_small",
  1377. },
  1378. })
  1379. end
  1380. -- glowlights
  1381. minetest.register_craft({
  1382. output = "homedecor:glowlight_half 6",
  1383. recipe = {
  1384. { "default:glass", "basic_materials:energy_crystal_simple", "default:glass", },
  1385. }
  1386. })
  1387. minetest.register_craft({
  1388. output = "homedecor:glowlight_half 6",
  1389. recipe = {
  1390. {"moreblocks:super_glow_glass", "moreblocks:glow_glass", "moreblocks:super_glow_glass", },
  1391. }
  1392. })
  1393. minetest.register_craft({
  1394. output = "homedecor:glowlight_half",
  1395. recipe = {
  1396. {"homedecor:glowlight_small_cube","homedecor:glowlight_small_cube"},
  1397. {"homedecor:glowlight_small_cube","homedecor:glowlight_small_cube"}
  1398. }
  1399. })
  1400. minetest.register_craft({
  1401. output = "homedecor:glowlight_half",
  1402. type = "shapeless",
  1403. recipe = {
  1404. "homedecor:glowlight_quarter",
  1405. "homedecor:glowlight_quarter"
  1406. }
  1407. })
  1408. unifieddyes.register_color_craft({
  1409. output = "homedecor:glowlight_half",
  1410. palette = "wallmounted",
  1411. type = "shapeless",
  1412. neutral_node = "homedecor:glowlight_half",
  1413. recipe = {
  1414. "NEUTRAL_NODE",
  1415. "MAIN_DYE"
  1416. }
  1417. })
  1418. minetest.register_craft({
  1419. output = "homedecor:glowlight_quarter 6",
  1420. recipe = {
  1421. {"homedecor:glowlight_half", "homedecor:glowlight_half", "homedecor:glowlight_half", },
  1422. }
  1423. })
  1424. unifieddyes.register_color_craft({
  1425. output = "homedecor:glowlight_quarter",
  1426. palette = "wallmounted",
  1427. type = "shapeless",
  1428. neutral_node = "homedecor:glowlight_quarter",
  1429. recipe = {
  1430. "NEUTRAL_NODE",
  1431. "MAIN_DYE"
  1432. }
  1433. })
  1434. minetest.register_craft({
  1435. output = "homedecor:glowlight_small_cube 8",
  1436. recipe = {
  1437. { "dye:white" },
  1438. { "default:glass" },
  1439. { "basic_materials:energy_crystal_simple" },
  1440. }
  1441. })
  1442. minetest.register_craft({
  1443. output = "homedecor:glowlight_small_cube 8",
  1444. recipe = {
  1445. {"dye:white" },
  1446. {"moreblocks:super_glow_glass" },
  1447. }
  1448. })
  1449. minetest.register_craft({
  1450. output = "homedecor:glowlight_small_cube 4",
  1451. recipe = {
  1452. {"homedecor:glowlight_half" },
  1453. }
  1454. })
  1455. unifieddyes.register_color_craft({
  1456. output = "homedecor:glowlight_small_cube",
  1457. palette = "wallmounted",
  1458. type = "shapeless",
  1459. neutral_node = "homedecor:glowlight_small_cube",
  1460. recipe = {
  1461. "NEUTRAL_NODE",
  1462. "MAIN_DYE"
  1463. }
  1464. })
  1465. ----
  1466. minetest.register_craft({
  1467. output = "homedecor:plasma_lamp",
  1468. recipe = {
  1469. {"", "default:glass", ""},
  1470. {"default:glass", "basic_materials:energy_crystal_simple", "default:glass"},
  1471. {"", "default:glass", ""}
  1472. }
  1473. })
  1474. minetest.register_craft({
  1475. output = "homedecor:plasma_ball 2",
  1476. recipe = {
  1477. {"", "default:glass", ""},
  1478. {"default:glass", "default:copper_ingot", "default:glass"},
  1479. {"basic_materials:plastic_sheet", "basic_materials:energy_crystal_simple", "basic_materials:plastic_sheet"}
  1480. }
  1481. })
  1482. minetest.register_craft({
  1483. output = "homedecor:desk_lamp 2",
  1484. recipe = {
  1485. { "", "default:steel_ingot", "homedecor:glowlight_small_cube" },
  1486. { "", "basic_materials:steel_strip", "" },
  1487. { "basic_materials:plastic_sheet", "basic_materials:copper_wire", "basic_materials:plastic_sheet" },
  1488. },
  1489. })
  1490. unifieddyes.register_color_craft({
  1491. output = "homedecor:desk_lamp",
  1492. palette = "wallmounted",
  1493. type = "shapeless",
  1494. neutral_node = "homedecor:desk_lamp",
  1495. recipe = {
  1496. "NEUTRAL_NODE",
  1497. "MAIN_DYE"
  1498. }
  1499. })
  1500. minetest.register_craft({
  1501. output = "homedecor:hanging_lantern 2",
  1502. recipe = {
  1503. { "default:iron_lump", "default:iron_lump", "" },
  1504. { "default:iron_lump", "homedecor:lattice_lantern_large", "" },
  1505. { "default:iron_lump", "", "" },
  1506. },
  1507. })
  1508. minetest.register_craft({
  1509. output = "homedecor:ceiling_lantern 2",
  1510. recipe = {
  1511. { "default:iron_lump", "default:iron_lump", "default:iron_lump" },
  1512. { "default:iron_lump", "homedecor:lattice_lantern_large", "default:iron_lump" },
  1513. { "", "default:iron_lump", "" },
  1514. },
  1515. })
  1516. minetest.register_craft({
  1517. output = "homedecor:wall_lamp 2",
  1518. recipe = {
  1519. { "", "homedecor:lattice_lantern_large", "" },
  1520. { "default:iron_lump", "group:stick", "" },
  1521. { "default:iron_lump", "group:stick", "" },
  1522. },
  1523. })
  1524. minetest.register_craft({
  1525. output = "homedecor:ceiling_lamp",
  1526. recipe = {
  1527. { "", "basic_materials:brass_ingot", ""},
  1528. { "", "basic_materials:chainlink_brass", ""},
  1529. { "default:glass", "homedecor:glowlight_small_cube", "default:glass"}
  1530. },
  1531. })
  1532. minetest.register_craft({
  1533. output = "homedecor:ceiling_lamp",
  1534. recipe = {
  1535. { "", "basic_materials:chain_steel_top_brass", ""},
  1536. { "default:glass", "homedecor:glowlight_small_cube", "default:glass"}
  1537. },
  1538. })
  1539. minetest.register_craft({
  1540. output = "homedecor:standing_lamp_hi",
  1541. recipe = {
  1542. {"homedecor:table_lamp_hi"},
  1543. {"group:stick"},
  1544. {"group:stick"},
  1545. },
  1546. })
  1547. unifieddyes.register_color_craft({
  1548. output = "homedecor:standing_lamp_hi",
  1549. palette = "extended",
  1550. type = "shapeless",
  1551. neutral_node = "homedecor:standing_lamp_hi",
  1552. recipe = {
  1553. "NEUTRAL_NODE",
  1554. "MAIN_DYE"
  1555. }
  1556. })
  1557. minetest.register_craft({
  1558. type = "fuel",
  1559. recipe = "homedecor:table_lamp_hi",
  1560. burntime = 10,
  1561. })
  1562. minetest.register_craft({
  1563. output = "homedecor:table_lamp_hi",
  1564. recipe = {
  1565. { "wool:white", "default:torch", "wool:white"},
  1566. { "", "group:stick", ""},
  1567. { "", "stairs:slab_wood", "" },
  1568. },
  1569. })
  1570. minetest.register_craft({
  1571. output = "homedecor:table_lamp_hi",
  1572. recipe = {
  1573. { "cottages:wool", "default:torch", "cottages:wool"},
  1574. { "", "group:stick", ""},
  1575. { "", "stairs:slab_wood", "" },
  1576. },
  1577. })
  1578. minetest.register_craft({
  1579. output = "homedecor:table_lamp_hi",
  1580. recipe = {
  1581. { "wool:white", "default:torch", "wool:white"},
  1582. { "", "group:stick", ""},
  1583. { "", "moreblocks:slab_wood", "" },
  1584. },
  1585. })
  1586. minetest.register_craft({
  1587. output = "homedecor:table_lamp_hi",
  1588. recipe = {
  1589. { "cottages:wool", "default:torch", "cottages:wool"},
  1590. { "", "group:stick", ""},
  1591. { "", "moreblocks:slab_wood", "" },
  1592. },
  1593. })
  1594. unifieddyes.register_color_craft({
  1595. output = "homedecor:table_lamp_hi",
  1596. palette = "extended",
  1597. type = "shapeless",
  1598. neutral_node = "homedecor:table_lamp_hi",
  1599. recipe = {
  1600. "NEUTRAL_NODE",
  1601. "MAIN_DYE"
  1602. }
  1603. })
  1604. -- aliases
  1605. minetest.register_alias("chains:chain_top", "homedecor:chain_steel_top")
  1606. minetest.register_alias("chains:chain_top_brass", "homedecor:chain_brass_top")
  1607. minetest.register_alias("chains:chandelier", "homedecor:chandelier_steel")
  1608. minetest.register_alias("chains:chandelier_steel", "homedecor:chandelier_steel")
  1609. minetest.register_alias("chains:chandelier_brass", "homedecor:chandelier_brass")
  1610. minetest.register_alias("homedecor:glowlight_half", "homedecor:glowlight_half_14")
  1611. minetest.register_alias("homedecor:glowlight_half_max", "homedecor:glowlight_half_14")
  1612. minetest.register_alias("homedecor:glowlight_quarter", "homedecor:glowlight_quarter_14")
  1613. minetest.register_alias("homedecor:glowlight_quarter_max", "homedecor:glowlight_quarter_14")
  1614. minetest.register_alias("homedecor:glowlight_small_cube", "homedecor:glowlight_small_cube_14")
  1615. minetest.register_alias("homedecor:glowlight_small_cube_max", "homedecor:glowlight_small_cube_14")
  1616. minetest.register_alias("homedecor:plasma_lamp", "homedecor:plasma_lamp_14")
  1617. minetest.register_alias("homedecor:plasma_lamp_max", "homedecor:plasma_lamp_14")
  1618. minetest.register_alias("homedecor:ground_lantern", "homedecor:ground_lantern_14")
  1619. minetest.register_alias("homedecor:ground_lantern_max", "homedecor:ground_lantern_14")
  1620. minetest.register_alias("homedecor:hanging_lantern", "homedecor:hanging_lantern_14")
  1621. minetest.register_alias("homedecor:hanging_lantern_max", "homedecor:hanging_lantern_14")
  1622. minetest.register_alias("homedecor:ceiling_lantern", "homedecor:ceiling_lantern_14")
  1623. minetest.register_alias("homedecor:ceiling_lantern_max", "homedecor:ceiling_lantern_14")
  1624. minetest.register_alias("homedecor:lattice_lantern_large", "homedecor:lattice_lantern_large_14")
  1625. minetest.register_alias("homedecor:lattice_lantern_large_max", "homedecor:lattice_lantern_large_14")
  1626. minetest.register_alias("homedecor:lattice_lantern_small", "homedecor:lattice_lantern_small_14")
  1627. minetest.register_alias("homedecor:lattice_lantern_small_max", "homedecor:lattice_lantern_small_14")
  1628. minetest.register_alias("homedecor:desk_lamp", "homedecor:desk_lamp_14")
  1629. minetest.register_alias("homedecor:desk_lamp_max", "homedecor:desk_lamp_14")
  1630. minetest.register_alias("homedecor:ceiling_lamp", "homedecor:ceiling_lamp_14")
  1631. minetest.register_alias("homedecor:ceiling_lamp_max", "homedecor:ceiling_lamp_14")
  1632. minetest.register_alias("homedecor:table_lamp", "homedecor:table_lamp_14")
  1633. minetest.register_alias("homedecor:table_lamp_max", "homedecor:table_lamp_14")
  1634. minetest.register_alias("homedecor:standing_lamp", "homedecor:standing_lamp_14")
  1635. minetest.register_alias("homedecor:standing_lamp_max", "homedecor:standing_lamp_14")
  1636. minetest.register_alias("3dforniture:table_lamp", "homedecor:table_lamp_14")
  1637. minetest.register_alias("3dforniture:table_lamp_max", "homedecor:table_lamp_14")
  1638. minetest.register_alias("3dforniture:torch_wall", "homedecor:torch_wall")
  1639. minetest.register_alias("torch_wall", "homedecor:torch_wall")
  1640. minetest.register_alias("homedecor:plasma_ball", "homedecor:plasma_ball_on")
  1641. minetest.register_alias("homedecor:wall_lamp", "homedecor:wall_lamp_on")
  1642. minetest.register_alias("homedecor:rope_light_on_floor_0", "homedecor:rope_light_on_floor_off")
  1643. minetest.register_alias("homedecor:rope_light_on_floor_14", "homedecor:rope_light_on_floor_on")
  1644. minetest.register_alias("homedecor:rope_light_on_ceiling_0", "homedecor:rope_light_on_ceiling_off")
  1645. minetest.register_alias("homedecor:rope_light_on_ceiling_14", "homedecor:rope_light_on_ceiling_on")
  1646. for name, level in pairs(word_to_bright) do
  1647. minetest.register_alias("homedecor:glowlight_half_"..name, "homedecor:glowlight_half_"..level)
  1648. minetest.register_alias("homedecor:glowlight_quarter_"..name, "homedecor:glowlight_quarter_"..level)
  1649. minetest.register_alias("homedecor:glowlight_small_cube_"..name, "homedecor:glowlight_small_cube_"..level)
  1650. minetest.register_alias("homedecor:rope_light_on_floor_"..name, "homedecor:rope_light_on_floor_"..level)
  1651. minetest.register_alias("homedecor:rope_light_on_ceiling_"..name, "homedecor:rope_light_on_ceiling_"..level)
  1652. minetest.register_alias("homedecor:plasma_lamp_"..name, "homedecor:plasma_lamp_"..level)
  1653. minetest.register_alias("homedecor:plasma_ball_"..name, "homedecor:plasma_ball_"..level)
  1654. minetest.register_alias("homedecor:ground_lantern_"..name, "homedecor:ground_lantern_"..level)
  1655. minetest.register_alias("homedecor:hanging_lantern_"..name, "homedecor:hanging_lantern_"..level)
  1656. minetest.register_alias("homedecor:ceiling_lantern_"..name, "homedecor:ceiling_lantern_"..level)
  1657. minetest.register_alias("homedecor:lattice_lantern_large_"..name, "homedecor:lattice_lantern_large_"..level)
  1658. minetest.register_alias("homedecor:lattice_lantern_small_"..name, "homedecor:lattice_lantern_small_"..level)
  1659. minetest.register_alias("homedecor:desk_lamp_"..name, "homedecor:desk_lamp_"..level)
  1660. minetest.register_alias("homedecor:ceiling_lamp_"..name, "homedecor:ceiling_lamp_"..level)
  1661. minetest.register_alias("homedecor:table_lamp_"..name, "homedecor:table_lamp_"..level)
  1662. minetest.register_alias("homedecor:standing_lamp_"..name, "homedecor:standing_lamp_"..level)
  1663. minetest.register_alias("3dforniture:table_lamp_"..name, "homedecor:table_lamp_"..level)
  1664. end
  1665. if minetest.get_modpath("darkage") then
  1666. minetest.register_alias("homedecor:lattice_lantern_large", "darkage:lamp")
  1667. for n = 0, 14 do
  1668. minetest.register_alias("homedecor:lattice_lantern_large_"..n, "darkage:lamp")
  1669. end
  1670. for name, level in pairs(word_to_bright) do
  1671. minetest.register_alias("homedecor:lattice_lantern_large_"..name, "darkage:lamp")
  1672. end
  1673. end