mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Static
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||||
env.info( 'Moose Generation Timestamp: 20170702_1258' )
|
env.info( 'Moose Generation Timestamp: 20170702_2317' )
|
||||||
|
|
||||||
--- Various routines
|
--- Various routines
|
||||||
-- @module routines
|
-- @module routines
|
||||||
@@ -20463,7 +20463,6 @@ function CONTROLLABLE:IsAirPlane()
|
|||||||
|
|
||||||
if DCSObject then
|
if DCSObject then
|
||||||
local Category = DCSObject:getDesc().category
|
local Category = DCSObject:getDesc().category
|
||||||
self:T( Category )
|
|
||||||
return Category == Unit.Category.AIRPLANE
|
return Category == Unit.Category.AIRPLANE
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -29813,72 +29812,76 @@ function MISSILETRAINER:_TrackMissiles()
|
|||||||
for ClientDataID, ClientData in pairs( self.TrackingMissiles ) do
|
for ClientDataID, ClientData in pairs( self.TrackingMissiles ) do
|
||||||
|
|
||||||
local Client = ClientData.Client
|
local Client = ClientData.Client
|
||||||
self:T2( { Client:GetName() } )
|
|
||||||
|
if Client and Client:IsAlive() then
|
||||||
|
|
||||||
for MissileDataID, MissileData in pairs( ClientData.MissileData ) do
|
for MissileDataID, MissileData in pairs( ClientData.MissileData ) do
|
||||||
self:T3( MissileDataID )
|
self:T3( MissileDataID )
|
||||||
|
|
||||||
local TrainerSourceUnit = MissileData.TrainerSourceUnit
|
|
||||||
local TrainerWeapon = MissileData.TrainerWeapon
|
|
||||||
local TrainerTargetUnit = MissileData.TrainerTargetUnit
|
|
||||||
local TrainerWeaponTypeName = MissileData.TrainerWeaponTypeName
|
|
||||||
local TrainerWeaponLaunched = MissileData.TrainerWeaponLaunched
|
|
||||||
|
|
||||||
if Client and Client:IsAlive() and TrainerSourceUnit and TrainerSourceUnit:IsAlive() and TrainerWeapon and TrainerWeapon:isExist() and TrainerTargetUnit and TrainerTargetUnit:IsAlive() then
|
local TrainerSourceUnit = MissileData.TrainerSourceUnit
|
||||||
local PositionMissile = TrainerWeapon:getPosition().p
|
local TrainerWeapon = MissileData.TrainerWeapon
|
||||||
local TargetVec3 = Client:GetVec3()
|
local TrainerTargetUnit = MissileData.TrainerTargetUnit
|
||||||
|
local TrainerWeaponTypeName = MissileData.TrainerWeaponTypeName
|
||||||
local Distance = ( ( PositionMissile.x - TargetVec3.x )^2 +
|
local TrainerWeaponLaunched = MissileData.TrainerWeaponLaunched
|
||||||
( PositionMissile.y - TargetVec3.y )^2 +
|
|
||||||
( PositionMissile.z - TargetVec3.z )^2
|
if Client and Client:IsAlive() and TrainerSourceUnit and TrainerSourceUnit:IsAlive() and TrainerWeapon and TrainerWeapon:isExist() and TrainerTargetUnit and TrainerTargetUnit:IsAlive() then
|
||||||
) ^ 0.5 / 1000
|
local PositionMissile = TrainerWeapon:getPosition().p
|
||||||
|
local TargetVec3 = Client:GetVec3()
|
||||||
if Distance <= self.Distance then
|
|
||||||
-- Hit alert
|
local Distance = ( ( PositionMissile.x - TargetVec3.x )^2 +
|
||||||
TrainerWeapon:destroy()
|
( PositionMissile.y - TargetVec3.y )^2 +
|
||||||
if self.MessagesOnOff == true and self.AlertsHitsOnOff == true then
|
( PositionMissile.z - TargetVec3.z )^2
|
||||||
|
) ^ 0.5 / 1000
|
||||||
self:T( "killed" )
|
|
||||||
|
if Distance <= self.Distance then
|
||||||
local Message = MESSAGE:New(
|
-- Hit alert
|
||||||
string.format( "%s launched by %s killed %s",
|
TrainerWeapon:destroy()
|
||||||
TrainerWeapon:getTypeName(),
|
if self.MessagesOnOff == true and self.AlertsHitsOnOff == true then
|
||||||
TrainerSourceUnit:GetTypeName(),
|
|
||||||
TrainerTargetUnit:GetPlayerName()
|
self:T( "killed" )
|
||||||
), 15, "Hit Alert" )
|
|
||||||
|
local Message = MESSAGE:New(
|
||||||
if self.AlertsToAll == true then
|
string.format( "%s launched by %s killed %s",
|
||||||
Message:ToAll()
|
TrainerWeapon:getTypeName(),
|
||||||
else
|
TrainerSourceUnit:GetTypeName(),
|
||||||
Message:ToClient( Client )
|
TrainerTargetUnit:GetPlayerName()
|
||||||
|
), 15, "Hit Alert" )
|
||||||
|
|
||||||
|
if self.AlertsToAll == true then
|
||||||
|
Message:ToAll()
|
||||||
|
else
|
||||||
|
Message:ToClient( Client )
|
||||||
|
end
|
||||||
|
|
||||||
|
MissileData = nil
|
||||||
|
table.remove( ClientData.MissileData, MissileDataID )
|
||||||
|
self:T(ClientData.MissileData)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if not ( TrainerWeapon and TrainerWeapon:isExist() ) then
|
||||||
|
if self.MessagesOnOff == true and self.AlertsLaunchesOnOff == true then
|
||||||
|
-- Weapon does not exist anymore. Delete from Table
|
||||||
|
local Message = MESSAGE:New(
|
||||||
|
string.format( "%s launched by %s self destructed!",
|
||||||
|
TrainerWeaponTypeName,
|
||||||
|
TrainerSourceUnit:GetTypeName()
|
||||||
|
), 5, "Tracking" )
|
||||||
|
|
||||||
|
if self.AlertsToAll == true then
|
||||||
|
Message:ToAll()
|
||||||
|
else
|
||||||
|
Message:ToClient( Client )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
MissileData = nil
|
MissileData = nil
|
||||||
table.remove( ClientData.MissileData, MissileDataID )
|
table.remove( ClientData.MissileData, MissileDataID )
|
||||||
self:T(ClientData.MissileData)
|
self:T( ClientData.MissileData )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
|
||||||
if not ( TrainerWeapon and TrainerWeapon:isExist() ) then
|
|
||||||
if self.MessagesOnOff == true and self.AlertsLaunchesOnOff == true then
|
|
||||||
-- Weapon does not exist anymore. Delete from Table
|
|
||||||
local Message = MESSAGE:New(
|
|
||||||
string.format( "%s launched by %s self destructed!",
|
|
||||||
TrainerWeaponTypeName,
|
|
||||||
TrainerSourceUnit:GetTypeName()
|
|
||||||
), 5, "Tracking" )
|
|
||||||
|
|
||||||
if self.AlertsToAll == true then
|
|
||||||
Message:ToAll()
|
|
||||||
else
|
|
||||||
Message:ToClient( Client )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
MissileData = nil
|
|
||||||
table.remove( ClientData.MissileData, MissileDataID )
|
|
||||||
self:T( ClientData.MissileData )
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
self.TrackingMissiles[ClientDataID] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -29894,7 +29897,7 @@ function MISSILETRAINER:_TrackMissiles()
|
|||||||
for ClientDataID, ClientData in pairs( self.TrackingMissiles ) do
|
for ClientDataID, ClientData in pairs( self.TrackingMissiles ) do
|
||||||
|
|
||||||
local Client = ClientData.Client
|
local Client = ClientData.Client
|
||||||
self:T2( { Client:GetName() } )
|
--self:T2( { Client:GetName() } )
|
||||||
|
|
||||||
|
|
||||||
ClientData.MessageToClient = ""
|
ClientData.MessageToClient = ""
|
||||||
@@ -29904,7 +29907,7 @@ function MISSILETRAINER:_TrackMissiles()
|
|||||||
for TrackingDataID, TrackingData in pairs( self.TrackingMissiles ) do
|
for TrackingDataID, TrackingData in pairs( self.TrackingMissiles ) do
|
||||||
|
|
||||||
for MissileDataID, MissileData in pairs( TrackingData.MissileData ) do
|
for MissileDataID, MissileData in pairs( TrackingData.MissileData ) do
|
||||||
self:T3( MissileDataID )
|
--self:T3( MissileDataID )
|
||||||
|
|
||||||
local TrainerSourceUnit = MissileData.TrainerSourceUnit
|
local TrainerSourceUnit = MissileData.TrainerSourceUnit
|
||||||
local TrainerWeapon = MissileData.TrainerWeapon
|
local TrainerWeapon = MissileData.TrainerWeapon
|
||||||
@@ -31674,7 +31677,7 @@ do -- DETECTION_BASE
|
|||||||
--self:E( { DetectionGroupData } )
|
--self:E( { DetectionGroupData } )
|
||||||
self:__DetectionGroup( DetectDelay, DetectionGroupData, DetectionTimeStamp ) -- Process each detection asynchronously.
|
self:__DetectionGroup( DetectDelay, DetectionGroupData, DetectionTimeStamp ) -- Process each detection asynchronously.
|
||||||
self.DetectionCount = self.DetectionCount + 1
|
self.DetectionCount = self.DetectionCount + 1
|
||||||
DetectDelay = DetectDelay + 0.1
|
DetectDelay = DetectDelay + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -32331,7 +32334,7 @@ do -- DETECTION_BASE
|
|||||||
local EnemyUnitName = DetectedUnit:GetName()
|
local EnemyUnitName = DetectedUnit:GetName()
|
||||||
local FoundUnitInReportSetGroup = ReportSetGroup:FindGroup( FoundUnitGroupName ) ~= nil
|
local FoundUnitInReportSetGroup = ReportSetGroup:FindGroup( FoundUnitGroupName ) ~= nil
|
||||||
|
|
||||||
self:F( { "Friendlies search:", FoundUnitName, FoundUnitCoalition, EnemyUnitName, EnemyCoalition, FoundUnitInReportSetGroup } )
|
--self:F( { "Friendlies search:", FoundUnitName, FoundUnitCoalition, EnemyUnitName, EnemyCoalition, FoundUnitInReportSetGroup } )
|
||||||
|
|
||||||
if FoundUnitCoalition ~= EnemyCoalition and FoundUnitInReportSetGroup == false then
|
if FoundUnitCoalition ~= EnemyCoalition and FoundUnitInReportSetGroup == false then
|
||||||
DetectedItem.FriendliesNearBy = DetectedItem.FriendliesNearBy or {}
|
DetectedItem.FriendliesNearBy = DetectedItem.FriendliesNearBy or {}
|
||||||
@@ -47149,7 +47152,7 @@ function TASK:ReportDetails( ReportGroup )
|
|||||||
local FromCoordinate = ReportGroup:GetUnit(1):GetCoordinate()
|
local FromCoordinate = ReportGroup:GetUnit(1):GetCoordinate()
|
||||||
local ToCoordinate = TaskInfo.TaskInfoText -- Core.Point#COORDINATE
|
local ToCoordinate = TaskInfo.TaskInfoText -- Core.Point#COORDINATE
|
||||||
Report:Add( TaskInfoIDText )
|
Report:Add( TaskInfoIDText )
|
||||||
Report:AddIndent( ToCoordinate:ToStringBRA( FromCoordinate ) .. ", " .. TaskInfo:ToStringAspect( FromCoordinate ) )
|
Report:AddIndent( ToCoordinate:ToStringBRA( FromCoordinate ) .. ", " .. TaskInfo.TaskInfoText:ToStringAspect( FromCoordinate ) )
|
||||||
Report:AddIndent( ToCoordinate:ToStringBULLS( ReportGroup:GetCoalition() ) )
|
Report:AddIndent( ToCoordinate:ToStringBULLS( ReportGroup:GetCoalition() ) )
|
||||||
else
|
else
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user