--# code by rezecib
local assets =
{
	Asset("ANIM", "anim/shadow_spear_projectile.zip"),
}


local function poof(inst)
	SpawnPrefab("small_puff").Transform:SetPosition(inst.Transform:GetWorldPosition())
		inst:Remove()
end

	




local function fn()
	local inst = CreateEntity()

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

    MakeInventoryPhysics(inst)
    RemovePhysicsColliders(inst)

    inst.AnimState:SetBank("spear_projectile")
    inst.AnimState:SetBuild("shadow_spear_projectile")
    inst.AnimState:PlayAnimation("idle", true)
	    inst.AnimState:SetMultColour(0.5, 0.5, 0.5, 0.5)
	
    if not TheWorld.ismastersim then
        return inst
    end

    -- inst.AnimState:SetBank("projectile")
    -- inst.AnimState:SetBuild("staff_projectile")
	    inst:AddTag("NOCLICK")
    inst:AddTag("projectile")
    				        inst:AddTag("SCARYTOPREY")
							
	inst.entity:SetPristine()	
	
	

	
    inst:AddComponent("projectile")
    inst.components.projectile:SetSpeed(20)
	inst.components.projectile:SetLaunchOffset({x=0, y=2})
	    inst.components.projectile:SetHitDist(2)
		    inst:DoTaskInTime(0.4, poof)
    -- inst.components.projectile:SetOnHitFn(inst.Remove)
    -- inst.components.projectile:SetOnMissFn(inst.Remove)
	inst.Transform:SetScale(1.8,1.8,1.8)
	
	
	inst:AddComponent("weapon")
	inst.components.weapon:SetDamage(55)

	-- inst.AnimState:PlayAnimation("fire_spin_loop", true)
	-- inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )

	inst.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround )
	
	
	
	return inst
end

return Prefab("common/inventory/shadow_spear_projectile", fn, assets)
--# code by rezecib