PrefabFiles =
{
	"gears_multitool",
	"gears_hat_goggles",
	"equip_pack",
	"wool_sack",
	"ice_pack",
	"hat_wood",
	"hat_rock",
	"hat_marble",
	"armor_rock",
	"sword_rock",
	"bug_swatter",
	"gears_mace",
	"gears_staff",
	"armor_beefalo",
	"ruins_battery",
	"box_gear",
	"bunnyback",
	"hat_hound",
	"hornucopia",
	"mace_sting",
	"wolfyback"
}

Assets =
{
	Asset("ATLAS", "images/inventoryimages/gears_multitool.xml"),
	Asset("ATLAS", "images/inventoryimages/gears_hat_goggles.xml"),
	Asset("ATLAS", "images/inventoryimages/equip_pack.xml"),
	Asset("ATLAS", "images/inventoryimages/wool_sack.xml"),
	Asset("ATLAS", "images/inventoryimages/ice_pack.xml"),
	Asset("ATLAS", "images/inventoryimages/hat_wood.xml"),
	Asset("ATLAS", "images/inventoryimages/hat_rock.xml"),
	Asset("ATLAS", "images/inventoryimages/hat_marble.xml"),
	Asset("ATLAS", "images/inventoryimages/armor_rock.xml"),
	Asset("ATLAS", "images/inventoryimages/sword_rock.xml"),
	Asset("ATLAS", "images/inventoryimages/bug_swatter.xml"),
	Asset("ATLAS", "images/inventoryimages/gears_mace.xml"),
	Asset("ATLAS", "images/inventoryimages/gears_staff.xml"),
	Asset("ATLAS", "images/inventoryimages/armor_beefalo.xml"),
	Asset("ATLAS", "images/inventoryimages/ruins_battery.xml"),
	Asset("ATLAS", "images/inventoryimages/box_gear.xml"),
	Asset("ATLAS", "images/inventoryimages/bunnyback.xml"),
	Asset("ATLAS", "images/inventoryimages/hat_hound.xml"),
	Asset("ATLAS", "images/inventoryimages/hornucopia.xml"),
	Asset("ATLAS", "images/inventoryimages/mace_sting.xml"),
	Asset("ATLAS", "images/inventoryimages/wolfyback.xml"),

	Asset("ATLAS", "images/minimap/minimap_equip_pack.xml"),
	Asset("ATLAS", "images/minimap/minimap_wool_sack.xml" ),
	Asset("ATLAS", "images/minimap/minimap_ice_pack.xml"),
	Asset("ATLAS", "images/minimap/bunnyback.xml"),
	Asset("ATLAS", "images/minimap/wolfyback.xml" ),
	Asset("ATLAS", "images/minimap/hornucopia.xml"),

	Asset("ANIM", "anim/ui_ice_pack_1x2.zip"),
}

STRINGS 	= GLOBAL.STRINGS
RECIPETABS 	= GLOBAL.RECIPETABS
Recipe 		= GLOBAL.Recipe
TECH		= GLOBAL.TECH
Ingredient 	= GLOBAL.Ingredient
require 		= GLOBAL.require
Vector3 		= GLOBAL.Vector3

--Configuration =
--{
	local config_gears_multitool  		= GetModConfigData("config_gears_multitool")
	local config_gears_hat_goggles  	= GetModConfigData("config_gears_hat_goggles")
	local config_equip_pack  			= GetModConfigData("config_equip_pack")
	local config_wool_sack  			= GetModConfigData("config_wool_sack")
	local config_ice_pack  				= GetModConfigData("config_ice_pack")
	local config_hat_wood  				= GetModConfigData("config_hat_wood")
	local config_hat_marble  			= GetModConfigData("config_hat_marble")
	local config_armor_rock  			= GetModConfigData("config_armor_rock")
	local config_sword_rock  			= GetModConfigData("config_sword_rock")
	local config_bug_swatter  			= GetModConfigData("config_bug_swatter")
	local config_gears_mace  			= GetModConfigData("config_gears_mace")
	local config_gears_staff  			= GetModConfigData("config_gears_staff")
	local config_armor_beefalo  		= GetModConfigData("config_armor_beefalo")
	local config_ruins_battery  		= GetModConfigData("config_ruins_battery")
	local config_bunnyback 				= GetModConfigData("config_bunnyback")
	local config_box_gear  				= GetModConfigData("config_box_gear")
	--local config_wolfyback  			= GetModConfigData("config_wolfyback")
	--local config_hat_hound  			= GetModConfigData("config_hat_hound")
	--local config_hornucopia   			= GetModConfigData("config_hornucopia")
	--local config_mace_sting  			= GetModConfigData("config_mace_sting")

	local tech_gears_multitool			= TECH.SCIENCE_TWO
	local tech_gears_hat_goggles		= TECH.SCIENCE_TWO
	local tech_equip_pack				= TECH.SCIENCE_TWO
	local tech_wool_sack				= TECH.SCIENCE_TWO
	local tech_ice_pack					= TECH.SCIENCE_TWO
	local tech_hat_wood					= TECH.SCIENCE_ONE
	local tech_hat_rock					= TECH.SCIENCE_TWO
	local tech_hat_marble				= TECH.SCIENCE_TWO
	local tech_armor_rock				= TECH.SCIENCE_TWO
	local tech_sword_rock				= TECH.SCIENCE_TWO
	local tech_bug_swatter				= TECH.SCIENCE_TWO
	local tech_gears_mace				= TECH.SCIENCE_TWO
	local tech_gears_staff				= TECH.SCIENCE_TWO
	local tech_armor_beefalo			= TECH.SCIENCE_TWO
	local tech_ruins_battery			= TECH.ANCIENT_FOUR
	local tech_box_gear 				= TECH.ANCIENT_FOUR
	local tech_bunnyback			= TECH.SCIENCE_TWO
	local tech_wolfyback 			= TECH.MAGIC_THREE
	local tech_hat_hound 			= TECH.MAGIC_THREE
	local tech_hornucopia 			= TECH.MAGIC_THREE
	local tech_mace_sting			= TECH.MAGIC_TWO

	if config_gears_multitool == "false" or config_ruins_battery == "false" then
		tech_gears_multitool			= TECH.LOST
	end

	if config_gears_hat_goggles == "false" or config_ruins_battery == "false" then
		tech_gears_hat_goggles			= TECH.LOST
	end

	if config_equip_pack == "false" then
		tech_equip_pack					= TECH.LOST
	end

	if config_wool_sack == "false" then
		tech_wool_sack					= TECH.LOST
	end

	if config_ice_pack == "false" then
		tech_ice_pack					= TECH.LOST
	end

	if config_hat_wood == "false" then
		tech_hat_wood					= TECH.LOST
	end

	if config_hat_rock == "false" then
		tech_hat_rock					= TECH.LOST
	end

	if config_hat_marble == "false" then
		tech_hat_marble					= TECH.LOST
	end

	if config_armor_rock == "false" then
		tech_armor_rock					= TECH.LOST
	end

	if config_sword_rock == "false" then
		tech_sword_rock					= TECH.LOST
	end

	if config_bug_swatter == "false" then
		tech_bug_swatter				= TECH.LOST
	end

	if config_gears_mace == "false" or config_ruins_battery == "false" then
		tech_gears_mace					= TECH.LOST
	end

	if config_gears_staff == "false" or config_ruins_battery == "false" then
		tech_gears_staff				= TECH.LOST
	end

	if config_armor_beefalo == "false" then
		tech_armor_beefalo				= TECH.LOST
	end

	if config_ruins_battery == "false" then
		tech_ruins_battery				= TECH.LOST
	end

	if config_box_gear == "false" then
		tech_box_gear				= TECH.LOST
	end

	if config_bunnyback == "false" then
		tech_bunnyback				= TECH.LOST
	end

	--if config_mace_sting == "false" then
		--tech_mace_sting 				= TECH.LOST
	--end

	--if config_wolfyback == "false" then
		--tech_wolfyback 				= TECH.LOST
	--end

	--if config_hat_hound == "false" then
		--tech_hat_hound 				= TECH.LOST
	--end

	--if config_hornucopia == "false" then
		--tech_hornucopia 				= TECH.LOST
	--end
--}
local gearbox						= Ingredient("box_gear", 1)
gearbox.atlas						= "images/inventoryimages/box_gear.xml"

local ruins_battery			= Ingredient("ruins_battery", 1)
ruins_battery.atlas			= "images/inventoryimages/ruins_battery.xml"

local gears_multitool = Recipe("gears_multitool",
{
	ruins_battery,
	Ingredient("goldnugget", 					4),
	Ingredient("twigs", 						4)
},
RECIPETABS.TOOLS, tech_gears_multitool)

local gears_hat_goggles = Recipe("gears_hat_goggles",
{
	ruins_battery,
	Ingredient("gears",							2),
	Ingredient("transistor", 					2)
},
RECIPETABS.LIGHT, tech_gears_hat_goggles)

local equip_pack = Recipe("equip_pack",
{
	Ingredient("gears", 						2),
	Ingredient("trinket_6", 					1)
},
RECIPETABS.SURVIVAL, tech_equip_pack)

local wool_sack = Recipe("wool_sack",
{
	Ingredient("steelwool", 					4),
	Ingredient("silk", 							6),
	Ingredient("rope", 							2)
},
RECIPETABS.SURVIVAL, tech_wool_sack)

local ice_pack = Recipe("ice_pack",
{
	Ingredient("trinket_11", 					1),
	Ingredient("gears",							2),
	Ingredient("trinket_6", 					1)
},
RECIPETABS.FARM, tech_ice_pack)

local hat_wood = Recipe("hat_wood",
{
	Ingredient("footballhat", 					1),
	Ingredient("log", 							4),
	Ingredient("rope", 							2)
},
RECIPETABS.WAR, tech_hat_wood)

local hat_rock = Recipe("hat_rock",
{
	Ingredient("rocks", 						8),
	Ingredient("flint", 						2),
	Ingredient("goldnugget", 					1)
},
RECIPETABS.WAR, tech_hat_rock)

local hat_marble = Recipe("hat_marble",
{
	Ingredient("marble", 						8)
},
RECIPETABS.WAR, tech_hat_marble)

local armor_rock = Recipe("armor_rock",
{
	Ingredient("rocks", 						12),
	Ingredient("flint", 						4)
},
RECIPETABS.WAR, tech_armor_rock)

local sword_rock = Recipe("sword_rock",
{
	Ingredient("twigs", 						2),
	Ingredient("rocks", 						4),
	Ingredient("rope", 							1)
},
RECIPETABS.WAR, tech_sword_rock)

local bug_swatter = Recipe("bug_swatter",
{
	Ingredient("twigs", 						2),
	Ingredient("silk", 							4),
	Ingredient("rope", 							2)
},
RECIPETABS.WAR, tech_bug_swatter)

local gears_mace = Recipe("gears_mace",
{
	ruins_battery,
	Ingredient("redgem", 						1),
	Ingredient("bluegem", 						1)
},
RECIPETABS.WAR, tech_gears_mace)

local gears_staff = Recipe("gears_staff",
{
	ruins_battery,
	Ingredient("nightmarefuel", 				12),
	Ingredient("yellowgem", 					4)
},
RECIPETABS.WAR, tech_gears_staff)

local armor_beefalo = Recipe("armor_beefalo",
{
	Ingredient("beefalowool", 					16),
	Ingredient("rope", 							2)
},
RECIPETABS.DRESS, tech_armor_beefalo)

local ruins_battery = Recipe("ruins_battery",
{
	Ingredient("minotaurhorn", 					1),
	Ingredient("thulecite", 					8),
	Ingredient("nightmarefuel", 				12)
},
RECIPETABS.ANCIENT, tech_ruins_battery)

local bunnyback = Recipe("bunnyback",
{
	Ingredient("manrabbit_tail", 		2),
	Ingredient("silk", 							8),
	Ingredient("rope", 							2)
},
RECIPETABS.SURVIVAL, tech_bunnyback)

local box_gear = Recipe("box_gear",
{
	Ingredient("gears", 						12),
	Ingredient("thulecite", 					8),
	Ingredient("nightmarefuel", 				16)
},
RECIPETABS.ANCIENT, tech_box_gear, nil, nil, true, 1)

local mace_sting = Recipe("mace_sting",
{
	Ingredient("stinger", 						12),
	Ingredient("log", 							2),
	Ingredient("nightmarefuel", 				6)
},
RECIPETABS.MAGIC, tech_mace_sting)

local wolfyback = Recipe("wolfyback",
{
	Ingredient("houndstooth", 					8),
	Ingredient("beefalowool",						5),
	Ingredient("nightmarefuel", 				6)
},
RECIPETABS.MAGIC, tech_wolfyback)

local hat_hound = Recipe("hat_hound",
{
	Ingredient("houndstooth", 					6),
	Ingredient("beefalowool",						5),
	Ingredient("cookedmonstermeat", 			8),
},
RECIPETABS.MAGIC, tech_hat_hound)

local hornucopia = Recipe("hornucopia",
{
	Ingredient("minotaurhorn", 					1),
	Ingredient("horn", 							1),
	Ingredient("cookedmeat", 					8)
},
RECIPETABS.MAGIC, tech_hornucopia)

gears_multitool.atlas 	= "images/inventoryimages/gears_multitool.xml"
gears_hat_goggles.atlas = "images/inventoryimages/gears_hat_goggles.xml"
equip_pack.atlas 		= "images/inventoryimages/equip_pack.xml"
wool_sack.atlas 		= "images/inventoryimages/wool_sack.xml"
ice_pack.atlas 			= "images/inventoryimages/ice_pack.xml"
hat_wood.atlas 			= "images/inventoryimages/hat_wood.xml"
hat_rock.atlas 			= "images/inventoryimages/hat_rock.xml"
hat_marble.atlas 		= "images/inventoryimages/hat_marble.xml"
armor_rock.atlas 		= "images/inventoryimages/armor_rock.xml"
sword_rock.atlas 		= "images/inventoryimages/sword_rock.xml"
bug_swatter.atlas 		= "images/inventoryimages/bug_swatter.xml"
gears_mace.atlas 		= "images/inventoryimages/gears_mace.xml"
gears_staff.atlas 		= "images/inventoryimages/gears_staff.xml"
armor_beefalo.atlas 	= "images/inventoryimages/armor_beefalo.xml"
ruins_battery.atlas 	= "images/inventoryimages/ruins_battery.xml"
bunnyback.atlas 	= "images/inventoryimages/bunnyback.xml"
box_gear.atlas 		= "images/inventoryimages/box_gear.xml"
mace_sting.atlas 	= "images/inventoryimages/mace_sting.xml"
wolfyback.atlas 	= "images/inventoryimages/wolfyback.xml"
hat_hound.atlas 	= "images/inventoryimages/hat_hound.xml"
hornucopia.atlas 	= "images/inventoryimages/hornucopia.xml"

AddMinimapAtlas("images/minimap/minimap_equip_pack.xml")
AddMinimapAtlas("images/minimap/minimap_wool_sack.xml")
AddMinimapAtlas("images/minimap/minimap_ice_pack.xml")
AddMinimapAtlas("images/minimap/bunnyback.xml")
AddMinimapAtlas("images/inventoryimages/wolfyback.xml")
AddMinimapAtlas("images/inventoryimages/hornucopia.xml")

---------------------equip_pack---------------------------------
local Spot = GetModConfigData("Spot")
local params={}
params.equip_pack =
{
	widget =
	{
			slotpos = {},
			animbank = "ui_krampusbag_2x8",
			animbuild = "ui_krampusbag_2x8",
			pos = Vector3(-5, -70, 0),
	},
	issidewidget = true,
	--acceptsstacks = false,
	type = "pack",
}
for y = 0, 7 do
    table.insert(params.equip_pack.widget.slotpos, Vector3(-162, -65 * y + 245, 0))
    table.insert(params.equip_pack.widget.slotpos, Vector3(-162 + 75, -65 * y + 245, 0))
end

local containers = require "containers"
containers.MAXITEMSLOTS = math.max(containers.MAXITEMSLOTS, params.equip_pack.widget.slotpos ~= nil and #params.equip_pack.widget.slotpos or 0)
local old_widgetsetup = containers.widgetsetup

function containers.widgetsetup(container, prefab, data)
	local pref = prefab or container.inst.prefab
	if pref == "equip_pack" then
		local t = params[pref]
		if t ~= nil then
			for k, v in pairs(t) do
				container[k] = v
			end
			container:SetNumSlots(container.widget.slotpos ~= nil and #container.widget.slotpos or 0)
		end
	else
			return old_widgetsetup(container, prefab)
	end
end
---------------------ice_pack---------------------------------
local Spot = GetModConfigData("Spot")
local params={}
params.ice_pack =
{
	widget =
	{
			slotpos = {},
			animbank = "ui_ice_pack_1x2",
			animbuild = "ui_ice_pack_1x2",
			pos = Vector3(-100,-250,0),
	},
	issidewidget = true,
	type = "cooler",
}
for y = 0, 1 do
    table.insert(params.ice_pack.widget.slotpos, Vector3(-162 + (75/2), -75 * y + 114 ,0))
end

local containers = require "containers"
containers.MAXITEMSLOTS = math.max(containers.MAXITEMSLOTS, params.ice_pack.widget.slotpos ~= nil and #params.ice_pack.widget.slotpos or 0)
local old_widgetsetup = containers.widgetsetup

function containers.widgetsetup(container, prefab, data)
	local pref = prefab or container.inst.prefab
	if pref == "ice_pack" then
		local t = params[pref]
		if t ~= nil then
			for k, v in pairs(t) do
				container[k] = v
			end
			container:SetNumSlots(container.widget.slotpos ~= nil and #container.widget.slotpos or 0)
		end
	else
			return old_widgetsetup(container, prefab)
	end
end
---------------------equip_pack---------------------------------
local Spot = GetModConfigData("Spot")
local params={}
params.wool_sack =
{
	widget =
	{
			slotpos = {},
			animbank = "ui_krampusbag_2x8",
			animbuild = "ui_krampusbag_2x8",
			pos = Vector3(-5, -50, 0),
	},
	issidewidget = true,
	type = "pack",
}
for y = 0, 7 do
    table.insert(params.wool_sack.widget.slotpos, Vector3(-162, -65 * y + 245, 0))
    table.insert(params.wool_sack.widget.slotpos, Vector3(-162 + 75, -65 * y + 245, 0))
end

local containers = require "containers"
containers.MAXITEMSLOTS = math.max(containers.MAXITEMSLOTS, params.wool_sack.widget.slotpos ~= nil and #params.wool_sack.widget.slotpos or 0)
local old_widgetsetup = containers.widgetsetup

function containers.widgetsetup(container, prefab, data)
	local pref = prefab or container.inst.prefab
	if pref == "wool_sack" then
		local t = params[pref]
		if t ~= nil then
			for k, v in pairs(t) do
				container[k] = v
			end
			container:SetNumSlots(container.widget.slotpos ~= nil and #container.widget.slotpos or 0)
		end
	else
			return old_widgetsetup(container, prefab)
	end
end
---------------------equip_pack---------------------------------
local Spot = GetModConfigData("Spot")
local params={}
params.bunnyback =
{
	widget =
	{
			slotpos = {},
			animbank = "ui_krampusbag_2x8",
			animbuild = "ui_krampusbag_2x8",
			pos = Vector3(-5, -70, 0),
	},
	issidewidget = true,
	type = "pack",
}
for y = 0, 7 do
    table.insert(params.bunnyback.widget.slotpos, Vector3(-162, -65 * y + 245, 0))
    table.insert(params.bunnyback.widget.slotpos, Vector3(-162 + 75, -65 * y + 245, 0))
end

local containers = require "containers"
containers.MAXITEMSLOTS = math.max(containers.MAXITEMSLOTS, params.bunnyback.widget.slotpos ~= nil and #params.bunnyback.widget.slotpos or 0)
local old_widgetsetup = containers.widgetsetup

function containers.widgetsetup(container, prefab, data)
	local pref = prefab or container.inst.prefab
	if pref == "bunnyback" then
		local t = params[pref]
		if t ~= nil then
			for k, v in pairs(t) do
				container[k] = v
			end
			container:SetNumSlots(container.widget.slotpos ~= nil and #container.widget.slotpos or 0)
		end
	else
			return old_widgetsetup(container, prefab)
	end
end
---------------------wolfyback---------------------------------
local Spot = GetModConfigData("Spot")
local params={}
params.wolfyback =
{
	widget =
	{
			slotpos = {},
			animbank = "ui_krampusbag_2x8",
			animbuild = "ui_krampusbag_2x8",
			pos = Vector3(-5, -70, 0),
	},
	issidewidget = true,
	type = "pack",
}
for y = 0, 7 do
    table.insert(params.wolfyback.widget.slotpos, Vector3(-162, -65 * y + 245, 0))
    table.insert(params.wolfyback.widget.slotpos, Vector3(-162 + 75, -65 * y + 245, 0))
end

local containers = require "containers"
containers.MAXITEMSLOTS = math.max(containers.MAXITEMSLOTS, params.wolfyback.widget.slotpos ~= nil and #params.wolfyback.widget.slotpos or 0)
local old_widgetsetup = containers.widgetsetup

function containers.widgetsetup(container, prefab, data)
	local pref = prefab or container.inst.prefab
	if pref == "wolfyback" then
		local t = params[pref]
		if t ~= nil then
			for k, v in pairs(t) do
				container[k] = v
			end
			container:SetNumSlots(container.widget.slotpos ~= nil and #container.widget.slotpos or 0)
		end
	else
			return old_widgetsetup(container, prefab)
	end
end
