From e12220be79e25c1c5cb866e1e98091d35079cd3e Mon Sep 17 00:00:00 2001
From: Sires <ranearodrigo1@gmail.com>
Date: Mon, 26 Aug 2019 19:52:41 +0200
Subject: [PATCH] Add translation for technic mod

---
 technic/config.lua |   48 ++++++++++++++----------------------------------
 1 files changed, 14 insertions(+), 34 deletions(-)

diff --git a/technic/config.lua b/technic/config.lua
index f546cf6..bb748ec 100644
--- a/technic/config.lua
+++ b/technic/config.lua
@@ -1,42 +1,22 @@
-technic.config = {}
+technic.config = technic.config or Settings(minetest.get_worldpath().."/technic.conf")
 
-technic.config.loaded = {}
+local conf_table = technic.config:to_table()
 
-technic.config.default = {
+local defaults = {
 	enable_mining_drill = "true",
 	enable_mining_laser = "true",
-	enable_flashlight = "true",
-	enable_item_drop = "true",
-	enable_item_pickup = "true",
-	enable_rubber_tree_generation = "true",
-	enable_marble_generation = "true",
-	enable_granite_generation = "true"
+	enable_flashlight = "false",
+	enable_wind_mill = "false",
+	enable_frames = "false",
+	enable_corium_griefing = "true",
+	enable_radiation_protection = "true",
+	enable_entity_radiation_damage = "true",
+	enable_longterm_radiation_damage = "true",
+	enable_nuclear_reactor_digiline_selfdestruct = "false",
 }
 
-function technic.config:load(filename)
-	file, error = io.open(filename, "r")
-	if error then return end
-	local line = file:read("*l")
-	while line do
-		local found, _, setting, value = line:find("^([^#%s=]+)%s?=%s?([^%s#]+)")
-		if found then
-			self.loaded[setting] = value
-		end
-		line = file:read("*l")
+for k, v in pairs(defaults) do
+	if conf_table[k] == nil then
+		technic.config:set(k, v)
 	end
-	file:close()
-end
-
-technic.config:load(minetest.get_worldpath().."/technic.conf")
-
-function technic.config:get(setting)
-	if self.loaded[setting] then
-		return self.loaded[setting]
-	else
-		return self.default[setting]
-	end
-end
-
-function technic.config:getBool(setting)
-	return string.lower(self:get(setting)) == "true"
 end

--
Gitblit v1.8.0