mesecons_rules must be global. made so, confined to pipeworks.{} table.

This commit is contained in:
Vanessa Ezekowitz 2013-12-21 03:33:06 -05:00
parent bdbdab0dfd
commit f57443e96f
3 changed files with 15 additions and 15 deletions

View File

@ -7,14 +7,14 @@ if mesecon then
pipereceptor_on = { pipereceptor_on = {
receptor = { receptor = {
state = mesecon.state.on, state = mesecon.state.on,
rules = mesecons_rules rules = pipeworks.mesecons_rules
} }
} }
pipereceptor_off = { pipereceptor_off = {
receptor = { receptor = {
state = mesecon.state.off, state = mesecon.state.off,
rules = mesecons_rules rules = pipeworks.mesecons_rules
} }
} }
end end

View File

@ -30,6 +30,13 @@ end
pipeworks.meseadjlist={{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=0,y=1,z=0},{x=0,y=-1,z=0},{x=1,y=0,z=0},{x=-1,y=0,z=0}} pipeworks.meseadjlist={{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=0,y=1,z=0},{x=0,y=-1,z=0},{x=1,y=0,z=0},{x=-1,y=0,z=0}}
pipeworks.rules_all = {{x=0, y=0, z=1},{x=0, y=0, z=-1},{x=1, y=0, z=0},{x=-1, y=0, z=0},
{x=0, y=1, z=1},{x=0, y=1, 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=-1, z=0},{x=-1, y=-1, z=0},
{x=0, y=1, z=0}, {x=0, y=-1, z=0}}
pipeworks.mesecons_rules={{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=1,z=0},{x=0,y=-1,z=0}}
pipeworks.liquid_texture = "default_water.png" pipeworks.liquid_texture = "default_water.png"
-- Helper functions -- Helper functions
@ -107,10 +114,6 @@ dofile(pipeworks.modpath.."/flowing_logic.lua")
dofile(pipeworks.modpath.."/crafts.lua") dofile(pipeworks.modpath.."/crafts.lua")
dofile(pipeworks.modpath.."/tubes.lua") dofile(pipeworks.modpath.."/tubes.lua")
pipeworks.rules_all = {{x=0, y=0, z=1},{x=0, y=0, z=-1},{x=1, y=0, z=0},{x=-1, y=0, z=0},
{x=0, y=1, z=1},{x=0, y=1, 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=-1, z=0},{x=-1, y=-1, z=0},
{x=0, y=1, z=0}, {x=0, y=-1, z=0}}
if pipeworks.enable_pipes then dofile(pipeworks.modpath.."/pipes.lua") end if pipeworks.enable_pipes then dofile(pipeworks.modpath.."/pipes.lua") end
if pipeworks.enable_teleport_tube then dofile(pipeworks.modpath.."/teleport_tube.lua") end if pipeworks.enable_teleport_tube then dofile(pipeworks.modpath.."/teleport_tube.lua") end
if pipeworks.enable_pipe_devices then dofile(pipeworks.modpath.."/devices.lua") end if pipeworks.enable_pipe_devices then dofile(pipeworks.modpath.."/devices.lua") end

View File

@ -324,9 +324,6 @@ if pipeworks.enable_mese_tube then
}) })
end end
local mesecons_rules={{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=1,z=0},{x=0,y=-1,z=0}}
if pipeworks.enable_detector_tube then if pipeworks.enable_detector_tube then
local detector_plain_textures={"pipeworks_detector_tube_plain.png","pipeworks_detector_tube_plain.png","pipeworks_detector_tube_plain.png", local detector_plain_textures={"pipeworks_detector_tube_plain.png","pipeworks_detector_tube_plain.png","pipeworks_detector_tube_plain.png",
@ -346,14 +343,14 @@ if pipeworks.enable_detector_tube then
groups={mesecon=2,not_in_creative_inventory=1}, groups={mesecon=2,not_in_creative_inventory=1},
drop="pipeworks:detector_tube_off_000000", drop="pipeworks:detector_tube_off_000000",
mesecons={receptor={state="on", mesecons={receptor={state="on",
rules=mesecons_rules}}, rules=pipeworks.mesecons_rules}},
item_exit = function(pos) item_exit = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local nitems=meta:get_int("nitems")-1 local nitems=meta:get_int("nitems")-1
local name = minetest.get_node(pos).name local name = minetest.get_node(pos).name
if nitems==0 then if nitems==0 then
minetest.set_node(pos,{name=string.gsub(name,"on","off")}) minetest.set_node(pos,{name=string.gsub(name,"on","off")})
mesecon:receptor_off(pos,mesecons_rules) mesecon:receptor_off(pos,pipeworks.mesecons_rules)
else else
meta:set_int("nitems", nitems) meta:set_int("nitems", nitems)
end end
@ -370,12 +367,12 @@ if pipeworks.enable_detector_tube then
{tube={can_go=function(pos,node,velocity,stack) {tube={can_go=function(pos,node,velocity,stack)
local name = minetest.get_node(pos).name local name = minetest.get_node(pos).name
minetest.set_node(pos,{name=string.gsub(name,"off","on")}) minetest.set_node(pos,{name=string.gsub(name,"off","on")})
mesecon:receptor_on(pos,mesecons_rules) mesecon:receptor_on(pos,pipeworks.mesecons_rules)
return pipeworks.notvel(pipeworks.meseadjlist,velocity) return pipeworks.notvel(pipeworks.meseadjlist,velocity)
end}, end},
groups={mesecon=2}, groups={mesecon=2},
mesecons={receptor={state="off", mesecons={receptor={state="off",
rules=mesecons_rules}} rules=pipeworks.mesecons_rules}}
}) })
end end
@ -400,7 +397,7 @@ if pipeworks.enable_conductor_tube then
conductor_end_textures,conductor_short_texture,conductor_inv_texture, conductor_end_textures,conductor_short_texture,conductor_inv_texture,
{groups={mesecon=2}, {groups={mesecon=2},
mesecons={conductor={state="off", mesecons={conductor={state="off",
rules=mesecons_rules, rules=pipeworks.mesecons_rules,
onstate="pipeworks:conductor_tube_on_#id"}} onstate="pipeworks:conductor_tube_on_#id"}}
}) })
@ -409,7 +406,7 @@ if pipeworks.enable_conductor_tube then
{groups={mesecon=2,not_in_creative_inventory=1}, {groups={mesecon=2,not_in_creative_inventory=1},
drop="pipeworks:conductor_tube_off_000000", drop="pipeworks:conductor_tube_off_000000",
mesecons={conductor={state="on", mesecons={conductor={state="on",
rules=mesecons_rules, rules=pipeworks.mesecons_rules,
offstate="pipeworks:conductor_tube_off_#id"}} offstate="pipeworks:conductor_tube_off_#id"}}
}) })
end end