Update param2 as per kahrl's suggestions.

This commit is contained in:
Anthony Zhang 2012-01-26 16:33:11 -05:00
parent 688f65947f
commit cbe6b4f7be
2 changed files with 28 additions and 42 deletions

@ -36,16 +36,16 @@ minetest.register_on_punchnode(function(pos, node, puncher)
if node.name == "jeija:wall_button_off" then if node.name == "jeija:wall_button_off" then
minetest.env:add_node(pos, {name="jeija:wall_button_on",param2=node.param2}) minetest.env:add_node(pos, {name="jeija:wall_button_on",param2=node.param2})
local rules_string="" local rules_string=""
if node.param2 == 32 then if node.param2 == 5 then
rules_string="button_z+" rules_string="button_z+"
end end
if node.param2 == 2 then if node.param2 == 3 then
rules_string="button_x+" rules_string="button_x+"
end end
if node.param2 == 16 then if node.param2 == 4 then
rules_string="button_z-" rules_string="button_z-"
end end
if node.param2 == 1 then if node.param2 == 2 then
rules_string="button_x-" rules_string="button_x-"
end end
mesecon:receptor_on(pos, rules_string) mesecon:receptor_on(pos, rules_string)
@ -59,16 +59,16 @@ minetest.register_abm({
minetest.env:add_node(pos, {name="jeija:wall_button_off",param2=node.param2}) minetest.env:add_node(pos, {name="jeija:wall_button_off",param2=node.param2})
local rules_string="" local rules_string=""
if node.param2 == 32 then if node.param2 == 5 then
rules_string="button_z+" rules_string="button_z+"
end end
if node.param2 == 2 then if node.param2 == 3 then
rules_string="button_x+" rules_string="button_x+"
end end
if node.param2 == 16 then if node.param2 == 4 then
rules_string="button_z-" rules_string="button_z-"
end end
if node.param2 == 1 then if node.param2 == 2 then
rules_string="button_x-" rules_string="button_x-"
end end
mesecon:receptor_off(pos, rules_string) mesecon:receptor_off(pos, rules_string)

@ -48,33 +48,24 @@ minetest.register_abm({
pa.y = 1 pa.y = 1
local rules_string="" local rules_string=""
if node.param2 == 32 then if node.param2 == 5 then
pa.z = -1 pa.z = -1
rules_string="mesecontorch_z+" rules_string="mesecontorch_z+"
end elseif node.param2 == 3 then
if node.param2 == 2 then
pa.x = -1 pa.x = -1
rules_string="mesecontorch_x+" rules_string="mesecontorch_x+"
end elseif node.param2 == 4 then
if node.param2 == 16 then
pa.z = 1 pa.z = 1
rules_string="mesecontorch_z-" rules_string="mesecontorch_z-"
end elseif node.param2 == 2 then
if node.param2 == 1 then
pa.x = 1 pa.x = 1
rules_string="mesecontorch_x-" rules_string="mesecontorch_x-"
end elseif node.param2 == 0 then
if node.param2 == 4 then
rules_string="mesecontorch_y-"
pa.y = 1 pa.y = 1
pa.z=0 rules_string="mesecontorch_y-"
pa.x=0 elseif node.param2 == 1 then
end
if node.param2 == 8 then
rules_string="mesecontorch_y+"
pa.y = -1 pa.y = -1
pa.z=0 rules_string="mesecontorch_y+"
pa.x=0
end end
if mesecon:is_power_on({x=pos.x, y=pos.y, z=pos.z}, pa.x, pa.y, pa.z)==1 then if mesecon:is_power_on({x=pos.x, y=pos.y, z=pos.z}, pa.x, pa.y, pa.z)==1 then
@ -103,22 +94,17 @@ minetest.register_on_placenode(function(pos, node, placer)
if node.name == "jeija:mesecon_torch_on" then if node.name == "jeija:mesecon_torch_on" then
local rules_string="" local rules_string=""
if node.param2 == 32 then if node.param2 == 5 then
rules_string="mesecontorch_z+" rules_string="mesecontorch_z+"
end elseif node.param2 == 3 then
if node.param2 == 2 then
rules_string="mesecontorch_x+" rules_string="mesecontorch_x+"
end elseif node.param2 == 4 then
if node.param2 == 16 then
rules_string="mesecontorch_z-" rules_string="mesecontorch_z-"
end elseif node.param2 == 2 then
if node.param2 == 1 then
rules_string="mesecontorch_x-" rules_string="mesecontorch_x-"
end elseif node.param2 == 0 then
if node.param2 == 4 then
rules_string="mesecontorch_y-" rules_string="mesecontorch_y-"
end elseif node.param2 == 1 then
if node.param2 == 8 then
rules_string="mesecontorch_y+" rules_string="mesecontorch_y+"
end end
@ -130,9 +116,9 @@ mesecon:add_receptor_node("jeija:mesecon_torch_on")
mesecon:add_receptor_node_off("jeija:mesecon_torch_off") mesecon:add_receptor_node_off("jeija:mesecon_torch_off")
-- Param2 Table (Block Attached To) -- Param2 Table (Block Attached To)
-- 32 = z-1 -- 5 = z-1
-- 2 = x-1 -- 3 = x-1
-- 16 = z+1 -- 4 = z+1
-- 1 = x+1 -- 2 = x+1
-- 4 = y+1 -- 0 = y+1
-- 8 = y-1 -- 1 = y-1