mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Fixes to resolve exceptions in multi player situations
This commit is contained in:
parent
367c4d74af
commit
8e2aef17e7
@ -1724,6 +1724,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
self:E( { DefenderSquadron } )
|
self:E( { DefenderSquadron } )
|
||||||
local SpawnCoord = DefenderSquadron.Airbase:GetCoordinate() -- Core.Point#COORDINATE
|
local SpawnCoord = DefenderSquadron.Airbase:GetCoordinate() -- Core.Point#COORDINATE
|
||||||
local TargetCoord = Target.Set:GetFirst():GetCoordinate()
|
local TargetCoord = Target.Set:GetFirst():GetCoordinate()
|
||||||
|
if TargetCoord then
|
||||||
local Distance = SpawnCoord:Get2DDistance( TargetCoord )
|
local Distance = SpawnCoord:Get2DDistance( TargetCoord )
|
||||||
|
|
||||||
if ClosestDistance == 0 or Distance < ClosestDistance then
|
if ClosestDistance == 0 or Distance < ClosestDistance then
|
||||||
@ -1736,6 +1737,7 @@ do -- AI_A2A_DISPATCHER
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if ClosestDefenderSquadronName then
|
if ClosestDefenderSquadronName then
|
||||||
|
|
||||||
|
|||||||
@ -1170,7 +1170,7 @@ do -- Players
|
|||||||
-- @return #nil The group has no players
|
-- @return #nil The group has no players
|
||||||
function GROUP:GetPlayerNames()
|
function GROUP:GetPlayerNames()
|
||||||
|
|
||||||
local PlayerNames = nil
|
local PlayerNames = {}
|
||||||
|
|
||||||
local Units = self:GetUnits()
|
local Units = self:GetUnits()
|
||||||
for UnitID, UnitData in pairs( Units ) do
|
for UnitID, UnitData in pairs( Units ) do
|
||||||
|
|||||||
@ -598,12 +598,17 @@ end
|
|||||||
-- @param #UNIT self
|
-- @param #UNIT self
|
||||||
function UNIT:GetThreatLevel()
|
function UNIT:GetThreatLevel()
|
||||||
|
|
||||||
local Attributes = self:GetDesc().attributes
|
|
||||||
self:T( Attributes )
|
|
||||||
|
|
||||||
local ThreatLevel = 0
|
local ThreatLevel = 0
|
||||||
local ThreatText = ""
|
local ThreatText = ""
|
||||||
|
|
||||||
|
local Descriptor = self:GetDesc()
|
||||||
|
|
||||||
|
if Descriptor then
|
||||||
|
|
||||||
|
local Attributes = Descriptor.attributes
|
||||||
|
self:T( Attributes )
|
||||||
|
|
||||||
if self:IsGround() then
|
if self:IsGround() then
|
||||||
|
|
||||||
self:T( "Ground" )
|
self:T( "Ground" )
|
||||||
@ -680,15 +685,15 @@ function UNIT:GetThreatLevel()
|
|||||||
|
|
||||||
self:T( "Ship" )
|
self:T( "Ship" )
|
||||||
|
|
||||||
--["Aircraft Carriers"] = {"Heavy armed ships",},
|
--["Aircraft Carriers"] = {"Heavy armed ships",},
|
||||||
--["Cruisers"] = {"Heavy armed ships",},
|
--["Cruisers"] = {"Heavy armed ships",},
|
||||||
--["Destroyers"] = {"Heavy armed ships",},
|
--["Destroyers"] = {"Heavy armed ships",},
|
||||||
--["Frigates"] = {"Heavy armed ships",},
|
--["Frigates"] = {"Heavy armed ships",},
|
||||||
--["Corvettes"] = {"Heavy armed ships",},
|
--["Corvettes"] = {"Heavy armed ships",},
|
||||||
--["Heavy armed ships"] = {"Armed ships", "Armed Air Defence", "HeavyArmoredUnits",},
|
--["Heavy armed ships"] = {"Armed ships", "Armed Air Defence", "HeavyArmoredUnits",},
|
||||||
--["Light armed ships"] = {"Armed ships","NonArmoredUnits"},
|
--["Light armed ships"] = {"Armed ships","NonArmoredUnits"},
|
||||||
--["Armed ships"] = {"Ships"},
|
--["Armed ships"] = {"Ships"},
|
||||||
--["Unarmed ships"] = {"Ships","HeavyArmoredUnits",},
|
--["Unarmed ships"] = {"Ships","HeavyArmoredUnits",},
|
||||||
|
|
||||||
local ThreatLevels = {
|
local ThreatLevels = {
|
||||||
"Unarmed ship",
|
"Unarmed ship",
|
||||||
@ -715,6 +720,7 @@ function UNIT:GetThreatLevel()
|
|||||||
|
|
||||||
ThreatText = ThreatLevels[ThreatLevel+1]
|
ThreatText = ThreatLevels[ThreatLevel+1]
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
self:T2( ThreatLevel )
|
self:T2( ThreatLevel )
|
||||||
return ThreatLevel, ThreatText
|
return ThreatLevel, ThreatText
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user