54 lines
1.4 KiB
Lua
54 lines
1.4 KiB
Lua
local mesedoorbell_rules = {
|
|
{x=0, y=0, z=-1},
|
|
{x=1, y=0, z=0},
|
|
{x=-1, y=0, z=0},
|
|
{x=0, y=0, z=1},
|
|
{x=1, y=1, z=0},
|
|
{x=1, y=-1, z=0},
|
|
{x=-1, y=1, z=0},
|
|
{x=-1, y=-1, z=0},
|
|
{x=0, y=1, z=1},
|
|
{x=0, y=-1, z=1},
|
|
{x=0, y=1, z=-1},
|
|
{x=0, y=-1, z=-1},
|
|
{x=0, y=-1, z=0},
|
|
}
|
|
|
|
minetest.register_node("doorbell:doorbell_mesecon_off", {
|
|
tiles = {"doorbell_off.png"},
|
|
description = "doorbell Mesecons",
|
|
is_ground_content = false,
|
|
groups = {cracky = 2, mesecon_effector_off = 1, mesecon = 2},
|
|
mesecons = {effector = {
|
|
rules = mesedoorbell_rules,
|
|
action_on = function (pos, node)
|
|
minetest.swap_node(pos, {name = "doorbell:doorbell_mesecon_on", param2 = node.param2})
|
|
doorbell_play(pos, "deurbel1")
|
|
end,
|
|
}},
|
|
on_blast = mesecon.on_blastnode,
|
|
})
|
|
|
|
minetest.register_node("doorbell:doorbell_mesecon_on", {
|
|
tiles = {"doorbell_on.png"},
|
|
description = "doorbell Mesecons",
|
|
is_ground_content = false,
|
|
groups = {cracky = 2, not_in_creative_inventory = 1, mesecon = 2},
|
|
drop = "doorbell:doorbell_mesecon_off",
|
|
light_source = minetest.LIGHT_MAX - 2,
|
|
mesecons = {effector = {
|
|
rules = mesedoorbell_rules,
|
|
action_off = function (pos, node)
|
|
minetest.swap_node(pos, {name = "doorbell:doorbell_mesecon_off", param2 = node.param2})
|
|
end,
|
|
}},
|
|
on_blast = mesecon.on_blastnode,
|
|
})
|
|
|
|
minetest.register_craft({
|
|
output = "doorbell:doorbell_mesecon_off",
|
|
recipe = {
|
|
{"doorbell:doorbell", "group:mesecon_conductor_craftable"}
|
|
}
|
|
})
|