Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
Applevangelist 2022-09-20 10:48:47 +02:00
commit 9ebc4fd5fe
4 changed files with 33 additions and 24 deletions

View File

@ -912,8 +912,8 @@ do -- DESIGNATE
for DesignateIndex, Designating in pairs( self.Designating ) do for DesignateIndex, Designating in pairs( self.Designating ) do
local DetectedItem = DetectedItems[DesignateIndex] local DetectedItem = DetectedItems[DesignateIndex]
if DetectedItem then if DetectedItem then
local Report = self.Detection:DetectedItemReportSummary( DetectedItem, AttackGroup ):Text( ", " ) local Report = self.Detection:DetectedItemReportSummary( DetectedItem, AttackGroup, nil, true ):Text( ", " )
DetectedReport:Add( string.rep( "-", 140 ) ) DetectedReport:Add( string.rep( "-", 40 ) )
DetectedReport:Add( " - " .. Report ) DetectedReport:Add( " - " .. Report )
if string.find( Designating, "L" ) then if string.find( Designating, "L" ) then
DetectedReport:Add( " - " .. "Lasing Targets" ) DetectedReport:Add( " - " .. "Lasing Targets" )
@ -1193,8 +1193,8 @@ do -- DESIGNATE
local MarkingCount = 0 local MarkingCount = 0
local MarkedTypes = {} local MarkedTypes = {}
local ReportTypes = REPORT:New() --local ReportTypes = REPORT:New()
local ReportLaserCodes = REPORT:New() --local ReportLaserCodes = REPORT:New()
TargetSetUnit:Flush( self ) TargetSetUnit:Flush( self )
@ -1244,8 +1244,8 @@ do -- DESIGNATE
if not Recce then if not Recce then
self:F( "Lasing..." ) self:F( "Lasing..." )
self.RecceSet:Flush( self) --self.RecceSet:Flush( self)
for RecceGroupID, RecceGroup in pairs( self.RecceSet:GetSet() ) do for RecceGroupID, RecceGroup in pairs( self.RecceSet:GetSet() ) do
for UnitID, UnitData in pairs( RecceGroup:GetUnits() or {} ) do for UnitID, UnitData in pairs( RecceGroup:GetUnits() or {} ) do
@ -1283,13 +1283,13 @@ do -- DESIGNATE
-- OK. We have assigned for the Recce a TargetUnit. We can exit the function. -- OK. We have assigned for the Recce a TargetUnit. We can exit the function.
MarkingCount = MarkingCount + 1 MarkingCount = MarkingCount + 1
local TargetUnitType = TargetUnit:GetTypeName() local TargetUnitType = TargetUnit:GetTypeName()
--RecceUnit:MessageToSetGroup( "Marking " .. TargetUnit:GetTypeName() .. " with laser " .. RecceUnit:GetSpot().LaserCode .. " for " .. Duration .. "s.", RecceUnit:MessageToSetGroup( "Marking " .. TargetUnit:GetTypeName() .. " with laser " .. RecceUnit:GetSpot().LaserCode .. " for " .. Duration .. "s.",
-- 5, self.AttackSet, DesignateName ) 10, self.AttackSet, DesignateName )
if not MarkedTypes[TargetUnitType] then if not MarkedTypes[TargetUnitType] then
MarkedTypes[TargetUnitType] = true MarkedTypes[TargetUnitType] = true
ReportTypes:Add(TargetUnitType) --ReportTypes:Add(TargetUnitType)
end end
ReportLaserCodes:Add(RecceUnit.LaserCode) --ReportLaserCodes:Add(RecceUnit.LaserCode)
return return
end end
else else
@ -1304,16 +1304,16 @@ do -- DESIGNATE
if Recce then if Recce then
Recce:LaseOff() Recce:LaseOff()
Recce:MessageToSetGroup( "Target " .. TargetUnit:GetTypeName() "out of LOS. Cancelling lase!", 5, self.AttackSet, self.DesignateName ) Recce:MessageToSetGroup( "Target " .. TargetUnit:GetTypeName() "out of LOS. Cancelling lase!", 10, self.AttackSet, self.DesignateName )
end end
else else
--MarkingCount = MarkingCount + 1 --MarkingCount = MarkingCount + 1
local TargetUnitType = TargetUnit:GetTypeName() local TargetUnitType = TargetUnit:GetTypeName()
if not MarkedTypes[TargetUnitType] then if not MarkedTypes[TargetUnitType] then
MarkedTypes[TargetUnitType] = true MarkedTypes[TargetUnitType] = true
ReportTypes:Add(TargetUnitType) --ReportTypes:Add(TargetUnitType)
end end
ReportLaserCodes:Add(RecceUnit.LaserCode) --ReportLaserCodes:Add(RecceUnit.LaserCode)
end end
end end
end end
@ -1323,19 +1323,19 @@ do -- DESIGNATE
local TargetUnitType = TargetUnit:GetTypeName() local TargetUnitType = TargetUnit:GetTypeName()
if not MarkedTypes[TargetUnitType] then if not MarkedTypes[TargetUnitType] then
MarkedTypes[TargetUnitType] = true MarkedTypes[TargetUnitType] = true
ReportTypes:Add(TargetUnitType) --ReportTypes:Add(TargetUnitType)
end end
ReportLaserCodes:Add(Recce.LaserCode) --ReportLaserCodes:Add(Recce.LaserCode)
--Recce:MessageToSetGroup( self.DesignateName .. ": Marking " .. TargetUnit:GetTypeName() .. " with laser " .. Recce.LaserCode .. ".", 5, self.AttackSet ) Recce:MessageToSetGroup( self.DesignateName .. ": Marking " .. TargetUnit:GetTypeName() .. " with laser " .. Recce.LaserCode .. ".", 10, self.AttackSet )
end end
end end
end end
end end
) )
local MarkedTypesText = ReportTypes:Text(', ') --local MarkedTypesText = ReportTypes:Text(', ')
local MarkedLaserCodesText = ReportLaserCodes:Text(', ') --local MarkedLaserCodesText = ReportLaserCodes:Text(', ')
self.CC:GetPositionable():MessageToSetGroup( "Marking " .. MarkingCount .. " x " .. MarkedTypesText .. ", code " .. MarkedLaserCodesText .. ".", 5, self.AttackSet, self.DesignateName ) --self.CC:GetPositionable():MessageToSetGroup( "Marking " .. MarkingCount .. " x " .. MarkedTypesText .. ", code " .. MarkedLaserCodesText .. ".", 5, self.AttackSet, self.DesignateName )
self:__Lasing( -self.LaseDuration, Index, Duration, LaserCodeRequested ) self:__Lasing( -self.LaseDuration, Index, Duration, LaserCodeRequested )

View File

@ -2152,8 +2152,9 @@ do -- DETECTION_UNITS
-- @param #DETECTION_BASE.DetectedItem DetectedItem The DetectedItem. -- @param #DETECTION_BASE.DetectedItem DetectedItem The DetectedItem.
-- @param Wrapper.Group#GROUP AttackGroup The group to generate the report for. -- @param Wrapper.Group#GROUP AttackGroup The group to generate the report for.
-- @param Core.Settings#SETTINGS Settings Message formatting settings to use. -- @param Core.Settings#SETTINGS Settings Message formatting settings to use.
-- @param #boolean ForceA2GCoordinate Set creation of A2G coordinate
-- @return Core.Report#REPORT The report of the detection items. -- @return Core.Report#REPORT The report of the detection items.
function DETECTION_UNITS:DetectedItemReportSummary( DetectedItem, AttackGroup, Settings ) function DETECTION_UNITS:DetectedItemReportSummary( DetectedItem, AttackGroup, Settings, ForceA2GCoordinate )
self:F( { DetectedItem = DetectedItem } ) self:F( { DetectedItem = DetectedItem } )
local DetectedItemID = self:GetDetectedItemID( DetectedItem ) local DetectedItemID = self:GetDetectedItemID( DetectedItem )
@ -2188,7 +2189,11 @@ do -- DETECTION_UNITS
-- TODO: solve Index reference -- TODO: solve Index reference
local DetectedItemCoordinate = self:GetDetectedItemCoordinate( DetectedItem ) local DetectedItemCoordinate = self:GetDetectedItemCoordinate( DetectedItem )
local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup, Settings ) local DetectedItemCoordText = DetectedItemCoordinate:ToString( AttackGroup, Settings )
if ForceA2GCoordinate then
DetectedItemCoordText = DetectedItemCoordinate:ToStringA2G(AttackGroup,Settings)
end
local ThreatLevelA2G = self:GetDetectedItemThreatLevel( DetectedItem ) local ThreatLevelA2G = self:GetDetectedItemThreatLevel( DetectedItem )
local Report = REPORT:New() local Report = REPORT:New()

View File

@ -2083,6 +2083,7 @@ function RANGE:OnEventShot( EventData )
self:_DisplayMessageToGroup( _unit, _message, nil, false ) self:_DisplayMessageToGroup( _unit, _message, nil, false )
if self.rangecontrol then if self.rangecontrol then
-- weapon impacted too far from the nearest target! No Score!
self.rangecontrol:NewTransmission( RANGE.Sound.RCWeaponImpactedTooFar.filename, RANGE.Sound.RCWeaponImpactedTooFar.duration, self.soundpath, nil, nil, _message, self.subduration ) self.rangecontrol:NewTransmission( RANGE.Sound.RCWeaponImpactedTooFar.filename, RANGE.Sound.RCWeaponImpactedTooFar.duration, self.soundpath, nil, nil, _message, self.subduration )
end end
@ -2171,6 +2172,7 @@ function RANGE:onafterEnterRange( From, Event, To, player )
local RF = UTILS.Split( string.format( "%.3f", self.rangecontrolfreq ), "." ) local RF = UTILS.Split( string.format( "%.3f", self.rangecontrolfreq ), "." )
-- Radio message that player entered the range -- Radio message that player entered the range
-- You entered the bombing range. For hit assessment, contact the range controller.
self.instructor:NewTransmission( RANGE.Sound.IREnterRange.filename, RANGE.Sound.IREnterRange.duration, self.soundpath ) self.instructor:NewTransmission( RANGE.Sound.IREnterRange.filename, RANGE.Sound.IREnterRange.duration, self.soundpath )
self.instructor:Number2Transmission( RF[1] ) self.instructor:Number2Transmission( RF[1] )
if tonumber( RF[2] ) > 0 then if tonumber( RF[2] ) > 0 then
@ -2191,6 +2193,7 @@ end
function RANGE:onafterExitRange( From, Event, To, player ) function RANGE:onafterExitRange( From, Event, To, player )
if self.instructor then if self.instructor then
-- You left the bombing range zone. Have a nice day!
self.instructor:NewTransmission( RANGE.Sound.IRExitRange.filename, RANGE.Sound.IRExitRange.duration, self.soundpath ) self.instructor:NewTransmission( RANGE.Sound.IRExitRange.filename, RANGE.Sound.IRExitRange.duration, self.soundpath )
end end
@ -3124,6 +3127,7 @@ function RANGE:_CheckInZone( _unitName )
self:_DisplayMessageToGroup( _unit, _msg, nil, true ) self:_DisplayMessageToGroup( _unit, _msg, nil, true )
if self.rangecontrol then if self.rangecontrol then
-- You left the strafing zone too quickly! No score!
self.rangecontrol:NewTransmission( RANGE.Sound.RCLeftStrafePitTooQuickly.filename, RANGE.Sound.RCLeftStrafePitTooQuickly.duration, self.soundpath ) self.rangecontrol:NewTransmission( RANGE.Sound.RCLeftStrafePitTooQuickly.filename, RANGE.Sound.RCLeftStrafePitTooQuickly.duration, self.soundpath )
end end

View File

@ -2306,7 +2306,7 @@ end
-- @param #string Filename The name of the file. -- @param #string Filename The name of the file.
-- @param #boolean Spawn If set to false, do not re-spawn the groups loaded in location and reduce to size. -- @param #boolean Spawn If set to false, do not re-spawn the groups loaded in location and reduce to size.
-- @return Core.Set#SET_GROUP Set of GROUP objects. -- @return Core.Set#SET_GROUP Set of GROUP objects.
-- Returns nil when file cannot be read. Returns a table of data entries if Spawn is false: `{ groupname=groupname, size=size, coordinate=coordinate }` -- Returns nil when file cannot be read. Returns a table of data entries if Spawn is false: `{ groupname=groupname, size=size, coordinate=coordinate, template=template }`
function UTILS.LoadSetOfGroups(Path,Filename,Spawn) function UTILS.LoadSetOfGroups(Path,Filename,Spawn)
local spawn = true local spawn = true
if Spawn == false then spawn = false end if Spawn == false then spawn = false end
@ -2329,10 +2329,10 @@ function UTILS.LoadSetOfGroups(Path,Filename,Spawn)
local posz = tonumber(dataset[6]) local posz = tonumber(dataset[6])
local coordinate = COORDINATE:NewFromVec3({x=posx, y=posy, z=posz}) local coordinate = COORDINATE:NewFromVec3({x=posx, y=posy, z=posz})
local group=nil local group=nil
local data = { groupname=groupname, size=size, coordinate=coordinate } local data = { groupname=groupname, size=size, coordinate=coordinate, template=template }
table.insert(datatable,data) table.insert(datatable,data)
if spawn then if spawn then
local group = SPAWN:New(groupname) local group = SPAWN:New(template)
:InitDelayOff() :InitDelayOff()
:OnSpawnGroup( :OnSpawnGroup(
function(spwndgrp) function(spwndgrp)