2012-04-02 08:08:26 +02:00
|
|
|
-- WALL LEVER
|
|
|
|
minetest.register_node("mesecons_walllever:wall_lever_off", {
|
2012-06-05 04:20:04 +02:00
|
|
|
drawtype = "signlike",
|
|
|
|
tile_images = {"jeija_wall_lever_off.png"},
|
|
|
|
inventory_image = "jeija_wall_lever_off.png",
|
|
|
|
wield_image = "jeija_wall_lever_off.png",
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "wallmounted",
|
|
|
|
legacy_wallmounted = true,
|
|
|
|
walkable = false,
|
|
|
|
selection_box = {
|
|
|
|
type = "wallmounted",
|
|
|
|
},
|
|
|
|
groups = {dig_immediate=2},
|
|
|
|
description="Lever",
|
2012-04-02 08:08:26 +02:00
|
|
|
})
|
|
|
|
minetest.register_node("mesecons_walllever:wall_lever_on", {
|
2012-06-05 04:20:04 +02:00
|
|
|
drawtype = "signlike",
|
|
|
|
tile_images = {"jeija_wall_lever_on.png"},
|
|
|
|
inventory_image = "jeija_wall_lever_on.png",
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "wallmounted",
|
|
|
|
legacy_wallmounted = true,
|
|
|
|
walkable = false,
|
|
|
|
selection_box = {
|
|
|
|
type = "wallmounted",
|
|
|
|
},
|
|
|
|
groups = {dig_immediate=2},
|
|
|
|
drop = '"mesecons_walllever:wall_lever_off" 1',
|
|
|
|
description="Lever",
|
|
|
|
after_dig_node = function(pos)
|
|
|
|
mesecon:receptor_off(pos, mesecon.button_get_rules(minetest.env:get_node(pos).param2))
|
|
|
|
end
|
2012-04-02 08:08:26 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_on_punchnode(function(pos, node, puncher)
|
|
|
|
if node.name == "mesecons_walllever:wall_lever_off" then
|
|
|
|
minetest.env:add_node(pos, {name="mesecons_walllever:wall_lever_on",param2=node.param2})
|
2012-04-02 08:24:48 +02:00
|
|
|
mesecon:receptor_on(pos, mesecon.button_get_rules(node.param2))
|
2012-04-02 08:08:26 +02:00
|
|
|
end
|
|
|
|
if node.name == "mesecons_walllever:wall_lever_on" then
|
|
|
|
minetest.env:add_node(pos, {name="mesecons_walllever:wall_lever_off",param2=node.param2})
|
2012-04-02 08:24:48 +02:00
|
|
|
mesecon:receptor_off(pos, mesecon.button_get_rules(node.param2))
|
2012-04-02 08:08:26 +02:00
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = '"mesecons_walllever:wall_lever_off" 2',
|
|
|
|
recipe = {
|
|
|
|
{'"mesecons:mesecon_off"'},
|
|
|
|
{'"default:stone"'},
|
|
|
|
{'"default:stick"'},
|
|
|
|
}
|
|
|
|
})
|
2012-04-02 08:24:48 +02:00
|
|
|
mesecon:add_receptor_node("mesecons_walllever:wall_lever", nil, mesecon.button_get_rules)
|
|
|
|
mesecon:add_receptor_node_off("mesecons_walllever:wall_lever_off", nil, mesecon.button_get_rules)
|