local assets =
{
    Asset("anim", "anim/sacredash.zip"),
    Asset("ATLAS", "images/inventoryimages/sacredash.xml"),
    Asset("IMAGE", "images/inventoryimages/sacredash.tex"),
}

--------------------------------------------------------------------------

local function OnHaunt(inst)
	inst.components.finiteuses:Use(1)
end

local function fn()
    local inst = CreateEntity()

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

    MakeInventoryPhysics(inst)

    inst.AnimState:SetBank("sacredash")
    inst.AnimState:SetBuild("sacredash")
    inst.AnimState:PlayAnimation("idle")

    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end
 
	inst:AddTag("resurrector")
    inst:AddComponent("inspectable")
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.imagename = "sacredash"
    inst.components.inventoryitem.atlasname = "images/inventoryimages/sacredash.xml"
	
	inst:AddComponent("finiteuses")
    inst.components.finiteuses:SetMaxUses(1)
    inst.components.finiteuses:SetUses(1)

    inst.components.finiteuses:SetOnFinished(inst.Remove)
	
	inst:AddComponent("hauntable")
    inst.components.hauntable:SetHauntValue(TUNING.HAUNT_INSTANT_REZ)
    AddHauntableCustomReaction(inst, OnHaunt, true, false, true)
	
	return inst
end

return Prefab("sacredash", fn, assets)