Merge branch 'screwdriver'

This commit is contained in:
Wuzzy 2019-12-11 04:47:53 +01:00
commit 231493cb1b
62 changed files with 591 additions and 98 deletions

View file

@ -175,11 +175,6 @@ local pistonspec_normal = {
local usagehelp_piston = S("This block can have one of 6 possible orientations.")
local on_rotate
if minetest.get_modpath("screwdriver") then
on_rotate = screwdriver.disallow
end
-- offstate
minetest.register_node("mesecons_pistons:piston_normal_off", {
description = S("Piston"),
@ -206,7 +201,12 @@ minetest.register_node("mesecons_pistons:piston_normal_off", {
}},
_mcl_blast_resistance = 2.5,
_mcl_hardness = 0.5,
on_rotate = on_rotate,
on_rotate = function(pos, node, user, mode)
if mode == screwdriver.ROTATE_AXIS then
minetest.set_node(pos, {name="mesecons_pistons:piston_up_normal_off"})
return true
end
end,
})
-- onstate
@ -236,7 +236,7 @@ minetest.register_node("mesecons_pistons:piston_normal_on", {
}},
_mcl_blast_resistance = 2.5,
_mcl_hardness = 0.5,
on_rotate = on_rotate,
on_rotate = false,
})
-- pusher
@ -261,7 +261,7 @@ minetest.register_node("mesecons_pistons:piston_pusher_normal", {
node_box = piston_pusher_box,
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 2.5,
on_rotate = on_rotate,
on_rotate = false,
})
-- Sticky ones
@ -303,7 +303,12 @@ minetest.register_node("mesecons_pistons:piston_sticky_off", {
}},
_mcl_blast_resistance = 2.5,
_mcl_hardness = 0.5,
on_rotate = on_rotate,
on_rotate = function(pos, node, user, mode)
if mode == screwdriver.ROTATE_AXIS then
minetest.set_node(pos, {name="mesecons_pistons:piston_up_sticky_off"})
return true
end
end,
})
-- onstate
@ -333,7 +338,7 @@ minetest.register_node("mesecons_pistons:piston_sticky_on", {
}},
_mcl_blast_resistance = 2.5,
_mcl_hardness = 0.5,
on_rotate = on_rotate,
on_rotate = false,
})
-- pusher
@ -358,7 +363,7 @@ minetest.register_node("mesecons_pistons:piston_pusher_sticky", {
node_box = piston_pusher_box,
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 2.5,
on_rotate = on_rotate,
on_rotate = false,
})
--
@ -416,7 +421,13 @@ minetest.register_node("mesecons_pistons:piston_up_normal_off", {
}),
_mcl_blast_resistance = 2.5,
_mcl_hardness = 0.5,
on_rotate = on_rotate,
on_rotate = function(pos, node, user, mode)
if mode == screwdriver.ROTATE_AXIS then
minetest.set_node(pos, {name="mesecons_pistons:piston_down_normal_off"})
return true
end
return false
end,
})
-- onstate
@ -446,7 +457,7 @@ minetest.register_node("mesecons_pistons:piston_up_normal_on", {
}},
_mcl_blast_resistance = 2.5,
_mcl_hardness = 0.5,
on_rotate = on_rotate,
on_rotate = false,
})
-- pusher
@ -471,7 +482,7 @@ minetest.register_node("mesecons_pistons:piston_up_pusher_normal", {
node_box = piston_up_pusher_box,
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 2.5,
on_rotate = on_rotate,
on_rotate = false,
})
@ -512,7 +523,13 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_off", {
}},
_mcl_blast_resistance = 2.5,
_mcl_hardness = 0.5,
on_rotate = on_rotate,
on_rotate = function(pos, node, user, mode)
if mode == screwdriver.ROTATE_AXIS then
minetest.set_node(pos, {name="mesecons_pistons:piston_down_sticky_off"})
return true
end
return false
end,
})
-- onstate
@ -542,7 +559,7 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_on", {
}},
_mcl_blast_resistance = 2.5,
_mcl_hardness = 0.5,
on_rotate = on_rotate,
on_rotate = false,
})
-- pusher
@ -567,7 +584,7 @@ minetest.register_node("mesecons_pistons:piston_up_pusher_sticky", {
node_box = piston_up_pusher_box,
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 2.5,
on_rotate = on_rotate,
on_rotate = false,
})
--
@ -625,7 +642,13 @@ minetest.register_node("mesecons_pistons:piston_down_normal_off", {
}},
_mcl_blast_resistance = 2.5,
_mcl_hardness = 0.5,
on_rotate = on_rotate,
on_rotate = function(pos, node, user, mode)
if mode == screwdriver.ROTATE_AXIS then
minetest.set_node(pos, {name="mesecons_pistons:piston_normal_off"})
return true
end
return false
end,
})
-- onstate
@ -655,7 +678,7 @@ minetest.register_node("mesecons_pistons:piston_down_normal_on", {
}},
_mcl_blast_resistance = 2.5,
_mcl_hardness = 0.5,
on_rotate = on_rotate,
on_rotate = false,
})
-- pusher
@ -680,7 +703,7 @@ minetest.register_node("mesecons_pistons:piston_down_pusher_normal", {
node_box = piston_down_pusher_box,
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 2.5,
on_rotate = on_rotate,
on_rotate = false,
})
-- Sticky
@ -716,7 +739,13 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_off", {
}},
_mcl_blast_resistance = 2.5,
_mcl_hardness = 0.5,
on_rotate = on_rotate,
on_rotate = function(pos, node, user, mode)
if mode == screwdriver.ROTATE_AXIS then
minetest.set_node(pos, {name="mesecons_pistons:piston_sticky_off"})
return true
end
return false
end,
})
-- onstate
@ -746,7 +775,7 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_on", {
}},
_mcl_blast_resistance = 2.5,
_mcl_hardness = 0.5,
on_rotate = on_rotate,
on_rotate = false,
})
-- pusher
@ -771,7 +800,7 @@ minetest.register_node("mesecons_pistons:piston_down_pusher_sticky", {
node_box = piston_down_pusher_box,
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 2.5,
on_rotate = on_rotate,
on_rotate = false,
})

View file

@ -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,
})
@ -134,7 +158,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,
})