From b649ad73a8a811db48dd4392949155f009923283 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Wed, 15 Feb 2023 10:31:40 +0100 Subject: [PATCH] Fixes --- Moose Development/Moose/Core/Spot.lua | 4 +- Moose Development/Moose/Ops/PlayerTask.lua | 102 +++++++++++---------- Moose Development/Moose/Wrapper/Group.lua | 2 +- 3 files changed, 56 insertions(+), 52 deletions(-) diff --git a/Moose Development/Moose/Core/Spot.lua b/Moose Development/Moose/Core/Spot.lua index 2384df073..f543a6bd7 100644 --- a/Moose Development/Moose/Core/Spot.lua +++ b/Moose Development/Moose/Core/Spot.lua @@ -5,7 +5,7 @@ -- SPOT implements the DCS Spot class functionality, but adds additional luxury to be able to: -- -- * Spot for a defined duration. --- * Updates of laer spot position every 0.2 seconds for moving targets. +-- * Updates of laser spot position every 0.2 seconds for moving targets. -- * Wiggle the spot at the target. -- * Provide a @{Wrapper.Unit} as a target, instead of a point. -- * Implement a status machine, LaseOn, LaseOff. @@ -57,7 +57,7 @@ do -- -- ## 1. SPOT constructor -- - -- * @{#SPOT.New}(..\Presentations\SPOT\Dia2.JPG): Creates a new SPOT object. + -- * @{#SPOT.New}(): Creates a new SPOT object. -- -- ## 2. SPOT is a FSM -- diff --git a/Moose Development/Moose/Ops/PlayerTask.lua b/Moose Development/Moose/Ops/PlayerTask.lua index e4afe4b7a..b5ee9e527 100644 --- a/Moose Development/Moose/Ops/PlayerTask.lua +++ b/Moose Development/Moose/Ops/PlayerTask.lua @@ -1460,7 +1460,7 @@ PLAYERTASKCONTROLLER.Messages = { --- PLAYERTASK class version. -- @field #string version -PLAYERTASKCONTROLLER.version="0.1.57" +PLAYERTASKCONTROLLER.version="0.1.58" --- Create and run a new TASKCONTROLLER instance. -- @param #PLAYERTASKCONTROLLER self @@ -2245,56 +2245,60 @@ function PLAYERTASKCONTROLLER:_CheckTargetQueue() end end - if self.UseTypeNames and object:IsGround() then - -- * Threat level 0: Unit is unarmed. - -- * Threat level 1: Unit is infantry. - -- * Threat level 2: Unit is an infantry vehicle. - -- * Threat level 3: Unit is ground artillery. - -- * Threat level 4: Unit is a tank. - -- * Threat level 5: Unit is a modern tank or ifv with ATGM. - -- * Threat level 6: Unit is a AAA. - -- * Threat level 7: Unit is a SAM or manpad, IR guided. - -- * Threat level 8: Unit is a Short Range SAM, radar guided. - -- * Threat level 9: Unit is a Medium Range SAM, radar guided. - -- * Threat level 10: Unit is a Long Range SAM, radar guided. - local threat = object:GetThreatLevel() - local typekey = "INFANTRY" - if threat == 0 or threat == 2 then - typekey = "TECHNICAL" - elseif threat == 3 then - typekey = "ARTILLERY" - elseif threat == 4 or threat == 5 then - typekey = "TANKS" - elseif threat == 6 or threat == 7 then - typekey = "AIRDEFENSE" - elseif threat >= 8 then - typekey = "SAM" - end - local typename = self.gettext:GetEntry(typekey,self.locale) - local gname = self.gettext:GetEntry("GROUP",self.locale) - target.TypeName = string.format("%s %s",typename,gname) - --self:T(self.lid.."Target TypeName = "..target.TypeName) - end + if object:IsInstanceOf("UNIT") or object:IsInstanceOf("GROUP") then - if self.UseTypeNames and object:IsShip() then - local threat = object:GetThreatLevel() - local typekey = "UNARMEDSHIP" - if threat == 1 then - typekey = "LIGHTARMEDSHIP" - elseif threat == 2 then - typekey = "CORVETTE" - elseif threat == 3 or threat == 4 then - typekey = "FRIGATE" - elseif threat == 5 or threat == 6 then - typekey = "CRUISER" - elseif threat == 7 or threat == 8 then - typekey = "DESTROYER" - elseif threat >= 9 then - typekey = "CARRIER" + if self.UseTypeNames and object:IsGround() then + -- * Threat level 0: Unit is unarmed. + -- * Threat level 1: Unit is infantry. + -- * Threat level 2: Unit is an infantry vehicle. + -- * Threat level 3: Unit is ground artillery. + -- * Threat level 4: Unit is a tank. + -- * Threat level 5: Unit is a modern tank or ifv with ATGM. + -- * Threat level 6: Unit is a AAA. + -- * Threat level 7: Unit is a SAM or manpad, IR guided. + -- * Threat level 8: Unit is a Short Range SAM, radar guided. + -- * Threat level 9: Unit is a Medium Range SAM, radar guided. + -- * Threat level 10: Unit is a Long Range SAM, radar guided. + local threat = object:GetThreatLevel() + local typekey = "INFANTRY" + if threat == 0 or threat == 2 then + typekey = "TECHNICAL" + elseif threat == 3 then + typekey = "ARTILLERY" + elseif threat == 4 or threat == 5 then + typekey = "TANKS" + elseif threat == 6 or threat == 7 then + typekey = "AIRDEFENSE" + elseif threat >= 8 then + typekey = "SAM" + end + local typename = self.gettext:GetEntry(typekey,self.locale) + local gname = self.gettext:GetEntry("GROUP",self.locale) + target.TypeName = string.format("%s %s",typename,gname) + --self:T(self.lid.."Target TypeName = "..target.TypeName) end - local typename = self.gettext:GetEntry(typekey,self.locale) - target.TypeName = typename - --self:T(self.lid.."Target TypeName = "..target.TypeName) + + if self.UseTypeNames and object:IsShip() then + local threat = object:GetThreatLevel() + local typekey = "UNARMEDSHIP" + if threat == 1 then + typekey = "LIGHTARMEDSHIP" + elseif threat == 2 then + typekey = "CORVETTE" + elseif threat == 3 or threat == 4 then + typekey = "FRIGATE" + elseif threat == 5 or threat == 6 then + typekey = "CRUISER" + elseif threat == 7 or threat == 8 then + typekey = "DESTROYER" + elseif threat >= 9 then + typekey = "CARRIER" + end + local typename = self.gettext:GetEntry(typekey,self.locale) + target.TypeName = typename + --self:T(self.lid.."Target TypeName = "..target.TypeName) + end + end self:_AddTask(target) diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index 0f60e1ebe..99125e66a 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -2810,7 +2810,7 @@ function GROUP:GetCustomCallSign(ShortCallsign,Keepnumber,CallsignTranslations) if self:IsAlive() then local IsPlayer = self:IsPlayer() local shortcallsign = self:GetCallsign() or "unknown91" -- e.g.Uzi91, but we want Uzi 9 1 - local callsignroot = string.match(shortcallsign, '(%a+)') -- Uzi + local callsignroot = string.match(shortcallsign, '(%a+)') or "Ghost" -- Uzi --self:I("CallSign = " .. callsignroot) local groupname = self:GetName() local callnumber = string.match(shortcallsign, "(%d+)$" ) or "91" -- 91