From a45c1c915ab436225145024925afdf1814ce49e7 Mon Sep 17 00:00:00 2001
From: JP Guerrero <jeanpatrick.guerrero@gmail.com>
Date: Thu, 8 Mar 2018 21:12:21 +0100
Subject: [PATCH] Fix style issues with previous commit

---
 handlers/helpers.lua      |  5 ++---
 handlers/registration.lua | 17 ++++++++---------
 init.lua                  | 12 ++++--------
 settingtypes.txt          | 20 ++++++++++----------
 src/enchanting.lua        | 10 ----------
 5 files changed, 24 insertions(+), 40 deletions(-)

diff --git a/handlers/helpers.lua b/handlers/helpers.lua
index e6ad8b9..cbb9113 100644
--- a/handlers/helpers.lua
+++ b/handlers/helpers.lua
@@ -29,10 +29,9 @@ function xdecor.tablecopy(T)
 	return new
 end
 
--- Return true if a def is accepting for stair
 function xdecor.stairs_valid_def(def)
 	return (def.drawtype == "normal" or def.drawtype:sub(1,5) == "glass") and
-		(def.groups.cracky or def.groups.choppy) and
+	       (def.groups.cracky or def.groups.choppy) and
 		not def.on_construct and
 		not def.after_place_node and
 		not def.on_rightclick and
@@ -46,5 +45,5 @@ function xdecor.stairs_valid_def(def)
 		not def.mesecons and
 		def.description and
 		def.description ~= "" and
-	def.light_source == 0
+		def.light_source == 0
 end
diff --git a/handlers/registration.lua b/handlers/registration.lua
index 0b7f2d6..f0db4fa 100644
--- a/handlers/registration.lua
+++ b/handlers/registration.lua
@@ -46,15 +46,13 @@ function xdecor.register(name, def)
 	local function xdecor_stairs_alternative(nodename, def)
 		local mod, name = nodename:match("(.*):(.*)")
 		for groupname, value in pairs(def.groups) do
-			if	groupname ~= "cracky" and
-				groupname ~= "choppy" and
-				groupname ~= "flammable" and
-				groupname ~= "crumbly" and
-				groupname ~= "snappy" 
-			then
+			if groupname ~= "cracky"    and groupname ~= "choppy"  and
+			   groupname ~= "flammable" and groupname ~= "crumbly" and
+			   groupname ~= "snappy"    then
 				def.groups.groupname = nil
 			end
-		end	
+		end
+
 		if minetest.get_modpath("moreblocks") then
 			stairsplus:register_all(
 				mod,
@@ -77,6 +75,7 @@ function xdecor.register(name, def)
 			)	
 		end	
 	end
+
 	def.drawtype = def.drawtype or (def.mesh and "mesh") or (def.node_box and "nodebox")
 	def.sounds = def.sounds or default.node_sound_defaults()
 
@@ -122,9 +121,9 @@ function xdecor.register(name, def)
 	end
 
 	minetest.register_node("xdecor:"..name, def)
-	
+
 	if minetest.settings:get_bool("disable_xdecor_workbench") and 
-	(minetest.get_modpath("moreblocks") or minetest.get_modpath("stairs")) then
+	  (minetest.get_modpath("moreblocks") or minetest.get_modpath("stairs")) then
 		if xdecor.stairs_valid_def(def) then
 			xdecor_stairs_alternative("xdecor:"..name, def)
 		end
diff --git a/init.lua b/init.lua
index bab6806..bc05030 100644
--- a/init.lua
+++ b/init.lua
@@ -2,19 +2,16 @@
 xdecor = {}
 local modpath = minetest.get_modpath("xdecor")
 
--- Handlers.
 dofile(modpath.."/handlers/animations.lua")
 dofile(modpath.."/handlers/helpers.lua")
 dofile(modpath.."/handlers/nodeboxes.lua")
 dofile(modpath.."/handlers/registration.lua")
 
--- Node and others
 dofile(modpath.."/src/alias.lua")
 dofile(modpath.."/src/nodes.lua")
 dofile(modpath.."/src/recipes.lua")
 
--- Elements
-local submod = {
+local subpart = {
 	"chess",
 	"cooking",
 	"enchanting",
@@ -26,12 +23,11 @@ local submod = {
 	"workbench"
 }
 
-for _, name in ipairs(submod) do
-	local enable = not(minetest.settings:get_bool("disable_xdecor_"..name))
-	if enable then
+for _, name in pairs(subpart) do
+	local enable = minetest.settings:get_bool("enable_xdecor_"..name)
+	if enable or enable == nil then
 		dofile(modpath.."/src/"..name..".lua")
 	end
 end
 
-
 --print(string.format("[xdecor] loaded in %.2f ms", (os.clock()-t)*1000))
diff --git a/settingtypes.txt b/settingtypes.txt
index a477bcc..f75d75c 100644
--- a/settingtypes.txt
+++ b/settingtypes.txt
@@ -1,11 +1,11 @@
-#For disabling a element in xdecor.
+#For enabling a subpart of X-Decor.
 
-disable_xdecor_chess 		(Disable element Chess) 		bool false
-disable_xdecor_cooking  	(Disable element Cooking) 		bool false
-disable_xdecor_enchanting  	(Disable element Enchanting) 	bool false
-disable_xdecor_hive 		(Disable element Hive) 			bool false
-disable_xdecor_itemframe 	(Disable element Itemframe) 	bool false
-disable_xdecor_mailbox 		(Disable element Mailbox) 		bool false
-disable_xdecor_mechanisms 	(Disable element Mechanisms) 	bool false
-disable_xdecor_rope 		(Disable element Rope) 			bool false
-disable_xdecor_workbench 	(Disable element Workbench) 	bool false
\ No newline at end of file
+enable_xdecor_chess 		(Enable Chess)		bool true
+enable_xdecor_cooking		(Enable Cooking) 	bool true
+enable_xdecor_enchanting  	(Enable Enchanting) 	bool true
+enable_xdecor_hive 		(Enable Hive) 		bool true
+enable_xdecor_itemframe 	(Enable Itemframe) 	bool true
+enable_xdecor_mailbox 		(Enable Mailbox) 	bool true
+enable_xdecor_mechanisms 	(Enable Mechanisms) 	bool true
+enable_xdecor_rope 		(Enable Rope) 		bool true
+enable_xdecor_workbench 	(Enable Workbench) 	bool true
\ No newline at end of file
diff --git a/src/enchanting.lua b/src/enchanting.lua
index 53ee217..620264d 100644
--- a/src/enchanting.lua
+++ b/src/enchanting.lua
@@ -282,16 +282,6 @@ enchanting:register_tools("default", {
 	}
 })
 
-enchanting:register_tools("3d_armor", {
-	materials = "steel, bronze, gold, diamond",
-	tools = {
-		boots      = {enchants = "strong, speed"},
-		chestplate = {enchants = "strong"},
-		helmet     = {enchants = "strong"},
-		leggings   = {enchants = "strong"}
-	}
-})
-
 -- Recipes
 
 minetest.register_craft({
-- 
GitLab