From 5075cc48a4c94bbb84e61251d8414f5b1d66f65b Mon Sep 17 00:00:00 2001
From: stujones11 <stujones111@gmail.com>
Date: Sun, 17 Aug 2014 17:00:52 +0100
Subject: [PATCH] Allow per world configuration overrides

---
 3d_armor/README.txt | 4 +++-
 3d_armor/armor.lua  | 8 ++++++++
 README.md           | 2 +-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/3d_armor/README.txt b/3d_armor/README.txt
index 74c8a8a..d64cabd 100644
--- a/3d_armor/README.txt
+++ b/3d_armor/README.txt
@@ -14,6 +14,8 @@ Overall level is boosted by 10% when wearing a full matching set.
 Configuration
 -------------
 
-Armor can be configured by adding a file called armor.conf in 3d_armor mod directory.
+Armor can be configured by adding a file called armor.conf in 3d_armor mod and/or world directory.
 see armor.conf.example for all available options.
 
+Note: worldpath config settings override any settings made in the mod's directory.
+
diff --git a/3d_armor/armor.lua b/3d_armor/armor.lua
index ccb074c..d0ce97b 100644
--- a/3d_armor/armor.lua
+++ b/3d_armor/armor.lua
@@ -8,12 +8,20 @@ ARMOR_LEVEL_MULTIPLIER = 1
 ARMOR_HEAL_MULTIPLIER = 1
 
 local modpath = minetest.get_modpath(ARMOR_MOD_NAME)
+local worldpath = minetest.get_worldpath()
 local input = io.open(modpath.."/armor.conf", "r")
 if input then
 	dofile(modpath.."/armor.conf")
 	input:close()
 	input = nil
 end
+input = io.open(worldpath.."/armor.conf", "r")
+if input then
+	dofile(worldpath.."/armor.conf")
+	input:close()
+	input = nil
+end
+
 local time = 0
 
 armor = {
diff --git a/README.md b/README.md
index 315c09a..2041ec6 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ when wearing a full matching set (helmet, chestplate, leggings and boots of the
 
 Compatible with player skins [skins] by Zeg9 and Player Textures [player_textures] by PilzAdam.
 
-Armor can be configured by adding a file called armor.conf in 3d_armor mod directory.
+Armor can be configured by adding a file called armor.conf in 3d_armor mod or world directory.
 see armor.conf.example for all available options.
 
 [mod] Visible Wielded Items [wieldview]