1 -- Pipeworks mod by Vanessa Ezekowitz - 2013-07-13
3 -- This mod supplies various steel pipes and plastic pneumatic tubes
4 -- and devices that they can connect to.
13 pipeworks
.worldpath
= minetest
.get_worldpath()
14 pipeworks
.modpath
= minetest
.get_modpath("pipeworks")
16 dofile(pipeworks
.modpath
.."/default_settings.txt")
18 -- Read the external config file if it exists.
19 if io
.open(pipeworks
.worldpath
.."/pipeworks_settings.txt","r") then
20 dofile(pipeworks
.worldpath
.."/pipeworks_settings.txt")
26 pipeworks
.expect_infinite_stacks
= true
27 if minetest
.get_modpath("unified_inventory") or not minetest
.settings
:get_bool("creative_mode") then
28 pipeworks
.expect_infinite_stacks
= false
31 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}}
33 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},
34 {x
=0, y
=1, z
=1},{x
=0, y
=1, z
=-1},{x
=1, y
=1, z
=0},{x
=-1, y
=1, z
=0},
35 {x
=0, y
=-1, z
=1},{x
=0, y
=-1, z
=-1},{x
=1, y
=-1, z
=0},{x
=-1, y
=-1, z
=0},
36 {x
=0, y
=1, z
=0}, {x
=0, y
=-1, z
=0}}
38 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}}
40 pipeworks
.liquid_texture
= "default_water.png"
44 function pipeworks
.fix_image_names(table, replacement
)
46 for i
in ipairs(table) do
47 outtable
[i
]=string.gsub(table[i
], "_XXXXX", replacement
)
53 function pipeworks
.add_node_box(t
, b
)
55 do table.insert(t
, b
[i
])
59 function pipeworks
.node_is_owned(pos
, placer
)
60 local is_protected
= minetest
.is_protected(pos
, placer
:get_player_name())
62 minetest
.chat_send_player(placer
:get_player_name(), S("Someone owns this spot."))
69 function pipeworks
.replace_name(tbl
,tr
,name
)
71 for key
,i
in pairs(tbl
) do
72 if type(i
)=="string" then
73 ntbl
[key
]=string.gsub(i
,tr
,name
)
74 elseif type(i
)=="table" then
75 ntbl
[key
]=pipeworks
.replace_name(i
,tr
,name
)
83 -------------------------------------------
84 -- Load the various other parts of the mod
86 dofile(pipeworks
.modpath
.."/models.lua")
87 dofile(pipeworks
.modpath
.."/autoplace_pipes.lua")
88 dofile(pipeworks
.modpath
.."/autoplace_tubes.lua")
89 dofile(pipeworks
.modpath
.."/item_transport.lua")
90 dofile(pipeworks
.modpath
.."/flowing_logic.lua")
91 dofile(pipeworks
.modpath
.."/crafts.lua")
92 dofile(pipeworks
.modpath
.."/tubes.lua")
94 if pipeworks
.enable_pipes
then dofile(pipeworks
.modpath
.."/pipes.lua") end
95 if pipeworks
.enable_teleport_tube
then dofile(pipeworks
.modpath
.."/teleport_tube.lua") end
96 if pipeworks
.enable_pipe_devices
then dofile(pipeworks
.modpath
.."/devices.lua") end
97 if pipeworks
.enable_redefines
then dofile(pipeworks
.modpath
.."/compat.lua") end
98 if pipeworks
.enable_autocrafter
then dofile(pipeworks
.modpath
.."/autocrafter.lua") end
99 if pipeworks
.enable_deployer
then dofile(pipeworks
.modpath
.."/deployer.lua") end
100 if pipeworks
.enable_node_breaker
then dofile(pipeworks
.modpath
.."/node_breaker.lua") end
102 minetest
.register_alias("pipeworks:pipe", "pipeworks:pipe_110000_empty")
104 minetest
.log("action", "Pipeworks loaded!")