Skip to content

Instantly share code, notes, and snippets.

@GreenXenith GreenXenith/init.lua Secret
Last active Nov 3, 2017

Embed
What would you like to do?
-- Lights
local function register_lights(desc, nodename, aspect, length, def, original_def)
minetest.register_node("christmas_decor:lights_"..nodename, {
description = desc.." Christmas Lights",
tiles = {
{
image = "lights_"..nodename..".png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = aspect,
aspect_h = aspect,
length = length
},
}
},
inventory_image = "inv_lights_"..nodename..".png",
wield_image = "inv_lights_"..nodename..".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 = 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 = "lights_"..nodename..".png^[transformFX",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = aspect,
aspect_h = aspect,
length = length
},
},
{
image = "lights_"..nodename..".png^[transformFX",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = aspect,
aspect_h = aspect,
length = length
},
}, "xpanes_space.png"
},
-- inventory_image = "inv_lights_"..nodename..".png",
-- wield_image = "inv_lights_"..nodename..".png",
use_texture_alpha = true,
groups = {snappy = 3},
sounds = default.node_sound_leaves_defaults(),
recipe = {
{"christmas_decor:lights_"..nodename, "christmas_decor:lights_"..nodename, "christmas_decor:lights_"..nodename},
{"christmas_decor:lights_"..nodename, "christmas_decor:lights_"..nodename, "christmas_decor:lights_"..nodename}
}
})
local def = {
minetest.registered_nodes[name],
}
tiles = def.textures
for i = 1, 15 do
minetest.override_item("xpanes:lights_" .. nodename .. "_pane_" .. i, {
--[[ tiles = {
{
image = "lights_"..nodename..".png^[transformFX",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = aspect,
aspect_h = aspect,
length = length
},
}, def.textures[3], def.textures[1]},]]
--[[ tiles = {
{
image = "lights_"..nodename..".png^",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = aspect,
aspect_h = aspect,
length = length
},
},
{
image = "lights_"..nodename..".png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = aspect,
aspect_h = aspect,
length = length
},
}, "xpanes_space.png"
},]]
sunlight_propagates = true,
walkable = false,
light_source = 10,
})
end
minetest.override_item("xpanes:lights_"..nodename.."_pane", {
--[[ tiles = {
{
image = "lights_"..nodename..".png^[transformFX",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = aspect,
aspect_h = aspect,
length = length
},
},
{
image = "lights_"..nodename..".png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = aspect,
aspect_h = aspect,
length = length
},
}, "xpanes_space.png"
},]]
sunlight_propagates = true,
walkable = false,
light_source = 10,
})
minetest.override_item("xpanes:lights_"..nodename.."_pane_flat", {
tiles = {
{
image = "lights_"..nodename..".png^[transformFX",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = aspect,
aspect_h = aspect,
length = length
},
},
{
image = "lights_"..nodename..".png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = aspect,
aspect_h = aspect,
length = length
},
}, "xpanes_space.png"
},
sunlight_propagates = true,
walkable = false,
light_source = 10,
})
minetest.register_craft({
output = "xpanes:lights_" .. nodename .. "_pane_flat 6",
recipe = {
{"christmas_decor:lights_"..nodename, "christmas_decor:lights_"..nodename, "christmas_decor:lights_"..nodename},
{"christmas_decor:lights_"..nodename, "christmas_decor:lights_"..nodename, "christmas_decor:lights_"..nodename}
}
})
end
register_lights("White", "white", 16, 6)
register_lights("White Icicle", "white_icicle", 16, 6)
register_lights("Multicolor", "multicolor", 16, 6)
register_lights("Multicolor Bulb", "multicolor_bulb", 8, 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.