2020-08-05 01:21:08 +02:00
|
|
|
local S = minetest.get_translator("lavalamp")
|
2017-01-29 22:41:03 +01:00
|
|
|
|
2017-01-29 10:32:26 +01:00
|
|
|
lavalamp = {}
|
2015-04-15 06:12:34 +02:00
|
|
|
|
2017-01-29 10:32:26 +01:00
|
|
|
minetest.register_node("lavalamp:lavalamp", {
|
2019-05-03 18:06:43 +02:00
|
|
|
description = S("Lava Lamp/Light"),
|
2017-01-29 10:32:26 +01:00
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "lavalamp.obj",
|
|
|
|
tiles = {
|
2017-06-18 01:32:14 +02:00
|
|
|
{ name = "lavalamp_metal.png", color = "white" },
|
|
|
|
{ name = "lavalamp_lamp_liquid.png", color = "white" },
|
|
|
|
},
|
|
|
|
overlay_tiles = {
|
|
|
|
"",
|
2017-01-29 10:32:26 +01:00
|
|
|
{
|
|
|
|
name="lavalamp_lamp_anim.png",
|
|
|
|
animation={
|
|
|
|
type="vertical_frames",
|
|
|
|
aspect_w=40,
|
|
|
|
aspect_h=40,
|
|
|
|
length=6.0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2022-03-29 07:44:05 +02:00
|
|
|
use_texture_alpha = "blend",
|
2017-01-29 10:32:26 +01:00
|
|
|
inventory_image = "lavalamp_lamp_inv.png",
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "color",
|
2017-02-25 08:11:47 +01:00
|
|
|
palette = "unifieddyes_palette_extended.png",
|
2017-01-29 10:32:26 +01:00
|
|
|
sunlight_propagates = true,
|
|
|
|
walkable = false,
|
|
|
|
light_source = 14,
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = { -0.25, -0.5, -0.25, 0.25,0.5, 0.25 },
|
|
|
|
},
|
2022-11-30 23:48:28 +01:00
|
|
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, ud_param2_colorable = 1, axey=5},
|
|
|
|
_mcl_hardness=1.6,
|
2022-05-03 21:21:14 +02:00
|
|
|
_sound_def = {
|
|
|
|
key = "node_sound_glass_defaults",
|
|
|
|
},
|
2017-03-14 07:13:17 +01:00
|
|
|
on_construct = unifieddyes.on_construct,
|
2019-07-18 08:16:46 +02:00
|
|
|
on_dig = unifieddyes.on_dig,
|
2017-01-29 10:32:26 +01:00
|
|
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
2017-02-05 01:41:36 +01:00
|
|
|
node.name = "lavalamp:lavalamp_off"
|
|
|
|
minetest.swap_node(pos, node)
|
|
|
|
return itemstack
|
2017-01-29 10:32:26 +01:00
|
|
|
end
|
|
|
|
})
|
2015-04-15 06:12:34 +02:00
|
|
|
|
2017-01-29 10:32:26 +01:00
|
|
|
minetest.register_node("lavalamp:lavalamp_off", {
|
2019-05-03 18:06:43 +02:00
|
|
|
description = S("Lava Lamp/Light (off)"),
|
2017-01-29 10:32:26 +01:00
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "lavalamp.obj",
|
|
|
|
tiles = {
|
|
|
|
{ name = "lavalamp_metal.png", color = 0xffffffff },
|
|
|
|
"lavalamp_lamp_off.png",
|
|
|
|
},
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "color",
|
2017-02-25 08:11:47 +01:00
|
|
|
palette = "unifieddyes_palette_extended.png",
|
2017-01-29 10:32:26 +01:00
|
|
|
sunlight_propagates = true,
|
|
|
|
walkable = false,
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = { -0.25, -0.5, -0.25, 0.25,0.5, 0.25 },
|
|
|
|
},
|
2022-11-30 23:48:28 +01:00
|
|
|
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1, axey=5},
|
|
|
|
_mcl_hardness=1.6,
|
2022-05-03 21:21:14 +02:00
|
|
|
_sound_def = {
|
|
|
|
key = "node_sound_glass_defaults",
|
|
|
|
},
|
2017-03-14 07:13:17 +01:00
|
|
|
on_construct = unifieddyes.on_construct,
|
2017-01-29 10:32:26 +01:00
|
|
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
|
|
|
node.name = "lavalamp:lavalamp"
|
|
|
|
minetest.swap_node(pos, node)
|
|
|
|
return itemstack
|
|
|
|
end,
|
2018-08-22 11:08:48 +02:00
|
|
|
drop = {
|
|
|
|
items = {
|
|
|
|
{items = {"lavalamp:lavalamp"}, inherit_color = true },
|
|
|
|
}
|
|
|
|
}
|
2017-01-29 10:32:26 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "lavalamp:lavalamp",
|
|
|
|
recipe = {
|
2022-05-03 21:21:14 +02:00
|
|
|
{"", homedecor.materials.wool_white, "", },
|
|
|
|
{"", homedecor.materials.water_bucket, "", },
|
|
|
|
{"", homedecor.materials.wool_black, "", }
|
2017-01-29 10:32:26 +01:00
|
|
|
}
|
|
|
|
})
|
2015-04-15 06:12:34 +02:00
|
|
|
|
2018-08-22 11:08:48 +02:00
|
|
|
unifieddyes.register_color_craft({
|
|
|
|
output = "lavalamp:lavalamp",
|
|
|
|
palette = "extended",
|
|
|
|
type = "shapeless",
|
|
|
|
neutral_node = "lavalamp:lavalamp",
|
|
|
|
recipe = {
|
|
|
|
"NEUTRAL_NODE",
|
|
|
|
"MAIN_DYE"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2017-01-29 10:32:26 +01:00
|
|
|
-- convert to param2 coloring
|
2016-12-15 22:23:31 +01:00
|
|
|
|
2017-01-29 10:32:26 +01:00
|
|
|
local colors = {
|
|
|
|
"red",
|
|
|
|
"orange",
|
|
|
|
"yellow",
|
|
|
|
"green",
|
|
|
|
"blue",
|
|
|
|
"violet"
|
|
|
|
}
|
|
|
|
|
|
|
|
lavalamp.old_static_nodes = {}
|
|
|
|
for _, color in ipairs(colors) do
|
|
|
|
table.insert(lavalamp.old_static_nodes, "lavalamp:"..color)
|
|
|
|
table.insert(lavalamp.old_static_nodes, "lavalamp:"..color.."_off")
|
2015-04-15 06:12:34 +02:00
|
|
|
end
|
2017-01-29 10:32:26 +01:00
|
|
|
|
|
|
|
minetest.register_lbm({
|
|
|
|
name = "lavalamp:convert",
|
|
|
|
label = "Convert lava lamps to use param2 color",
|
2017-02-16 22:58:48 +01:00
|
|
|
run_at_every_load = false,
|
2017-01-29 10:32:26 +01:00
|
|
|
nodenames = lavalamp.old_static_nodes,
|
|
|
|
action = function(pos, node)
|
|
|
|
local name = node.name
|
|
|
|
local color
|
|
|
|
|
|
|
|
if string.find(name, "red") then
|
|
|
|
color = "red"
|
|
|
|
elseif string.find(name, "orange") then
|
|
|
|
color = "orange"
|
|
|
|
elseif string.find(name, "yellow") then
|
|
|
|
color = "yellow"
|
|
|
|
elseif string.find(name, "green") then
|
|
|
|
color = "green"
|
|
|
|
elseif string.find(name, "blue") then
|
|
|
|
color = "blue"
|
|
|
|
elseif string.find(name, "violet") then
|
|
|
|
color = "violet"
|
|
|
|
end
|
|
|
|
|
2017-02-25 08:11:47 +01:00
|
|
|
local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, "extended")
|
2017-01-29 10:32:26 +01:00
|
|
|
|
|
|
|
minetest.set_node(pos, { name = "lavalamp:lavalamp", param2 = paletteidx })
|
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
meta:set_string("dye", "unifieddyes:"..color)
|
|
|
|
|
|
|
|
end
|
|
|
|
})
|