diff --git a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua index 076aa20a8..f5875f571 100644 --- a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua +++ b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua @@ -1001,7 +1001,7 @@ do -- AI_A2A_DISPATCHER --- @param #AI_A2A_DISPATCHER self -- @param Core.Event#EVENTDATA EventData function AI_A2A_DISPATCHER:OnEventLand( EventData ) - self:E( "Landed" ) + self:F( "Landed" ) local DefenderUnit = EventData.IniUnit local Defender = EventData.IniGroup local Squadron = self:GetSquadronFromDefender( Defender ) @@ -1488,7 +1488,7 @@ do -- AI_A2A_DISPATCHER DefenderSquadron.Resources = Resources DefenderSquadron.TemplatePrefixes = TemplatePrefixes - self:E( { Squadron = {SquadronName, AirbaseName, TemplatePrefixes, Resources } } ) + self:F( { Squadron = {SquadronName, AirbaseName, TemplatePrefixes, Resources } } ) return self end @@ -1554,7 +1554,7 @@ do -- AI_A2A_DISPATCHER self:SetSquadronCapInterval( SquadronName, self.DefenderDefault.CapLimit, self.DefenderDefault.CapMinSeconds, self.DefenderDefault.CapMaxSeconds, 1 ) - self:E( { CAP = { SquadronName, Zone, FloorAltitude, CeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageMinSpeed, EngageMaxSpeed, AltType } } ) + self:F( { CAP = { SquadronName, Zone, FloorAltitude, CeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageMinSpeed, EngageMaxSpeed, AltType } } ) -- Add the CAP to the EWR network. @@ -1658,7 +1658,7 @@ do -- AI_A2A_DISPATCHER local Cap = DefenderSquadron.Cap if Cap then local CapCount = self:CountCapAirborne( SquadronName ) - self:E( { CapCount = CapCount } ) + self:F( { CapCount = CapCount } ) if CapCount < Cap.CapLimit then local Probability = math.random() if Probability <= Cap.Probability then @@ -1716,7 +1716,7 @@ do -- AI_A2A_DISPATCHER Intercept.EngageMinSpeed = EngageMinSpeed Intercept.EngageMaxSpeed = EngageMaxSpeed - self:E( { GCI = { SquadronName, EngageMinSpeed, EngageMaxSpeed } } ) + self:F( { GCI = { SquadronName, EngageMinSpeed, EngageMaxSpeed } } ) end --- Defines the default amount of extra planes that will take-off as part of the defense system. @@ -2443,7 +2443,7 @@ do -- AI_A2A_DISPATCHER if Squadron.Resources then Squadron.Resources = Squadron.Resources - Size end - self:E( { DefenderName = DefenderName, SquadronResources = Squadron.Resources } ) + self:F( { DefenderName = DefenderName, SquadronResources = Squadron.Resources } ) end --- @param #AI_A2A_DISPATCHER self @@ -2652,7 +2652,7 @@ do -- AI_A2A_DISPATCHER --- @param #AI_A2A_DISPATCHER self function Fsm:onafterHome( Defender, From, Event, To, Action ) - self:E({"CAP Home", Defender:GetName()}) + self:F({"CAP Home", Defender:GetName()}) self:GetParent(self).onafterHome( self, Defender, From, Event, To ) local Dispatcher = self:GetDispatcher() -- #AI_A2A_DISPATCHER @@ -2793,7 +2793,7 @@ do -- AI_A2A_DISPATCHER local TakeoffMethod = self:GetSquadronTakeoff( ClosestDefenderSquadronName ) local DefenderGCI = Spawn:SpawnAtAirbase( DefenderSquadron.Airbase, TakeoffMethod, DefenderSquadron.TakeoffAltitude or self.DefenderDefault.TakeoffAltitude ) -- Wrapper.Group#GROUP - self:E( { GCIDefender = DefenderGCI:GetName() } ) + self:F( { GCIDefender = DefenderGCI:GetName() } ) DefendersNeeded = DefendersNeeded - DefenderGrouping @@ -2957,13 +2957,13 @@ do -- AI_A2A_DISPATCHER local AIGroup = AIGroup -- Wrapper.Group#GROUP if not AIGroup:IsAlive() then local DefenderTaskFsm = self:GetDefenderTaskFsm( AIGroup ) - self:E( { Defender = AIGroup:GetName(), DefenderState = DefenderTaskFsm:GetState() } ) + self:F( { Defender = AIGroup:GetName(), DefenderState = DefenderTaskFsm:GetState() } ) if not DefenderTaskFsm:Is( "Started" ) then self:ClearDefenderTask( AIGroup ) end else if DefenderTask.Target then - local AttackerItem = Detection:GetDetectedItem( DefenderTask.Target.Index ) + local AttackerItem = Detection:GetDetectedItemByIndex( DefenderTask.Target.Index ) if not AttackerItem then self:F( { "Removing obsolete Target:", DefenderTask.Target.Index } ) self:ClearDefenderTaskTarget( AIGroup ) @@ -3056,7 +3056,7 @@ do -- AI_A2A_DISPATCHER end Report:Add( string.format( "\n - %d Tasks", TaskCount ) ) - self:E( Report:Text( "\n" ) ) + self:F( Report:Text( "\n" ) ) trigger.action.outText( Report:Text( "\n" ), 25 ) end @@ -3084,7 +3084,7 @@ do for PlayerUnitName, PlayerUnitData in pairs( PlayersNearBy ) do local PlayerUnit = PlayerUnitData -- Wrapper.Unit#UNIT local PlayerName = PlayerUnit:GetPlayerName() - --self:E( { PlayerName = PlayerName, PlayerUnit = PlayerUnit } ) + --self:F( { PlayerName = PlayerName, PlayerUnit = PlayerUnit } ) if PlayerUnit:IsAirPlane() and PlayerName ~= nil then local FriendlyUnitThreatLevel = PlayerUnit:GetThreatLevel() PlayersCount = PlayersCount + 1 @@ -3097,7 +3097,7 @@ do end - --self:E( { PlayersCount = PlayersCount } ) + --self:F( { PlayersCount = PlayersCount } ) local PlayerTypesReport = REPORT:New() @@ -3141,7 +3141,7 @@ do end - --self:E( { FriendliesCount = FriendliesCount } ) + --self:F( { FriendliesCount = FriendliesCount } ) local FriendlyTypesReport = REPORT:New() @@ -3551,23 +3551,23 @@ do -- Setup squadrons - self:E( { Airbases = AirbaseNames } ) + self:F( { Airbases = AirbaseNames } ) - self:E( "Defining Templates for Airbases ..." ) + self:F( "Defining Templates for Airbases ..." ) for AirbaseID, AirbaseName in pairs( AirbaseNames ) do local Airbase = _DATABASE:FindAirbase( AirbaseName ) -- Wrapper.Airbase#AIRBASE local AirbaseName = Airbase:GetName() local AirbaseCoord = Airbase:GetCoordinate() local AirbaseZone = ZONE_RADIUS:New( "Airbase", AirbaseCoord:GetVec2(), 3000 ) local Templates = nil - self:E( { Airbase = AirbaseName } ) + self:F( { Airbase = AirbaseName } ) for TemplateID, Template in pairs( self.Templates:GetSet() ) do local Template = Template -- Wrapper.Group#GROUP local TemplateCoord = Template:GetCoordinate() if AirbaseZone:IsVec2InZone( TemplateCoord:GetVec2() ) then Templates = Templates or {} table.insert( Templates, Template:GetName() ) - self:E( { Template = Template:GetName() } ) + self:F( { Template = Template:GetName() } ) end end if Templates then @@ -3583,13 +3583,13 @@ do self.CAPTemplates:FilterPrefixes( CapPrefixes ) self.CAPTemplates:FilterOnce() - self:E( "Setting up CAP ..." ) + self:F( "Setting up CAP ..." ) for CAPID, CAPTemplate in pairs( self.CAPTemplates:GetSet() ) do local CAPZone = ZONE_POLYGON:New( CAPTemplate:GetName(), CAPTemplate ) -- Now find the closest airbase from the ZONE (start or center) local AirbaseDistance = 99999999 local AirbaseClosest = nil -- Wrapper.Airbase#AIRBASE - self:E( { CAPZoneGroup = CAPID } ) + self:F( { CAPZoneGroup = CAPID } ) for AirbaseID, AirbaseName in pairs( AirbaseNames ) do local Airbase = _DATABASE:FindAirbase( AirbaseName ) -- Wrapper.Airbase#AIRBASE local AirbaseName = Airbase:GetName() @@ -3597,7 +3597,7 @@ do local Squadron = self.DefenderSquadrons[AirbaseName] if Squadron then local Distance = AirbaseCoord:Get2DDistance( CAPZone:GetCoordinate() ) - self:E( { AirbaseDistance = Distance } ) + self:F( { AirbaseDistance = Distance } ) if Distance < AirbaseDistance then AirbaseDistance = Distance AirbaseClosest = Airbase @@ -3605,7 +3605,7 @@ do end end if AirbaseClosest then - self:E( { CAPAirbase = AirbaseClosest:GetName() } ) + self:F( { CAPAirbase = AirbaseClosest:GetName() } ) self:SetSquadronCap( AirbaseClosest:GetName(), CAPZone, 6000, 10000, 500, 800, 800, 1200, "RADIO" ) self:SetSquadronCapInterval( AirbaseClosest:GetName(), CapLimit, 300, 600, 1 ) end @@ -3613,14 +3613,14 @@ do -- Setup GCI. -- GCI is setup for all Squadrons. - self:E( "Setting up GCI ..." ) + self:F( "Setting up GCI ..." ) for AirbaseID, AirbaseName in pairs( AirbaseNames ) do local Airbase = _DATABASE:FindAirbase( AirbaseName ) -- Wrapper.Airbase#AIRBASE local AirbaseName = Airbase:GetName() local Squadron = self.DefenderSquadrons[AirbaseName] - self:E( { Airbase = AirbaseName } ) + self:F( { Airbase = AirbaseName } ) if Squadron then - self:E( { GCIAirbase = AirbaseName } ) + self:F( { GCIAirbase = AirbaseName } ) self:SetSquadronGci( AirbaseName, 800, 1200 ) end end diff --git a/Moose Development/Moose/AI/AI_A2A_Patrol.lua b/Moose Development/Moose/AI/AI_A2A_Patrol.lua index dfffe95b5..a6620b68b 100644 --- a/Moose Development/Moose/AI/AI_A2A_Patrol.lua +++ b/Moose Development/Moose/AI/AI_A2A_Patrol.lua @@ -305,7 +305,6 @@ function AI_A2A_PATROL:onafterPatrol( AIPatrol, From, Event, To ) AIPatrol:OnReSpawn( function( PatrolGroup ) - self:E( "ReSpawn" ) self:__Reset( 1 ) self:__Route( 5 ) end diff --git a/Moose Development/Moose/AI/AI_CAS.lua b/Moose Development/Moose/AI/AI_CAS.lua index a62f6d28d..3f3a88a19 100644 --- a/Moose Development/Moose/AI/AI_CAS.lua +++ b/Moose Development/Moose/AI/AI_CAS.lua @@ -403,7 +403,6 @@ end -- @param #string Event The Event string. -- @param #string To The To State string. function AI_CAS_ZONE:onafterTarget( Controllable, From, Event, To ) - self:E("onafterTarget") if Controllable:IsAlive() then @@ -414,7 +413,7 @@ function AI_CAS_ZONE:onafterTarget( Controllable, From, Event, To ) if DetectedUnit:IsAlive() then if DetectedUnit:IsInZone( self.EngageZone ) then if Detected == true then - self:E( {"Target: ", DetectedUnit } ) + self:F( {"Target: ", DetectedUnit } ) self.DetectedUnits[DetectedUnit] = false local AttackTask = Controllable:TaskAttackUnit( DetectedUnit, false, self.EngageWeaponExpend, self.EngageAttackQty, self.EngageDirection, self.EngageAltitude, nil ) self.Controllable:PushTask( AttackTask, 1 ) @@ -496,7 +495,7 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To, self:T( DetectedUnit ) if DetectedUnit:IsAlive() then if DetectedUnit:IsInZone( self.EngageZone ) then - self:E( {"Engaging ", DetectedUnit } ) + self:F( {"Engaging ", DetectedUnit } ) AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit, true, EngageWeaponExpend, diff --git a/Moose Development/Moose/Actions/Act_Account.lua b/Moose Development/Moose/Actions/Act_Account.lua index 0cc641623..809a28690 100644 --- a/Moose Development/Moose/Actions/Act_Account.lua +++ b/Moose Development/Moose/Actions/Act_Account.lua @@ -190,7 +190,6 @@ do -- ACT_ACCOUNT_DEADS -- @param #string From -- @param #string To function ACT_ACCOUNT_DEADS:onenterReport( ProcessUnit, Task, From, Event, To ) - self:E( { ProcessUnit, From, Event, To } ) local MessageText = "Your group with assigned " .. self.TaskName .. " task has " .. Task.TargetSetUnit:GetUnitTypesText() .. " targets left to be destroyed." self:GetCommandCenter():MessageTypeToGroup( MessageText, ProcessUnit:GetGroup(), MESSAGE.Type.Information ) diff --git a/Moose Development/Moose/Actions/Act_Assign.lua b/Moose Development/Moose/Actions/Act_Assign.lua index df82b8172..930810ee2 100644 --- a/Moose Development/Moose/Actions/Act_Assign.lua +++ b/Moose Development/Moose/Actions/Act_Assign.lua @@ -156,7 +156,7 @@ do -- ACT_ASSIGN_ACCEPT -- @param #string From -- @param #string To function ACT_ASSIGN_ACCEPT:onafterStart( ProcessUnit, From, Event, To ) - self:E( { ProcessUnit, From, Event, To } ) + self:F( { ProcessUnit, From, Event, To } ) self:__Assign( 1 ) end @@ -168,8 +168,7 @@ do -- ACT_ASSIGN_ACCEPT -- @param #string From -- @param #string To function ACT_ASSIGN_ACCEPT:onenterAssigned( ProcessUnit, From, Event, To ) - env.info( "in here" ) - self:E( { ProcessUnit, From, Event, To } ) + self:F( { ProcessUnit, From, Event, To } ) local ProcessGroup = ProcessUnit:GetGroup() @@ -234,7 +233,7 @@ do -- ACT_ASSIGN_MENU_ACCEPT -- @param #string From -- @param #string To function ACT_ASSIGN_MENU_ACCEPT:onafterStart( ProcessUnit, From, Event, To ) - self:E( { ProcessUnit, From, Event, To } ) + self:F( { ProcessUnit, From, Event, To } ) self:GetCommandCenter():MessageTypeToGroup( "Access the radio menu to accept the task. You have 30 seconds or the assignment will be cancelled.", ProcessUnit:GetGroup(), MESSAGE.Type.Information ) @@ -248,7 +247,6 @@ do -- ACT_ASSIGN_MENU_ACCEPT --- Menu function. -- @param #ACT_ASSIGN_MENU_ACCEPT self function ACT_ASSIGN_MENU_ACCEPT:MenuAssign() - self:E( ) self:__Assign( 1 ) end @@ -256,7 +254,6 @@ do -- ACT_ASSIGN_MENU_ACCEPT --- Menu function. -- @param #ACT_ASSIGN_MENU_ACCEPT self function ACT_ASSIGN_MENU_ACCEPT:MenuReject() - self:E( ) self:__Reject( 1 ) end @@ -268,7 +265,7 @@ do -- ACT_ASSIGN_MENU_ACCEPT -- @param #string From -- @param #string To function ACT_ASSIGN_MENU_ACCEPT:onafterAssign( ProcessUnit, From, Event, To ) - self:E( { ProcessUnit.UnitNameFrom, Event, To } ) + self:F( { ProcessUnit.UnitNameFrom, Event, To } ) self.Menu:Remove() end @@ -280,7 +277,7 @@ do -- ACT_ASSIGN_MENU_ACCEPT -- @param #string From -- @param #string To function ACT_ASSIGN_MENU_ACCEPT:onafterReject( ProcessUnit, From, Event, To ) - self:E( { ProcessUnit.UnitName, From, Event, To } ) + self:F( { ProcessUnit.UnitName, From, Event, To } ) self.Menu:Remove() --TODO: need to resolve this problem ... it has to do with the events ... diff --git a/Moose Development/Moose/Actions/Act_Assist.lua b/Moose Development/Moose/Actions/Act_Assist.lua index 439abc49d..7d4e55d85 100644 --- a/Moose Development/Moose/Actions/Act_Assist.lua +++ b/Moose Development/Moose/Actions/Act_Assist.lua @@ -111,7 +111,6 @@ do -- ACT_ASSIST local MissionMenu = self:GetMission():GetMenu( ProcessGroup ) local function MenuSmoke( MenuParam ) - self:E( MenuParam ) local self = MenuParam.self local SmokeColor = MenuParam.SmokeColor self.SmokeColor = SmokeColor diff --git a/Moose Development/Moose/Actions/Act_JTAC.lua b/Moose Development/Moose/Actions/Act_JTAC.lua index 2dd363f58..86f965eb0 100644 --- a/Moose Development/Moose/Actions/Act_JTAC.lua +++ b/Moose Development/Moose/Actions/Act_JTAC.lua @@ -83,7 +83,7 @@ end function PROCESS_JTAC:OnJTACMenuUpdate( Fsm, From, Event, To ) local function JTACMenuSpot( MenuParam ) - self:E( MenuParam.TargetUnit.UnitName ) + self:F( MenuParam.TargetUnit.UnitName ) local self = MenuParam.self local TargetUnit = MenuParam.TargetUnit @@ -91,7 +91,7 @@ function PROCESS_JTAC:OnJTACMenuUpdate( Fsm, From, Event, To ) end local function JTACMenuCancel( MenuParam ) - self:E( MenuParam ) + self:F( MenuParam ) local self = MenuParam.self local TargetUnit = MenuParam.TargetUnit @@ -102,7 +102,7 @@ function PROCESS_JTAC:OnJTACMenuUpdate( Fsm, From, Event, To ) -- Loop each unit in the target set, and determine the threat levels map table. local UnitThreatLevels = self.TargetSetUnit:GetUnitThreatLevels() - self:E( {"UnitThreadLevels", UnitThreatLevels } ) + self:F( {"UnitThreadLevels", UnitThreatLevels } ) local JTACMenu = self.ProcessGroup:GetState( self.ProcessGroup, "JTACMenu" ) diff --git a/Moose Development/Moose/Actions/Act_Route.lua b/Moose Development/Moose/Actions/Act_Route.lua index 4e0527d37..e50c3ffcc 100644 --- a/Moose Development/Moose/Actions/Act_Route.lua +++ b/Moose Development/Moose/Actions/Act_Route.lua @@ -158,8 +158,6 @@ do -- ACT_ROUTE -- @return #string function ACT_ROUTE:GetRouteText( Controllable ) - self:E() - local RouteText = "" local Coordinate = nil -- Core.Point#COORDINATE @@ -182,13 +180,13 @@ do -- ACT_ROUTE local ShortestDistance = 0 local ShortestReferencePoint = nil local ShortestReferenceName = "" - self:E( { CC.ReferencePoints } ) + self:F( { CC.ReferencePoints } ) for ZoneName, Zone in pairs( CC.ReferencePoints ) do - self:E( { ZoneName = ZoneName } ) + self:F( { ZoneName = ZoneName } ) local Zone = Zone -- Core.Zone#ZONE local ZoneCoord = Zone:GetCoordinate() local ZoneDistance = ZoneCoord:Get2DDistance( self.Coordinate ) - self:E( { ShortestDistance, ShortestReferenceName } ) + self:F( { ShortestDistance, ShortestReferenceName } ) if ShortestDistance == 0 or ZoneDistance < ShortestDistance then ShortestDistance = ZoneDistance ShortestReferencePoint = ZoneCoord @@ -467,7 +465,7 @@ do -- ACT_ROUTE_ZONE -- @param #string From -- @param #string To function ACT_ROUTE_ZONE:onafterReport( ProcessUnit, From, Event, To ) - self:E( { ProcessUnit = ProcessUnit } ) + self:F( { ProcessUnit = ProcessUnit } ) local RouteText = self:GetRouteText( ProcessUnit ) self:GetCommandCenter():MessageTypeToGroup( RouteText, ProcessUnit:GetGroup(), MESSAGE.Type.Update ) diff --git a/Moose Development/Moose/Core/Event.lua b/Moose Development/Moose/Core/Event.lua index af96d1070..3e55977da 100644 --- a/Moose Development/Moose/Core/Event.lua +++ b/Moose Development/Moose/Core/Event.lua @@ -472,7 +472,7 @@ end -- @return #EVENT.Events function EVENT:Reset( EventObject ) --R2.1 - self:E( { "Resetting subscriptions for class: ", EventObject:GetClassNameAndID() } ) + self:F( { "Resetting subscriptions for class: ", EventObject:GetClassNameAndID() } ) local EventPriority = EventObject:GetEventPriority() for EventID, EventData in pairs( self.Events ) do @@ -562,7 +562,6 @@ end -- @param EventID -- @return #EVENT function EVENT:OnEventForGroup( GroupName, EventFunction, EventClass, EventID, ... ) - self:E( GroupName ) local Event = self:Init( EventID, EventClass ) Event.EventGroup = true @@ -899,7 +898,7 @@ function EVENT:onEvent( Event ) if EventData.EventFunction then if Event.IniObjectCategory ~= 3 then - self:E( { "Calling EventFunction for UNIT ", EventClass:GetClassNameAndID(), ", Unit ", Event.IniUnitName, EventPriority } ) + self:F( { "Calling EventFunction for UNIT ", EventClass:GetClassNameAndID(), ", Unit ", Event.IniUnitName, EventPriority } ) end local Result, Value = xpcall( @@ -915,7 +914,7 @@ function EVENT:onEvent( Event ) -- Now call the default event function. if Event.IniObjectCategory ~= 3 then - self:E( { "Calling " .. EventMeta.Event .. " for Class ", EventClass:GetClassNameAndID(), EventPriority } ) + self:F( { "Calling " .. EventMeta.Event .. " for Class ", EventClass:GetClassNameAndID(), EventPriority } ) end local Result, Value = xpcall( @@ -950,7 +949,7 @@ function EVENT:onEvent( Event ) if EventData.EventFunction then if Event.IniObjectCategory ~= 3 then - self:E( { "Calling EventFunction for GROUP ", EventClass:GetClassNameAndID(), ", Unit ", Event.IniUnitName, EventPriority } ) + self:F( { "Calling EventFunction for GROUP ", EventClass:GetClassNameAndID(), ", Unit ", Event.IniUnitName, EventPriority } ) end local Result, Value = xpcall( @@ -966,7 +965,7 @@ function EVENT:onEvent( Event ) -- Now call the default event function. if Event.IniObjectCategory ~= 3 then - self:E( { "Calling " .. EventMeta.Event .. " for GROUP ", EventClass:GetClassNameAndID(), EventPriority } ) + self:F( { "Calling " .. EventMeta.Event .. " for GROUP ", EventClass:GetClassNameAndID(), EventPriority } ) end local Result, Value = xpcall( diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua index 0e0a41ed8..3fdfea1c5 100644 --- a/Moose Development/Moose/Core/Point.lua +++ b/Moose Development/Moose/Core/Point.lua @@ -1244,7 +1244,7 @@ do -- COORDINATE -- @return #string The coordinate Text in the configured coordinate system. function COORDINATE:ToStringFromRP( ReferenceCoord, ReferenceName, Controllable, Settings ) -- R2.2 - self:E( { ReferenceCoord = ReferenceCoord, ReferenceName = ReferenceName } ) + self:F( { ReferenceCoord = ReferenceCoord, ReferenceName = ReferenceName } ) local Settings = Settings or ( Controllable and _DATABASE:GetPlayerSettings( Controllable:GetPlayerName() ) ) or _SETTINGS diff --git a/Moose Development/Moose/Core/Set.lua b/Moose Development/Moose/Core/Set.lua index 37f5988b3..b4e7a95a4 100644 --- a/Moose Development/Moose/Core/Set.lua +++ b/Moose Development/Moose/Core/Set.lua @@ -1694,10 +1694,10 @@ do -- SET_UNIT local function EvaluateZone( ZoneUnit ) local ZoneUnitName = ZoneUnit:GetName() - self:E( { ZoneUnitName = ZoneUnitName } ) + self:F( { ZoneUnitName = ZoneUnitName } ) if self:FindUnit( ZoneUnitName ) then IsPartiallyInZone = true - self:E( { Found = true } ) + self:F( { Found = true } ) return false end @@ -2179,7 +2179,7 @@ do -- SET_UNIT if self.Filter.Coalitions then local MUnitCoalition = false for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do - self:E( { "Coalition:", MUnit:GetCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } ) + self:F( { "Coalition:", MUnit:GetCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } ) if self.FilterMeta.Coalitions[CoalitionName] and self.FilterMeta.Coalitions[CoalitionName] == MUnit:GetCoalition() then MUnitCoalition = true end diff --git a/Moose Development/Moose/Core/Spawn.lua b/Moose Development/Moose/Core/Spawn.lua index f4961fd4e..eef24926a 100644 --- a/Moose Development/Moose/Core/Spawn.lua +++ b/Moose Development/Moose/Core/Spawn.lua @@ -1133,7 +1133,7 @@ end -- Spawn_Heli:SpawnAtAirbase( AIRBASE:FindByName( "Carrier" ), SPAWN.Takeoff.Cold ) -- function SPAWN:SpawnAtAirbase( SpawnAirbase, Takeoff, TakeoffAltitude ) -- R2.2 - self:E( { self.SpawnTemplatePrefix, SpawnAirbase, Takeoff, TakeoffAltitude } ) + self:F( { self.SpawnTemplatePrefix, SpawnAirbase, Takeoff, TakeoffAltitude } ) local PointVec3 = SpawnAirbase:GetPointVec3() self:T2(PointVec3) diff --git a/Moose Development/Moose/Core/Spot.lua b/Moose Development/Moose/Core/Spot.lua index 5e6eb014f..38ed1d583 100644 --- a/Moose Development/Moose/Core/Spot.lua +++ b/Moose Development/Moose/Core/Spot.lua @@ -200,7 +200,7 @@ do -- @param #number LaserCode -- @param #number Duration function SPOT:onafterLaseOn( From, Event, To, Target, LaserCode, Duration ) - self:E( { "LaseOn", Target, LaserCode, Duration } ) + self:F( { "LaseOn", Target, LaserCode, Duration } ) local function StopLase( self ) self:LaseOff() @@ -228,10 +228,10 @@ do --- @param #SPOT self -- @param Core.Event#EVENTDATA EventData function SPOT:OnEventDead(EventData) - self:E( { Dead = EventData.IniDCSUnitName, Target = self.Target } ) + self:F( { Dead = EventData.IniDCSUnitName, Target = self.Target } ) if self.Target then if EventData.IniDCSUnitName == self.Target:GetName() then - self:E( {"Target dead ", self.Target:GetName() } ) + self:F( {"Target dead ", self.Target:GetName() } ) self:Destroyed() self:LaseOff() end @@ -249,7 +249,7 @@ do self.SpotLaser:setPoint( self.Target:GetPointVec3():AddY(1):GetVec3() ) self:__Lasing( -0.2 ) else - self:E( { "Target is not alive", self.Target:IsAlive() } ) + self:F( { "Target is not alive", self.Target:IsAlive() } ) end end @@ -261,7 +261,7 @@ do -- @return #SPOT function SPOT:onafterLaseOff( From, Event, To ) - self:E( {"Stopped lasing for ", self.Target:GetName() , SpotIR = self.SportIR, SpotLaser = self.SpotLaser } ) + self:F( {"Stopped lasing for ", self.Target:GetName() , SpotIR = self.SportIR, SpotLaser = self.SpotLaser } ) self.Lasing = false diff --git a/Moose Development/Moose/Core/Zone.lua b/Moose Development/Moose/Core/Zone.lua index 9e0ab175f..618d49ec5 100644 --- a/Moose Development/Moose/Core/Zone.lua +++ b/Moose Development/Moose/Core/Zone.lua @@ -607,7 +607,7 @@ function ZONE_RADIUS:Scan( ObjectCategories ) local ZoneCoord = self:GetCoordinate() local ZoneRadius = self:GetRadius() - self:E({ZoneCoord = ZoneCoord, ZoneRadius = ZoneRadius, ZoneCoordLL = ZoneCoord:ToStringLLDMS()}) + self:F({ZoneCoord = ZoneCoord, ZoneRadius = ZoneRadius, ZoneCoordLL = ZoneCoord:ToStringLLDMS()}) local SphereSearch = { id = world.VolumeType.SPHERE, @@ -625,14 +625,14 @@ function ZONE_RADIUS:Scan( ObjectCategories ) (ObjectCategory == Object.Category.STATIC and ZoneObject:isExist()) then local CoalitionDCSUnit = ZoneObject:getCoalition() self.ScanData.Coalitions[CoalitionDCSUnit] = true - self:E( { Name = ZoneObject:getName(), Coalition = CoalitionDCSUnit } ) + self:F( { Name = ZoneObject:getName(), Coalition = CoalitionDCSUnit } ) end if ObjectCategory == Object.Category.SCENERY then local SceneryType = ZoneObject:getTypeName() local SceneryName = ZoneObject:getName() self.ScanData.Scenery[SceneryType] = self.ScanData.Scenery[SceneryType] or {} self.ScanData.Scenery[SceneryType][SceneryName] = SCENERY:Register( SceneryName, ZoneObject ) - self:E( { SCENERY = self.ScanData.Scenery[SceneryType][SceneryName] } ) + self:F( { SCENERY = self.ScanData.Scenery[SceneryType][SceneryName] } ) end end return true @@ -779,7 +779,7 @@ function ZONE_RADIUS:SearchZone( EvaluateFunction, ObjectCategories ) local ZoneCoord = self:GetCoordinate() local ZoneRadius = self:GetRadius() - self:E({ZoneCoord = ZoneCoord, ZoneRadius = ZoneRadius, ZoneCoordLL = ZoneCoord:ToStringLLDMS()}) + self:F({ZoneCoord = ZoneCoord, ZoneRadius = ZoneRadius, ZoneCoordLL = ZoneCoord:ToStringLLDMS()}) local SphereSearch = { id = world.VolumeType.SPHERE, diff --git a/Moose Development/Moose/Functional/Designate.lua b/Moose Development/Moose/Functional/Designate.lua index 46aebc274..e8322dc26 100644 --- a/Moose Development/Moose/Functional/Designate.lua +++ b/Moose Development/Moose/Functional/Designate.lua @@ -573,7 +573,7 @@ do -- DESIGNATE function DESIGNATE:SetLaserCodes( LaserCodes ) --R2.1 self.LaserCodes = ( type( LaserCodes ) == "table" ) and LaserCodes or { LaserCodes } - self:E( { LaserCodes = self.LaserCodes } ) + self:F( { LaserCodes = self.LaserCodes } ) self.LaserCodesUsed = {} @@ -938,7 +938,7 @@ do -- DESIGNATE for DesignateIndex, Designating in pairs( self.Designating ) do - local DetectedItem = self.Detection:GetDetectedItem( DesignateIndex ) + local DetectedItem = self.Detection:GetDetectedItemByIndex( DesignateIndex ) if DetectedItem then @@ -987,7 +987,7 @@ do -- DESIGNATE -- @param #DESIGNATE self function DESIGNATE:MenuStatus( AttackGroup ) - self:E("Status") + self:F("Status") self:SendStatus( AttackGroup ) end @@ -996,7 +996,7 @@ do -- DESIGNATE -- @param #DESIGNATE self function DESIGNATE:MenuFlashStatus( AttackGroup, Flash ) - self:E("Flash Status") + self:F("Flash Status") self.FlashStatusMenu[AttackGroup] = Flash self:SetDesignateMenu() @@ -1007,7 +1007,7 @@ do -- DESIGNATE -- @param #DESIGNATE self function DESIGNATE:MenuForget( Index ) - self:E("Forget") + self:F("Forget") self.Designating[Index] = "" self:SetDesignateMenu() @@ -1017,7 +1017,7 @@ do -- DESIGNATE -- @param #DESIGNATE self function DESIGNATE:MenuAutoLase( AutoLase ) - self:E("AutoLase") + self:F("AutoLase") self:SetAutoLase( AutoLase, true ) end @@ -1026,7 +1026,7 @@ do -- DESIGNATE -- @param #DESIGNATE self function DESIGNATE:MenuSmoke( Index, Color ) - self:E("Designate through Smoke") + self:F("Designate through Smoke") if string.find( self.Designating[Index], "S" ) == nil then self.Designating[Index] = self.Designating[Index] .. "S" @@ -1039,7 +1039,7 @@ do -- DESIGNATE -- @param #DESIGNATE self function DESIGNATE:MenuIlluminate( Index ) - self:E("Designate through Illumination") + self:F("Designate through Illumination") if string.find( self.Designating[Index], "I", 1, true ) == nil then self.Designating[Index] = self.Designating[Index] .. "I" @@ -1053,7 +1053,7 @@ do -- DESIGNATE -- @param #DESIGNATE self function DESIGNATE:MenuLaseOn( Index, Duration ) - self:E("Designate through Lase") + self:F("Designate through Lase") self:__LaseOn( 1, Index, Duration ) self:SetDesignateMenu() @@ -1064,7 +1064,7 @@ do -- DESIGNATE -- @param #DESIGNATE self function DESIGNATE:MenuLaseCode( Index, Duration, LaserCode ) - self:E( "Designate through Lase using " .. LaserCode ) + self:F( "Designate through Lase using " .. LaserCode ) self:__LaseOn( 1, Index, Duration, LaserCode ) self:SetDesignateMenu() @@ -1075,7 +1075,7 @@ do -- DESIGNATE -- @param #DESIGNATE self function DESIGNATE:MenuLaseOff( Index, Duration ) - self:E("Lasing off") + self:F("Lasing off") self.Designating[Index] = string.gsub( self.Designating[Index], "L", "" ) self:__LaseOff( 1, Index ) @@ -1155,7 +1155,7 @@ do -- DESIGNATE if not Recce then - self:E( "Lasing..." ) + self:F( "Lasing..." ) self.RecceSet:Flush() for RecceGroupID, RecceGroup in pairs( self.RecceSet:GetSet() ) do @@ -1307,7 +1307,7 @@ do -- DESIGNATE MarkedCount = MarkedCount + 1 - self:E( "Smoking ..." ) + self:F( "Smoking ..." ) local RecceGroup = self.RecceSet:FindNearestGroupFromPointVec2(SmokeUnit:GetPointVec2()) local RecceUnit = RecceGroup:GetUnit( 1 ) diff --git a/Moose Development/Moose/Functional/Detection.lua b/Moose Development/Moose/Functional/Detection.lua index a76651ab9..bc738e2f7 100644 --- a/Moose Development/Moose/Functional/Detection.lua +++ b/Moose Development/Moose/Functional/Detection.lua @@ -275,6 +275,7 @@ do -- DETECTION_BASE DetectionRun = 0, DetectedObjectsIdentified = {}, DetectedItems = {}, + DetectedItemsByIndex = {}, } --- @type DETECTION_BASE.DetectedObjects @@ -515,7 +516,7 @@ do -- DETECTION_BASE -- @param #string Event The Event string. -- @param #string To The To State string. function DETECTION_BASE:onafterDetect(From,Event,To) - self:E( { From, Event, To } ) + self:F( { From, Event, To } ) local DetectDelay = 0.1 self.DetectionCount = 0 @@ -525,7 +526,7 @@ do -- DETECTION_BASE local DetectionTimeStamp = timer.getTime() for DetectionGroupID, DetectionGroupData in pairs( self.DetectionSetGroup:GetSet() ) do - --self:E( { DetectionGroupData } ) + --self:F( { DetectionGroupData } ) self:__DetectionGroup( DetectDelay, DetectionGroupData, DetectionTimeStamp ) -- Process each detection asynchronously. self.DetectionCount = self.DetectionCount + 1 DetectDelay = DetectDelay + 1 @@ -538,7 +539,7 @@ do -- DETECTION_BASE -- @param #string To The To State string. -- @param Wrapper.Group#GROUP DetectionGroup The Group detecting. function DETECTION_BASE:onafterDetectionGroup( From, Event, To, DetectionGroup, DetectionTimeStamp ) - self:E( { From, Event, To } ) + self:F( { From, Event, To } ) self.DetectionRun = self.DetectionRun + 1 @@ -672,7 +673,7 @@ do -- DETECTION_BASE if not self.DetectedObjects[DetectedObjectName] and Detection.visible and self.ZoneProbability then for ZoneDataID, ZoneData in pairs( self.ZoneProbability ) do - self:E({ZoneData}) + self:F({ZoneData}) local ZoneObject = ZoneData[1] -- Core.Zone#ZONE_BASE local ZoneProbability = ZoneData[2] -- #number ZoneProbability = ZoneProbability * 30 / 300 @@ -784,7 +785,7 @@ do -- DETECTION_BASE local DetectedItems = self:GetDetectedItems() for DetectedItemIndex, DetectedItem in pairs( DetectedItems ) do - local DetectedSet = self:GetDetectedSet( DetectedItemIndex ) + local DetectedSet = self:GetDetectedSet( DetectedItem ) if DetectedSet then DetectedSet:RemoveUnitsByName( UnitName ) end @@ -799,7 +800,7 @@ do -- DETECTION_BASE function DETECTION_BASE:CreateDetectionItems() self:F2() - self:E( "Error, in DETECTION_BASE class..." ) + self:F( "Error, in DETECTION_BASE class..." ) return self end @@ -1000,7 +1001,7 @@ do -- DETECTION_BASE self.AcceptZones = AcceptZones end else - self:E( { "AcceptZones must be a list of ZONE_BASE derived objects or one ZONE_BASE derived object", AcceptZones } ) + self:F( { "AcceptZones must be a list of ZONE_BASE derived objects or one ZONE_BASE derived object", AcceptZones } ) error() end @@ -1021,7 +1022,7 @@ do -- DETECTION_BASE self.RejectZones = RejectZones end else - self:E( { "RejectZones must be a list of ZONE_BASE derived objects or one ZONE_BASE derived object", RejectZones } ) + self:F( { "RejectZones must be a list of ZONE_BASE derived objects or one ZONE_BASE derived object", RejectZones } ) error() end @@ -1113,7 +1114,7 @@ do -- DETECTION_BASE DetectedItem.Changes[ChangeCode].ID = ID DetectedItem.Changes[ChangeCode].ItemUnitType = ItemUnitType - self:E( { "Change on Detected Item:", DetectedItemID = DetectedItem.ID, ChangeCode = ChangeCode, ItemUnitType = ItemUnitType } ) + self:F( { "Change on Detected Item:", DetectedItemID = DetectedItem.ID, ChangeCode = ChangeCode, ItemUnitType = ItemUnitType } ) return self end @@ -1136,7 +1137,7 @@ do -- DETECTION_BASE DetectedItem.Changes[ChangeCode][ChangeUnitType] = DetectedItem.Changes[ChangeCode][ChangeUnitType] + 1 DetectedItem.Changes[ChangeCode].ID = ID - self:E( { "Change on Detected Unit:", DetectedItemID = DetectedItem.ID, ChangeCode = ChangeCode, ChangeUnitType = ChangeUnitType } ) + self:F( { "Change on Detected Unit:", DetectedItemID = DetectedItem.ID, ChangeCode = ChangeCode, ChangeUnitType = ChangeUnitType } ) return self end @@ -1458,23 +1459,26 @@ do -- DETECTION_BASE -- The DetectedItem is a table and contains a SET_UNIT in the field Set. -- @param #DETECTION_BASE self -- @param ItemPrefix - -- @param #string DetectedItemIndex The index of the DetectedItem. + -- @param DetectedItemKey The key of the DetectedItem. -- @param Core.Set#SET_UNIT Set (optional) The Set of Units to be added. -- @return #DETECTION_BASE.DetectedItem - function DETECTION_BASE:AddDetectedItem( ItemPrefix, DetectedItemIndex, Set ) + function DETECTION_BASE:AddDetectedItem( ItemPrefix, DetectedItemKey, Set ) local DetectedItem = {} self.DetectedItemCount = self.DetectedItemCount + 1 self.DetectedItemMax = self.DetectedItemMax + 1 - if DetectedItemIndex then - self.DetectedItems[DetectedItemIndex] = DetectedItem + if DetectedItemKey then + self.DetectedItems[DetectedItemKey] = DetectedItem else self.DetectedItems[self.DetectedItemMax] = DetectedItem end + self.DetectedItemsByIndex[self.DetectedItemMax] = DetectedItem + + DetectedItem.Set = Set or SET_UNIT:New():FilterDeads():FilterCrashes() - DetectedItem.Index = DetectedItemIndex or self.DetectedItemMax + DetectedItem.Index = DetectedItemKey or self.DetectedItemMax DetectedItem.ItemID = ItemPrefix .. "." .. self.DetectedItemMax DetectedItem.ID = self.DetectedItemMax DetectedItem.Removed = false @@ -1485,13 +1489,13 @@ do -- DETECTION_BASE --- Adds a new DetectedItem to the DetectedItems list. -- The DetectedItem is a table and contains a SET_UNIT in the field Set. -- @param #DETECTION_BASE self - -- @param #string DetectedItemIndex The index of the DetectedItem. + -- @param DetectedItemKey The key of the DetectedItem. -- @param Core.Set#SET_UNIT Set (optional) The Set of Units to be added. -- @param Core.Zone#ZONE_UNIT Zone (optional) The Zone to be added where the Units are located. -- @return #DETECTION_BASE.DetectedItem - function DETECTION_BASE:AddDetectedItemZone( DetectedItemIndex, Set, Zone ) + function DETECTION_BASE:AddDetectedItemZone( DetectedItemKey, Set, Zone ) - local DetectedItem = self:AddDetectedItem( "AREA", DetectedItemIndex, Set ) + local DetectedItem = self:AddDetectedItem( "AREA", DetectedItemKey, Set ) DetectedItem.Zone = Zone @@ -1501,12 +1505,16 @@ do -- DETECTION_BASE --- Removes an existing DetectedItem from the DetectedItems list. -- The DetectedItem is a table and contains a SET_UNIT in the field Set. -- @param #DETECTION_BASE self - -- @param #number DetectedItemIndex The index or position in the DetectedItems list where the item needs to be removed. - function DETECTION_BASE:RemoveDetectedItem( DetectedItemIndex ) + -- @param DetectedItemKey The key in the DetectedItems list where the item needs to be removed. + function DETECTION_BASE:RemoveDetectedItem( DetectedItemKey ) - if self.DetectedItems[DetectedItemIndex] then + local DetectedItem = self.DetectedItems[DetectedItemKey] + + if DetectedItem then self.DetectedItemCount = self.DetectedItemCount - 1 - self.DetectedItems[DetectedItemIndex] = nil + local DetectedItemIndex = DetectedItem.Index + self.DetectedItemsByIndex[DetectedItemIndex] = nil + self.DetectedItems[DetectedItemKey] = nil end end @@ -1528,13 +1536,31 @@ do -- DETECTION_BASE return DetectedCount end + --- Get a detected item using a given Key. + -- @param #DETECTION_BASE self + -- @param Key + -- @return #DETECTION_BASE.DetectedItem + function DETECTION_BASE:GetDetectedItemByKey( Key ) + + self:F( { DetectedItems = self.DetectedItems } ) + + local DetectedItem = self.DetectedItems[Key] + if DetectedItem then + return DetectedItem + end + + return nil + end + --- Get a detected item using a given numeric index. -- @param #DETECTION_BASE self -- @param #number Index -- @return #DETECTION_BASE.DetectedItem - function DETECTION_BASE:GetDetectedItem( Index ) + function DETECTION_BASE:GetDetectedItemByIndex( Index ) - local DetectedItem = self.DetectedItems[Index] + self:F( { DetectedItemsByIndex = self.DetectedItemsByIndex } ) + + local DetectedItem = self.DetectedItemsByIndex[Index] if DetectedItem then return DetectedItem end @@ -1544,16 +1570,11 @@ do -- DETECTION_BASE --- Get a detected ItemID using a given numeric index. -- @param #DETECTION_BASE self - -- @param #number Index + -- @param #DETECTION_BASE.DetectedItem DetectedItem The DetectedItem. -- @return #string DetectedItemID - function DETECTION_BASE:GetDetectedItemID( Index ) --R2.1 + function DETECTION_BASE:GetDetectedItemID( DetectedItem ) --R2.1 - local DetectedItem = self.DetectedItems[Index] - if DetectedItem then - return DetectedItem.ItemID - end - - return "" + return DetectedItem and DetectedItem.ItemID or "" end --- Get a detected ID using a given numeric index. @@ -1562,7 +1583,7 @@ do -- DETECTION_BASE -- @return #string DetectedItemID function DETECTION_BASE:GetDetectedID( Index ) --R2.1 - local DetectedItem = self.DetectedItems[Index] + local DetectedItem = self.DetectedItemsByIndex[Index] if DetectedItem then return DetectedItem.ID end @@ -1572,12 +1593,11 @@ do -- DETECTION_BASE --- Get the @{Set#SET_UNIT} of a detecttion area using a given numeric index. -- @param #DETECTION_BASE self - -- @param #number Index + -- @param #DETECTION_BASE.DetectedItem DetectedItem -- @return Core.Set#SET_UNIT DetectedSet - function DETECTION_BASE:GetDetectedSet( Index ) + function DETECTION_BASE:GetDetectedSet( DetectedItem ) - local DetectedItem = self:GetDetectedItem( Index ) - local DetectedSetUnit = DetectedItem.Set + local DetectedSetUnit = DetectedItem and DetectedItem.Set if DetectedSetUnit then return DetectedSetUnit end @@ -1622,11 +1642,11 @@ do -- DETECTION_BASE --- Get the @{Zone#ZONE_UNIT} of a detection area using a given numeric index. -- @param #DETECTION_BASE self - -- @param #number Index + -- @param #DETECTION_BASE.DetectedItem DetectedItem The DetectedItem. -- @return Core.Zone#ZONE_UNIT DetectedZone - function DETECTION_BASE:GetDetectedItemZone( Index ) + function DETECTION_BASE:GetDetectedItemZone( DetectedItem ) - local DetectedZone = self.DetectedItems[Index].Zone + local DetectedZone = DetectedItem and DetectedItem.Zone if DetectedZone then return DetectedZone end @@ -1641,7 +1661,7 @@ do -- DETECTION_BASE --- Set the detected item coordinate. -- @param #DETECTION_BASE self - -- @param #DETECTION_BASE.DetectedItem The DetectedItem to set the coordinate at. + -- @param #DETECTION_BASE.DetectedItem DetectedItem The DetectedItem to set the coordinate at. -- @param Core.Point#COORDINATE Coordinate The coordinate to set the last know detected position at. -- @param Wrapper.Unit#UNIT DetectedItemUnit The unit to set the heading and altitude from. -- @return #DETECTION_BASE @@ -1661,13 +1681,11 @@ do -- DETECTION_BASE --- Get the detected item coordinate. -- @param #DETECTION_BASE self - -- @param #number Index + -- @param #DETECTION_BASE.DetectedItem DetectedItem The DetectedItem to set the coordinate at. -- @return Core.Point#COORDINATE - function DETECTION_BASE:GetDetectedItemCoordinate( Index ) - self:F( { Index = Index } ) + function DETECTION_BASE:GetDetectedItemCoordinate( DetectedItem ) + self:F( { DetectedItem = DetectedItem } ) - local DetectedItem = self:GetDetectedItem( Index ) - if DetectedItem then return DetectedItem.Coordinate end @@ -1692,42 +1710,27 @@ do -- DETECTION_BASE --- Get the detected item coordinate. -- @param #DETECTION_BASE self - -- @param #number Index + -- @param #DETECTION_BASE.DetectedItem DetectedItem The DetectedItem. -- @return #number ThreatLevel - function DETECTION_BASE:GetDetectedItemThreatLevel( Index ) - self:F( { Index = Index } ) + function DETECTION_BASE:GetDetectedItemThreatLevel( DetectedItem ) + self:F( { DetectedItem = DetectedItem } ) - local DetectedItem = self:GetDetectedItem( Index ) - if DetectedItem then + self:F( { ThreatLevel = DetectedItem.ThreatLevel, ThreatText = DetectedItem.ThreatText } ) return DetectedItem.ThreatLevel or 0, DetectedItem.ThreatText or "" end return nil, "" end - - - - - --- Menu of a detected item using a given numeric index. - -- @param #DETECTION_BASE self - -- @param Index - -- @return #string - function DETECTION_BASE:DetectedItemMenu( Index, AttackGroup ) - self:F( Index ) - return nil - end - - --- Report summary of a detected item using a given numeric index. -- @param #DETECTION_BASE self - -- @param Index + -- @param #DETECTION_BASE.DetectedItem DetectedItem The DetectedItem. -- @param Wrapper.Group#GROUP AttackGroup The group to generate the report for. -- @param Core.Settings#SETTINGS Settings Message formatting settings to use. -- @return Core.Report#REPORT - function DETECTION_BASE:DetectedItemReportSummary( Index, AttackGroup, Settings ) + function DETECTION_BASE:DetectedItemReportSummary( DetectedItem, AttackGroup, Settings ) self:F( Index ) return nil end @@ -1764,7 +1767,7 @@ do -- DETECTION_BASE for RecceUnit, RecceUnit in pairs( RecceGroup:GetUnits() ) do if RecceUnit:IsActive() then local RecceUnitCoord = RecceUnit:GetCoordinate() - local Distance = RecceUnitCoord:Get2DDistance( self:GetDetectedItemCoordinate( DetectedItem.Index ) ) + local Distance = RecceUnitCoord:Get2DDistance( self:GetDetectedItemCoordinate( DetectedItem ) ) if Distance < DistanceRecce then DistanceRecce = Distance NearestRecce = RecceUnit @@ -1887,9 +1890,9 @@ do -- DETECTION_UNITS local DetectedUnit = DetectedUnitData -- Wrapper.Unit#UNIT local DetectedObject = nil - --self:E( DetectedUnit ) + --self:F( DetectedUnit ) if DetectedUnit:IsAlive() then - --self:E(DetectedUnit:GetName()) + --self:F(DetectedUnit:GetName()) DetectedObject = self:GetDetectedObject( DetectedUnit:GetName() ) end if DetectedObject then @@ -1928,7 +1931,7 @@ do -- DETECTION_UNITS if DetectedUnit then local DetectedTypeName = DetectedUnit:GetTypeName() - local DetectedItem = self:GetDetectedItem( DetectedUnitName ) + local DetectedItem = self:GetDetectedItemByKey( DetectedUnitName ) if not DetectedItem then self:T( "Added new DetectedItem" ) DetectedItem = self:AddDetectedItem( "UNIT", DetectedUnitName ) @@ -1960,54 +1963,24 @@ do -- DETECTION_UNITS self:SetDetectedItemCoordinate( DetectedItem, DetectedFirstUnitCoord, DetectedFirstUnit ) self:ReportFriendliesNearBy( { DetectedItem = DetectedItem, ReportSetGroup = self.DetectionSetGroup } ) -- Fill the Friendlies table + self:SetDetectedItemThreatLevel( DetectedItem ) self:NearestRecce( DetectedItem ) end end - --- Menu of a DetectedItem using a given numeric index. - -- @param #DETECTION_UNITS self - -- @param Index - -- @return #string - function DETECTION_UNITS:DetectedItemMenu( Index, AttackGroup ) - self:F( Index ) - - local DetectedItem = self:GetDetectedItem( Index ) - local DetectedSet = self:GetDetectedSet( Index ) - local DetectedItemID = self:GetDetectedItemID( Index ) - - self:T( DetectedSet ) - if DetectedSet then - local ReportSummary = "" - local UnitDistanceText = "" - local UnitCategoryText = "" - - local DetectedItemCoordinate = self:GetDetectedItemCoordinate( Index ) - local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup ) - - ReportSummary = string.format( - "%s - %s", - DetectedItemID, - DetectedItemCoordText - ) - self:T( ReportSummary ) - - return ReportSummary - end - end --- Report summary of a DetectedItem using a given numeric index. -- @param #DETECTION_UNITS self - -- @param Index + -- @param #DETECTION_BASE.DetectedItem DetectedItem The DetectedItem. -- @param Wrapper.Group#GROUP AttackGroup The group to generate the report for. -- @param Core.Settings#SETTINGS Settings Message formatting settings to use. -- @return Core.Report#REPORT The report of the detection items. - function DETECTION_UNITS:DetectedItemReportSummary( Index, AttackGroup, Settings ) - self:F( { Index, self.DetectedItems } ) + function DETECTION_UNITS:DetectedItemReportSummary( DetectedItem, AttackGroup, Settings ) + self:F( { DetectedItem = DetectedItem } ) - local DetectedItem = self:GetDetectedItem( Index ) - local DetectedItemID = self:GetDetectedItemID( Index ) + local DetectedItemID = self:GetDetectedItemID( DetectedItem ) if DetectedItem then local ReportSummary = "" @@ -2037,10 +2010,10 @@ do -- DETECTION_UNITS end --TODO: solve Index reference - local DetectedItemCoordinate = self:GetDetectedItemCoordinate( Index ) + local DetectedItemCoordinate = self:GetDetectedItemCoordinate( DetectedItem ) local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup, Settings ) - local ThreatLevelA2G = self:GetDetectedItemThreatLevel( Index ) + local ThreatLevelA2G = self:GetDetectedItemThreatLevel( DetectedItem ) local Report = REPORT:New() Report:Add(DetectedItemID .. ", " .. DetectedItemCoordText) @@ -2060,9 +2033,9 @@ do -- DETECTION_UNITS self:F() local Report = REPORT:New() - for DetectedItemID, DetectedItem in pairs( self.DetectedItems ) do + for DetectedItemIndex, DetectedItem in pairs( self.DetectedItems ) do local DetectedItem = DetectedItem -- #DETECTION_BASE.DetectedItem - local ReportSummary = self:DetectedItemReportSummary( DetectedItemID, AttackGroup ) + local ReportSummary = self:DetectedItemReportSummary( DetectedItem, AttackGroup ) Report:SetTitle( "Detected units:" ) Report:Add( ReportSummary:Text() ) end @@ -2165,7 +2138,7 @@ do -- DETECTION_TYPES local DetectedObject = nil if DetectedUnit:IsAlive() then - --self:E(DetectedUnit:GetName()) + --self:F(DetectedUnit:GetName()) DetectedObject = self:GetDetectedObject( DetectedUnit:GetName() ) end if DetectedObject then @@ -2192,10 +2165,10 @@ do -- DETECTION_TYPES if DetectedUnit then local DetectedTypeName = DetectedUnit:GetTypeName() - local DetectedItem = self:GetDetectedItem( DetectedTypeName ) + local DetectedItem = self:GetDetectedItemByKey( DetectedTypeName ) if not DetectedItem then DetectedItem = self:AddDetectedItem( "TYPE", DetectedTypeName ) - DetectedItem.TypeName = DetectedUnit:GetTypeName() + DetectedItem.TypeName = DetectedTypeName end DetectedItem.Set:AddUnit( DetectedUnit ) @@ -2218,6 +2191,7 @@ do -- DETECTION_TYPES self:SetDetectedItemCoordinate( DetectedItem, DetectedUnitCoord, DetectedFirstUnit ) self:ReportFriendliesNearBy( { DetectedItem = DetectedItem, ReportSetGroup = self.DetectionSetGroup } ) -- Fill the Friendlies table + self:SetDetectedItemThreatLevel( DetectedItem ) self:NearestRecce( DetectedItem ) end @@ -2225,53 +2199,26 @@ do -- DETECTION_TYPES end - --- Menu of a DetectedItem using a given numeric index. - -- @param #DETECTION_TYPES self - -- @param Index - -- @return #string - function DETECTION_TYPES:DetectedItemMenu( DetectedTypeName, AttackGroup ) - self:F( DetectedTypeName ) - - local DetectedItem = self:GetDetectedItem( DetectedTypeName ) - local DetectedItemID = self:GetDetectedItemID( DetectedTypeName ) - - if DetectedItem then - - local DetectedItemCoordinate = self:GetDetectedItemCoordinate( DetectedTypeName ) - local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup ) - - local ReportSummary = string.format( - "%s - %s", - DetectedItemID, - DetectedItemCoordText - ) - self:T( ReportSummary ) - - return ReportSummary - end - end - --- Report summary of a DetectedItem using a given numeric index. -- @param #DETECTION_TYPES self - -- @param Index + -- @param #DETECTION_BASE.DetectedItem DetectedItem The DetectedItem. -- @param Wrapper.Group#GROUP AttackGroup The group to generate the report for. -- @param Core.Settings#SETTINGS Settings Message formatting settings to use. -- @return Core.Report#REPORT The report of the detection items. - function DETECTION_TYPES:DetectedItemReportSummary( DetectedTypeName, AttackGroup, Settings ) - self:F( DetectedTypeName ) + function DETECTION_TYPES:DetectedItemReportSummary( DetectedItem, AttackGroup, Settings ) + self:F( { DetectedItem = DetectedItem } ) - local DetectedItem = self:GetDetectedItem( DetectedTypeName ) - local DetectedSet = self:GetDetectedSet( DetectedTypeName ) - local DetectedItemID = self:GetDetectedItemID( DetectedTypeName ) + local DetectedSet = self:GetDetectedSet( DetectedItem ) + local DetectedItemID = self:GetDetectedItemID( DetectedItem ) self:T( DetectedItem ) if DetectedItem then - local ThreatLevelA2G = self:GetDetectedItemThreatLevel( DetectedTypeName ) + local ThreatLevelA2G = self:GetDetectedItemThreatLevel( DetectedItem ) local DetectedItemsCount = DetectedSet:Count() local DetectedItemType = DetectedItem.TypeName - local DetectedItemCoordinate = self:GetDetectedItemCoordinate( DetectedTypeName ) + local DetectedItemCoordinate = self:GetDetectedItemCoordinate( DetectedItem ) local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup, Settings ) local Report = REPORT:New() @@ -2290,9 +2237,9 @@ do -- DETECTION_TYPES self:F() local Report = REPORT:New() - for DetectedItemTypeName, DetectedItem in pairs( self.DetectedItems ) do + for DetectedItemIndex, DetectedItem in pairs( self.DetectedItems ) do local DetectedItem = DetectedItem -- #DETECTION_BASE.DetectedItem - local ReportSummary = self:DetectedItemReportSummary( DetectedItemTypeName, AttackGroup ) + local ReportSummary = self:DetectedItemReportSummary( DetectedItem, AttackGroup ) Report:SetTitle( "Detected types:" ) Report:Add( ReportSummary:Text() ) end @@ -2371,57 +2318,26 @@ do -- DETECTION_AREAS end - --- Menu of a detected item using a given numeric index. - -- @param #DETECTION_AREAS self - -- @param Index - -- @return #string - function DETECTION_AREAS:DetectedItemMenu( Index, AttackGroup ) - self:F( Index ) - - local DetectedItem = self:GetDetectedItem( Index ) - local DetectedItemID = self:GetDetectedItemID( Index ) - - if DetectedItem then - local DetectedSet = self:GetDetectedSet( Index ) - local ReportSummaryItem - - local DetectedZone = self:GetDetectedItemZone( Index ) - local DetectedItemCoordinate = DetectedZone:GetCoordinate() - local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup ) - - local ReportSummary = string.format( - "%s - %s", - DetectedItemID, - DetectedItemCoordText - ) - - return ReportSummary - end - - return nil - end - --- Report summary of a detected item using a given numeric index. -- @param #DETECTION_AREAS self - -- @param Index + -- @param #DETECTION_BASE.DetectedItem DetectedItem The DetectedItem. -- @param Wrapper.Group#GROUP AttackGroup The group to get the settings for. -- @param Core.Settings#SETTINGS Settings (Optional) Message formatting settings to use. -- @return Core.Report#REPORT The report of the detection items. - function DETECTION_AREAS:DetectedItemReportSummary( Index, AttackGroup, Settings ) - self:F( Index ) + function DETECTION_AREAS:DetectedItemReportSummary( DetectedItem, AttackGroup, Settings ) + self:F( { DetectedItem = DetectedItem } ) - local DetectedItem = self:GetDetectedItem( Index ) - local DetectedItemID = self:GetDetectedItemID( Index ) + local DetectedItemID = self:GetDetectedItemID( DetectedItem ) if DetectedItem then - local DetectedSet = self:GetDetectedSet( Index ) + local DetectedSet = self:GetDetectedSet( DetectedItem ) local ReportSummaryItem - local DetectedZone = self:GetDetectedItemZone( Index ) + local DetectedZone = self:GetDetectedItemZone( DetectedItem ) local DetectedItemCoordinate = DetectedZone:GetCoordinate() local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup, Settings ) - local ThreatLevelA2G = self:GetDetectedItemThreatLevel( Index ) + local ThreatLevelA2G = self:GetDetectedItemThreatLevel( DetectedItem ) local DetectedItemsCount = DetectedSet:Count() local DetectedItemsTypes = DetectedSet:GetTypeNames() @@ -2446,7 +2362,7 @@ do -- DETECTION_AREAS local Report = REPORT:New() for DetectedItemIndex, DetectedItem in pairs( self.DetectedItems ) do local DetectedItem = DetectedItem -- #DETECTION_BASE.DetectedItem - local ReportSummary = self:DetectedItemReportSummary( DetectedItemIndex, AttackGroup ) + local ReportSummary = self:DetectedItemReportSummary( DetectedItem, AttackGroup ) Report:SetTitle( "Detected areas:" ) Report:Add( ReportSummary:Text() ) end @@ -2673,7 +2589,7 @@ do -- DETECTION_AREAS local DetectedObject = nil if DetectedUnit:IsAlive() then - --self:E(DetectedUnit:GetName()) + --self:F(DetectedUnit:GetName()) DetectedObject = self:GetDetectedObject( DetectedUnit:GetName() ) end if DetectedObject then @@ -2751,7 +2667,7 @@ do -- DETECTION_AREAS SET_UNIT:New():FilterDeads():FilterCrashes(), ZONE_UNIT:New( DetectedUnitName, DetectedUnit, self.DetectionZoneRange ) ) - --self:E( DetectedItem.Zone.ZoneUNIT.UnitName ) + --self:F( DetectedItem.Zone.ZoneUNIT.UnitName ) DetectedItem.Set:AddUnit( DetectedUnit ) self:AddChangeItem( DetectedItem, "AA", DetectedUnitTypeName ) end diff --git a/Moose Development/Moose/Functional/Escort.lua b/Moose Development/Moose/Functional/Escort.lua index f2a1e5d7b..c9b150a92 100644 --- a/Moose Development/Moose/Functional/Escort.lua +++ b/Moose Development/Moose/Functional/Escort.lua @@ -846,11 +846,11 @@ function _Resume( EscortGroup ) end --- @param #ESCORT self --- @param #number DetectedItemID -function ESCORT:_AttackTarget( DetectedItemID ) +-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem +function ESCORT:_AttackTarget( DetectedItem ) local EscortGroup = self.EscortGroup -- Wrapper.Group#GROUP - self:E( EscortGroup ) + self:F( EscortGroup ) local EscortClient = self.EscortClient @@ -861,7 +861,7 @@ function ESCORT:_AttackTarget( DetectedItemID ) EscortGroup:OptionROTPassiveDefense() EscortGroup:SetState( EscortGroup, "Escort", self ) - local DetectedSet = self.Detection:GetDetectedSet( DetectedItemID ) + local DetectedSet = self.Detection:GetDetectedSet( DetectedItem ) local Tasks = {} @@ -884,7 +884,7 @@ function ESCORT:_AttackTarget( DetectedItemID ) else - local DetectedSet = self.Detection:GetDetectedSet( DetectedItemID ) + local DetectedSet = self.Detection:GetDetectedSet( DetectedItem ) local Tasks = {} @@ -910,8 +910,9 @@ function ESCORT:_AttackTarget( DetectedItemID ) end --- --- @param #number DetectedItemID -function ESCORT:_AssistTarget( EscortGroupAttack, DetectedItemID ) +--- @param #ESCORT self +-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem +function ESCORT:_AssistTarget( EscortGroupAttack, DetectedItem ) local EscortGroup = self.EscortGroup local EscortClient = self.EscortClient @@ -922,7 +923,7 @@ function ESCORT:_AssistTarget( EscortGroupAttack, DetectedItemID ) EscortGroupAttack:OptionROEOpenFire() EscortGroupAttack:OptionROTVertical() - local DetectedSet = self.Detection:GetDetectedSet( DetectedItemID ) + local DetectedSet = self.Detection:GetDetectedSet( DetectedItem ) local Tasks = {} @@ -944,7 +945,7 @@ function ESCORT:_AssistTarget( EscortGroupAttack, DetectedItemID ) ) else - local DetectedSet = self.Detection:GetDetectedSet( DetectedItemID ) + local DetectedSet = self.Detection:GetDetectedSet( DetectedItem ) local Tasks = {} @@ -1151,7 +1152,7 @@ function ESCORT:_ReportTargetsScheduler() end local DetectedItems = self.Detection:GetDetectedItems() - self:E( DetectedItems ) + self:F( DetectedItems ) local DetectedTargets = false @@ -1162,11 +1163,11 @@ function ESCORT:_ReportTargetsScheduler() local ClientEscortTargets = EscortGroupData.Detection --local EscortUnit = EscortGroupData:GetUnit( 1 ) - for DetectedItemID, DetectedItem in pairs( DetectedItems ) do - self:E( { DetectedItemID, DetectedItem } ) + for DetectedItemIndex, DetectedItem in pairs( DetectedItems ) do + self:F( { DetectedItemIndex, DetectedItem } ) -- Remove the sub menus of the Attack menu of the Escort for the EscortGroup. - local DetectedItemReportSummary = self.Detection:DetectedItemReportSummary( DetectedItemID, EscortGroupData.EscortGroup, _DATABASE:GetPlayerSettings( self.EscortClient:GetPlayerName() ) ) + local DetectedItemReportSummary = self.Detection:DetectedItemReportSummary( DetectedItem, EscortGroupData.EscortGroup, _DATABASE:GetPlayerSettings( self.EscortClient:GetPlayerName() ) ) if ClientEscortGroupName == EscortGroupName then @@ -1180,7 +1181,7 @@ function ESCORT:_ReportTargetsScheduler() self.EscortMenuAttackNearbyTargets, ESCORT._AttackTarget, self, - DetectedItemID + DetectedItem ) else if self.EscortMenuTargetAssistance then @@ -1195,7 +1196,7 @@ function ESCORT:_ReportTargetsScheduler() ESCORT._AssistTarget, self, EscortGroupData.EscortGroup, - DetectedItemID + DetectedItem ) end end @@ -1204,7 +1205,7 @@ function ESCORT:_ReportTargetsScheduler() end end - self:E( DetectedMsgs ) + self:F( DetectedMsgs ) if DetectedTargets then self.EscortGroup:MessageToClient( "Reporting detected targets:\n" .. table.concat( DetectedMsgs, "\n" ), 20, self.EscortClient ) else diff --git a/Moose Development/Moose/Functional/MissileTrainer.lua b/Moose Development/Moose/Functional/MissileTrainer.lua index 2129b8477..fd3357855 100644 --- a/Moose Development/Moose/Functional/MissileTrainer.lua +++ b/Moose Development/Moose/Functional/MissileTrainer.lua @@ -177,13 +177,13 @@ function MISSILETRAINER:New( Distance, Briefing ) -- for ClientID, Client in pairs( self.DBClients.Database ) do --- self:E( "ForEach:" .. Client.UnitName ) +-- self:F( "ForEach:" .. Client.UnitName ) -- Client:Alive( self._Alive, self ) -- end -- self.DBClients:ForEachClient( function( Client ) - self:E( "ForEach:" .. Client.UnitName ) + self:F( "ForEach:" .. Client.UnitName ) Client:Alive( self._Alive, self ) end ) diff --git a/Moose Development/Moose/Functional/Protect.lua b/Moose Development/Moose/Functional/Protect.lua index 7b163ea2b..6fe73e54a 100644 --- a/Moose Development/Moose/Functional/Protect.lua +++ b/Moose Development/Moose/Functional/Protect.lua @@ -78,14 +78,14 @@ end function PROTECT:IsGuarded() local IsGuarded = self.ProtectZone:IsAllInZoneOfCoalition( self.Coalition ) - self:E( { IsGuarded = IsGuarded } ) + self:F( { IsGuarded = IsGuarded } ) return IsGuarded end function PROTECT:IsCaptured() local IsCaptured = self.ProtectZone:IsAllInZoneOfOtherCoalition( self.Coalition ) - self:E( { IsCaptured = IsCaptured } ) + self:F( { IsCaptured = IsCaptured } ) return IsCaptured end @@ -93,7 +93,7 @@ end function PROTECT:IsAttacked() local IsAttacked = self.ProtectZone:IsSomeInZoneOfCoalition( self.Coalition ) - self:E( { IsAttacked = IsAttacked } ) + self:F( { IsAttacked = IsAttacked } ) return IsAttacked end @@ -101,7 +101,7 @@ end function PROTECT:IsEmpty() local IsEmpty = self.ProtectZone:IsNoneInZone() - self:E( { IsEmpty = IsEmpty } ) + self:F( { IsEmpty = IsEmpty } ) return IsEmpty end @@ -158,7 +158,7 @@ function PROTECT:IsCaptureUnitInZone() local IsInZone = self.CaptureUnitSet:IsPartiallyInZone( self.ProtectZone ) - self:E({IsInZone = IsInZone}) + self:F({IsInZone = IsInZone}) return IsInZone end @@ -189,7 +189,7 @@ function PROTECT:Mark() local State = self:GetState() if self.MarkRed and self.MarkBlue then - self:E( { MarkRed = self.MarkRed, MarkBlue = self.MarkBlue } ) + self:F( { MarkRed = self.MarkRed, MarkBlue = self.MarkBlue } ) Coord:RemoveMark( self.MarkRed ) Coord:RemoveMark( self.MarkBlue ) end @@ -231,7 +231,7 @@ end function PROTECT:onenterCaptured() local NewCoalition = self.ProtectZone:GetCoalition() - self:E( { NewCoalition = NewCoalition } ) + self:F( { NewCoalition = NewCoalition } ) self:SetCoalition( NewCoalition ) self:Mark() @@ -254,7 +254,7 @@ end -- @param #PROTECT self function PROTECT:StatusCoalition() - self:E( { State = self:GetState() } ) + self:F( { State = self:GetState() } ) self.ProtectZone:Scan() @@ -271,7 +271,7 @@ end -- @param #PROTECT self function PROTECT:StatusZone() - self:E( { State = self:GetState() } ) + self:F( { State = self:GetState() } ) self.ProtectZone:Scan() diff --git a/Moose Development/Moose/Functional/Range.lua b/Moose Development/Moose/Functional/Range.lua new file mode 100644 index 000000000..e167bd7c9 --- /dev/null +++ b/Moose Development/Moose/Functional/Range.lua @@ -0,0 +1,1907 @@ +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--- **Functional** - Range Practice. +-- +-- ![Banner Image](..\Presentations\RANGE\RANGE_Main.png) +-- +-- ==== +-- +-- The RANGE class enables easy set up of bombing and strafing ranges within DCS World. +-- +-- Implementation is based on the [Simple Range Script](https://forums.eagle.ru/showthread.php?t=157991) by [Ciribob](https://forums.eagle.ru/member.php?u=112175), which itself was motivated +-- by a script by SNAFU [see here](https://forums.eagle.ru/showthread.php?t=109174). +-- +-- ## Features +-- +-- * Bomb and rocket impact point from closest range target is measured and distance reported to the player. +-- * Number of hits on strafing passes are counted. +-- * Results of all bombing and strafing runs are stored and top 10 results can be displayed. +-- * Range targets can be marked by smoke. +-- * Range can be illuminated by illumination bombs for night practices. +-- * Rocket or bomb impact points can be marked by smoke. +-- * Direct hits on targets can trigger flares. +-- * Smoke and flare colors can be adjusted for each player via radio menu. +-- * Range information and weather report at the range can be reported via radio menu. +-- +-- More information and examples can be found below. +-- +-- ==== +-- +-- # Demo Missions +-- +-- ### [ALL Demo Missions pack of the last release](https://github.com/FlightControl-Master/MOOSE_MISSIONS/releases) +-- +-- ==== +-- +-- # YouTube Channel +-- +-- ### [MOOSE YouTube Channel](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl1jirWIo4t4YxqN-HxjqRkL) +-- +-- === +-- +-- ### Author: **[funkyfranky](https://forums.eagle.ru/member.php?u=115026)** +-- +-- ### Contributions: [FlightControl](https://forums.eagle.ru/member.php?u=89536), [Ciribob](https://forums.eagle.ru/member.php?u=112175) +-- +-- ==== +-- @module Range + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--- RANGE class +-- @type RANGE +-- @field #string ClassName Name of the Class. +-- @field #boolean Debug If true, debug info is send as messages on the screen. +-- @field #string rangename Name of the range. +-- @field Core.Point#COORDINATE location Coordinate of the range. +-- @field #number rangeradius Radius of range defining its total size for e.g. smoking bomb impact points. Default 10 km. +-- @field #table strafeTargets Table of strafing targets. +-- @field #table bombingTargets Table of targets to bomb. +-- @field #number nbombtargets Number of bombing targets. +-- @field #number nstrafetargets Number of strafing targets. +-- @field #table MenuAddedTo Table for monitoring which players already got an F10 menu. +-- @field #table planes Table for administration. +-- @field #table strafeStatus Table containing the current strafing target a player as assigned to. +-- @field #table strafePlayerResults Table containing the strafing results of each player. +-- @field #table bombPlayerResults Table containing the bombing results of each player. +-- @field #table PlayerSettings Indiviual player settings. +-- @field #number dtBombtrack Time step [sec] used for tracking released bomb/rocket positions. Default 0.005 seconds. +-- @field #number Tmsg Time [sec] messages to players are displayed. Default 30 sec. +-- @field #number strafemaxalt Maximum altitude above ground for registering for a strafe run. Default is 914 m = 3000 ft. +-- @field #number ndisplayresult Number of (player) results that a displayed. Default is 10. +-- @field Utilities.Utils#SMOKECOLOR BombSmokeColor Color id used for smoking bomb targets. +-- @field Utilities.Utils#SMOKECOLOR StrafeSmokeColor Color id used to smoke strafe targets. +-- @field Utilities.Utils#SMOKECOLOR StrafePitSmokeColor Color id used to smoke strafe pit approach boxes. +-- @field #number illuminationminalt Minimum altitude AGL in meters at which illumination bombs are fired. Default is 500 m. +-- @field #number illuminationmaxalt Maximum altitude AGL in meters at which illumination bombs are fired. Default is 1000 m. +-- @field #number scorebombdistance Distance from closest target up to which bomb hits are counted. Default 1000 m. +-- @field #number TdelaySmoke Time delay in seconds between impact of bomb and starting the smoke. Default 3 seconds. +-- @field #boolean eventmoose If true, events are handled by MOOSE. If false, events are handled directly by DCS eventhandler. Default true. +-- @extends Core.Base#BASE + +---# RANGE class, extends @{Base#BASE} +-- The RANGE class enables a mission designer to easily set up practice ranges in DCS. A new RANGE object can be created with the @{#RANGE.New}(rangename) contructor. +-- The parameter "rangename" defindes the name of the range. It has to be unique since this is also the name displayed in the radio menu. +-- +-- Generally, a range consits of strafe pits and bombing targets. For strafe pits the number of hits for each pass is counted and tabulated. +-- For bombing targets, the distance from the impact point of the bomb or rocket to the closest range target is measured and tabulated. +-- Each player can display his best results via a function in the radio menu or see the best best results from all players. +-- +-- When all targets have been defined in the script, the range is started by the @{#RANGE.Start}() command. +-- +-- **IMPORTANT** +-- +-- Due to a DCS bug, it is not possible to directly monitor when a player enters a plane. So in a mission with client slots, it is vital that +-- a player first enters as spector and **after that** jumps into the slot of his aircraft! +-- If that is not done, the script is not started correctly. This can be checked by looking at the radio menues. If the mission was entered correctly, +-- there should be an "On the Range" menu items in the "F10. Other..." menu. +-- +-- ## Strafe Pits +-- Each strafe pit can consist of multiple targets. Often one findes two or three strafe targets next to each other. +-- +-- A strafe pit can be added to the range by the @{#RANGE.AddStrafepit}(unitnames, boxlength, boxwidth, heading, inverseheading, goodpass, foulline) function. +-- +-- The first parameter defines the target. This has to be given as a lua table which contains the unit names of the targets as defined in the mission editor. +-- +-- In order to perform a valid pass on the strafe pit, the pilot has to begin his run from the correct direction. Therefore, an "approach box" is defined in front +-- of the strafe targets. The parameters "boxlength" and "boxwidth" define the size of the box while the parameter "heading" defines its direction. +-- If the parameter heading is passed as **nil**, the heading is automatically taken from the heading of the first target unit as defined in the ME. +-- The parameter "inverseheading" turns the heading around by 180 degrees. This is sometimes useful, since the default heading of strafe target units point in the +-- wrong/opposite direction. +-- +-- The parameter "goodpass" defines the number of hits a pilot has to achive during a run to be judges as a good pass. +-- +-- The last parameter "foulline" sets the distance from the pit targets to the foul line. Hit from closer than this line are not counted. +-- +-- Finally, a valid approach has to be performed below a certain maximum altitude. The default is 914 meters (3000 ft) AGL. This is a parameter valid for all +-- strafing pits of the range and can be adjusted by the @{#RANGE.SetMaxStrafeAlt}(maxalt) function. +-- +-- ## Bombing targets +-- One ore multiple bombing targets can be added to the range by the @{#RANGE.AddBombingTargets}(unitnames goodhitrange,static) function. +-- +-- The first parameter "unitnames" has to be a lua table, which contains the names of the units as defined in the mission editor. +-- +-- The parameter "goodhitrange" specifies the radius around the target. If a bomb or rocket falls at a distance smaller than this number, the hit is considered to be "good". +-- +-- The final (optional) parameter "static" can be enabled (set to true) if static bomb targets are used rather than alive units. +-- +-- ## Fine Tuning +-- Many range parameters have good default values. However, the mission designer can change these settings easily with the supplied user functions: +-- +-- * @{#RANGE.SetMaxStrafeAlt}() sets the max altitude for valid strafing runs. +-- * @{#RANGE.SetMessageTimeDuration}() sets the duration how long (most) messages are displayed. +-- * @{#RANGE.SetDisplayedMaxPlayerResults}() sets the number of results displayed. +-- * @{#RANGE.SetRangeRadius}() defines the total range area. +-- * @{#RANGE.SetBombTargetSmokeColor}() sets the color used to smoke bombing targets. +-- * @{#RANGE.SetStrafeTargetSmokeColor}() sets the color used to smoke strafe targets. +-- * @{#RANGE.SetStrafePitSmokeColor}() sets the color used to smoke strafe pit approach boxes. +-- * @{#RANGE.SetSmokeTimeDelay}() sets the time delay between smoking bomb/rocket impact points after impact. +-- +-- ## Radio Menu +-- Each range gets a radio menu with various submenus where each player can adjust his individual settings or request information about the range or his scores. +-- +-- The main range menu can be found at "F10. Other..." --> "Fxx. On the Range..." --> "F1. Your Range Name...". +-- +-- The range menu contains the following submenues: +-- +-- * "F1. Mark Targets": Various ways to mark targets. +-- * "F2. My Settings": Player specific settings. +-- * "F3. Stats" Player: statistics and scores. +-- * "Range Information": Information about the range, such as bearing and range. Also range and player specific settings are displayed. +-- * "Weather Report": Temperatur, wind and QFE pressure information is provided. +-- +-- ## Examples +-- +-- ### Goldwater Range +-- This example shows hot to set up the Barry M. Goldwater range. It consists of two strafe pits each has two targets plus three bombing targets. +-- +-- -- Strafe pits. Each pit can consist of multiple targets. Here we have two pits and each of the pits has two targets. These are names of the corresponding units defined in the ME. +-- local strafepit_left={"GWR Strafe Pit Left 1", "GWR Strafe Pit Left 2"} +-- local strafepit_right={"GWR Strafe Pit Right 1", "GWR Strafe Pit Right 2"} +-- +-- -- Table of bombing target names. Again these are the names of the corresponding units as defined in the ME. +-- local bombtargets={"GWR Bomb Target Circle Left", "GWR Bomb Target Circle Right", "GWR Bomb Target Hard"} +-- +-- -- Create a range object. +-- local GoldwaterRange=RANGE:New("Goldwater Range") +-- +-- -- Distance between foul line and strafe target. Note that this could also be done manually by simply measuring the distance between the target and the foul line in the ME. +-- local strafe=UNIT:FindByName("GWR Strafe Pit Left 1") +-- local foul=UNIT:FindByName("GWR Foul Line Left") +-- local fouldist=strafe:GetCoordinate():Get2DDistance(foul:GetCoordinate()) +-- +-- -- Add strafe pits. Each pit (left and right) consists of two targets. +-- GoldwaterRange:AddStrafePit(strafepit_left, 3000, 300, nil, true, 20, fouldist) +-- GoldwaterRange:AddStrafePit(strafepit_right, 3000, 300, nil, true, 20, fouldist) +-- +-- -- Add bombing targets. A good hit is if the bomb falls less then 50 m from the target. +-- GoldwaterRange:AddBombingTargets(bombtargets, 50) +-- +-- -- Start range. +-- GoldwaterRange:Start() +-- +-- +-- +-- @field #RANGE +RANGE={ + ClassName = "RANGE", + Debug=false, + rangename=nil, + location=nil, + rangeradius=10000, + strafeTargets={}, + bombingTargets={}, + nbombtargets=0, + nstrafetargets=0, + MenuAddedTo = {}, + planes = {}, + strafeStatus = {}, + strafePlayerResults = {}, + bombPlayerResults = {}, + PlayerSettings = {}, + dtBombtrack=0.005, + Tmsg=30, + strafemaxalt=914, + ndisplayresult=10, + BombSmokeColor=SMOKECOLOR.Red, + StrafeSmokeColor=SMOKECOLOR.Green, + StrafePitSmokeColor=SMOKECOLOR.White, + illuminationminalt=500, + illuminationmaxalt=1000, + scorebombdistance=1000, + TdelaySmoke=3.0, + eventmoose=true, +} + +--- Some ID to identify who we are in output of the DCS.log file. +-- @field #string id +RANGE.id="RANGE | " + +--- Range script version. +-- @field #number version +RANGE.version="1.0.0" + +--TODO list +--TODO: Add statics for strafe pits. +--DONE: Convert env.info() to self:T() +--DONE: Add user functions. +--DONE: Rename private functions, i.e. start with _functionname. +--DONE: number of displayed results variable. +--DONE: Add tire option for strafe pits. ==> No really feasible since tires are very small and cannot be seen. +--DONE: Check that menu texts are short enough to be correctly displayed in VR. + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +--- RANGE contructor. Creates a new RANGE object. +-- @param #RANGE self +-- @param #string rangename Name of the range. Has to be unique. Will we used to create F10 menu items etc. +-- @return #RANGE RANGE object. +function RANGE:New(rangename) + BASE:F({rangename=rangename}) + + -- Inherit BASE. + local self=BASE:Inherit(self, BASE:New()) -- #RANGE + + -- Get range name. + self.rangename=rangename or "Practice Range" + + -- Debug info. + local text=string.format("RANGE script version %s. Creating new RANGE object. Range name: %s.", RANGE.version, self.rangename) + self:E(RANGE.id..text) + MESSAGE:New(text, 10):ToAllIf(self.Debug) + + -- Return object. + return self +end + +--- Initializes number of targets and location of the range. Starts the event handlers. +-- @param #RANGE self +function RANGE:Start() + self:F() + + -- Location/coordinate of range. + local _location=nil + + -- Count bomb targets. + local _count=0 + for _,_target in pairs(self.bombingTargets) do + _count=_count+1 + --_target.name + if _location==nil then + _location=_target.point --Core.Point#COORDINATE + end + end + self.nbombtargets=_count + + -- Count strafing targets. + _count=0 + for _,_target in pairs(self.strafeTargets) do + _count=_count+1 + for _,_unit in pairs(_target.targets) do + if _location==nil then + _location=_unit:GetCoordinate() + end + end + end + self.nstrafetargets=_count + + -- Location of the range. We simply take the first unit/target we find. + self.location=_location + + if self.location==nil then + local text=string.format("ERROR! No range location found. Number of strafe targets = %d. Number of bomb targets = %d.", self.rangename, self.nstrafetargets, self.nbombtargets) + self:E(RANGE.id..text) + return nil + end + + -- Starting range. + local text=string.format("Starting RANGE %s. Number of strafe targets = %d. Number of bomb targets = %d.", self.rangename, self.nstrafetargets, self.nbombtargets) + self:E(RANGE.id..text) + MESSAGE:New(text,10):ToAllIf(self.Debug) + + -- Event handling. + if self.eventmoose then + -- Events are handled my MOOSE. + self:T(RANGE.id.."Events are handled by MOOSE.") + self:HandleEvent(EVENTS.Birth, self._OnBirth) + self:HandleEvent(EVENTS.Hit, self._OnHit) + self:HandleEvent(EVENTS.Shot, self._OnShot) + else + -- Events are handled directly by DCS. + self:T(RANGE.id.."Events are handled directly by DCS.") + world.addEventHandler(self) + end + +end + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +-- User Functions + +--- Set maximal strafing altitude. Player entering a strafe pit above that altitude are not registered for a valid pass. +-- @param #RANGE self +-- @param #number maxalt Maximum altitude AGL in meters. Default is 914 m= 3000 ft. +function RANGE:SetMaxStrafeAlt(maxalt) + self.strafemaxalt=maxalt or 914 +end + +--- Set time interval for tracking bombs. A smaller time step increases accuracy but needs more CPU time. +-- @param #RANGE self +-- @param #number dt Time interval in seconds. Default is 0.005 s. +function RANGE:SetBombtrackTimestep(dt) + self.dtBombtrack=dt or 0.005 +end + +--- Set time how long (most) messages are displayed. +-- @param #RANGE self +-- @param #number time Time in seconds. Default is 30 s. +function RANGE:SetMessageTimeDuration(time) + self.Tmsg=time or 30 +end + +--- Set max number of player results that are displayed. +-- @param #RANGE self +-- @param #number nmax Number of results. Default is 10. +function RANGE:SetDisplayedMaxPlayerResults(nmax) + self.ndisplayresult=nmax or 10 +end + +--- Set range radius. Defines the area in which e.g. bomb impacts are smoked. +-- @param #RANGE self +-- @param #number radius Radius in km. Default 10 km. +function RANGE:SetRangeRadius(radius) + self.rangeradius=radius*1000 or 10000 +end + +--- Set smoke color for marking bomb targets. By default bomb targets are marked by red smoke. +-- @param #RANGE self +-- @param Utilities.Utils#SMOKECOLOR colorid Color id. Default SMOKECOLOR.Red. +function RANGE:SetBombTargetSmokeColor(colorid) + self.BombSmokeColor=colorid or SMOKECOLOR.Red +end + +--- Set smoke color for marking strafe targets. By default strafe targets are marked by green smoke. +-- @param #RANGE self +-- @param Utilities.Utils#SMOKECOLOR colorid Color id. Default SMOKECOLOR.Green. +function RANGE:SetStrafeTargetSmokeColor(colorid) + self.StrafeSmokeColor=colorid or SMOKECOLOR.Green +end + +--- Set smoke color for marking strafe pit approach boxes. By default strafe pit boxes are marked by white smoke. +-- @param #RANGE self +-- @param Utilities.Utils#SMOKECOLOR colorid Color id. Default SMOKECOLOR.White. +function RANGE:SetStrafePitSmokeColor(colorid) + self.StrafePitSmokeColor=colorid or SMOKECOLOR.White +end + +--- Set time delay between bomb impact and starting to smoke the impact point. +-- @param #RANGE self +-- @param #number delay Time delay in seconds. Default is 3 seconds. +function RANGE:SetSmokeTimeDelay(delay) + self.TdelaySmoke=delay or 3.0 +end + +--- Enable debug modus. +-- @param #RANGE self +function RANGE:DebugON() + self.Debug=true +end + +--- Disable debug modus. +-- @param #RANGE self +function RANGE:DebugOFF() + self.Debug=false +end + + +--- Add new strafe pit. For a strafe pit, hits from guns are counted. One pit can consist of several units. +-- Note, an approach is only valid, if the player enters via a zone in front of the pit, which defined by boxlength and boxheading. +-- Furthermore, the player must not be too high and fly in the direction of the pit to make a valid target apporoach. +-- @param #RANGE self +-- @param #table unitnames Table of unit names defining the strafe targets. The first target in the list determines the approach zone (heading and box). +-- @param #number boxlength (Optional) Length of the approach box in meters. Default is 3000 m. +-- @param #number boxwidth (Optional) Width of the approach box in meters. Default is 300 m. +-- @param #number heading (Optional) Approach heading in Degrees. Default is heading of the unit as defined in the mission editor. +-- @param #boolean inverseheading (Optional) Take inverse heading (heading --> heading - 180 Degrees). Default is false. +-- @param #number goodpass (Optional) Number of hits for a "good" strafing pass. Default is 20. +-- @param #number foulline (Optional) Foul line distance. Hits from closer than this distance are not counted. Default 610 m = 2000 ft. Set to 0 for no foul line. +function RANGE:AddStrafePit(unitnames, boxlength, boxwidth, heading, inverseheading, goodpass, foulline) + self:F({unitnames=unitnames, boxlength=boxlength, boxwidth=boxwidth, heading=heading, inverseheading=inverseheading, goodpass=goodpass, foulline=foulline}) + + -- Create table if necessary. + if type(unitnames) ~= "table" then + unitnames={unitnames} + end + + -- Make targets + local _targets={} + local center=nil --Wrapper.Unit#UNIT + local ntargets=0 + + for _i,_name in ipairs(unitnames) do + + self:T(RANGE.id..string.format("Adding strafe target #%d %s", _i, _name)) + local unit=UNIT:FindByName(_name) + + if unit then + table.insert(_targets, unit) + -- Define center as the first unit we find + if center==nil then + center=unit + end + ntargets=ntargets+1 + else + local text=string.format("ERROR! Could not find strafe target with name %s.", _name) + self:E(RANGE.id..text) + MESSAGE:New(text, 10):ToAllIf(self.Debug) + end + + end + + -- Approach box dimensions. + local l=boxlength or 3000 + local w=(boxwidth or 300)/2 + + -- Heading: either manually entered or automatically taken from unit heading. + local heading=heading or center:GetHeading() + + -- Invert the heading since some units point in the "wrong" direction. In particular the strafe pit from 476th range objects. + if inverseheading ~= nil then + if inverseheading then + heading=heading-180 + end + end + if heading<0 then + heading=heading+360 + end + if heading>360 then + heading=heading-360 + end + + -- Number of hits called a "good" pass. + local goodpass=goodpass or 20 + + -- Foule line distance. + local foulline=foulline or 610 + + -- Coordinate of the range. + local Ccenter=center:GetCoordinate() + + -- Name of the target defined as its unit name. + local _name=center:GetName() + + -- Points defining the approach area. + local p={} + p[#p+1]=Ccenter:Translate( w, heading+90) + p[#p+1]= p[#p]:Translate( l, heading) + p[#p+1]= p[#p]:Translate(2*w, heading-90) + p[#p+1]= p[#p]:Translate( -l, heading) + + local pv2={} + for i,p in ipairs(p) do + pv2[i]={x=p.x, y=p.z} + end + + -- Create polygon zone. + local _polygon=ZONE_POLYGON_BASE:New(_name, pv2) + + -- Create tires + --_polygon:BoundZone() + + -- Add zone to table. + table.insert(self.strafeTargets, {name=_name, polygon=_polygon, goodPass=goodpass, targets=_targets, foulline=foulline, smokepoints=p, heading=heading}) + + -- Debug info + local text=string.format("Adding new strafe target %s with %d targets: heading = %03d, box_L = %.1f, box_W = %.1f, goodpass = %d, foul line = %.1f", _name, ntargets, heading, boxlength, boxwidth, goodpass, foulline) + self:T(RANGE.id..text) + MESSAGE:New(text, 5):ToAllIf(self.Debug) +end + +--- Add bombing target(s) to range. +-- @param #RANGE self +-- @param #table unitnames Table containing the unit names acting as bomb targets. +-- @param #number goodhitrange (Optional) Max distance from target unit (in meters) which is considered as a good hit. Default is 25 m. +-- @param #boolean static (Optional) Target is static. Default false. +function RANGE:AddBombingTargets(unitnames, goodhitrange, static) + self:F({unitnames=unitnames, goodhitrange=goodhitrange, static=static}) + + -- Create a table if necessary. + if type(unitnames) ~= "table" then + unitnames={unitnames} + end + + if static == nil or static == false then + static=false + else + static=true + end + + -- Default range is 25 m. + goodhitrange=goodhitrange or 25 + + for _,name in pairs(unitnames) do + local _unit + local _static + + if static then + + -- Add static object. Workaround since cargo objects are not yet in database because DCS function does not add those. + local _DCSstatic=StaticObject.getByName(name) + if _DCSstatic and _DCSstatic:isExist() then + self:T(RANGE.id..string.format("Adding DCS static to database. Name = %s.", name)) + _DATABASE:AddStatic(name) + else + self:E(RANGE.id..string.format("ERROR! DCS static DOES NOT exist! Name = %s.", name)) + end + + -- Now we can find it... + _static=STATIC:FindByName(name) + if _static then + self:AddBombingTargetUnit(_static, goodhitrange) + self:T(RANGE.id..string.format("Adding static bombing target %s with hit range %d.", name, goodhitrange)) + else + self:E(RANGE.id..string.format("ERROR! Cound not find static bombing target %s.", name)) + end + + else + + _unit=UNIT:FindByName(name) + if _unit then + self:AddBombingTargetUnit(_unit, goodhitrange) + self:T(RANGE.id..string.format("Adding bombing target %s with hit range %d.", name, goodhitrange)) + else + self:E(RANGE.id..string.fromat("ERROR! Could not find bombing target %s.", name)) + end + + end + + end +end + +--- Add a unit as bombing target. +-- @param #RANGE self +-- @param Wrapper.Unit#UNIT unit Unit of the strafe target. +-- @param #number goodhitrange Max distance from unit which is considered as a good hit. +function RANGE:AddBombingTargetUnit(unit, goodhitrange) + self:F({unit=unit, goodhitrange=goodhitrange}) + + local coord=unit:GetCoordinate() + local name=unit:GetName() + + -- Default range is 25 m. + goodhitrange=goodhitrange or 25 + + -- Create a zone around the unit. + local Vec2=coord:GetVec2() + local Rzone=ZONE_RADIUS:New(name, Vec2, goodhitrange) + + -- Insert target to table. + table.insert(self.bombingTargets, {name=name, point=coord, zone=Rzone, target=unit, goodhitrange=goodhitrange}) +end + + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +-- Event Handling + +--- General event handler. +-- @param #RANGE self +-- @param #table Event DCS event table. +function RANGE:onEvent(Event) + self:F3(Event) + + if Event == nil or Event.initiator == nil or Unit.getByName(Event.initiator:getName()) == nil then + return true + end + + local DCSiniunit = Event.initiator + local DCStgtunit = Event.target + local DCSweapon = Event.weapon + + local EventData={} + local _playerunit=nil + local _playername=nil + + if Event.initiator then + EventData.IniUnitName = Event.initiator:getName() + EventData.IniDCSGroup = Event.initiator:getGroup() + EventData.IniGroupName = Event.initiator:getGroup():getName() + -- Get player unit and name. This returns nil,nil if the event was not fired by a player unit. And these are the only events we are interested in. + _playerunit, _playername = self:_GetPlayerUnitAndName(EventData.IniUnitName) + end + + if Event.target then + EventData.TgtUnitName = Event.target:getName() + EventData.TgtDCSGroup = Event.target:getGroup() + EventData.TgtGroupName = Event.target:getGroup():getName() + EventData.TgtGroup = GROUP:FindByName(EventData.TgtGroupName) + EventData.TgtUnit = UNIT:FindByName(EventData.TgtUnitName) + end + + if Event.weapon then + EventData.Weapon = Event.weapon + EventData.weapon = Event.weapon + EventData.WeaponTypeName = Event.weapon:getTypeName() + end + + -- Event info. + self:T3(RANGE.id..string.format("EVENT: Event in onEvent with ID = %s", tostring(Event.id))) + self:T3(RANGE.id..string.format("EVENT: Ini unit = %s" , tostring(EventData.IniUnitName))) + self:T3(RANGE.id..string.format("EVENT: Ini group = %s" , tostring(EventData.IniGroupName))) + self:T3(RANGE.id..string.format("EVENT: Ini player = %s" , tostring(_playername))) + self:T3(RANGE.id..string.format("EVENT: Tgt unit = %s" , tostring(EventData.TgtUnitName))) + self:T3(RANGE.id..string.format("EVENT: Tgt group = %s" , tostring(EventData.IniGroupName))) + self:T3(RANGE.id..string.format("EVENT: Wpn type = %s" , tostring(EventData.WeapoinTypeName))) + + -- Call event Birth function. + if Event.id==world.event.S_EVENT_BIRTH and _playername then + self:_OnBirth(EventData) + end + + -- Call event Shot function. + if Event.id==world.event.S_EVENT_SHOT and _playername and Event.weapon then + self:_OnShot(EventData) + end + + -- Call event Hit function. + if Event.id==world.event.S_EVENT_HIT and _playername and DCStgtunit then + self:_OnHit(EventData) + end + +end + + +--- Range event handler for event birth. +-- @param #RANGE self +-- @param Core.Event#EVENTDATA EventData +function RANGE:_OnBirth(EventData) + self:F({eventbirth = EventData}) + + local _unitName=EventData.IniUnitName + local _unit, _playername=self:_GetPlayerUnitAndName(_unitName) + + self:T3(RANGE.id.."BIRTH: unit = "..tostring(EventData.IniUnitName)) + self:T3(RANGE.id.."BIRTH: group = "..tostring(EventData.IniGroupName)) + self:T3(RANGE.id.."BIRTH: player = "..tostring(_playername)) + + if _unit and _playername then + + local _uid=_unit:GetID() + local _group=_unit:GetGroup() + local _gid=_group:GetID() + local _callsign=_unit:GetCallsign() + + -- Debug output. + local text=string.format("Player %s, callsign %s entered unit %s (UID %d) of group %s (GID %d)", _playername, _callsign, _unitName, _uid, _group:GetName(), _gid) + self:T(RANGE.id..text) + MESSAGE:New(text, 5):ToAllIf(self.Debug) + + -- Reset current strafe status. + self.strafeStatus[_uid] = nil + + -- Add Menu commands. + self:_AddF10Commands(_unitName) + + -- By default, some bomb impact points and do not flare each hit on target. + self.PlayerSettings[_playername]={} + self.PlayerSettings[_playername].smokebombimpact=true + self.PlayerSettings[_playername].flaredirecthits=false + self.PlayerSettings[_playername].smokecolor=SMOKECOLOR.Blue + self.PlayerSettings[_playername].flarecolor=FLARECOLOR.Red + self.PlayerSettings[_playername].delaysmoke=true + + -- Start check in zone timer. + if self.planes[_uid] ~= true then + SCHEDULER:New(nil, self._CheckInZone, {self, EventData.IniUnitName}, 1, 1) + self.planes[_uid] = true + end + + end +end + +--- Range event handler for event hit. +-- @param #RANGE self +-- @param Core.Event#EVENTDATA EventData +function RANGE:_OnHit(EventData) + self:F({eventhit = EventData}) + + -- Player info + local _unitName = EventData.IniUnitName + local _unit, _playername = self:_GetPlayerUnitAndName(_unitName) + local _unitID = _unit:GetID() + + -- Target + local target = EventData.TgtUnit + local targetname = EventData.TgtUnitName + + -- Debug info. + self:T3(RANGE.id.."HIT: Ini unit = "..tostring(EventData.IniUnitName)) + self:T3(RANGE.id.."HIT: Ini group = "..tostring(EventData.IniGroupName)) + self:T3(RANGE.id.."HIT: Tgt target = "..tostring(EventData.TgtUnitName)) + self:T3(RANGE.id.."HIT: Tgt group = "..tostring(EventData.TgtGroupName)) + + -- Current strafe target of player. + local _currentTarget = self.strafeStatus[_unitID] + + -- Player has rolled in on a strafing target. + if _currentTarget then + + local playerPos = _unit:GetCoordinate() + local targetPos = target:GetCoordinate() + + -- Loop over valid targets for this run. + for _,_target in pairs(_currentTarget.zone.targets) do + + -- Check the the target is the same that was actually hit. + if _target:GetName() == targetname then + + -- Get distance between player and target. + local dist=playerPos:Get2DDistance(targetPos) + + if dist > _currentTarget.zone.foulline then + -- Increase hit counter of this run. + _currentTarget.hits = _currentTarget.hits + 1 + + -- Flare target. + if _unit and _playername and self.PlayerSettings[_playername].flaredirecthits then + targetPos:Flare(self.PlayerSettings[_playername].flarecolor) + end + else + -- Too close to the target. + if _currentTarget.pastfoulline==false and _unit and _playername then + local _d=_currentTarget.zone.foulline + local text=string.format("%s, Invalid hit!\nYou already passed foul line distance of %d m for target %s.", self:_myname(_unitName), _d, targetname) + self:_DisplayMessageToGroup(_unit, text, 10) + self:T2(RANGE.id..text) + _currentTarget.pastfoulline=true + end + end + + end + end + end + + -- Bombing Targets + for _,_target in pairs(self.bombingTargets) do + + -- Check if one of the bomb targets was hit. + if _target.name == targetname then + + if _unit and _playername then + + local playerPos = _unit:GetCoordinate() + local targetPos = target:GetCoordinate() + + -- Message to player. + --local text=string.format("%s, direct hit on target %s.", self:_myname(_unitName), targetname) + --self:DisplayMessageToGroup(_unit, text, 10, true) + + -- Flare target. + if self.PlayerSettings[_playername].flaredirecthits then + targetPos:Flare(self.PlayerSettings[_playername].flarecolor) + end + + end + end + end +end + +--- Range event handler for event shot (when a unit releases a rocket or bomb (but not a fast firing gun). +-- @param #RANGE self +-- @param Core.Event#EVENTDATA EventData +function RANGE:_OnShot(EventData) + self:F({eventshot = EventData}) + + -- Weapon data. + local _weapon = EventData.Weapon:getTypeName() -- should be the same as Event.WeaponTypeName + local _weaponStrArray = self:_split(_weapon,"%.") + local _weaponName = _weaponStrArray[#_weaponStrArray] + + -- Debug info. + self:T3(RANGE.id.."EVENT SHOT: Ini unit = "..EventData.IniUnitName) + self:T3(RANGE.id.."EVENT SHOT: Ini group = "..EventData.IniGroupName) + self:T3(RANGE.id.."EVENT SHOT: Weapon type = ".._weapon) + self:T3(RANGE.id.."EVENT SHOT: Weapon name = ".._weaponName) + + -- Monitor only bombs and rockets. + if (string.match(_weapon, "weapons.bombs") or string.match(_weapon, "weapons.nurs")) then + + -- Weapon + local _ordnance = EventData.weapon + + -- Tracking info and init of last bomb position. + self:T(RANGE.id..string.format("Tracking %s - %s.", _weapon, _ordnance:getName())) + + -- Init bomb position. + local _lastBombPos = {x=0,y=0,z=0} + + -- Get unit name. + local _unitName = EventData.IniUnitName + + -- Function monitoring the position of a bomb until impact. + local function trackBomb(_previousPos) + + -- Get player unit and name. + local _unit, _playername = self:_GetPlayerUnitAndName(_unitName) + local _callsign=self:_myname(_unitName) + + if _unit and _playername then + + -- When the pcall returns a failure the weapon has hit. + local _status,_bombPos = pcall( + function() + return _ordnance:getPoint() + end) + + if _status then + + -- Still in the air. Remember this position. + _lastBombPos = {x = _bombPos.x, y = _bombPos.y, z= _bombPos.z } + + -- Check again in 0.005 seconds. + return timer.getTime() + self.dtBombtrack + + else + + -- Bomb did hit the ground. + -- Get closet target to last position. + local _closetTarget = nil + local _distance = nil + local _hitquality = "POOR" + + -- Coordinate of impact point. + local impactcoord=COORDINATE:NewFromVec3(_lastBombPos) + + -- Distance from range. We dont want to smoke targets outside of the range. + local impactdist=impactcoord:Get2DDistance(self.location) + + -- Smoke impact point of bomb. + if self.PlayerSettings[_playername].smokebombimpact and impactdist b.hits end + table.sort(_results,_sort) + + -- Prepare message of best results. + local _bestMsg = "" + local _count = 1 + + -- Loop over results + for _,_result in pairs(_results) do + + -- Message text. + _message = _message..string.format("\n[%d] Hits %d - %s - %s", _count, _result.hits, _result.zone.name, _result.text) + + -- Best result. + if _bestMsg == "" then + _bestMsg = string.format("Hits %d - %s - %s", _result.hits, _result.zone.name, _result.text) + end + + -- 10 runs + if _count == self.ndisplayresult then + break + end + + -- Increase counter + _count = _count+1 + end + + -- Message text. + _message = _message .."\n\nBEST: ".._bestMsg + end + + -- Send message to group. + self:_DisplayMessageToGroup(_unit, _message, nil, true) + end +end + +--- Display top 10 strafing results of all players. +-- @param #RANGE self +-- @param #string _unitName Name fo the player unit. +function RANGE:_DisplayStrafePitResults(_unitName) + self:F(_unitName) + + -- Get player unit and name. + local _unit, _playername = self:_GetPlayerUnitAndName(_unitName) + + -- Check if we have a unit which is a player. + if _unit and _playername then + + -- Results table. + local _playerResults = {} + + -- Message text. + local _message = string.format("Strafe Pit Results - Top %d Players:\n", self.ndisplayresult) + + -- Loop over player results. + for _playerName,_results in pairs(self.strafePlayerResults) do + + -- Get the best result of the player. + local _best = nil + for _,_result in pairs(_results) do + if _best == nil or _result.hits > _best.hits then + _best = _result + end + end + + -- Add best result to table. + if _best ~= nil then + local text=string.format("%s: Hits %i - %s - %s", _playerName, _best.hits, _best.zone.name, _best.text) + table.insert(_playerResults,{msg = text, hits = _best.hits}) + end + + end + + --Sort list! + local _sort = function( a,b ) return a.hits > b.hits end + table.sort(_playerResults,_sort) + + -- Add top 10 results. + for _i = 1, math.min(#_playerResults, self.ndisplayresult) do + _message = _message..string.format("\n[%d] %s", _i, _playerResults[_i].msg) + end + + -- In case there are no scores yet. + if #_playerResults<1 then + _message = _message.."No player scored yet." + end + + -- Send message. + self:_DisplayMessageToGroup(_unit, _message, nil, true) + end +end + +--- Display top 10 bombing run results of specific player. +-- @param #RANGE self +-- @param #string _unitName Name of the player unit. +function RANGE:_DisplayMyBombingResults(_unitName) + self:F(_unitName) + + -- Get player unit and name. + local _unit, _playername = self:_GetPlayerUnitAndName(_unitName) + + if _unit and _playername then + + -- Init message. + local _message = string.format("My Top %d Bombing Results:\n", self.ndisplayresult) + + -- Results from player. + local _results = self.bombPlayerResults[_playername] + + -- No score so far. + if _results == nil then + _message = _playername..": No Score yet." + else + + -- Sort results wrt to distance. + local _sort = function( a,b ) return a.distance < b.distance end + table.sort(_results,_sort) + + -- Loop over results. + local _bestMsg = "" + local _count = 1 + for _,_result in pairs(_results) do + + -- Message with name, weapon and distance. + _message = _message.."\n"..string.format("[%d] %d m - %s - %s - %s hit", _count, _result.distance, _result.name, _result.weapon, _result.quality) + + -- Store best/first result. + if _bestMsg == "" then + _bestMsg = string.format("%d m - %s - %s - %s hit",_result.distance,_result.name,_result.weapon, _result.quality) + end + + -- Best 10 runs only. + if _count == self.ndisplayresult then + break + end + + -- Increase counter. + _count = _count+1 + end + + -- Message. + _message = _message .."\n\nBEST: ".._bestMsg + end + + -- Send message. + self:_DisplayMessageToGroup(_unit, _message, nil, true) + end +end + +--- Display best bombing results of top 10 players. +-- @param #RANGE self +-- @param #string _unitName Name of player unit. +function RANGE:_DisplayBombingResults(_unitName) + self:F(_unitName) + + -- Results table. + local _playerResults = {} + + -- Get player unit and name. + local _unit, _player = self:_GetPlayerUnitAndName(_unitName) + + -- Check if we have a unit with a player. + if _unit and _player then + + -- Message header. + local _message = string.format("Bombing Results - Top %d Players:\n", self.ndisplayresult) + + -- Loop over players. + for _playerName,_results in pairs(self.bombPlayerResults) do + + -- Find best result of player. + local _best = nil + for _,_result in pairs(_results) do + if _best == nil or _result.distance < _best.distance then + _best = _result + end + end + + -- Put best result of player into table. + if _best ~= nil then + local bestres=string.format("%s: %d m - %s - %s - %s hit", _playerName, _best.distance, _best.name, _best.weapon, _best.quality) + table.insert(_playerResults, {msg = bestres, distance = _best.distance}) + end + + end + + -- Sort list of player results. + local _sort = function( a,b ) return a.distance < b.distance end + table.sort(_playerResults,_sort) + + -- Loop over player results. + for _i = 1, math.min(#_playerResults, self.ndisplayresult) do + _message = _message..string.format("\n[%d] %s", _i, _playerResults[_i].msg) + end + + -- In case there are no scores yet. + if #_playerResults<1 then + _message = _message.."No player scored yet." + end + + -- Send message. + self:_DisplayMessageToGroup(_unit, _message, nil, true) + end +end + +--- Report information like bearing and range from player unit to range. +-- @param #RANGE self +-- @param #string _unitname Name of the player unit. +function RANGE:_DisplayRangeInfo(_unitname) + self:F(_unitname) + + -- Get player unit and player name. + local unit, playername = self:_GetPlayerUnitAndName(_unitname) + + -- Check if we have a player. + if unit and playername then + + -- Message text. + local text="" + + -- Current coordinates. + local coord=unit:GetCoordinate() + + if self.location then + + -- Direction vector from current position (coord) to target (position). + local position=self.location --Core.Point#COORDINATE + local rangealt=position:GetLandHeight() + local vec3=coord:GetDirectionVec3(position) + local angle=coord:GetAngleDegrees(vec3) + local range=coord:Get2DDistance(position) + + -- Bearing string. + local Bs=string.format('%03d°', angle) + + local texthit + if self.PlayerSettings[playername].flaredirecthits then + texthit=string.format("Flare direct hits: ON (flare color %s)\n", self:_flarecolor2text(self.PlayerSettings[playername].flarecolor)) + else + texthit=string.format("Flare direct hits: OFF\n") + end + local textbomb + if self.PlayerSettings[playername].smokebombimpact then + textbomb=string.format("Smoke bomb impact points: ON (smoke color %s)\n", self:_smokecolor2text(self.PlayerSettings[playername].smokecolor)) + else + textbomb=string.format("Smoke bomb impact points: OFF\n") + end + local textdelay + if self.PlayerSettings[playername].delaysmoke then + textdelay=string.format("Smoke bomb delay: ON (delay %.1f seconds)", self.TdelaySmoke) + else + textdelay=string.format("Smoke bomb delay: OFF") + end + + -- Player unit settings. + local settings=_DATABASE:GetPlayerSettings(playername) or _SETTINGS --Core.Settings#SETTINGS + local trange=string.format("%.1f km", range/1000) + local trangealt=string.format("%d m", rangealt) + local tstrafemaxalt=string.format("%d m", self.strafemaxalt) + if settings:IsImperial() then + trange=string.format("%.1f NM", UTILS.MetersToNM(range)) + trangealt=string.format("%d feet", UTILS.MetersToFeet(rangealt)) + tstrafemaxalt=string.format("%d feet", UTILS.MetersToFeet(self.strafemaxalt)) + end + + -- Message. + text=text..string.format("Information on %s:\n", self.rangename) + text=text..string.format("-------------------------------------------------------\n") + text=text..string.format("Bearing %s, Range %s\n", Bs, trange) + text=text..string.format("Altitude ASL: %s\n", trangealt) + text=text..string.format("Max strafing alt AGL: %s\n", tstrafemaxalt) + text=text..string.format("# of strafe targets: %d\n", self.nstrafetargets) + text=text..string.format("# of bomb targets: %d\n", self.nbombtargets) + text=text..texthit + text=text..textbomb + text=text..textdelay + + -- Send message to player group. + self:_DisplayMessageToGroup(unit, text, nil, true) + + -- Debug output. + self:T2(RANGE.id..text) + end + end +end + +--- Report weather conditions at range. Temperature, QFE pressure and wind data. +-- @param #RANGE self +-- @param #string _unitname Name of the player unit. +function RANGE:_DisplayRangeWeather(_unitname) + self:F(_unitname) + + -- Get player unit and player name. + local unit, playername = self:_GetPlayerUnitAndName(_unitname) + + -- Check if we have a player. + if unit and playername then + + -- Message text. + local text="" + + -- Current coordinates. + local coord=unit:GetCoordinate() + + if self.location then + + -- Get atmospheric data at range location. + local position=self.location --Core.Point#COORDINATE + local T=position:GetTemperature() + local P=position:GetPressure() + local Wd,Ws=position:GetWind() + + -- Get Beaufort wind scale. + local Bn,Bd=UTILS.BeaufortScale(Ws) + + local WD=string.format('%03d°', Wd) + local Ts=string.format("%d°C",T) + + local hPa2inHg=0.0295299830714 + local hPa2mmHg=0.7500615613030 + + local settings=_DATABASE:GetPlayerSettings(playername) or _SETTINGS --Core.Settings#SETTINGS + local tT=string.format("%d°C",T) + local tW=string.format("%.1f m/s", Ws) + local tP=string.format("%.1f mmHg", P*hPa2mmHg) + if settings:IsImperial() then + tT=string.format("%d°F", UTILS.CelciusToFarenheit(T)) + tW=string.format("%.1f knots", UTILS.MpsToKnots(Ws)) + tP=string.format("%.2f inHg", P*hPa2inHg) + end + + + -- Message text. + text=text..string.format("Weather Report at %s:\n", self.rangename) + text=text..string.format("--------------------------------------------------\n") + text=text..string.format("Temperature %s\n", tT) + text=text..string.format("Wind from %s at %s (%s)\n", WD, tW, Bd) + text=text..string.format("QFE %.1f hPa = %s", P, tP) + else + text=string.format("No range location defined for range %s.", self.rangename) + end + + -- Send message to player group. + self:_DisplayMessageToGroup(unit, text, nil, true) + + -- Debug output. + self:T2(RANGE.id..text) + else + self:T(RANGE.id..string.format("ERROR! Could not find player unit in RangeInfo! Name = %s", _unitname)) + end +end + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------- +-- Timer Functions + +--- Check if player is inside a strafing zone. If he is, we start looking for hits. If he was and left the zone again, the result is stored. +-- @param #RANGE self +-- @param #string _unitName Name of player unit. +function RANGE:_CheckInZone(_unitName) + self:F(_unitName) + + -- Get player unit and name. + local _unit, _playername = self:_GetPlayerUnitAndName(_unitName) + + if _unit and _playername then + + -- Current position of player unit. + local _unitID = _unit:GetID() + + -- Currently strafing? (strafeStatus is nil if not) + local _currentStrafeRun = self.strafeStatus[_unitID] + + if _currentStrafeRun then -- player has already registered for a strafing run. + + -- Get the current approach zone and check if player is inside. + local zone=_currentStrafeRun.zone.polygon --Core.Zone#ZONE_POLYGON_BASE + + local unitheading = _unit:GetHeading() + local pitheading = _currentStrafeRun.zone.heading - 180 + local deltaheading = unitheading-pitheading + local towardspit = math.abs(deltaheading)<=90 or math.abs(deltaheading-360)<=90 + local unitalt=_unit:GetHeight()-_unit:GetCoordinate():GetLandHeight() + + -- Check if unit is inside zone and below max height AGL. + local unitinzone=_unit:IsInZone(zone) and unitalt <= self.strafemaxalt and towardspit + + -- Debug output + local text=string.format("Checking stil in zone. Unit = %s, player = %s in zone = %s. alt = %d, delta heading = %d", _unitName, _playername, tostring(unitinzone), unitalt, deltaheading) + self:T(RANGE.id..text) + + -- Check if player is in strafe zone and below max alt. + if unitinzone then + + -- Still in zone, keep counting hits. Increase counter. + _currentStrafeRun.time = _currentStrafeRun.time+1 + + else + + -- Increase counter + _currentStrafeRun.time = _currentStrafeRun.time+1 + + if _currentStrafeRun.time <= 3 then + + -- Reset current run. + self.strafeStatus[_unitID] = nil + + -- Message text. + local _msg = string.format("%s left strafing zone %s too quickly. No Score.", _playername, _currentStrafeRun.zone.name) + + -- Send message. + self:_DisplayMessageToGroup(_unit, _msg, nil, true) + + else + + -- Result. + local _result = self.strafeStatus[_unitID] + + -- Judge this pass. Text is displayed on summary. + if _result.hits >= _result.zone.goodPass*2 then + _result.text = "EXCELLENT PASS" + elseif _result.hits >= _result.zone.goodPass then + _result.text = "GOOD PASS" + elseif _result.hits >= _result.zone.goodPass/2 then + _result.text = "INEFFECTIVE PASS" + else + _result.text = "POOR PASS" + end + + -- Message text. + local _text=string.format("%s, %s with %d hits on target %s.", self:_myname(_unitName), _result.text, _result.hits, _result.zone.name) + + -- Send message. + self:_DisplayMessageToGroup(_unit, _text) + + -- Set strafe status to nil. + self.strafeStatus[_unitID] = nil + + -- Save stats so the player can retrieve them. + local _stats = self.strafePlayerResults[_playername] or {} + table.insert(_stats, _result) + self.strafePlayerResults[_playername] = _stats + end + + end + + else + + -- Check to see if we're in any of the strafing zones (first time). + for _,_targetZone in pairs(self.strafeTargets) do + + -- Get the current approach zone and check if player is inside. + local zonenname=_targetZone.name + local zone=_targetZone.polygon --Core.Zone#ZONE_POLYGON_BASE + + -- Check if player is in zone and below max alt and flying towards the target. + local unitheading = _unit:GetHeading() + local pitheading = _targetZone.heading - 180 + local deltaheading = unitheading-pitheading + local towardspit = math.abs(deltaheading)<=90 or math.abs(deltaheading-360)<=90 + local unitalt =_unit:GetHeight()-_unit:GetCoordinate():GetLandHeight() + + -- Check if unit is inside zone and below max height AGL. + local unitinzone=_unit:IsInZone(zone) and unitalt <= self.strafemaxalt and towardspit + + -- Debug info. + local text=string.format("Checking zone %s. Unit = %s, player = %s in zone = %s. alt = %d, delta heading = %d", _targetZone.name, _unitName, _playername, tostring(unitinzone), unitalt, deltaheading) + self:T(RANGE.id..text) + + -- Player is inside zone. + if unitinzone then + + -- Init strafe status for this player. + self.strafeStatus[_unitID] = {hits = 0, zone = _targetZone, time = 1, pastfoulline=false } + + -- Rolling in! + local _msg=string.format("%s, rolling in on strafe pit %s.", self:_myname(_unitName), _targetZone.name) + + -- Send message. + self:_DisplayMessageToGroup(_unit, _msg, 10, true) + + -- We found our player. Skip remaining checks. + break + + end -- unit in zone check + + end -- loop over zones + end + end + +end + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------- +-- Menu Functions + +--- Add menu commands for player. +-- @param #RANGE self +-- @param #string _unitName Name of player unit. +function RANGE:_AddF10Commands(_unitName) + self:F(_unitName) + + -- Get player unit and name. + local _unit, playername = self:_GetPlayerUnitAndName(_unitName) + + -- Check for player unit. + if _unit and playername then + + -- Get group and ID. + local group=_unit:GetGroup() + local _gid=group:GetID() + + if group and _gid then + + if not self.MenuAddedTo[_gid] then + + -- Enable switch so we don't do this twice. + self.MenuAddedTo[_gid] = true + + -- Main F10 menu: F10/On the Range + local _rootPath = missionCommands.addSubMenuForGroup(_gid, "On the Range") + local _rangePath = missionCommands.addSubMenuForGroup(_gid, self.rangename, _rootPath) + local _statsPath = missionCommands.addSubMenuForGroup(_gid, "Statistics", _rangePath) + local _markPath = missionCommands.addSubMenuForGroup(_gid, "Mark Targets", _rangePath) + local _settingsPath = missionCommands.addSubMenuForGroup(_gid, "My Settings", _rangePath) + -- F10/On the Range/My Settings/ + local _mysmokePath = missionCommands.addSubMenuForGroup(_gid, "Smoke Color", _settingsPath) + local _myflarePath = missionCommands.addSubMenuForGroup(_gid, "Flare Color", _settingsPath) + + + --TODO: Convert to MOOSE menu. + -- F10/On the Range/Mark Targets/ + missionCommands.addCommandForGroup(_gid, "Mark On Map", _markPath, self._MarkTargetsOnMap, self, _unitName) + missionCommands.addCommandForGroup(_gid, "Illuminate Range", _markPath, self._IlluminateBombTargets, self, _unitName) + missionCommands.addCommandForGroup(_gid, "Smoke Strafe Pits", _markPath, self._SmokeStrafeTargetBoxes, self, _unitName) + missionCommands.addCommandForGroup(_gid, "Smoke Strafe Tgts", _markPath, self._SmokeStrafeTargets, self, _unitName) + missionCommands.addCommandForGroup(_gid, "Smoke Bomb Tgts", _markPath, self._SmokeBombTargets, self, _unitName) + -- F10/On the Range/Stats/ + missionCommands.addCommandForGroup(_gid, "All Strafe Results", _statsPath, self._DisplayStrafePitResults, self, _unitName) + missionCommands.addCommandForGroup(_gid, "All Bombing Results", _statsPath, self._DisplayBombingResults, self, _unitName) + missionCommands.addCommandForGroup(_gid, "My Strafe Results", _statsPath, self._DisplayMyStrafePitResults, self, _unitName) + missionCommands.addCommandForGroup(_gid, "My Bomb Results", _statsPath, self._DisplayMyBombingResults, self, _unitName) + missionCommands.addCommandForGroup(_gid, "Reset All Stats", _statsPath, self._ResetRangeStats, self, _unitName) + -- F10/On the Range/My Settings/Smoke Color/ + missionCommands.addCommandForGroup(_gid, "Blue Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.Blue) + missionCommands.addCommandForGroup(_gid, "Green Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.Green) + missionCommands.addCommandForGroup(_gid, "Orange Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.Orange) + missionCommands.addCommandForGroup(_gid, "Red Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.Red) + missionCommands.addCommandForGroup(_gid, "White Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.White) + -- F10/On the Range/My Settings/Flare Color/ + missionCommands.addCommandForGroup(_gid, "Green Flares", _myflarePath, self._playerflarecolor, self, _unitName, FLARECOLOR.Green) + missionCommands.addCommandForGroup(_gid, "Red Flares", _myflarePath, self._playerflarecolor, self, _unitName, FLARECOLOR.Red) + missionCommands.addCommandForGroup(_gid, "White Flares", _myflarePath, self._playerflarecolor, self, _unitName, FLARECOLOR.White) + missionCommands.addCommandForGroup(_gid, "Yellow Flares", _myflarePath, self._playerflarecolor, self, _unitName, FLARECOLOR.Yellow) + -- F10/On the Range/My Settings/ + missionCommands.addCommandForGroup(_gid, "Smoke Delay On/Off", _settingsPath, self._SmokeBombDelayOnOff, self, _unitName) + missionCommands.addCommandForGroup(_gid, "Smoke Impact On/Off", _settingsPath, self._SmokeBombImpactOnOff, self, _unitName) + missionCommands.addCommandForGroup(_gid, "Flare Hits On/Off", _settingsPath, self._FlareDirectHitsOnOff, self, _unitName) + -- F10/On the Range/ + missionCommands.addCommandForGroup(_gid, "Range Information", _rangePath, self._DisplayRangeInfo, self, _unitName) + missionCommands.addCommandForGroup(_gid, "Weather Report", _rangePath, self._DisplayRangeWeather, self, _unitName) + end + else + self:T(RANGE.id.."Could not find group or group ID in AddF10Menu() function. Unit name: ".._unitName) + end + else + self:T(RANGE.id.."Player unit does not exist in AddF10Menu() function. Unit name: ".._unitName) + end + +end + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------- +-- Helper Functions + +--- Mark targets on F10 map. +-- @param #RANGE self +-- @param #string _unitName Name of the player unit. +function RANGE:_MarkTargetsOnMap(_unitName) + self:F(_unitName) + + -- Get group. + local group=UNIT:FindByName(_unitName):GetGroup() + + if group then + + -- Mark bomb targets. + for _,_target in pairs(self.bombingTargets) do + local coord=_target.point --Core.Point#COORDINATE + coord:MarkToGroup("Bomb target ".._target.name, group) + end + + -- Mark strafe targets. + for _,_strafepit in pairs(self.strafeTargets) do + for _,_target in pairs(_strafepit.targets) do + local coord=_target:GetCoordinate() --Core.Point#COORDINATE + coord:MarkToGroup("Strafe target ".._target:GetName(), group) + end + end + + if _unitName then + local _unit, _playername = self:_GetPlayerUnitAndName(_unitName) + local text=string.format("%s, %s, range targets are now marked on F10 map.", self.rangename, _playername) + self:_DisplayMessageToGroup(_unit, text, 5) + end + + end +end + +--- Illuminate targets. Fires illumination bombs at one random bomb and one random strafe target at a random altitude between 400 and 800 m. +-- @param #RANGE self +-- @param #string _unitName (Optional) Name of the player unit. +function RANGE:_IlluminateBombTargets(_unitName) + self:F(_unitName) + + -- All bombing target coordinates. + local bomb={} + + for _,_target in pairs(self.bombingTargets) do + local coord=_target.point --Core.Point#COORDINATE + table.insert(bomb, coord) + end + + if #bomb>0 then + local coord=bomb[math.random(#bomb)] --Core.Point#COORDINATE + local c=COORDINATE:New(coord.x,coord.y+math.random(self.illuminationminalt,self.illuminationmaxalt),coord.z) + c:IlluminationBomb() + end + + -- All strafe target coordinates. + local strafe={} + + for _,_strafepit in pairs(self.strafeTargets) do + for _,_target in pairs(_strafepit.targets) do + local coord=_target:GetCoordinate() --Core.Point#COORDINATE + table.insert(strafe, coord) + end + end + + -- Pick a random strafe target. + if #strafe>0 then + local coord=strafe[math.random(#strafe)] --Core.Point#COORDINATE + local c=COORDINATE:New(coord.x,coord.y+math.random(self.illuminationminalt,self.illuminationmaxalt),coord.z) + c:IlluminationBomb() + end + + if _unitName then + local _unit, _playername = self:_GetPlayerUnitAndName(_unitName) + local text=string.format("%s, %s, range targets are illuminated.", self.rangename, _playername) + self:_DisplayMessageToGroup(_unit, text, 5) + end +end + +--- Reset player statistics. +-- @param #RANGE self +-- @param #string _unitName Name of the player unit. +function RANGE:_ResetRangeStats(_unitName) + self:F(_unitName) + + -- Get player unit and name. + local _unit, _playername = self:_GetPlayerUnitAndName(_unitName) + + if _unit and _playername then + self.strafePlayerResults[_playername] = nil + self.bombPlayerResults[_playername] = nil + local text=string.format("%s, %s, your range stats were cleared.", self.rangename, _playername) + self:DisplayMessageToGroup(_unit, text, 5) + end +end + +--- Display message to group. +-- @param #RANGE self +-- @param Wrapper.Unit#UNIT _unit Player unit. +-- @param #string _text Message text. +-- @param #number _time Duration how long the message is displayed. +-- @param #boolean _clear Clear up old messages. +function RANGE:_DisplayMessageToGroup(_unit, _text, _time, _clear) + self:F({unit=_unit, text=_text, time=_time, clear=_clear}) + + _time=_time or self.Tmsg + if _clear==nil then + _clear=false + end + + -- Group ID. + local _gid=_unit:GetGroup():GetID() + + if _gid then + if _clear == true then + trigger.action.outTextForGroup(_gid, _text, _time, _clear) + else + trigger.action.outTextForGroup(_gid, _text, _time) + end + end + +end + +--- Toggle status of smoking bomb impact points. +-- @param #RANGE self +-- @param #string unitname Name of the player unit. +function RANGE:_SmokeBombImpactOnOff(unitname) + self:F(unitname) + + local unit, playername = self:_GetPlayerUnitAndName(unitname) + if unit and playername then + local text + if self.PlayerSettings[playername].smokebombimpact==true then + self.PlayerSettings[playername].smokebombimpact=false + text=string.format("%s, %s, smoking impact points of bombs is now OFF.", self.rangename, playername) + else + self.PlayerSettigs[playername].smokebombimpact=true + text=string.format("%s, %s, smoking impact points of bombs is now ON.", self.rangename, playername) + end + self:_DisplayMessageToGroup(unit, text, 5) + end + +end + +--- Toggle status of time delay for smoking bomb impact points +-- @param #RANGE self +-- @param #string unitname Name of the player unit. +function RANGE:_SmokeBombDelayOnOff(unitname) + self:F(unitname) + + local unit, playername = self:_GetPlayerUnitAndName(unitname) + if unit and playername then + local text + if self.PlayerSettings[playername].delaysmoke==true then + self.PlayerSettings[playername].delaysmoke=false + text=string.format("%s, %s, delayed smoke of bombs is now OFF.", self.rangename, playername) + else + self.PlayerSettigs[playername].delaysmoke=true + text=string.format("%s, %s, delayed smoke of bombs is now ON.", self.rangename, playername) + end + self:_DisplayMessageToGroup(unit, text, 5) + end + +end + +--- Toggle status of flaring direct hits of range targets. +-- @param #RANGE self +-- @param #string unitname Name of the player unit. +function RANGE:_FlareDirectHitsOnOff(unitname) + self:F(unitname) + + local unit, playername = self:_GetPlayerUnitAndName(unitname) + if unit and playername then + local text + if self.PlayerSettings[playername].flaredirecthits==true then + self.PlayerSettings[playername].flaredirecthits=false + text=string.format("%s, %s, flaring direct hits is now OFF.", self.rangename, playername) + else + self.PlayerSettings[playername].flaredirecthits=true + text=string.format("%s, %s, flaring direct hits is now ON.", self.rangename, playername) + end + self:_DisplayMessageToGroup(unit, text, 5) + end + +end + +--- Mark bombing targets with smoke. +-- @param #RANGE self +-- @param #string unitname Name of the player unit. +function RANGE:_SmokeBombTargets(unitname) + self:F(unitname) + + for _,_target in pairs(self.bombingTargets) do + local coord = _target.point --Core.Point#COORDINATE + coord:Smoke(self.BombSmokeColor) + end + + if unitname then + local unit, playername = self:_GetPlayerUnitAndName(unitname) + local text=string.format("%s, %s, bombing targets are now marked with %s smoke.", self.rangename, playername, self:_smokecolor2text(self.BombSmokeColor)) + self:_DisplayMessageToGroup(unit, text, 5) + end + +end + +--- Mark strafing targets with smoke. +-- @param #RANGE self +-- @param #string unitname Name of the player unit. +function RANGE:_SmokeStrafeTargets(unitname) + self:F(unitname) + + for _,_target in pairs(self.strafeTargets) do + for _,_unit in pairs(_target.targets) do + local coord = _unit:GetCoordinate() --Core.Point#COORDINATE + coord:Smoke(self.StrafeSmokeColor) + end + end + + if unitname then + local unit, playername = self:_GetPlayerUnitAndName(unitname) + local text=string.format("%s, %s, strafing tragets are now marked with %s smoke.", self.rangename, playername, self:_smokecolor2text(self.StrafeSmokeColor)) + self:_DisplayMessageToGroup(unit, text, 5) + end + +end + +--- Mark approach boxes of strafe targets with smoke. +-- @param #RANGE self +-- @param #string unitname Name of the player unit. +function RANGE:_SmokeStrafeTargetBoxes(unitname) + self:F(unitname) + + for _,_target in pairs(self.strafeTargets) do + local zone=_target.polygon --Core.Zone#ZONE + zone:SmokeZone(self.StrafePitSmokeColor) + for _,_point in pairs(_target.smokepoints) do + _point:SmokeOrange() --Corners are smoked orange. + end + end + + if unitname then + local unit, playername = self:_GetPlayerUnitAndName(unitname) + local text=string.format("%s, %s, strafing pit approach boxes are now marked with %s smoke.", self.rangename, playername, self:_smokecolor2text(self.StrafePitSmokeColor)) + self:_DisplayMessageToGroup(unit, text, 5) + end + +end + +--- Sets the smoke color used to smoke players bomb impact points. +-- @param #RANGE self +-- @param #string _unitName Name of the player unit. +-- @param Utilities.Utils#SMOKECOLOR color ID of the smoke color. +function RANGE:_playersmokecolor(_unitName, color) + self:F({unitname=_unitName, color=color}) + + local _unit, _playername = self:_GetPlayerUnitAndName(_unitName) + if _unit and _playername then + self.PlayerSettings[_playername].smokecolor=color + local text=string.format("%s, %s, your bomb impacts are now smoked in %s.", self.rangename, _playername, self:_smokecolor2text(color)) + self:_DisplayMessageToGroup(_unit, text, 5) + end + +end + +--- Sets the flare color used when player makes a direct hit on target. +-- @param #RANGE self +-- @param #string _unitName Name of the player unit. +-- @param Utilities.Utils#FLARECOLOR color ID of flare color. +function RANGE:_playerflarecolor(_unitName, color) + self:F({unitname=_unitName, color=color}) + + local _unit, _playername = self:_GetPlayerUnitAndName(_unitName) + if _unit and _playername then + self.PlayerSettings[_playername].flarecolor=color + local text=string.format("%s, %s, your direct hits are now flared in %s.", self.rangename, _playername, self:_flarecolor2text(color)) + self:_DisplayMessageToGroup(_unit, text, 5) + end + +end + +--- Converts a smoke color id to text. E.g. SMOKECOLOR.Blue --> "blue". +-- @param #RANGE self +-- @param Utilities.Utils#SMOKECOLOR color Color Id. +-- @return #string Color text. +function RANGE:_smokecolor2text(color) + self:F(color) + + local txt="" + if color==SMOKECOLOR.Blue then + txt="blue" + elseif color==SMOKECOLOR.Green then + txt="green" + elseif color==SMOKECOLOR.Orange then + txt="orange" + elseif color==SMOKECOLOR.Red then + txt="red" + elseif color==SMOKECOLOR.White then + txt="white" + else + txt=string.format("unkown color (%s)", tostring(color)) + end + + return txt +end + +--- Sets the flare color used to flare players direct target hits. +-- @param #RANGE self +-- @param Utilities.Utils#FLARECOLOR color Color Id. +-- @return #string Color text. +function RANGE:_flarecolor2text(color) + self:F(color) + + local txt="" + if color==FLARECOLOR.Green then + txt="green" + elseif color==FLARECOLOR.Red then + txt="red" + elseif color==FLARECOLOR.White then + txt="white" + elseif color==FLARECOLOR.Yellow then + txt="yellow" + else + txt=string.format("unkown color (%s)", tostring(color)) + end + + return txt +end + +--- Returns the unit of a player and the player name. If the unit does not belong to a player, nil is returned. +-- @param #RANGE self +-- @param #string _unitName Name of the player unit. +-- @return Wrapper.Unit#UNIT Unit of player. +-- @return #string Name of the player. +-- @return nil If player does not exist. +function RANGE:_GetPlayerUnitAndName(_unitName) + self:F(_unitName) + + if _unitName ~= nil then + local DCSunit=Unit.getByName(_unitName) + local playername=DCSunit:getPlayerName() + local unit=UNIT:Find(DCSunit) + + self:T({DCSunit=DCSunit, unit=unit, playername=playername}) + if DCSunit and unit and playername then + return unit, playername + end + end + + return nil,nil +end + +--- Returns a string which consits of this callsign and the player name. +-- @param #RANGE self +-- @param #string unitname Name of the player unit. +function RANGE:_myname(unitname) + self:F(unitname) + + local unit=UNIT:FindByName(unitname) + local pname=unit:GetPlayerName() + local csign=unit:GetCallsign() + + return string.format("%s (%s)", csign, pname) +end + +--- http://stackoverflow.com/questions/1426954/split-string-in-lua +-- @param #RANGE self +-- @param #string str Sting to split. +-- @param #string sep Speparator for split. +-- @return #table Split text. +function RANGE:_split(str, sep) + self:F({str=str, sep=sep}) + + local result = {} + local regex = ("([^%s]+)"):format(sep) + for each in str:gmatch(regex) do + table.insert(result, each) + end + + return result +end + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/Moose Development/Moose/Functional/Scoring.lua b/Moose Development/Moose/Functional/Scoring.lua index 087d79f1f..ed233a409 100644 --- a/Moose Development/Moose/Functional/Scoring.lua +++ b/Moose Development/Moose/Functional/Scoring.lua @@ -689,7 +689,7 @@ end -- @param #number Score The score can be both positive or negative ( Penalty ). function SCORING:AddGoalScorePlayer( PlayerName, GoalTag, Text, Score ) - self:E( { PlayerName, PlayerName, GoalTag, Text, Score } ) + self:F( { PlayerName, PlayerName, GoalTag, Text, Score } ) -- PlayerName can be nil, if the Unit with the player crashed or due to another reason. if PlayerName then @@ -721,7 +721,7 @@ function SCORING:AddGoalScore( PlayerUnit, GoalTag, Text, Score ) local PlayerName = PlayerUnit:GetPlayerName() - self:E( { PlayerUnit.UnitName, PlayerName, GoalTag, Text, Score } ) + self:F( { PlayerUnit.UnitName, PlayerName, GoalTag, Text, Score } ) -- PlayerName can be nil, if the Unit with the player crashed or due to another reason. if PlayerName then @@ -749,7 +749,7 @@ function SCORING:_AddMissionTaskScore( Mission, PlayerUnit, Text, Score ) local PlayerName = PlayerUnit:GetPlayerName() local MissionName = Mission:GetName() - self:E( { Mission:GetName(), PlayerUnit.UnitName, PlayerName, Text, Score } ) + self:F( { Mission:GetName(), PlayerUnit.UnitName, PlayerName, Text, Score } ) -- PlayerName can be nil, if the Unit with the player crashed or due to another reason. if PlayerName then @@ -783,7 +783,7 @@ function SCORING:_AddMissionGoalScore( Mission, PlayerName, Text, Score ) local MissionName = Mission:GetName() - self:E( { Mission:GetName(), PlayerName, Text, Score } ) + self:F( { Mission:GetName(), PlayerName, Text, Score } ) -- PlayerName can be nil, if the Unit with the player crashed or due to another reason. if PlayerName then @@ -817,12 +817,12 @@ function SCORING:_AddMissionScore( Mission, Text, Score ) local MissionName = Mission:GetName() - self:E( { Mission, Text, Score } ) - self:E( self.Players ) + self:F( { Mission, Text, Score } ) + self:F( self.Players ) for PlayerName, PlayerData in pairs( self.Players ) do - self:E( PlayerData ) + self:F( PlayerData ) if PlayerData.Mission[MissionName] then PlayerData.Score = PlayerData.Score + Score @@ -1232,7 +1232,7 @@ function SCORING:_EventOnDeadOrCrash( Event ) local ThreatTypeTarget = TargetThreatType local ThreatLevelPlayer = Player.ThreatLevel / 10 + 1 local ThreatPenalty = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.ScaleDestroyPenalty / 10 ) - self:E( { ThreatLevel = ThreatPenalty, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } ) + self:F( { ThreatLevel = ThreatPenalty, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } ) Player.Penalty = Player.Penalty + ThreatPenalty TargetDestroy.Penalty = TargetDestroy.Penalty + ThreatPenalty @@ -1267,7 +1267,7 @@ function SCORING:_EventOnDeadOrCrash( Event ) local ThreatLevelPlayer = Player.ThreatLevel / 10 + 1 local ThreatScore = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.ScaleDestroyScore / 10 ) - self:E( { ThreatLevel = ThreatScore, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } ) + self:F( { ThreatLevel = ThreatScore, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } ) Player.Score = Player.Score + ThreatScore TargetDestroy.Score = TargetDestroy.Score + ThreatScore @@ -1312,7 +1312,7 @@ function SCORING:_EventOnDeadOrCrash( Event ) -- Check if there are Zones where the destruction happened. for ZoneName, ScoreZoneData in pairs( self.ScoringZones ) do - self:E( { ScoringZone = ScoreZoneData } ) + self:F( { ScoringZone = ScoreZoneData } ) local ScoreZone = ScoreZoneData.ScoreZone -- Core.Zone#ZONE_BASE local Score = ScoreZoneData.Score if ScoreZone:IsVec2InZone( TargetUnit:GetVec2() ) then @@ -1334,7 +1334,7 @@ function SCORING:_EventOnDeadOrCrash( Event ) else -- Check if there are Zones where the destruction happened. for ZoneName, ScoreZoneData in pairs( self.ScoringZones ) do - self:E( { ScoringZone = ScoreZoneData } ) + self:F( { ScoringZone = ScoreZoneData } ) local ScoreZone = ScoreZoneData.ScoreZone -- Core.Zone#ZONE_BASE local Score = ScoreZoneData.Score if ScoreZone:IsVec2InZone( TargetUnit:GetVec2() ) then @@ -1449,7 +1449,7 @@ function SCORING:ReportDetailedPlayerDestroys( PlayerName ) local PenaltyDestroy = 0 for UnitName, UnitData in pairs( PlayerData.Destroy[CategoryID] ) do - self:E( { UnitData = UnitData } ) + self:F( { UnitData = UnitData } ) if UnitData ~= {} then Score = Score + UnitData.Score ScoreDestroy = ScoreDestroy + UnitData.ScoreDestroy @@ -1603,23 +1603,23 @@ function SCORING:ReportScoreGroupSummary( PlayerGroup ) local ReportHits, ScoreHits, PenaltyHits = self:ReportDetailedPlayerHits( PlayerName ) ReportHits = ReportHits ~= "" and "\n- " .. ReportHits or ReportHits - self:E( { ReportHits, ScoreHits, PenaltyHits } ) + self:F( { ReportHits, ScoreHits, PenaltyHits } ) local ReportDestroys, ScoreDestroys, PenaltyDestroys = self:ReportDetailedPlayerDestroys( PlayerName ) ReportDestroys = ReportDestroys ~= "" and "\n- " .. ReportDestroys or ReportDestroys - self:E( { ReportDestroys, ScoreDestroys, PenaltyDestroys } ) + self:F( { ReportDestroys, ScoreDestroys, PenaltyDestroys } ) local ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges = self:ReportDetailedPlayerCoalitionChanges( PlayerName ) ReportCoalitionChanges = ReportCoalitionChanges ~= "" and "\n- " .. ReportCoalitionChanges or ReportCoalitionChanges - self:E( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } ) + self:F( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } ) local ReportGoals, ScoreGoals, PenaltyGoals = self:ReportDetailedPlayerGoals( PlayerName ) ReportGoals = ReportGoals ~= "" and "\n- " .. ReportGoals or ReportGoals - self:E( { ReportGoals, ScoreGoals, PenaltyGoals } ) + self:F( { ReportGoals, ScoreGoals, PenaltyGoals } ) local ReportMissions, ScoreMissions, PenaltyMissions = self:ReportDetailedPlayerMissions( PlayerName ) ReportMissions = ReportMissions ~= "" and "\n- " .. ReportMissions or ReportMissions - self:E( { ReportMissions, ScoreMissions, PenaltyMissions } ) + self:F( { ReportMissions, ScoreMissions, PenaltyMissions } ) local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions @@ -1655,23 +1655,23 @@ function SCORING:ReportScoreGroupDetailed( PlayerGroup ) local ReportHits, ScoreHits, PenaltyHits = self:ReportDetailedPlayerHits( PlayerName ) ReportHits = ReportHits ~= "" and "\n- " .. ReportHits or ReportHits - self:E( { ReportHits, ScoreHits, PenaltyHits } ) + self:F( { ReportHits, ScoreHits, PenaltyHits } ) local ReportDestroys, ScoreDestroys, PenaltyDestroys = self:ReportDetailedPlayerDestroys( PlayerName ) ReportDestroys = ReportDestroys ~= "" and "\n- " .. ReportDestroys or ReportDestroys - self:E( { ReportDestroys, ScoreDestroys, PenaltyDestroys } ) + self:F( { ReportDestroys, ScoreDestroys, PenaltyDestroys } ) local ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges = self:ReportDetailedPlayerCoalitionChanges( PlayerName ) ReportCoalitionChanges = ReportCoalitionChanges ~= "" and "\n- " .. ReportCoalitionChanges or ReportCoalitionChanges - self:E( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } ) + self:F( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } ) local ReportGoals, ScoreGoals, PenaltyGoals = self:ReportDetailedPlayerGoals( PlayerName ) ReportGoals = ReportGoals ~= "" and "\n- " .. ReportGoals or ReportGoals - self:E( { ReportGoals, ScoreGoals, PenaltyGoals } ) + self:F( { ReportGoals, ScoreGoals, PenaltyGoals } ) local ReportMissions, ScoreMissions, PenaltyMissions = self:ReportDetailedPlayerMissions( PlayerName ) ReportMissions = ReportMissions ~= "" and "\n- " .. ReportMissions or ReportMissions - self:E( { ReportMissions, ScoreMissions, PenaltyMissions } ) + self:F( { ReportMissions, ScoreMissions, PenaltyMissions } ) local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions @@ -1711,23 +1711,23 @@ function SCORING:ReportScoreAllSummary( PlayerGroup ) local ReportHits, ScoreHits, PenaltyHits = self:ReportDetailedPlayerHits( PlayerName ) ReportHits = ReportHits ~= "" and "\n- " .. ReportHits or ReportHits - self:E( { ReportHits, ScoreHits, PenaltyHits } ) + self:F( { ReportHits, ScoreHits, PenaltyHits } ) local ReportDestroys, ScoreDestroys, PenaltyDestroys = self:ReportDetailedPlayerDestroys( PlayerName ) ReportDestroys = ReportDestroys ~= "" and "\n- " .. ReportDestroys or ReportDestroys - self:E( { ReportDestroys, ScoreDestroys, PenaltyDestroys } ) + self:F( { ReportDestroys, ScoreDestroys, PenaltyDestroys } ) local ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges = self:ReportDetailedPlayerCoalitionChanges( PlayerName ) ReportCoalitionChanges = ReportCoalitionChanges ~= "" and "\n- " .. ReportCoalitionChanges or ReportCoalitionChanges - self:E( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } ) + self:F( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } ) local ReportGoals, ScoreGoals, PenaltyGoals = self:ReportDetailedPlayerGoals( PlayerName ) ReportGoals = ReportGoals ~= "" and "\n- " .. ReportGoals or ReportGoals - self:E( { ReportGoals, ScoreGoals, PenaltyGoals } ) + self:F( { ReportGoals, ScoreGoals, PenaltyGoals } ) local ReportMissions, ScoreMissions, PenaltyMissions = self:ReportDetailedPlayerMissions( PlayerName ) ReportMissions = ReportMissions ~= "" and "\n- " .. ReportMissions or ReportMissions - self:E( { ReportMissions, ScoreMissions, PenaltyMissions } ) + self:F( { ReportMissions, ScoreMissions, PenaltyMissions } ) local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions @@ -1787,7 +1787,7 @@ function SCORING:OpenCSV( ScoringCSV ) error( "A string containing the CSV file name must be given." ) end else - self:E( "The MissionScripting.lua file has not been changed to allow lfs, io and os modules to be used..." ) + self:F( "The MissionScripting.lua file has not been changed to allow lfs, io and os modules to be used..." ) end return self end diff --git a/Moose Development/Moose/Functional/ZoneCaptureCoalition.lua b/Moose Development/Moose/Functional/ZoneCaptureCoalition.lua index 14ee3a766..b776cc4bb 100644 --- a/Moose Development/Moose/Functional/ZoneCaptureCoalition.lua +++ b/Moose Development/Moose/Functional/ZoneCaptureCoalition.lua @@ -285,7 +285,7 @@ do -- ZONE_CAPTURE_COALITION function ZONE_CAPTURE_COALITION:IsGuarded() local IsGuarded = self.Zone:IsAllInZoneOfCoalition( self.Coalition ) - self:E( { IsGuarded = IsGuarded } ) + self:F( { IsGuarded = IsGuarded } ) return IsGuarded end @@ -293,7 +293,7 @@ do -- ZONE_CAPTURE_COALITION function ZONE_CAPTURE_COALITION:IsEmpty() local IsEmpty = self.Zone:IsNoneInZone() - self:E( { IsEmpty = IsEmpty } ) + self:F( { IsEmpty = IsEmpty } ) return IsEmpty end @@ -301,7 +301,7 @@ do -- ZONE_CAPTURE_COALITION function ZONE_CAPTURE_COALITION:IsCaptured() local IsCaptured = self.Zone:IsAllInZoneOfOtherCoalition( self.Coalition ) - self:E( { IsCaptured = IsCaptured } ) + self:F( { IsCaptured = IsCaptured } ) return IsCaptured end @@ -309,7 +309,7 @@ do -- ZONE_CAPTURE_COALITION function ZONE_CAPTURE_COALITION:IsAttacked() local IsAttacked = self.Zone:IsSomeInZoneOfCoalition( self.Coalition ) - self:E( { IsAttacked = IsAttacked } ) + self:F( { IsAttacked = IsAttacked } ) return IsAttacked end @@ -324,7 +324,7 @@ do -- ZONE_CAPTURE_COALITION local State = self:GetState() if self.MarkRed and self.MarkBlue then - self:E( { MarkRed = self.MarkRed, MarkBlue = self.MarkBlue } ) + self:F( { MarkRed = self.MarkRed, MarkBlue = self.MarkBlue } ) Coord:RemoveMark( self.MarkRed ) Coord:RemoveMark( self.MarkBlue ) end @@ -359,7 +359,7 @@ do -- ZONE_CAPTURE_COALITION --self:GetParent( self ):onenterCaptured() local NewCoalition = self.Zone:GetScannedCoalition() - self:E( { NewCoalition = NewCoalition } ) + self:F( { NewCoalition = NewCoalition } ) self:SetCoalition( NewCoalition ) self:Mark() @@ -386,7 +386,7 @@ do -- ZONE_CAPTURE_COALITION -- @param #ZONE_CAPTURE_COALITION self function ZONE_CAPTURE_COALITION:onafterGuard() - --self:E({BASE:GetParent( self )}) + --self:F({BASE:GetParent( self )}) --BASE:GetParent( self ).onafterGuard( self ) if not self.SmokeScheduler then @@ -398,7 +398,7 @@ do -- ZONE_CAPTURE_COALITION function ZONE_CAPTURE_COALITION:IsCaptured() local IsCaptured = self.Zone:IsAllInZoneOfOtherCoalition( self.Coalition ) - self:E( { IsCaptured = IsCaptured } ) + self:F( { IsCaptured = IsCaptured } ) return IsCaptured end @@ -406,7 +406,7 @@ do -- ZONE_CAPTURE_COALITION function ZONE_CAPTURE_COALITION:IsAttacked() local IsAttacked = self.Zone:IsSomeInZoneOfCoalition( self.Coalition ) - self:E( { IsAttacked = IsAttacked } ) + self:F( { IsAttacked = IsAttacked } ) return IsAttacked end @@ -416,7 +416,7 @@ do -- ZONE_CAPTURE_COALITION function ZONE_CAPTURE_COALITION:StatusZone() local State = self:GetState() - self:E( { State = self:GetState() } ) + self:F( { State = self:GetState() } ) self:GetParent( self, ZONE_CAPTURE_COALITION ).StatusZone( self ) diff --git a/Moose Development/Moose/Functional/ZoneGoal.lua b/Moose Development/Moose/Functional/ZoneGoal.lua index 992f26404..436b00db8 100644 --- a/Moose Development/Moose/Functional/ZoneGoal.lua +++ b/Moose Development/Moose/Functional/ZoneGoal.lua @@ -112,7 +112,7 @@ do -- Zone --self:GetParent( self ):onafterStart() - self:E("Guard") + self:F("Guard") --self:ScheduleRepeat( 15, 15, 0.1, nil, self.StatusZone, self ) if not self.SmokeScheduler then @@ -142,14 +142,14 @@ do -- Zone --- @param #ZONE_GOAL self -- @param Core.Event#EVENTDATA EventData function ZONE_GOAL:__Destroyed( EventData ) - self:E( { "EventDead", EventData } ) + self:F( { "EventDead", EventData } ) - self:E( { EventData.IniUnit } ) + self:F( { EventData.IniUnit } ) local Vec3 = EventData.IniDCSUnit:getPosition().p - self:E( { Vec3 = Vec3 } ) + self:F( { Vec3 = Vec3 } ) local ZoneGoal = self:GetZone() - self:E({ZoneGoal}) + self:F({ZoneGoal}) if EventData.IniDCSUnit then if ZoneGoal:IsVec3InZone(Vec3) then diff --git a/Moose Development/Moose/Functional/ZoneGoalCargo.lua b/Moose Development/Moose/Functional/ZoneGoalCargo.lua index 78707d461..3fc0d5e8b 100644 --- a/Moose Development/Moose/Functional/ZoneGoalCargo.lua +++ b/Moose Development/Moose/Functional/ZoneGoalCargo.lua @@ -293,7 +293,7 @@ do -- ZoneGoal function ZONE_GOAL_CARGO:IsGuarded() local IsGuarded = self.Zone:IsAllInZoneOfCoalition( self.Coalition ) - self:E( { IsGuarded = IsGuarded } ) + self:F( { IsGuarded = IsGuarded } ) return IsGuarded end @@ -301,7 +301,7 @@ do -- ZoneGoal function ZONE_GOAL_CARGO:IsEmpty() local IsEmpty = self.Zone:IsNoneInZone() - self:E( { IsEmpty = IsEmpty } ) + self:F( { IsEmpty = IsEmpty } ) return IsEmpty end @@ -309,7 +309,7 @@ do -- ZoneGoal function ZONE_GOAL_CARGO:IsCaptured() local IsCaptured = self.Zone:IsAllInZoneOfOtherCoalition( self.Coalition ) - self:E( { IsCaptured = IsCaptured } ) + self:F( { IsCaptured = IsCaptured } ) return IsCaptured end @@ -317,7 +317,7 @@ do -- ZoneGoal function ZONE_GOAL_CARGO:IsAttacked() local IsAttacked = self.Zone:IsSomeInZoneOfCoalition( self.Coalition ) - self:E( { IsAttacked = IsAttacked } ) + self:F( { IsAttacked = IsAttacked } ) return IsAttacked end @@ -332,7 +332,7 @@ do -- ZoneGoal local State = self:GetState() if self.MarkRed and self.MarkBlue then - self:E( { MarkRed = self.MarkRed, MarkBlue = self.MarkBlue } ) + self:F( { MarkRed = self.MarkRed, MarkBlue = self.MarkBlue } ) Coord:RemoveMark( self.MarkRed ) Coord:RemoveMark( self.MarkBlue ) end @@ -367,7 +367,7 @@ do -- ZoneGoal --self:GetParent( self ):onenterCaptured() local NewCoalition = self.Zone:GetCoalition() - self:E( { NewCoalition = NewCoalition } ) + self:F( { NewCoalition = NewCoalition } ) self:SetCoalition( NewCoalition ) self:Mark() @@ -394,7 +394,7 @@ do -- ZoneGoal -- @param #ZONE_GOAL_CARGO self function ZONE_GOAL_CARGO:onafterGuard() - --self:E({BASE:GetParent( self )}) + --self:F({BASE:GetParent( self )}) --BASE:GetParent( self ).onafterGuard( self ) if not self.SmokeScheduler then @@ -409,7 +409,7 @@ do -- ZoneGoal function ZONE_GOAL_CARGO:IsCaptured() local IsCaptured = self.Zone:IsAllInZoneOfOtherCoalition( self.Coalition ) - self:E( { IsCaptured = IsCaptured } ) + self:F( { IsCaptured = IsCaptured } ) return IsCaptured end @@ -417,7 +417,7 @@ do -- ZoneGoal function ZONE_GOAL_CARGO:IsAttacked() local IsAttacked = self.Zone:IsSomeInZoneOfCoalition( self.Coalition ) - self:E( { IsAttacked = IsAttacked } ) + self:F( { IsAttacked = IsAttacked } ) return IsAttacked end @@ -426,7 +426,7 @@ do -- ZoneGoal function ZONE_GOAL_CARGO:StatusZone() local State = self:GetState() - self:E( { State = self:GetState() } ) + self:F( { State = self:GetState() } ) self.Zone:Scan() diff --git a/Moose Development/Moose/Functional/ZoneGoalCoalition.lua b/Moose Development/Moose/Functional/ZoneGoalCoalition.lua index 83415f3fb..0b31b8494 100644 --- a/Moose Development/Moose/Functional/ZoneGoalCoalition.lua +++ b/Moose Development/Moose/Functional/ZoneGoalCoalition.lua @@ -103,7 +103,7 @@ do -- ZoneGoal function ZONE_GOAL_COALITION:StatusZone() local State = self:GetState() - self:E( { State = self:GetState() } ) + self:F( { State = self:GetState() } ) self.Zone:Scan( { Object.Category.UNIT, Object.Category.STATIC } ) diff --git a/Moose Development/Moose/Tasking/CommandCenter.lua b/Moose Development/Moose/Tasking/CommandCenter.lua index 0c95d95bc..d949f4763 100644 --- a/Moose Development/Moose/Tasking/CommandCenter.lua +++ b/Moose Development/Moose/Tasking/CommandCenter.lua @@ -101,7 +101,6 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName ) if EventData.IniObjectCategory == 1 then local EventGroup = GROUP:Find( EventData.IniDCSGroup ) self:E( { CommandCenter = self:GetName(), EventGroup = EventGroup, HasGroup = self:HasGroup( EventGroup ), EventData = EventData } ) - self:E( { GROUPS = _DATABASE.GROUPS } ) if EventGroup and self:HasGroup( EventGroup ) then local CommandCenterMenu = MENU_GROUP:New( EventGroup, "Command Center (" .. self:GetName() .. ")" ) local MenuReporting = MENU_GROUP:New( EventGroup, "Missions Reports", CommandCenterMenu ) @@ -423,7 +422,7 @@ end -- Each Mission is listed, with an indication how many Tasks are still to be completed. -- @param #COMMANDCENTER self function COMMANDCENTER:ReportSummary( ReportGroup ) - self:E( ReportGroup ) + self:F( ReportGroup ) local Report = REPORT:New() @@ -443,7 +442,7 @@ end -- Each Mission is listed, with an indication how many Tasks are still to be completed. -- @param #COMMANDCENTER self function COMMANDCENTER:ReportMissionsPlayers( ReportGroup ) - self:E( ReportGroup ) + self:F( ReportGroup ) local Report = REPORT:New() @@ -461,7 +460,7 @@ end -- Report the details of a Mission, listing the Mission, and all the Task details. -- @param #COMMANDCENTER self function COMMANDCENTER:ReportDetails( ReportGroup, Task ) - self:E( ReportGroup ) + self:F( ReportGroup ) local Report = REPORT:New() diff --git a/Moose Development/Moose/Tasking/DetectionManager.lua b/Moose Development/Moose/Tasking/DetectionManager.lua index 8e9010a3e..e2816dbba 100644 --- a/Moose Development/Moose/Tasking/DetectionManager.lua +++ b/Moose Development/Moose/Tasking/DetectionManager.lua @@ -129,7 +129,6 @@ do -- DETECTION MANAGER self:SetRefreshTimeInterval( 30 ) self:SetReportDisplayTime( 25 ) - self:E( { Detection = Detection } ) Detection:__Start( 3 ) return self @@ -141,8 +140,6 @@ do -- DETECTION MANAGER function DETECTION_MANAGER:onafterReport( From, Event, To ) - self:E( "onafterReport" ) - self:__Report( -self._RefreshTimeInterval ) self:ProcessDetected( self.Detection ) @@ -256,7 +253,6 @@ do -- DETECTION_REPORTING function DETECTION_REPORTING:ProcessDetected( Group, Detection ) self:F2( Group ) - self:E( Group ) local DetectedMsg = {} for DetectedAreaID, DetectedAreaData in pairs( Detection:GetDetectedAreas() ) do local DetectedArea = DetectedAreaData -- Functional.Detection#DETECTION_AREAS.DetectedArea diff --git a/Moose Development/Moose/Tasking/Task.lua b/Moose Development/Moose/Tasking/Task.lua index 36727e3f1..22a02fe82 100644 --- a/Moose Development/Moose/Tasking/Task.lua +++ b/Moose Development/Moose/Tasking/Task.lua @@ -213,7 +213,7 @@ function TASK:New( Mission, SetGroupAssign, TaskName, TaskType, TaskBriefing ) self:AddTransition( { "Failed", "Aborted", "Cancelled" }, "Replan", "Planned" ) self:AddTransition( "*", "TimeOut", "Cancelled" ) - self:E( "New TASK " .. TaskName ) + self:F( "New TASK " .. TaskName ) self.Processes = {} self.Fsm = {} @@ -284,7 +284,7 @@ function TASK:JoinUnit( PlayerUnit, PlayerGroup ) end if self:IsStateAssigned() then local IsGroupAssigned = self:IsGroupAssigned( PlayerGroup ) - self:E( { IsGroupAssigned = IsGroupAssigned } ) + self:F( { IsGroupAssigned = IsGroupAssigned } ) if IsGroupAssigned then self:AssignToUnit( PlayerUnit ) self:MessageToGroups( PlayerUnit:GetPlayerName() .. " joined Task " .. self:GetName() ) @@ -313,7 +313,7 @@ function TASK:AbortGroup( PlayerGroup ) -- If the PlayerUnit was the last unit of the PlayerGroup, the menu needs to be removed from the Group. if self:IsStateAssigned() then local IsGroupAssigned = self:IsGroupAssigned( PlayerGroup ) - self:E( { IsGroupAssigned = IsGroupAssigned } ) + self:F( { IsGroupAssigned = IsGroupAssigned } ) if IsGroupAssigned then local PlayerName = PlayerGroup:GetUnit(1):GetPlayerName() --self:MessageToGroups( PlayerName .. " aborted Task " .. self:GetName() ) @@ -365,7 +365,7 @@ function TASK:CrashGroup( PlayerGroup ) -- If the PlayerUnit was the last unit of the PlayerGroup, the menu needs to be removed from the Group. if self:IsStateAssigned() then local IsGroupAssigned = self:IsGroupAssigned( PlayerGroup ) - self:E( { IsGroupAssigned = IsGroupAssigned } ) + self:F( { IsGroupAssigned = IsGroupAssigned } ) if IsGroupAssigned then local PlayerName = PlayerGroup:GetUnit(1):GetPlayerName() self:MessageToGroups( PlayerName .. " crashed! " ) @@ -446,7 +446,7 @@ do -- Group Assignment local TaskGroupName = TaskGroup:GetName() self.AssignedGroups[TaskGroupName] = TaskGroup - self:E( string.format( "Task %s is assigned to %s", TaskName, TaskGroupName ) ) + self:F( string.format( "Task %s is assigned to %s", TaskName, TaskGroupName ) ) -- Set the group to be assigned at mission level. This allows to decide the menu options on mission level for this group. self:GetMission():SetGroupAssigned( TaskGroup ) @@ -476,7 +476,7 @@ do -- Group Assignment local TaskGroupName = TaskGroup:GetName() self.AssignedGroups[TaskGroupName] = nil - --self:E( string.format( "Task %s is unassigned to %s", TaskName, TaskGroupName ) ) + --self:F( string.format( "Task %s is unassigned to %s", TaskName, TaskGroupName ) ) -- Set the group to be assigned at mission level. This allows to decide the menu options on mission level for this group. self:GetMission():ClearGroupAssignment( TaskGroup ) @@ -517,7 +517,7 @@ do -- Group Assignment for UnitID, UnitData in pairs( TaskUnits ) do local TaskUnit = UnitData -- Wrapper.Unit#UNIT local PlayerName = TaskUnit:GetPlayerName() - self:E(PlayerName) + self:F(PlayerName) if PlayerName ~= nil and PlayerName ~= "" then self:AssignToUnit( TaskUnit ) CommandCenter:MessageToGroup( @@ -865,7 +865,7 @@ end -- @param Wrapper.Group#GROUP TaskGroup function TASK:MenuAssignToGroup( TaskGroup ) - self:E( "Join Task menu selected") + self:F( "Join Task menu selected") self:AssignToGroup( TaskGroup ) end @@ -875,7 +875,7 @@ end function TASK:MenuMarkToGroup( TaskGroup ) self:F() - self:UpdateTaskInfo() + self:UpdateTaskInfo( self.DetectedItem ) local Report = REPORT:New():SetIndent( 0 ) @@ -981,10 +981,10 @@ end function TASK:RemoveStateMachine( TaskUnit ) self:F( { TaskUnit = TaskUnit:GetName(), HasFsm = ( self.Fsm[TaskUnit] ~= nil ) } ) - --self:E( self.Fsm ) + --self:F( self.Fsm ) --for TaskUnitT, Fsm in pairs( self.Fsm ) do --local Fsm = Fsm -- Core.Fsm#FSM_PROCESS - --self:E( TaskUnitT ) + --self:F( TaskUnitT ) --self.Fsm[TaskUnit] = nil --end @@ -994,7 +994,7 @@ function TASK:RemoveStateMachine( TaskUnit ) end collectgarbage() - self:E( "Garbage Collected, Processes should be finalized now ...") + self:F( "Garbage Collected, Processes should be finalized now ...") end @@ -1186,7 +1186,7 @@ end -- @param #string TaskBriefing -- @return #TASK self function TASK:SetBriefing( TaskBriefing ) - self:E(TaskBriefing) + self:F(TaskBriefing) self.TaskBriefing = TaskBriefing return self end @@ -1210,7 +1210,7 @@ function TASK:onenterAssigned( From, Event, To, PlayerUnit, PlayerName ) --- This test is required, because the state transition will be fired also when the state does not change in case of an event. if From ~= "Assigned" then - self:E( { From, Event, To, PlayerUnit:GetName(), PlayerName } ) + self:F( { From, Event, To, PlayerUnit:GetName(), PlayerName } ) self:GetMission():GetCommandCenter():MessageToCoalition( "Task " .. self:GetName() .. " is assigned." ) @@ -1219,7 +1219,7 @@ function TASK:onenterAssigned( From, Event, To, PlayerUnit, PlayerName ) self:SetGoalTotal() -- Polymorphic to set the initial goal total! if self.Dispatcher then - self:E( "Firing Assign event " ) + self:F( "Firing Assign event " ) self.Dispatcher:Assign( self, PlayerUnit, PlayerName ) end @@ -1230,8 +1230,8 @@ function TASK:onenterAssigned( From, Event, To, PlayerUnit, PlayerName ) self:SetMenu() - self:E( { "--> Task Assigned", TaskName = self:GetName(), Mission = self:GetMission():GetName() } ) - self:E( { "--> Task Player Names", PlayerNames = self:GetPlayerNames() } ) + self:F( { "--> Task Assigned", TaskName = self:GetName(), Mission = self:GetMission():GetName() } ) + self:F( { "--> Task Player Names", PlayerNames = self:GetPlayerNames() } ) end end @@ -1244,8 +1244,8 @@ end -- @param #string To function TASK:onenterSuccess( From, Event, To ) - self:E( { "<-> Task Replanned", TaskName = self:GetName(), Mission = self:GetMission():GetName() } ) - self:E( { "<-> Task Player Names", PlayerNames = self:GetPlayerNames() } ) + self:F( { "<-> Task Replanned", TaskName = self:GetName(), Mission = self:GetMission():GetName() } ) + self:F( { "<-> Task Player Names", PlayerNames = self:GetPlayerNames() } ) self:GetMission():GetCommandCenter():MessageToCoalition( "Task " .. self:GetName() .. " is successful! Good job!" ) self:UnAssignFromGroups() @@ -1262,8 +1262,8 @@ end -- @param #string To function TASK:onenterAborted( From, Event, To ) - self:E( { "<-- Task Aborted", TaskName = self:GetName(), Mission = self:GetMission():GetName() } ) - self:E( { "<-- Task Player Names", PlayerNames = self:GetPlayerNames() } ) + self:F( { "<-- Task Aborted", TaskName = self:GetName(), Mission = self:GetMission():GetName() } ) + self:F( { "<-- Task Player Names", PlayerNames = self:GetPlayerNames() } ) if From ~= "Aborted" then self:GetMission():GetCommandCenter():MessageToCoalition( "Task " .. self:GetName() .. " has been aborted! Task may be replanned." ) @@ -1280,8 +1280,8 @@ end -- @param #string To function TASK:onenterCancelled( From, Event, To ) - self:E( { "<-- Task Cancelled", TaskName = self:GetName(), Mission = self:GetMission():GetName() } ) - self:E( { "<-- Player Names", PlayerNames = self:GetPlayerNames() } ) + self:F( { "<-- Task Cancelled", TaskName = self:GetName(), Mission = self:GetMission():GetName() } ) + self:F( { "<-- Player Names", PlayerNames = self:GetPlayerNames() } ) if From ~= "Cancelled" then self:GetMission():GetCommandCenter():MessageToCoalition( "Task " .. self:GetName() .. " has been cancelled! The tactical situation has changed." ) @@ -1298,8 +1298,8 @@ end -- @param #string To function TASK:onafterReplan( From, Event, To ) - self:E( { "Task Replanned", TaskName = self:GetName(), Mission = self:GetMission():GetName() } ) - self:E( { "Task Player Names", PlayerNames = self:GetPlayerNames() } ) + self:F( { "Task Replanned", TaskName = self:GetName(), Mission = self:GetMission():GetName() } ) + self:F( { "Task Player Names", PlayerNames = self:GetPlayerNames() } ) self:GetMission():GetCommandCenter():MessageToCoalition( "Replanning Task " .. self:GetName() .. "." ) @@ -1314,8 +1314,8 @@ end -- @param #string To function TASK:onenterFailed( From, Event, To ) - self:E( { "Task Failed", TaskName = self:GetName(), Mission = self:GetMission():GetName() } ) - self:E( { "Task Player Names", PlayerNames = self:GetPlayerNames() } ) + self:F( { "Task Failed", TaskName = self:GetName(), Mission = self:GetMission():GetName() } ) + self:F( { "Task Player Names", PlayerNames = self:GetPlayerNames() } ) self:GetMission():GetCommandCenter():MessageToCoalition( "Task " .. self:GetName() .. " has failed!" ) @@ -1336,7 +1336,7 @@ function TASK:onstatechange( From, Event, To ) if self.Scores[To] then local Scoring = self:GetScoring() if Scoring then - self:E( { self.Scores[To].ScoreText, self.Scores[To].Score } ) + self:F( { self.Scores[To].ScoreText, self.Scores[To].Score } ) Scoring:_AddMissionScore( self.Mission, self.Scores[To].ScoreText, self.Scores[To].Score ) end end @@ -1380,14 +1380,14 @@ do -- Links --- Set detection of a task -- @param #TASK self -- @param Function.Detection#DETECTION_BASE Detection - -- @param #number DetectedItemIndex + -- @param DetectedItem -- @return #TASK - function TASK:SetDetection( Detection, DetectedItemIndex ) + function TASK:SetDetection( Detection, DetectedItem ) - self:E({DetectedItemIndex,Detection}) + self:F( { DetectedItem, Detection } ) self.Detection = Detection - self.DetectedItemIndex = DetectedItemIndex + self.DetectedItem = DetectedItem end end @@ -1420,7 +1420,7 @@ end -- @return #string function TASK:ReportOverview( ReportGroup ) - self:UpdateTaskInfo() + self:UpdateTaskInfo( self.DetectedItem ) -- List the name of the Task. local TaskName = self:GetName() @@ -1480,7 +1480,7 @@ end -- @return #string function TASK:ReportDetails( ReportGroup ) - self:UpdateTaskInfo() + self:UpdateTaskInfo( self.DetectedItem ) local Report = REPORT:New():SetIndent( 3 ) diff --git a/Moose Development/Moose/Tasking/TaskInfo.lua b/Moose Development/Moose/Tasking/TaskInfo.lua index 1826df2d2..df0160747 100644 --- a/Moose Development/Moose/Tasking/TaskInfo.lua +++ b/Moose Development/Moose/Tasking/TaskInfo.lua @@ -283,7 +283,7 @@ function TASKINFO:Report( Report, Detail, ReportGroup ) for Key, Data in UTILS.spairs( self.Info.Set, function( t, a, b ) return t[a].Order < t[b].Order end ) do - self:E( { Key = Key, Detail = Detail, Data = Data } ) + self:F( { Key = Key, Detail = Detail, Data = Data } ) if Data.Detail:find( Detail ) then local Text = "" diff --git a/Moose Development/Moose/Tasking/TaskZoneCapture.lua b/Moose Development/Moose/Tasking/TaskZoneCapture.lua index 6fa20c48c..e897e0e2e 100644 --- a/Moose Development/Moose/Tasking/TaskZoneCapture.lua +++ b/Moose Development/Moose/Tasking/TaskZoneCapture.lua @@ -77,7 +77,7 @@ do -- TASK_ZONE_GOAL -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task#TASK_ZONE_GOAL Task function Fsm:onafterStartMonitoring( TaskUnit, Task ) - self:E( { self } ) + self:F( { self } ) self:__Monitor( 0.1 ) self:__RouteTo( 0.1 ) end @@ -87,7 +87,7 @@ do -- TASK_ZONE_GOAL -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task#TASK_ZONE_GOAL Task function Fsm:onafterMonitor( TaskUnit, Task ) - self:E( { self } ) + self:F( { self } ) self:__Monitor( 15 ) end @@ -96,7 +96,7 @@ do -- TASK_ZONE_GOAL -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_A2G#TASK_ZONE_GOAL Task function Fsm:onafterRouteTo( TaskUnit, Task ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) -- Determine the first Unit from the self.TargetSetUnit if Task:GetTargetZone( TaskUnit ) then @@ -236,14 +236,14 @@ do -- TASK_ZONE_CAPTURE -- @param Wrapper.Unit#UNIT TaskUnit function TASK_ZONE_CAPTURE:OnAfterGoal( From, Event, To, PlayerUnit, PlayerName ) - self:E( { PlayerUnit = PlayerUnit } ) + self:F( { PlayerUnit = PlayerUnit } ) if self.ZoneGoal then if self.ZoneGoal.Goal:IsAchieved() then self:Success() local TotalContributions = self.ZoneGoal.Goal:GetTotalContributions() local PlayerContributions = self.ZoneGoal.Goal:GetPlayerContributions() - self:E( { TotalContributions = TotalContributions, PlayerContributions = PlayerContributions } ) + self:F( { TotalContributions = TotalContributions, PlayerContributions = PlayerContributions } ) for PlayerName, PlayerContribution in pairs( PlayerContributions ) do local Scoring = self:GetScoring() if Scoring then diff --git a/Moose Development/Moose/Tasking/Task_A2A.lua b/Moose Development/Moose/Tasking/Task_A2A.lua index e94e88a43..cd6f74022 100644 --- a/Moose Development/Moose/Tasking/Task_A2A.lua +++ b/Moose Development/Moose/Tasking/Task_A2A.lua @@ -90,7 +90,7 @@ do -- TASK_A2A -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_A2A#TASK_A2A Task function Fsm:onafterRouteToRendezVous( TaskUnit, Task ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) -- Determine the first Unit from the self.RendezVousSetUnit if Task:GetRendezVousZone( TaskUnit ) then @@ -109,7 +109,7 @@ do -- TASK_A2A -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task#TASK_A2A Task function Fsm:OnAfterArriveAtRendezVous( TaskUnit, Task ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) -- Determine the first Unit from the self.TargetSetUnit self:__Engage( 0.1 ) @@ -120,7 +120,7 @@ do -- TASK_A2A -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task#TASK_A2A Task function Fsm:onafterEngage( TaskUnit, Task ) - self:E( { self } ) + self:F( { self } ) self:__Account( 0.1 ) self:__RouteToTarget(0.1 ) self:__RouteToTargets( -10 ) @@ -131,7 +131,7 @@ do -- TASK_A2A -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_A2A#TASK_A2A Task function Fsm:onafterRouteToTarget( TaskUnit, Task ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) -- Determine the first Unit from the self.TargetSetUnit if Task:GetTargetZone( TaskUnit ) then @@ -152,7 +152,7 @@ do -- TASK_A2A -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_A2A#TASK_A2A Task function Fsm:onafterRouteToTargets( TaskUnit, Task ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) local TargetUnit = Task.TargetSetUnit:GetFirst() -- Wrapper.Unit#UNIT if TargetUnit then Task:SetTargetCoordinate( TargetUnit:GetCoordinate(), TaskUnit ) @@ -308,16 +308,16 @@ do -- TASK_A2A --- @param #TASK_A2A self - function TASK_A2A:UpdateTaskInfo() + function TASK_A2A:UpdateTaskInfo( DetectedItem ) if self:IsStatePlanned() or self:IsStateAssigned() then - local TargetCoordinate = self.Detection and self.Detection:GetDetectedItemCoordinate( self.DetectedItemIndex ) or self.TargetSetUnit:GetFirst():GetCoordinate() + local TargetCoordinate = DetectedItem and self.Detection:GetDetectedItemCoordinate( DetectedItem ) or self.TargetSetUnit:GetFirst():GetCoordinate() self.TaskInfo:AddTaskName( 0, "MSOD" ) self.TaskInfo:AddCoordinate( TargetCoordinate, 1, "SOD" ) local ThreatLevel, ThreatText - if self.Detection then - ThreatLevel, ThreatText = self.Detection:GetDetectedItemThreatLevel( self.DetectedItemIndex ) + if DetectedItem then + ThreatLevel, ThreatText = self.Detection:GetDetectedItemThreatLevel( DetectedItem ) else ThreatLevel, ThreatText = self.TargetSetUnit:CalculateThreatLevelA2G() end diff --git a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua index eb96a4761..ce227ce24 100644 --- a/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua +++ b/Moose Development/Moose/Tasking/Task_A2A_Dispatcher.lua @@ -376,7 +376,7 @@ do -- TASK_A2A_DISPATCHER local DetectedSet = DetectedItem.Set -- Core.Set#SET_UNIT --DetectedSet:Flush() - --self:E( { DetectedSetCount = DetectedSet:Count() } ) + --self:F( { DetectedSetCount = DetectedSet:Count() } ) if DetectedSet:Count() == 0 then Remove = true end @@ -418,7 +418,7 @@ do -- TASK_A2A_DISPATCHER end - --self:E( { FriendliesCount = FriendliesCount } ) + --self:F( { FriendliesCount = FriendliesCount } ) local FriendlyTypesReport = REPORT:New() @@ -451,7 +451,7 @@ do -- TASK_A2A_DISPATCHER for PlayerUnitName, PlayerUnitData in pairs( PlayersNearBy ) do local PlayerUnit = PlayerUnitData -- Wrapper.Unit#UNIT local PlayerName = PlayerUnit:GetPlayerName() - --self:E( { PlayerName = PlayerName, PlayerUnit = PlayerUnit } ) + --self:F( { PlayerName = PlayerName, PlayerUnit = PlayerUnit } ) if PlayerUnit:IsAirPlane() and PlayerName ~= nil then local FriendlyUnitThreatLevel = PlayerUnit:GetThreatLevel() PlayersCount = PlayersCount + 1 @@ -464,8 +464,6 @@ do -- TASK_A2A_DISPATCHER end - --self:E( { PlayersCount = PlayersCount } ) - local PlayerTypesReport = REPORT:New() if PlayersCount > 0 then @@ -491,7 +489,7 @@ do -- TASK_A2A_DISPATCHER -- @param Functional.Detection#DETECTION_BASE Detection The detection created by the @{Detection#DETECTION_BASE} derived object. -- @return #boolean Return true if you want the task assigning to continue... false will cancel the loop. function TASK_A2A_DISPATCHER:ProcessDetected( Detection ) - self:E() + self:F() local AreaMsg = {} local TaskMsg = {} @@ -507,7 +505,7 @@ do -- TASK_A2A_DISPATCHER for TaskIndex, TaskData in pairs( self.Tasks ) do local Task = TaskData -- Tasking.Task#TASK if Task:IsStatePlanned() then - local DetectedItem = Detection:GetDetectedItem( TaskIndex ) + local DetectedItem = Detection:GetDetectedItemByIndex( TaskIndex ) if not DetectedItem then local TaskText = Task:GetName() for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do @@ -525,7 +523,7 @@ do -- TASK_A2A_DISPATCHER local DetectedSet = DetectedItem.Set -- Core.Set#SET_UNIT local DetectedCount = DetectedSet:Count() local DetectedZone = DetectedItem.Zone - --self:E( { "Targets in DetectedItem", DetectedItem.ItemID, DetectedSet:Count(), tostring( DetectedItem ) } ) + --self:F( { "Targets in DetectedItem", DetectedItem.ItemID, DetectedSet:Count(), tostring( DetectedItem ) } ) --DetectedSet:Flush() local DetectedID = DetectedItem.ID @@ -540,17 +538,17 @@ do -- TASK_A2A_DISPATCHER local TargetSetUnit = self:EvaluateENGAGE( DetectedItem ) -- Returns a SetUnit if there are targets to be INTERCEPTed... if TargetSetUnit then Task = TASK_A2A_ENGAGE:New( Mission, self.SetGroup, string.format( "ENGAGE.%03d", DetectedID ), TargetSetUnit ) - Task:SetDetection( Detection, TaskIndex ) + Task:SetDetection( Detection, DetectedItem ) else local TargetSetUnit = self:EvaluateINTERCEPT( DetectedItem ) -- Returns a SetUnit if there are targets to be INTERCEPTed... if TargetSetUnit then Task = TASK_A2A_INTERCEPT:New( Mission, self.SetGroup, string.format( "INTERCEPT.%03d", DetectedID ), TargetSetUnit ) - Task:SetDetection( Detection, TaskIndex ) + Task:SetDetection( Detection, DetectedItem ) else local TargetSetUnit = self:EvaluateSWEEP( DetectedItem ) -- Returns a SetUnit if TargetSetUnit then Task = TASK_A2A_SWEEP:New( Mission, self.SetGroup, string.format( "SWEEP.%03d", DetectedID ), TargetSetUnit ) - Task:SetDetection( Detection, TaskIndex ) + Task:SetDetection( Detection, DetectedItem ) end end end @@ -563,7 +561,7 @@ do -- TASK_A2A_DISPATCHER TaskReport:Add( Task:GetName() ) else - self:E("This should not happen") + self:F("This should not happen") end end diff --git a/Moose Development/Moose/Tasking/Task_A2G.lua b/Moose Development/Moose/Tasking/Task_A2G.lua index 4fcb4a873..c9737759a 100644 --- a/Moose Development/Moose/Tasking/Task_A2G.lua +++ b/Moose Development/Moose/Tasking/Task_A2G.lua @@ -90,7 +90,7 @@ do -- TASK_A2G -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_A2G#TASK_A2G Task function Fsm:onafterRouteToRendezVous( TaskUnit, Task ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) -- Determine the first Unit from the self.RendezVousSetUnit if Task:GetRendezVousZone( TaskUnit ) then @@ -109,7 +109,7 @@ do -- TASK_A2G -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task#TASK_A2G Task function Fsm:OnAfterArriveAtRendezVous( TaskUnit, Task ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) -- Determine the first Unit from the self.TargetSetUnit self:__Engage( 0.1 ) @@ -120,7 +120,7 @@ do -- TASK_A2G -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task#TASK_A2G Task function Fsm:onafterEngage( TaskUnit, Task ) - self:E( { self } ) + self:F( { self } ) self:__Account( 0.1 ) self:__RouteToTarget(0.1 ) self:__RouteToTargets( -10 ) @@ -131,7 +131,7 @@ do -- TASK_A2G -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_A2G#TASK_A2G Task function Fsm:onafterRouteToTarget( TaskUnit, Task ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) -- Determine the first Unit from the self.TargetSetUnit if Task:GetTargetZone( TaskUnit ) then @@ -152,7 +152,7 @@ do -- TASK_A2G -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_A2G#TASK_A2G Task function Fsm:onafterRouteToTargets( TaskUnit, Task ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) local TargetUnit = Task.TargetSetUnit:GetFirst() -- Wrapper.Unit#UNIT if TargetUnit then Task:SetTargetCoordinate( TargetUnit:GetCoordinate(), TaskUnit ) @@ -307,16 +307,16 @@ do -- TASK_A2G end --- @param #TASK_A2G self - function TASK_A2G:UpdateTaskInfo() + function TASK_A2G:UpdateTaskInfo( DetectedItem ) if self:IsStatePlanned() or self:IsStateAssigned() then - local TargetCoordinate = self.Detection and self.Detection:GetDetectedItemCoordinate( self.DetectedItemIndex ) or self.TargetSetUnit:GetFirst():GetCoordinate() + local TargetCoordinate = DetectedItem and self.Detection:GetDetectedItemCoordinate( DetectedItem ) or self.TargetSetUnit:GetFirst():GetCoordinate() self.TaskInfo:AddTaskName( 0, "MSOD" ) self.TaskInfo:AddCoordinate( TargetCoordinate, 1, "SOD" ) local ThreatLevel, ThreatText - if self.Detection then - ThreatLevel, ThreatText = self.Detection:GetDetectedItemThreatLevel( self.DetectedItemIndex ) + if DetectedItem then + ThreatLevel, ThreatText = self.Detection:GetDetectedItemThreatLevel( DetectedItem ) else ThreatLevel, ThreatText = self.TargetSetUnit:CalculateThreatLevelA2G() end diff --git a/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua b/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua index 92a461602..45749b2b9 100644 --- a/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua +++ b/Moose Development/Moose/Tasking/Task_A2G_Dispatcher.lua @@ -573,7 +573,7 @@ do -- TASK_A2G_DISPATCHER if Task then if ( Task:IsStatePlanned() and DetectedItemChanged == true ) or Task:IsStateCancelled() then - --self:E( "Removing Tasking: " .. Task:GetTaskName() ) + --self:F( "Removing Tasking: " .. Task:GetTaskName() ) self:RemoveTask( TaskIndex ) end end @@ -587,7 +587,7 @@ do -- TASK_A2G_DISPATCHER -- @param Functional.Detection#DETECTION_BASE Detection The detection created by the @{Detection#DETECTION_BASE} derived object. -- @return #boolean Return true if you want the task assigning to continue... false will cancel the loop. function TASK_A2G_DISPATCHER:ProcessDetected( Detection ) - self:E() + self:F() local AreaMsg = {} local TaskMsg = {} @@ -603,7 +603,7 @@ do -- TASK_A2G_DISPATCHER for TaskIndex, TaskData in pairs( self.Tasks ) do local Task = TaskData -- Tasking.Task#TASK if Task:IsStatePlanned() then - local DetectedItem = Detection:GetDetectedItem( TaskIndex ) + local DetectedItem = Detection:GetDetectedItemByIndex( TaskIndex ) if not DetectedItem then local TaskText = Task:GetName() for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do @@ -620,14 +620,14 @@ do -- TASK_A2G_DISPATCHER local DetectedItem = DetectedItem -- Functional.Detection#DETECTION_BASE.DetectedItem local DetectedSet = DetectedItem.Set -- Core.Set#SET_UNIT local DetectedZone = DetectedItem.Zone - --self:E( { "Targets in DetectedItem", DetectedItem.ItemID, DetectedSet:Count(), tostring( DetectedItem ) } ) + --self:F( { "Targets in DetectedItem", DetectedItem.ItemID, DetectedSet:Count(), tostring( DetectedItem ) } ) --DetectedSet:Flush() local DetectedItemID = DetectedItem.ID local TaskIndex = DetectedItem.ID local DetectedItemChanged = DetectedItem.Changed - self:E( { DetectedItemChanged = DetectedItemChanged, DetectedItemID = DetectedItemID, TaskIndex = TaskIndex } ) + self:F( { DetectedItemChanged = DetectedItemChanged, DetectedItemID = DetectedItemID, TaskIndex = TaskIndex } ) local Task = self.Tasks[TaskIndex] -- Tasking.Task_A2G#TASK_A2G @@ -640,7 +640,7 @@ do -- TASK_A2G_DISPATCHER if TargetSetUnit then if Task:IsInstanceOf( TASK_A2G_SEAD ) then Task:SetTargetSetUnit( TargetSetUnit ) - Task:UpdateTaskInfo() + Task:UpdateTaskInfo( DetectedItem ) TargetsReport:Add( Detection:GetChangeText( DetectedItem ) ) else Task:Cancel() @@ -651,7 +651,7 @@ do -- TASK_A2G_DISPATCHER if Task:IsInstanceOf( TASK_A2G_CAS ) then Task:SetTargetSetUnit( TargetSetUnit ) Task:SetDetection( Detection, TaskIndex ) - Task:UpdateTaskInfo() + Task:UpdateTaskInfo( DetectedItem ) TargetsReport:Add( Detection:GetChangeText( DetectedItem ) ) else Task:Cancel() @@ -663,7 +663,7 @@ do -- TASK_A2G_DISPATCHER if Task:IsInstanceOf( TASK_A2G_BAI ) then Task:SetTargetSetUnit( TargetSetUnit ) Task:SetDetection( Detection, TaskIndex ) - Task:UpdateTaskInfo() + Task:UpdateTaskInfo( DetectedItem ) TargetsReport:Add( Detection:GetChangeText( DetectedItem ) ) else Task:Cancel() @@ -691,7 +691,8 @@ do -- TASK_A2G_DISPATCHER local TargetSetUnit = self:EvaluateSEAD( DetectedItem ) -- Returns a SetUnit if there are targets to be SEADed... if TargetSetUnit then Task:SetTargetSetUnit( TargetSetUnit ) - Task:UpdateTaskInfo() + Task:SetDetection( Detection, DetectedItem ) + Task:UpdateTaskInfo( DetectedItem ) else Task:Cancel() Task = self:RemoveTask( TaskIndex ) @@ -701,8 +702,8 @@ do -- TASK_A2G_DISPATCHER local TargetSetUnit = self:EvaluateCAS( DetectedItem ) -- Returns a SetUnit if there are targets to be CASed... if TargetSetUnit then Task:SetTargetSetUnit( TargetSetUnit ) - Task:SetDetection( Detection, TaskIndex ) - Task:UpdateTaskInfo() + Task:SetDetection( Detection, DetectedItem ) + Task:UpdateTaskInfo( DetectedItem ) else Task:Cancel() Task = self:RemoveTask( TaskIndex ) @@ -712,8 +713,8 @@ do -- TASK_A2G_DISPATCHER local TargetSetUnit = self:EvaluateBAI( DetectedItem ) -- Returns a SetUnit if there are targets to be BAIed... if TargetSetUnit then Task:SetTargetSetUnit( TargetSetUnit ) - Task:SetDetection( Detection, TaskIndex ) - Task:UpdateTaskInfo() + Task:SetDetection( Detection, DetectedItem ) + Task:UpdateTaskInfo( DetectedItem ) else Task:Cancel() Task = self:RemoveTask( TaskIndex ) @@ -733,7 +734,7 @@ do -- TASK_A2G_DISPATCHER local TargetSetUnit = self:EvaluateSEAD( DetectedItem ) -- Returns a SetUnit if there are targets to be SEADed... if TargetSetUnit then Task = TASK_A2G_SEAD:New( Mission, self.SetGroup, string.format( "SEAD.%03d", DetectedItemID ), TargetSetUnit ) - Task:SetDetection( Detection, TaskIndex ) + Task:SetDetection( Detection, DetectedItem ) end -- Evaluate CAS @@ -741,7 +742,7 @@ do -- TASK_A2G_DISPATCHER local TargetSetUnit = self:EvaluateCAS( DetectedItem ) -- Returns a SetUnit if there are targets to be CASed... if TargetSetUnit then Task = TASK_A2G_CAS:New( Mission, self.SetGroup, string.format( "CAS.%03d", DetectedItemID ), TargetSetUnit ) - Task:SetDetection( Detection, TaskIndex ) + Task:SetDetection( Detection, DetectedItem ) end -- Evaluate BAI @@ -749,7 +750,7 @@ do -- TASK_A2G_DISPATCHER local TargetSetUnit = self:EvaluateBAI( DetectedItem, self.Mission:GetCommandCenter():GetPositionable():GetCoalition() ) -- Returns a SetUnit if there are targets to be BAIed... if TargetSetUnit then Task = TASK_A2G_BAI:New( Mission, self.SetGroup, string.format( "BAI.%03d", DetectedItemID ), TargetSetUnit ) - Task:SetDetection( Detection, TaskIndex ) + Task:SetDetection( Detection, DetectedItem ) end end end @@ -758,12 +759,12 @@ do -- TASK_A2G_DISPATCHER self.Tasks[TaskIndex] = Task Task:SetTargetZone( DetectedZone ) Task:SetDispatcher( self ) - Task:UpdateTaskInfo() + Task:UpdateTaskInfo( DetectedItem ) Mission:AddTask( Task ) TaskReport:Add( Task:GetName() ) else - self:E("This should not happen") + self:F("This should not happen") end end diff --git a/Moose Development/Moose/Tasking/Task_CARGO.lua b/Moose Development/Moose/Tasking/Task_CARGO.lua index 9cc545f6b..a138e2a0f 100644 --- a/Moose Development/Moose/Tasking/Task_CARGO.lua +++ b/Moose Development/Moose/Tasking/Task_CARGO.lua @@ -212,7 +212,7 @@ do -- TASK_CARGO local TaskUnitName = TaskUnit:GetName() - self:E( { TaskUnit = TaskUnitName, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnitName, Task = Task and Task:GetClassNameAndID() } ) local MenuTime = timer.getTime() @@ -296,7 +296,7 @@ do -- TASK_CARGO -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_Cargo#TASK_CARGO Task function Fsm:OnLeaveWaitingForCommand( TaskUnit, Task ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) TaskUnit.Menu:Remove() end @@ -332,7 +332,7 @@ do -- TASK_CARGO -- @param To -- @param Core.Cargo#CARGO Cargo function Fsm:onafterRouteToPickup( TaskUnit, Task, From, Event, To, Cargo ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) if Cargo:IsAlive() then self.Cargo = Cargo -- Core.Cargo#CARGO @@ -348,7 +348,7 @@ do -- TASK_CARGO -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_Cargo#TASK_CARGO Task function Fsm:onafterArriveAtPickup( TaskUnit, Task ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) if self.Cargo:IsAlive() then self.Cargo:Smoke( Task:GetSmokeColor(), 15 ) if TaskUnit:IsAir() then @@ -365,7 +365,7 @@ do -- TASK_CARGO -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_Cargo#TASK_CARGO Task function Fsm:onafterCancelRouteToPickup( TaskUnit, Task ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) self:__SelectAction( -0.1 ) end @@ -374,9 +374,9 @@ do -- TASK_CARGO --- @param #FSM_PROCESS self -- @param Wrapper.Unit#UNIT TaskUnit function Fsm:onafterRouteToDeploy( TaskUnit, Task, From, Event, To, DeployZone ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) - self:E( DeployZone ) + self:F( DeployZone ) self.DeployZone = DeployZone Task:SetDeployZone( self.DeployZone, TaskUnit ) self:__RouteToDeployZone( -0.1 ) @@ -387,7 +387,7 @@ do -- TASK_CARGO -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_Cargo#TASK_CARGO Task function Fsm:onafterArriveAtDeploy( TaskUnit, Task ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) if TaskUnit:IsAir() then Task:GetMission():GetCommandCenter():MessageToGroup( "Land", TaskUnit:GetGroup() ) @@ -402,7 +402,7 @@ do -- TASK_CARGO -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_Cargo#TASK_CARGO Task function Fsm:onafterCancelRouteToDeploy( TaskUnit, Task ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) self:__SelectAction( -0.1 ) end @@ -413,7 +413,7 @@ do -- TASK_CARGO -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_Cargo#TASK_CARGO Task function Fsm:onafterLand( TaskUnit, Task, From, Event, To, Action ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) if self.Cargo:IsAlive() then if self.Cargo:IsInRadius( TaskUnit:GetPointVec2() ) then @@ -437,7 +437,7 @@ do -- TASK_CARGO -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_Cargo#TASK_CARGO Task function Fsm:onafterLanded( TaskUnit, Task, From, Event, To, Action ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) if self.Cargo:IsAlive() then if self.Cargo:IsInRadius( TaskUnit:GetPointVec2() ) then @@ -460,7 +460,7 @@ do -- TASK_CARGO -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_Cargo#TASK_CARGO Task function Fsm:onafterPrepareBoarding( TaskUnit, Task, From, Event, To, Cargo ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) if Cargo and Cargo:IsAlive() then self.Cargo = Cargo -- Core.Cargo#CARGO_GROUP @@ -472,10 +472,10 @@ do -- TASK_CARGO -- @param Wrapper.Unit#UNIT TaskUnit -- @param Tasking.Task_Cargo#TASK_CARGO Task function Fsm:onafterBoard( TaskUnit, Task ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID() } ) function self.Cargo:OnEnterLoaded( From, Event, To, TaskUnit, TaskProcess ) - self:E({From, Event, To, TaskUnit, TaskProcess }) + self:F({From, Event, To, TaskUnit, TaskProcess }) TaskProcess:__Boarded( 0.1 ) end @@ -502,7 +502,7 @@ do -- TASK_CARGO function Fsm:onafterBoarded( TaskUnit, Task ) local TaskUnitName = TaskUnit:GetName() - self:E( { TaskUnit = TaskUnitName, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnitName, Task = Task and Task:GetClassNameAndID() } ) self.Cargo:MessageToGroup( "Boarded ...", TaskUnit:GetGroup() ) @@ -531,7 +531,7 @@ do -- TASK_CARGO -- @param Cargo -- @param Core.Zone#ZONE_BASE DeployZone function Fsm:onafterPrepareUnBoarding( TaskUnit, Task, From, Event, To, Cargo ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID(), From, Event, To, Cargo } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID(), From, Event, To, Cargo } ) self.Cargo = Cargo self.DeployZone = nil @@ -558,10 +558,10 @@ do -- TASK_CARGO -- @param Cargo -- @param Core.Zone#ZONE_BASE DeployZone function Fsm:onafterUnBoard( TaskUnit, Task, From, Event, To, Cargo, DeployZone ) - self:E( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID(), From, Event, To, Cargo, DeployZone } ) + self:F( { TaskUnit = TaskUnit, Task = Task and Task:GetClassNameAndID(), From, Event, To, Cargo, DeployZone } ) function self.Cargo:OnEnterUnLoaded( From, Event, To, DeployZone, TaskProcess ) - self:E({From, Event, To, DeployZone, TaskProcess }) + self:F({From, Event, To, DeployZone, TaskProcess }) TaskProcess:__UnBoarded( -0.1 ) end @@ -583,7 +583,7 @@ do -- TASK_CARGO function Fsm:onafterUnBoarded( TaskUnit, Task ) local TaskUnitName = TaskUnit:GetName() - self:E( { TaskUnit = TaskUnitName, Task = Task and Task:GetClassNameAndID() } ) + self:F( { TaskUnit = TaskUnitName, Task = Task and Task:GetClassNameAndID() } ) self.Cargo:MessageToGroup( "UnBoarded ...", TaskUnit:GetGroup() ) @@ -810,7 +810,7 @@ do -- TASK_CARGO end --- @param #TASK_CARGO self - function TASK_CARGO:UpdateTaskInfo() + function TASK_CARGO:UpdateTaskInfo( DetectedItem ) if self:IsStatePlanned() or self:IsStateAssigned() then self.TaskInfo:AddTaskName( 0, "MSOD" ) @@ -855,7 +855,7 @@ do -- TASK_CARGO_TRANSPORT self:AddTransition( "*", "CargoPickedUp", "*" ) self:AddTransition( "*", "CargoDeployed", "*" ) - self:E( { CargoDeployed = self.CargoDeployed ~= nil and "true" or "false" } ) + self:F( { CargoDeployed = self.CargoDeployed ~= nil and "true" or "false" } ) --- OnBefore Transition Handler for Event CargoPickedUp. -- @function [parent=#TASK_CARGO_TRANSPORT] OnBeforeCargoPickedUp diff --git a/Moose Development/Moose/Utilities/Utils.lua b/Moose Development/Moose/Utilities/Utils.lua index e1bea66d9..e7f730ad1 100644 --- a/Moose Development/Moose/Utilities/Utils.lua +++ b/Moose Development/Moose/Utilities/Utils.lua @@ -71,7 +71,6 @@ UTILS.IsInstanceOf = function( object, className ) -- I'm not sure if this should take advantage of MOOSE logging function, or throw an error for pcall local err_str = 'className parameter should be a string; parameter received: '..type( className ) - self:E( err_str ) return false -- error( err_str ) diff --git a/Moose Development/Moose/Wrapper/Client.lua b/Moose Development/Moose/Wrapper/Client.lua index 74cd6b741..3b20fb754 100644 --- a/Moose Development/Moose/Wrapper/Client.lua +++ b/Moose Development/Moose/Wrapper/Client.lua @@ -143,7 +143,7 @@ function CLIENT:Register( ClientName ) --self.AliveCheckScheduler = routines.scheduleFunction( self._AliveCheckScheduler, { self }, timer.getTime() + 1, 5 ) self.AliveCheckScheduler = SCHEDULER:New( self, self._AliveCheckScheduler, { "Client Alive " .. ClientName }, 1, 5 ) - self:E( self ) + self:F( self ) return self end @@ -296,7 +296,7 @@ function CLIENT:GetDCSGroup() self:T3( { "UnitData:", UnitData } ) if UnitData and UnitData:isExist() then - --self:E(self.ClientName) + --self:F(self.ClientName) if ClientUnit then local ClientGroup = ClientUnit:getGroup() if ClientGroup then @@ -323,7 +323,7 @@ function CLIENT:GetDCSGroup() -- error( "Client " .. self.ClientName .. " not found!" ) end else - --self:E( { "Client not found!", self.ClientName } ) + --self:F( { "Client not found!", self.ClientName } ) end end end @@ -357,7 +357,7 @@ function CLIENT:GetClientGroupID() local ClientGroup = self:GetDCSGroup() - --self:E( self.ClientGroupID ) -- Determined in GetDCSGroup() + --self:F( self.ClientGroupID ) -- Determined in GetDCSGroup() return self.ClientGroupID end diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index a6c207eb5..90e11151d 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -1647,7 +1647,7 @@ do -- Patrol methods PatrolGroup = self:GetGroup() -- Wrapper.Group#GROUP end - self:E( { PatrolGroup = PatrolGroup:GetName() } ) + self:F( { PatrolGroup = PatrolGroup:GetName() } ) if PatrolGroup:IsGround() or PatrolGroup:IsShip() then @@ -1661,7 +1661,7 @@ do -- Patrol methods local TaskRoute = PatrolGroup:TaskFunction( "CONTROLLABLE.PatrolRoute" ) - self:E({Waypoints = Waypoints}) + self:F({Waypoints = Waypoints}) local Waypoint = Waypoints[#Waypoints] PatrolGroup:SetTaskWaypoint( Waypoint, TaskRoute ) -- Set for the given Route at Waypoint 2 the TaskRouteToZone. @@ -1681,7 +1681,7 @@ do -- Patrol methods PatrolGroup = self:GetGroup() -- Wrapper.Group#GROUP end - self:E( { PatrolGroup = PatrolGroup:GetName() } ) + self:F( { PatrolGroup = PatrolGroup:GetName() } ) if PatrolGroup:IsGround() or PatrolGroup:IsShip() then @@ -1702,7 +1702,7 @@ do -- Patrol methods -- Select a random waypoint and check if it is not the same waypoint as where the object is about. ToWaypoint = math.random( 1, #Waypoints ) until( ToWaypoint ~= FromWaypoint ) - self:E( { FromWaypoint = FromWaypoint, ToWaypoint = ToWaypoint } ) + self:F( { FromWaypoint = FromWaypoint, ToWaypoint = ToWaypoint } ) local Waypoint = Waypoints[ToWaypoint] -- Select random waypoint. local ToCoord = COORDINATE:NewFromVec2( { x = Waypoint.x, y = Waypoint.y } ) @@ -1736,7 +1736,7 @@ do -- Patrol methods PatrolGroup = self:GetGroup() -- Wrapper.Group#GROUP end - self:E( { PatrolGroup = PatrolGroup:GetName() } ) + self:F( { PatrolGroup = PatrolGroup:GetName() } ) if PatrolGroup:IsGround() or PatrolGroup:IsShip() then diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index 2c3f8f271..5c9e48b87 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -1063,13 +1063,13 @@ function GROUP:Respawn( Template, Reset ) --Template.x = nil --Template.y = nil - self:E( #Template.units ) + self:F( #Template.units ) if Reset == true then for UnitID, UnitData in pairs( self:GetUnits() ) do local GroupUnit = UnitData -- Wrapper.Unit#UNIT - self:E( GroupUnit:GetName() ) + self:F( GroupUnit:GetName() ) if GroupUnit:IsAlive() then - self:E( "Alive" ) + self:F( "Alive" ) local GroupUnitVec3 = GroupUnit:GetVec3() if Zone then if self.InitRespawnRandomizePositionZone then @@ -1087,12 +1087,12 @@ function GROUP:Respawn( Template, Reset ) Template.units[UnitID].x = ( Template.units[UnitID].x - From.x ) + GroupUnitVec3.x -- Keep the original x position of the template and translate to the new position. Template.units[UnitID].y = ( Template.units[UnitID].y - From.y ) + GroupUnitVec3.z -- Keep the original z position of the template and translate to the new position. Template.units[UnitID].heading = self.InitRespawnHeading and self.InitRespawnHeading or GroupUnit:GetHeading() - self:E( { UnitID, Template.units[UnitID], Template.units[UnitID] } ) + self:F( { UnitID, Template.units[UnitID], Template.units[UnitID] } ) end end else for UnitID, TemplateUnitData in pairs( Template.units ) do - self:E( "Reset" ) + self:F( "Reset" ) local GroupUnitVec3 = { x = TemplateUnitData.x, y = TemplateUnitData.alt, z = TemplateUnitData.z } if Zone then if self.InitRespawnRandomizePositionZone then @@ -1110,7 +1110,7 @@ function GROUP:Respawn( Template, Reset ) Template.units[UnitID].x = ( Template.units[UnitID].x - From.x ) + GroupUnitVec3.x -- Keep the original x position of the template and translate to the new position. Template.units[UnitID].y = ( Template.units[UnitID].y - From.y ) + GroupUnitVec3.z -- Keep the original z position of the template and translate to the new position. Template.units[UnitID].heading = self.InitRespawnHeading and self.InitRespawnHeading or TemplateUnitData.heading - self:E( { UnitID, Template.units[UnitID], Template.units[UnitID] } ) + self:F( { UnitID, Template.units[UnitID], Template.units[UnitID] } ) end end @@ -1281,7 +1281,7 @@ do -- Route methods AirbaseAirPoint["airdromeId"] = RTBAirbase:GetID() AirbaseAirPoint["speed_locked"] = true, - self:E(AirbaseAirPoint ) + self:F(AirbaseAirPoint ) local Points = { PointFrom, AirbaseAirPoint } diff --git a/Moose Development/Moose/Wrapper/Identifiable.lua b/Moose Development/Moose/Wrapper/Identifiable.lua index cd86668c0..fe14a8b9d 100644 --- a/Moose Development/Moose/Wrapper/Identifiable.lua +++ b/Moose Development/Moose/Wrapper/Identifiable.lua @@ -103,7 +103,7 @@ function IDENTIFIABLE:GetTypeName() return IdentifiableTypeName end - self:E( self.ClassName .. " " .. self.IdentifiableName .. " not found!" ) + self:F( self.ClassName .. " " .. self.IdentifiableName .. " not found!" ) return nil end @@ -136,7 +136,7 @@ function IDENTIFIABLE:GetCategoryName() return IdentifiableCategoryName end - self:E( self.ClassName .. " " .. self.IdentifiableName .. " not found!" ) + self:F( self.ClassName .. " " .. self.IdentifiableName .. " not found!" ) return nil end @@ -155,7 +155,7 @@ function IDENTIFIABLE:GetCoalition() return IdentifiableCoalition end - self:E( self.ClassName .. " " .. self.IdentifiableName .. " not found!" ) + self:F( self.ClassName .. " " .. self.IdentifiableName .. " not found!" ) return nil end @@ -185,7 +185,7 @@ function IDENTIFIABLE:GetCoalitionName() end end - self:E( self.ClassName .. " " .. self.IdentifiableName .. " not found!" ) + self:F( self.ClassName .. " " .. self.IdentifiableName .. " not found!" ) return nil end @@ -204,7 +204,7 @@ function IDENTIFIABLE:GetCountry() return IdentifiableCountry end - self:E( self.ClassName .. " " .. self.IdentifiableName .. " not found!" ) + self:F( self.ClassName .. " " .. self.IdentifiableName .. " not found!" ) return nil end @@ -225,7 +225,7 @@ function IDENTIFIABLE:GetDesc() return IdentifiableDesc end - self:E( self.ClassName .. " " .. self.IdentifiableName .. " not found!" ) + self:F( self.ClassName .. " " .. self.IdentifiableName .. " not found!" ) return nil end diff --git a/Moose Development/Moose/Wrapper/Positionable.lua b/Moose Development/Moose/Wrapper/Positionable.lua index 142ef1400..f901be0e2 100644 --- a/Moose Development/Moose/Wrapper/Positionable.lua +++ b/Moose Development/Moose/Wrapper/Positionable.lua @@ -211,7 +211,7 @@ function POSITIONABLE:GetRandomVec3( Radius ) self:T3( PositionableRandomVec3 ) return PositionableRandomVec3 else - self:E("Radius is nil, returning the PointVec3 of the POSITIONABLE", PositionablePointVec3) + self:F("Radius is nil, returning the PointVec3 of the POSITIONABLE", PositionablePointVec3) return PositionablePointVec3 end end @@ -731,7 +731,7 @@ function POSITIONABLE:LaseUnit( Target, LaserCode, Duration ) --R2.1 local RecceDcsUnit = self:GetDCSObject() local TargetVec3 = Target:GetVec3() - self:E("bulding spot") + self:F("bulding spot") self.Spot = SPOT:New( self ) -- Core.Spot#SPOT self.Spot:LaseOn( Target, LaserCode, Duration) self.LaserCode = LaserCode diff --git a/Moose Development/Moose/Wrapper/Unit.lua b/Moose Development/Moose/Wrapper/Unit.lua index 2d74b5b99..76f4567ab 100644 --- a/Moose Development/Moose/Wrapper/Unit.lua +++ b/Moose Development/Moose/Wrapper/Unit.lua @@ -204,10 +204,10 @@ function UNIT:ReSpawn( SpawnVec3, Heading ) SpawnGroupTemplate.x = SpawnVec3.x SpawnGroupTemplate.y = SpawnVec3.z - self:E( #SpawnGroupTemplate.units ) + self:F( #SpawnGroupTemplate.units ) for UnitID, UnitData in pairs( SpawnGroup:GetUnits() ) do local GroupUnit = UnitData -- #UNIT - self:E( GroupUnit:GetName() ) + self:F( GroupUnit:GetName() ) if GroupUnit:IsAlive() then local GroupUnitVec3 = GroupUnit:GetVec3() local GroupUnitHeading = GroupUnit:GetHeading() @@ -215,7 +215,7 @@ function UNIT:ReSpawn( SpawnVec3, Heading ) SpawnGroupTemplate.units[UnitID].x = GroupUnitVec3.x SpawnGroupTemplate.units[UnitID].y = GroupUnitVec3.z SpawnGroupTemplate.units[UnitID].heading = GroupUnitHeading - self:E( { UnitID, SpawnGroupTemplate.units[UnitID], SpawnGroupTemplate.units[UnitID] } ) + self:F( { UnitID, SpawnGroupTemplate.units[UnitID], SpawnGroupTemplate.units[UnitID] } ) end end end @@ -228,9 +228,9 @@ function UNIT:ReSpawn( SpawnVec3, Heading ) SpawnGroupTemplate.units[UnitTemplateID].x = SpawnVec3.x SpawnGroupTemplate.units[UnitTemplateID].y = SpawnVec3.z SpawnGroupTemplate.units[UnitTemplateID].heading = Heading - self:E( { UnitTemplateID, SpawnGroupTemplate.units[UnitTemplateID], SpawnGroupTemplate.units[UnitTemplateID] } ) + self:F( { UnitTemplateID, SpawnGroupTemplate.units[UnitTemplateID], SpawnGroupTemplate.units[UnitTemplateID] } ) else - self:E( SpawnGroupTemplate.units[UnitTemplateID].name ) + self:F( SpawnGroupTemplate.units[UnitTemplateID].name ) local GroupUnit = UNIT:FindByName( SpawnGroupTemplate.units[UnitTemplateID].name ) -- #UNIT if GroupUnit and GroupUnit:IsAlive() then local GroupUnitVec3 = GroupUnit:GetVec3() @@ -322,7 +322,7 @@ function UNIT:GetCallsign() return UnitCallSign end - self:E( self.ClassName .. " " .. self.UnitName .. " not found!" ) + self:F( self.ClassName .. " " .. self.UnitName .. " not found!" ) return nil end @@ -875,7 +875,7 @@ function UNIT:IsFriendly( FriendlyCoalition ) local IsFriendlyResult = ( UnitCoalition == FriendlyCoalition ) - self:E( IsFriendlyResult ) + self:F( IsFriendlyResult ) return IsFriendlyResult end diff --git a/Moose Setup/Moose.files b/Moose Setup/Moose.files index 938e9e1ed..1e575f0f2 100644 --- a/Moose Setup/Moose.files +++ b/Moose Setup/Moose.files @@ -45,6 +45,7 @@ Functional/ATC_Ground.lua Functional/Detection.lua Functional/Designate.lua Functional/RAT.lua +Functional/Range.lua Functional/ZoneGoal.lua Functional/ZoneGoalCoalition.lua Functional/ZoneCaptureCoalition.lua