From b00778bb8674b2c21f7883d18102100e436373f3 Mon Sep 17 00:00:00 2001 From: Frank Date: Mon, 29 Mar 2021 09:53:30 +0200 Subject: [PATCH 01/73] Update AI_A2A_Cap.lua Fixes #1474 --- Moose Development/Moose/AI/AI_A2A_Cap.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/AI/AI_A2A_Cap.lua b/Moose Development/Moose/AI/AI_A2A_Cap.lua index 08062cc11..f86bed9c0 100644 --- a/Moose Development/Moose/AI/AI_A2A_Cap.lua +++ b/Moose Development/Moose/AI/AI_A2A_Cap.lua @@ -143,7 +143,7 @@ end -- @return #AI_A2A_CAP function AI_A2A_CAP:New( AICap, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageMinSpeed, EngageMaxSpeed, PatrolAltType ) - return self:New2( AICap, EngageMinSpeed, EngageMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolZone, PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, PatrolAltType ) + return self:New2( AICap, EngageMinSpeed, EngageMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType, PatrolZone, PatrolMinSpeed, PatrolMaxSpeed, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolAltType ) end From 3e22411328dd37ea28b9ac068c2372ea357cfa44 Mon Sep 17 00:00:00 2001 From: Frank Date: Mon, 29 Mar 2021 18:01:42 +0200 Subject: [PATCH 02/73] Events - Added new DCS events --- Moose Development/Moose/Core/Base.lua | 31 +++++++++++++++++++++ Moose Development/Moose/Core/Event.lua | 38 ++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/Moose Development/Moose/Core/Base.lua b/Moose Development/Moose/Core/Base.lua index 4398c6d1a..1b809252a 100644 --- a/Moose Development/Moose/Core/Base.lua +++ b/Moose Development/Moose/Core/Base.lua @@ -676,6 +676,37 @@ do -- Event Handling -- @param #BASE self -- @param Core.Event#EVENTDATA EventData The EventData structure. + --- Paratrooper landing. + -- @function [parent=#BASE] OnEventParatrooperLanding + -- @param #BASE self + -- @param Core.Event#EVENTDATA EventData The EventData structure. + + --- Discard chair after ejection. + -- @function [parent=#BASE] OnEventDiscardChairAfterEjection + -- @param #BASE self + -- @param Core.Event#EVENTDATA EventData The EventData structure. + + --- Weapon add. Fires when entering a mission per pylon with the name of the weapon (double pylons not counted, infinite wep reload not counted. + -- @function [parent=#BASE] OnEventParatrooperLanding + -- @param #BASE self + -- @param Core.Event#EVENTDATA EventData The EventData structure. + + --- Trigger zone. + -- @function [parent=#BASE] OnEventTriggerZone + -- @param #BASE self + -- @param Core.Event#EVENTDATA EventData The EventData structure. + + --- Landing quality mark. + -- @function [parent=#BASE] OnEventLandingQualityMark + -- @param #BASE self + -- @param Core.Event#EVENTDATA EventData The EventData structure. + + --- BDA. + -- @function [parent=#BASE] OnEventBDA + -- @param #BASE self + -- @param Core.Event#EVENTDATA EventData The EventData structure. + + --- Occurs when a player enters a slot and takes control of an aircraft. -- **NOTE**: This is a workaround of a long standing DCS bug with the PLAYER_ENTER_UNIT event. -- initiator : The unit that is being taken control of. diff --git a/Moose Development/Moose/Core/Event.lua b/Moose Development/Moose/Core/Event.lua index 4588c6ba7..22b86e1ce 100644 --- a/Moose Development/Moose/Core/Event.lua +++ b/Moose Development/Moose/Core/Event.lua @@ -241,6 +241,13 @@ EVENTS = { Score = world.event.S_EVENT_SCORE or -1, UnitLost = world.event.S_EVENT_UNIT_LOST or -1, LandingAfterEjection = world.event.S_EVENT_LANDING_AFTER_EJECTION or -1, + -- Added with DCS 2.7.0 + ParatrooperLanding = world.event.S_EVENT_PARATROOPER_LENDING or -1, + DiscardChairAfterEjection = world.event.S_EVENT_DISCARD_CHAIR_AFTER_EJECTION or -1, + WeaponAdd = world.event.S_EVENT_WEAPON_ADD or -1, + TriggerZone = world.event.S_EVENT_TRIGGER_ZONE or -1, + LandingQualityMark = world.event.S_EVENT_LANDING_QUALITY_MARK or -1, + BDA = world.event.S_EVENT_BDA or -1, } --- The Event structure @@ -521,6 +528,37 @@ local _EVENTMETA = { Order = 1, Event = "OnEventLandingAfterEjection", Text = "S_EVENT_LANDING_AFTER_EJECTION" + }, + -- Added with DCS 2.7.0 + [EVENTS.ParatrooperLanding] = { + Order = 1, + Event = "OnEventParatrooperLanding", + Text = "S_EVENT_PARATROOPER_LENDING" + }, + [EVENTS.DicardChairAfterEjection] = { + Order = 1, + Event = "OnEventDiscardChairAfterEjection", + Text = "S_EVENT_DISCARD_CHAIR_AFTER_EJECTION" + }, + [EVENTS.WeaponAdd] = { + Order = 1, + Event = "OnEventWeaponAdd", + Text = "S_EVENT_WEAPON_ADD" + }, + [EVENTS.TriggerZone] = { + Order = 1, + Event = "OnEventTriggerZone", + Text = "S_EVENT_TRIGGER_ZONE" + }, + [EVENTS.LandingQualityMark] = { + Order = 1, + Event = "OnEventLandingQualityMark", + Text = "S_EVENT_LANDING_QUALITYMARK" + }, + [EVENTS.BDA] = { + Order = 1, + Event = "OnEventBDA", + Text = "S_EVENT_BDA" }, } From f161f08fc17af02305f1a3cba35119b357918cbd Mon Sep 17 00:00:00 2001 From: Frank Date: Mon, 29 Mar 2021 19:55:11 +0200 Subject: [PATCH 03/73] Update Event.lua - Fixed typo --- Moose Development/Moose/Core/Event.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Core/Event.lua b/Moose Development/Moose/Core/Event.lua index 22b86e1ce..c996d9bc7 100644 --- a/Moose Development/Moose/Core/Event.lua +++ b/Moose Development/Moose/Core/Event.lua @@ -535,7 +535,7 @@ local _EVENTMETA = { Event = "OnEventParatrooperLanding", Text = "S_EVENT_PARATROOPER_LENDING" }, - [EVENTS.DicardChairAfterEjection] = { + [EVENTS.DiscardChairAfterEjection] = { Order = 1, Event = "OnEventDiscardChairAfterEjection", Text = "S_EVENT_DISCARD_CHAIR_AFTER_EJECTION" From 31b93fb42c40a2292754e7a57831a78e61114f9b Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Thu, 1 Apr 2021 13:21:40 +0200 Subject: [PATCH 04/73] Update FlightGroup.lua Avoid endless when plane/heli is not airborne by needs to RTB --- Moose Development/Moose/Ops/FlightGroup.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Ops/FlightGroup.lua b/Moose Development/Moose/Ops/FlightGroup.lua index ad0f1a6ce..09ce9a524 100644 --- a/Moose Development/Moose/Ops/FlightGroup.lua +++ b/Moose Development/Moose/Ops/FlightGroup.lua @@ -147,6 +147,7 @@ FLIGHTGROUP = { Tparking = nil, menu = nil, ishelo = nil, + RTBRecallCount = 0, } @@ -2150,11 +2151,16 @@ function FLIGHTGROUP:onbeforeRTB(From, Event, To, airbase, SpeedTo, SpeedHold) end if not self.group:IsAirborne(true) then - self:I(self.lid..string.format("WARNING: Group is not AIRBORNE ==> RTB event is suspended for 10 sec.")) + -- this should really not happen, either the AUFTRAG is cancelled before the group was airborne or it is stuck at the ground for some reason + self:I(self.lid..string.format("WARNING: Group is not AIRBORNE ==> RTB event is suspended for 20 sec.")) allowed=false - Tsuspend=-10 + Tsuspend=-20 + self.RTBRecallCount = self.RTBRecallCount+1 + if self.RTBRecallCount > 3 then + self:Despawn(5) + end end - + -- Only if fuel is not low or critical. if not (self:IsFuelLow() or self:IsFuelCritical()) then From 903e8711f7415bc4dc15f9491bd5b6907d3541af Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Thu, 1 Apr 2021 13:28:59 +0200 Subject: [PATCH 05/73] Update AirWing.lua Make Patrolpoint Markes Switchable --- Moose Development/Moose/Ops/AirWing.lua | 59 +++++++++++++++++++------ 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/Moose Development/Moose/Ops/AirWing.lua b/Moose Development/Moose/Ops/AirWing.lua index 2f3870403..234d89ed5 100644 --- a/Moose Development/Moose/Ops/AirWing.lua +++ b/Moose Development/Moose/Ops/AirWing.lua @@ -119,6 +119,7 @@ AIRWING = { pointsTANKER = {}, pointsAWACS = {}, wingcommander = nil, + markpoints = false, } --- Squadron asset. @@ -209,6 +210,7 @@ function AIRWING:New(warehousename, airwingname) self.nflightsTANKERprobe=0 self.nflightsRecoveryTanker=0 self.nflightsRescueHelo=0 + self.markpoints = false ------------------------ --- Pseudo Functions --- @@ -230,6 +232,24 @@ function AIRWING:New(warehousename, airwingname) -- @function [parent=#AIRWING] __Stop -- @param #AIRWING self -- @param #number delay Delay in seconds. + + --- On after "FlightOnMission" event. Triggered when an asset group starts a mission. + -- @function [parent=#AIRWING] OnAfterFlightOnMission + -- @param #AIRWING self + -- @param #string From The From state + -- @param #string Event The Event called + -- @param #string To The To state + -- @param Ops.FlightGroup#FLIGHTGROUP Flightgroup The Flightgroup on mission + -- @param Ops.Auftrag#AUFTRAG Mission The Auftrag of the Flightgroup + + --- On after "AssetReturned" event. Triggered when an asset group returned to its airwing. + -- @function [parent=#AIRWING] OnAfterAssetReturned + -- @param #AIRWING self + -- @param #string From From state. + -- @param #string Event Event. + -- @param #string To To state. + -- @param Ops.Squadron#SQUADRON Squadron The asset squadron. + -- @param #AIRWING.SquadronAsset Asset The asset that returned. return self end @@ -647,6 +667,19 @@ function AIRWING:SetNumberTankerBoom(Nboom) return self end +--- Set markers on the map for Patrol Points. +-- @param #AIRWING self +-- @param #boolean onoff Set to true to switch markers on. +-- @return #AIRWING self +function AIRWING:ShowPatrolPointMarkers(onoff) + if onoff then + self.markpoints = true + else + self.markpoints = false + end + return self +end + --- Set number of TANKER flights with Probe constantly in the air. -- @param #AIRWING self -- @param #number Nprobe Number of flights. Default 1. @@ -689,12 +722,10 @@ end --- Update marker of the patrol point. -- @param #AIRWING.PatrolData point Patrol point table. function AIRWING.UpdatePatrolPointMarker(point) - - local text=string.format("%s Occupied=%d\nheading=%03d, leg=%d NM, alt=%d ft, speed=%d kts", - point.type, point.noccupied, point.heading, point.leg, point.altitude, point.speed) - - point.marker:UpdateText(text, 1) - + local text=string.format("%s Occupied=%d\nheading=%03d, leg=%d NM, alt=%d ft, speed=%d kts", + point.type, point.noccupied, point.heading, point.leg, point.altitude, point.speed) + + point.marker:UpdateText(text, 1) end @@ -717,10 +748,12 @@ function AIRWING:NewPatrolPoint(Type, Coordinate, Altitude, Speed, Heading, LegL patrolpoint.altitude=Altitude or math.random(10,20)*1000 patrolpoint.speed=Speed or 350 patrolpoint.noccupied=0 - patrolpoint.marker=MARKER:New(Coordinate, "New Patrol Point"):ToAll() - AIRWING.UpdatePatrolPointMarker(patrolpoint) - + if self.markpoints then + patrolpoint.marker=MARKER:New(Coordinate, "New Patrol Point"):ToAll() + AIRWING.UpdatePatrolPointMarker(patrolpoint) + end + return patrolpoint end @@ -928,7 +961,7 @@ function AIRWING:CheckCAP() patrol.noccupied=patrol.noccupied+1 - AIRWING.UpdatePatrolPointMarker(patrol) + if self.markpoints then AIRWING.UpdatePatrolPointMarker(patrol) end self:AddMission(missionCAP) @@ -972,7 +1005,7 @@ function AIRWING:CheckTANKER() patrol.noccupied=patrol.noccupied+1 - AIRWING.UpdatePatrolPointMarker(patrol) + if self.markpoints then AIRWING.UpdatePatrolPointMarker(patrol) end self:AddMission(mission) @@ -990,7 +1023,7 @@ function AIRWING:CheckTANKER() patrol.noccupied=patrol.noccupied+1 - AIRWING.UpdatePatrolPointMarker(patrol) + if self.markpoints then AIRWING.UpdatePatrolPointMarker(patrol) end self:AddMission(mission) @@ -1018,7 +1051,7 @@ function AIRWING:CheckAWACS() patrol.noccupied=patrol.noccupied+1 - AIRWING.UpdatePatrolPointMarker(patrol) + if self.markpoints then AIRWING.UpdatePatrolPointMarker(patrol) end self:AddMission(mission) From b1465d89a6c50cd36741348edbf81bd0f47f4b73 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Sun, 4 Apr 2021 12:49:40 +0200 Subject: [PATCH 06/73] Update FlightGroup.lua Added check for velocity for the RTB loop (if group is taxiing). Added OutOfAAMissiles. --- Moose Development/Moose/Ops/FlightGroup.lua | 47 +++++++++++++++++++-- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Ops/FlightGroup.lua b/Moose Development/Moose/Ops/FlightGroup.lua index 09ce9a524..afcedc072 100644 --- a/Moose Development/Moose/Ops/FlightGroup.lua +++ b/Moose Development/Moose/Ops/FlightGroup.lua @@ -140,6 +140,7 @@ FLIGHTGROUP = { fuelcritical = nil, fuelcriticalthresh = nil, fuelcriticalrtb = false, + outofAAMrtb = true, squadron = nil, flightcontrol = nil, flaghold = nil, @@ -477,6 +478,20 @@ function FLIGHTGROUP:SetFuelLowRTB(switch) return self end +--- Set if flight is out of Air-Air-Missiles, flight goes RTB. +-- @param #FLIGHTGROUP self +-- @param #boolean switch If true or nil, flight goes RTB. If false, turn this off. +-- @return #FLIGHTGROUP self +function FLIGHTGROUP:SetOutOfAMMRTB(switch) + if switch==false then + self.outofAAMrtb=false + else + self.outofAAMrtb=true + end + return self +end + + --- Set if low fuel threshold is reached, flight tries to refuel at the neares tanker. -- @param #FLIGHTGROUP self -- @param #boolean switch If true or nil, flight goes for refuelling. If false, turn this off. @@ -1015,7 +1030,18 @@ function FLIGHTGROUP:onafterStatus(From, Event, To) if fuelmin RTB event is suspended for 20 sec.")) allowed=false Tsuspend=-20 - self.RTBRecallCount = self.RTBRecallCount+1 - if self.RTBRecallCount > 3 then + local groupspeed = self.group:GetVelocityMPS() + if groupspeed <= 1 then self.RTBRecallCount = self.RTBRecallCount+1 end + if self.RTBRecallCount > 6 then self:Despawn(5) end end From bab61271f2bef51cfa494e8d0f8a10992db4bacc Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Sun, 4 Apr 2021 13:07:54 +0200 Subject: [PATCH 07/73] Update Intelligence.lua Make Markers Coalition specific --- Moose Development/Moose/Ops/Intelligence.lua | 29 ++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/Moose Development/Moose/Ops/Intelligence.lua b/Moose Development/Moose/Ops/Intelligence.lua index ca95135eb..9c4a3a876 100644 --- a/Moose Development/Moose/Ops/Intelligence.lua +++ b/Moose Development/Moose/Ops/Intelligence.lua @@ -1,11 +1,11 @@ --- **Ops** - Office of Military Intelligence. -- --- ## Main Features: +-- **Main Features:** -- -- * Detect and track contacts consistently -- * Detect and track clusters of contacts consistently -- * Use FSM events to link functionality into your scripts --- * Easy setup +-- * Easy setup -- -- === -- @@ -80,6 +80,7 @@ -- `local m = MESSAGE:New(text,15,"KGB"):ToAll()` -- `end` -- +-- -- @field #INTEL INTEL = { ClassName = "INTEL", @@ -93,7 +94,7 @@ INTEL = { ContactsUnknown = {}, Clusters = {}, clustercounter = 1, - clusterradius = 10, + clusterradius = 15, } --- Detected item info. @@ -130,7 +131,7 @@ INTEL = { --- INTEL class version. -- @field #string version -INTEL.version="0.2.0" +INTEL.version="0.2.1" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- ToDo list @@ -350,7 +351,7 @@ function INTEL:RemoveRejectZone(RejectZone) return self end ---- Set forget contacts time interval. For unknown contacts only. +--- Set forget contacts time interval. -- Previously known contacts that are not detected any more, are "lost" after this time. -- This avoids fast oscillations between a contact being detected and undetected. -- @param #INTEL self @@ -465,7 +466,7 @@ end -- @param #number radius The radius of the clusters -- @return #INTEL self function INTEL:SetClusterRadius(radius) - local radius = radius or 10 + local radius = radius or 15 self.clusterradius = radius return self end @@ -1082,7 +1083,7 @@ function INTEL:CalcClusterThreatlevelSum(cluster) threatlevel=threatlevel+contact.threatlevel end - cluster.threatlevelSum = threatlevel + cluster.threatlevelSum = threatlevel return threatlevel end @@ -1094,7 +1095,7 @@ function INTEL:CalcClusterThreatlevelAverage(cluster) local threatlevel=self:CalcClusterThreatlevelSum(cluster) threatlevel=threatlevel/cluster.size - cluster.threatlevelAve = threatlevel + cluster.threatlevelAve = threatlevel return threatlevel end @@ -1114,7 +1115,7 @@ function INTEL:CalcClusterThreatlevelMax(cluster) end end - cluster.threatlevelMax = threatlevel + cluster.threatlevelMax = threatlevel return threatlevel end @@ -1155,7 +1156,7 @@ function INTEL:IsContactConnectedToCluster(contact, cluster) --local dist=Contact.position:Get2DDistance(contact.position) local dist=Contact.position:DistanceFromPointVec2(contact.position) - local radius = self.clusterradius or 10 + local radius = self.clusterradius or 15 if dist Date: Sun, 4 Apr 2021 13:11:25 +0200 Subject: [PATCH 08/73] Update AirWing.lua Avoid loop if mission is governed by an Airwing. Mission cancel will ask airwing to cancel will ask flightgroup to cancel, which doesn't work if the latter is dead. Rare but happens. --- Moose Development/Moose/Ops/AirWing.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Ops/AirWing.lua b/Moose Development/Moose/Ops/AirWing.lua index 234d89ed5..706133f4b 100644 --- a/Moose Development/Moose/Ops/AirWing.lua +++ b/Moose Development/Moose/Ops/AirWing.lua @@ -1464,7 +1464,9 @@ function AIRWING:onafterMissionCancel(From, Event, To, Mission) -- Info message. self:I(self.lid..string.format("Cancel mission %s", Mission.name)) - if Mission:IsPlanned() or Mission:IsQueued() or Mission:IsRequested() then + local Ngroups = Mission:CountOpsGroups() + + if Mission:IsPlanned() or Mission:IsQueued() or Mission:IsRequested() or Ngroups == 0 then Mission:Done() From cb813b70e1361bf9cdc4b635d71721e9ff8a0d0c Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Wed, 7 Apr 2021 19:31:10 +0200 Subject: [PATCH 09/73] Update Mantis.lua Added option to use AI on/off instead of changing the alert state --- Moose Development/Moose/Functional/Mantis.lua | 44 ++++++++++++++++--- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/Moose Development/Moose/Functional/Mantis.lua b/Moose Development/Moose/Functional/Mantis.lua index c4564fb94..4d6565262 100644 --- a/Moose Development/Moose/Functional/Mantis.lua +++ b/Moose Development/Moose/Functional/Mantis.lua @@ -20,7 +20,7 @@ -- @module Functional.Mantis -- @image Functional.Mantis.jpg --- Date: Feb 2021 +-- Date: Apr 2021 ------------------------------------------------------------------------- --- **MANTIS** class, extends #Core.Base#BASE @@ -51,6 +51,7 @@ -- @field #number adv_state Advanced mode state tracker -- @field #boolean advAwacs Boolean switch to use Awacs as a separate detection stream -- @field #number awacsrange Detection range of an optional Awacs unit +-- @field #boolean UseAIOnOff Decide if we are using AI on/off (true) or AlarmState red/green (default) -- @field Functional.Shorad#SHORAD Shorad SHORAD Object, if available -- @field #boolean ShoradLink If true, #MANTIS has #SHORAD enabled -- @field #number ShoradTime Timer in seconds, how long #SHORAD will be active after a detection inside of the defense range @@ -189,7 +190,8 @@ MANTIS = { Shorad = nil, ShoradLink = false, ShoradTime = 600, - ShoradActDistance = 15000, + ShoradActDistance = 15000, + UseAIOnOff = false, } ----------------------------------------------------------------------- @@ -206,6 +208,7 @@ do --@param #string coaltion Coalition side of your setup, e.g. "blue", "red" or "neutral" --@param #boolean dynamic Use constant (true) filtering or just filter once (false, default) (optional) --@param #string awacs Group name of your Awacs (optional) + --@param #boolean AIOnOff Make MANTIS switch AI on and off instead of changing the alarm state between RED and GREEN (optional) --@return #MANTIS self --@usage Start up your MANTIS with a basic setting -- @@ -227,7 +230,7 @@ do -- `mybluemantis = MANTIS:New("bluemantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")` -- `mybluemantis:Start()` -- - function MANTIS:New(name,samprefix,ewrprefix,hq,coaltion,dynamic,awacs) + function MANTIS:New(name,samprefix,ewrprefix,hq,coaltion,dynamic,awacs, AIOnOff) -- DONE: Create some user functions for these -- DONE: Make HQ useful @@ -260,6 +263,8 @@ do self.ShoradLink = false self.ShoradTime = 600 self.ShoradActDistance = 15000 + -- TODO: add emissions on/off when available .... in 2 weeks + self.UseAIOnOff = AIOnOff or false if type(awacs) == "string" then self.advAwacs = true @@ -299,7 +304,7 @@ do end -- @field #string version - self.version="0.3.7" + self.version="0.4.0" self:I(string.format("***** Starting MANTIS Version %s *****", self.version)) return self @@ -458,6 +463,13 @@ do end end + --- Set using AI on/off instead of changing alarm state + -- @param #MANTIS self + -- @param #boolean switch Decide if we are changing alarm state or AI state + function MANTIS:SetUsingAIOnOff(switch) + self.UseAIOnOff = switch or false + end + --- [Internal] Function to check if HQ is alive -- @param #MANTIS self -- @return #boolean True if HQ is alive, else false @@ -701,7 +713,12 @@ do --cycle through groups and set alarm state etc for _i,_group in pairs (SAM_Grps) do local group = _group - group:OptionAlarmStateGreen() -- AI off + -- TODO: add emissions on/off + if self.UseAIOnOff then + group:SetAIOff() + else + group:OptionAlarmStateGreen() -- AI off + end group:SetOption(AI.Option.Ground.id.AC_ENGAGEMENT_RANGE_RESTRICTION,engagerange) --default engagement will be 75% of firing range if group:IsGround() then local grpname = group:GetName() @@ -804,7 +821,11 @@ do local IsInZone, Distance = self:CheckObjectInZone(detset, samcoordinate) if IsInZone then --check any target in zone if samgroup:IsAlive() then - -- switch off SAM + -- switch on SAM + if self.UseAIOnOff then + -- TODO: add emissions on/off + samgroup:SetAIOn() + end samgroup:OptionAlarmStateRed() -- link in to SHORAD if available -- DONE: Test integration fully @@ -822,7 +843,12 @@ do else if samgroup:IsAlive() then -- switch off SAM - samgroup:OptionAlarmStateGreen() + if self.UseAIOnOff then + -- TODO: add emissions on/off + samgroup:SetAIOff() + else + samgroup:OptionAlarmStateGreen() + end --samgroup:OptionROEWeaponFree() --samgroup:SetAIOn() local text = string.format("SAM %s switched to alarm state GREEN!", name) @@ -857,6 +883,10 @@ do local name = _data[1] local samgroup = GROUP:FindByName(name) if samgroup:IsAlive() then + if self.UseAIOnOff then + -- TODO: add emissions on/off + samgroup:SetAIOn() + end samgroup:OptionAlarmStateRed() end -- end alive end -- end for loop From bddc1d7fdcb6531300141963fecb5606700c4a52 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Wed, 7 Apr 2021 19:32:34 +0200 Subject: [PATCH 10/73] Update Shorad.lua Added option to use AI on/off instead of changing the alert state --- Moose Development/Moose/Functional/Shorad.lua | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Functional/Shorad.lua b/Moose Development/Moose/Functional/Shorad.lua index 7ecf59d18..155a86829 100644 --- a/Moose Development/Moose/Functional/Shorad.lua +++ b/Moose Development/Moose/Functional/Shorad.lua @@ -38,6 +38,7 @@ -- @field #boolean DefendMavs Default true, intercept incoming AG-Missiles -- @field #number DefenseLowProb Default 70, minimum detection limit -- @field #number DefenseHighProb Default 90, maximim detection limit +-- @field #boolean UseAIOnOff Decide if we are using AI on/off (true) or AlarmState red/green (default). -- @extends Core.Base#BASE --- *Good friends are worth defending.* Mr Tushman, Wonder (the Movie) @@ -94,7 +95,8 @@ SHORAD = { DefendHarms = true, DefendMavs = true, DefenseLowProb = 70, - DefenseHighProb = 90, + DefenseHighProb = 90, + UseAIOnOff = false, } ----------------------------------------------------------------------- @@ -174,7 +176,8 @@ do self.DefendMavs = true self.DefenseLowProb = 70 -- probability to detect a missile shot, low margin self.DefenseHighProb = 90 -- probability to detect a missile shot, high margin - self:I("*** SHORAD - Started Version 0.0.2") + self.UseAIOnOff = false -- Decide if we are using AI on/off (true) or AlarmState red/green (default) + self:I("*** SHORAD - Started Version 0.1.0") -- Set the string id for output to DCS.log file. self.lid=string.format("SHORAD %s | ", self.name) self:_InitState() @@ -189,7 +192,11 @@ do self:T({set = set}) local aliveset = set:GetAliveSet() --#table for _,_group in pairs (aliveset) do + if self.UseAIOnOff then + _group:SetAIOff() + else _group:OptionAlarmStateGreen() --Wrapper.Group#GROUP + end end -- gather entropy for i=1,10 do @@ -272,6 +279,13 @@ do self.Radius = radius end + --- Set using AI on/off instead of changing alarm state + -- @param #SHORAD self + -- @param #boolean switch Decide if we are changing alarm state or AI state + function SHORAD:SetUsingAIOnOff(switch) + self.UseAIOnOff = switch or false + end + --- Check if a HARM was fired -- @param #SHORAD self -- @param #string WeaponName @@ -396,7 +410,11 @@ do local function SleepShorad(group) local groupname = group:GetName() self.ActiveGroups[groupname] = nil - group:OptionAlarmStateGreen() + if self.UseAIOnOff then + group:SetAIOff() + else + group:OptionAlarmStateGreen() + end local text = string.format("Sleeping SHORAD %s", group:GetName()) self:T(text) local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug) @@ -407,6 +425,9 @@ do local text = string.format("Waking up SHORAD %s", _group:GetName()) self:T(text) local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug) + if self.UseAIOnOff then + _group:SetAIOn() + end _group:OptionAlarmStateRed() local groupname = _group:GetName() if self.ActiveGroups[groupname] == nil then -- no timer yet for this group From c1a8c088804857797fc98a709f7baca2a8240ef4 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Mon, 12 Apr 2021 13:02:16 +0200 Subject: [PATCH 11/73] Update FlightGroup.lua --- Moose Development/Moose/Ops/FlightGroup.lua | 54 ++++++++++++++++++--- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/Moose Development/Moose/Ops/FlightGroup.lua b/Moose Development/Moose/Ops/FlightGroup.lua index afcedc072..a71619474 100644 --- a/Moose Development/Moose/Ops/FlightGroup.lua +++ b/Moose Development/Moose/Ops/FlightGroup.lua @@ -140,7 +140,8 @@ FLIGHTGROUP = { fuelcritical = nil, fuelcriticalthresh = nil, fuelcriticalrtb = false, - outofAAMrtb = true, + outofAAMrtb = true, + outofAGMrtb = true, squadron = nil, flightcontrol = nil, flaghold = nil, @@ -148,7 +149,7 @@ FLIGHTGROUP = { Tparking = nil, menu = nil, ishelo = nil, - RTBRecallCount = 0, + RTBRecallCount = 0, } @@ -212,7 +213,7 @@ FLIGHTGROUP.version="0.6.1" -- TODO: Mark assigned parking spot on F10 map. -- TODO: Let user request a parking spot via F10 marker :) -- TODO: Monitor traveled distance in air ==> calculate fuel consumption ==> calculate range remaining. Will this give half way accurate results? --- TODO: Out of AG/AA missiles. Safe state of out-of-ammo. +-- DONE: Out of AG/AA missiles. Safe state of out-of-ammo. -- DONE: Add tasks. -- DONE: Waypoints, read, add, insert, detour. -- DONE: Get ammo. @@ -276,9 +277,9 @@ function FLIGHTGROUP:New(group) self:AddTransition("*", "FuelLow", "*") -- Fuel state of group is low. Default ~25%. self:AddTransition("*", "FuelCritical", "*") -- Fuel state of group is critical. Default ~10%. - self:AddTransition("*", "OutOfMissilesAA", "*") -- Group is out of A2A missiles. Not implemented yet! - self:AddTransition("*", "OutOfMissilesAG", "*") -- Group is out of A2G missiles. Not implemented yet! - self:AddTransition("*", "OutOfMissilesAS", "*") -- Group is out of A2G missiles. Not implemented yet! + self:AddTransition("*", "OutOfMissilesAA", "*") -- Group is out of A2A missiles. + self:AddTransition("*", "OutOfMissilesAG", "*") -- Group is out of A2G missiles. + self:AddTransition("*", "OutOfMissilesAS", "*") -- Group is out of A2S(ship) missiles. Not implemented yet! self:AddTransition("Airborne", "EngageTarget", "Engaging") -- Engage targets. self:AddTransition("Engaging", "Disengage", "Airborne") -- Engagement over. @@ -482,7 +483,7 @@ end -- @param #FLIGHTGROUP self -- @param #boolean switch If true or nil, flight goes RTB. If false, turn this off. -- @return #FLIGHTGROUP self -function FLIGHTGROUP:SetOutOfAMMRTB(switch) +function FLIGHTGROUP:SetOutOfAAMRTB(switch) if switch==false then self.outofAAMrtb=false else @@ -491,6 +492,18 @@ function FLIGHTGROUP:SetOutOfAMMRTB(switch) return self end +--- Set if flight is out of Air-Ground-Missiles, flight goes RTB. +-- @param #FLIGHTGROUP self +-- @param #boolean switch If true or nil, flight goes RTB. If false, turn this off. +-- @return #FLIGHTGROUP self +function FLIGHTGROUP:SetOutOfAGMRTB(switch) + if switch==false then + self.outofAGMrtb=false + else + self.outofAGMrtb=true + end + return self +end --- Set if low fuel threshold is reached, flight tries to refuel at the neares tanker. -- @param #FLIGHTGROUP self @@ -1031,17 +1044,28 @@ function FLIGHTGROUP:onafterStatus(From, Event, To) self:FuelCritical() end - -- Out of AA Ammo? CAP, GCICAP, INTERCEPT + -- Out of AA Missiles? CAP, GCICAP, INTERCEPT local CurrIsCap = false + -- Out of AG Missiles? BAI, SEAD, CAS, STRIKE + local CurrIsA2G = false + -- Check AUFTRAG Type local CurrAuftrag = self:GetMissionCurrent() if CurrAuftrag then local CurrAuftragType = CurrAuftrag:GetType() if CurrAuftragType == "CAP" or CurrAuftragType == "GCICAP" or CurrAuftragType == "INTERCEPT" then CurrIsCap = true end + if CurrAuftragType == "BAI" or CurrAuftragType == "CAS" or CurrAuftragType == "SEAD" or CurrAuftragType == "STRIKE" then CurrIsA2G = true end end + + -- Check A2A if (not self:CanAirToAir(true)) and CurrIsCap then self:OutOfMissilesAA() end + -- Check A2G + if (not self:CanAirToGround(false)) and CurrIsA2G then + self:OutOfMissilesAG() + end + end --- @@ -2087,6 +2111,20 @@ function FLIGHTGROUP:onafterOutOfMissilesAA(From, Event, To) end end +--- On after "OutOfMissilesAG" event. +-- @param #FLIGHTGROUP self +-- @param #string From From state. +-- @param #string Event Event. +-- @param #string To To state. +function FLIGHTGROUP:onafterOutOfMissilesAG(From, Event, To) + self:I(self.lid.."Group is out of AG Missiles!") + if self.outofAGMrtb then + -- Back to destination or home. + local airbase=self.destbase or self.homebase + self:__RTB(-5,airbase) + end +end + --- Check if flight is done, i.e. -- -- * passed the final waypoint, From fa342a5b6bc4bae476f016a0bd6006b213262b0b Mon Sep 17 00:00:00 2001 From: Frank Date: Wed, 14 Apr 2021 23:42:36 +0200 Subject: [PATCH 12/73] ATIS v0.9.1 - DCS 2.7 weather presetss --- Moose Development/Moose/Ops/ATIS.lua | 100 ++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Ops/ATIS.lua b/Moose Development/Moose/Ops/ATIS.lua index 044963a28..001b43f1b 100644 --- a/Moose Development/Moose/Ops/ATIS.lua +++ b/Moose Development/Moose/Ops/ATIS.lua @@ -7,7 +7,7 @@ -- * Wind direction and speed -- * Visibility -- * Cloud coverage, base and ceiling --- * Temprature +-- * Temperature -- * Dew point (approximate as there is no relative humidity in DCS yet) -- * Pressure QNH/QFE -- * Weather phenomena: rain, thunderstorm, fog, dust @@ -564,7 +564,7 @@ _ATIS={} --- ATIS class version. -- @field #string version -ATIS.version="0.9.0" +ATIS.version="0.9.1" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- TODO list @@ -1431,9 +1431,103 @@ function ATIS:onafterBroadcast(From, Event, To) local cloudceil=clouds.base+clouds.thickness local clouddens=clouds.density + -- Cloud preset (DCS 2.7) + local cloudspreset=clouds.preset or "Nothing" + -- Precepitation: 0=None, 1=Rain, 2=Thunderstorm, 3=Snow, 4=Snowstorm. - local precepitation=tonumber(clouds.iprecptns) + local precepitation=0 + if cloudspreset:find("Preset10") then + -- Scattered 5 + clouddens=4 + elseif cloudspreset:find("Preset11") then + -- Scattered 6 + clouddens=4 + elseif cloudspreset:find("Preset12") then + -- Scattered 7 + clouddens=4 + elseif cloudspreset:find("Preset13") then + -- Broken 1 + clouddens=7 + elseif cloudspreset:find("Preset14") then + -- Broken 2 + clouddens=7 + elseif cloudspreset:find("Preset15") then + -- Broken 3 + clouddens=7 + elseif cloudspreset:find("Preset16") then + -- Broken 4 + clouddens=7 + elseif cloudspreset:find("Preset17") then + -- Broken 5 + clouddens=7 + elseif cloudspreset:find("Preset18") then + -- Broken 6 + clouddens=7 + elseif cloudspreset:find("Preset19") then + -- Broken 7 + clouddens=7 + elseif cloudspreset:find("Preset20") then + -- Broken 8 + clouddens=7 + elseif cloudspreset:find("Preset21") then + -- Overcast 1 + clouddens=9 + elseif cloudspreset:find("Preset22") then + -- Overcast 2 + clouddens=9 + elseif cloudspreset:find("Preset23") then + -- Overcast 3 + clouddens=9 + elseif cloudspreset:find("Preset24") then + -- Overcast 4 + clouddens=9 + elseif cloudspreset:find("Preset25") then + -- Overcast 5 + clouddens=9 + elseif cloudspreset:find("Preset26") then + -- Overcast 6 + clouddens=9 + elseif cloudspreset:find("Preset27") then + -- Overcast 7 + clouddens=9 + elseif cloudspreset:find("Preset1") then + -- Light Scattered 1 + clouddens=1 + elseif cloudspreset:find("Preset2") then + -- Light Scattered 2 + clouddens=1 + elseif cloudspreset:find("Preset3") then + -- High Scattered 1 + clouddens=4 + elseif cloudspreset:find("Preset4") then + -- High Scattered 2 + clouddens=4 + elseif cloudspreset:find("Preset5") then + -- Scattered 1 + clouddens=4 + elseif cloudspreset:find("Preset6") then + -- Scattered 2 + clouddens=4 + elseif cloudspreset:find("Preset7") then + -- Scattered 3 + clouddens=4 + elseif cloudspreset:find("Preset8") then + -- High Scattered 3 + clouddens=4 + elseif cloudspreset:find("Preset9") then + -- Scattered 4 + clouddens=4 + elseif cloudspreset:find("RainyPreset") then + -- Overcast + Rain + clouddens=9 + if temperature>5 then + precepitation=1 -- rain + else + precepitation=3 -- snow + end + end + local CLOUDBASE=string.format("%d", UTILS.MetersToFeet(cloudbase)) local CLOUDCEIL=string.format("%d", UTILS.MetersToFeet(cloudceil)) From e8a21679342f81f9fb08189ba77bb79a8f9fd362 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Thu, 15 Apr 2021 13:01:02 +0200 Subject: [PATCH 13/73] Events - Workaround for 2.7 Same as for Event 31 --- Moose Development/Moose/Core/Event.lua | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Moose Development/Moose/Core/Event.lua b/Moose Development/Moose/Core/Event.lua index c996d9bc7..7bb39a1b7 100644 --- a/Moose Development/Moose/Core/Event.lua +++ b/Moose Development/Moose/Core/Event.lua @@ -254,7 +254,7 @@ EVENTS = { -- Note that at the beginning of each field description, there is an indication which field will be populated depending on the object type involved in the Event: -- -- * A (Object.Category.)UNIT : A UNIT object type is involved in the Event. --- * A (Object.Category.)STATIC : A STATIC object type is involved in the Event.µ +-- * A (Object.Category.)STATIC : A STATIC object type is involved in the Event.µ -- -- @type EVENTDATA -- @field #number id The identifier of the event. @@ -1115,13 +1115,25 @@ function EVENT:onEvent( Event ) end if Event.TgtObjectCategory == Object.Category.STATIC then + BASE:T({Event = Event}) + --[[ + Event.TgtDCSUnit = Event.target + Event.TgtDCSUnitName = Event.TgtDCSUnit:getName() + Event.TgtUnitName = Event.TgtDCSUnitName + Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false ) + Event.TgtCoalition = Event.TgtDCSUnit:getCoalition() + Event.TgtCategory = Event.TgtDCSUnit:getDesc().category + Event.TgtTypeName = Event.TgtDCSUnit:getTypeName() + --]] + -- Same as for Event Initiator above 2.7 issue Event.TgtDCSUnit = Event.target - Event.TgtDCSUnitName = Event.TgtDCSUnit:getName() + local ID=Event.initiator.id_ + Event.TgtDCSUnitName = string.format("Ejected Pilot ID %s", tostring(ID)) Event.TgtUnitName = Event.TgtDCSUnitName - Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false ) - Event.TgtCoalition = Event.TgtDCSUnit:getCoalition() - Event.TgtCategory = Event.TgtDCSUnit:getDesc().category - Event.TgtTypeName = Event.TgtDCSUnit:getTypeName() + --Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false ) + Event.TgtCoalition = Event.IniCoalition + Event.TgtCategory = Event.IniCategory + Event.TgtTypeName = "Ejected Pilot" end if Event.TgtObjectCategory == Object.Category.SCENERY then From b232a5da37c016ebafd2be3225d09bf0b7f7acbd Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Thu, 15 Apr 2021 13:02:59 +0200 Subject: [PATCH 14/73] Update Event.lua workaround for 2.7 Same as for Event 31 --- Moose Development/Moose/Core/Event.lua | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Moose Development/Moose/Core/Event.lua b/Moose Development/Moose/Core/Event.lua index c996d9bc7..7bb39a1b7 100644 --- a/Moose Development/Moose/Core/Event.lua +++ b/Moose Development/Moose/Core/Event.lua @@ -254,7 +254,7 @@ EVENTS = { -- Note that at the beginning of each field description, there is an indication which field will be populated depending on the object type involved in the Event: -- -- * A (Object.Category.)UNIT : A UNIT object type is involved in the Event. --- * A (Object.Category.)STATIC : A STATIC object type is involved in the Event.µ +-- * A (Object.Category.)STATIC : A STATIC object type is involved in the Event.µ -- -- @type EVENTDATA -- @field #number id The identifier of the event. @@ -1115,13 +1115,25 @@ function EVENT:onEvent( Event ) end if Event.TgtObjectCategory == Object.Category.STATIC then + BASE:T({Event = Event}) + --[[ + Event.TgtDCSUnit = Event.target + Event.TgtDCSUnitName = Event.TgtDCSUnit:getName() + Event.TgtUnitName = Event.TgtDCSUnitName + Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false ) + Event.TgtCoalition = Event.TgtDCSUnit:getCoalition() + Event.TgtCategory = Event.TgtDCSUnit:getDesc().category + Event.TgtTypeName = Event.TgtDCSUnit:getTypeName() + --]] + -- Same as for Event Initiator above 2.7 issue Event.TgtDCSUnit = Event.target - Event.TgtDCSUnitName = Event.TgtDCSUnit:getName() + local ID=Event.initiator.id_ + Event.TgtDCSUnitName = string.format("Ejected Pilot ID %s", tostring(ID)) Event.TgtUnitName = Event.TgtDCSUnitName - Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false ) - Event.TgtCoalition = Event.TgtDCSUnit:getCoalition() - Event.TgtCategory = Event.TgtDCSUnit:getDesc().category - Event.TgtTypeName = Event.TgtDCSUnit:getTypeName() + --Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false ) + Event.TgtCoalition = Event.IniCoalition + Event.TgtCategory = Event.IniCategory + Event.TgtTypeName = "Ejected Pilot" end if Event.TgtObjectCategory == Object.Category.SCENERY then From c7ec1b4e5ebb83d3b7704eaa6471c39628ee555d Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Fri, 16 Apr 2021 12:37:35 +0200 Subject: [PATCH 15/73] Update Group.lua Added code for EnableEmission --- Moose Development/Moose/Wrapper/Group.lua | 53 ++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index 9c6c0a79c..4ab573ec0 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -2169,6 +2169,40 @@ function GROUP:GetThreatLevel() return threatlevelMax end +--- Get the unit in the group with the highest threat level, which is still alive. +-- @param #GROUP self +-- @return Wrapper.Unit#UNIT The most dangerous unit in the group. +-- @return #number Threat level of the unit. +function GROUP:GetHighestThreat() + + -- Get units of the group. + local units=self:GetUnits() + + if units then + + local threat=nil ; local maxtl=0 + for _,_unit in pairs(units or {}) do + local unit=_unit --Wrapper.Unit#UNIT + + if unit and unit:IsAlive() then + + -- Threat level of group. + local tl=unit:GetThreatLevel() + + -- Check if greater the current threat. + if tl>maxtl then + maxtl=tl + threat=unit + end + end + end + + return threat, maxtl + end + + return nil, nil +end + --- Returns true if the first unit of the GROUP is in the air. -- @param Wrapper.Group#GROUP self @@ -2551,6 +2585,23 @@ do -- Players end +--- GROUND - Switch on/off radar emissions +-- @param #GROUP self +-- @param #boolean switch +function GROUP:EnableEmission(switch) + self:F2( self.GroupName ) + local switch = switch or false + + local DCSUnit = self:GetDCSObject() + + if DCSUnit then + + DCSUnit:enableEmission(switch) + + end + +end + --do -- Smoke -- ----- Signal a flare at the position of the GROUP. @@ -2641,4 +2692,4 @@ end -- -- -- ---end \ No newline at end of file +--end From 9eed35ace7fb2ecc92abf52f49dd915f3a2c8e8a Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Fri, 16 Apr 2021 12:40:32 +0200 Subject: [PATCH 16/73] Update Unit.lua Added changes for EnableEmission --- Moose Development/Moose/Wrapper/Unit.lua | 30 +++++++++++++++++++----- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/Moose Development/Moose/Wrapper/Unit.lua b/Moose Development/Moose/Wrapper/Unit.lua index 1321cba5d..ff48dd7d1 100644 --- a/Moose Development/Moose/Wrapper/Unit.lua +++ b/Moose Development/Moose/Wrapper/Unit.lua @@ -63,7 +63,7 @@ -- -- The UNIT class provides methods to obtain the current point or position of the DCS Unit. -- The @{#UNIT.GetPointVec2}(), @{#UNIT.GetVec3}() will obtain the current **location** of the DCS Unit in a Vec2 (2D) or a **point** in a Vec3 (3D) vector respectively. --- If you want to obtain the complete **3D position** including ori�ntation and direction vectors, consult the @{#UNIT.GetPositionVec3}() method respectively. +-- If you want to obtain the complete **3D position** including orientation and direction vectors, consult the @{#UNIT.GetPositionVec3}() method respectively. -- -- ## Test if alive -- @@ -527,8 +527,7 @@ end --- Returns the unit's group if it exist and nil otherwise. -- @param Wrapper.Unit#UNIT self --- @return Wrapper.Group#GROUP The Group of the Unit. --- @return #nil The DCS Unit is not existing or alive. +-- @return Wrapper.Group#GROUP The Group of the Unit or `nil` if the unit does not exist. function UNIT:GetGroup() self:F2( self.UnitName ) @@ -1175,8 +1174,9 @@ end --- Returns true if the UNIT is in the air. -- @param #UNIT self +-- @param #boolean NoHeloCheck If true, no additonal checks for helos are performed. -- @return #boolean Return true if in the air or #nil if the UNIT is not existing or alive. -function UNIT:InAir() +function UNIT:InAir(NoHeloCheck) self:F2( self.UnitName ) -- Get DCS unit object. @@ -1186,14 +1186,14 @@ function UNIT:InAir() -- Get DCS result of whether unit is in air or not. local UnitInAir = DCSUnit:inAir() - + -- Get unit category. local UnitCategory = DCSUnit:getDesc().category -- If DCS says that it is in air, check if this is really the case, since we might have landed on a building where inAir()=true but actually is not. -- This is a workaround since DCS currently does not acknoledge that helos land on buildings. -- Note however, that the velocity check will fail if the ground is moving, e.g. on an aircraft carrier! - if UnitInAir==true and UnitCategory == Unit.Category.HELICOPTER then + if UnitInAir==true and UnitCategory == Unit.Category.HELICOPTER and (not NoHeloCheck) then local VelocityVec3 = DCSUnit:getVelocity() local Velocity = UTILS.VecNorm(VelocityVec3) local Coordinate = DCSUnit:getPoint() @@ -1393,3 +1393,21 @@ function UNIT:GetTemplateFuel() return nil end + +--- GROUND - Switch on/off radar emissions +-- @param #UNIT self +-- @param #boolean switch +function UNIT:EnableEmission(switch) + self:F2( self.UnitName ) + + local switch = switch or false + + local DCSUnit = self:GetDCSObject() + + if DCSUnit then + + DCSUnit:enableEmission(switch) + + end + +end From e7d5fd6c1bd9602b2326588c650337dd7af93753 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Fri, 16 Apr 2021 12:46:45 +0200 Subject: [PATCH 17/73] Update DCS.lua enableEmissions --- Moose Development/Moose/DCS.lua | 70 ++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/DCS.lua b/Moose Development/Moose/DCS.lua index 15c73c29a..9fcac18cb 100644 --- a/Moose Development/Moose/DCS.lua +++ b/Moose Development/Moose/DCS.lua @@ -736,7 +736,66 @@ do -- Airbase end -- Airbase +do -- Spot + --- [DCS Class Spot](https://wiki.hoggitworld.com/view/DCS_Class_Spot) + -- Represents a spot from laser or IR-pointer. + -- @type Spot + -- @field #Spot.Category Category enum that stores spot categories. + + --- Enum that stores spot categories. + -- @type Spot.Category + -- @field #string INFRA_RED + -- @field #string LASER + + + --- Creates a laser ray emanating from the given object to a point in 3d space. + -- @function [parent=#Spot] createLaser + -- @param DCS#Object Source The source object of the laser. + -- @param DCS#Vec3 LocalRef An optional 3D offset for the source. + -- @param DCS#Vec3 Vec3 Target coordinate where the ray is pointing at. + -- @param #number LaserCode Any 4 digit number between 1111 and 1788. + -- @return #Spot + + --- Creates an infrared ray emanating from the given object to a point in 3d space. Can be seen with night vision goggles. + -- @function [parent=#Spot] createInfraRed + -- @param DCS#Object Source Source position of the IR ray. + -- @param DCS#Vec3 LocalRef An optional 3D offset for the source. + -- @param DCS#Vec3 Vec3 Target coordinate where the ray is pointing at. + -- @return #Spot + + --- Returns a vec3 table of the x, y, and z coordinates for the position of the given object in 3D space. Coordinates are dependent on the position of the maps origin. + -- @function [parent=#Spot] getPoint + -- @param #Spot self + -- @return DCS#Vec3 Point in 3D, where the beam is pointing at. + + --- Sets the destination point from which the source of the spot is drawn toward. + -- @function [parent=#Spot] setPoint + -- @param #Spot self + -- @param DCS#Vec3 Vec3 Point in 3D, where the beam is pointing at. + + --- Returns the number that is used to define the laser code for which laser designation can track. + -- @function [parent=#Spot] getCode + -- @param #Spot self + -- @return #number Code The laser code used. + + --- Sets the number that is used to define the laser code for which laser designation can track. + -- @function [parent=#Spot] setCode + -- @param #Spot self + -- @param #number Code The laser code. Default value is 1688. + + --- Destroys the spot. + -- @function [parent=#Spot] destroy + -- @param #Spot self + + --- Gets the category of the spot (laser or IR). + -- @function [parent=#Spot] getCategory + -- @param #Spot self + -- @return #string Category. + + Spot = {} --#Spot + +end -- Spot do -- Controller --- Controller is an object that performs A.I.-routines. Other words controller is an instance of A.I.. Controller stores current main task, active enroute tasks and behavior options. Controller performs commands. Please, read DCS A-10C GUI Manual EN.pdf chapter "Task Planning for Unit Groups", page 91 to understand A.I. system of DCS:A-10C. @@ -1093,6 +1152,10 @@ do -- Unit -- @param #Unit self -- @return #Unit.Desc + --- GROUND - Switch on/off radar emissions + -- @function [parent=#Unit] enableEmission + -- @param #Unit self + -- @param #boolean switch Unit = {} --#Unit @@ -1178,6 +1241,11 @@ do -- Group -- @param #Group self -- @return #Controller + --- GROUND - Switch on/off radar emissions + -- @function [parent=#Group] enableEmission + -- @param #Group self + -- @param #boolean switch + Group = {} --#Group end -- Group @@ -1393,4 +1461,4 @@ do -- AI AI = {} --#AI -end -- AI \ No newline at end of file +end -- AI From d040cc0d037d346045a8318d98a85345e576f7a0 Mon Sep 17 00:00:00 2001 From: Frank Date: Fri, 16 Apr 2021 23:04:59 +0200 Subject: [PATCH 18/73] DCS 2.7 - Added COORDINATE:LineToAll and COORDINATE:CircleToAll - Added altitude parameter to CONTROLLABLE:TaskFireAtPoint - Added emission on/off functions to UNIT --- Moose Development/Moose/Core/Point.lua | 56 +++++++++++++++++++ .../Moose/Wrapper/Controllable.lua | 14 ++++- Moose Development/Moose/Wrapper/Unit.lua | 35 ++++++++++++ 3 files changed, 104 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua index 0c722f9af..26aaa9dd7 100644 --- a/Moose Development/Moose/Core/Point.lua +++ b/Moose Development/Moose/Core/Point.lua @@ -1978,6 +1978,62 @@ do -- COORDINATE function COORDINATE:RemoveMark( MarkID ) trigger.action.removeMark( MarkID ) end + + --- Line to all. + -- Creates a line on the F10 map from one point to another. + -- @param #COORDINATE self + -- @param #COORDINATE Endpoint COORDIANTE to where the line is drawn. + -- @param #number Coalition Coalition: All=-1, Neutral=0, Red=1, Blue=2. Default -1=All. + -- @param #number LineType Line type: 0=No line, 1=Solid, 2=Dashed, 3=Dotted, 4=Dot dash, 5=Long dash, 6=Two dash. Default 1=Solid. + -- @param #table Color RGB color table {r, g, b}, e.g. {1,0,0} for red (default). + -- @param #number Alpha Transparency [0,1]. Default 1. + -- @param #boolean ReadOnly (Optional) Mark is readonly and cannot be removed by users. Default false. + -- @param #string Text (Optional) Text displayed when mark is added. Default none. + -- @return #number The resulting Mark ID which is a number. + function COORDINATE:LineToAll(Endpoint, Coalition, LineType, Color, Alpha, ReadOnly, Text) + local MarkID = UTILS.GetMarkID() + if ReadOnly==nil then + ReadOnly=false + end + local vec3=Endpoint:GetVec3() + Coalition=Coalition or -1 + Color=Color or {1,0,0} + Color[4]=Alpha or 1.0 + LineType=LineType or 1 + trigger.action.lineToAll(Coalition, MarkID, self:GetVec3(), vec3, Color, LineType, ReadOnly, Text or "") + return MarkID + end + + --- Circle to all. + -- Creates a circle on the map with a given radius, color, fill color, and outline. + -- @param #COORDINATE self + -- @param #COORDINATE Center COORDIANTE of the center of the circle. + -- @param #numberr Radius Radius in meters. Default 1000 m. + -- @param #number Coalition Coalition: All=-1, Neutral=0, Red=1, Blue=2. Default -1=All. + -- @param #number LineType Line type: 0=No line, 1=Solid, 2=Dashed, 3=Dotted, 4=Dot dash, 5=Long dash, 6=Two dash. Default 1=Solid. + -- @param #table Color RGB color table {r, g, b}, e.g. {1,0,0} for red (default). + -- @param #number Alpha Transparency [0,1]. Default 1. + -- @param #table FillColor RGB color table {r, g, b}, e.g. {1,0,0} for red (default). + -- @param #number FillAlpha Transparency [0,1]. Default 0.5. + -- @param #boolean ReadOnly (Optional) Mark is readonly and cannot be removed by users. Default false. + -- @param #string Text (Optional) Text displayed when mark is added. Default none. + -- @return #number The resulting Mark ID which is a number. + function COORDINATE:CircleToAll(Radius, Coalition, LineType, Color, Alpha, FillColor, FillAlpha, ReadOnly, Text) + local MarkID = UTILS.GetMarkID() + if ReadOnly==nil then + ReadOnly=false + end + local vec3=self:GetVec3() + Radius=Radius or 1000 + Coalition=Coalition or -1 + Color=Color or {1,0,0} + Color[4]=Alpha or 1.0 + LineType=LineType or 1 + FillColor=FillColor or {1,0,0} + FillColor[4]=FillAlpha or 0.5 + trigger.action.circleToAll(Coalition, MarkID, vec3, Radius, Color, FillColor, LineType, ReadOnly, Text or "") + return MarkID + end end -- Markings diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index 526a184a4..951342d97 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -1431,16 +1431,22 @@ end -- @param DCS#Distance Radius The radius of the zone to deploy the fire at. -- @param #number AmmoCount (optional) Quantity of ammunition to expand (omit to fire until ammunition is depleted). -- @param #number WeaponType (optional) Enum for weapon type ID. This value is only required if you want the group firing to use a specific weapon, for instance using the task on a ship to force it to fire guided missiles at targets within cannon range. See http://wiki.hoggit.us/view/DCS_enum_weapon_flag +-- @param #number Altitude (Optional) Altitude in meters. +-- @param #number ASL Altitude is above mean sea level. Default is above ground level. -- @return DCS#Task The DCS task structure. -function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius, AmmoCount, WeaponType ) +function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius, AmmoCount, WeaponType, Altitude, ASL ) local DCSTask = { id = 'FireAtPoint', params = { point = Vec2, + x=Vec2.x, + y=Vec2.y, zoneRadius = Radius, + radius = Radius, expendQty = 100, -- dummy value expendQtyEnabled = false, + alt_type = ASL and 0 or 1 } } @@ -1448,10 +1454,16 @@ function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius, AmmoCount, WeaponType ) DCSTask.params.expendQty = AmmoCount DCSTask.params.expendQtyEnabled = true end + + if Altitude then + DCSTask.params.altitude=Altitude + end if WeaponType then DCSTask.params.weaponType=WeaponType end + + self:I(DCSTask) return DCSTask end diff --git a/Moose Development/Moose/Wrapper/Unit.lua b/Moose Development/Moose/Wrapper/Unit.lua index ff48dd7d1..1d1df1b63 100644 --- a/Moose Development/Moose/Wrapper/Unit.lua +++ b/Moose Development/Moose/Wrapper/Unit.lua @@ -761,6 +761,41 @@ function UNIT:GetFuel() return nil end +--- Sets the passed group or unit objects radar emitters on or off. Can be used on sam sites for example to shut down the radar without setting AI off or changing the alarm state. +-- @param #UNIT self +-- @param #boolean Switch If `true` or `nil`, emission is enabled. If `false`, emission is turned off. +-- @return #UNIT self +function UNIT:SetEmission(Switch) + + if Switch==nil then + Switch=true + end + + local DCSUnit = self:GetDCSObject() + + if DCSUnit then + DCSUnit:enableEmission(Switch) + end + + return self +end + +--- Sets the passed group or unit objects radar emitters ON. Can be used on sam sites for example to shut down the radar without setting AI off or changing the alarm state. +-- @param #UNIT self +-- @return #UNIT self +function UNIT:EnableEmission() + self:SetEmission(true) + return self +end + +--- Sets the passed group or unit objects radar emitters OFF. Can be used on sam sites for example to shut down the radar without setting AI off or changing the alarm state. +-- @param #UNIT self +-- @return #UNIT self +function UNIT:DisableEmission() + self:SetEmission(false) + return self +end + --- Returns a list of one @{Wrapper.Unit}. -- @param #UNIT self -- @return #list A list of one @{Wrapper.Unit}. From a7b444dfea6ccab899f7c635252771b0fada6825 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 17 Apr 2021 09:29:55 +0200 Subject: [PATCH 19/73] Update OpsGroup.lua --- Moose Development/Moose/Ops/OpsGroup.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Moose Development/Moose/Ops/OpsGroup.lua b/Moose Development/Moose/Ops/OpsGroup.lua index b8f52b52e..a7a75c28f 100644 --- a/Moose Development/Moose/Ops/OpsGroup.lua +++ b/Moose Development/Moose/Ops/OpsGroup.lua @@ -340,6 +340,8 @@ OPSGROUP.version="0.7.1" -- TODO: Invisible/immortal. -- TODO: F10 menu. -- TODO: Add pseudo function. +-- TODO: EPLRS datalink. +-- TODO: Emission on/off. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Constructor From e198aae1dd851ee991d8b6481d2b2fb7add2b08d Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 17 Apr 2021 10:28:18 +0200 Subject: [PATCH 20/73] Update ATIS.lua --- Moose Development/Moose/Ops/ATIS.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/Moose Development/Moose/Ops/ATIS.lua b/Moose Development/Moose/Ops/ATIS.lua index 001b43f1b..1532cd1b3 100644 --- a/Moose Development/Moose/Ops/ATIS.lua +++ b/Moose Development/Moose/Ops/ATIS.lua @@ -580,6 +580,7 @@ ATIS.version="0.9.1" -- DONE: Metric units. -- DONE: Set UTC correction. -- DONE: Set magnetic variation. +-- DONE: New DCS 2.7 weather presets. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Constructor From 41e0f92cc07413cc631ee2a5c95763a5237a4130 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 17 Apr 2021 19:49:04 +0200 Subject: [PATCH 21/73] Update Unit.lua --- Moose Development/Moose/Wrapper/Unit.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Wrapper/Unit.lua b/Moose Development/Moose/Wrapper/Unit.lua index 1d1df1b63..0a0d50ba3 100644 --- a/Moose Development/Moose/Wrapper/Unit.lua +++ b/Moose Development/Moose/Wrapper/Unit.lua @@ -1429,7 +1429,7 @@ function UNIT:GetTemplateFuel() return nil end ---- GROUND - Switch on/off radar emissions +--- GROUND - Switch on/off radar emissions. -- @param #UNIT self -- @param #boolean switch function UNIT:EnableEmission(switch) From 38b40e2931eac9632576b65c41cf8f8a0ded9449 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 17 Apr 2021 21:16:34 +0200 Subject: [PATCH 22/73] Update Unit.lua --- Moose Development/Moose/Wrapper/Unit.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/Moose Development/Moose/Wrapper/Unit.lua b/Moose Development/Moose/Wrapper/Unit.lua index 0a0d50ba3..38033821c 100644 --- a/Moose Development/Moose/Wrapper/Unit.lua +++ b/Moose Development/Moose/Wrapper/Unit.lua @@ -1162,8 +1162,6 @@ end - - --- Returns if the unit is a friendly unit. -- @param #UNIT self -- @return #boolean IsFriendly evaluation result. From 42d253a9cacbe9094970da5f941f7fba6e0e3426 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 17 Apr 2021 21:22:09 +0200 Subject: [PATCH 23/73] Update Unit.lua --- Moose Development/Moose/Wrapper/Unit.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/Moose Development/Moose/Wrapper/Unit.lua b/Moose Development/Moose/Wrapper/Unit.lua index 38033821c..00060a946 100644 --- a/Moose Development/Moose/Wrapper/Unit.lua +++ b/Moose Development/Moose/Wrapper/Unit.lua @@ -1162,6 +1162,7 @@ end + --- Returns if the unit is a friendly unit. -- @param #UNIT self -- @return #boolean IsFriendly evaluation result. From 6519c30b3a2e81c6c206212d1119b82d9e3981d0 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 17 Apr 2021 21:26:26 +0200 Subject: [PATCH 24/73] Update Unit.lua --- Moose Development/Moose/Wrapper/Unit.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/Moose Development/Moose/Wrapper/Unit.lua b/Moose Development/Moose/Wrapper/Unit.lua index 00060a946..38033821c 100644 --- a/Moose Development/Moose/Wrapper/Unit.lua +++ b/Moose Development/Moose/Wrapper/Unit.lua @@ -1162,7 +1162,6 @@ end - --- Returns if the unit is a friendly unit. -- @param #UNIT self -- @return #boolean IsFriendly evaluation result. From 40415ef93389dc9c931a09839d0dd7306c8864b0 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 17 Apr 2021 21:31:55 +0200 Subject: [PATCH 25/73] Update Unit.lua --- Moose Development/Moose/Wrapper/Unit.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/Moose Development/Moose/Wrapper/Unit.lua b/Moose Development/Moose/Wrapper/Unit.lua index 38033821c..00060a946 100644 --- a/Moose Development/Moose/Wrapper/Unit.lua +++ b/Moose Development/Moose/Wrapper/Unit.lua @@ -1162,6 +1162,7 @@ end + --- Returns if the unit is a friendly unit. -- @param #UNIT self -- @return #boolean IsFriendly evaluation result. From 2289e16d91dbbcb7009eca406e750ee4d86da2e0 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 17 Apr 2021 21:45:17 +0200 Subject: [PATCH 26/73] Update Unit.lua --- Moose Development/Moose/Wrapper/Unit.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/Moose Development/Moose/Wrapper/Unit.lua b/Moose Development/Moose/Wrapper/Unit.lua index 00060a946..0a0d50ba3 100644 --- a/Moose Development/Moose/Wrapper/Unit.lua +++ b/Moose Development/Moose/Wrapper/Unit.lua @@ -1163,6 +1163,7 @@ end + --- Returns if the unit is a friendly unit. -- @param #UNIT self -- @return #boolean IsFriendly evaluation result. From 3e470e557d25f86476ecdcddacbd0b8ad01d9435 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 17 Apr 2021 22:19:27 +0200 Subject: [PATCH 27/73] Update Unit.lua --- Moose Development/Moose/Wrapper/Unit.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Wrapper/Unit.lua b/Moose Development/Moose/Wrapper/Unit.lua index 0a0d50ba3..65199d97d 100644 --- a/Moose Development/Moose/Wrapper/Unit.lua +++ b/Moose Development/Moose/Wrapper/Unit.lua @@ -154,8 +154,8 @@ function UNIT:Name() return self.UnitName end - ---- @param #UNIT self +--- Get the DCS unit object. +-- @param #UNIT self -- @return DCS#Unit function UNIT:GetDCSObject() From 7106efbc049c17ce587abcf41dc4d021466c0a00 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 17 Apr 2021 22:56:54 +0200 Subject: [PATCH 28/73] Update Unit.lua --- Moose Development/Moose/Wrapper/Unit.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Wrapper/Unit.lua b/Moose Development/Moose/Wrapper/Unit.lua index 65199d97d..41b6fed81 100644 --- a/Moose Development/Moose/Wrapper/Unit.lua +++ b/Moose Development/Moose/Wrapper/Unit.lua @@ -154,7 +154,7 @@ function UNIT:Name() return self.UnitName end ---- Get the DCS unit object. +--- Get the DCS unit object you want. -- @param #UNIT self -- @return DCS#Unit function UNIT:GetDCSObject() From 4b6aa3b56fa1e9da1eafc29a53c5e4b974153175 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 17 Apr 2021 23:29:31 +0200 Subject: [PATCH 29/73] Update appveyor.yml --- .appveyor/appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor/appveyor.yml b/.appveyor/appveyor.yml index 7fcd96a10..9cfb705f8 100644 --- a/.appveyor/appveyor.yml +++ b/.appveyor/appveyor.yml @@ -70,7 +70,7 @@ build_script: "Authorization" = "Bearer $token" "Content-type" = "application/json" } - $RequestBody = @{ accountName = 'FlightControl-Master'; projectSlug = 'moose-docs'; branch = "$env:appveyor_repo_branch"; environmentVariables = @{} } | ConvertTo-Json + $RequestBody = @{ accountName = 'funkyfranky'; projectSlug = 'moose-docs'; branch = "$env:appveyor_repo_branch"; environmentVariables = @{} } | ConvertTo-Json # get project with last build details $project = Invoke-RestMethod -method Post -Uri "$apiUrl/builds" -Headers $headers -Body $RequestBody } From 5aeb48006986c98f04cfbffb637627e8505acad1 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 17 Apr 2021 23:29:53 +0200 Subject: [PATCH 30/73] Update ATIS.lua --- Moose Development/Moose/Ops/ATIS.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/Moose Development/Moose/Ops/ATIS.lua b/Moose Development/Moose/Ops/ATIS.lua index 1532cd1b3..569497197 100644 --- a/Moose Development/Moose/Ops/ATIS.lua +++ b/Moose Development/Moose/Ops/ATIS.lua @@ -581,6 +581,7 @@ ATIS.version="0.9.1" -- DONE: Set UTC correction. -- DONE: Set magnetic variation. -- DONE: New DCS 2.7 weather presets. +-- DONE: ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Constructor From 6d53a30b1fef7c13bc0ba1ac97ac3d47239788a7 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 17 Apr 2021 23:36:14 +0200 Subject: [PATCH 31/73] Update appveyor.yml --- .appveyor/appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor/appveyor.yml b/.appveyor/appveyor.yml index 9cfb705f8..6b0baf00f 100644 --- a/.appveyor/appveyor.yml +++ b/.appveyor/appveyor.yml @@ -57,7 +57,7 @@ build_script: "Authorization" = "Bearer $token" "Content-type" = "application/json" } - $RequestBody = @{ accountName = 'FlightControl-Master'; projectSlug = 'moose-include'; branch = "$env:appveyor_repo_branch"; environmentVariables = @{} } | ConvertTo-Json + $RequestBody = @{ accountName = 'funkyfranky'; projectSlug = 'moose-include'; branch = "$env:appveyor_repo_branch"; environmentVariables = @{} } | ConvertTo-Json # Generate the new version ... $project = Invoke-RestMethod -method Post -Uri "$apiUrl/builds" -Headers $headers -Body $RequestBody } From 1f949463aaa33c2ed0db2ba09d731ca96c77addc Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 17 Apr 2021 23:36:49 +0200 Subject: [PATCH 32/73] Update ATIS.lua --- Moose Development/Moose/Ops/ATIS.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Ops/ATIS.lua b/Moose Development/Moose/Ops/ATIS.lua index 569497197..91333138d 100644 --- a/Moose Development/Moose/Ops/ATIS.lua +++ b/Moose Development/Moose/Ops/ATIS.lua @@ -581,7 +581,7 @@ ATIS.version="0.9.1" -- DONE: Set UTC correction. -- DONE: Set magnetic variation. -- DONE: New DCS 2.7 weather presets. --- DONE: +-- DONE: whatever ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Constructor From 3675ddaf0460c63fdba8282ea337e636ad1394ae Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Sun, 18 Apr 2021 12:09:37 +0200 Subject: [PATCH 33/73] Revert "Update Group.lua" --- Moose Development/Moose/Wrapper/Group.lua | 53 +---------------------- 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index 4ab573ec0..9c6c0a79c 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -2169,40 +2169,6 @@ function GROUP:GetThreatLevel() return threatlevelMax end ---- Get the unit in the group with the highest threat level, which is still alive. --- @param #GROUP self --- @return Wrapper.Unit#UNIT The most dangerous unit in the group. --- @return #number Threat level of the unit. -function GROUP:GetHighestThreat() - - -- Get units of the group. - local units=self:GetUnits() - - if units then - - local threat=nil ; local maxtl=0 - for _,_unit in pairs(units or {}) do - local unit=_unit --Wrapper.Unit#UNIT - - if unit and unit:IsAlive() then - - -- Threat level of group. - local tl=unit:GetThreatLevel() - - -- Check if greater the current threat. - if tl>maxtl then - maxtl=tl - threat=unit - end - end - end - - return threat, maxtl - end - - return nil, nil -end - --- Returns true if the first unit of the GROUP is in the air. -- @param Wrapper.Group#GROUP self @@ -2585,23 +2551,6 @@ do -- Players end ---- GROUND - Switch on/off radar emissions --- @param #GROUP self --- @param #boolean switch -function GROUP:EnableEmission(switch) - self:F2( self.GroupName ) - local switch = switch or false - - local DCSUnit = self:GetDCSObject() - - if DCSUnit then - - DCSUnit:enableEmission(switch) - - end - -end - --do -- Smoke -- ----- Signal a flare at the position of the GROUP. @@ -2692,4 +2641,4 @@ end -- -- -- ---end +--end \ No newline at end of file From 8ba3a30278e439aa1787337b792d139f889e4104 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 18 Apr 2021 14:34:36 +0200 Subject: [PATCH 34/73] Update appveyor.yml --- .appveyor/appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.appveyor/appveyor.yml b/.appveyor/appveyor.yml index 6b0baf00f..7fcd96a10 100644 --- a/.appveyor/appveyor.yml +++ b/.appveyor/appveyor.yml @@ -57,7 +57,7 @@ build_script: "Authorization" = "Bearer $token" "Content-type" = "application/json" } - $RequestBody = @{ accountName = 'funkyfranky'; projectSlug = 'moose-include'; branch = "$env:appveyor_repo_branch"; environmentVariables = @{} } | ConvertTo-Json + $RequestBody = @{ accountName = 'FlightControl-Master'; projectSlug = 'moose-include'; branch = "$env:appveyor_repo_branch"; environmentVariables = @{} } | ConvertTo-Json # Generate the new version ... $project = Invoke-RestMethod -method Post -Uri "$apiUrl/builds" -Headers $headers -Body $RequestBody } @@ -70,7 +70,7 @@ build_script: "Authorization" = "Bearer $token" "Content-type" = "application/json" } - $RequestBody = @{ accountName = 'funkyfranky'; projectSlug = 'moose-docs'; branch = "$env:appveyor_repo_branch"; environmentVariables = @{} } | ConvertTo-Json + $RequestBody = @{ accountName = 'FlightControl-Master'; projectSlug = 'moose-docs'; branch = "$env:appveyor_repo_branch"; environmentVariables = @{} } | ConvertTo-Json # get project with last build details $project = Invoke-RestMethod -method Post -Uri "$apiUrl/builds" -Headers $headers -Body $RequestBody } From 91b6da70afa3d7462bdaf435aa0e66ac80431953 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 18 Apr 2021 14:49:01 +0200 Subject: [PATCH 35/73] Update Event.lua --- Moose Development/Moose/Core/Event.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Core/Event.lua b/Moose Development/Moose/Core/Event.lua index 7bb39a1b7..07ddcfdf1 100644 --- a/Moose Development/Moose/Core/Event.lua +++ b/Moose Development/Moose/Core/Event.lua @@ -254,7 +254,7 @@ EVENTS = { -- Note that at the beginning of each field description, there is an indication which field will be populated depending on the object type involved in the Event: -- -- * A (Object.Category.)UNIT : A UNIT object type is involved in the Event. --- * A (Object.Category.)STATIC : A STATIC object type is involved in the Event.µ +-- * A (Object.Category.)STATIC : A STATIC object type is involved in the Event. -- -- @type EVENTDATA -- @field #number id The identifier of the event. From 9f095a1d280922516706c75e24a44a89dc396d07 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 18 Apr 2021 22:14:51 +0200 Subject: [PATCH 36/73] Update appveyor.yml - Token for my appveyor account. --- .appveyor/appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.appveyor/appveyor.yml b/.appveyor/appveyor.yml index 7fcd96a10..3649b6c8f 100644 --- a/.appveyor/appveyor.yml +++ b/.appveyor/appveyor.yml @@ -52,7 +52,7 @@ build_script: if( $env:appveyor_repo_branch -eq 'master' -or $env:appveyor_repo_branch -eq 'develop' ) { $apiUrl = 'https://ci.appveyor.com/api' - $token = 'qts80b5kpq0ooj4x6vvw' + $token = 'v2.bg2hb0fnxm96dr5f8yb' $headers = @{ "Authorization" = "Bearer $token" "Content-type" = "application/json" @@ -65,7 +65,7 @@ build_script: if( $env:appveyor_repo_branch -eq 'master' -or $env:appveyor_repo_branch -eq 'develop' ) { $apiUrl = 'https://ci.appveyor.com/api' - $token = 'qts80b5kpq0ooj4x6vvw' + $token = 'v2.bg2hb0fnxm96dr5f8yb' $headers = @{ "Authorization" = "Bearer $token" "Content-type" = "application/json" From 2d6545429aadb161ecbfd944b4495e61a5428686 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 18 Apr 2021 22:16:46 +0200 Subject: [PATCH 37/73] Update Unit.lua - Appveyor test --- Moose Development/Moose/Wrapper/Unit.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Wrapper/Unit.lua b/Moose Development/Moose/Wrapper/Unit.lua index 41b6fed81..65199d97d 100644 --- a/Moose Development/Moose/Wrapper/Unit.lua +++ b/Moose Development/Moose/Wrapper/Unit.lua @@ -154,7 +154,7 @@ function UNIT:Name() return self.UnitName end ---- Get the DCS unit object you want. +--- Get the DCS unit object. -- @param #UNIT self -- @return DCS#Unit function UNIT:GetDCSObject() From 1d6be07cff0fd5172f1f7399f13d0ebfaee306c7 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 18 Apr 2021 22:59:20 +0200 Subject: [PATCH 38/73] Update appveyor.yml --- .appveyor/appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.appveyor/appveyor.yml b/.appveyor/appveyor.yml index 3649b6c8f..687110cf4 100644 --- a/.appveyor/appveyor.yml +++ b/.appveyor/appveyor.yml @@ -51,6 +51,7 @@ build_script: - ps: | if( $env:appveyor_repo_branch -eq 'master' -or $env:appveyor_repo_branch -eq 'develop' ) { + echo "Hello World!" $apiUrl = 'https://ci.appveyor.com/api' $token = 'v2.bg2hb0fnxm96dr5f8yb' $headers = @{ From 0577940d58658221262488a11d592cf7848e08fd Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Mon, 19 Apr 2021 20:38:50 +0200 Subject: [PATCH 39/73] Update appveyor.yml --- .appveyor/appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.appveyor/appveyor.yml b/.appveyor/appveyor.yml index 687110cf4..ad1246a3c 100644 --- a/.appveyor/appveyor.yml +++ b/.appveyor/appveyor.yml @@ -53,7 +53,7 @@ build_script: { echo "Hello World!" $apiUrl = 'https://ci.appveyor.com/api' - $token = 'v2.bg2hb0fnxm96dr5f8yb' + $token = 'v2.6hcv3ige78kg3yvg4ge8' $headers = @{ "Authorization" = "Bearer $token" "Content-type" = "application/json" @@ -66,7 +66,7 @@ build_script: if( $env:appveyor_repo_branch -eq 'master' -or $env:appveyor_repo_branch -eq 'develop' ) { $apiUrl = 'https://ci.appveyor.com/api' - $token = 'v2.bg2hb0fnxm96dr5f8yb' + $token = 'v2.6hcv3ige78kg3yvg4ge8' $headers = @{ "Authorization" = "Bearer $token" "Content-type" = "application/json" From 40700a387c273f87e6cbf932e5dc633b9b6dc6da Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Mon, 19 Apr 2021 20:42:24 +0200 Subject: [PATCH 40/73] Update appveyor.yml --- .appveyor/appveyor.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.appveyor/appveyor.yml b/.appveyor/appveyor.yml index ad1246a3c..0ab5e1e66 100644 --- a/.appveyor/appveyor.yml +++ b/.appveyor/appveyor.yml @@ -27,23 +27,23 @@ init: install: # Outcomment if lua environment invalidates and needs to be reinstalled, otherwise all will run from the cache. -# - call choco install 7zip.commandline -# - call choco install lua51 -# - call choco install luarocks -# - call refreshenv -# - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" -# - cmd: PATH = %PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\bin -# - cmd: set LUA_PATH = %LUA_PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?.lua;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?\init.lua -# - cmd: set LUA_CPATH = %LUA_CPATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\lib\lua\5.1\?.dll -# - call luarocks install luasrcdiet -# - call luarocks install checks -# - call luarocks install luadocumentor -# - call luarocks install luacheck +call choco install 7zip.commandline +call choco install lua51 +call choco install luarocks +call refreshenv +call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" +cmd: PATH = %PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\bin +cmd: set LUA_PATH = %LUA_PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?.lua;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?\init.lua +cmd: set LUA_CPATH = %LUA_CPATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\lib\lua\5.1\?.dll +call luarocks install luasrcdiet +call luarocks install checks +call luarocks install luadocumentor +call luarocks install luacheck #cache: -# - C:\ProgramData\chocolatey\lib -# - C:\ProgramData\chocolatey\bin +C:\ProgramData\chocolatey\lib +C:\ProgramData\chocolatey\bin From b2eba4911a2459f4250dbbc8525a57986bb22152 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Mon, 19 Apr 2021 20:44:50 +0200 Subject: [PATCH 41/73] Update appveyor.yml --- .appveyor/appveyor.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.appveyor/appveyor.yml b/.appveyor/appveyor.yml index 0ab5e1e66..f59be974d 100644 --- a/.appveyor/appveyor.yml +++ b/.appveyor/appveyor.yml @@ -27,18 +27,18 @@ init: install: # Outcomment if lua environment invalidates and needs to be reinstalled, otherwise all will run from the cache. -call choco install 7zip.commandline -call choco install lua51 -call choco install luarocks -call refreshenv -call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" +- call choco install 7zip.commandline +- call choco install lua51 +- call choco install luarocks +- call refreshenv +- call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" cmd: PATH = %PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\bin cmd: set LUA_PATH = %LUA_PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?.lua;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?\init.lua cmd: set LUA_CPATH = %LUA_CPATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\lib\lua\5.1\?.dll -call luarocks install luasrcdiet -call luarocks install checks -call luarocks install luadocumentor -call luarocks install luacheck +- call luarocks install luasrcdiet +- call luarocks install checks +- call luarocks install luadocumentor +- call luarocks install luacheck #cache: From 3749686882ef13c1c1e9d747c9f01459c732475c Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Mon, 19 Apr 2021 20:46:30 +0200 Subject: [PATCH 42/73] Update appveyor.yml --- .appveyor/appveyor.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.appveyor/appveyor.yml b/.appveyor/appveyor.yml index f59be974d..78c43a456 100644 --- a/.appveyor/appveyor.yml +++ b/.appveyor/appveyor.yml @@ -26,19 +26,20 @@ init: # - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) install: + - cmd: # Outcomment if lua environment invalidates and needs to be reinstalled, otherwise all will run from the cache. -- call choco install 7zip.commandline -- call choco install lua51 -- call choco install luarocks -- call refreshenv -- call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" -cmd: PATH = %PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\bin -cmd: set LUA_PATH = %LUA_PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?.lua;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?\init.lua -cmd: set LUA_CPATH = %LUA_CPATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\lib\lua\5.1\?.dll -- call luarocks install luasrcdiet -- call luarocks install checks -- call luarocks install luadocumentor -- call luarocks install luacheck +call choco install 7zip.commandline +# - call choco install lua51 +# - call choco install luarocks +# - call refreshenv +# - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" +# cmd: PATH = %PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\bin +# cmd: set LUA_PATH = %LUA_PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?.lua;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?\init.lua +# cmd: set LUA_CPATH = %LUA_CPATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\lib\lua\5.1\?.dll +# - call luarocks install luasrcdiet +# - call luarocks install checks +# - call luarocks install luadocumentor +# - call luarocks install luacheck #cache: From 82da7a8f24fc4c17bc2d4c16c3f60bde44fb8818 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Mon, 19 Apr 2021 20:47:16 +0200 Subject: [PATCH 43/73] Update appveyor.yml --- .appveyor/appveyor.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.appveyor/appveyor.yml b/.appveyor/appveyor.yml index 78c43a456..a89bb8662 100644 --- a/.appveyor/appveyor.yml +++ b/.appveyor/appveyor.yml @@ -29,17 +29,17 @@ install: - cmd: # Outcomment if lua environment invalidates and needs to be reinstalled, otherwise all will run from the cache. call choco install 7zip.commandline -# - call choco install lua51 -# - call choco install luarocks -# - call refreshenv -# - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" -# cmd: PATH = %PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\bin -# cmd: set LUA_PATH = %LUA_PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?.lua;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?\init.lua -# cmd: set LUA_CPATH = %LUA_CPATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\lib\lua\5.1\?.dll -# - call luarocks install luasrcdiet -# - call luarocks install checks -# - call luarocks install luadocumentor -# - call luarocks install luacheck +call choco install lua51 +call choco install luarocks +call refreshenv +call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" +cmd: PATH = %PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\bin +cmd: set LUA_PATH = %LUA_PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?.lua;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?\init.lua +cmd: set LUA_CPATH = %LUA_CPATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\lib\lua\5.1\?.dll +call luarocks install luasrcdiet +call luarocks install checks +call luarocks install luadocumentor +call luarocks install luacheck #cache: From 3b2af6ea07ecd68b0b4aa511cfb6ca360f8eb20d Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Mon, 19 Apr 2021 20:49:17 +0200 Subject: [PATCH 44/73] Update appveyor.yml --- .appveyor/appveyor.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.appveyor/appveyor.yml b/.appveyor/appveyor.yml index a89bb8662..2af7fd529 100644 --- a/.appveyor/appveyor.yml +++ b/.appveyor/appveyor.yml @@ -28,21 +28,21 @@ init: install: - cmd: # Outcomment if lua environment invalidates and needs to be reinstalled, otherwise all will run from the cache. -call choco install 7zip.commandline -call choco install lua51 -call choco install luarocks -call refreshenv -call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" -cmd: PATH = %PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\bin -cmd: set LUA_PATH = %LUA_PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?.lua;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?\init.lua -cmd: set LUA_CPATH = %LUA_CPATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\lib\lua\5.1\?.dll -call luarocks install luasrcdiet -call luarocks install checks -call luarocks install luadocumentor -call luarocks install luacheck + call choco install 7zip.commandline + call choco install lua51 + call choco install luarocks + call refreshenv + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" + cmd: PATH = %PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\bin + cmd: set LUA_PATH = %LUA_PATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?.lua;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\share\lua\5.1\?\init.lua + cmd: set LUA_CPATH = %LUA_CPATH%;C:\ProgramData\chocolatey\lib\luarocks\luarocks-2.4.3-win32\systree\lib\lua\5.1\?.dll + call luarocks install luasrcdiet + call luarocks install checks + call luarocks install luadocumentor + call luarocks install luacheck -#cache: +cache: C:\ProgramData\chocolatey\lib C:\ProgramData\chocolatey\bin From 8ae6192a5feb5ff6e5c1ba8c47aa479e9d9a3b95 Mon Sep 17 00:00:00 2001 From: IdefixRC Date: Tue, 20 Apr 2021 15:43:45 +0800 Subject: [PATCH 45/73] Create Airbase.lua New Syria Airbases added to list: H4, Gaziantep, Rosh Pina, Sayqal, Shayrat, Tiyas, Tha'lah and Naqoura --- Moose Development/Moose/Wrapper/Airbase.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Moose Development/Moose/Wrapper/Airbase.lua b/Moose Development/Moose/Wrapper/Airbase.lua index 317c3b448..df18bc9ef 100644 --- a/Moose Development/Moose/Wrapper/Airbase.lua +++ b/Moose Development/Moose/Wrapper/Airbase.lua @@ -361,6 +361,14 @@ AIRBASE.TheChannel = { -- * AIRBASE.Syria.Beirut_Rafic_Hariri -- * AIRBASE.Syria.An_Nasiriyah -- * AIRBASE.Syria.Abu_al_Duhur +-- * AIRBASE.Syria.H4 +-- * AIRBASE.Syria.Gaziantep +-- * AIRBASE.Syria.Rosh_Pina +-- * AIRBASE.Syria.Sayqal +-- * AIRBASE.Syria.Shayrat +-- * AIRBASE.Syria.Tiyas +-- * AIRBASE.Syria.Tha_lah +-- * AIRBASE.Syria.Naqoura -- -- @field Syria AIRBASE.Syria={ @@ -397,6 +405,14 @@ AIRBASE.Syria={ ["Beirut_Rafic_Hariri"]="Beirut-Rafic Hariri", ["An_Nasiriyah"]="An Nasiriyah", ["Abu_al_Duhur"]="Abu al-Duhur", + ["H4"]="H4", + ["Gaziantep"]="Gaziantep", + ["Rosh_Pina"]="Rosh Pina", + ["Sayqal"]="Sayqal", + ["Shayrat"]="Shayrat", + ["Tiyas"]="Tiyas", + ["Tha_lah"]="Tha'lah", + ["Naqoura"]="Naqoura", } From 2531a25c9e127059ef49306f6761a0dfba965707 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Tue, 20 Apr 2021 11:36:59 +0200 Subject: [PATCH 46/73] Update Group.lua Add EnableEmissions --- Moose Development/Moose/Wrapper/Group.lua | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index 9c6c0a79c..1a2f00fa8 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -2551,6 +2551,23 @@ do -- Players end +--- GROUND - Switch on/off radar emissions +-- @param #GROUP self +-- @param #boolean switch +function GROUP:EnableEmission(switch) + self:F2( self.GroupName ) + local switch = switch or false + + local DCSUnit = self:GetDCSObject() + + if DCSUnit then + + DCSUnit:enableEmission(switch) + + end + +end + --do -- Smoke -- ----- Signal a flare at the position of the GROUP. @@ -2641,4 +2658,4 @@ end -- -- -- ---end \ No newline at end of file +--end From a8549e2b7d4df7c5f89c1c9110cc8ff41c3c05e6 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Tue, 20 Apr 2021 16:50:00 +0200 Subject: [PATCH 47/73] Update Airbase.lua --- Moose Development/Moose/Wrapper/Airbase.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Moose Development/Moose/Wrapper/Airbase.lua b/Moose Development/Moose/Wrapper/Airbase.lua index d015bbde9..2f3c1603e 100644 --- a/Moose Development/Moose/Wrapper/Airbase.lua +++ b/Moose Development/Moose/Wrapper/Airbase.lua @@ -362,6 +362,14 @@ AIRBASE.TheChannel = { -- * AIRBASE.Syria.Beirut_Rafic_Hariri -- * AIRBASE.Syria.An_Nasiriyah -- * AIRBASE.Syria.Abu_al_Duhur +-- * AIRBASE.Syria.H4 +-- * AIRBASE.Syria.Gaziantep +-- * AIRBASE.Syria.Rosh_Pina +-- * AIRBASE.Syria.Sayqal +-- * AIRBASE.Syria.Shayrat +-- * AIRBASE.Syria.Tiyas +-- * AIRBASE.Syria.Tha_lah +-- * AIRBASE.Syria.Naqoura -- -- @field Syria AIRBASE.Syria={ @@ -398,6 +406,14 @@ AIRBASE.Syria={ ["Beirut_Rafic_Hariri"]="Beirut-Rafic Hariri", ["An_Nasiriyah"]="An Nasiriyah", ["Abu_al_Duhur"]="Abu al-Duhur", + ["H4"]="H4", + ["Gaziantep"]="Gaziantep", + ["Rosh_Pina"]="Rosh Pina", + ["Sayqal"]="Sayqal", + ["Shayrat"]="Shayrat", + ["Tiyas"]="Tiyas", + ["Tha_lah"]="Tha'lah", + ["Naqoura"]="Naqoura", } From 18fca6461bb6ff7d08b73403475c40689fda84ac Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Tue, 20 Apr 2021 17:27:48 +0200 Subject: [PATCH 48/73] Update Group.lua --- Moose Development/Moose/Wrapper/Group.lua | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index 9c6c0a79c..1a2f00fa8 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -2551,6 +2551,23 @@ do -- Players end +--- GROUND - Switch on/off radar emissions +-- @param #GROUP self +-- @param #boolean switch +function GROUP:EnableEmission(switch) + self:F2( self.GroupName ) + local switch = switch or false + + local DCSUnit = self:GetDCSObject() + + if DCSUnit then + + DCSUnit:enableEmission(switch) + + end + +end + --do -- Smoke -- ----- Signal a flare at the position of the GROUP. @@ -2641,4 +2658,4 @@ end -- -- -- ---end \ No newline at end of file +--end From 19eb9dca30a3c794c902e41ec3a6fe2200fdc004 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Tue, 20 Apr 2021 18:49:54 +0200 Subject: [PATCH 49/73] Update Utils.lua --- Moose Development/Moose/Utilities/Utils.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Utilities/Utils.lua b/Moose Development/Moose/Utilities/Utils.lua index d53284871..1e9c2597b 100644 --- a/Moose Development/Moose/Utilities/Utils.lua +++ b/Moose Development/Moose/Utilities/Utils.lua @@ -6,7 +6,7 @@ -- -- ### Contributions: -- --- * FlightControl : Rework to OO framework +-- * FlightControl : Rework to OO framework. -- -- @module Utils -- @image MOOSE.JPG From 62c42adebc4a98614174fdf8af1f1666a0ccc0b2 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Wed, 21 Apr 2021 15:48:54 +0200 Subject: [PATCH 50/73] Update DCS.lua --- Moose Development/Moose/DCS.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/DCS.lua b/Moose Development/Moose/DCS.lua index 9fcac18cb..92052d5cf 100644 --- a/Moose Development/Moose/DCS.lua +++ b/Moose Development/Moose/DCS.lua @@ -1226,7 +1226,7 @@ do -- Group -- @param #Group self -- @return #number - --- Returns initial size of the group. If some of the units will be destroyed, initial size of the group will not be changed. Initial size limits the unitNumber parameter for Group.getUnit() function. + --- Returns initial size of the group. If some of the units will be destroyed, initial size of the group will not be changed; Initial size limits the unitNumber parameter for Group.getUnit() function. -- @function [parent=#Group] getInitialSize -- @param #Group self -- @return #number From f4f12f786cfb7afd9594a33c5d9eb1c2f1c2c077 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Wed, 21 Apr 2021 18:52:44 +0200 Subject: [PATCH 51/73] Update Airboss.lua Escape error --- Moose Development/Moose/Ops/Airboss.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index 12370b7a7..cf5057e81 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -17846,7 +17846,7 @@ function AIRBOSS:onbeforeLoad(From, Event, To, path, filename) -- Check default path. if path==nil and not lfs then - self:E(self.lid.."WARNING: lfs not desanitized. Results will be saved in DCS installation root directory rather than your \"Saved Games\DCS\" folder.") + self:E(self.lid.."WARNING: lfs not desanitized. Results will be saved in DCS installation root directory rather than your \"Saved Games\\DCS\" folder.") end -- Set path or default. From a1a414925fb61d52f58d2728f7479cd2b2d71dd5 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Thu, 22 Apr 2021 08:19:56 +0200 Subject: [PATCH 52/73] Update Airboss.lua --- Moose Development/Moose/Ops/Airboss.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index 041843d56..dc3de77a3 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -18037,7 +18037,7 @@ function AIRBOSS:onbeforeLoad(From, Event, To, path, filename) -- Check default path. if path==nil and not lfs then - self:E(self.lid.."WARNING: lfs not desanitized. Results will be saved in DCS installation root directory rather than your \"Saved Games\DCS\" folder.") + self:E(self.lid.."WARNING: lfs not desanitized. Results will be saved in DCS installation root directory rather than your \"Saved Games\\DCS\" folder.") end -- Set path or default. From 9d6851adec13578a3fb968bdd98f4a14847917fe Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Thu, 22 Apr 2021 08:30:19 +0200 Subject: [PATCH 53/73] Update Airboss.lua Escape error 17933 --- Moose Development/Moose/Ops/Airboss.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index dc3de77a3..38d04d4ff 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -17930,7 +17930,7 @@ function AIRBOSS:onbeforeSave(From, Event, To, path, filename) -- Check default path. if path==nil and not lfs then - self:E(self.lid.."WARNING: lfs not desanitized. Results will be saved in DCS installation root directory rather than your \"Saved Games\DCS\" folder.") + self:E(self.lid.."WARNING: lfs not desanitized. Results will be saved in DCS installation root directory rather than your \"Saved Games\\DCS\" folder.") end return true From 2475f22937e63fc3e3f2b26080a922368a634038 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Thu, 22 Apr 2021 10:08:57 +0200 Subject: [PATCH 54/73] Create .luacheckrc --- .luacheckrc | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .luacheckrc diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 000000000..b29cbbc22 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,54 @@ +ignore = { + "011", -- A syntax error. + "021", -- An invalid inline option. + "022", -- An unpaired inline push directive. + "023", -- An unpaired inline pop directive. + "111", -- Setting an undefined global variable. + "112", -- Mutating an undefined global variable. + "113", -- Accessing an undefined global variable. + "121", -- Setting a read-only global variable. + "122", -- Setting a read-only field of a global variable. + "131", -- Unused implicitly defined global variable. + "142", -- Setting an undefined field of a global variable. + "143", -- Accessing an undefined field of a global variable. + "211", -- Unused local variable. + "212", -- Unused argument. + "213", -- Unused loop variable. + "221", -- Local variable is accessed but never set. + "231", -- Local variable is set but never accessed. + "232", -- An argument is set but never accessed. + "233", -- Loop variable is set but never accessed. + "241", -- Local variable is mutated but never accessed. + "311", -- Value assigned to a local variable is unused. + "312", -- Value of an argument is unused. + "313", -- Value of a loop variable is unused. + "314", -- Value of a field in a table literal is unused. + "321", -- Accessing uninitialized local variable. + "331", -- Value assigned to a local variable is mutated but never accessed. + "341", -- Mutating uninitialized local variable. + "411", -- Redefining a local variable. + "412", -- Redefining an argument. + "413", -- Redefining a loop variable. + "421", -- Shadowing a local variable. + "422", -- Shadowing an argument. + "423", -- Shadowing a loop variable. + "431", -- Shadowing an upvalue. + "432", -- Shadowing an upvalue argument. + "433", -- Shadowing an upvalue loop variable. + "511", -- Unreachable code. + "512", -- Loop can be executed at most once. + "521", -- Unused label. + "531", -- Left-hand side of an assignment is too short. + "532", -- Left-hand side of an assignment is too long. + "541", -- An empty do end block. + "542", -- An empty if branch. + "551", -- An empty statement. + "561", -- Cyclomatic complexity of a function is too high. + "571", -- A numeric for loop goes from #(expr) down to 1 or less without negative step. + "611", -- A line consists of nothing but whitespace. + "612", -- A line contains trailing whitespace. + "613", -- Trailing whitespace in a string. + "614", -- Trailing whitespace in a comment. + "621", -- Inconsistent indentation (SPACE followed by TAB). + "631", -- Line is too long. +} From 0259e41ce8f194737d4cddadd49bd1534bc152e7 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Thu, 22 Apr 2021 10:10:59 +0200 Subject: [PATCH 55/73] Create .luacheckrc --- .luacheckrc | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .luacheckrc diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 000000000..b29cbbc22 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,54 @@ +ignore = { + "011", -- A syntax error. + "021", -- An invalid inline option. + "022", -- An unpaired inline push directive. + "023", -- An unpaired inline pop directive. + "111", -- Setting an undefined global variable. + "112", -- Mutating an undefined global variable. + "113", -- Accessing an undefined global variable. + "121", -- Setting a read-only global variable. + "122", -- Setting a read-only field of a global variable. + "131", -- Unused implicitly defined global variable. + "142", -- Setting an undefined field of a global variable. + "143", -- Accessing an undefined field of a global variable. + "211", -- Unused local variable. + "212", -- Unused argument. + "213", -- Unused loop variable. + "221", -- Local variable is accessed but never set. + "231", -- Local variable is set but never accessed. + "232", -- An argument is set but never accessed. + "233", -- Loop variable is set but never accessed. + "241", -- Local variable is mutated but never accessed. + "311", -- Value assigned to a local variable is unused. + "312", -- Value of an argument is unused. + "313", -- Value of a loop variable is unused. + "314", -- Value of a field in a table literal is unused. + "321", -- Accessing uninitialized local variable. + "331", -- Value assigned to a local variable is mutated but never accessed. + "341", -- Mutating uninitialized local variable. + "411", -- Redefining a local variable. + "412", -- Redefining an argument. + "413", -- Redefining a loop variable. + "421", -- Shadowing a local variable. + "422", -- Shadowing an argument. + "423", -- Shadowing a loop variable. + "431", -- Shadowing an upvalue. + "432", -- Shadowing an upvalue argument. + "433", -- Shadowing an upvalue loop variable. + "511", -- Unreachable code. + "512", -- Loop can be executed at most once. + "521", -- Unused label. + "531", -- Left-hand side of an assignment is too short. + "532", -- Left-hand side of an assignment is too long. + "541", -- An empty do end block. + "542", -- An empty if branch. + "551", -- An empty statement. + "561", -- Cyclomatic complexity of a function is too high. + "571", -- A numeric for loop goes from #(expr) down to 1 or less without negative step. + "611", -- A line consists of nothing but whitespace. + "612", -- A line contains trailing whitespace. + "613", -- Trailing whitespace in a string. + "614", -- Trailing whitespace in a comment. + "621", -- Inconsistent indentation (SPACE followed by TAB). + "631", -- Line is too long. +} From 5091ed7d6d564ba1764ef79ab59c1eb38f6e6198 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Thu, 22 Apr 2021 10:26:02 +0200 Subject: [PATCH 56/73] Update Airboss.lua --- Moose Development/Moose/Ops/Airboss.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index cf5057e81..a6924682d 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -17739,7 +17739,7 @@ function AIRBOSS:onbeforeSave(From, Event, To, path, filename) -- Check default path. if path==nil and not lfs then - self:E(self.lid.."WARNING: lfs not desanitized. Results will be saved in DCS installation root directory rather than your \"Saved Games\DCS\" folder.") + self:E(self.lid.."WARNING: lfs not desanitized. Results will be saved in DCS installation root directory rather than your \"Saved Games\\DCS\" folder.") end return true From aa13583aa7bfc4b817dc477e71746c8d56adca61 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Thu, 22 Apr 2021 12:39:35 +0200 Subject: [PATCH 57/73] Update README.md added badge --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7ba71d91c..976a47f96 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Build status](https://ci.appveyor.com/api/projects/status/1y8nfmx7lwsn33tt?svg=true)](https://ci.appveyor.com/project/Applevangelist/MOOSE) + # MOOSE framework MOOSE is a **M**ission **O**bject **O**riented **S**cripting **E**nvironment, and is meant for mission designers in DCS World. @@ -50,9 +52,7 @@ This repository contains all the demonstration missions in packed format (*.miz) This repository contains all the demonstration missions in unpacked format. That means that there is no .miz file included, but all the .miz contents are unpacked. - - - + ## [MOOSE Web Site](https://flightcontrol-master.github.io/MOOSE_DOCS/) Documentation on the MOOSE class hierarchy, usage guides and background information can be found here for normal users, beta testers and contributors. From 9c6c2ec5ca735bf315d2d299fe6614762806a7e9 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Thu, 22 Apr 2021 12:46:37 +0200 Subject: [PATCH 58/73] Update .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 5e42c0c93..fe5b6b4f8 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,8 @@ local.properties # External tool builders .externalToolBuilders/ +# AppVeyor +.appveyor/ # CDT-specific .cproject From 459ff8038ba8ad2866a30a0006b0b91ad3e22c1a Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Fri, 23 Apr 2021 09:51:58 +0200 Subject: [PATCH 59/73] Update Controllable.lua Some Docu updates --- Moose Development/Moose/Wrapper/Controllable.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index 951342d97..b07d09046 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -2910,7 +2910,7 @@ end --- Set option for Rules of Engagement (ROE). -- @param Wrapper.Controllable#CONTROLLABLE self -- @param #number ROEvalue ROE value. See ENUMS.ROE. --- @return Wrapper.Controllable#CONTROLLABLE self +-- @return #CONTROLLABLE self function CONTROLLABLE:OptionROE(ROEvalue) local DCSControllable = self:GetDCSObject() @@ -2952,8 +2952,8 @@ function CONTROLLABLE:OptionROEHoldFirePossible() end --- Weapons Hold: AI will hold fire under all circumstances. --- @param Wrapper.Controllable#CONTROLLABLE self --- @return Wrapper.Controllable#CONTROLLABLE self +-- @param #CONTROLLABLE self +-- @return #CONTROLLABLE self function CONTROLLABLE:OptionROEHoldFire() self:F2( { self.ControllableName } ) @@ -3551,7 +3551,7 @@ end -- Note that when WayPointInitialize is called, the Mission of the controllable is RESTARTED! -- @param #CONTROLLABLE self -- @param #table WayPoints If WayPoints is given, then use the route. --- @return #CONTROLLABLE +-- @return #CONTROLLABLE self function CONTROLLABLE:WayPointInitialize( WayPoints ) self:F( { WayPoints } ) @@ -3582,7 +3582,7 @@ end -- @param #number WayPoint The waypoint number. Note that the start waypoint on the route is WayPoint 1! -- @param #number WayPointIndex When defining multiple WayPoint functions for one WayPoint, use WayPointIndex to set the sequence of actions. -- @param #function WayPointFunction The waypoint function to be called when the controllable moves over the waypoint. The waypoint function takes variable parameters. --- @return #CONTROLLABLE +-- @return #CONTROLLABLE self function CONTROLLABLE:WayPointFunction( WayPoint, WayPointIndex, WayPointFunction, ... ) self:F2( { WayPoint, WayPointIndex, WayPointFunction } ) @@ -3598,7 +3598,7 @@ end -- @param #CONTROLLABLE self -- @param #number WayPoint The WayPoint from where to execute the mission. -- @param #number WaitTime The amount seconds to wait before initiating the mission. --- @return #CONTROLLABLE +-- @return #CONTROLLABLE self function CONTROLLABLE:WayPointExecute( WayPoint, WaitTime ) self:F( { WayPoint, WaitTime } ) @@ -3682,6 +3682,7 @@ end --- Sets Controllable Option for A2A attack range for AIR FIGHTER units. -- @param #CONTROLLABLE self -- @param #number range Defines the range +-- @return #CONTROLLABLE self -- @usage Range can be one of MAX_RANGE = 0, NEZ_RANGE = 1, HALF_WAY_RMAX_NEZ = 2, TARGET_THREAT_EST = 3, RANDOM_RANGE = 4. Defaults to 3. See: https://wiki.hoggitworld.com/view/DCS_option_missileAttack function CONTROLLABLE:OptionAAAttackRange(range) self:F2( { self.ControllableName } ) @@ -3733,6 +3734,7 @@ end -- @param #number radius Radius of the relocation zone, default 500 -- @param #boolean onroad If true, route on road (less problems with AI way finding), default true -- @param #boolean shortcut If true and onroad is set, take a shorter route - if available - off road, default false +-- @return #CONTROLLABLE self function CONTROLLABLE:RelocateGroundRandomInRadius(speed, radius, onroad, shortcut) self:F2( { self.ControllableName } ) From 41274e7801710de87fdc1c50379f54f494b87190 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Fri, 23 Apr 2021 10:59:22 +0200 Subject: [PATCH 60/73] Update Controllable.lua --- .../Moose/Wrapper/Controllable.lua | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index 5db0632ab..dc004b4c1 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -3753,3 +3753,24 @@ function CONTROLLABLE:RelocateGroundRandomInRadius(speed, radius, onroad, shortc return self end + +--- Defines how long a GROUND unit/group will move to avoid an ongoing attack. +-- @param #CONTROLLABLE self +-- @param #number Seconds Any positive number: AI will disperse, but only for the specified time before continuing their route. 0: AI will not disperse. +-- @return #CONTROLLABLE self +function CONTROLLABLE:OptionDisperseOnAttack(Seconds) + self:F2( { self.ControllableName } ) + -- Set default if not specified. + local seconds = Seconds or 0 + local DCSControllable = self:GetDCSObject() + if DCSControllable then + local Controller = self:_GetController() + if Controller then + if self:IsGround() then + self:SetOption(AI.Option.GROUND.id.DISPERSE_ON_ATTACK, seconds) + end + end + return self + end + return nil +end From bbb21749578b6692a44910e59e878196f82d1c5a Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Fri, 23 Apr 2021 12:00:49 +0200 Subject: [PATCH 61/73] Update Controllable.lua added `OptionDisperseOnAttack` for GROUND units --- .../Moose/Wrapper/Controllable.lua | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index b07d09046..55fd34f12 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -3758,3 +3758,24 @@ function CONTROLLABLE:RelocateGroundRandomInRadius(speed, radius, onroad, shortc return self end + +--- Defines how long a GROUND unit/group will move to avoid an ongoing attack. +-- @param #CONTROLLABLE self +-- @param #number Seconds Any positive number: AI will disperse, but only for the specified time before continuing their route. 0: AI will not disperse. +-- @return #CONTROLLABLE self +function CONTROLLABLE:OptionDisperseOnAttack(Seconds) + self:F2( { self.ControllableName } ) + -- Set default if not specified. + local seconds = Seconds or 0 + local DCSControllable = self:GetDCSObject() + if DCSControllable then + local Controller = self:_GetController() + if Controller then + if self:IsGround() then + self:SetOption(AI.Option.GROUND.id.DISPERSE_ON_ATTACK, seconds) + end + end + return self + end + return nil +end From dc64b98c59b733fc2e9db111581b0ba068c2bdf2 Mon Sep 17 00:00:00 2001 From: Frank Date: Fri, 23 Apr 2021 13:27:24 +0200 Subject: [PATCH 62/73] Update Act_Route.lua - Fixed bug in ACT_GROUP:GetRouteText --- Moose Development/Moose/Actions/Act_Route.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Actions/Act_Route.lua b/Moose Development/Moose/Actions/Act_Route.lua index f2c5ebcda..7f075b420 100644 --- a/Moose Development/Moose/Actions/Act_Route.lua +++ b/Moose Development/Moose/Actions/Act_Route.lua @@ -190,7 +190,7 @@ do -- ACT_ROUTE self:F( { ZoneName = ZoneName } ) local Zone = Zone -- Core.Zone#ZONE local ZoneCoord = Zone:GetCoordinate() - local ZoneDistance = ZoneCoord:Get2DDistance( self.Coordinate ) + local ZoneDistance = ZoneCoord:Get2DDistance( Coordinate ) self:F( { ShortestDistance, ShortestReferenceName } ) if ShortestDistance == 0 or ZoneDistance < ShortestDistance then ShortestDistance = ZoneDistance From 57f6096aa1aa8418a934a65ea7cc2a9da74359dc Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Sun, 25 Apr 2021 20:24:41 +0200 Subject: [PATCH 63/73] Update Controllable.lua (#1518) Error line 1466 --- Moose Development/Moose/Wrapper/Controllable.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index 55fd34f12..e2d3edca6 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -1463,7 +1463,7 @@ function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius, AmmoCount, WeaponType, Alti DCSTask.params.weaponType=WeaponType end - self:I(DCSTask) + --self:I(DCSTask) return DCSTask end From a466365949414f17e26acea5c30961922bea4168 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Sun, 25 Apr 2021 20:31:02 +0200 Subject: [PATCH 64/73] Update Controllable.lua (#1519) Error line 1463 --- Moose Development/Moose/Wrapper/Controllable.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index 0e98f49e4..165835229 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -1460,7 +1460,7 @@ function CONTROLLABLE:TaskFireAtPoint( Vec2, Radius, AmmoCount, WeaponType, Alti DCSTask.params.weaponType=WeaponType end - self:I(DCSTask) + --self:I(DCSTask) return DCSTask end From d5bf28f799e40a6285541513014e8b7f17badb38 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Thu, 29 Apr 2021 18:20:03 +0200 Subject: [PATCH 65/73] Update AirWing.lua (#1521) Markpoint honored for direct calls from #OPSGROUP --- Moose Development/Moose/Ops/AirWing.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Ops/AirWing.lua b/Moose Development/Moose/Ops/AirWing.lua index 706133f4b..202eb631d 100644 --- a/Moose Development/Moose/Ops/AirWing.lua +++ b/Moose Development/Moose/Ops/AirWing.lua @@ -721,11 +721,13 @@ end --- Update marker of the patrol point. -- @param #AIRWING.PatrolData point Patrol point table. -function AIRWING.UpdatePatrolPointMarker(point) +function AIRWING:UpdatePatrolPointMarker(point) + if self.markpoints then -- sometimes there's a direct call from #OPSGROUP local text=string.format("%s Occupied=%d\nheading=%03d, leg=%d NM, alt=%d ft, speed=%d kts", point.type, point.noccupied, point.heading, point.leg, point.altitude, point.speed) point.marker:UpdateText(text, 1) + end end From 7da1905ad3fe7cf0944c11755476920842d27d4e Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Sat, 1 May 2021 14:22:01 +0200 Subject: [PATCH 66/73] Update Event.lua (#1525) Updates for Events 33 and 6 - makes scoring also work again for STATIC targets --- Moose Development/Moose/Core/Event.lua | 43 ++++++++++++++++++-------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/Moose Development/Moose/Core/Event.lua b/Moose Development/Moose/Core/Event.lua index 07ddcfdf1..9d10bdbbc 100644 --- a/Moose Development/Moose/Core/Event.lua +++ b/Moose Development/Moose/Core/Event.lua @@ -1049,6 +1049,14 @@ function EVENT:onEvent( Event ) Event.IniCoalition = 0 Event.IniCategory = 0 Event.IniTypeName = "Ejected Pilot" + elseif Event.id == 33 then -- ejection seat discarded + Event.IniDCSUnit = Event.initiator + local ID=Event.initiator.id_ + Event.IniDCSUnitName = string.format("Ejection Seat ID %s", tostring(ID)) + Event.IniUnitName = Event.IniDCSUnitName + Event.IniCoalition = 0 + Event.IniCategory = 0 + Event.IniTypeName = "Ejection Seat" else Event.IniDCSUnit = Event.initiator Event.IniDCSUnitName = Event.IniDCSUnit:getName() @@ -1115,25 +1123,34 @@ function EVENT:onEvent( Event ) end if Event.TgtObjectCategory == Object.Category.STATIC then - BASE:T({Event = Event}) - --[[ - Event.TgtDCSUnit = Event.target + BASE:T({StaticTgtEvent = Event.id}) + -- get base data + Event.TgtDCSUnit = Event.target + if Event.target:isExist() and Event.id ~= 33 then -- leave out ejected seat object Event.TgtDCSUnitName = Event.TgtDCSUnit:getName() Event.TgtUnitName = Event.TgtDCSUnitName Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false ) Event.TgtCoalition = Event.TgtDCSUnit:getCoalition() Event.TgtCategory = Event.TgtDCSUnit:getDesc().category Event.TgtTypeName = Event.TgtDCSUnit:getTypeName() - --]] - -- Same as for Event Initiator above 2.7 issue - Event.TgtDCSUnit = Event.target - local ID=Event.initiator.id_ - Event.TgtDCSUnitName = string.format("Ejected Pilot ID %s", tostring(ID)) - Event.TgtUnitName = Event.TgtDCSUnitName - --Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false ) - Event.TgtCoalition = Event.IniCoalition - Event.TgtCategory = Event.IniCategory - Event.TgtTypeName = "Ejected Pilot" + else + Event.TgtDCSUnitName = string.format("No target object for Event ID %s", tostring(Event.id)) + Event.TgtUnitName = Event.TgtDCSUnitName + Event.TgtUnit = nil + Event.TgtCoalition = 0 + Event.TgtCategory = 0 + if Event.id == 6 then + Event.TgtTypeName = "Ejected Pilot" + Event.TgtDCSUnitName = string.format("Ejected Pilot ID %s", tostring(Event.IniDCSUnitName)) + Event.TgtUnitName = Event.TgtDCSUnitName + elseif Event.id == 33 then + Event.TgtTypeName = "Ejection Seat" + Event.TgtDCSUnitName = string.format("Ejection Seat ID %s", tostring(Event.IniDCSUnitName)) + Event.TgtUnitName = Event.TgtDCSUnitName + else + Event.TgtTypeName = "Static" + end + end end if Event.TgtObjectCategory == Object.Category.SCENERY then From 2bcc531e73c1abcad861577510a98b02272721cc Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Sat, 1 May 2021 14:26:03 +0200 Subject: [PATCH 67/73] Update Event.lua (#1526) Updates for Event 33 and 6 - also makes Scoring work again --- Moose Development/Moose/Core/Event.lua | 43 ++++++++++++++++++-------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/Moose Development/Moose/Core/Event.lua b/Moose Development/Moose/Core/Event.lua index 07ddcfdf1..9d10bdbbc 100644 --- a/Moose Development/Moose/Core/Event.lua +++ b/Moose Development/Moose/Core/Event.lua @@ -1049,6 +1049,14 @@ function EVENT:onEvent( Event ) Event.IniCoalition = 0 Event.IniCategory = 0 Event.IniTypeName = "Ejected Pilot" + elseif Event.id == 33 then -- ejection seat discarded + Event.IniDCSUnit = Event.initiator + local ID=Event.initiator.id_ + Event.IniDCSUnitName = string.format("Ejection Seat ID %s", tostring(ID)) + Event.IniUnitName = Event.IniDCSUnitName + Event.IniCoalition = 0 + Event.IniCategory = 0 + Event.IniTypeName = "Ejection Seat" else Event.IniDCSUnit = Event.initiator Event.IniDCSUnitName = Event.IniDCSUnit:getName() @@ -1115,25 +1123,34 @@ function EVENT:onEvent( Event ) end if Event.TgtObjectCategory == Object.Category.STATIC then - BASE:T({Event = Event}) - --[[ - Event.TgtDCSUnit = Event.target + BASE:T({StaticTgtEvent = Event.id}) + -- get base data + Event.TgtDCSUnit = Event.target + if Event.target:isExist() and Event.id ~= 33 then -- leave out ejected seat object Event.TgtDCSUnitName = Event.TgtDCSUnit:getName() Event.TgtUnitName = Event.TgtDCSUnitName Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false ) Event.TgtCoalition = Event.TgtDCSUnit:getCoalition() Event.TgtCategory = Event.TgtDCSUnit:getDesc().category Event.TgtTypeName = Event.TgtDCSUnit:getTypeName() - --]] - -- Same as for Event Initiator above 2.7 issue - Event.TgtDCSUnit = Event.target - local ID=Event.initiator.id_ - Event.TgtDCSUnitName = string.format("Ejected Pilot ID %s", tostring(ID)) - Event.TgtUnitName = Event.TgtDCSUnitName - --Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false ) - Event.TgtCoalition = Event.IniCoalition - Event.TgtCategory = Event.IniCategory - Event.TgtTypeName = "Ejected Pilot" + else + Event.TgtDCSUnitName = string.format("No target object for Event ID %s", tostring(Event.id)) + Event.TgtUnitName = Event.TgtDCSUnitName + Event.TgtUnit = nil + Event.TgtCoalition = 0 + Event.TgtCategory = 0 + if Event.id == 6 then + Event.TgtTypeName = "Ejected Pilot" + Event.TgtDCSUnitName = string.format("Ejected Pilot ID %s", tostring(Event.IniDCSUnitName)) + Event.TgtUnitName = Event.TgtDCSUnitName + elseif Event.id == 33 then + Event.TgtTypeName = "Ejection Seat" + Event.TgtDCSUnitName = string.format("Ejection Seat ID %s", tostring(Event.IniDCSUnitName)) + Event.TgtUnitName = Event.TgtDCSUnitName + else + Event.TgtTypeName = "Static" + end + end end if Event.TgtObjectCategory == Object.Category.SCENERY then From 596eb4c7e4744ce27fa124227d977711e2385e11 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Sat, 1 May 2021 17:13:07 +0200 Subject: [PATCH 68/73] Update Sead.lua Adjust to Event changes --- Moose Development/Moose/Functional/Sead.lua | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Moose Development/Moose/Functional/Sead.lua b/Moose Development/Moose/Functional/Sead.lua index 2c5abb451..420ec1a7e 100644 --- a/Moose Development/Moose/Functional/Sead.lua +++ b/Moose Development/Moose/Functional/Sead.lua @@ -109,7 +109,7 @@ function SEAD:New( SEADGroupPrefixes ) end self:HandleEvent( EVENTS.Shot ) - self:I("*** SEAD - Started Version 0.2.5") + self:I("*** SEAD - Started Version 0.2.7") return self end @@ -205,15 +205,18 @@ function SEAD:OnEventShot( EventData ) SEADWeaponName == "weapons.missiles.AGM_84H" --AGM84 anti-radiation missiles fired --]] if self:_CheckHarms(SEADWeaponName) then - + local _targetskill = "Random" + local _targetMimgroupName = "none" local _evade = math.random (1,100) -- random number for chance of evading action local _targetMim = EventData.Weapon:getTarget() -- Identify target - local _targetMimname = Unit.getName(_targetMim) -- Unit name - local _targetMimgroup = Unit.getGroup(Weapon.getTarget(SEADWeapon)) --targeted group - local _targetMimgroupName = _targetMimgroup:getName() -- group name - local _targetskill = _DATABASE.Templates.Units[_targetMimname].Template.skill - self:T( self.SEADGroupPrefixes ) - self:T( _targetMimgroupName ) + local _targetUnit = UNIT:Find(_targetMim) -- Unit name by DCS Object + if _targetUnit and _targetUnit:IsAlive() then + local _targetMimgroup = _targetUnit:GetGroup() + local _targetMimgroupName = _targetMimgroup:GetName() -- group name + --local _targetskill = _DATABASE.Templates.Units[_targetUnit].Template.skill + self:T( self.SEADGroupPrefixes ) + self:T( _targetMimgroupName ) + end -- see if we are shot at local SEADGroupFound = false for SEADGroupPrefixID, SEADGroupPrefix in pairs( self.SEADGroupPrefixes ) do @@ -249,6 +252,7 @@ function SEAD:OnEventShot( EventData ) local range = self.EngagementRange -- Feature Request #1355 self:T(string.format("*** SEAD - Engagement Range is %d", range)) id.ctrl:setOption(AI.Option.Ground.id.ALARM_STATE,AI.Option.Ground.val.ALARM_STATE.RED) + --id.groupName:enableEmission(true) id.ctrl:setOption(AI.Option.Ground.id.AC_ENGAGEMENT_RANGE_RESTRICTION,range) --Feature Request #1355 self.SuppressedGroups[id.groupName] = nil --delete group id from table when done end @@ -261,6 +265,7 @@ function SEAD:OnEventShot( EventData ) SuppressionEndTime = delay } Controller.setOption(_targetMimcont, AI.Option.Ground.id.ALARM_STATE,AI.Option.Ground.val.ALARM_STATE.GREEN) + --_targetMimgroup:enableEmission(false) timer.scheduleFunction(SuppressionEnd, id, SuppressionEndTime) --Schedule the SuppressionEnd() function end end From 9a7df65faa5d82611a87aee03187052de41a21b2 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Sat, 1 May 2021 17:18:01 +0200 Subject: [PATCH 69/73] Update Shorad.lua Adjust to Event changes --- Moose Development/Moose/Functional/Shorad.lua | 63 +++++++++++-------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/Moose Development/Moose/Functional/Shorad.lua b/Moose Development/Moose/Functional/Shorad.lua index 155a86829..e2f3991f8 100644 --- a/Moose Development/Moose/Functional/Shorad.lua +++ b/Moose Development/Moose/Functional/Shorad.lua @@ -18,7 +18,7 @@ -- @module Functional.Shorad -- @image Functional.Shorad.jpg -- --- Date: Feb 2021 +-- Date: May 2021 ------------------------------------------------------------------------- --- **SHORAD** class, extends Core.Base#BASE @@ -38,7 +38,7 @@ -- @field #boolean DefendMavs Default true, intercept incoming AG-Missiles -- @field #number DefenseLowProb Default 70, minimum detection limit -- @field #number DefenseHighProb Default 90, maximim detection limit --- @field #boolean UseAIOnOff Decide if we are using AI on/off (true) or AlarmState red/green (default). +-- @field #boolean UseEmOnOff Decide if we are using Emission on/off (default) or AlarmState red/green. -- @extends Core.Base#BASE --- *Good friends are worth defending.* Mr Tushman, Wonder (the Movie) @@ -96,7 +96,7 @@ SHORAD = { DefendMavs = true, DefenseLowProb = 70, DefenseHighProb = 90, - UseAIOnOff = false, + UseEmOnOff = false, } ----------------------------------------------------------------------- @@ -176,8 +176,8 @@ do self.DefendMavs = true self.DefenseLowProb = 70 -- probability to detect a missile shot, low margin self.DefenseHighProb = 90 -- probability to detect a missile shot, high margin - self.UseAIOnOff = false -- Decide if we are using AI on/off (true) or AlarmState red/green (default) - self:I("*** SHORAD - Started Version 0.1.0") + self.UseEmOnOff = false -- Decide if we are using Emission on/off (default) or AlarmState red/green + self:I("*** SHORAD - Started Version 0.2.1") -- Set the string id for output to DCS.log file. self.lid=string.format("SHORAD %s | ", self.name) self:_InitState() @@ -192,8 +192,9 @@ do self:T({set = set}) local aliveset = set:GetAliveSet() --#table for _,_group in pairs (aliveset) do - if self.UseAIOnOff then - _group:SetAIOff() + if self.UseEmOnOff then + --_group:SetAIOff() + _group:EnableEmission(false) else _group:OptionAlarmStateGreen() --Wrapper.Group#GROUP end @@ -279,11 +280,11 @@ do self.Radius = radius end - --- Set using AI on/off instead of changing alarm state + --- Set using Emission on/off instead of changing alarm state -- @param #SHORAD self -- @param #boolean switch Decide if we are changing alarm state or AI state - function SHORAD:SetUsingAIOnOff(switch) - self.UseAIOnOff = switch or false + function SHORAD:SetUsingEmOnOff(switch) + self.UseEmOnOff = switch or false end --- Check if a HARM was fired @@ -410,8 +411,9 @@ do local function SleepShorad(group) local groupname = group:GetName() self.ActiveGroups[groupname] = nil - if self.UseAIOnOff then - group:SetAIOff() + if self.UseEmOnOff then + group:EnableEmission(false) + --group:SetAIOff() else group:OptionAlarmStateGreen() end @@ -425,8 +427,9 @@ do local text = string.format("Waking up SHORAD %s", _group:GetName()) self:T(text) local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug) - if self.UseAIOnOff then + if self.UseEmOnOff then _group:SetAIOn() + _group:EnableEmission(true) end _group:OptionAlarmStateRed() local groupname = _group:GetName() @@ -461,23 +464,31 @@ do end local text = string.format("%s Missile Launched = %s | Detected probability state is %s", self.lid, ShootingWeaponName, DetectedText) self:T( text ) - local m = MESSAGE:New(text,15,"Info"):ToAllIf(self.debug) + local m = MESSAGE:New(text,10,"Info"):ToAllIf(self.debug) -- if (self:_CheckHarms(ShootingWeaponName) or self:_CheckMavs(ShootingWeaponName)) and IsDetected then -- get target data local targetdata = EventData.Weapon:getTarget() -- Identify target - local targetunitname = Unit.getName(targetdata) -- Unit name - local targetgroup = Unit.getGroup(Weapon.getTarget(ShootingWeapon)) --targeted group - local targetgroupname = targetgroup:getName() -- group name - -- check if we or a SAM site are the target - --local TargetGroup = EventData.TgtGroup -- Wrapper.Group#GROUP - local shotatus = self:_CheckShotAtShorad(targetgroupname) --#boolean - local shotatsams = self:_CheckShotAtSams(targetgroupname) --#boolean - -- if being shot at, find closest SHORADs to activate - if shotatsams or shotatus then - self:T({shotatsams=shotatsams,shotatus=shotatus}) - self:WakeUpShorad(targetgroupname, self.Radius, self.ActiveTimer) - end + local targetunit = UNIT:Find(targetdata) + --local targetunitname = Unit.getName(targetdata) -- Unit name + if targetunit and targetunit:IsAlive() then + local targetunitname = targetunit:GetName() + --local targetgroup = Unit.getGroup(Weapon.getTarget(ShootingWeapon)) --targeted group + local targetgroup = targetunit:GetGroup() + local targetgroupname = targetgroup:GetName() -- group name + local text = string.format("%s Missile Target = %s", self.lid, tostring(targetgroupname)) + self:T( text ) + local m = MESSAGE:New(text,10,"Info"):ToAllIf(self.debug) + -- check if we or a SAM site are the target + --local TargetGroup = EventData.TgtGroup -- Wrapper.Group#GROUP + local shotatus = self:_CheckShotAtShorad(targetgroupname) --#boolean + local shotatsams = self:_CheckShotAtSams(targetgroupname) --#boolean + -- if being shot at, find closest SHORADs to activate + if shotatsams or shotatus then + self:T({shotatsams=shotatsams,shotatus=shotatus}) + self:WakeUpShorad(targetgroupname, self.Radius, self.ActiveTimer) + end + end end end end From 725e32f43940ca5d6652452293dee7306038b6be Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Sat, 1 May 2021 17:19:10 +0200 Subject: [PATCH 70/73] Update Sead.lua Adjust to Event changes --- Moose Development/Moose/Functional/Sead.lua | 23 +++++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/Moose Development/Moose/Functional/Sead.lua b/Moose Development/Moose/Functional/Sead.lua index 2c5abb451..be1ea4b9f 100644 --- a/Moose Development/Moose/Functional/Sead.lua +++ b/Moose Development/Moose/Functional/Sead.lua @@ -109,7 +109,7 @@ function SEAD:New( SEADGroupPrefixes ) end self:HandleEvent( EVENTS.Shot ) - self:I("*** SEAD - Started Version 0.2.5") + self:I("*** SEAD - Started Version 0.2.7") return self end @@ -205,15 +205,18 @@ function SEAD:OnEventShot( EventData ) SEADWeaponName == "weapons.missiles.AGM_84H" --AGM84 anti-radiation missiles fired --]] if self:_CheckHarms(SEADWeaponName) then - + local _targetskill = "Random" + local _targetMimgroupName = "none" local _evade = math.random (1,100) -- random number for chance of evading action local _targetMim = EventData.Weapon:getTarget() -- Identify target - local _targetMimname = Unit.getName(_targetMim) -- Unit name - local _targetMimgroup = Unit.getGroup(Weapon.getTarget(SEADWeapon)) --targeted group - local _targetMimgroupName = _targetMimgroup:getName() -- group name - local _targetskill = _DATABASE.Templates.Units[_targetMimname].Template.skill - self:T( self.SEADGroupPrefixes ) - self:T( _targetMimgroupName ) + local _targetUnit = UNIT:Find(_targetMim) -- Unit name by DCS Object + if _targetUnit and _targetUnit:IsAlive() then + local _targetMimgroup = _targetUnit:GetGroup() + local _targetMimgroupName = _targetMimgroup:GetName() -- group name + --local _targetskill = _DATABASE.Templates.Units[_targetUnit].Template.skill + self:T( self.SEADGroupPrefixes ) + self:T( _targetMimgroupName ) + end -- see if we are shot at local SEADGroupFound = false for SEADGroupPrefixID, SEADGroupPrefix in pairs( self.SEADGroupPrefixes ) do @@ -249,6 +252,7 @@ function SEAD:OnEventShot( EventData ) local range = self.EngagementRange -- Feature Request #1355 self:T(string.format("*** SEAD - Engagement Range is %d", range)) id.ctrl:setOption(AI.Option.Ground.id.ALARM_STATE,AI.Option.Ground.val.ALARM_STATE.RED) + id.groupName:enableEmission(true) id.ctrl:setOption(AI.Option.Ground.id.AC_ENGAGEMENT_RANGE_RESTRICTION,range) --Feature Request #1355 self.SuppressedGroups[id.groupName] = nil --delete group id from table when done end @@ -260,7 +264,8 @@ function SEAD:OnEventShot( EventData ) self.SuppressedGroups[id.groupName] = { SuppressionEndTime = delay } - Controller.setOption(_targetMimcont, AI.Option.Ground.id.ALARM_STATE,AI.Option.Ground.val.ALARM_STATE.GREEN) + --Controller.setOption(_targetMimcont, AI.Option.Ground.id.ALARM_STATE,AI.Option.Ground.val.ALARM_STATE.GREEN) + _targetMimgroup:enableEmission(false) timer.scheduleFunction(SuppressionEnd, id, SuppressionEndTime) --Schedule the SuppressionEnd() function end end From 32027026127e3acb6fff5c3afcebc7090d9ab103 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Sat, 1 May 2021 17:20:35 +0200 Subject: [PATCH 71/73] Update Shorad.lua Adjustments for 2.7 --- Moose Development/Moose/Functional/Shorad.lua | 63 +++++++++++-------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/Moose Development/Moose/Functional/Shorad.lua b/Moose Development/Moose/Functional/Shorad.lua index 155a86829..2e61d7743 100644 --- a/Moose Development/Moose/Functional/Shorad.lua +++ b/Moose Development/Moose/Functional/Shorad.lua @@ -18,7 +18,7 @@ -- @module Functional.Shorad -- @image Functional.Shorad.jpg -- --- Date: Feb 2021 +-- Date: May 2021 ------------------------------------------------------------------------- --- **SHORAD** class, extends Core.Base#BASE @@ -38,7 +38,7 @@ -- @field #boolean DefendMavs Default true, intercept incoming AG-Missiles -- @field #number DefenseLowProb Default 70, minimum detection limit -- @field #number DefenseHighProb Default 90, maximim detection limit --- @field #boolean UseAIOnOff Decide if we are using AI on/off (true) or AlarmState red/green (default). +-- @field #boolean UseEmOnOff Decide if we are using Emission on/off (default) or AlarmState red/green. -- @extends Core.Base#BASE --- *Good friends are worth defending.* Mr Tushman, Wonder (the Movie) @@ -96,7 +96,7 @@ SHORAD = { DefendMavs = true, DefenseLowProb = 70, DefenseHighProb = 90, - UseAIOnOff = false, + UseEmOnOff = true, } ----------------------------------------------------------------------- @@ -176,8 +176,8 @@ do self.DefendMavs = true self.DefenseLowProb = 70 -- probability to detect a missile shot, low margin self.DefenseHighProb = 90 -- probability to detect a missile shot, high margin - self.UseAIOnOff = false -- Decide if we are using AI on/off (true) or AlarmState red/green (default) - self:I("*** SHORAD - Started Version 0.1.0") + self.UseEmOnOff = true -- Decide if we are using Emission on/off (default) or AlarmState red/green + self:I("*** SHORAD - Started Version 0.2.1") -- Set the string id for output to DCS.log file. self.lid=string.format("SHORAD %s | ", self.name) self:_InitState() @@ -192,8 +192,9 @@ do self:T({set = set}) local aliveset = set:GetAliveSet() --#table for _,_group in pairs (aliveset) do - if self.UseAIOnOff then - _group:SetAIOff() + if self.UseEmOnOff then + --_group:SetAIOff() + _group:EnableEmission(false) else _group:OptionAlarmStateGreen() --Wrapper.Group#GROUP end @@ -279,11 +280,11 @@ do self.Radius = radius end - --- Set using AI on/off instead of changing alarm state + --- Set using Emission on/off instead of changing alarm state -- @param #SHORAD self -- @param #boolean switch Decide if we are changing alarm state or AI state - function SHORAD:SetUsingAIOnOff(switch) - self.UseAIOnOff = switch or false + function SHORAD:SetUsingEmOnOff(switch) + self.UseEmOnOff = switch or false end --- Check if a HARM was fired @@ -410,8 +411,9 @@ do local function SleepShorad(group) local groupname = group:GetName() self.ActiveGroups[groupname] = nil - if self.UseAIOnOff then - group:SetAIOff() + if self.UseEmOnOff then + group:EnableEmission(false) + --group:SetAIOff() else group:OptionAlarmStateGreen() end @@ -425,8 +427,9 @@ do local text = string.format("Waking up SHORAD %s", _group:GetName()) self:T(text) local m = MESSAGE:New(text,10,"SHORAD"):ToAllIf(self.debug) - if self.UseAIOnOff then + if self.UseEmOnOff then _group:SetAIOn() + _group:EnableEmission(true) end _group:OptionAlarmStateRed() local groupname = _group:GetName() @@ -461,23 +464,31 @@ do end local text = string.format("%s Missile Launched = %s | Detected probability state is %s", self.lid, ShootingWeaponName, DetectedText) self:T( text ) - local m = MESSAGE:New(text,15,"Info"):ToAllIf(self.debug) + local m = MESSAGE:New(text,10,"Info"):ToAllIf(self.debug) -- if (self:_CheckHarms(ShootingWeaponName) or self:_CheckMavs(ShootingWeaponName)) and IsDetected then -- get target data local targetdata = EventData.Weapon:getTarget() -- Identify target - local targetunitname = Unit.getName(targetdata) -- Unit name - local targetgroup = Unit.getGroup(Weapon.getTarget(ShootingWeapon)) --targeted group - local targetgroupname = targetgroup:getName() -- group name - -- check if we or a SAM site are the target - --local TargetGroup = EventData.TgtGroup -- Wrapper.Group#GROUP - local shotatus = self:_CheckShotAtShorad(targetgroupname) --#boolean - local shotatsams = self:_CheckShotAtSams(targetgroupname) --#boolean - -- if being shot at, find closest SHORADs to activate - if shotatsams or shotatus then - self:T({shotatsams=shotatsams,shotatus=shotatus}) - self:WakeUpShorad(targetgroupname, self.Radius, self.ActiveTimer) - end + local targetunit = UNIT:Find(targetdata) + --local targetunitname = Unit.getName(targetdata) -- Unit name + if targetunit and targetunit:IsAlive() then + local targetunitname = targetunit:GetName() + --local targetgroup = Unit.getGroup(Weapon.getTarget(ShootingWeapon)) --targeted group + local targetgroup = targetunit:GetGroup() + local targetgroupname = targetgroup:GetName() -- group name + local text = string.format("%s Missile Target = %s", self.lid, tostring(targetgroupname)) + self:T( text ) + local m = MESSAGE:New(text,10,"Info"):ToAllIf(self.debug) + -- check if we or a SAM site are the target + --local TargetGroup = EventData.TgtGroup -- Wrapper.Group#GROUP + local shotatus = self:_CheckShotAtShorad(targetgroupname) --#boolean + local shotatsams = self:_CheckShotAtSams(targetgroupname) --#boolean + -- if being shot at, find closest SHORADs to activate + if shotatsams or shotatus then + self:T({shotatsams=shotatsams,shotatus=shotatus}) + self:WakeUpShorad(targetgroupname, self.Radius, self.ActiveTimer) + end + end end end end From a89a3b38ce51a867e1a016f6d525682f37dcff6b Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Sat, 1 May 2021 17:21:53 +0200 Subject: [PATCH 72/73] Update Mantis.lua Adjustments for 2.7 --- Moose Development/Moose/Functional/Mantis.lua | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/Moose Development/Moose/Functional/Mantis.lua b/Moose Development/Moose/Functional/Mantis.lua index 4d6565262..23faabb3f 100644 --- a/Moose Development/Moose/Functional/Mantis.lua +++ b/Moose Development/Moose/Functional/Mantis.lua @@ -51,7 +51,7 @@ -- @field #number adv_state Advanced mode state tracker -- @field #boolean advAwacs Boolean switch to use Awacs as a separate detection stream -- @field #number awacsrange Detection range of an optional Awacs unit --- @field #boolean UseAIOnOff Decide if we are using AI on/off (true) or AlarmState red/green (default) +-- @field #boolean UseEmOnOff Decide if we are using Emissions on/off (true) or AlarmState red/green (default) -- @field Functional.Shorad#SHORAD Shorad SHORAD Object, if available -- @field #boolean ShoradLink If true, #MANTIS has #SHORAD enabled -- @field #number ShoradTime Timer in seconds, how long #SHORAD will be active after a detection inside of the defense range @@ -191,7 +191,7 @@ MANTIS = { ShoradLink = false, ShoradTime = 600, ShoradActDistance = 15000, - UseAIOnOff = false, + UseEmOnOff = true, } ----------------------------------------------------------------------- @@ -208,7 +208,7 @@ do --@param #string coaltion Coalition side of your setup, e.g. "blue", "red" or "neutral" --@param #boolean dynamic Use constant (true) filtering or just filter once (false, default) (optional) --@param #string awacs Group name of your Awacs (optional) - --@param #boolean AIOnOff Make MANTIS switch AI on and off instead of changing the alarm state between RED and GREEN (optional) + --@param #boolean EmOnOff Make MANTIS switch Emissions on and off instead of changing the alarm state between RED and GREEN (optional, deault true) --@return #MANTIS self --@usage Start up your MANTIS with a basic setting -- @@ -230,7 +230,7 @@ do -- `mybluemantis = MANTIS:New("bluemantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")` -- `mybluemantis:Start()` -- - function MANTIS:New(name,samprefix,ewrprefix,hq,coaltion,dynamic,awacs, AIOnOff) + function MANTIS:New(name,samprefix,ewrprefix,hq,coaltion,dynamic,awacs, EmOnOff) -- DONE: Create some user functions for these -- DONE: Make HQ useful @@ -264,7 +264,11 @@ do self.ShoradTime = 600 self.ShoradActDistance = 15000 -- TODO: add emissions on/off when available .... in 2 weeks - self.UseAIOnOff = AIOnOff or false + if EmOnOff then + if EmOnOff == false then + self.UseEmOnOff = false + end + end if type(awacs) == "string" then self.advAwacs = true @@ -304,7 +308,7 @@ do end -- @field #string version - self.version="0.4.0" + self.version="0.4.1" self:I(string.format("***** Starting MANTIS Version %s *****", self.version)) return self @@ -463,11 +467,11 @@ do end end - --- Set using AI on/off instead of changing alarm state + --- Set using Emissions on/off instead of changing alarm state -- @param #MANTIS self - -- @param #boolean switch Decide if we are changing alarm state or AI state - function MANTIS:SetUsingAIOnOff(switch) - self.UseAIOnOff = switch or false + -- @param #boolean switch Decide if we are changing alarm state or Emission state + function MANTIS:SetUsingEmOnOff(switch) + self.UseEmOnOff = switch or false end --- [Internal] Function to check if HQ is alive @@ -714,8 +718,9 @@ do for _i,_group in pairs (SAM_Grps) do local group = _group -- TODO: add emissions on/off - if self.UseAIOnOff then - group:SetAIOff() + if self.UseEmOnOff then + group:EnableEmission(false) + --group:SetAIOff() else group:OptionAlarmStateGreen() -- AI off end @@ -822,9 +827,10 @@ do if IsInZone then --check any target in zone if samgroup:IsAlive() then -- switch on SAM - if self.UseAIOnOff then + if self.UseEmOnOff then -- TODO: add emissions on/off - samgroup:SetAIOn() + --samgroup:SetAIOn() + samgroup:EnableEmission(true) end samgroup:OptionAlarmStateRed() -- link in to SHORAD if available @@ -843,9 +849,10 @@ do else if samgroup:IsAlive() then -- switch off SAM - if self.UseAIOnOff then + if self.UseEmOnOff then -- TODO: add emissions on/off - samgroup:SetAIOff() + samgroup:EnableEmission(false) + --samgroup:SetAIOff() else samgroup:OptionAlarmStateGreen() end @@ -883,9 +890,10 @@ do local name = _data[1] local samgroup = GROUP:FindByName(name) if samgroup:IsAlive() then - if self.UseAIOnOff then + if self.UseEmOnOff then -- TODO: add emissions on/off - samgroup:SetAIOn() + --samgroup:SetAIOn() + samgroup:EnableEmission(true) end samgroup:OptionAlarmStateRed() end -- end alive From 39d3f85b712eb894e5b79ebec9f7d5011fe6731e Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Sat, 1 May 2021 17:23:17 +0200 Subject: [PATCH 73/73] Update Mantis.lua Adjustments for 2.7 --- Moose Development/Moose/Functional/Mantis.lua | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/Moose Development/Moose/Functional/Mantis.lua b/Moose Development/Moose/Functional/Mantis.lua index 4d6565262..23faabb3f 100644 --- a/Moose Development/Moose/Functional/Mantis.lua +++ b/Moose Development/Moose/Functional/Mantis.lua @@ -51,7 +51,7 @@ -- @field #number adv_state Advanced mode state tracker -- @field #boolean advAwacs Boolean switch to use Awacs as a separate detection stream -- @field #number awacsrange Detection range of an optional Awacs unit --- @field #boolean UseAIOnOff Decide if we are using AI on/off (true) or AlarmState red/green (default) +-- @field #boolean UseEmOnOff Decide if we are using Emissions on/off (true) or AlarmState red/green (default) -- @field Functional.Shorad#SHORAD Shorad SHORAD Object, if available -- @field #boolean ShoradLink If true, #MANTIS has #SHORAD enabled -- @field #number ShoradTime Timer in seconds, how long #SHORAD will be active after a detection inside of the defense range @@ -191,7 +191,7 @@ MANTIS = { ShoradLink = false, ShoradTime = 600, ShoradActDistance = 15000, - UseAIOnOff = false, + UseEmOnOff = true, } ----------------------------------------------------------------------- @@ -208,7 +208,7 @@ do --@param #string coaltion Coalition side of your setup, e.g. "blue", "red" or "neutral" --@param #boolean dynamic Use constant (true) filtering or just filter once (false, default) (optional) --@param #string awacs Group name of your Awacs (optional) - --@param #boolean AIOnOff Make MANTIS switch AI on and off instead of changing the alarm state between RED and GREEN (optional) + --@param #boolean EmOnOff Make MANTIS switch Emissions on and off instead of changing the alarm state between RED and GREEN (optional, deault true) --@return #MANTIS self --@usage Start up your MANTIS with a basic setting -- @@ -230,7 +230,7 @@ do -- `mybluemantis = MANTIS:New("bluemantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs")` -- `mybluemantis:Start()` -- - function MANTIS:New(name,samprefix,ewrprefix,hq,coaltion,dynamic,awacs, AIOnOff) + function MANTIS:New(name,samprefix,ewrprefix,hq,coaltion,dynamic,awacs, EmOnOff) -- DONE: Create some user functions for these -- DONE: Make HQ useful @@ -264,7 +264,11 @@ do self.ShoradTime = 600 self.ShoradActDistance = 15000 -- TODO: add emissions on/off when available .... in 2 weeks - self.UseAIOnOff = AIOnOff or false + if EmOnOff then + if EmOnOff == false then + self.UseEmOnOff = false + end + end if type(awacs) == "string" then self.advAwacs = true @@ -304,7 +308,7 @@ do end -- @field #string version - self.version="0.4.0" + self.version="0.4.1" self:I(string.format("***** Starting MANTIS Version %s *****", self.version)) return self @@ -463,11 +467,11 @@ do end end - --- Set using AI on/off instead of changing alarm state + --- Set using Emissions on/off instead of changing alarm state -- @param #MANTIS self - -- @param #boolean switch Decide if we are changing alarm state or AI state - function MANTIS:SetUsingAIOnOff(switch) - self.UseAIOnOff = switch or false + -- @param #boolean switch Decide if we are changing alarm state or Emission state + function MANTIS:SetUsingEmOnOff(switch) + self.UseEmOnOff = switch or false end --- [Internal] Function to check if HQ is alive @@ -714,8 +718,9 @@ do for _i,_group in pairs (SAM_Grps) do local group = _group -- TODO: add emissions on/off - if self.UseAIOnOff then - group:SetAIOff() + if self.UseEmOnOff then + group:EnableEmission(false) + --group:SetAIOff() else group:OptionAlarmStateGreen() -- AI off end @@ -822,9 +827,10 @@ do if IsInZone then --check any target in zone if samgroup:IsAlive() then -- switch on SAM - if self.UseAIOnOff then + if self.UseEmOnOff then -- TODO: add emissions on/off - samgroup:SetAIOn() + --samgroup:SetAIOn() + samgroup:EnableEmission(true) end samgroup:OptionAlarmStateRed() -- link in to SHORAD if available @@ -843,9 +849,10 @@ do else if samgroup:IsAlive() then -- switch off SAM - if self.UseAIOnOff then + if self.UseEmOnOff then -- TODO: add emissions on/off - samgroup:SetAIOff() + samgroup:EnableEmission(false) + --samgroup:SetAIOff() else samgroup:OptionAlarmStateGreen() end @@ -883,9 +890,10 @@ do local name = _data[1] local samgroup = GROUP:FindByName(name) if samgroup:IsAlive() then - if self.UseAIOnOff then + if self.UseEmOnOff then -- TODO: add emissions on/off - samgroup:SetAIOn() + --samgroup:SetAIOn() + samgroup:EnableEmission(true) end samgroup:OptionAlarmStateRed() end -- end alive