local assets =
{
	Asset("ANIM", "anim/mace_sting.zip"),
	Asset("ANIM", "anim/swap_mace_sting.zip"),
}

local function onequip(inst, owner)
    owner.AnimState:OverrideSymbol("swap_object", "swap_mace_sting", "swap_nightmaresword")
    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 onattack(inst, owner, target)
    if owner.components.health and not target:HasTag("wall") then
        owner.components.sanity:DoDelta(-TUNING.BATBAT_DRAIN * 0.125)
    end
end

local function fn(Sim)
	local inst = CreateEntity()
  inst.entity:AddTransform()
  inst.entity:AddAnimState()
  inst.entity:AddNetwork()
    MakeInventoryPhysics(inst)
    --[[
	if IsDLCEnabled(CAPY_DLC) then
		MakeInventoryFloatable(inst, "idle_water", "idle")
    end
    ]]
  	inst.AnimState:SetBank("nightmaresword")
  	inst.AnimState:SetBuild("mace_sting")
    inst.AnimState:PlayAnimation("idle")

		inst.entity:SetPristine()

	    if not TheWorld.ismastersim then
	        return inst
	    end

    inst:AddTag("sharp")

    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(TUNING.SPEAR_DAMAGE*1.625)
		inst.components.weapon.onattack = onattack

    -------

    inst:AddComponent("finiteuses")
    inst.components.finiteuses:SetMaxUses(TUNING.SPEAR_USES)
    inst.components.finiteuses:SetUses(TUNING.SPEAR_USES)
		inst.components.finiteuses:SetOnFinished(inst.Remove)

    inst:AddComponent("inspectable")

    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.atlasname = "images/inventoryimages/mace_sting.xml"

    inst:AddComponent("equippable")
    inst.components.equippable:SetOnEquip( onequip )
    inst.components.equippable:SetOnUnequip( onunequip )
		MakeHauntableLaunch(inst)
    return inst
end

STRINGS.NAMES.MACE_STING 								= "Bee Sting Bat"
STRINGS.RECIPE_DESC.MACE_STING 							= "Makes a point."

STRINGS.CHARACTERS.GENERIC.DESCRIBE.MACE_STING 			= "It makes me want to beat things!"
STRINGS.CHARACTERS.WILLOW.DESCRIBE.MACE_STING 			= "Not something I want hitting me."
STRINGS.CHARACTERS.WOLFGANG.DESCRIBE.MACE_STING 		= "Is very scary looking."
STRINGS.CHARACTERS.WENDY.DESCRIBE.MACE_STING 			= "Pointy."
STRINGS.CHARACTERS.WX78.DESCRIBE.MACE_STING 			= "BEES NOW SERVE A BETTER PURPOSE"
STRINGS.CHARACTERS.WICKERBOTTOM.DESCRIBE.MACE_STING 	= "A vicious looking bat."
STRINGS.CHARACTERS.WOODIE.DESCRIBE.MACE_STING 			= "Keep it away from me!"
STRINGS.CHARACTERS.WAXWELL.DESCRIBE.MACE_STING 			= "A bat dripping with venom."
STRINGS.CHARACTERS.WATHGRITHR.DESCRIBE.MACE_STING 	= "It cries för battle!"
STRINGS.CHARACTERS.WEBBER.DESCRIBE.MACE_STING 		= "Can I play baseball with it?"


--if IsDLCEnabled(CAPY_DLC) then
	--STRINGS.CHARACTERS.WOODLEGS.DESCRIBE.MACE_STING		= "Bee bottom bat."
	--STRINGS.CHARACTERS.WALANI.DESCRIBE.MACE_STING		= "I prefer the bat alone."
	--STRINGS.CHARACTERS.WARLY.DESCRIBE.MACE_STING		= "Rather barbaric."
--end

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