mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-18 22:39:33 +01:00
Add partial rotation of levers
This commit is contained in:
parent
33ef45245c
commit
ad13c71bf1
1 changed files with 26 additions and 2 deletions
|
@ -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 a new issue