mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2024-12-23 00:20:17 +01:00
e4c02a82d6
related functions to use homedecor: and lib_6d: namespaces, as necessary, instead of simple "homedecor_" name prefixes.
294 lines
8.9 KiB
Lua
294 lines
8.9 KiB
Lua
|
|
-- This file supplies glowlights
|
|
|
|
-- Boilerplate to support localized strings if intllib mod is installed.
|
|
local S
|
|
if homedecor.intllib_modpath then
|
|
dofile(homedecor.intllib_modpath.."/intllib.lua")
|
|
S = intllib.Getter(minetest.get_current_modname())
|
|
else
|
|
S = function ( s ) return s end
|
|
end
|
|
|
|
local colors = {"yellow","white"}
|
|
|
|
for i in ipairs(colors) do
|
|
local color = colors[i]
|
|
|
|
minetest.register_abm({
|
|
nodenames = { "homedecor:glowlight_thin_"..color },
|
|
interval = 1,
|
|
chance = 1,
|
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
minetest.add_node(pos, {name = "homedecor:glowlight_quarter_"..color, param2 = 20})
|
|
end,
|
|
})
|
|
|
|
minetest.register_abm({
|
|
nodenames = { "homedecor:glowlight_thick_"..color },
|
|
interval = 1,
|
|
chance = 1,
|
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
minetest.add_node(pos, {name = "homedecor:glowlight_half_"..color, param2 = 20})
|
|
end,
|
|
})
|
|
|
|
minetest.register_abm({
|
|
nodenames = { "homedecor:glowlight_thin_"..color.."_wall" },
|
|
interval = 1,
|
|
chance = 1,
|
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
local fdir = node.param2 or 0
|
|
nfdir = dirs2[fdir+1]
|
|
minetest.add_node(pos, {name = "homedecor:glowlight_quarter_"..color, param2 = nfdir})
|
|
end,
|
|
})
|
|
|
|
minetest.register_abm({
|
|
nodenames = { "homedecor:glowlight_thick_"..color.."_wall" },
|
|
interval = 1,
|
|
chance = 1,
|
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
local fdir = node.param2 or 0
|
|
nfdir = dirs2[fdir+1]
|
|
minetest.add_node(pos, {name = "homedecor:glowlight_half_"..color, param2 = nfdir})
|
|
end,
|
|
})
|
|
|
|
minetest.register_abm({
|
|
nodenames = { "homedecor:glowlight_small_cube_"..color.."_ceiling" },
|
|
interval = 1,
|
|
chance = 1,
|
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
minetest.add_node(pos, {name = "homedecor:glowlight_small_cube_"..color, param2 = 20})
|
|
end,
|
|
})
|
|
end
|
|
|
|
-- Yellow
|
|
|
|
minetest.register_node('homedecor:glowlight_half_yellow', {
|
|
description = S("Yellow Glowlight (thick)"),
|
|
drawtype = "nodebox",
|
|
tiles = {
|
|
'homedecor_glowlight_yellow_top.png',
|
|
'homedecor_glowlight_yellow_bottom.png',
|
|
'homedecor_glowlight_thick_yellow_sides.png',
|
|
'homedecor_glowlight_thick_yellow_sides.png',
|
|
'homedecor_glowlight_thick_yellow_sides.png',
|
|
'homedecor_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,
|
|
paramtype = "light",
|
|
paramtype2 = "facedir",
|
|
walkable = true,
|
|
groups = { snappy = 3 },
|
|
light_source = LIGHT_MAX,
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
on_place = function(itemstack, placer, pointed_thing)
|
|
if not homedecor:node_is_owned(pointed_thing.under, placer)
|
|
and not homedecor:node_is_owned(pointed_thing.above, placer) then
|
|
lib_6d:rotate_and_place(itemstack, placer, pointed_thing, homedecor.expect_infinite_stacks)
|
|
end
|
|
return itemstack
|
|
end
|
|
})
|
|
|
|
minetest.register_node('homedecor:glowlight_quarter_yellow', {
|
|
description = S("Yellow Glowlight (thin)"),
|
|
drawtype = "nodebox",
|
|
tiles = {
|
|
'homedecor_glowlight_yellow_top.png',
|
|
'homedecor_glowlight_yellow_bottom.png',
|
|
'homedecor_glowlight_thin_yellow_sides.png',
|
|
'homedecor_glowlight_thin_yellow_sides.png',
|
|
'homedecor_glowlight_thin_yellow_sides.png',
|
|
'homedecor_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,
|
|
paramtype = "light",
|
|
paramtype2 = "facedir",
|
|
walkable = true,
|
|
groups = { snappy = 3 },
|
|
light_source = LIGHT_MAX-1,
|
|
sounds = default.node_sound_wood_defaults(),
|
|
on_place = function(itemstack, placer, pointed_thing)
|
|
if not homedecor:node_is_owned(pointed_thing.under, placer)
|
|
and not homedecor:node_is_owned(pointed_thing.above, placer) then
|
|
lib_6d:rotate_and_place(itemstack, placer, pointed_thing, homedecor.expect_infinite_stacks)
|
|
end
|
|
return itemstack
|
|
end
|
|
})
|
|
|
|
|
|
|
|
-- White
|
|
|
|
minetest.register_node('homedecor:glowlight_half_white', {
|
|
description = S("White Glowlight (thick)"),
|
|
drawtype = "nodebox",
|
|
tiles = {
|
|
'homedecor_glowlight_white_top.png',
|
|
'homedecor_glowlight_white_bottom.png',
|
|
'homedecor_glowlight_thick_white_sides.png',
|
|
'homedecor_glowlight_thick_white_sides.png',
|
|
'homedecor_glowlight_thick_white_sides.png',
|
|
'homedecor_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 = LIGHT_MAX,
|
|
sounds = default.node_sound_wood_defaults(),
|
|
on_place = function(itemstack, placer, pointed_thing)
|
|
if not homedecor:node_is_owned(pointed_thing.under, placer)
|
|
and not homedecor:node_is_owned(pointed_thing.above, placer) then
|
|
lib_6d:rotate_and_place(itemstack, placer, pointed_thing, homedecor.expect_infinite_stacks)
|
|
end
|
|
return itemstack
|
|
end
|
|
})
|
|
|
|
minetest.register_node('homedecor:glowlight_quarter_white', {
|
|
description = S("White Glowlight (thin)"),
|
|
drawtype = "nodebox",
|
|
tiles = {
|
|
'homedecor_glowlight_white_top.png',
|
|
'homedecor_glowlight_white_bottom.png',
|
|
'homedecor_glowlight_thin_white_sides.png',
|
|
'homedecor_glowlight_thin_white_sides.png',
|
|
'homedecor_glowlight_thin_white_sides.png',
|
|
'homedecor_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 = LIGHT_MAX-1,
|
|
sounds = default.node_sound_wood_defaults(),
|
|
on_place = function(itemstack, placer, pointed_thing)
|
|
if not homedecor:node_is_owned(pointed_thing.under, placer)
|
|
and not homedecor:node_is_owned(pointed_thing.above, placer) then
|
|
lib_6d:rotate_and_place(itemstack, placer, pointed_thing, homedecor.expect_infinite_stacks)
|
|
end
|
|
return itemstack
|
|
end
|
|
})
|
|
|
|
-- Glowlight "cubes"
|
|
|
|
minetest.register_node('homedecor:glowlight_small_cube_yellow', {
|
|
description = S("Yellow Glowlight (small cube)"),
|
|
drawtype = "nodebox",
|
|
tiles = {
|
|
'homedecor_glowlight_cube_yellow_tb.png',
|
|
'homedecor_glowlight_cube_yellow_tb.png',
|
|
'homedecor_glowlight_cube_yellow_sides.png',
|
|
'homedecor_glowlight_cube_yellow_sides.png',
|
|
'homedecor_glowlight_cube_yellow_sides.png',
|
|
'homedecor_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 = LIGHT_MAX-1,
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
on_place = function(itemstack, placer, pointed_thing)
|
|
if not homedecor:node_is_owned(pointed_thing.under, placer)
|
|
and not homedecor:node_is_owned(pointed_thing.above, placer) then
|
|
lib_6d:rotate_and_place(itemstack, placer, pointed_thing, homedecor.expect_infinite_stacks)
|
|
end
|
|
return itemstack
|
|
end
|
|
})
|
|
|
|
minetest.register_node('homedecor:glowlight_small_cube_white', {
|
|
description = S("White Glowlight (small cube)"),
|
|
drawtype = "nodebox",
|
|
tiles = {
|
|
'homedecor_glowlight_cube_white_tb.png',
|
|
'homedecor_glowlight_cube_white_tb.png',
|
|
'homedecor_glowlight_cube_white_sides.png',
|
|
'homedecor_glowlight_cube_white_sides.png',
|
|
'homedecor_glowlight_cube_white_sides.png',
|
|
'homedecor_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 = LIGHT_MAX-1,
|
|
sounds = default.node_sound_wood_defaults(),
|
|
on_place = function(itemstack, placer, pointed_thing)
|
|
if not homedecor:node_is_owned(pointed_thing.under, placer)
|
|
and not homedecor:node_is_owned(pointed_thing.above, placer) then
|
|
lib_6d:rotate_and_place(itemstack, placer, pointed_thing, homedecor.expect_infinite_stacks)
|
|
end
|
|
return itemstack
|
|
end
|
|
})
|
|
|