2022-12-01 18:33:19 +01:00
|
|
|
local S = minetest.get_translator(minetest.get_current_modname())
|
|
|
|
|
2012-04-02 08:08:26 +02:00
|
|
|
-- WALL LEVER
|
2012-12-09 13:28:32 +01:00
|
|
|
-- Basically a switch that can be attached to a wall
|
|
|
|
-- Powers the block 2 nodes behind (using a receiver)
|
2014-11-22 20:49:54 +01:00
|
|
|
mesecon.register_node("mesecons_walllever:wall_lever", {
|
2022-12-01 18:33:19 +01:00
|
|
|
description = S("Lever"),
|
2014-11-24 00:05:01 +01:00
|
|
|
drawtype = "mesh",
|
|
|
|
inventory_image = "jeija_wall_lever_inv.png",
|
|
|
|
wield_image = "jeija_wall_lever_inv.png",
|
2012-06-05 04:20:04 +02:00
|
|
|
paramtype = "light",
|
2012-08-10 02:00:36 +02:00
|
|
|
paramtype2 = "facedir",
|
2017-10-31 22:50:39 +01:00
|
|
|
is_ground_content = false,
|
2012-09-07 15:59:49 +02:00
|
|
|
sunlight_propagates = true,
|
2012-06-05 04:20:04 +02:00
|
|
|
walkable = false,
|
|
|
|
selection_box = {
|
2012-08-10 02:00:36 +02:00
|
|
|
type = "fixed",
|
|
|
|
fixed = { -8/16, -8/16, 3/16, 8/16, 8/16, 8/16 },
|
|
|
|
},
|
2022-05-05 16:57:53 +02:00
|
|
|
sounds = mesecon.node_sound.wood,
|
2015-10-01 19:13:12 +02:00
|
|
|
on_rightclick = function (pos, node)
|
2014-11-22 20:49:54 +01:00
|
|
|
if(mesecon.flipstate(pos, node) == "on") then
|
|
|
|
mesecon.receptor_on(pos, mesecon.rules.buttonlike_get(node))
|
|
|
|
else
|
|
|
|
mesecon.receptor_off(pos, mesecon.rules.buttonlike_get(node))
|
|
|
|
end
|
2020-08-01 15:10:14 +02:00
|
|
|
minetest.sound_play("mesecons_lever", { pos = pos }, true)
|
2014-11-22 20:49:54 +01:00
|
|
|
end
|
|
|
|
},{
|
2015-05-20 09:00:06 +02:00
|
|
|
tiles = {
|
|
|
|
"jeija_wall_lever_lever_light_off.png",
|
|
|
|
"jeija_wall_lever_front.png",
|
|
|
|
"jeija_wall_lever_front_bump.png",
|
|
|
|
"jeija_wall_lever_back_edges.png"
|
|
|
|
},
|
2014-11-24 00:05:01 +01:00
|
|
|
mesh="jeija_wall_lever_off.obj",
|
2016-12-26 06:50:09 +01:00
|
|
|
on_rotate = mesecon.buttonlike_onrotate,
|
2012-12-09 13:28:32 +01:00
|
|
|
mesecons = {receptor = {
|
|
|
|
rules = mesecon.rules.buttonlike_get,
|
2012-12-09 00:42:30 +01:00
|
|
|
state = mesecon.state.off
|
2014-11-22 20:49:54 +01:00
|
|
|
}},
|
|
|
|
groups = {dig_immediate = 2, mesecon_needs_receiver = 1}
|
|
|
|
},{
|
2015-05-20 09:00:06 +02:00
|
|
|
tiles = {
|
|
|
|
"jeija_wall_lever_lever_light_on.png",
|
|
|
|
"jeija_wall_lever_front.png",
|
|
|
|
"jeija_wall_lever_front_bump.png",
|
|
|
|
"jeija_wall_lever_back_edges.png"
|
|
|
|
},
|
2014-11-24 00:05:01 +01:00
|
|
|
mesh="jeija_wall_lever_on.obj",
|
2016-12-26 06:50:09 +01:00
|
|
|
on_rotate = false,
|
2012-12-09 13:28:32 +01:00
|
|
|
mesecons = {receptor = {
|
|
|
|
rules = mesecon.rules.buttonlike_get,
|
2012-12-09 00:42:30 +01:00
|
|
|
state = mesecon.state.on
|
2014-11-22 20:49:54 +01:00
|
|
|
}},
|
|
|
|
groups = {dig_immediate = 2, mesecon_needs_receiver = 1, not_in_creative_inventory = 1}
|
2012-04-02 08:08:26 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
2013-04-28 12:40:08 +02:00
|
|
|
output = "mesecons_walllever:wall_lever_off 2",
|
2012-04-02 08:08:26 +02:00
|
|
|
recipe = {
|
2013-04-28 12:40:08 +02:00
|
|
|
{"group:mesecon_conductor_craftable"},
|
2022-05-05 16:57:53 +02:00
|
|
|
{"mesecons_gamecompat:stone"},
|
|
|
|
{"group:stick"},
|
2012-04-02 08:08:26 +02:00
|
|
|
}
|
|
|
|
})
|