Add partial rotation of levers
parent
33ef45245c
commit
ad13c71bf1
|
@ -2,6 +2,30 @@ local S = minetest.get_translator("mesecons_wallever")
|
|||
|
||||
local lever_get_output_rules = mesecon.rules.buttonlike_get
|
||||
|
||||
local on_rotate = function(pos, node, user, mode)
|
||||
if mode == screwdriver.ROTATE_FACE then
|
||||
if node.param2 == 10 then
|
||||
node.param2 = 13
|
||||
minetest.swap_node(pos, node)
|
||||
return true
|
||||
elseif node.param2 == 13 then
|
||||
node.param2 = 10
|
||||
minetest.swap_node(pos, node)
|
||||
return true
|
||||
elseif node.param2 == 8 then
|
||||
node.param2 = 15
|
||||
minetest.swap_node(pos, node)
|
||||
return true
|
||||
elseif node.param2 == 15 then
|
||||
node.param2 = 8
|
||||
minetest.swap_node(pos, node)
|
||||
return true
|
||||
end
|
||||
end
|
||||
-- TODO: Rotate axis
|
||||
return false
|
||||
end
|
||||
|
||||
-- LEVER
|
||||
minetest.register_node("mesecons_walllever:wall_lever_off", {
|
||||
drawtype = "mesh",
|
||||
|
@ -102,7 +126,7 @@ minetest.register_node("mesecons_walllever:wall_lever_off", {
|
|||
rules = lever_get_output_rules,
|
||||
state = mesecon.state.off
|
||||
}},
|
||||
on_rotate = false,
|
||||
on_rotate = on_rotate,
|
||||
_mcl_blast_resistance = 2.5,
|
||||
_mcl_hardness = 0.5,
|
||||
})
|
||||
|
@ -136,7 +160,7 @@ minetest.register_node("mesecons_walllever:wall_lever_on", {
|
|||
rules = lever_get_output_rules,
|
||||
state = mesecon.state.on
|
||||
}},
|
||||
on_rotate = false,
|
||||
on_rotate = on_rotate,
|
||||
_mcl_blast_resistance = 2.5,
|
||||
_mcl_hardness = 0.5,
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue