Fix piston drops and craft recipe

This commit is contained in:
Jeija 2013-01-20 13:01:40 +01:00
parent 841bc70b97
commit 74eefc270a
5 changed files with 23 additions and 23 deletions

View File

@ -1 +1,2 @@
mesecons mesecons
doors

View File

@ -43,7 +43,7 @@ function doors:register_door(name, def)
end end
end end
local function on_punch(pos, dir, check_name, replace, replace_dir, params) local function on_rightclick(pos, dir, check_name, replace, replace_dir, params)
pos.y = pos.y+dir pos.y = pos.y+dir
if not minetest.env:get_node(pos).name == check_name then if not minetest.env:get_node(pos).name == check_name then
return return
@ -62,11 +62,11 @@ function doors:register_door(name, def)
end end
local function on_mesecons_signal_open (pos, node) local function on_mesecons_signal_open (pos, node)
on_punch(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0}) on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0})
end end
local function on_mesecons_signal_close (pos, node) local function on_mesecons_signal_close (pos, node)
on_punch(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2}) on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
end end
local function check_player_priv(pos, player) local function check_player_priv(pos, player)
@ -99,9 +99,9 @@ function doors:register_door(name, def)
after_dig_node(pos, name.."_t_1") after_dig_node(pos, name.."_t_1")
end, end,
on_punch = function(pos, node, puncher) on_rightclick = function(pos, node, puncher)
if check_player_priv(pos, puncher) then if check_player_priv(pos, puncher) then
on_punch(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0}) on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0})
end end
end, end,
@ -133,9 +133,9 @@ function doors:register_door(name, def)
after_dig_node(pos, name.."_t_2") after_dig_node(pos, name.."_t_2")
end, end,
on_punch = function(pos, node, puncher) on_rightclick = function(pos, node, puncher)
if check_player_priv(pos, puncher) then if check_player_priv(pos, puncher) then
on_punch(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2}) on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
end end
end, end,

View File

@ -11,7 +11,7 @@ local tbox = {
local bbox = { local bbox = {
type = "fixed", type = "fixed",
fixed = {{ -.5, -.5 , -.5, .5, -.5+1/16, .5}, fixed = {{ -.5, -.5 , -.5, .5, -.5+1/16, .5},
{-1/16, -.5, -1/16, 1/16, .5 , 1/16}} {-1/16, -.5+1/16, -1/16, 1/16, .5 , 1/16}}
} }
local vrules = local vrules =

View File

@ -20,6 +20,7 @@ end
function mesecon:mvps_process_stack(stack) function mesecon:mvps_process_stack(stack)
-- update mesecons for placed nodes ( has to be done after all nodes have been added ) -- update mesecons for placed nodes ( has to be done after all nodes have been added )
for _, n in ipairs(stack) do for _, n in ipairs(stack) do
nodeupdate(n.pos)
mesecon.on_placenode(n.pos, minetest.env:get_node(n.pos)) mesecon.on_placenode(n.pos, minetest.env:get_node(n.pos))
mesecon:update_autoconnect(n.pos) mesecon:update_autoconnect(n.pos)
end end
@ -57,7 +58,6 @@ function mesecon:mvps_push(pos, dir, maximum) -- pos: pos of mvps; dir: directio
-- remove all nodes -- remove all nodes
for _, n in ipairs(nodes) do for _, n in ipairs(nodes) do
minetest.env:remove_node(n.pos) minetest.env:remove_node(n.pos)
nodeupdate(n.pos)
end end
-- update mesecons for removed nodes ( has to be done after all nodes have been removed ) -- update mesecons for removed nodes ( has to be done after all nodes have been removed )
@ -70,7 +70,6 @@ function mesecon:mvps_push(pos, dir, maximum) -- pos: pos of mvps; dir: directio
for _, n in ipairs(nodes) do for _, n in ipairs(nodes) do
np = mesecon:addPosRule(n.pos, dir) np = mesecon:addPosRule(n.pos, dir)
minetest.env:add_node(np, n.node) minetest.env:add_node(np, n.node)
nodeupdate(np)
end end
for i in ipairs(nodes) do for i in ipairs(nodes) do

View File

@ -156,7 +156,7 @@ minetest.register_node("mesecons_pistons:piston_normal_on", {
groups = {cracky = 3, not_in_creative_inventory = 1}, groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_normal_off"}, drop = "mesecons_pistons:piston_normal_off",
after_dig_node = piston_remove_pusher, after_dig_node = piston_remove_pusher,
node_box = piston_on_box, node_box = piston_on_box,
selection_box = piston_on_box, selection_box = piston_on_box,
@ -233,7 +233,7 @@ minetest.register_node("mesecons_pistons:piston_sticky_on", {
groups = {cracky = 3, not_in_creative_inventory = 1}, groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_normal_off"}, drop = "mesecons_pistons:piston_normal_off",
after_dig_node = piston_remove_pusher, after_dig_node = piston_remove_pusher,
node_box = piston_on_box, node_box = piston_on_box,
selection_box = piston_on_box, selection_box = piston_on_box,
@ -305,7 +305,7 @@ minetest.register_node("mesecons_pistons:piston_up_normal_off", {
}, },
groups = {cracky = 3, not_in_creative_inventory = 1}, groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype2 = "facedir", paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_normal_off"}, drop = "mesecons_pistons:piston_normal_off",
mesecons_piston = pistonspec_normal_up, mesecons_piston = pistonspec_normal_up,
mesecons = {effector={ mesecons = {effector={
action_on = piston_on, action_on = piston_on,
@ -326,7 +326,7 @@ minetest.register_node("mesecons_pistons:piston_up_normal_on", {
groups = {cracky = 3, not_in_creative_inventory = 1}, groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_normal_off"}, drop = "mesecons_pistons:piston_normal_off",
after_dig_node = piston_remove_pusher, after_dig_node = piston_remove_pusher,
node_box = piston_up_on_box, node_box = piston_up_on_box,
selection_box = piston_up_on_box, selection_box = piston_up_on_box,
@ -381,7 +381,7 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_off", {
}, },
groups = {cracky = 3, not_in_creative_inventory = 1}, groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype2 = "facedir", paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_sticky_off"}, drop = "mesecons_pistons:piston_sticky_off",
mesecons_piston = pistonspec_sticky_up, mesecons_piston = pistonspec_sticky_up,
mesecons = {effector={ mesecons = {effector={
action_on = piston_on, action_on = piston_on,
@ -402,7 +402,7 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_on", {
groups = {cracky = 3, not_in_creative_inventory = 1}, groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_normal_off"}, drop = "mesecons_pistons:piston_normal_off",
after_dig_node = piston_remove_pusher, after_dig_node = piston_remove_pusher,
node_box = piston_up_on_box, node_box = piston_up_on_box,
selection_box = piston_up_on_box, selection_box = piston_up_on_box,
@ -475,7 +475,7 @@ minetest.register_node("mesecons_pistons:piston_down_normal_off", {
}, },
groups = {cracky = 3, not_in_creative_inventory = 1}, groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype2 = "facedir", paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_normal_off"}, drop = "mesecons_pistons:piston_normal_off",
mesecons_piston = pistonspec_normal_down, mesecons_piston = pistonspec_normal_down,
mesecons = {effector={ mesecons = {effector={
action_on = piston_on, action_on = piston_on,
@ -496,7 +496,7 @@ minetest.register_node("mesecons_pistons:piston_down_normal_on", {
groups = {cracky = 3, not_in_creative_inventory = 1}, groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_normal_off"}, drop = "mesecons_pistons:piston_normal_off",
after_dig_node = piston_remove_pusher, after_dig_node = piston_remove_pusher,
node_box = piston_down_on_box, node_box = piston_down_on_box,
selection_box = piston_down_on_box, selection_box = piston_down_on_box,
@ -547,7 +547,7 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_off", {
}, },
groups = {cracky = 3, not_in_creative_inventory = 1}, groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype2 = "facedir", paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_sticky_off"}, drop = "mesecons_pistons:piston_sticky_off",
mesecons_piston = pistonspec_sticky_down, mesecons_piston = pistonspec_sticky_down,
mesecons = {effector={ mesecons = {effector={
action_on = piston_on, action_on = piston_on,
@ -568,7 +568,7 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_on", {
groups = {cracky = 3, not_in_creative_inventory = 1}, groups = {cracky = 3, not_in_creative_inventory = 1},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
drop = {"mesecons_pistons:piston_sticky_off"}, drop = "mesecons_pistons:piston_sticky_off",
after_dig_node = piston_remove_pusher, after_dig_node = piston_remove_pusher,
node_box = piston_down_on_box, node_box = piston_down_on_box,
selection_box = piston_down_on_box, selection_box = piston_down_on_box,
@ -670,7 +670,7 @@ mesecon:register_mvps_stopper("mesecons_pistons:piston_down_sticky_on", piston_u
--craft recipes --craft recipes
minetest.register_craft({ minetest.register_craft({
output = '"mesecons_pistons:piston_normal" 2', output = '"mesecons_pistons:piston_normal_off" 2',
recipe = { recipe = {
{"default:wood", "default:wood", "default:wood"}, {"default:wood", "default:wood", "default:wood"},
{"default:cobble", "default:steel_ingot", "default:cobble"}, {"default:cobble", "default:steel_ingot", "default:cobble"},
@ -679,7 +679,7 @@ minetest.register_craft({
}) })
minetest.register_craft({ minetest.register_craft({
output = "mesecons_pistons:piston_sticky", output = "mesecons_pistons:piston_sticky_off",
recipe = { recipe = {
{"mesecons_materials:glue"}, {"mesecons_materials:glue"},
{"mesecons_pistons:piston_normal"}, {"mesecons_pistons:piston_normal"},