summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2014-07-26 19:03:07 +0100
committerZefram <zefram@fysh.org>2014-07-26 19:20:45 +0100
commit9f0b41fe713e0ff973c09e2f8e52624d40551ff9 (patch)
tree51c99ce6f8080b65962d697f726b7f5f0b6afddb
parentdd65a68ce9f494717faffc98c45814f9a9d67fa4 (diff)
Make technic_worldgen loadable before technic
There was a small amount of dependency of technic_worldgen on the technic mod, for configuration loading and the top-level "technic" table. Resolve that by sharing the configuration and top-level table between the two mods. This means that technic_worldgen can be loaded before technic, permitting other mods to depend on it without depending on technic.
-rw-r--r--technic/config.lua9
-rw-r--r--technic/init.lua2
-rw-r--r--technic_worldgen/config.lua15
-rw-r--r--technic_worldgen/depends.txt1
-rw-r--r--technic_worldgen/init.lua2
5 files changed, 19 insertions, 10 deletions
diff --git a/technic/config.lua b/technic/config.lua
index 1dfce66..e512bee 100644
--- a/technic/config.lua
+++ b/technic/config.lua
@@ -1,7 +1,4 @@
-
-local worldpath = minetest.get_worldpath()
-
-technic.config = Settings(worldpath.."/technic.conf")
+technic.config = technic.config or Settings(minetest.get_worldpath().."/technic.conf")
local conf_table = technic.config:to_table()
@@ -9,9 +6,6 @@ local defaults = {
enable_mining_drill = "true",
enable_mining_laser = "true",
enable_flashlight = "false",
- enable_rubber_tree_generation = "true",
- enable_marble_generation = "true",
- enable_granite_generation = "true",
enable_wind_mill = "false",
enable_corium_griefing = "true",
}
@@ -21,4 +15,3 @@ for k, v in pairs(defaults) do
technic.config:set(k, v)
end
end
-
diff --git a/technic/init.lua b/technic/init.lua
index 2349029..fcd1cd9 100644
--- a/technic/init.lua
+++ b/technic/init.lua
@@ -2,7 +2,7 @@
-- namespace: technic
-- (c) 2012-2013 by RealBadAngel <mk@realbadangel.pl>
-technic = {}
+technic = technic or {}
local load_start = os.clock()
local modpath = minetest.get_modpath("technic")
diff --git a/technic_worldgen/config.lua b/technic_worldgen/config.lua
new file mode 100644
index 0000000..4ac748c
--- /dev/null
+++ b/technic_worldgen/config.lua
@@ -0,0 +1,15 @@
+technic.config = technic.config or Settings(minetest.get_worldpath().."/technic.conf")
+
+local conf_table = technic.config:to_table()
+
+local defaults = {
+ enable_granite_generation = "true",
+ enable_marble_generation = "true",
+ enable_rubber_tree_generation = "true",
+}
+
+for k, v in pairs(defaults) do
+ if conf_table[k] == nil then
+ technic.config:set(k, v)
+ end
+end
diff --git a/technic_worldgen/depends.txt b/technic_worldgen/depends.txt
index a72ad90..ac858d0 100644
--- a/technic_worldgen/depends.txt
+++ b/technic_worldgen/depends.txt
@@ -1,4 +1,3 @@
default
-technic
intllib?
mg?
diff --git a/technic_worldgen/init.lua b/technic_worldgen/init.lua
index 7e80fd3..73e9fc7 100644
--- a/technic_worldgen/init.lua
+++ b/technic_worldgen/init.lua
@@ -1,5 +1,6 @@
local modpath = minetest.get_modpath("technic_worldgen")
+technic = technic or {}
technic.worldgen = {}
if intllib then
technic.worldgen.gettext = intllib.Getter()
@@ -7,6 +8,7 @@ else
technic.worldgen.gettext = function(s) return s end
end
+dofile(modpath.."/config.lua")
dofile(modpath.."/nodes.lua")
dofile(modpath.."/oregen.lua")
dofile(modpath.."/crafts.lua")