Tweak button/pressure plate connection sides

This commit is contained in:
Wuzzy 2017-09-12 05:37:03 +02:00
parent 427eb32448
commit be135b7066
2 changed files with 34 additions and 5 deletions

View File

@ -10,9 +10,22 @@ local button_get_output_rules = function(node)
{x = 0, y = 0, z = -1},
{x = 0, y = 0, z = 1},
{x = 0, y = -1, z = 0},
{x = 0, y = 1, z = 0},
}
if minetest.wallmounted_to_dir(node.param2).y == 1 then
table.insert(rules, {x=0, y=1, z=1})
table.insert(rules, {x=0, y=2, z=0})
elseif minetest.wallmounted_to_dir(node.param2).y == -1 then
table.insert(rules, {x=0, y=-2, z=0})
end
if minetest.wallmounted_to_dir(node.param2).x == 1 then
table.insert(rules, {x=2, y=0, z=0})
elseif minetest.wallmounted_to_dir(node.param2).x == -1 then
table.insert(rules, {x=-2, y=0, z=0})
end
if minetest.wallmounted_to_dir(node.param2).z == 1 then
table.insert(rules, {x=0, y=0, z=2})
elseif minetest.wallmounted_to_dir(node.param2).z == -1 then
table.insert(rules, {x=-0, y=0, z=-2})
end
return rules
end

View File

@ -10,6 +10,22 @@ local pp_box_on = {
fixed = { -7/16, -8/16, -7/16, 7/16, -7.5/16, 7/16 },
}
local pplate_rules = {
{x=-1, y=0, z=0},
{x=1, y=0, z=0},
{x=0, y=0, z=-1},
{x=0, y=0, z=1},
{x=-1, y=-1, z=0},
{x=1, y=-1, z=0},
{x=0, y=-1, z=-1},
{x=0, y=-1, z=1},
{x=0, y=-1, z=0},
{x=0, y=-2, z=0},
{x=0, y=1, z=0},
}
local function pp_on_timer(pos, elapsed)
local node = minetest.get_node(pos)
local basename = minetest.registered_nodes[node.name].pressureplate_basename
@ -52,7 +68,7 @@ local function pp_on_timer(pos, elapsed)
end
if disable then
minetest.set_node(pos, {name = basename .. "_off"})
mesecon.receptor_off(pos, mesecon.rules.pplate)
mesecon.receptor_off(pos, pplate_rules)
end
elseif node.name == basename .. "_off" then
for k, obj in pairs(objs) do
@ -60,7 +76,7 @@ local function pp_on_timer(pos, elapsed)
if obj_does_activate(obj, activated_by) then
if objpos.y > pos.y-1 and objpos.y < pos.y then
minetest.set_node(pos, {name = basename .. "_on"})
mesecon.receptor_on(pos, mesecon.rules.pplate )
mesecon.receptor_on(pos, pplate_rules)
break
end
end
@ -119,7 +135,7 @@ function mesecon.register_pressure_plate(basename, description, textures_off, te
groups = groups_off,
tiles = textures_off,
mesecons = {receptor = { state = mesecon.state.off, rules = mesecon.rules.pplate }},
mesecons = {receptor = { state = mesecon.state.off, rules = pplate_rules }},
_doc_items_longdesc = longdesc,
},{
node_box = pp_box_on,
@ -127,7 +143,7 @@ function mesecon.register_pressure_plate(basename, description, textures_off, te
groups = groups_on,
tiles = textures_on,
mesecons = {receptor = { state = mesecon.state.on, rules = mesecon.rules.pplate }},
mesecons = {receptor = { state = mesecon.state.on, rules = pplate_rules }},
_doc_items_create_entry = false,
})