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 01/14] 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 02/14] 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 03/14] 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 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 04/14] 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 05/14] 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 06/14] 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 ce7e152e138ffd364edf0893faca1fd4246d66a4 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Tue, 4 May 2021 12:59:21 +0200 Subject: [PATCH 07/14] Updated Shorad and Set --- Moose Development/Moose/Core/Set.lua | 2 +- Moose Development/Moose/Functional/Shorad.lua | 184 ++++++++++-------- 2 files changed, 107 insertions(+), 79 deletions(-) diff --git a/Moose Development/Moose/Core/Set.lua b/Moose Development/Moose/Core/Set.lua index c8cb5dd05..6aa72d67e 100644 --- a/Moose Development/Moose/Core/Set.lua +++ b/Moose Development/Moose/Core/Set.lua @@ -3267,7 +3267,7 @@ do -- SET_STATIC -- @param #SET_STATIC self -- @param Core.Zone#ZONE Zone The Zone to be tested for. -- @return #boolean - function SET_STATIC:IsPatriallyInZone( Zone ) + function SET_STATIC:IsPartiallyInZone( Zone ) local IsPartiallyInZone = false diff --git a/Moose Development/Moose/Functional/Shorad.lua b/Moose Development/Moose/Functional/Shorad.lua index 2d808a2ba..8a25cb198 100644 --- a/Moose Development/Moose/Functional/Shorad.lua +++ b/Moose Development/Moose/Functional/Shorad.lua @@ -1,20 +1,20 @@ --- **Functional** -- Short Range Air Defense System --- +-- -- === --- +-- -- **SHORAD** - Short Range Air Defense System -- Controls a network of short range air/missile defense groups. --- +-- -- === --- +-- -- ## Missions: -- -- ### [SHORAD - Short Range Air Defense](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SRD%20-%20SHORAD%20Defense) --- +-- -- === --- +-- -- ### Author : **applevangelist ** --- +-- -- @module Functional.Shorad -- @image Functional.Shorad.jpg -- @@ -26,7 +26,7 @@ -- @field #string ClassName -- @field #string name Name of this Shorad -- @field #boolean debug Set the debug state --- @field #string Prefixes String to be used to build the @{#Core.Set#SET_GROUP} +-- @field #string Prefixes String to be used to build the @{#Core.Set#SET_GROUP} -- @field #number Radius Shorad defense radius in meters -- @field Core.Set#SET_GROUP Groupset The set of Shorad groups -- @field Core.Set#SET_GROUP Samset The set of SAM groups to defend @@ -41,10 +41,10 @@ -- @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) --- +--- *Good friends are worth defending.* Mr Tushman, Wonder (the Movie) +-- -- Simple Class for a more intelligent Short Range Air Defense System --- +-- -- #SHORAD -- Moose derived missile intercepting short range defense system. -- Protects a network of SAM sites. Uses events to switch on the defense groups closest to the enemy. @@ -52,26 +52,26 @@ -- -- ## Usage -- --- Set up a #SET_GROUP for the SAM sites to be protected: --- --- `local SamSet = SET_GROUP:New():FilterPrefixes("Red SAM"):FilterCoalitions("red"):FilterStart()` --- +-- Set up a #SET_GROUP for the SAM sites to be protected: +-- +-- `local SamSet = SET_GROUP:New():FilterPrefixes("Red SAM"):FilterCoalitions("red"):FilterStart()` +-- -- By default, SHORAD will defense against both HARMs and AG-Missiles with short to medium range. The default defense probability is 70-90%. --- When a missile is detected, SHORAD will activate defense groups in the given radius around the target for 10 minutes. It will *not* react to friendly fire. --- +-- When a missile is detected, SHORAD will activate defense groups in the given radius around the target for 10 minutes. It will *not* react to friendly fire. +-- -- ### Start a new SHORAD system, parameters are: +-- +-- * Name: Name of this SHORAD. +-- * ShoradPrefix: Filter for the Shorad #SET_GROUP. +-- * Samset: The #SET_GROUP of SAM sites to defend. +-- * Radius: Defense radius in meters. +-- * ActiveTimer: Determines how many seconds the systems stay on red alert after wake-up call. +-- * Coalition: Coalition, i.e. "blue", "red", or "neutral".* +-- +-- `myshorad = SHORAD:New("RedShorad", "Red SHORAD", SamSet, 25000, 600, "red")` -- --- * Name: Name of this SHORAD. --- * ShoradPrefix: Filter for the Shorad #SET_GROUP. --- * Samset: The #SET_GROUP of SAM sites to defend. --- * Radius: Defense radius in meters. --- * ActiveTimer: Determines how many seconds the systems stay on red alert after wake-up call. --- * Coalition: Coalition, i.e. "blue", "red", or "neutral".* --- --- `myshorad = SHORAD:New("RedShorad", "Red SHORAD", SamSet, 25000, 600, "red")` --- --- ## Customize options --- +-- ## Customize options +-- -- * SHORAD:SwitchDebug(debug) -- * SHORAD:SwitchHARMDefense(onoff) -- * SHORAD:SwitchAGMDefense(onoff) @@ -96,7 +96,7 @@ SHORAD = { DefendMavs = true, DefenseLowProb = 70, DefenseHighProb = 90, - UseEmOnOff = false, + UseEmOnOff = false, } ----------------------------------------------------------------------- @@ -137,7 +137,7 @@ do ["X_31"] = "X_31", ["Kh25"] = "Kh25", } - + --- TODO complete list? -- @field Mavs SHORAD.Mavs = { @@ -148,7 +148,7 @@ do ["Kh31"] = "Kh31", ["Kh66"] = "Kh66", } - + --- Instantiates a new SHORAD object -- @param #SHORAD self -- @param #string Name Name of this SHORAD @@ -157,10 +157,10 @@ do -- @param #number Radius Defense radius in meters, used to switch on groups -- @param #number ActiveTimer Determines how many seconds the systems stay on red alert after wake-up call -- @param #string Coalition Coalition, i.e. "blue", "red", or "neutral" - function SHORAD:New(Name, ShoradPrefix, Samset, Radius, ActiveTimer, Coalition) + function SHORAD:New(Name, ShoradPrefix, Samset, Radius, ActiveTimer, Coalition) local self = BASE:Inherit( self, BASE:New() ) - self:F({Name, ShoradPrefix, Samset, Radius, ActiveTimer, Coalition}) - + self:T({Name, ShoradPrefix, Samset, Radius, ActiveTimer, Coalition}) + local GroupSet = SET_GROUP:New():FilterPrefixes(ShoradPrefix):FilterCoalitions(Coalition):FilterCategoryGround():FilterStart() self.name = Name or "MyShorad" @@ -176,14 +176,14 @@ 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.UseEmOnOff = false -- Decide if we are using Emission on/off (default) or AlarmState red/green - self:I("*** SHORAD - Started Version 0.2.1") + self.UseEmOnOff = true -- Decide if we are using Emission on/off (default) or AlarmState red/green + self:I("*** SHORAD - Started Version 0.2.5") -- Set the string id for output to DCS.log file. self.lid=string.format("SHORAD %s | ", self.name) self:_InitState() return self end - + --- Initially set all groups to alarm state GREEN -- @param #SHORAD self function SHORAD:_InitState() @@ -204,12 +204,12 @@ do math.random() end end - + --- Switch debug state -- @param #SHORAD self -- @param #boolean debug Switch debug on (true) or off (false) function SHORAD:SwitchDebug(debug) - self:F( { debug } ) + self:T( { debug } ) local onoff = debug or false if debug then self.debug = true @@ -221,31 +221,31 @@ do BASE:TraceOff() end end - + --- Switch defense for HARMs -- @param #SHORAD self -- @param #boolean onoff function SHORAD:SwitchHARMDefense(onoff) - self:F( { onoff } ) + self:T( { onoff } ) local onoff = onoff or true self.DefendHarms = onoff end - + --- Switch defense for AGMs -- @param #SHORAD self -- @param #boolean onoff function SHORAD:SwitchAGMDefense(onoff) - self:F( { onoff } ) + self:T( { onoff } ) local onoff = onoff or true self.DefendMavs = onoff end - + --- Set defense probability limits -- @param #SHORAD self -- @param #number low Minimum detection limit, integer 1-100 -- @param #number high Maximum detection limit integer 1-100 function SHORAD:SetDefenseLimits(low,high) - self:F( { low, high } ) + self:T( { low, high } ) local low = low or 70 local high = high or 90 if (low < 0) or (low > 100) or (low > high) then @@ -257,7 +257,7 @@ do self.DefenseLowProb = low self.DefenseHighProb = high end - + --- Set the number of seconds a SHORAD site will stay active -- @param #SHORAD self -- @param #number seconds Number of seconds systems stay active @@ -271,7 +271,7 @@ do --- Set the number of meters for the SHORAD defense zone -- @param #SHORAD self - -- @param #number meters Radius of the defense search zone in meters. #SHORADs in this range around a targeted group will go active + -- @param #number meters Radius of the defense search zone in meters. #SHORADs in this range around a targeted group will go active function SHORAD:SetDefenseRadius(meters) local radius = meters or 20000 if radius < 0 then @@ -279,20 +279,20 @@ do end self.Radius = radius end - + --- 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:SetUsingEmOnOff(switch) self.UseEmOnOff = switch or false end - + --- Check if a HARM was fired -- @param #SHORAD self -- @param #string WeaponName -- @return #boolean Returns true for a match function SHORAD:_CheckHarms(WeaponName) - self:F( { WeaponName } ) + self:T( { WeaponName } ) local hit = false if self.DefendHarms then for _,_name in pairs (SHORAD.Harms) do @@ -301,13 +301,13 @@ do end return hit end - + --- Check if an AGM was fired -- @param #SHORAD self -- @param #string WeaponName -- @return #boolean Returns true for a match function SHORAD:_CheckMavs(WeaponName) - self:F( { WeaponName } ) + self:T( { WeaponName } ) local hit = false if self.DefendMavs then for _,_name in pairs (SHORAD.Mavs) do @@ -316,7 +316,7 @@ do end return hit end - + --- Check the coalition of the attacker -- @param #SHORAD self -- @param #string Coalition name @@ -324,7 +324,7 @@ do function SHORAD:_CheckCoalition(Coalition) local owncoalition = self.Coalition local othercoalition = "" - if Coalition == 0 then + if Coalition == 0 then othercoalition = "neutral" elseif Coalition == 1 then othercoalition = "red" @@ -338,7 +338,7 @@ do return false end end - + --- Check if the missile is aimed at a SHORAD -- @param #SHORAD self -- @param #string TargetGroupName Name of the target group @@ -352,11 +352,12 @@ do local groupname = _groups:GetName() if string.find(groupname, tgtgrp, 1) then returnname = true + _groups:RelocateGroundRandomInRadius(7,125,false,false) -- be a bit evasive end end - return returnname + return returnname end - + --- Check if the missile is aimed at a SAM site -- @param #SHORAD self -- @param #string TargetGroupName Name of the target group @@ -364,7 +365,8 @@ do function SHORAD:_CheckShotAtSams(TargetGroupName) local tgtgrp = TargetGroupName local shorad = self.Samset - local shoradset = shorad:GetAliveSet() --#table + --local shoradset = shorad:GetAliveSet() --#table + local shoradset = shorad:GetSet() --#table local returnname = false for _,_groups in pairs (shoradset) do local groupname = _groups:GetName() @@ -374,7 +376,7 @@ do end return returnname end - + --- Calculate if the missile shot is detected -- @param #SHORAD self -- @return #boolean Returns true for a detection, else false @@ -387,24 +389,36 @@ do end return IsDetected end - + --- Wake up #SHORADs in a zone with diameter Radius for ActiveTimer seconds -- @param #SHORAD self -- @param #string TargetGroup Name of the target group used to build the #ZONE -- @param #number Radius Radius of the #ZONE -- @param #number ActiveTimer Number of seconds to stay active - -- @usage Use this function to integrate with other systems, example - -- + -- @param #number TargetCat (optional) Category, i.e. Object.Category.UNIT or Object.Category.STATIC + -- @usage Use this function to integrate with other systems, example + -- -- local SamSet = SET_GROUP:New():FilterPrefixes("Blue SAM"):FilterCoalitions("blue"):FilterStart() -- myshorad = SHORAD:New("BlueShorad", "Blue SHORAD", SamSet, 22000, 600, "blue") -- myshorad:SwitchDebug(true) -- mymantis = MANTIS:New("BlueMantis","Blue SAM","Blue EWR",nil,"blue",false,"Blue Awacs") -- mymantis:AddShorad(myshorad,720) -- mymantis:Start() - function SHORAD:WakeUpShorad(TargetGroup, Radius, ActiveTimer) - self:F({TargetGroup, Radius, ActiveTimer}) - local targetgroup = GROUP:FindByName(TargetGroup) - local targetzone = ZONE_GROUP:New("Shorad",targetgroup,Radius) -- create a defense zone to check + function SHORAD:WakeUpShorad(TargetGroup, Radius, ActiveTimer, TargetCat) + self:T({TargetGroup, Radius, ActiveTimer, TargetCat}) + local targetcat = TargetCat or Object.Category.UNIT + local targetgroup = TargetGroup + local targetvec2 = nil + if targetcat == Object.Category.UNIT then + targetvec2 = GROUP:FindByName(targetgroup):GetVec2() + elseif targetcat == Object.Category.STATIC then + targetvec2 = STATIC:FindByName(targetgroup,false):GetVec2() + else + local samset = self.Samset + local sam = samset:GetRandom() + targetvec2 = sam:GetVec2() + end + local targetzone = ZONE_RADIUS:New("Shorad",targetvec2,Radius) -- create a defense zone to check local groupset = self.Groupset --Core.Set#SET_GROUP local shoradset = groupset:GetAliveSet() --#table -- local function to switch off shorad again @@ -441,13 +455,13 @@ do end end end - + --- Main function - work on the EventData -- @param #SHORAD self -- @param Core.Event#EVENTDATA EventData The event details table data set function SHORAD:OnEventShot( EventData ) - self:F( { EventData } ) - + self:T( { EventData } ) + --local ShootingUnit = EventData.IniDCSUnit --local ShootingUnitName = EventData.IniDCSUnitName local ShootingWeapon = EventData.Weapon -- Identify the weapon fired @@ -459,7 +473,7 @@ do local IsDetected = self:_ShotIsDetected() -- convert to text local DetectedText = "false" - if IsDetected then + if IsDetected then DetectedText = "true" end local text = string.format("%s Missile Launched = %s | Detected probability state is %s", self.lid, ShootingWeaponName, DetectedText) @@ -469,31 +483,45 @@ do if (self:_CheckHarms(ShootingWeaponName) or self:_CheckMavs(ShootingWeaponName)) and IsDetected then -- get target data local targetdata = EventData.Weapon:getTarget() -- Identify target - local targetunit = UNIT:Find(targetdata) + local targetcat = targetdata:getCategory() -- Identify category + self:T(string.format("Target Category (3=STATIC, 1=UNIT)= %s",tostring(targetcat))) + local targetunit = nil + if targetcat == Object.Category.UNIT then -- UNIT + targetunit = UNIT:Find(targetdata) + elseif targetcat == Object.Category.STATIC then -- STATIC + targetunit = STATIC:Find(targetdata) + end --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 targetgroup = nil + local targetgroupname = "none" + if targetcat == Object.Category.UNIT then + targetgroup = targetunit:GetGroup() + targetgroupname = targetgroup:GetName() -- group name + elseif targetcat == Object.Category.STATIC then + targetgroup = targetunit + targetgroupname = targetunitname + end 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 + -- 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) + self:WakeUpShorad(targetgroupname, self.Radius, self.ActiveTimer, targetcat) end - end + end end end - end + end -- end ----------------------------------------------------------------------- -- SHORAD end ------------------------------------------------------------------------ +----------------------------------------------------------------------- \ No newline at end of file From 0046533d53028a0ba44e3ef18559e73894139e47 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Wed, 5 May 2021 11:44:17 +0200 Subject: [PATCH 08/14] Added base class for action based on marker additions, changes, deletions and text keywords --- .../Moose/Core/MarkerOps_Base.lua | 253 ++++++++++++++++++ 1 file changed, 253 insertions(+) create mode 100644 Moose Development/Moose/Core/MarkerOps_Base.lua diff --git a/Moose Development/Moose/Core/MarkerOps_Base.lua b/Moose Development/Moose/Core/MarkerOps_Base.lua new file mode 100644 index 000000000..aa6bc30b5 --- /dev/null +++ b/Moose Development/Moose/Core/MarkerOps_Base.lua @@ -0,0 +1,253 @@ +--- **Core** - MarkerOps_Base. +-- +-- **Main Features:** +-- +-- * Create an easy way to tap into markers added to the F10 map by users. +-- * Recognize own tag and list of keywords. +-- * Matched keywords are handed down to functions. +-- +-- === +-- +-- ### Author: **Applevangelist** +-- +-- Date: May 2021 +-- +-- === +--- +-- @module Core.MarkerOps_Base +-- @image Wrapper_Marker.png + +-------------------------------------------------------------------------- +-- MARKEROPS_BASE Class Definition. +-------------------------------------------------------------------------- + +--- MARKEROPS_BASE class. +-- @type MARKEROPS_BASE +-- @field #string ClassName Name of the class. +-- @field #string Tag Tag to identify commands. +-- @field #table Keywords Table of keywords to recognize. +-- @field #string version Version of #MARKEROPS_BASE. +-- @extends Core.Fsm#FSM + +--- *Fiat lux.* -- Latin proverb. +-- +-- === +-- +-- ![Banner Image](..\Presentations\MARKER\Marker_Main.jpg) +-- +-- # The MARKEROPS_BASE Concept +-- +-- This class enable scripting text-based actions from markers. +-- +-- @field #MARKEROPS_BASE +MARKEROPS_BASE = { + ClassName = "MARKEROPS", + Tag = "mytag", + Keywords = {}, + version = "0.0.1", + debug = false, +} + +--- Function to instantiate a new #MARKEROPS_BASE object. +-- @param #MARKEROPS_BASE self +-- @param #string Tagname Name to identify us from the event text. +-- @param #table Keywords Table of keywords recognized from the event text. +-- @return #MARKEROPS_BASE self +function MARKEROPS_BASE:New(Tagname,Keywords) + -- Inherit FSM + local self=BASE:Inherit(self, FSM:New()) -- #MARKEROPS_BASE + + -- Set some string id for output to DCS.log file. + self.lid=string.format("MARKEROPS_BASE %s | ", tostring(self.version)) + + self.Tag = Tagname or "mytag"-- #string + self.Keywords = Keywords or {} -- #table + self.debug = false + + ----------------------- + --- FSM Transitions --- + ----------------------- + + -- Start State. + self:SetStartState("Stopped") + + -- Add FSM transitions. + -- From State --> Event --> To State + self:AddTransition("Stopped", "Start", "Running") -- Start the FSM. + self:AddTransition("*", "MarkAdded", "*") -- Start the FSM. + self:AddTransition("*", "MarkChanged", "*") -- Start the FSM. + self:AddTransition("*", "MarkDeleted", "*") -- Start the FSM. + self:AddTransition("Running", "Stop", "Stopped") -- Stop the FSM. + + self:HandleEvent(EVENTS.MarkAdded, self.OnEventMark) + self:HandleEvent(EVENTS.MarkChange, self.OnEventMark) + self:HandleEvent(EVENTS.MarkRemoved, self.OnEventMark) + + -- start + self:I(self.lid..string.format("started for %s",self.Tag)) + self:__Start(1) + return self + + ------------------- + -- PSEUDO Functions + ------------------- + + --- On after "MarkAdded" event. Triggered when a Marker is added to the F10 map. + -- @function [parent=#MARKEROPS_BASE] OnAfterMarkAdded + -- @param #MARKEROPS_BASE self + -- @param #string From The From state + -- @param #string Event The Event called + -- @param #string To The To state + -- @param #string Text The text on the marker + -- @param #table Keywords Table of matching keywords found in the Event text + -- @param Core.Point#COORDINATE Coord Coordinate of the marker. + + --- On after "MarkChanged" event. Triggered when a Marker is changed on the F10 map. + -- @function [parent=#MARKEROPS_BASE] OnAfterMarkChanged + -- @param #MARKEROPS_BASE self + -- @param #string From The From state + -- @param #string Event The Event called + -- @param #string To The To state + -- @param #string Text The text on the marker + -- @param #table Keywords Table of matching keywords found in the Event text + -- @param Core.Point#COORDINATE Coord Coordinate of the marker. + + --- On after "MarkDeleted" event. Triggered when a Marker is deleted from the F10 map. + -- @function [parent=#MARKEROPS_BASE] OnAfterMarkDeleted + -- @param #MARKEROPS_BASE self + -- @param #string From The From state + -- @param #string Event The Event called + -- @param #string To The To state + + --- "Stop" trigger. Used to stop the function an unhandle events + -- @function [parent=#MARKEROPS_BASE] Stop + +end + +--- (internal) Handle events. +-- @param #MARKEROPS self +-- @param Core.Event#EVENTDATA Event +function MARKEROPS_BASE:OnEventMark(Event) + self:T({Event}) + if Event == nil or Event.idx == nil then + self:E("Skipping onEvent. Event or Event.idx unknown.") + return true + end + --position + local vec3={y=Event.pos.y, x=Event.pos.x, z=Event.pos.z} + local coord=COORDINATE:NewFromVec3(vec3) + if self.debug then + local coordtext = coord:ToStringLLDDM() + local text = tostring(Event.text) + local m = MESSAGE:New(string.format("Mark added at %s with text: %s",coordtext,text),10,"Info",false):ToAll() + end + -- decision + if Event.id==world.event.S_EVENT_MARK_ADDED then + self:T({event="S_EVENT_MARK_ADDED", carrier=self.groupname, vec3=Event.pos}) + -- Handle event + local Eventtext = tostring(Event.text) + if Eventtext~=nil then + if self:_MatchTag(Eventtext) then + local matchtable = self:_MatchKeywords(Eventtext) + self:MarkAdded(Eventtext,matchtable,coord) + end + end + elseif Event.id==world.event.S_EVENT_MARK_CHANGE then + self:T({event="S_EVENT_MARK_CHANGE", carrier=self.groupname, vec3=Event.pos}) + -- Handle event. + local Eventtext = tostring(Event.text) + if Eventtext~=nil then + if self:_MatchTag(Eventtext) then + local matchtable = self:_MatchKeywords(Eventtext) + self:MarkChanged(Eventtext,matchtable,coord) + end + end + elseif Event.id==world.event.S_EVENT_MARK_REMOVED then + self:T({event="S_EVENT_MARK_REMOVED", carrier=self.groupname, vec3=Event.pos}) + -- Hande event. + local Eventtext = tostring(Event.text) + if Eventtext~=nil then + if self:_MatchTag(Eventtext) then + self:MarkDeleted() + end + end + end +end + +--- (internal) Match tag. +-- @param #MARKEROPS self +-- @param #string Eventtext Text added to the marker. +-- @return #boolean +function MARKEROPS_BASE:_MatchTag(Eventtext) + local matches = false + local type = string.lower(self.Tag) -- #string + if string.find(string.lower(Eventtext),type) then + matches = true --event text contains tag + end + return matches +end + +--- (internal) Match keywords table. +-- @param #MARKEROPS self +-- @param #string Eventtext Text added to the marker. +-- @return #table +function MARKEROPS_BASE:_MatchKeywords(Eventtext) + local matchtable = {} + local keytable = self.Keywords + for _index,_word in pairs (keytable) do + if string.find(string.lower(Eventtext),string.lower(_word))then + table.insert(matchtable,_word) + end + end + return matchtable +end + +--- On before "MarkAdded" event. Triggered when a Marker is added to the F10 map. + -- @param #MARKEROPS_BASE self + -- @param #string From The From state + -- @param #string Event The Event called + -- @param #string To The To state + -- @param #string Text The text on the marker + -- @param #table Keywords Table of matching keywords found in the Event text + -- @param Core.Point#COORDINATE Coord Coordinate of the marker. +function MARKEROPS_BASE:onbeforeMarkAdded(From,Event,To,Text,Keywords,Coord) + self:T({self.lid,From,Event,To,Text,Keywords,Coord:ToStringLLDDM()}) +end + +--- On before "MarkChanged" event. Triggered when a Marker is changed on the F10 map. + -- @param #MARKEROPS_BASE self + -- @param #string From The From state + -- @param #string Event The Event called + -- @param #string To The To state + -- @param #string Text The text on the marker + -- @param #table Keywords Table of matching keywords found in the Event text + -- @param Core.Point#COORDINATE Coord Coordinate of the marker. +function MARKEROPS_BASE:onbeforeMarkChanged(From,Event,To,Text,Keywords,Coord) + self:T({self.lid,From,Event,To,Text,Keywords,Coord:ToStringLLDDM()}) +end + +--- On before "MarkDeleted" event. Triggered when a Marker is removed from the F10 map. + -- @param #MARKEROPS_BASE self + -- @param #string From The From state + -- @param #string Event The Event called + -- @param #string To The To state +function MARKEROPS_BASE:onbeforeMarkDeleted(From,Event,To) + self:T({self.lid,From,Event,To}) +end + +--- On enter "Stopped" event. Unsubscribe events. + -- @param #MARKEROPS_BASE self + -- @param #string From The From state + -- @param #string Event The Event called + -- @param #string To The To state +function MARKEROPS_BASE:onenterStopped(From,Event,To) + self:T({self.lid,From,Event,To}) + -- unsubscribe from events + self:UnHandleEvent(EVENTS.MarkAdded) + self:UnHandleEvent(EVENTS.MarkChange) + self:UnHandleEvent(EVENTS.MarkRemoved) +end + +-------------------------------------------------------------------------- +-- MARKEROPS_BASE Class Definition End. +-------------------------------------------------------------------------- \ No newline at end of file From 2046958bd6f1468b60ebfebf299fe8352384f73c Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Wed, 5 May 2021 11:44:35 +0200 Subject: [PATCH 09/14] Added MarkerOps_Base.lua --- Moose Development/Moose/Modules.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/Moose Development/Moose/Modules.lua b/Moose Development/Moose/Modules.lua index decc5b306..9c84d7f15 100644 --- a/Moose Development/Moose/Modules.lua +++ b/Moose Development/Moose/Modules.lua @@ -29,6 +29,7 @@ __Moose.Include( 'Scripts/Moose/Core/Timer.lua' ) __Moose.Include( 'Scripts/Moose/Core/Goal.lua' ) __Moose.Include( 'Scripts/Moose/Core/Spot.lua' ) __Moose.Include( 'Scripts/Moose/Core/Astar.lua' ) +__Moose.Include( 'Scripts/Moose/Core/MarkerOps_Base.lua' ) __Moose.Include( 'Scripts/Moose/Wrapper/Object.lua' ) __Moose.Include( 'Scripts/Moose/Wrapper/Identifiable.lua' ) From ad16c6d44fac4c3e28b5486caab008ebaf903ecb Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Wed, 5 May 2021 11:56:00 +0200 Subject: [PATCH 10/14] Include MarkerOps_Base (#1533) Include MarkerOps_Base --- Moose Development/Moose/Core/MarkerOps_Base.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Core/MarkerOps_Base.lua b/Moose Development/Moose/Core/MarkerOps_Base.lua index aa6bc30b5..4875e4481 100644 --- a/Moose Development/Moose/Core/MarkerOps_Base.lua +++ b/Moose Development/Moose/Core/MarkerOps_Base.lua @@ -10,7 +10,7 @@ -- -- ### Author: **Applevangelist** -- --- Date: May 2021 +-- Date: 5 May 2021 -- -- === --- @@ -250,4 +250,4 @@ end -------------------------------------------------------------------------- -- MARKEROPS_BASE Class Definition End. --------------------------------------------------------------------------- \ No newline at end of file +-------------------------------------------------------------------------- From e9d3c7c2e7fd0263899b9f3eceeee7fdfd3dfe34 Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Wed, 5 May 2021 19:02:46 +0200 Subject: [PATCH 11/14] Update MarkerOps_Base.lua --- Moose Development/Moose/Core/MarkerOps_Base.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Core/MarkerOps_Base.lua b/Moose Development/Moose/Core/MarkerOps_Base.lua index 4875e4481..f645f936f 100644 --- a/Moose Development/Moose/Core/MarkerOps_Base.lua +++ b/Moose Development/Moose/Core/MarkerOps_Base.lua @@ -61,7 +61,7 @@ function MARKEROPS_BASE:New(Tagname,Keywords) self.lid=string.format("MARKEROPS_BASE %s | ", tostring(self.version)) self.Tag = Tagname or "mytag"-- #string - self.Keywords = Keywords or {} -- #table + self.Keywords = Keywords or {} -- #table - might want to use lua regex here, too self.debug = false ----------------------- From 9eba6d607c4f2c10c460c7bf9c71d88affa5ff6c Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 6 May 2021 09:29:28 +0200 Subject: [PATCH 12/14] Updated doc images --- Moose Development/Moose/AI/AI_Cargo_Dispatcher_Ship.lua | 2 +- Moose Development/Moose/AI/AI_Cargo_Ship.lua | 2 +- Moose Development/Moose/Core/MarkerOps_Base.lua | 4 +--- Moose Development/Moose/Wrapper/Marker.lua | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Moose Development/Moose/AI/AI_Cargo_Dispatcher_Ship.lua b/Moose Development/Moose/AI/AI_Cargo_Dispatcher_Ship.lua index d20cca9eb..70f325f62 100644 --- a/Moose Development/Moose/AI/AI_Cargo_Dispatcher_Ship.lua +++ b/Moose Development/Moose/AI/AI_Cargo_Dispatcher_Ship.lua @@ -21,7 +21,7 @@ -- === -- -- @module AI.AI_Cargo_Dispatcher_Ship --- @image AI_Cargo_Dispatching_For_Ship.JPG +-- @image AI_Cargo_Dispatcher.JPG --- @type AI_CARGO_DISPATCHER_SHIP -- @extends AI.AI_Cargo_Dispatcher#AI_CARGO_DISPATCHER diff --git a/Moose Development/Moose/AI/AI_Cargo_Ship.lua b/Moose Development/Moose/AI/AI_Cargo_Ship.lua index e28e52aa2..37c7da57a 100644 --- a/Moose Development/Moose/AI/AI_Cargo_Ship.lua +++ b/Moose Development/Moose/AI/AI_Cargo_Ship.lua @@ -7,7 +7,7 @@ -- === -- -- @module AI.AI_Cargo_Ship --- @image AI_Cargo_Dispatching_For_Ship.JPG +-- @image AI_Cargo_Dispatcher.JPG --- @type AI_CARGO_SHIP -- @extends AI.AI_Cargo#AI_CARGO diff --git a/Moose Development/Moose/Core/MarkerOps_Base.lua b/Moose Development/Moose/Core/MarkerOps_Base.lua index f645f936f..eb5e17110 100644 --- a/Moose Development/Moose/Core/MarkerOps_Base.lua +++ b/Moose Development/Moose/Core/MarkerOps_Base.lua @@ -15,7 +15,7 @@ -- === --- -- @module Core.MarkerOps_Base --- @image Wrapper_Marker.png +-- @image MOOSE_Core.JPG -------------------------------------------------------------------------- -- MARKEROPS_BASE Class Definition. @@ -33,8 +33,6 @@ -- -- === -- --- ![Banner Image](..\Presentations\MARKER\Marker_Main.jpg) --- -- # The MARKEROPS_BASE Concept -- -- This class enable scripting text-based actions from markers. diff --git a/Moose Development/Moose/Wrapper/Marker.lua b/Moose Development/Moose/Wrapper/Marker.lua index 88a868501..c37b1b263 100644 --- a/Moose Development/Moose/Wrapper/Marker.lua +++ b/Moose Development/Moose/Wrapper/Marker.lua @@ -13,7 +13,7 @@ -- -- ### Author: **funkyfranky** -- @module Wrapper.Marker --- @image Wrapper_Marker.png +-- @image MOOSE_Core.JPG --- Marker class. From 3b0949de7237bf77c42ddd14e575b118e146d409 Mon Sep 17 00:00:00 2001 From: Frank Date: Fri, 7 May 2021 21:46:03 +0200 Subject: [PATCH 13/14] Fixed Ground Speed Issues COORDINATE - Fixed issue with ground units not honoring set speed by setting `ETA_locked=false` in `COORDINATE:WaypointGround` function (used by other classes and routines in MOOSE). See #1484 - Also set `ETA_locked=false` for `COORINATE:WaypointAir` and `COORDINATE:WaypointNaval` --- Moose Development/Moose/Core/Point.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua index 26aaa9dd7..0dea38886 100644 --- a/Moose Development/Moose/Core/Point.lua +++ b/Moose Development/Moose/Core/Point.lua @@ -1184,7 +1184,7 @@ do -- COORDINATE -- ETA. RoutePoint.ETA=0 - RoutePoint.ETA_locked=true + RoutePoint.ETA_locked=false -- Waypoint description. RoutePoint.name=description @@ -1333,7 +1333,7 @@ do -- COORDINATE RoutePoint.formation_template="" RoutePoint.ETA=0 - RoutePoint.ETA_locked=true + RoutePoint.ETA_locked=false RoutePoint.speed = ( Speed or 20 ) / 3.6 RoutePoint.speed_locked = true @@ -1368,7 +1368,7 @@ do -- COORDINATE RoutePoint.formation_template = "" RoutePoint.ETA=0 - RoutePoint.ETA_locked=true + RoutePoint.ETA_locked=false RoutePoint.speed = ( Speed or 20 ) / 3.6 RoutePoint.speed_locked = true From 8b4ba430fb3c8374cc2319b41bea6564dde135fe Mon Sep 17 00:00:00 2001 From: Frank Date: Fri, 7 May 2021 21:55:56 +0200 Subject: [PATCH 14/14] Update Airbase.lua - Fixed #1524 --- Moose Development/Moose/Wrapper/Airbase.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Wrapper/Airbase.lua b/Moose Development/Moose/Wrapper/Airbase.lua index df18bc9ef..453e4857b 100644 --- a/Moose Development/Moose/Wrapper/Airbase.lua +++ b/Moose Development/Moose/Wrapper/Airbase.lua @@ -608,7 +608,7 @@ end --- Get all airbase names of the current map. This includes ships and FARPS. -- @param DCS#Coalition coalition (Optional) Return only airbases belonging to the specified coalition. By default, all airbases of the map are returned. --- @param #number category (Optional) Return only airbases of a certain category, e.g. Airbase.Category.FARP +-- @param #number category (Optional) Return only airbases of a certain category, e.g. `Airbase.Category.HELIPAD`. -- @return #table Table containing all airbase names of the current map. function AIRBASE.GetAllAirbaseNames(coalition, category)