From 61481e6e9a1756959542d3ed9095fed820e84f1b Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Fri, 23 Jul 2021 11:19:53 +0200 Subject: [PATCH] CSAR updates to messaging. Detect if far approach note exceeds 8km for smoke/flare request --- Moose Development/Moose/Ops/CSAR.lua | 35 +++++++++++++++++----------- Moose Development/Moose/Ops/CTLD.lua | 2 +- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/Moose Development/Moose/Ops/CSAR.lua b/Moose Development/Moose/Ops/CSAR.lua index df419a5b9..80f1fa642 100644 --- a/Moose Development/Moose/Ops/CSAR.lua +++ b/Moose Development/Moose/Ops/CSAR.lua @@ -1010,6 +1010,8 @@ function CSAR:_CheckWoundedGroupStatus(heliname,woundedgroupname) end elseif _distance >= self.approachdist_near and _distance < self.approachdist_far then self.heliVisibleMessage[_lookupKeyHeli] = nil + self.heliCloseMessage[_lookupKeyHeli] = nil + self.landedStatus[_lookupKeyHeli] = nil --reschedule as units aren\'t dead yet , schedule for a bit slower though as we\'re far away _downedpilot.timestamp = timer.getAbsTime() self:__Approach(-10,heliname,woundedgroupname) @@ -1520,8 +1522,9 @@ function CSAR:_SignalFlare(_unitName) end local _closest = self:_GetClosestDownedPilot(_heli) - - if _closest ~= nil and _closest.pilot ~= nil and _closest.distance < 8000.0 then + local smokedist = 8000 + if self.approachdist_far > smokedist then smokedist = self.approachdist_far end + if _closest ~= nil and _closest.pilot ~= nil and _closest.distance < smokedist then local _clockDir = self:_GetClockDirection(_heli, _closest.pilot) local _distance = 0 @@ -1536,11 +1539,13 @@ function CSAR:_SignalFlare(_unitName) local _coord = _closest.pilot:GetCoordinate() _coord:FlareRed(_clockDir) else - local disttext = "4.3nm" - if _SETTINGS:IsMetric() then - disttext = "8km" - end - self:_DisplayMessageToSAR(_heli, string.format("No Pilots within %s",disttext), self.messageTime) + local _distance = smokedist + if _SETTINGS:IsImperial() then + _distance = string.format("%.1fnm",UTILS.MetersToNM(smokedist)) + else + _distance = string.format("%.1fkm",smokedist/1000) + end + self:_DisplayMessageToSAR(_heli, string.format("No Pilots within %s",_distance), self.messageTime) end return self end @@ -1572,8 +1577,10 @@ function CSAR:_Reqsmoke( _unitName ) if _heli == nil then return end + local smokedist = 8000 + if smokedist < self.approachdist_far then smokedist = self.approachdist_far end local _closest = self:_GetClosestDownedPilot(_heli) - if _closest ~= nil and _closest.pilot ~= nil and _closest.distance < 8000.0 then + if _closest ~= nil and _closest.pilot ~= nil and _closest.distance < smokedist then local _clockDir = self:_GetClockDirection(_heli, _closest.pilot) local _distance = 0 if _SETTINGS:IsImperial() then @@ -1587,11 +1594,13 @@ function CSAR:_Reqsmoke( _unitName ) local color = self.smokecolor _coord:Smoke(color) else - local disttext = "4.3nm" - if _SETTINGS:IsMetric() then - disttext = "8km" - end - self:_DisplayMessageToSAR(_heli, string.format("No Pilots within %s",disttext), self.messageTime) + local _distance = 0 + if _SETTINGS:IsImperial() then + _distance = string.format("%.1fnm",UTILS.MetersToNM(smokedist)) + else + _distance = string.format("%.1fkm",smokedist/1000) + end + self:_DisplayMessageToSAR(_heli, string.format("No Pilots within %s",_distance), self.messageTime) end return self end diff --git a/Moose Development/Moose/Ops/CTLD.lua b/Moose Development/Moose/Ops/CTLD.lua index 880606d07..3ab505402 100644 --- a/Moose Development/Moose/Ops/CTLD.lua +++ b/Moose Development/Moose/Ops/CTLD.lua @@ -1,4 +1,4 @@ ---- **Ops** -- Combat Troops & Logistics Deployment. +--- **Ops** -- Combat Troops & Logistics Department. -- -- === --