-- =================================================================== -- This file provides replacements for multiple types of Home Decor -- glowlights (including types that are missing from newer releases of -- Home Decor). -- ABMs in this file and/or related aliases in the "ocfixups" mod are -- used to replace missing Home Decor "glowlight" nodes. -- =================================================================== local reg_node = ocutil.safe_register_node -- =================================================================== local dirs1 = { 20, 23, 22, 21 } local dirs2 = { 9, 18, 7, 12 } local colors = { "yellow", "white" } -- =================================================================== -- This loop defines 5 ABMs that convert these 10 cases: -- -- homedecor:glowlight_{thick,thin}_{white,yellow} -- homedecor:glowlight_{thick,thin}_{white,yellow}_wall -- homedecor:glowlight_small_cube_{white,yellow}_ceiling for i in ipairs (colors) do local color = colors [i] -- =================================================================== minetest.register_abm ({ nodenames = { "homedecor:glowlight_thin_" .. color } , catch_up = false , chance = 1 , interval = 1 , action = function (pos, node, active_object_count, active_object_count_wider) minetest.add_node (pos, { name = "coderblocks:glowlight_quarter_" .. color , param2 = 20 }) end , }) -- =================================================================== minetest.register_abm ({ nodenames = { "homedecor:glowlight_thick_" .. color } , catch_up = false , chance = 1 , interval = 1 , action = function (pos, node, active_object_count, active_object_count_wider) minetest.add_node (pos, { name = "coderblocks:glowlight_half_" .. color , param2 = 20 }) end , }) -- =================================================================== minetest.register_abm ({ nodenames = { "homedecor:glowlight_thin_" .. color .. "_wall" } , catch_up = false , chance = 1 , interval = 1 , action = function (pos, node, active_object_count, active_object_count_wider) local fdir = node.param2 or 0 minetest.add_node (pos, { name = "coderblocks:glowlight_quarter_" .. color , param2 = dirs2 [fdir + 1] }) end , }) -- =================================================================== minetest.register_abm ({ nodenames = { "homedecor:glowlight_thick_" .. color .. "_wall" } , catch_up = false , chance = 1, interval = 1, action = function (pos, node, active_object_count, active_object_count_wider) local fdir = node.param2 or 0 minetest.add_node (pos, { name = "coderblocks:glowlight_half_" .. color , param2 = dirs2 [fdir + 1] }) end , }) -- =================================================================== minetest.register_abm ({ nodenames = { "homedecor:glowlight_small_cube_" .. color .. "_ceiling" } , catch_up = false , chance = 1 , interval = 1 , action = function (pos, node, active_object_count, active_object_count_wider) minetest.add_node (pos, { name = "coderblocks:glowlight_small_cube_" .. color , param2 = 20 }) end , }) end -- =================================================================== -- Yellow reg_node ("coderblocks:glowlight_half_yellow", { description = "Yellow Glowlight (thick)" , drawtype = "nodebox" , paramtype = "light" , paramtype2 = "facedir" , walkable = true , groups = { snappy = 3 } , light_source = default.LIGHT_MAX - 1 , sounds = default.sound_wood() , on_place = minetest.rotate_node , tiles = { "coderblocks_glowlight_yellow_top.png" , "coderblocks_glowlight_yellow_bottom.png" , "coderblocks_glowlight_thick_yellow_sides.png" , "coderblocks_glowlight_thick_yellow_sides.png" , "coderblocks_glowlight_thick_yellow_sides.png" , "coderblocks_glowlight_thick_yellow_sides.png" , } , selection_box = { type = "fixed" , fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 } } , node_box = { type = "fixed" , fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 } } , sunlight_propagates = false , }) -- =================================================================== reg_node ("coderblocks:glowlight_quarter_yellow", { description = "Yellow Glowlight (thin)" , drawtype = "nodebox" , paramtype = "light" , paramtype2 = "facedir" , walkable = true , groups = { snappy = 3 } , light_source = default.LIGHT_MAX - 1 , sounds = default.sound_wood() , on_place = minetest.rotate_node , tiles = { "coderblocks_glowlight_yellow_top.png" , "coderblocks_glowlight_yellow_bottom.png" , "coderblocks_glowlight_thin_yellow_sides.png" , "coderblocks_glowlight_thin_yellow_sides.png" , "coderblocks_glowlight_thin_yellow_sides.png" , "coderblocks_glowlight_thin_yellow_sides.png" , } , selection_box = { type = "fixed" , fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 } } , node_box = { type = "fixed" , fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 } } , sunlight_propagates = false , }) -- =================================================================== -- White reg_node ("coderblocks:glowlight_half_white", { description = "White Glowlight (thick)" , drawtype = "nodebox", tiles = { "coderblocks_glowlight_white_top.png" , "coderblocks_glowlight_white_bottom.png" , "coderblocks_glowlight_thick_white_sides.png" , "coderblocks_glowlight_thick_white_sides.png" , "coderblocks_glowlight_thick_white_sides.png" , "coderblocks_glowlight_thick_white_sides.png" , } , selection_box = { type = "fixed", fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 } } , node_box = { type = "fixed", fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 } } , sunlight_propagates = false, paramtype = "light", paramtype2 = "facedir", walkable = true, groups = { snappy = 3 } , light_source = default.LIGHT_MAX - 1, sounds = default.node_sound_wood_defaults(), on_place = minetest.rotate_node }) -- =================================================================== reg_node ("coderblocks:glowlight_quarter_white", { description = "White Glowlight (thin)" , drawtype = "nodebox", tiles = { "coderblocks_glowlight_white_top.png" , "coderblocks_glowlight_white_bottom.png" , "coderblocks_glowlight_thin_white_sides.png" , "coderblocks_glowlight_thin_white_sides.png" , "coderblocks_glowlight_thin_white_sides.png" , "coderblocks_glowlight_thin_white_sides.png" , } , selection_box = { type = "fixed", fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 } } , node_box = { type = "fixed", fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 } } , sunlight_propagates = false, paramtype = "light", paramtype2 = "facedir", walkable = true, groups = { snappy = 3 } , light_source = default.LIGHT_MAX - 1, sounds = default.node_sound_wood_defaults(), on_place = minetest.rotate_node }) -- =================================================================== -- Glowlight "cubes" reg_node ("coderblocks:glowlight_small_cube_yellow", { description = "Yellow Glowlight (small cube)" , drawtype = "nodebox", tiles = { "coderblocks_glowlight_cube_yellow_tb.png" , "coderblocks_glowlight_cube_yellow_tb.png" , "coderblocks_glowlight_cube_yellow_sides.png" , "coderblocks_glowlight_cube_yellow_sides.png" , "coderblocks_glowlight_cube_yellow_sides.png" , "coderblocks_glowlight_cube_yellow_sides.png" , } , selection_box = { type = "fixed", fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 } } , node_box = { type = "fixed", fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 } } , sunlight_propagates = false, paramtype = "light", paramtype2 = "facedir", walkable = true, groups = { snappy = 3 } , light_source = default.LIGHT_MAX - 1, sounds = default.node_sound_wood_defaults(), on_place = minetest.rotate_node }) -- =================================================================== reg_node ("coderblocks:glowlight_small_cube_white", { description = "White Glowlight (small cube)" , drawtype = "nodebox", tiles = { "coderblocks_glowlight_cube_white_tb.png" , "coderblocks_glowlight_cube_white_tb.png" , "coderblocks_glowlight_cube_white_sides.png" , "coderblocks_glowlight_cube_white_sides.png" , "coderblocks_glowlight_cube_white_sides.png" , "coderblocks_glowlight_cube_white_sides.png" , } , selection_box = { type = "fixed", fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 } } , node_box = { type = "fixed", fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 } } , sunlight_propagates = false, paramtype = "light", paramtype2 = "facedir", walkable = true, groups = { snappy = 3 } , light_source = default.LIGHT_MAX - 1, sounds = default.node_sound_wood_defaults(), on_place = minetest.rotate_node }) -- =================================================================== local function slab_y (height, shift) return { -0.5 , -0.5 + (shift or 0) , -0.5 , 0.5 , -0.5 + height + (shift or 0) , 0.5 } end -- =================================================================== local glowlight_nodebox = { half = slab_y (1/2) , quarter = slab_y (1/4) , small_cube = { type = "fixed" , fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 } } , } -- =================================================================== reg_node ("coderblocks:glowlight_half", { description = "Thick Glowlight", tiles = { "coderblocks_glowlight_top.png" , "coderblocks_glowlight_bottom.png" , "coderblocks_glowlight_thick_sides.png" , "coderblocks_glowlight_thick_sides.png" , "coderblocks_glowlight_thick_sides.png" , "coderblocks_glowlight_thick_sides.png" , } , overlay_tiles = { { name = "coderblocks_glowlight_top_overlay.png", color = "white"} , "", { name = "coderblocks_glowlight_thick_sides_overlay.png", color = "white"} , { name = "coderblocks_glowlight_thick_sides_overlay.png", color = "white"} , { name = "coderblocks_glowlight_thick_sides_overlay.png", color = "white"} , { name = "coderblocks_glowlight_thick_sides_overlay.png", color = "white"} , } , use_texture_alpha = true, drawtype = "nodebox", paramtype = "light", paramtype2 = "colorwallmounted", palette = "unifieddyes_palette_colorwallmounted.png", selection_box = { type = "wallmounted", wall_top = { -0.5, 0, -0.5, 0.5, 0.5, 0.5 } , wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 } , wall_side = { -0.5, -0.5, -0.5, 0, 0.5, 0.5 } } , node_box = glowlight_nodebox.half, groups = { snappy = 3, ud_param2_colorable = 1 } , light_source = default.LIGHT_MAX, sounds = default.node_sound_glass_defaults(), after_place_node = function(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing) end , after_dig_node = unifieddyes.after_dig_node }) -- =================================================================== reg_node ("coderblocks:glowlight_quarter", { description = "Thin Glowlight", tiles = { "coderblocks_glowlight_top.png" , "coderblocks_glowlight_bottom.png" , "coderblocks_glowlight_thin_sides.png" , "coderblocks_glowlight_thin_sides.png" , "coderblocks_glowlight_thin_sides.png" , "coderblocks_glowlight_thin_sides.png" , } , overlay_tiles = { { name = "coderblocks_glowlight_top_overlay.png", color = "white"} , "", { name = "coderblocks_glowlight_thin_sides_overlay.png", color = "white"} , { name = "coderblocks_glowlight_thin_sides_overlay.png", color = "white"} , { name = "coderblocks_glowlight_thin_sides_overlay.png", color = "white"} , { name = "coderblocks_glowlight_thin_sides_overlay.png", color = "white"} , } , use_texture_alpha = true, drawtype = "nodebox", paramtype = "light", paramtype2 = "colorwallmounted", palette = "unifieddyes_palette_colorwallmounted.png", selection_box = { type = "wallmounted", wall_top = { -0.5, 0.25, -0.5, 0.5, 0.5, 0.5 } , wall_bottom = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 } , wall_side = { -0.5, -0.5, -0.5, -0.25, 0.5, 0.5 } } , node_box = glowlight_nodebox.quarter, groups = { snappy = 3, ud_param2_colorable = 1 } , light_source = default.LIGHT_MAX-1, sounds = default.node_sound_glass_defaults(), after_place_node = function(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing) end , after_dig_node = unifieddyes.after_dig_node }) -- =================================================================== -- End of file.