LocateSurvivor

Locate downed personnel

Usage: Used in 8 task(s)

Lua Implementation

-- Locate Survivor
function execute(params)
    local searchArea = params.search_area
    local survivors = {}

    -- Scan area for survivor beacons
    local contacts = this:getContactList()
    for _, contact in ipairs(contacts) do
        if contact:hasStateProperty("SurvivorBeacon") then
            local distance = spatialUtil.distance(this:getLocation3D(), contact:getLocation3D())
            if distance <= params.search_radius then
                table.insert(survivors, contact)
            end
        end
    end

    params.locatedSurvivors = survivors
    return #survivors > 0
end