From 0bb16ec8271af98dda9ed3094c0d2b30acfd6100 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Sat, 1 Jul 2023 13:09:16 +0200 Subject: [PATCH] #AIRBASE * Fix for nil error in finding parking for a group #MANTIS * Added SAM type "SHORAD" as designator #SCORING * fix for non local problem #UTILS * fix for OneLineSerialize --- Moose Development/Moose/Functional/Mantis.lua | 7 ++++--- Moose Development/Moose/Functional/Scoring.lua | 6 +++--- Moose Development/Moose/Utilities/Utils.lua | 4 ++-- Moose Development/Moose/Wrapper/Airbase.lua | 18 +++++++++--------- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Moose Development/Moose/Functional/Mantis.lua b/Moose Development/Moose/Functional/Mantis.lua index 3f6f7b008..aeef55fa0 100644 --- a/Moose Development/Moose/Functional/Mantis.lua +++ b/Moose Development/Moose/Functional/Mantis.lua @@ -22,7 +22,7 @@ -- @module Functional.Mantis -- @image Functional.Mantis.jpg -- --- Last Update: Oct 2022 +-- Last Update: July 2023 ------------------------------------------------------------------------- --- **MANTIS** class, extends Core.Base#BASE @@ -369,6 +369,7 @@ MANTIS.SamData = { ["SA-20A"] = { Range=150, Blindspot=5, Height=27, Type="Long" , Radar="S-300PMU1"}, ["SA-20B"] = { Range=200, Blindspot=4, Height=27, Type="Long" , Radar="S-300PMU2"}, ["HQ-2"] = { Range=50, Blindspot=6, Height=35, Type="Medium", Radar="HQ_2_Guideline_LN" }, + ["SHORAD"] = { Range=3, Blindspot=0, Height=3, Type="Short", Radar="Igla" } } --- SAM data HDS @@ -578,7 +579,7 @@ do -- TODO Version -- @field #string version - self.version="0.8.9" + self.version="0.8.10" self:I(string.format("***** Starting MANTIS Version %s *****", self.version)) --- FSM Functions --- @@ -1319,7 +1320,7 @@ do elseif sma then SAMData = self.SamDataSMA end - --self:I("Looking to auto-match for "..grpname) + --self:T("Looking to auto-match for "..grpname) for _,_unit in pairs(units) do local unit = _unit -- Wrapper.Unit#UNIT local type = string.lower(unit:GetTypeName()) diff --git a/Moose Development/Moose/Functional/Scoring.lua b/Moose Development/Moose/Functional/Scoring.lua index 950ccd3c0..48841a177 100644 --- a/Moose Development/Moose/Functional/Scoring.lua +++ b/Moose Development/Moose/Functional/Scoring.lua @@ -1767,9 +1767,9 @@ function SCORING:SecondsToClock( sSeconds ) -- return nil; return "00:00:00"; else - nHours = string.format( "%02.f", math.floor( nSeconds / 3600 ) ); - nMins = string.format( "%02.f", math.floor( nSeconds / 60 - (nHours * 60) ) ); - nSecs = string.format( "%02.f", math.floor( nSeconds - nHours * 3600 - nMins * 60 ) ); + local nHours = string.format( "%02.f", math.floor( nSeconds / 3600 ) ); + local nMins = string.format( "%02.f", math.floor( nSeconds / 60 - (nHours * 60) ) ); + lcoal nSecs = string.format( "%02.f", math.floor( nSeconds - nHours * 3600 - nMins * 60 ) ); return nHours .. ":" .. nMins .. ":" .. nSecs end end diff --git a/Moose Development/Moose/Utilities/Utils.lua b/Moose Development/Moose/Utilities/Utils.lua index 891718da7..99c643a7a 100644 --- a/Moose Development/Moose/Utilities/Utils.lua +++ b/Moose Development/Moose/Utilities/Utils.lua @@ -299,14 +299,14 @@ end -- @param #table tbl Input table. UTILS.OneLineSerialize = function( tbl ) -- serialization of a table all on a single line, no comments, made to replace old get_table_string function - lookup_table = {} +local lookup_table = {} local function _Serialize( tbl ) if type(tbl) == 'table' then --function only works for tables! if lookup_table[tbl] then - return lookup_table[object] + return lookup_table[tbl] end local tbl_str = {} diff --git a/Moose Development/Moose/Wrapper/Airbase.lua b/Moose Development/Moose/Wrapper/Airbase.lua index 66aca8d82..276ec5b8d 100644 --- a/Moose Development/Moose/Wrapper/Airbase.lua +++ b/Moose Development/Moose/Wrapper/Airbase.lua @@ -12,7 +12,7 @@ -- @image Wrapper_Airbase.JPG ---- @type AIRBASE +-- @type AIRBASE -- @field #string ClassName Name of the class, i.e. "AIRBASE". -- @field #table CategoryName Names of airbase categories. -- @field #string AirbaseName Name of the airbase. @@ -1501,16 +1501,16 @@ function AIRBASE:FindFreeParkingSpotForAircraft(group, terminaltype, scanradius, -- Get the aircraft size, i.e. it's longest side of x,z. local aircraft = nil -- fix local problem below - local _aircraftsize, ax,ay,az + -- SU27 dimensions as default + local _aircraftsize = 23 + local ax = 23 -- l + local ay = 7 -- h + local az = 17 -- w if group and group.ClassName == "GROUP" then aircraft=group:GetUnit(1) - _aircraftsize, ax,ay,az=aircraft:GetObjectSize() - else - -- SU27 dimensions - _aircraftsize = 23 - ax = 23 -- length - ay = 7 -- height - az = 17 -- width + if aircraft then + _aircraftsize, ax,ay,az=aircraft:GetObjectSize() + end end