mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Bugfix Missile trainer
This commit is contained in:
parent
5f02b5f764
commit
a76ec08499
@ -9,7 +9,7 @@
|
|||||||
-- It suports the following functionality:
|
-- It suports the following functionality:
|
||||||
--
|
--
|
||||||
-- * Track the missiles fired at you and other players, providing bearing and range information of the missiles towards the airplanes.
|
-- * Track the missiles fired at you and other players, providing bearing and range information of the missiles towards the airplanes.
|
||||||
-- * Provide alerts of missile launches, including detailed information of the units launching, including bearing, range …
|
-- * Provide alerts of missile launches, including detailed information of the units launching, including bearing, range <EFBFBD>
|
||||||
-- * Provide alerts when a missile would have killed your aircraft.
|
-- * Provide alerts when a missile would have killed your aircraft.
|
||||||
-- * Provide alerts when the missile self destructs.
|
-- * Provide alerts when the missile self destructs.
|
||||||
-- * Enable / Disable and Configure the Missile Trainer using the various menu options.
|
-- * Enable / Disable and Configure the Missile Trainer using the various menu options.
|
||||||
@ -461,42 +461,47 @@ function MISSILETRAINER:_EventShot( Event )
|
|||||||
self:T( "Missile Launched = " .. TrainerWeaponName )
|
self:T( "Missile Launched = " .. TrainerWeaponName )
|
||||||
|
|
||||||
local TrainerTargetDCSUnit = TrainerWeapon:getTarget() -- Identify target
|
local TrainerTargetDCSUnit = TrainerWeapon:getTarget() -- Identify target
|
||||||
local TrainerTargetDCSUnitName = Unit.getName( TrainerTargetDCSUnit )
|
if TrainerTargetDCSUnit then
|
||||||
local TrainerTargetSkill = _DATABASE.Templates.Units[TrainerTargetDCSUnitName].Template.skill
|
local TrainerTargetDCSUnitName = Unit.getName( TrainerTargetDCSUnit )
|
||||||
|
local TrainerTargetSkill = _DATABASE.Templates.Units[TrainerTargetDCSUnitName].Template.skill
|
||||||
self:T(TrainerTargetDCSUnitName )
|
|
||||||
|
self:T(TrainerTargetDCSUnitName )
|
||||||
local Client = self.DBClients:FindClient( TrainerTargetDCSUnitName )
|
|
||||||
if Client then
|
local Client = self.DBClients:FindClient( TrainerTargetDCSUnitName )
|
||||||
|
if Client then
|
||||||
local TrainerSourceUnit = UNIT:Find( TrainerSourceDCSUnit )
|
|
||||||
local TrainerTargetUnit = UNIT:Find( TrainerTargetDCSUnit )
|
local TrainerSourceUnit = UNIT:Find( TrainerSourceDCSUnit )
|
||||||
|
local TrainerTargetUnit = UNIT:Find( TrainerTargetDCSUnit )
|
||||||
if self.MessagesOnOff == true and self.AlertsLaunchesOnOff == true then
|
|
||||||
|
if self.MessagesOnOff == true and self.AlertsLaunchesOnOff == true then
|
||||||
local Message = MESSAGE:New(
|
|
||||||
string.format( "%s launched a %s",
|
local Message = MESSAGE:New(
|
||||||
TrainerSourceUnit:GetTypeName(),
|
string.format( "%s launched a %s",
|
||||||
TrainerWeaponName
|
TrainerSourceUnit:GetTypeName(),
|
||||||
) .. self:_AddRange( Client, TrainerWeapon ) .. self:_AddBearing( Client, TrainerWeapon ), 5, "Launch Alert" )
|
TrainerWeaponName
|
||||||
|
) .. self:_AddRange( Client, TrainerWeapon ) .. self:_AddBearing( Client, TrainerWeapon ), 5, "Launch Alert" )
|
||||||
if self.AlertsToAll then
|
|
||||||
Message:ToAll()
|
if self.AlertsToAll then
|
||||||
else
|
Message:ToAll()
|
||||||
Message:ToClient( Client )
|
else
|
||||||
|
Message:ToClient( Client )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local ClientID = Client:GetID()
|
||||||
|
self:T( ClientID )
|
||||||
|
local MissileData = {}
|
||||||
|
MissileData.TrainerSourceUnit = TrainerSourceUnit
|
||||||
|
MissileData.TrainerWeapon = TrainerWeapon
|
||||||
|
MissileData.TrainerTargetUnit = TrainerTargetUnit
|
||||||
|
MissileData.TrainerWeaponTypeName = TrainerWeapon:getTypeName()
|
||||||
|
MissileData.TrainerWeaponLaunched = true
|
||||||
|
table.insert( self.TrackingMissiles[ClientID].MissileData, MissileData )
|
||||||
|
--self:T( self.TrackingMissiles )
|
||||||
end
|
end
|
||||||
|
else
|
||||||
local ClientID = Client:GetID()
|
-- TODO: some weapons don't know the target unit... Need to develop a workaround for this.
|
||||||
self:T( ClientID )
|
TrainerWeapon:destroy()
|
||||||
local MissileData = {}
|
|
||||||
MissileData.TrainerSourceUnit = TrainerSourceUnit
|
|
||||||
MissileData.TrainerWeapon = TrainerWeapon
|
|
||||||
MissileData.TrainerTargetUnit = TrainerTargetUnit
|
|
||||||
MissileData.TrainerWeaponTypeName = TrainerWeapon:getTypeName()
|
|
||||||
MissileData.TrainerWeaponLaunched = true
|
|
||||||
table.insert( self.TrackingMissiles[ClientID].MissileData, MissileData )
|
|
||||||
--self:T( self.TrackingMissiles )
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||||
env.info( 'Moose Generation Timestamp: 20160723_1214' )
|
env.info( 'Moose Generation Timestamp: 20160723_1232' )
|
||||||
local base = _G
|
local base = _G
|
||||||
|
|
||||||
Include = {}
|
Include = {}
|
||||||
@ -23234,7 +23234,7 @@ end
|
|||||||
-- It suports the following functionality:
|
-- It suports the following functionality:
|
||||||
--
|
--
|
||||||
-- * Track the missiles fired at you and other players, providing bearing and range information of the missiles towards the airplanes.
|
-- * Track the missiles fired at you and other players, providing bearing and range information of the missiles towards the airplanes.
|
||||||
-- * Provide alerts of missile launches, including detailed information of the units launching, including bearing, range …
|
-- * Provide alerts of missile launches, including detailed information of the units launching, including bearing, range <EFBFBD>
|
||||||
-- * Provide alerts when a missile would have killed your aircraft.
|
-- * Provide alerts when a missile would have killed your aircraft.
|
||||||
-- * Provide alerts when the missile self destructs.
|
-- * Provide alerts when the missile self destructs.
|
||||||
-- * Enable / Disable and Configure the Missile Trainer using the various menu options.
|
-- * Enable / Disable and Configure the Missile Trainer using the various menu options.
|
||||||
@ -23686,42 +23686,47 @@ function MISSILETRAINER:_EventShot( Event )
|
|||||||
self:T( "Missile Launched = " .. TrainerWeaponName )
|
self:T( "Missile Launched = " .. TrainerWeaponName )
|
||||||
|
|
||||||
local TrainerTargetDCSUnit = TrainerWeapon:getTarget() -- Identify target
|
local TrainerTargetDCSUnit = TrainerWeapon:getTarget() -- Identify target
|
||||||
local TrainerTargetDCSUnitName = Unit.getName( TrainerTargetDCSUnit )
|
if TrainerTargetDCSUnit then
|
||||||
local TrainerTargetSkill = _DATABASE.Templates.Units[TrainerTargetDCSUnitName].Template.skill
|
local TrainerTargetDCSUnitName = Unit.getName( TrainerTargetDCSUnit )
|
||||||
|
local TrainerTargetSkill = _DATABASE.Templates.Units[TrainerTargetDCSUnitName].Template.skill
|
||||||
self:T(TrainerTargetDCSUnitName )
|
|
||||||
|
self:T(TrainerTargetDCSUnitName )
|
||||||
local Client = self.DBClients:FindClient( TrainerTargetDCSUnitName )
|
|
||||||
if Client then
|
local Client = self.DBClients:FindClient( TrainerTargetDCSUnitName )
|
||||||
|
if Client then
|
||||||
local TrainerSourceUnit = UNIT:Find( TrainerSourceDCSUnit )
|
|
||||||
local TrainerTargetUnit = UNIT:Find( TrainerTargetDCSUnit )
|
local TrainerSourceUnit = UNIT:Find( TrainerSourceDCSUnit )
|
||||||
|
local TrainerTargetUnit = UNIT:Find( TrainerTargetDCSUnit )
|
||||||
if self.MessagesOnOff == true and self.AlertsLaunchesOnOff == true then
|
|
||||||
|
if self.MessagesOnOff == true and self.AlertsLaunchesOnOff == true then
|
||||||
local Message = MESSAGE:New(
|
|
||||||
string.format( "%s launched a %s",
|
local Message = MESSAGE:New(
|
||||||
TrainerSourceUnit:GetTypeName(),
|
string.format( "%s launched a %s",
|
||||||
TrainerWeaponName
|
TrainerSourceUnit:GetTypeName(),
|
||||||
) .. self:_AddRange( Client, TrainerWeapon ) .. self:_AddBearing( Client, TrainerWeapon ), 5, "Launch Alert" )
|
TrainerWeaponName
|
||||||
|
) .. self:_AddRange( Client, TrainerWeapon ) .. self:_AddBearing( Client, TrainerWeapon ), 5, "Launch Alert" )
|
||||||
if self.AlertsToAll then
|
|
||||||
Message:ToAll()
|
if self.AlertsToAll then
|
||||||
else
|
Message:ToAll()
|
||||||
Message:ToClient( Client )
|
else
|
||||||
|
Message:ToClient( Client )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local ClientID = Client:GetID()
|
||||||
|
self:T( ClientID )
|
||||||
|
local MissileData = {}
|
||||||
|
MissileData.TrainerSourceUnit = TrainerSourceUnit
|
||||||
|
MissileData.TrainerWeapon = TrainerWeapon
|
||||||
|
MissileData.TrainerTargetUnit = TrainerTargetUnit
|
||||||
|
MissileData.TrainerWeaponTypeName = TrainerWeapon:getTypeName()
|
||||||
|
MissileData.TrainerWeaponLaunched = true
|
||||||
|
table.insert( self.TrackingMissiles[ClientID].MissileData, MissileData )
|
||||||
|
--self:T( self.TrackingMissiles )
|
||||||
end
|
end
|
||||||
|
else
|
||||||
local ClientID = Client:GetID()
|
-- TODO: some weapons don't know the target unit... Need to develop a workaround for this.
|
||||||
self:T( ClientID )
|
TrainerWeapon:destroy()
|
||||||
local MissileData = {}
|
|
||||||
MissileData.TrainerSourceUnit = TrainerSourceUnit
|
|
||||||
MissileData.TrainerWeapon = TrainerWeapon
|
|
||||||
MissileData.TrainerTargetUnit = TrainerTargetUnit
|
|
||||||
MissileData.TrainerWeaponTypeName = TrainerWeapon:getTypeName()
|
|
||||||
MissileData.TrainerWeaponLaunched = true
|
|
||||||
table.insert( self.TrackingMissiles[ClientID].MissileData, MissileData )
|
|
||||||
--self:T( self.TrackingMissiles )
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||||
env.info( 'Moose Generation Timestamp: 20160723_1214' )
|
env.info( 'Moose Generation Timestamp: 20160723_1232' )
|
||||||
local base = _G
|
local base = _G
|
||||||
|
|
||||||
Include = {}
|
Include = {}
|
||||||
@ -23234,7 +23234,7 @@ end
|
|||||||
-- It suports the following functionality:
|
-- It suports the following functionality:
|
||||||
--
|
--
|
||||||
-- * Track the missiles fired at you and other players, providing bearing and range information of the missiles towards the airplanes.
|
-- * Track the missiles fired at you and other players, providing bearing and range information of the missiles towards the airplanes.
|
||||||
-- * Provide alerts of missile launches, including detailed information of the units launching, including bearing, range …
|
-- * Provide alerts of missile launches, including detailed information of the units launching, including bearing, range <EFBFBD>
|
||||||
-- * Provide alerts when a missile would have killed your aircraft.
|
-- * Provide alerts when a missile would have killed your aircraft.
|
||||||
-- * Provide alerts when the missile self destructs.
|
-- * Provide alerts when the missile self destructs.
|
||||||
-- * Enable / Disable and Configure the Missile Trainer using the various menu options.
|
-- * Enable / Disable and Configure the Missile Trainer using the various menu options.
|
||||||
@ -23686,42 +23686,47 @@ function MISSILETRAINER:_EventShot( Event )
|
|||||||
self:T( "Missile Launched = " .. TrainerWeaponName )
|
self:T( "Missile Launched = " .. TrainerWeaponName )
|
||||||
|
|
||||||
local TrainerTargetDCSUnit = TrainerWeapon:getTarget() -- Identify target
|
local TrainerTargetDCSUnit = TrainerWeapon:getTarget() -- Identify target
|
||||||
local TrainerTargetDCSUnitName = Unit.getName( TrainerTargetDCSUnit )
|
if TrainerTargetDCSUnit then
|
||||||
local TrainerTargetSkill = _DATABASE.Templates.Units[TrainerTargetDCSUnitName].Template.skill
|
local TrainerTargetDCSUnitName = Unit.getName( TrainerTargetDCSUnit )
|
||||||
|
local TrainerTargetSkill = _DATABASE.Templates.Units[TrainerTargetDCSUnitName].Template.skill
|
||||||
self:T(TrainerTargetDCSUnitName )
|
|
||||||
|
self:T(TrainerTargetDCSUnitName )
|
||||||
local Client = self.DBClients:FindClient( TrainerTargetDCSUnitName )
|
|
||||||
if Client then
|
local Client = self.DBClients:FindClient( TrainerTargetDCSUnitName )
|
||||||
|
if Client then
|
||||||
local TrainerSourceUnit = UNIT:Find( TrainerSourceDCSUnit )
|
|
||||||
local TrainerTargetUnit = UNIT:Find( TrainerTargetDCSUnit )
|
local TrainerSourceUnit = UNIT:Find( TrainerSourceDCSUnit )
|
||||||
|
local TrainerTargetUnit = UNIT:Find( TrainerTargetDCSUnit )
|
||||||
if self.MessagesOnOff == true and self.AlertsLaunchesOnOff == true then
|
|
||||||
|
if self.MessagesOnOff == true and self.AlertsLaunchesOnOff == true then
|
||||||
local Message = MESSAGE:New(
|
|
||||||
string.format( "%s launched a %s",
|
local Message = MESSAGE:New(
|
||||||
TrainerSourceUnit:GetTypeName(),
|
string.format( "%s launched a %s",
|
||||||
TrainerWeaponName
|
TrainerSourceUnit:GetTypeName(),
|
||||||
) .. self:_AddRange( Client, TrainerWeapon ) .. self:_AddBearing( Client, TrainerWeapon ), 5, "Launch Alert" )
|
TrainerWeaponName
|
||||||
|
) .. self:_AddRange( Client, TrainerWeapon ) .. self:_AddBearing( Client, TrainerWeapon ), 5, "Launch Alert" )
|
||||||
if self.AlertsToAll then
|
|
||||||
Message:ToAll()
|
if self.AlertsToAll then
|
||||||
else
|
Message:ToAll()
|
||||||
Message:ToClient( Client )
|
else
|
||||||
|
Message:ToClient( Client )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local ClientID = Client:GetID()
|
||||||
|
self:T( ClientID )
|
||||||
|
local MissileData = {}
|
||||||
|
MissileData.TrainerSourceUnit = TrainerSourceUnit
|
||||||
|
MissileData.TrainerWeapon = TrainerWeapon
|
||||||
|
MissileData.TrainerTargetUnit = TrainerTargetUnit
|
||||||
|
MissileData.TrainerWeaponTypeName = TrainerWeapon:getTypeName()
|
||||||
|
MissileData.TrainerWeaponLaunched = true
|
||||||
|
table.insert( self.TrackingMissiles[ClientID].MissileData, MissileData )
|
||||||
|
--self:T( self.TrackingMissiles )
|
||||||
end
|
end
|
||||||
|
else
|
||||||
local ClientID = Client:GetID()
|
-- TODO: some weapons don't know the target unit... Need to develop a workaround for this.
|
||||||
self:T( ClientID )
|
TrainerWeapon:destroy()
|
||||||
local MissileData = {}
|
|
||||||
MissileData.TrainerSourceUnit = TrainerSourceUnit
|
|
||||||
MissileData.TrainerWeapon = TrainerWeapon
|
|
||||||
MissileData.TrainerTargetUnit = TrainerTargetUnit
|
|
||||||
MissileData.TrainerWeaponTypeName = TrainerWeapon:getTypeName()
|
|
||||||
MissileData.TrainerWeaponLaunched = true
|
|
||||||
table.insert( self.TrackingMissiles[ClientID].MissileData, MissileData )
|
|
||||||
--self:T( self.TrackingMissiles )
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user