local assets =
{
	Asset("ANIM", "anim/gears_multitool.zip"),
	Asset("ANIM", "anim/swap_gears_multitool.zip"),
}

local function onfinished(inst)
	local fin = SpawnPrefab("box_gear")
	fin.Transform:SetPosition(inst.Transform:GetWorldPosition())	
    inst:Remove()
end

local function onequip(inst, owner) 
    owner.AnimState:OverrideSymbol("swap_object", "swap_gears_multitool", "swap_object")
    owner.AnimState:Show("ARM_carry") 
    owner.AnimState:Hide("ARM_normal") 
end

local function onunequip(inst, owner) 
    owner.AnimState:Hide("ARM_carry") 
    owner.AnimState:Show("ARM_normal") 
end

local function fn()
    local inst = CreateEntity()

    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddSoundEmitter()
    inst.entity:AddNetwork()

    MakeInventoryPhysics(inst)

    inst.AnimState:SetBank("multitool_axe_pickaxe")
    inst.AnimState:SetBuild("gears_multitool")
    inst.AnimState:PlayAnimation("idle")
    
    inst:AddTag("sharp")
    
    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end

    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(TUNING.MULTITOOL_DAMAGE)
    -----
    inst:AddComponent("tool")
    inst.components.tool:SetAction(ACTIONS.CHOP, 1.20)
    inst.components.tool:SetAction(ACTIONS.MINE, 1.20)
    -------
    inst:AddComponent("finiteuses")
    inst.components.finiteuses:SetMaxUses(TUNING.MULTITOOL_AXE_PICKAXE_USES*.75)
    inst.components.finiteuses:SetUses(TUNING.MULTITOOL_AXE_PICKAXE_USES*.75)
    inst.components.finiteuses:SetOnFinished(onfinished)
    inst.components.finiteuses:SetConsumption(ACTIONS.CHOP, 1)
    inst.components.finiteuses:SetConsumption(ACTIONS.MINE, 3)
    -------
	
    inst:AddComponent("tradable")
    inst:AddComponent("inspectable")
    
    inst:AddComponent("inventoryitem")
	inst.components.inventoryitem.atlasname = "images/inventoryimages/gears_multitool.xml"
    
    inst:AddComponent("equippable")
    inst.components.equippable:SetOnEquip(onequip)
    inst.components.equippable:SetOnUnequip(onunequip)

    MakeHauntableLaunch(inst)
	
    return inst
end

STRINGS.NAMES.GEARS_MULTITOOL 								= "Multitool"
STRINGS.RECIPE_DESC.GEARS_MULTITOOL 						= "An axe and pickaxe in one."

STRINGS.CHARACTERS.GENERIC.DESCRIBE.GEARS_MULTITOOL 		= "Great for outdoors."
STRINGS.CHARACTERS.WILLOW.DESCRIBE.GEARS_MULTITOOL			= "They gave these to us when I was in the girl scouts."
STRINGS.CHARACTERS.WOLFGANG.DESCRIBE.GEARS_MULTITOOL 		= "Is small yet strong."
STRINGS.CHARACTERS.WENDY.DESCRIBE.GEARS_MULTITOOL 			= "It serves two functions."
STRINGS.CHARACTERS.WX78.DESCRIBE.GEARS_MULTITOOL 			= "MULTIFUNCTIONAL TOOL"
STRINGS.CHARACTERS.WICKERBOTTOM.DESCRIBE.GEARS_MULTITOOL 	= "It can both be used for both mining and chopping."
STRINGS.CHARACTERS.WOODIE.DESCRIBE.GEARS_MULTITOOL 			= "Back to the basics, eh?"
STRINGS.CHARACTERS.WAXWELL.DESCRIBE.GEARS_MULTITOOL 		= "My type of tool."
STRINGS.CHARACTERS.WATHGRITHR.DESCRIBE.GEARS_MULTITOOL 		= "Convenience in the palm of my hand."
STRINGS.CHARACTERS.WEBBER.DESCRIBE.GEARS_MULTITOOL 			= "My father carried one of these around."

return Prefab( "common/inventory/gears_multitool", fn, assets)