-- =================================================================== local modname = minetest.get_current_modname() local modpath = minetest.get_modpath (modname) local modprefix = modname .. ":" local neednode local fromnode -- =================================================================== xmasdecor.register_alias_node = function (foo, bar) if minetest.registered_nodes [foo] == nil and minetest.registered_nodes [bar] ~= nil then minetest.register_alias (foo, bar) end end -- =================================================================== xmasdecor.register_alias_craft = function (foo, bar) if minetest.registered_items [foo] == nil and minetest.registered_items [bar] ~= nil then minetest.register_alias (foo, bar) end end -- =================================================================== xmasdecor.register_node = function (name, params) if ocutil.starts_with (name, ":") then name = string.gsub (name, ":", "", 1) end ocutil.safe_register_node (name, params) local oldname = name:gsub ("xmasdecor:", "christmas_decor:") if oldname ~= name then default.convert_node (oldname, name) end end -- =================================================================== xmasdecor.register_craftitem = function (name, params) if ocutil.starts_with (name, ":") then name = string.gsub (name, ":", "", 1) end ocutil.safe_register_item (name, params) local oldname = name:gsub ("xmasdecor:", "christmas_decor:") if oldname ~= name then xmasdecor.register_alias_craft (oldname, name) end end -- =================================================================== local function register_lights (desc, nodename, aspect, length, def, craftitem, original_def) local fullnode = "xmasdecor:lights_" .. nodename local pngbase = "xmasdecor_lights_" .. nodename .. ".png" local invbase = "xmasdecor_inv_lights_" .. nodename .. ".png" xmasdecor.register_node (":" .. fullnode, { description = desc .. " Christmas Lights" , tiles = { { image = pngbase , backface_culling = false , animation = { type = "vertical_frames" , aspect_w = aspect , aspect_h = aspect , length = length , } , } }, inventory_image = invbase , wield_image = invbase , sunlight_propagates = true, walkable = false, climbable = false, is_ground_content = false, selection_box = { type = "wallmounted", }, legacy_wallmounted = true, use_texture_alpha = true, drawtype = "signlike", paramtype = "light", light_source = 10, paramtype2 = "wallmounted", groups = {snappy = 3}, sounds = default.node_sound_leaves_defaults(), }) xpanes.register_pane ("lights_"..nodename.."_pane", { description = desc.." Christmas Lights (pane)" , textures = { { image = pngbase .. "^[transformFX" , backface_culling = false, animation = { type = "vertical_frames" , aspect_w = aspect , aspect_h = aspect , length = length , } , } , { image = pngbase .. "^[transformFX", backface_culling = false, animation = { type = "vertical_frames" , aspect_w = aspect , aspect_h = aspect , length = length , }, }, "xpanes_space.png" }, use_texture_alpha = true, groups = {snappy = 3}, sounds = default.node_sound_leaves_defaults(), recipe = { { fullnode , fullnode , fullnode } , { fullnode , fullnode , fullnode } , } }) local tileFX = { name = pngbase .. "^[transformFX", backface_culling = false, animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3 } } local tile = { name = pngbase, backface_culling = false, animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3 } } for i = 1, 15 do minetest.override_item ("xpanes:lights_" .. nodename .. "_pane_" .. i, { tiles = { "xpanes_space.png", "xpanes_space.png", tile, tile, tileFX, tile }, sunlight_propagates = true, walkable = false, light_source = 10, }) end minetest.override_item("xpanes:lights_"..nodename.."_pane", { tiles = { "xpanes_space.png", "xpanes_space.png", tile, tile, tileFX, tile }, sunlight_propagates = true, walkable = false, light_source = 10, }) minetest.override_item("xpanes:lights_"..nodename.."_pane_flat", { tiles = { "xpanes_space.png", "xpanes_space.png", tile, tile, tileFX, tile }, sunlight_propagates = true, walkable = false, light_source = 10, }) minetest.register_craft ({ output = "xpanes:lights_" .. nodename .. "_pane_flat 6", recipe = { { fullnode, fullnode, fullnode }, { fullnode, fullnode, fullnode } } }) end if false then register_lights("White", "white", 16, 6) end register_lights("White Icicle", "white_icicle", 16, 6) register_lights("Multicolor", "multicolor", 16, 6) register_lights("Multicolor Bulb", "multicolor_bulb", 8, 3) -- =================================================================== neednode = "xmasdecor:frosting_block" if minetest.registered_nodes [neednode] == nil then xmasdecor.register_node (":" .. neednode, { description = "Frosting Block", tiles = {"xmasdecor_frosting.png"}, paramtype2 = "facedir", groups = {snappy = 3}, sounds = default.node_sound_leaves_defaults(), }) end -- =================================================================== neednode = "xmasdecor:lights_white" if minetest.registered_nodes [neednode] == nil then xmasdecor.register_node (":" .. neednode, { description = "christmas Wall lights", drawtype = "signlike", light_source = 10, walkable = false, tiles = { "coderblocks_xmaswhite.png" } , inventory_image = "coderblocks_xmaswhite.png", wield_image = "coderblocks_xmaswhite.png", paramtype = "light", paramtype2 = "wallmounted", selection_box = { type = "wallmounted", }, groups = {oddly_breakable_by_hand = 3}, }) end -- =================================================================== neednode = "xmasdecor:icicles_wall" if minetest.registered_nodes [neednode] == nil then xmasdecor.register_node (":" .. neednode, { description = "Icicles", drawtype = "signlike", light_source = 3, walkable = false, tiles = { "coderblocks_icicles.png" } , inventory_image = "coderblocks_icicles.png", wield_image = "coderblocks_icicles.png", paramtype = "light", paramtype2 = "wallmounted", selection_box = { type = "wallmounted", }, groups = {oddly_breakable_by_hand = 3}, }) end -- =================================================================== neednode = "xmasdecor:snowman" fromnode = "christmas_craft:snowman" if minetest.registered_nodes [neednode] == nil and minetest.registered_nodes [fromnode] ~= nil then xmasdecor.register_node (":" .. neednode, { description = "Snowman", tiles = { "default_snow.png" , "ccsnowman.png" , "ccsnowman.png" , "ccsnowman.png" , "ccsnowman.png" , "ccsnowman.png" , }, is_ground_content = true, paramtype2 = "facedir", groups = {crumbly=3}, sounds = default.node_sound_sand_defaults(), }) end -- =================================================================== neednode = "stairs:slope_frosting_block" fromnode = "xmasdecor:frosting_block" if minetest.registered_nodes [neednode] == nil and minetest.registered_nodes [fromnode] ~= nil then local xyz = 1 if true then stairs.register_all ("frosting_block" , fromnode , { snappy=3 } , { "xmasdecor_frosting.png" } , "Frosting Block" , default.node_sound_leaves_defaults()) end end -- Candycane Blocks xmasdecor.register_node (":xmasdecor:candycane_block", { description = "Candycane Block", tiles = { "xmasdecor_candycane_block.png" , "xmasdecor_candycane_block.png" , "xmasdecor_candycane_block.png" , "xmasdecor_candycane_block.png" , "xmasdecor_candycane_block.png^[transformFX" , "xmasdecor_candycane_block.png^[transformFX" , } , paramtype2 = "facedir", groups = {snappy = 3}, sounds = default.node_sound_stone_defaults(), }) xmasdecor.register_node (":xmasdecor:peppermint_block" , { description = "Peppermint Block" , tiles = { "xmasdecor_peppermint_block.png" , "xmasdecor_peppermint_block.png" , "xmasdecor_peppermint_block.png" , "xmasdecor_peppermint_block.png" , "xmasdecor_peppermint_block.png^[transformFX" , "xmasdecor_peppermint_block.png^[transformFX" , } , paramtype2 = "facedir" , groups = { snappy = 3 } , sounds = default.node_sound_stone_defaults() , }) if true then stairs.register_all ("candycane", "xmasdecor:candycane_block" , { snappy=3 } , { "xmasdecor_candycane_block.png" , "xmasdecor_candycane_block.png" , "xmasdecor_candycane_block.png" , "xmasdecor_candycane_block.png" , "xmasdecor_candycane_block.png^[transformFX" , "xmasdecor_candycane_block.png^[transformFX" , } , "Candycane", stairs.stone) end xmasdecor.register_node (":xmasdecor:candycane", { description = "Candycane (placeable)", drawtype = "mesh", mesh = "xmasdecor_candycane.obj", tiles = {"xmasdecor_candycane.png"}, inventory_image = "xmasdecor_inv_candycane.png", walkable = true, selection_box = { type = "fixed", fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}, }, collision_box = { type = "fixed", fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}, }, paramtype = "light", sunlight_propagates = true, paramtype2 = "facedir", groups = {snappy = 3}, sounds = default.node_sound_stone_defaults(), }) -- Garland xmasdecor.register_node (":xmasdecor:garland", { description = "Garland", tiles = {"xmasdecor_garland.png"}, inventory_image = "xmasdecor_garland.png", wield_image = "xmasdecor_garland.png", sunlight_propagates = true, light_source = 10, walkable = false, climbable = false, is_ground_content = false, selection_box = { type = "wallmounted", }, legacy_wallmounted = true, use_texture_alpha = true, drawtype = "signlike", paramtype = "light", paramtype2 = "wallmounted", groups = {snappy = 3}, sounds = default.node_sound_leaves_defaults(), }) xmasdecor.register_node (":xmasdecor:garland_lights", { description = "Garland with Lights", tiles = { { image = "xmasdecor_garland_lights.png", backface_culling = false, animation = { type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 16 }, } }, inventory_image = "xmasdecor_inv_garland_lights.png", wield_image = "xmasdecor_inv_garland_lights.png", sunlight_propagates = true, walkable = false, climbable = false, is_ground_content = false, selection_box = { type = "wallmounted", }, legacy_wallmounted = true, use_texture_alpha = true, drawtype = "signlike", paramtype = "light", light_source = 8, paramtype2 = "wallmounted", groups = {snappy = 3}, sounds = default.node_sound_leaves_defaults(), }) minetest.register_craft({ output = "xmasdecor:garland 3", recipe = { { "default:pine_needles" , "default:pine_needles" , "default:pine_needles" , } , }, }) minetest.register_craft({ output = "xmasdecor:garland_lights", type = "shapeless", recipe = {"xmasdecor:garland", "xmasdecor:led_white", "xmasdecor:led_white", "xmasdecor:led_white"}, }) -- Lights xmasdecor.register_craftitem (":xmasdecor:led_rgb", { description = "RGB Led Light", inventory_image = "xmasdecor_led_rgb.png", }) xmasdecor.register_craftitem (":xmasdecor:led_white", { description = "White Led Light", inventory_image = "xmasdecor_led_white.png", }) minetest.register_craft ({ output = "xmasdecor:led_rgb", type = "shapeless", recipe = {"xmasdecor:led_white", "dye:green", "dye:blue", "dye:red"}, }) minetest.register_craft({ output = "xmasdecor:led_white 8", recipe = { {"default:glass"}, {"homedecor:power_crystal"}, {"homedecor:plastic_sheeting"}, }, }) xmasdecor.register_craftitem (":xmasdecor:wire", { description = "Wire", inventory_image = "xmasdecor_wire.png", }) minetest.register_craft ({ output = "xmasdecor:wire 16", recipe = { {"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting"}, {"homedecor:copper_strip", "homedecor:copper_strip", "homedecor:copper_strip"}, {"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting"}, }, }) minetest.register_craft({ output = "xmasdecor:lights_white 6", recipe = { {"xmasdecor:led_white", "xmasdecor:led_white", "xmasdecor:led_white"}, {"xmasdecor:wire", "xmasdecor:wire", "xmasdecor:wire"}, {"xmasdecor:led_white", "xmasdecor:led_white", "xmasdecor:led_white"}, }, }) minetest.register_craft({ output = "xmasdecor:lights_white_icicle 6", recipe = { {"xmasdecor:wire", "xmasdecor:wire", "xmasdecor:wire"}, {"xmasdecor:led_white", "xmasdecor:led_white", "xmasdecor:led_white"}, {"xmasdecor:led_white", "xmasdecor:led_white", "xmasdecor:led_white"}, }, }) minetest.register_craft({ output = "xmasdecor:lights_multicolor 6", recipe = { {"xmasdecor:led_rgb", "xmasdecor:led_rgb", "xmasdecor:led_rgb"}, {"xmasdecor:wire", "xmasdecor:wire", "xmasdecor:wire"}, {"xmasdecor:led_rgb", "xmasdecor:led_rgb", "xmasdecor:led_rgb"}, }, }) minetest.register_craft({ output = "xmasdecor:lights_multicolor_bulb 6", recipe = { {"xmasdecor:led_rgb", "default:glass", "xmasdecor:led_rgb"}, {"xmasdecor:wire", "xmasdecor:wire", "xmasdecor:wire"}, {"xmasdecor:led_rgb", "default:glass", "xmasdecor:led_rgb"}, }, }) -- Mistletoe xmasdecor.register_node (":xmasdecor:mistletoe", { description = "Mistletoe", tiles = {"xmasdecor_mistletoe.png"}, drawtype = "plantlike", walkable = false, sunlight_propagats = true, use_texture_alpha = true, groups = {snappy = 3}, sounds = default.node_sound_leaves_defaults(), }) minetest.register_craft({ output = "xmasdecor:mistletoe", type = "shapeless", recipe = {"default:leaves", "default:leaves", "dye:red"}, }) local nutcracker_placeholder = { description = "Decoration" , tiles = { "wool_blue.png" } , groups = { oddly_breakable_by_hand=1 } , drawtype = "nodebox" , paramtype = "light" , paramtype2 = "facedir" , node_box = { type = "fixed" , fixed = { { -0.2500, -0.3125, -0.2500, 0.2500, 0.1250, 0.5000 }, -- Body { -0.1875, -0.1250, -0.5000, 0.1875, 0.2500, -0.2500 }, -- Head { 0.1250, -0.5000, 0.2500, 0.2500, -0.3125, 0.4500 }, -- Leg { 0.1250, -0.5000, -0.1250, 0.2500, -0.3125, 0.0625 }, -- Leg { -0.2500, -0.5000, 0.2500, -0.1250, -0.3125, 0.4625 }, -- Leg { -0.2500, -0.5000, -0.1250, -0.1250, -0.3125, 0.0625 }, -- Leg } } } xmasdecor.register_node (":xmasdecor:nutcracker" , nutcracker_placeholder) xmasdecor.register_node (":xmasdecor:nutcracker_wall" , nutcracker_placeholder) xmasdecor.register_node (":statue:easter_bunny" , nutcracker_placeholder) dofile (modpath .. "/stocking.lua") xmasdecor.register_craftitem (":xmasdecor:cookiecutter", { description = "Cookie Cutter", inventory_image = "xmasdecor_cookie_cutter.png", }) xmasdecor.register_node (":xmasdecor:plate_with_cookies", { description = "Plate of Cookies", tiles = {"xmasdecor_plate_top.png"}, inventory_image = "xmasdecor_plate_top.png", wield_imagte = "xmasdecor_plate_top.png", sunlight_propagates = true, walkable = false, climbable = false, is_ground_content = false, selection_box = { type = "wallmounted", }, legacy_wallmounted = true, use_texture_alpha = true, drawtype = "signlike", paramtype2 = "wallmounted", groups = {snappy = 3}, sounds = default.node_sound_glass_defaults(), }) -- =================================================================== -- End of file.