Adjust redstone rules of most redstone components

This commit is contained in:
Wuzzy 2017-09-14 02:20:47 +02:00
parent a4b229e565
commit a34405b17b
8 changed files with 28 additions and 51 deletions

View File

@ -361,7 +361,8 @@ local dispenserdef = {
inv:set_stack("main", stack_id, stack) inv:set_stack("main", stack_id, stack)
end end
end end
end end,
rules = mesecon.rules.alldirs,
}} }}
} }

View File

@ -89,7 +89,8 @@ local dropperdef = {
inv:set_stack("main", stack_id, stack) inv:set_stack("main", stack_id, stack)
end end
end end
end end,
rules = mesecon.rules.alldirs,
}} }}
} }

View File

@ -2,31 +2,9 @@
-- A button that when pressed emits power for 1 second -- A button that when pressed emits power for 1 second
-- and then turns off again -- 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 button_get_output_rules = function(node)
local rules = { local rules = mesecon.rules.alldirs
{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
return rules return rules
end end

View File

@ -143,7 +143,8 @@ You can optionally use the following placeholders in your commands:
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector = { mesecons = {effector = {
action_on = commandblock_action_on action_on = commandblock_action_on,
rules = mesecon.rules.alldirs,
}}, }},
_mcl_blast_resistance = 18000000, _mcl_blast_resistance = 18000000,
_mcl_hardness = -1, _mcl_hardness = -1,
@ -160,7 +161,8 @@ minetest.register_node("mesecons_commandblock:commandblock_on", {
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector = { mesecons = {effector = {
action_off = commandblock_action_off action_off = commandblock_action_off,
rules = mesecon.rules.alldirs,
}}, }},
_mcl_blast_resistance = 18000000, _mcl_blast_resistance = 18000000,
_mcl_hardness = -1, _mcl_hardness = -1,

View File

@ -9,7 +9,8 @@ minetest.register_node("mesecons_lightstone:lightstone_off", {
mesecons = {effector = { mesecons = {effector = {
action_on = function (pos, node) action_on = function (pos, node)
minetest.swap_node(pos, {name="mesecons_lightstone:lightstone_on", param2 = node.param2}) minetest.swap_node(pos, {name="mesecons_lightstone:lightstone_on", param2 = node.param2})
end end,
rules = mesecon.rules.alldirs,
}}, }},
_mcl_blast_resistance = 1.5, _mcl_blast_resistance = 1.5,
_mcl_hardness = 0.3, _mcl_hardness = 0.3,
@ -28,7 +29,8 @@ minetest.register_node("mesecons_lightstone:lightstone_on", {
mesecons = {effector = { mesecons = {effector = {
action_off = function (pos, node) action_off = function (pos, node)
minetest.swap_node(pos, {name="mesecons_lightstone:lightstone_off", param2 = node.param2}) minetest.swap_node(pos, {name="mesecons_lightstone:lightstone_off", param2 = node.param2})
end end,
rules = mesecon.rules.alldirs,
}}, }},
_mcl_blast_resistance = 1.5, _mcl_blast_resistance = 1.5,
_mcl_hardness = 0.3, _mcl_hardness = 0.3,

View File

@ -5,32 +5,22 @@ piston_rules =
{{x=0, y=0, z=1}, --everything apart from z- (pusher side) {{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=0, z=0}, {x=-1, y=0, z=0},
{x=1, y=1, z=0}, {x=0, y=1, z=0},
{x=1, y=-1, z=0}, {x=0, 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}}
local piston_up_rules = local piston_up_rules =
{{x=0, y=0, z=-1}, --everything apart from y+ (pusher side) {{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=0, y=0, z=1},
{x=1, y=-1, z=0}, {x=-1, y=0, z=0},
{x=-1, y=-1, z=0}, {x=1, y=0, z=1},
{x=0, y=-1, z=1}, {x=0, y=-1, z=0}}
{x=0, y=-1, z=-1}}
local piston_down_rules = local piston_down_rules =
{{x=0, y=0, z=-1}, --everything apart from y- (pusher side) {{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=0, y=0, z=1},
{x=1, y=1, z=0}, {x=-1, y=0, z=0},
{x=-1, y=1, z=0}, {x=1, y=0, z=1},
{x=0, y=1, z=1}, {x=0, y=1, z=0}}
{x=0, y=1, z=-1}}
local piston_get_rules = function (node) local piston_get_rules = function (node)
local rules = piston_rules local rules = piston_rules

View File

@ -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}, groups = {handy=1,axey=1, not_in_creative_inventory = 1, material_wood=1},
sounds = mcl_sounds.node_sound_glass_defaults(), sounds = mcl_sounds.node_sound_glass_defaults(),
mesecons = {receptor = { mesecons = {receptor = {
state = mesecon.state.on state = mesecon.state.on,
rules = mesecon.rules.alldirs,
}}, }},
on_rightclick = function(pos, node, clicker, pointed_thing) on_rightclick = function(pos, node, clicker, pointed_thing)
minetest.swap_node(pos, {name = "mesecons_solarpanel:solar_panel_inverted_off"}) 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.", _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(), sounds = mcl_sounds.node_sound_glass_defaults(),
mesecons = {receptor = { mesecons = {receptor = {
state = mesecon.state.off state = mesecon.state.off,
rules = mesecon.rules.alldirs,
}}, }},
on_rightclick = function(pos, node, clicker, pointed_thing) on_rightclick = function(pos, node, clicker, pointed_thing)
minetest.swap_node(pos, {name = "mesecons_solarpanel:solar_panel_inverted_on"}) minetest.swap_node(pos, {name = "mesecons_solarpanel:solar_panel_inverted_on"})

View File

@ -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.", _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 }, groups = { dig_immediate = 3, tnt = 1, enderman_takable=1 },
mesecons = {effector = { mesecons = {effector = {
action_on = tnt.ignite action_on = tnt.ignite,
rules = mesecon.rules.alldirs,
}}, }},
_on_ignite = function(player, pointed_thing) _on_ignite = function(player, pointed_thing)
tnt.ignite(pointed_thing.under) tnt.ignite(pointed_thing.under)