From a34405b17b052bc2bda5fd7e83b49fe524e0f557 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 14 Sep 2017 02:20:47 +0200 Subject: [PATCH] Adjust redstone rules of most redstone components --- mods/ITEMS/REDSTONE/mcl_dispensers/init.lua | 3 ++- mods/ITEMS/REDSTONE/mcl_droppers/init.lua | 3 ++- mods/ITEMS/REDSTONE/mesecons_button/init.lua | 26 ++----------------- .../REDSTONE/mesecons_commandblock/init.lua | 6 +++-- .../REDSTONE/mesecons_lightstone/init.lua | 6 +++-- mods/ITEMS/REDSTONE/mesecons_pistons/init.lua | 26 ++++++------------- .../REDSTONE/mesecons_solarpanel/init.lua | 6 +++-- mods/ITEMS/mcl_tnt/init.lua | 3 ++- 8 files changed, 28 insertions(+), 51 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua index 263ed80ede..4d33780c0d 100644 --- a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua @@ -361,7 +361,8 @@ local dispenserdef = { inv:set_stack("main", stack_id, stack) end end - end + end, + rules = mesecon.rules.alldirs, }} } diff --git a/mods/ITEMS/REDSTONE/mcl_droppers/init.lua b/mods/ITEMS/REDSTONE/mcl_droppers/init.lua index ec6622537b..ded1c4a6c5 100644 --- a/mods/ITEMS/REDSTONE/mcl_droppers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_droppers/init.lua @@ -89,7 +89,8 @@ local dropperdef = { inv:set_stack("main", stack_id, stack) end end - end + end, + rules = mesecon.rules.alldirs, }} } diff --git a/mods/ITEMS/REDSTONE/mesecons_button/init.lua b/mods/ITEMS/REDSTONE/mesecons_button/init.lua index df30d1e872..a513202121 100644 --- a/mods/ITEMS/REDSTONE/mesecons_button/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_button/init.lua @@ -2,31 +2,9 @@ -- A button that when pressed emits power for 1 second -- and then turns off again --- FIXME: Power lower/upper nodes as well +-- FIXME: Power node behind as well local button_get_output_rules = function(node) - local 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 = 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=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 + local rules = mesecon.rules.alldirs return rules end diff --git a/mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua b/mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua index 3bd14ba47a..9da011fd2b 100644 --- a/mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua @@ -143,7 +143,8 @@ You can optionally use the following placeholders in your commands: on_rightclick = on_rightclick, sounds = mcl_sounds.node_sound_stone_defaults(), mesecons = {effector = { - action_on = commandblock_action_on + action_on = commandblock_action_on, + rules = mesecon.rules.alldirs, }}, _mcl_blast_resistance = 18000000, _mcl_hardness = -1, @@ -160,7 +161,8 @@ minetest.register_node("mesecons_commandblock:commandblock_on", { on_rightclick = on_rightclick, sounds = mcl_sounds.node_sound_stone_defaults(), mesecons = {effector = { - action_off = commandblock_action_off + action_off = commandblock_action_off, + rules = mesecon.rules.alldirs, }}, _mcl_blast_resistance = 18000000, _mcl_hardness = -1, diff --git a/mods/ITEMS/REDSTONE/mesecons_lightstone/init.lua b/mods/ITEMS/REDSTONE/mesecons_lightstone/init.lua index 60bd05bfda..8e3bc1d50d 100644 --- a/mods/ITEMS/REDSTONE/mesecons_lightstone/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_lightstone/init.lua @@ -9,7 +9,8 @@ minetest.register_node("mesecons_lightstone:lightstone_off", { mesecons = {effector = { action_on = function (pos, node) minetest.swap_node(pos, {name="mesecons_lightstone:lightstone_on", param2 = node.param2}) - end + end, + rules = mesecon.rules.alldirs, }}, _mcl_blast_resistance = 1.5, _mcl_hardness = 0.3, @@ -28,7 +29,8 @@ minetest.register_node("mesecons_lightstone:lightstone_on", { mesecons = {effector = { action_off = function (pos, node) minetest.swap_node(pos, {name="mesecons_lightstone:lightstone_off", param2 = node.param2}) - end + end, + rules = mesecon.rules.alldirs, }}, _mcl_blast_resistance = 1.5, _mcl_hardness = 0.3, diff --git a/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua b/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua index c37fb5886d..3729a014a8 100644 --- a/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua @@ -5,32 +5,22 @@ piston_rules = {{x=0, y=0, z=1}, --everything apart from z- (pusher side) {x=1, y=0, z=0}, {x=-1, y=0, z=0}, - {x=1, y=1, z=0}, - {x=1, y=-1, z=0}, - {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=-1, z=0}} local piston_up_rules = {{x=0, y=0, z=-1}, --everything apart from y+ (pusher side) - {x=1, y=0, z=0}, - {x=-1, y=0, z=0}, {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=-1, y=0, z=0}, + {x=1, y=0, z=1}, + {x=0, y=-1, z=0}} local piston_down_rules = {{x=0, y=0, z=-1}, --everything apart from y- (pusher side) - {x=1, y=0, z=0}, - {x=-1, y=0, z=0}, {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=-1, y=0, z=0}, + {x=1, y=0, z=1}, + {x=0, y=1, z=0}} local piston_get_rules = function (node) local rules = piston_rules diff --git a/mods/ITEMS/REDSTONE/mesecons_solarpanel/init.lua b/mods/ITEMS/REDSTONE/mesecons_solarpanel/init.lua index 9ed18c6a4c..90b9ac95db 100644 --- a/mods/ITEMS/REDSTONE/mesecons_solarpanel/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_solarpanel/init.lua @@ -24,7 +24,8 @@ minetest.register_node("mesecons_solarpanel:solar_panel_on", { groups = {handy=1,axey=1, not_in_creative_inventory = 1, material_wood=1}, sounds = mcl_sounds.node_sound_glass_defaults(), mesecons = {receptor = { - state = mesecon.state.on + state = mesecon.state.on, + rules = mesecon.rules.alldirs, }}, on_rightclick = function(pos, node, clicker, pointed_thing) minetest.swap_node(pos, {name = "mesecons_solarpanel:solar_panel_inverted_off"}) @@ -58,7 +59,8 @@ minetest.register_node("mesecons_solarpanel:solar_panel_off", { _doc_items_usagehelp = "Rightclick the daylight sensor to turn it into an inverted daylight sensor, which supplies redstone energy when it is in moonlight.", sounds = mcl_sounds.node_sound_glass_defaults(), mesecons = {receptor = { - state = mesecon.state.off + state = mesecon.state.off, + rules = mesecon.rules.alldirs, }}, on_rightclick = function(pos, node, clicker, pointed_thing) minetest.swap_node(pos, {name = "mesecons_solarpanel:solar_panel_inverted_on"}) diff --git a/mods/ITEMS/mcl_tnt/init.lua b/mods/ITEMS/mcl_tnt/init.lua index 84094a5acb..3acb865b93 100644 --- a/mods/ITEMS/mcl_tnt/init.lua +++ b/mods/ITEMS/mcl_tnt/init.lua @@ -69,7 +69,8 @@ minetest.register_node("mcl_tnt:tnt", { _doc_items_usagehelp = "Place the TNT on the ground and ignite it with one of the methods above. Quickly get in safe distance quickly. The TNT will start to be affected by gravity and explodes in 4 seconds.", groups = { dig_immediate = 3, tnt = 1, enderman_takable=1 }, mesecons = {effector = { - action_on = tnt.ignite + action_on = tnt.ignite, + rules = mesecon.rules.alldirs, }}, _on_ignite = function(player, pointed_thing) tnt.ignite(pointed_thing.under)