197 lines
5.9 KiB
Lua
197 lines
5.9 KiB
Lua
|
-- Window Block
|
||
|
|
||
|
minetest.register_node("mesecons_window:window_closed", {
|
||
|
description="Mesecon Window",
|
||
|
_doc_items_longdesc = "A Mesecon receptor which is opaque when it isn't powered and is fully transparent to light and sunlight when powered.",
|
||
|
tiles = {"mesecons_window_closed.png"},
|
||
|
is_ground_content = false,
|
||
|
groups = {cracky=3, oddly_breakable_by_hand=3},
|
||
|
sounds = default.node_sound_glass_defaults(),
|
||
|
mesecons = {conductor = {
|
||
|
state = mesecon.state.off,
|
||
|
rules = { --axes
|
||
|
{x = -1, y = 0, z = 0},
|
||
|
{x = 1, y = 0, z = 0},
|
||
|
{x = 0, y = -1, z = 0},
|
||
|
{x = 0, y = 1, z = 0},
|
||
|
{x = 0, y = 0, z = -1},
|
||
|
{x = 0, y = 0, z = 1},
|
||
|
},
|
||
|
onstate = "mesecons_window:window_open"
|
||
|
}}
|
||
|
})
|
||
|
|
||
|
minetest.register_node("mesecons_window:window_open", {
|
||
|
description="Mesecon Window",
|
||
|
_doc_items_create_entry = false,
|
||
|
drawtype = "glasslike_framed",
|
||
|
sunlight_propagates = true,
|
||
|
tiles = {"mesecons_window_open.png", "mesecons_window_open_detail.png"},
|
||
|
is_ground_content = false,
|
||
|
paramtype = "light",
|
||
|
groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory=1},
|
||
|
drop = "mesecons_window:window_closed",
|
||
|
sounds = default.node_sound_glass_defaults(),
|
||
|
mesecons = {conductor = {
|
||
|
state = mesecon.state.on,
|
||
|
rules = {
|
||
|
{x = -1, y = 0, z = 0},
|
||
|
{x = 1, y = 0, z = 0},
|
||
|
{x = 0, y = -1, z = 0},
|
||
|
{x = 0, y = 1, z = 0},
|
||
|
{x = 0, y = 0, z = -1},
|
||
|
{x = 0, y = 0, z = 1},
|
||
|
},
|
||
|
offstate = "mesecons_window:window_closed"
|
||
|
}},
|
||
|
on_construct = function(pos)
|
||
|
-- remove shadow
|
||
|
shadowpos = vector.add(pos, vector.new(0, 1, 0))
|
||
|
if (minetest.get_node(shadowpos).name == "air") then
|
||
|
minetest.dig_node(shadowpos)
|
||
|
end
|
||
|
end
|
||
|
})
|
||
|
|
||
|
minetest.register_node("mesecons_window:filter_closed", {
|
||
|
description="Mesecon Filter Window",
|
||
|
tiles = {"mesecons_filter_closed.png"},
|
||
|
_doc_items_longdesc = "A Mesecon receptor which is opaque when it isn't powered and is semi-transparent to light when powered.",
|
||
|
is_ground_content = false,
|
||
|
groups = {cracky=3, oddly_breakable_by_hand=3},
|
||
|
sounds = default.node_sound_glass_defaults(),
|
||
|
mesecons = {conductor = {
|
||
|
state = mesecon.state.off,
|
||
|
rules = { --axes
|
||
|
{x = -1, y = 0, z = 0},
|
||
|
{x = 1, y = 0, z = 0},
|
||
|
{x = 0, y = -1, z = 0},
|
||
|
{x = 0, y = 1, z = 0},
|
||
|
{x = 0, y = 0, z = -1},
|
||
|
{x = 0, y = 0, z = 1},
|
||
|
},
|
||
|
onstate = "mesecons_window:filter_open"
|
||
|
}}
|
||
|
})
|
||
|
|
||
|
minetest.register_node("mesecons_window:filter_open", {
|
||
|
description="Mesecon Filter Window",
|
||
|
drawtype = "glasslike_framed",
|
||
|
_doc_items_create_entry = false,
|
||
|
sunlight_propagates = false,
|
||
|
tiles = {"mesecons_filter_open.png", "mesecons_filter_open_detail.png"},
|
||
|
is_ground_content = false,
|
||
|
paramtype = "light",
|
||
|
groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory=1},
|
||
|
drop = "mesecons_window:filter_closed",
|
||
|
sounds = default.node_sound_glass_defaults(),
|
||
|
mesecons = {conductor = {
|
||
|
state = mesecon.state.on,
|
||
|
rules = {
|
||
|
{x = -1, y = 0, z = 0},
|
||
|
{x = 1, y = 0, z = 0},
|
||
|
{x = 0, y = -1, z = 0},
|
||
|
{x = 0, y = 1, z = 0},
|
||
|
{x = 0, y = 0, z = -1},
|
||
|
{x = 0, y = 0, z = 1},
|
||
|
},
|
||
|
offstate = "mesecons_window:filter_closed"
|
||
|
}},
|
||
|
on_construct = function(pos)
|
||
|
-- remove shadow
|
||
|
shadowpos = vector.add(pos, vector.new(0, 1, 0))
|
||
|
if (minetest.get_node(shadowpos).name == "air") then
|
||
|
minetest.dig_node(shadowpos)
|
||
|
end
|
||
|
end
|
||
|
})
|
||
|
|
||
|
minetest.register_node("mesecons_window:filter2_closed", {
|
||
|
description="Mesecon Filter Glass",
|
||
|
_doc_items_longdesc = "A Mesecon receptor which lets light through. When not powered, it is semi-transparent, i.e. it is transparent to light, but filters out sunlight. When powered, it is fully transparent to light and sunlight.",
|
||
|
drawtype="glasslike_framed",
|
||
|
tiles = {"mesecons_filter2_closed.png", "mesecons_filter2_closed_detail.png"},
|
||
|
is_ground_content = false,
|
||
|
groups = {cracky=3, oddly_breakable_by_hand=3},
|
||
|
sounds = default.node_sound_glass_defaults(),
|
||
|
paramtype = "light",
|
||
|
sunlight_propagates = false,
|
||
|
mesecons = {conductor = {
|
||
|
state = mesecon.state.off,
|
||
|
rules = { --axes
|
||
|
{x = -1, y = 0, z = 0},
|
||
|
{x = 1, y = 0, z = 0},
|
||
|
{x = 0, y = -1, z = 0},
|
||
|
{x = 0, y = 1, z = 0},
|
||
|
{x = 0, y = 0, z = -1},
|
||
|
{x = 0, y = 0, z = 1},
|
||
|
},
|
||
|
onstate = "mesecons_window:filter2_open"
|
||
|
}},
|
||
|
on_construct = function(pos)
|
||
|
-- remove shadow
|
||
|
shadowpos = vector.add(pos, vector.new(0, 1, 0))
|
||
|
if (minetest.get_node(shadowpos).name == "air") then
|
||
|
minetest.dig_node(shadowpos)
|
||
|
end
|
||
|
end
|
||
|
})
|
||
|
|
||
|
minetest.register_node("mesecons_window:filter2_open", {
|
||
|
description="Mesecon Filter Glass",
|
||
|
_doc_items_create_entry = false,
|
||
|
drawtype = "glasslike_framed",
|
||
|
sunlight_propagates = false,
|
||
|
tiles = {"mesecons_filter2_open.png", "mesecons_filter2_open_detail.png"},
|
||
|
is_ground_content = false,
|
||
|
paramtype = "light",
|
||
|
sunlight_propagates = true,
|
||
|
groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory=1},
|
||
|
drop = "mesecons_window:filter2_closed",
|
||
|
sounds = default.node_sound_glass_defaults(),
|
||
|
mesecons = {conductor = {
|
||
|
state = mesecon.state.on,
|
||
|
rules = {
|
||
|
{x = -1, y = 0, z = 0},
|
||
|
{x = 1, y = 0, z = 0},
|
||
|
{x = 0, y = -1, z = 0},
|
||
|
{x = 0, y = 1, z = 0},
|
||
|
{x = 0, y = 0, z = -1},
|
||
|
{x = 0, y = 0, z = 1},
|
||
|
},
|
||
|
offstate = "mesecons_window:filter2_closed"
|
||
|
}},
|
||
|
on_construct = function(pos)
|
||
|
-- remove shadow
|
||
|
shadowpos = vector.add(pos, vector.new(0, 1, 0))
|
||
|
if (minetest.get_node(shadowpos).name == "air") then
|
||
|
minetest.dig_node(shadowpos)
|
||
|
end
|
||
|
end
|
||
|
})
|
||
|
|
||
|
|
||
|
minetest.register_craft({
|
||
|
output = 'mesecons_window:window_closed',
|
||
|
recipe = {
|
||
|
{"", "default:glass", ""},
|
||
|
{"default:cobble", "group:mesecon_conductor_craftable", "default:cobble"},
|
||
|
}
|
||
|
})
|
||
|
|
||
|
minetest.register_craft({
|
||
|
output = 'mesecons_window:filter_closed',
|
||
|
recipe = {
|
||
|
{"", "default:pine_needles", ""},
|
||
|
{"default:cobble", "group:mesecon_conductor_craftable", "default:cobble"},
|
||
|
}
|
||
|
})
|
||
|
|
||
|
minetest.register_craft({
|
||
|
output = 'mesecons_window:filter2_closed',
|
||
|
recipe = {
|
||
|
{"", "default:glass", ""},
|
||
|
{"default:pine_needles", "group:mesecon_conductor_craftable", "default:pine_needles"},
|
||
|
}
|
||
|
})
|