dofile( "data/scripts/lib/utilities.lua" )

local entity_id    = GetUpdatedEntityID()
local pos_x, pos_y = EntityGetTransform( entity_id )

local projectile_component = EntityGetFirstComponent(entity_id, "ProjectileComponent")

if(projectile_component ~= nil)then

    --EntitySave(entity_id,"test_projectile.xml")

    --print(extra_entities)

    local has_action_stored = false

    local nearby = EntityGetInRadiusWithTag(pos_x, pos_y, 1000, "mortal")

    for k, enemy in pairs(nearby)do
        local lua_components = EntityGetComponent(enemy, "LuaComponent")
        if(lua_components ~= nil)then
            for k, comp in pairs(lua_components)do
                local script = ComponentGetValue2(comp, "script_damage_received")
                if(script == "mods/spellbound_bundle/files/scripts/misc/sacrificiallaunchattach.lua")then
                    EntityRemoveComponent(enemy, comp)
                end
            end
        end
    end

end