TUNING.ZOMBIEJ_ADDTIONAL_PACKAGE = "Additional Item Package"
TUNING.AIP_GOLDEN_MINE_CAR_USAGE = 80
GLOBAL.STRINGS.AIP = {}

-- 资源
Assets =
{
	Asset("ATLAS", "images/inventoryimages/popcorngun.xml"),
	Asset("ATLAS", "images/inventoryimages/incinerator.xml"),
	Asset("ATLAS", "images/inventoryimages/dark_observer.xml"),
	Asset("ATLAS", "images/gemtab.xml"),
	Asset("IMAGE", "images/gemtab.tex"),
	Asset("ATLAS", "images/inventoryimages/ore_cobalt.xml"),
	Asset("ATLAS", "images/inventoryimages/ore_iron.xml"),
}

-- 物品列表
PrefabFiles =
{
	-- Food
	"aip_veggies",
	"foods",
	"aip_nectar_maker",
	"aip_nectar",

	"popcorngun",
	"incinerator",
	"dark_observer",
	"dark_observer_vest",
	"aip_blood_package",
	"aip_fish_sword",
	"aip_beehave",

	-- Orbit
	"aip_orbit",
	"aip_mine_car",

	-- Dress
	"aip_dress",

	-- Chesspiece
	"aip_chesspiece",
	-- "aip_chesspiece_moon",
	"aip_golden_mine_car",
}
modimport("libs/env.lua")

modimport ("libs/custom_prototyper_api.lua")
AddNewTechTree("GEMOLOGY", 1)
GLOBAL.TUNING.PROTOTYPER_MODULE_GEMOLOGY = 2

--STRINGS.TABS.GEMOLOGY_TAB = "Gems" --Lugar especifico
--GLOBAL.RECIPETABS['GEMOLOGY_TAB'] = {str = "GEMOLOGY_TAB", sort=8, icon = "gemtab.tex", icon_atlas = "images/gemtab.xml"}

-- "Gem" Tab
gemologytab = AddRecipeTab("Gems", 949, "images/gemtab.xml", "gemtab.tex", nil, true)

--------------------------------------- 工具 ---------------------------------------
modimport("scripts/aipUtils.lua")

--------------------------------------- 图标 ---------------------------------------
AddMinimapAtlas("minimap/dark_observer_vest.xml")

--------------------------------------- 封装 ---------------------------------------
modimport("scripts/recipeWrapper.lua")
modimport("scripts/seedsWrapper.lua")
modimport("scripts/containersWrapper.lua")
modimport("scripts/itemTileWrapper.lua")

--------------------------------------- 矿车 ---------------------------------------
if GetModConfigData("additional_orbit") == "open" then
	modimport("scripts/mineCarAction.lua")
end

------------------------------------ 贪婪观察者 ------------------------------------
-- 暗影跟随者
function ShadowFollowerPrefabPostInit(inst)
	if not GLOBAL.TheWorld.ismastersim then
		return
	end

	if not inst.components.shadow_follower then
		inst:AddComponent("shadow_follower")
	end
end


AddPrefabPostInit("dragonfly", function(inst) ShadowFollowerPrefabPostInit(inst) end) -- 龙蝇
AddPrefabPostInit("deerclops", function(inst) ShadowFollowerPrefabPostInit(inst) end) -- 鹿角怪
AddPrefabPostInit("bearger", function(inst) ShadowFollowerPrefabPostInit(inst) end) -- 熊獾
AddPrefabPostInit("moose", function(inst) ShadowFollowerPrefabPostInit(inst) end) -- 麋鹿鹅
AddPrefabPostInit("beequeen", function(inst) ShadowFollowerPrefabPostInit(inst) end) -- 蜂后
AddPrefabPostInit("klaus", function(inst) ShadowFollowerPrefabPostInit(inst) end) -- 克劳斯
AddPrefabPostInit("antlion", function(inst) ShadowFollowerPrefabPostInit(inst) end) -- 蚁狮
AddPrefabPostInit("toadstool", function(inst) ShadowFollowerPrefabPostInit(inst) end) -- 蟾蜍王
AddPrefabPostInit("toadstool_dark", function(inst) ShadowFollowerPrefabPostInit(inst) end) -- 苦难蟾蜍王

-- 世界追踪
function WorldPrefabPostInit(inst)
	inst:AddComponent("world_common_store")
end

if GLOBAL.TheNet:GetIsServer() or GLOBAL.TheNet:IsDedicated() then
	AddPrefabPostInit("world", WorldPrefabPostInit)
end

------------------------------------- 玩家钩子 -------------------------------------
function PlayerPrefabPostInit(inst)
	if not inst.components.aipc_player_client then
		inst:AddComponent("aipc_player_client")
	end

	if not GLOBAL.TheWorld.ismastersim then
		return
	end

	if not inst.components.aipc_timer then
		inst:AddComponent("aipc_timer")
	end
end

AddPlayerPostInit(PlayerPrefabPostInit)

local _G = GLOBAL
local string = _G.STRINGS
local name = string.NAMES
local charDesc = string.CHARACTERS
local recipeDesc = string.RECIPE_DESC

recipeDesc.REDGEM = "Una gema de fuego"
recipeDesc.BLUEGEM = "Una gema de hielo"
recipeDesc.YELLOWGEM = "Una gema brillante"
recipeDesc.ORANGEGEM = "Una Crazy gem?"
recipeDesc.GREENGEM = "Una Build gem?"

AddRecipe("redgem", { Ingredient("ore_iron", 5, "images/inventoryimages/ore_iron.xml"), Ingredient("charcoal", 5),Ingredient("reviver",1)},
gemologytab, TECH.GEMOLOGY_ONE,
nil, nil, true, 1)
AddRecipe("bluegem", { Ingredient("ore_cobalt", 5, "images/inventoryimages/ore_cobalt.xml"), Ingredient("ice", 5)},
gemologytab, TECH.GEMOLOGY_ONE,
nil, nil, true, 1)
AddRecipe("yellowgem", { Ingredient("goldnugget", 5), Ingredient("lightbulb", 5),Ingredient("fireflies",1)},
gemologytab, TECH.GEMOLOGY_ONE,
nil, nil, true, 1)
AddRecipe("orangegem", { Ingredient("redgem", 1), Ingredient("yellowgem", 1)},
gemologytab, TECH.GEMOLOGY_ONE,
nil, nil, true, 1)
AddRecipe("greengem", { Ingredient("bluegem", 1), Ingredient("yellowgem", 1)},
gemologytab, TECH.GEMOLOGY_ONE,
nil, nil, true, 1)
Recipe("purplegem", { Ingredient("redgem", 1), Ingredient("bluegem", 1)},
gemologytab, TECH.GEMOLOGY_ONE,
nil, nil, true, 1)
AddRecipe("opalstaff", { Ingredient("opalpreciousgem", 1)},
gemologytab, TECH.GEMOLOGY_ONE,
nil, nil, true, 1)
