Clean up the redstone rules
This commit is contained in:
parent
54c0d1d750
commit
e4ab20509f
7 changed files with 44 additions and 79 deletions
|
@ -15,22 +15,6 @@ mesecon.rules.default =
|
|||
{x=0, y=1, z=-1},
|
||||
{x=0, y=-1, z=-1}}
|
||||
|
||||
mesecon.rules.pplate = mesecon.mergetable(mesecon.rules.default, {{x=0, y=-2, z=0}})
|
||||
|
||||
mesecon.rules.buttonlike =
|
||||
{{x = 1, y = 0, z = 0},
|
||||
{x = 1, y = 1, z = 0},
|
||||
{x = 1, y =-1, z = 0},
|
||||
{x = 1, y =-1, z = 1},
|
||||
{x = 1, y =-1, z =-1},
|
||||
{x = 2, y = 0, z = 0}}
|
||||
|
||||
mesecon.rules.flat =
|
||||
{{x = 1, y = 0, z = 0},
|
||||
{x =-1, y = 0, z = 0},
|
||||
{x = 0, y = 0, z = 1},
|
||||
{x = 0, y = 0, z =-1}}
|
||||
|
||||
mesecon.rules.alldirs =
|
||||
{{x= 1, y= 0, z= 0},
|
||||
{x=-1, y= 0, z= 0},
|
||||
|
@ -39,6 +23,42 @@ mesecon.rules.alldirs =
|
|||
{x= 0, y= 0, z= 1},
|
||||
{x= 0, y= 0, z=-1}}
|
||||
|
||||
mesecon.rules.pplate =
|
||||
{{x = 1, y = 0, z = 0},
|
||||
{x =-1, y = 0, z = 0},
|
||||
{x = 0, y = 1, z = 0},
|
||||
{x = 0, y =-1, z = 0},
|
||||
{x = 0, y = 0, z = 1},
|
||||
{x = 0, y = 0, z =-1},
|
||||
{x = 0, y = -2, 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}}
|
||||
|
||||
mesecon.rules.buttonlike =
|
||||
{{x = 1, y = 0, z = 0},
|
||||
{x = 1, y = 1, z = 0},
|
||||
{x = 1, y =-1, z = 0},
|
||||
{x = 1, y = 0, z =-1},
|
||||
{x = 1, y = 0, z = 1},
|
||||
{x = 2, y = 0, z = 0},
|
||||
{x = 0, y = 1, z = 0},
|
||||
{x = 0, y = -1, z = 0},
|
||||
{x =-1, y = 0, z = 0},
|
||||
{x = 0, y = 0, z = 1},
|
||||
{x = 0, y = 0, z =-1}}
|
||||
|
||||
mesecon.rules.flat =
|
||||
{{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 = 2, y = 0, z = 0},
|
||||
{x =-2, y = 0, z = 0},
|
||||
{x = 0, y = 0, z = 2},
|
||||
{x = 0, y = 0, z =-2}}
|
||||
|
||||
mesecon.rules.buttonlike_get = function(node)
|
||||
local rules = mesecon.rules.buttonlike
|
||||
local dir = minetest.facedir_to_dir(node.param2)
|
||||
|
|
|
@ -2,11 +2,7 @@
|
|||
-- A button that when pressed emits power for 1 second
|
||||
-- and then turns off again
|
||||
|
||||
-- FIXME: Power node behind as well
|
||||
local button_get_output_rules = function(node)
|
||||
local rules = mesecon.rules.alldirs
|
||||
return rules
|
||||
end
|
||||
local button_get_output_rules = mesecon.rules.buttonlike_get
|
||||
|
||||
local boxes_off = {
|
||||
type = "wallmounted",
|
||||
|
|
|
@ -26,7 +26,8 @@ The note block will only play a note when it is below air, otherwise, it stays s
|
|||
mesecons = {effector = { -- play sound when activated
|
||||
action_on = function (pos, node)
|
||||
mesecon.noteblock_play(pos, node.param2)
|
||||
end
|
||||
end,
|
||||
rules = mesecon.rules.alldirs,
|
||||
}},
|
||||
_mcl_blast_resistance = 4,
|
||||
_mcl_hardness = 0.8,
|
||||
|
|
|
@ -10,22 +10,6 @@ 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
|
||||
|
@ -68,7 +52,7 @@ local function pp_on_timer(pos, elapsed)
|
|||
end
|
||||
if disable then
|
||||
minetest.set_node(pos, {name = basename .. "_off"})
|
||||
mesecon.receptor_off(pos, pplate_rules)
|
||||
mesecon.receptor_off(pos, mesecon.rules.pplate)
|
||||
end
|
||||
elseif node.name == basename .. "_off" then
|
||||
for k, obj in pairs(objs) do
|
||||
|
@ -76,7 +60,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, pplate_rules)
|
||||
mesecon.receptor_on(pos, mesecon.rules.pplate)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
@ -137,7 +121,7 @@ function mesecon.register_pressure_plate(basename, description, textures_off, te
|
|||
groups = groups_off,
|
||||
tiles = textures_off,
|
||||
|
||||
mesecons = {receptor = { state = mesecon.state.off, rules = pplate_rules }},
|
||||
mesecons = {receptor = { state = mesecon.state.off, rules = mesecon.rules.pplate }},
|
||||
_doc_items_longdesc = longdesc,
|
||||
},{
|
||||
node_box = pp_box_on,
|
||||
|
@ -145,7 +129,7 @@ function mesecon.register_pressure_plate(basename, description, textures_off, te
|
|||
groups = groups_on,
|
||||
tiles = textures_on,
|
||||
|
||||
mesecons = {receptor = { state = mesecon.state.on, rules = pplate_rules }},
|
||||
mesecons = {receptor = { state = mesecon.state.on, rules = mesecon.rules.pplate }},
|
||||
_doc_items_create_entry = false,
|
||||
})
|
||||
|
||||
|
|
|
@ -1,17 +1,4 @@
|
|||
local lever_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},
|
||||
}
|
||||
local dir = minetest.facedir_to_dir(node.param2)
|
||||
dir = vector.multiply(dir, 2)
|
||||
table.insert(rules, dir)
|
||||
return rules
|
||||
end
|
||||
local lever_get_output_rules = mesecon.rules.buttonlike_get
|
||||
|
||||
-- LEVER
|
||||
minetest.register_node("mesecons_walllever:wall_lever_off", {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue