make worldpath and modpath pipeworks-namespace-specific and global
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>
Tue, 29 Oct 2013 18:08:23 +0000 (14:08 -0400)
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>
Tue, 29 Oct 2013 18:08:23 +0000 (14:08 -0400)
init.lua
item_transport.lua

index 106b471fe2a229ad19a375baa9668e23ffd5e709..afbe3a86427b3b90e4505bf0f3cf71eeef599973 100644 (file)
--- a/init.lua
+++ b/init.lua
@@ -8,17 +8,19 @@
 
 -- Read (and if necessary, copy) the config file
 
+pipeworks = {}
+
 local DEBUG = false
 
-local worldpath = minetest.get_worldpath()
-local modpath = minetest.get_modpath("pipeworks")
+pipeworks.worldpath = minetest.get_worldpath()
+pipeworks.modpath = minetest.get_modpath("pipeworks")
 
-dofile(modpath.."/default_settings.txt")
+dofile(pipeworks.modpath.."/default_settings.txt")
 
-if io.open(worldpath.."/pipeworks_settings.txt","r") == nil then
+if io.open(pipeworks.worldpath.."/pipeworks_settings.txt","r") == nil then
 
-       io.input(modpath.."/default_settings.txt")
-       io.output(worldpath.."/pipeworks_settings.txt")
+       io.input(pipeworks.modpath.."/default_settings.txt")
+       io.output(pipeworks.worldpath.."/pipeworks_settings.txt")
 
        local size = 2^13      -- good buffer size (8K)
        while true do
@@ -31,7 +33,7 @@ if io.open(worldpath.."/pipeworks_settings.txt","r") == nil then
        end
 
 else
-       dofile(worldpath.."/pipeworks_settings.txt")
+       dofile(pipeworks.worldpath.."/pipeworks_settings.txt")
 end
 
 -- Helper functions
@@ -106,24 +108,24 @@ end
 
 -- Load the various parts of the mod
 
-dofile(modpath.."/autoplace.lua")
-dofile(modpath.."/item_transport.lua")
-dofile(modpath.."/flowing_logic.lua")
-dofile(modpath.."/crafts.lua")
+dofile(pipeworks.modpath.."/autoplace.lua")
+dofile(pipeworks.modpath.."/item_transport.lua")
+dofile(pipeworks.modpath.."/flowing_logic.lua")
+dofile(pipeworks.modpath.."/crafts.lua")
 
-dofile(modpath.."/tubes.lua")
+dofile(pipeworks.modpath.."/tubes.lua")
 
 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 enable_pipes then dofile(modpath.."/pipes.lua") end
-if enable_teleport_tube then dofile(modpath.."/teleport_tube.lua") end
-if enable_pipe_devices then dofile(modpath.."/devices.lua") end
-if enable_redefines then dofile(modpath.."/compat.lua") end
-if enable_autocrafter then dofile(modpath.."/autocrafter.lua") end
-if enable_deployer then dofile(modpath.."/deployer.lua") end
-if enable_node_breaker then dofile(modpath.."/node_breaker.lua") end
+if enable_pipes then dofile(pipeworks.modpath.."/pipes.lua") end
+if enable_teleport_tube then dofile(pipeworks.modpath.."/teleport_tube.lua") end
+if enable_pipe_devices then dofile(pipeworks.modpath.."/devices.lua") end
+if enable_redefines then dofile(pipeworks.modpath.."/compat.lua") end
+if enable_autocrafter then dofile(pipeworks.modpath.."/autocrafter.lua") end
+if enable_deployer then dofile(pipeworks.modpath.."/deployer.lua") end
+if enable_node_breaker then dofile(pipeworks.modpath.."/node_breaker.lua") end
 
 minetest.register_alias("pipeworks:pipe", "pipeworks:pipe_110000_empty")
 
index 3e7ff0a3caa560ed4bb5a7a564cd47fc001907d1..69909072c4de3952046840ea7679cd7e063c8add 100644 (file)
@@ -1,6 +1,4 @@
-modpath=minetest.get_modpath("pipeworks")
-
-dofile(modpath.."/compat.lua")
+dofile(pipeworks.modpath.."/compat.lua")
 
 --define the functions from https://github.com/minetest/minetest/pull/834 while waiting for the devs to notice it
 local function dir_to_facedir(dir, is6d)