FlightControl-Master / MOOSE

Mission Object Oriented Scripting Environment (MOOSE) for lua mission scripting design in DCS World
http://flightcontrol-master.github.io/MOOSE/
GNU General Public License v3.0
291 stars 95 forks source link

CORE_SET :FilterHasSEAD() returns none SEADable units #644

Closed baluballa closed 7 years ago

baluballa commented 7 years ago

SEAD units are units that has radars, and might be targeted by Anti Radiation Missiles. Search Radars, Track Radars or Early Warning Radars (EWR), and even Roland Radar and ADS.

FlightControl-User commented 7 years ago

I will check this method. It can be I only check for radar presence in the dispatcher, but not in this method. Something is not cooking then!

baluballa commented 7 years ago

I am not sure, Had a look into this, and I am not sure if its correct, from Core.Set ` --- Returns if the @{Set} has targets that can be SEADed. -- @param #SET_UNIT self -- @return #number The amount of SEADable units in the Set function SET_UNIT:HasSEAD() self:F2()

local SEADCount = 0 for UnitID, UnitData in pairs( self:GetSet()) do local UnitSEAD = UnitData -- Wrapper.Unit#UNIT if UnitSEAD:IsAlive() then local UnitSEADAttributes = UnitSEAD:GetDesc().attributes

  local HasSEAD = UnitSEAD:HasSEAD()

  self:T3(HasSEAD)
  if HasSEAD then
    SEADCount = SEADCount + 1
  end
end

end

return SEADCount end `

FlightControl-User commented 7 years ago

Ha! That is the issue! It does not filter, we'll need to add a filter method to filter all the SEAD targets from the SET_UNIT.

baluballa commented 7 years ago

Exactly...

FlightControl-User commented 7 years ago

Maybe there is a method like that already, no?

baluballa commented 7 years ago

Not sure, Where is the actual filter algo?

FlightControl-User commented 7 years ago

I think there isn't a method yet. This will need to be added. I need to check the code.

baluballa commented 7 years ago

The algorithm must look something like this if HasSEAD then SEADCount = SEADCount + 1 check if already in SET, if not ADD IT else check if already in SET, if it is REMOVE IT, end

FlightControl-User commented 7 years ago

@baluballa I am not sure that this is a valid request. I have been testing this and it works perfectly.