From be135b7066005919f1801241b66e3752290422c9 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 12 Sep 2017 05:37:03 +0200 Subject: [PATCH] Tweak button/pressure plate connection sides --- mods/ITEMS/REDSTONE/mesecons_button/init.lua | 15 +++++++++++- .../REDSTONE/mesecons_pressureplates/init.lua | 24 +++++++++++++++---- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons_button/init.lua b/mods/ITEMS/REDSTONE/mesecons_button/init.lua index c4d822891..df30d1e87 100644 --- a/mods/ITEMS/REDSTONE/mesecons_button/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_button/init.lua @@ -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 diff --git a/mods/ITEMS/REDSTONE/mesecons_pressureplates/init.lua b/mods/ITEMS/REDSTONE/mesecons_pressureplates/init.lua index 3bb41284d..4423c8971 100644 --- a/mods/ITEMS/REDSTONE/mesecons_pressureplates/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_pressureplates/init.lua @@ -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, })