Merge remote-tracking branch 'refs/remotes/origin/master' into master-bugfix

This commit is contained in:
Sven Van de Velde 2017-02-24 12:29:31 +01:00
commit f4b4a40d75
12 changed files with 360 additions and 116 deletions

View File

@ -136,8 +136,8 @@ AI_CAS_ZONE = {
-- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol. -- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
-- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h. -- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h.
-- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h. -- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h.
-- @param Core.Zone#ZONE_BASE EngageZone The zone where the engage will happen.
-- @param Dcs.DCSTypes#AltitudeType PatrolAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO -- @param Dcs.DCSTypes#AltitudeType PatrolAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO
-- @param Core.Zone#ZONE EngageZone
-- @return #AI_CAS_ZONE self -- @return #AI_CAS_ZONE self
function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageZone, PatrolAltType ) function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageZone, PatrolAltType )

View File

@ -38,7 +38,7 @@
-- --
-- ![Objects](..\Presentations\EVENT\Dia6.JPG) -- ![Objects](..\Presentations\EVENT\Dia6.JPG)
-- --
-- For most DCS events, the above order of updating will be followed.1 -- For most DCS events, the above order of updating will be followed.
-- --
-- ![Objects](..\Presentations\EVENT\Dia7.JPG) -- ![Objects](..\Presentations\EVENT\Dia7.JPG)
-- --
@ -124,6 +124,22 @@
-- --
-- ![Objects](..\Presentations\EVENT\Dia14.JPG) -- ![Objects](..\Presentations\EVENT\Dia14.JPG)
-- --
-- **IMPORTANT NOTE:** Some events can involve not just UNIT objects, but also STATIC objects!!!
-- In that case the initiator or target unit fields will refer to a STATIC object!
-- In case a STATIC object is involved, the documentation indicates which fields will and won't not be populated.
-- The fields **IniCategory** and **TgtCategory** contain the indicator which **kind of object is involved** in the event.
-- You can use the enumerator **Object.Category.UNIT** and **Object.Category.STATIC** to check on IniCategory and TgtCategory.
-- Example code snippet:
--
-- if Event.IniCategory == Object.Category.UNIT then
-- ...
-- end
-- if Event.IniCategory == Object.Category.STATIC then
-- ...
-- end
--
-- When a static object is involved in the event, the Group and Player fields won't be populated.
--
-- ==== -- ====
-- --
-- # **API CHANGE HISTORY** -- # **API CHANGE HISTORY**
@ -152,7 +168,8 @@
-- --
-- @module Event -- @module Event
-- TODO: Need to update the EVENTDATA documentation with IniPlayerName and TgtPlayerName
-- TODO: Need to update the EVENTDATA documentation with IniCategory and TgtCategory
@ -195,23 +212,39 @@ EVENTS = {
} }
--- The Event structure --- The Event structure
-- Note that at the beginning of each field description, there is an indication which field will be populated depending on the object type involved in the Event:
--
-- * A (Object.Category.)UNIT : A UNIT object type is involved in the Event.
-- * A (Object.Category.)STATIC : A STATIC object type is involved in the Event.µ
--
-- @type EVENTDATA -- @type EVENTDATA
-- @field id -- @field #number id The identifier of the event.
-- @field initiator --
-- @field target -- @field Dcs.DCSUnit#Unit initiator (UNIT/STATIC) The initiating @{Dcs.DCSUnit#Unit} or @{Dcs.DCSStaticObject#StaticObject}.
-- @field weapon -- @field Dcs.DCSObject#Object.Category IniCategory (UNIT/STATIC) The initiator object category ( Object.Category.UNIT or Object.Category.STATIC ).
-- @field IniDCSUnit -- @field Dcs.DCSUnit#Unit IniDCSUnit (UNIT/STATIC) The initiating @{Dcs.DCSUnit#Unit} or @{Dcs.DCSStaticObject#StaticObject}.
-- @field IniDCSUnitName -- @field #string IniDCSUnitName (UNIT/STATIC) The initiating Unit name.
-- @field Wrapper.Unit#UNIT IniUnit -- @field Wrapper.Unit#UNIT IniUnit (UNIT/STATIC) The initiating MOOSE wrapper @{Wrapper.Unit#UNIT} of the initiator Unit object.
-- @field #string IniUnitName -- @field #string IniUnitName (UNIT/STATIC) The initiating UNIT name (same as IniDCSUnitName).
-- @field IniDCSGroup -- @field Dcs.DCSGroup#Group IniDCSGroup (UNIT) The initiating {Dcs.DCSGroup#Group}.
-- @field IniDCSGroupName -- @field #string IniDCSGroupName (UNIT) The initiating Group name.
-- @field TgtDCSUnit -- @field Wrapper.Group#GROUP IniGroup (UNIT) The initiating MOOSE wrapper @{Wrapper.Group#GROUP} of the initiator Group object.
-- @field TgtDCSUnitName -- @field #string IniGroupName (UNIT) The initiating GROUP name (same as IniDCSGroupName).
-- @field Wrapper.Unit#UNIT TgtUnit -- @field #string IniPlayerName (UNIT) The name of the initiating player in case the Unit is a client or player slot.
-- @field #string TgtUnitName --
-- @field TgtDCSGroup -- @field Dcs.DCSUnit#Unit target (UNIT/STATIC) The target @{Dcs.DCSUnit#Unit} or @{Dcs.DCSStaticObject#StaticObject}.
-- @field TgtDCSGroupName -- @field Dcs.DCSObject#Object.Category TgtCategory (UNIT/STATIC) The target object category ( Object.Category.UNIT or Object.Category.STATIC ).
-- @field Dcs.DCSUnit#Unit TgtDCSUnit (UNIT/STATIC) The target @{Dcs.DCSUnit#Unit} or @{Dcs.DCSStaticObject#StaticObject}.
-- @field #string TgtDCSUnitName (UNIT/STATIC) The target Unit name.
-- @field Wrapper.Unit#UNIT TgtUnit (UNIT/STATIC) The target MOOSE wrapper @{Wrapper.Unit#UNIT} of the target Unit object.
-- @field #string TgtUnitName (UNIT/STATIC) The target UNIT name (same as TgtDCSUnitName).
-- @field Dcs.DCSGroup#Group TgtDCSGroup (UNIT) The target {Dcs.DCSGroup#Group}.
-- @field #string TgtDCSGroupName (UNIT) The target Group name.
-- @field Wrapper.Group#GROUP TgtGroup (UNIT) The target MOOSE wrapper @{Wrapper.Group#GROUP} of the target Group object.
-- @field #string TgtGroupName (UNIT) The target GROUP name (same as TgtDCSGroupName).
-- @field #string TgtPlayerName (UNIT) The name of the target player in case the Unit is a client or player slot.
--
-- @field weapon The weapon used during the event.
-- @field Weapon -- @field Weapon
-- @field WeaponName -- @field WeaponName
-- @field WeaponTgtDCSUnit -- @field WeaponTgtDCSUnit
@ -1014,11 +1047,15 @@ function EVENT:onEvent( Event )
end end
if self and self.Events and self.Events[Event.id] then if self and self.Events and self.Events[Event.id] then
if Event.initiator and Event.initiator:getCategory() == Object.Category.UNIT then
if Event.initiator then
Event.IniCategory = Event.initiator:getCategory()
if Event.IniCategory == Object.Category.UNIT then
Event.IniDCSUnit = Event.initiator Event.IniDCSUnit = Event.initiator
Event.IniDCSGroup = Event.IniDCSUnit:getGroup()
Event.IniDCSUnitName = Event.IniDCSUnit:getName() Event.IniDCSUnitName = Event.IniDCSUnit:getName()
Event.IniUnitName = Event.IniDCSUnitName Event.IniUnitName = Event.IniDCSUnitName
Event.IniDCSGroup = Event.IniDCSUnit:getGroup()
Event.IniUnit = UNIT:FindByName( Event.IniDCSUnitName ) Event.IniUnit = UNIT:FindByName( Event.IniDCSUnitName )
if not Event.IniUnit then if not Event.IniUnit then
-- Unit can be a CLIENT. Most likely this will be the case ... -- Unit can be a CLIENT. Most likely this will be the case ...
@ -1030,9 +1067,20 @@ function EVENT:onEvent( Event )
Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName ) Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
self:E( { IniGroup = Event.IniGroup } ) self:E( { IniGroup = Event.IniGroup } )
end end
Event.IniPlayerName = Event.IniDCSUnit:getPlayerName()
end end
if Event.IniCategory == Object.Category.STATIC then
Event.IniDCSUnit = Event.initiator
Event.IniDCSUnitName = Event.IniDCSUnit:getName()
Event.IniUnitName = Event.IniDCSUnitName
Event.IniUnit = STATIC:FindByName( Event.IniDCSUnitName )
end
end
if Event.target then if Event.target then
if Event.target and Event.target:getCategory() == Object.Category.UNIT then Event.TgtCategory = Event.target:getCategory()
if Event.TgtCategory == Object.Category.UNIT then
Event.TgtDCSUnit = Event.target Event.TgtDCSUnit = Event.target
Event.TgtDCSGroup = Event.TgtDCSUnit:getGroup() Event.TgtDCSGroup = Event.TgtDCSUnit:getGroup()
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName() Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
@ -1042,8 +1090,19 @@ function EVENT:onEvent( Event )
if Event.TgtDCSGroup and Event.TgtDCSGroup:isExist() then if Event.TgtDCSGroup and Event.TgtDCSGroup:isExist() then
Event.TgtDCSGroupName = Event.TgtDCSGroup:getName() Event.TgtDCSGroupName = Event.TgtDCSGroup:getName()
end end
Event.TgtPlayerName = Event.TgtDCSUnit:getPlayerName()
end
if Event.TgtCategory == Object.Category.STATIC then
Event.TgtDCSUnit = Event.target
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
Event.TgtUnitName = Event.TgtDCSUnitName
Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName )
end end
end end
if Event.weapon then if Event.weapon then
Event.Weapon = Event.weapon Event.Weapon = Event.weapon
Event.WeaponName = Event.Weapon:getTypeName() Event.WeaponName = Event.Weapon:getTypeName()

View File

@ -122,7 +122,7 @@ function SCORING:_EventOnDeadOrCrash( Event )
TargetUnitName = Event.IniDCSUnitName TargetUnitName = Event.IniDCSUnitName
TargetGroup = Event.IniDCSGroup TargetGroup = Event.IniDCSGroup
TargetGroupName = Event.IniDCSGroupName TargetGroupName = Event.IniDCSGroupName
TargetPlayerName = TargetUnit:getPlayerName() TargetPlayerName = Event.IniPlayerName
TargetCoalition = TargetUnit:getCoalition() TargetCoalition = TargetUnit:getCoalition()
--TargetCategory = TargetUnit:getCategory() --TargetCategory = TargetUnit:getCategory()
@ -369,7 +369,7 @@ function SCORING:_EventOnHit( Event )
InitUnitName = Event.IniDCSUnitName InitUnitName = Event.IniDCSUnitName
InitGroup = Event.IniDCSGroup InitGroup = Event.IniDCSGroup
InitGroupName = Event.IniDCSGroupName InitGroupName = Event.IniDCSGroupName
InitPlayerName = InitUnit:getPlayerName() InitPlayerName = Event.IniPlayerName
InitCoalition = InitUnit:getCoalition() InitCoalition = InitUnit:getCoalition()
--TODO: Workaround Client DCS Bug --TODO: Workaround Client DCS Bug
@ -391,7 +391,7 @@ function SCORING:_EventOnHit( Event )
TargetUnitName = Event.TgtDCSUnitName TargetUnitName = Event.TgtDCSUnitName
TargetGroup = Event.TgtDCSGroup TargetGroup = Event.TgtDCSGroup
TargetGroupName = Event.TgtDCSGroupName TargetGroupName = Event.TgtDCSGroupName
TargetPlayerName = TargetUnit:getPlayerName() TargetPlayerName = Event.TgtPlayerName
TargetCoalition = TargetUnit:getCoalition() TargetCoalition = TargetUnit:getCoalition()
--TODO: Workaround Client DCS Bug --TODO: Workaround Client DCS Bug

View File

@ -184,7 +184,7 @@ function GROUP:IsAlive()
local DCSGroup = self:GetDCSObject() local DCSGroup = self:GetDCSObject()
if DCSGroup then if DCSGroup then
local GroupIsAlive = DCSGroup:isExist() local GroupIsAlive = DCSGroup:isExist() and DCSGroup:getUnit(1) ~= nil
self:T3( GroupIsAlive ) self:T3( GroupIsAlive )
return GroupIsAlive return GroupIsAlive
end end

View File

@ -0,0 +1,14 @@
---
-- Name: XXX-999 - Title
-- Author: YYY
-- Date Created: DD Mmm YYYY
--
-- # Situation:
--
--
--
-- # Test cases:
--
-- 1.

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' ) env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20170221_1153' ) env.info( 'Moose Generation Timestamp: 20170224_1222' )
local base = _G local base = _G
Include = {} Include = {}
@ -4059,7 +4059,7 @@ end
-- --
-- ![Objects](..\Presentations\EVENT\Dia6.JPG) -- ![Objects](..\Presentations\EVENT\Dia6.JPG)
-- --
-- For most DCS events, the above order of updating will be followed.1 -- For most DCS events, the above order of updating will be followed.
-- --
-- ![Objects](..\Presentations\EVENT\Dia7.JPG) -- ![Objects](..\Presentations\EVENT\Dia7.JPG)
-- --
@ -4145,6 +4145,22 @@ end
-- --
-- ![Objects](..\Presentations\EVENT\Dia14.JPG) -- ![Objects](..\Presentations\EVENT\Dia14.JPG)
-- --
-- **IMPORTANT NOTE:** Some events can involve not just UNIT objects, but also STATIC objects!!!
-- In that case the initiator or target unit fields will refer to a STATIC object!
-- In case a STATIC object is involved, the documentation indicates which fields will and won't not be populated.
-- The fields **IniCategory** and **TgtCategory** contain the indicator which **kind of object is involved** in the event.
-- You can use the enumerator **Object.Category.UNIT** and **Object.Category.STATIC** to check on IniCategory and TgtCategory.
-- Example code snippet:
--
-- if Event.IniCategory == Object.Category.UNIT then
-- ...
-- end
-- if Event.IniCategory == Object.Category.STATIC then
-- ...
-- end
--
-- When a static object is involved in the event, the Group and Player fields won't be populated.
--
-- ==== -- ====
-- --
-- # **API CHANGE HISTORY** -- # **API CHANGE HISTORY**
@ -4173,7 +4189,8 @@ end
-- --
-- @module Event -- @module Event
-- TODO: Need to update the EVENTDATA documentation with IniPlayerName and TgtPlayerName
-- TODO: Need to update the EVENTDATA documentation with IniCategory and TgtCategory
@ -4216,23 +4233,39 @@ EVENTS = {
} }
--- The Event structure --- The Event structure
-- Note that at the beginning of each field description, there is an indication which field will be populated depending on the object type involved in the Event:
--
-- * A (Object.Category.)UNIT : A UNIT object type is involved in the Event.
-- * A (Object.Category.)STATIC : A STATIC object type is involved in the Event.µ
--
-- @type EVENTDATA -- @type EVENTDATA
-- @field id -- @field #number id The identifier of the event.
-- @field initiator --
-- @field target -- @field Dcs.DCSUnit#Unit initiator (UNIT/STATIC) The initiating @{Dcs.DCSUnit#Unit} or @{Dcs.DCSStaticObject#StaticObject}.
-- @field weapon -- @field Dcs.DCSObject#Object.Category IniCategory (UNIT/STATIC) The initiator object category ( Object.Category.UNIT or Object.Category.STATIC ).
-- @field IniDCSUnit -- @field Dcs.DCSUnit#Unit IniDCSUnit (UNIT/STATIC) The initiating @{Dcs.DCSUnit#Unit} or @{Dcs.DCSStaticObject#StaticObject}.
-- @field IniDCSUnitName -- @field #string IniDCSUnitName (UNIT/STATIC) The initiating Unit name.
-- @field Wrapper.Unit#UNIT IniUnit -- @field Wrapper.Unit#UNIT IniUnit (UNIT/STATIC) The initiating MOOSE wrapper @{Wrapper.Unit#UNIT} of the initiator Unit object.
-- @field #string IniUnitName -- @field #string IniUnitName (UNIT/STATIC) The initiating UNIT name (same as IniDCSUnitName).
-- @field IniDCSGroup -- @field Dcs.DCSGroup#Group IniDCSGroup (UNIT) The initiating {Dcs.DCSGroup#Group}.
-- @field IniDCSGroupName -- @field #string IniDCSGroupName (UNIT) The initiating Group name.
-- @field TgtDCSUnit -- @field Wrapper.Group#GROUP IniGroup (UNIT) The initiating MOOSE wrapper @{Wrapper.Group#GROUP} of the initiator Group object.
-- @field TgtDCSUnitName -- @field #string IniGroupName (UNIT) The initiating GROUP name (same as IniDCSGroupName).
-- @field Wrapper.Unit#UNIT TgtUnit -- @field #string IniPlayerName (UNIT) The name of the initiating player in case the Unit is a client or player slot.
-- @field #string TgtUnitName --
-- @field TgtDCSGroup -- @field Dcs.DCSUnit#Unit target (UNIT/STATIC) The target @{Dcs.DCSUnit#Unit} or @{Dcs.DCSStaticObject#StaticObject}.
-- @field TgtDCSGroupName -- @field Dcs.DCSObject#Object.Category TgtCategory (UNIT/STATIC) The target object category ( Object.Category.UNIT or Object.Category.STATIC ).
-- @field Dcs.DCSUnit#Unit TgtDCSUnit (UNIT/STATIC) The target @{Dcs.DCSUnit#Unit} or @{Dcs.DCSStaticObject#StaticObject}.
-- @field #string TgtDCSUnitName (UNIT/STATIC) The target Unit name.
-- @field Wrapper.Unit#UNIT TgtUnit (UNIT/STATIC) The target MOOSE wrapper @{Wrapper.Unit#UNIT} of the target Unit object.
-- @field #string TgtUnitName (UNIT/STATIC) The target UNIT name (same as TgtDCSUnitName).
-- @field Dcs.DCSGroup#Group TgtDCSGroup (UNIT) The target {Dcs.DCSGroup#Group}.
-- @field #string TgtDCSGroupName (UNIT) The target Group name.
-- @field Wrapper.Group#GROUP TgtGroup (UNIT) The target MOOSE wrapper @{Wrapper.Group#GROUP} of the target Group object.
-- @field #string TgtGroupName (UNIT) The target GROUP name (same as TgtDCSGroupName).
-- @field #string TgtPlayerName (UNIT) The name of the target player in case the Unit is a client or player slot.
--
-- @field weapon The weapon used during the event.
-- @field Weapon -- @field Weapon
-- @field WeaponName -- @field WeaponName
-- @field WeaponTgtDCSUnit -- @field WeaponTgtDCSUnit
@ -5035,11 +5068,15 @@ function EVENT:onEvent( Event )
end end
if self and self.Events and self.Events[Event.id] then if self and self.Events and self.Events[Event.id] then
if Event.initiator and Event.initiator:getCategory() == Object.Category.UNIT then
if Event.initiator then
Event.IniCategory = Event.initiator:getCategory()
if Event.IniCategory == Object.Category.UNIT then
Event.IniDCSUnit = Event.initiator Event.IniDCSUnit = Event.initiator
Event.IniDCSGroup = Event.IniDCSUnit:getGroup()
Event.IniDCSUnitName = Event.IniDCSUnit:getName() Event.IniDCSUnitName = Event.IniDCSUnit:getName()
Event.IniUnitName = Event.IniDCSUnitName Event.IniUnitName = Event.IniDCSUnitName
Event.IniDCSGroup = Event.IniDCSUnit:getGroup()
Event.IniUnit = UNIT:FindByName( Event.IniDCSUnitName ) Event.IniUnit = UNIT:FindByName( Event.IniDCSUnitName )
if not Event.IniUnit then if not Event.IniUnit then
-- Unit can be a CLIENT. Most likely this will be the case ... -- Unit can be a CLIENT. Most likely this will be the case ...
@ -5051,9 +5088,20 @@ function EVENT:onEvent( Event )
Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName ) Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
self:E( { IniGroup = Event.IniGroup } ) self:E( { IniGroup = Event.IniGroup } )
end end
Event.IniPlayerName = Event.IniDCSUnit:getPlayerName()
end end
if Event.IniCategory == Object.Category.STATIC then
Event.IniDCSUnit = Event.initiator
Event.IniDCSUnitName = Event.IniDCSUnit:getName()
Event.IniUnitName = Event.IniDCSUnitName
Event.IniUnit = STATIC:FindByName( Event.IniDCSUnitName )
end
end
if Event.target then if Event.target then
if Event.target and Event.target:getCategory() == Object.Category.UNIT then Event.TgtCategory = Event.target:getCategory()
if Event.TgtCategory == Object.Category.UNIT then
Event.TgtDCSUnit = Event.target Event.TgtDCSUnit = Event.target
Event.TgtDCSGroup = Event.TgtDCSUnit:getGroup() Event.TgtDCSGroup = Event.TgtDCSUnit:getGroup()
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName() Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
@ -5063,8 +5111,19 @@ function EVENT:onEvent( Event )
if Event.TgtDCSGroup and Event.TgtDCSGroup:isExist() then if Event.TgtDCSGroup and Event.TgtDCSGroup:isExist() then
Event.TgtDCSGroupName = Event.TgtDCSGroup:getName() Event.TgtDCSGroupName = Event.TgtDCSGroup:getName()
end end
Event.TgtPlayerName = Event.TgtDCSUnit:getPlayerName()
end
if Event.TgtCategory == Object.Category.STATIC then
Event.TgtDCSUnit = Event.target
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
Event.TgtUnitName = Event.TgtDCSUnitName
Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName )
end end
end end
if Event.weapon then if Event.weapon then
Event.Weapon = Event.weapon Event.Weapon = Event.weapon
Event.WeaponName = Event.Weapon:getTypeName() Event.WeaponName = Event.Weapon:getTypeName()
@ -15359,7 +15418,7 @@ function GROUP:IsAlive()
local DCSGroup = self:GetDCSObject() local DCSGroup = self:GetDCSObject()
if DCSGroup then if DCSGroup then
local GroupIsAlive = DCSGroup:isExist() local GroupIsAlive = DCSGroup:isExist() and DCSGroup:getUnit(1) ~= nil
self:T3( GroupIsAlive ) self:T3( GroupIsAlive )
return GroupIsAlive return GroupIsAlive
end end
@ -17726,7 +17785,7 @@ function SCORING:_EventOnDeadOrCrash( Event )
TargetUnitName = Event.IniDCSUnitName TargetUnitName = Event.IniDCSUnitName
TargetGroup = Event.IniDCSGroup TargetGroup = Event.IniDCSGroup
TargetGroupName = Event.IniDCSGroupName TargetGroupName = Event.IniDCSGroupName
TargetPlayerName = TargetUnit:getPlayerName() TargetPlayerName = Event.IniPlayerName
TargetCoalition = TargetUnit:getCoalition() TargetCoalition = TargetUnit:getCoalition()
--TargetCategory = TargetUnit:getCategory() --TargetCategory = TargetUnit:getCategory()
@ -17973,7 +18032,7 @@ function SCORING:_EventOnHit( Event )
InitUnitName = Event.IniDCSUnitName InitUnitName = Event.IniDCSUnitName
InitGroup = Event.IniDCSGroup InitGroup = Event.IniDCSGroup
InitGroupName = Event.IniDCSGroupName InitGroupName = Event.IniDCSGroupName
InitPlayerName = InitUnit:getPlayerName() InitPlayerName = Event.IniPlayerName
InitCoalition = InitUnit:getCoalition() InitCoalition = InitUnit:getCoalition()
--TODO: Workaround Client DCS Bug --TODO: Workaround Client DCS Bug
@ -17995,7 +18054,7 @@ function SCORING:_EventOnHit( Event )
TargetUnitName = Event.TgtDCSUnitName TargetUnitName = Event.TgtDCSUnitName
TargetGroup = Event.TgtDCSGroup TargetGroup = Event.TgtDCSGroup
TargetGroupName = Event.TgtDCSGroupName TargetGroupName = Event.TgtDCSGroupName
TargetPlayerName = TargetUnit:getPlayerName() TargetPlayerName = Event.TgtPlayerName
TargetCoalition = TargetUnit:getCoalition() TargetCoalition = TargetUnit:getCoalition()
--TODO: Workaround Client DCS Bug --TODO: Workaround Client DCS Bug
@ -26119,8 +26178,8 @@ AI_CAS_ZONE = {
-- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol. -- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
-- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h. -- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h.
-- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h. -- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h.
-- @param Core.Zone#ZONE_BASE EngageZone The zone where the engage will happen.
-- @param Dcs.DCSTypes#AltitudeType PatrolAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO -- @param Dcs.DCSTypes#AltitudeType PatrolAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO
-- @param Core.Zone#ZONE EngageZone
-- @return #AI_CAS_ZONE self -- @return #AI_CAS_ZONE self
function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageZone, PatrolAltType ) function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageZone, PatrolAltType )

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' ) env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20170221_1153' ) env.info( 'Moose Generation Timestamp: 20170224_1222' )
local base = _G local base = _G
Include = {} Include = {}
@ -4059,7 +4059,7 @@ end
-- --
-- ![Objects](..\Presentations\EVENT\Dia6.JPG) -- ![Objects](..\Presentations\EVENT\Dia6.JPG)
-- --
-- For most DCS events, the above order of updating will be followed.1 -- For most DCS events, the above order of updating will be followed.
-- --
-- ![Objects](..\Presentations\EVENT\Dia7.JPG) -- ![Objects](..\Presentations\EVENT\Dia7.JPG)
-- --
@ -4145,6 +4145,22 @@ end
-- --
-- ![Objects](..\Presentations\EVENT\Dia14.JPG) -- ![Objects](..\Presentations\EVENT\Dia14.JPG)
-- --
-- **IMPORTANT NOTE:** Some events can involve not just UNIT objects, but also STATIC objects!!!
-- In that case the initiator or target unit fields will refer to a STATIC object!
-- In case a STATIC object is involved, the documentation indicates which fields will and won't not be populated.
-- The fields **IniCategory** and **TgtCategory** contain the indicator which **kind of object is involved** in the event.
-- You can use the enumerator **Object.Category.UNIT** and **Object.Category.STATIC** to check on IniCategory and TgtCategory.
-- Example code snippet:
--
-- if Event.IniCategory == Object.Category.UNIT then
-- ...
-- end
-- if Event.IniCategory == Object.Category.STATIC then
-- ...
-- end
--
-- When a static object is involved in the event, the Group and Player fields won't be populated.
--
-- ==== -- ====
-- --
-- # **API CHANGE HISTORY** -- # **API CHANGE HISTORY**
@ -4173,7 +4189,8 @@ end
-- --
-- @module Event -- @module Event
-- TODO: Need to update the EVENTDATA documentation with IniPlayerName and TgtPlayerName
-- TODO: Need to update the EVENTDATA documentation with IniCategory and TgtCategory
@ -4216,23 +4233,39 @@ EVENTS = {
} }
--- The Event structure --- The Event structure
-- Note that at the beginning of each field description, there is an indication which field will be populated depending on the object type involved in the Event:
--
-- * A (Object.Category.)UNIT : A UNIT object type is involved in the Event.
-- * A (Object.Category.)STATIC : A STATIC object type is involved in the Event.µ
--
-- @type EVENTDATA -- @type EVENTDATA
-- @field id -- @field #number id The identifier of the event.
-- @field initiator --
-- @field target -- @field Dcs.DCSUnit#Unit initiator (UNIT/STATIC) The initiating @{Dcs.DCSUnit#Unit} or @{Dcs.DCSStaticObject#StaticObject}.
-- @field weapon -- @field Dcs.DCSObject#Object.Category IniCategory (UNIT/STATIC) The initiator object category ( Object.Category.UNIT or Object.Category.STATIC ).
-- @field IniDCSUnit -- @field Dcs.DCSUnit#Unit IniDCSUnit (UNIT/STATIC) The initiating @{Dcs.DCSUnit#Unit} or @{Dcs.DCSStaticObject#StaticObject}.
-- @field IniDCSUnitName -- @field #string IniDCSUnitName (UNIT/STATIC) The initiating Unit name.
-- @field Wrapper.Unit#UNIT IniUnit -- @field Wrapper.Unit#UNIT IniUnit (UNIT/STATIC) The initiating MOOSE wrapper @{Wrapper.Unit#UNIT} of the initiator Unit object.
-- @field #string IniUnitName -- @field #string IniUnitName (UNIT/STATIC) The initiating UNIT name (same as IniDCSUnitName).
-- @field IniDCSGroup -- @field Dcs.DCSGroup#Group IniDCSGroup (UNIT) The initiating {Dcs.DCSGroup#Group}.
-- @field IniDCSGroupName -- @field #string IniDCSGroupName (UNIT) The initiating Group name.
-- @field TgtDCSUnit -- @field Wrapper.Group#GROUP IniGroup (UNIT) The initiating MOOSE wrapper @{Wrapper.Group#GROUP} of the initiator Group object.
-- @field TgtDCSUnitName -- @field #string IniGroupName (UNIT) The initiating GROUP name (same as IniDCSGroupName).
-- @field Wrapper.Unit#UNIT TgtUnit -- @field #string IniPlayerName (UNIT) The name of the initiating player in case the Unit is a client or player slot.
-- @field #string TgtUnitName --
-- @field TgtDCSGroup -- @field Dcs.DCSUnit#Unit target (UNIT/STATIC) The target @{Dcs.DCSUnit#Unit} or @{Dcs.DCSStaticObject#StaticObject}.
-- @field TgtDCSGroupName -- @field Dcs.DCSObject#Object.Category TgtCategory (UNIT/STATIC) The target object category ( Object.Category.UNIT or Object.Category.STATIC ).
-- @field Dcs.DCSUnit#Unit TgtDCSUnit (UNIT/STATIC) The target @{Dcs.DCSUnit#Unit} or @{Dcs.DCSStaticObject#StaticObject}.
-- @field #string TgtDCSUnitName (UNIT/STATIC) The target Unit name.
-- @field Wrapper.Unit#UNIT TgtUnit (UNIT/STATIC) The target MOOSE wrapper @{Wrapper.Unit#UNIT} of the target Unit object.
-- @field #string TgtUnitName (UNIT/STATIC) The target UNIT name (same as TgtDCSUnitName).
-- @field Dcs.DCSGroup#Group TgtDCSGroup (UNIT) The target {Dcs.DCSGroup#Group}.
-- @field #string TgtDCSGroupName (UNIT) The target Group name.
-- @field Wrapper.Group#GROUP TgtGroup (UNIT) The target MOOSE wrapper @{Wrapper.Group#GROUP} of the target Group object.
-- @field #string TgtGroupName (UNIT) The target GROUP name (same as TgtDCSGroupName).
-- @field #string TgtPlayerName (UNIT) The name of the target player in case the Unit is a client or player slot.
--
-- @field weapon The weapon used during the event.
-- @field Weapon -- @field Weapon
-- @field WeaponName -- @field WeaponName
-- @field WeaponTgtDCSUnit -- @field WeaponTgtDCSUnit
@ -5035,11 +5068,15 @@ function EVENT:onEvent( Event )
end end
if self and self.Events and self.Events[Event.id] then if self and self.Events and self.Events[Event.id] then
if Event.initiator and Event.initiator:getCategory() == Object.Category.UNIT then
if Event.initiator then
Event.IniCategory = Event.initiator:getCategory()
if Event.IniCategory == Object.Category.UNIT then
Event.IniDCSUnit = Event.initiator Event.IniDCSUnit = Event.initiator
Event.IniDCSGroup = Event.IniDCSUnit:getGroup()
Event.IniDCSUnitName = Event.IniDCSUnit:getName() Event.IniDCSUnitName = Event.IniDCSUnit:getName()
Event.IniUnitName = Event.IniDCSUnitName Event.IniUnitName = Event.IniDCSUnitName
Event.IniDCSGroup = Event.IniDCSUnit:getGroup()
Event.IniUnit = UNIT:FindByName( Event.IniDCSUnitName ) Event.IniUnit = UNIT:FindByName( Event.IniDCSUnitName )
if not Event.IniUnit then if not Event.IniUnit then
-- Unit can be a CLIENT. Most likely this will be the case ... -- Unit can be a CLIENT. Most likely this will be the case ...
@ -5051,9 +5088,20 @@ function EVENT:onEvent( Event )
Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName ) Event.IniGroup = GROUP:FindByName( Event.IniDCSGroupName )
self:E( { IniGroup = Event.IniGroup } ) self:E( { IniGroup = Event.IniGroup } )
end end
Event.IniPlayerName = Event.IniDCSUnit:getPlayerName()
end end
if Event.IniCategory == Object.Category.STATIC then
Event.IniDCSUnit = Event.initiator
Event.IniDCSUnitName = Event.IniDCSUnit:getName()
Event.IniUnitName = Event.IniDCSUnitName
Event.IniUnit = STATIC:FindByName( Event.IniDCSUnitName )
end
end
if Event.target then if Event.target then
if Event.target and Event.target:getCategory() == Object.Category.UNIT then Event.TgtCategory = Event.target:getCategory()
if Event.TgtCategory == Object.Category.UNIT then
Event.TgtDCSUnit = Event.target Event.TgtDCSUnit = Event.target
Event.TgtDCSGroup = Event.TgtDCSUnit:getGroup() Event.TgtDCSGroup = Event.TgtDCSUnit:getGroup()
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName() Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
@ -5063,8 +5111,19 @@ function EVENT:onEvent( Event )
if Event.TgtDCSGroup and Event.TgtDCSGroup:isExist() then if Event.TgtDCSGroup and Event.TgtDCSGroup:isExist() then
Event.TgtDCSGroupName = Event.TgtDCSGroup:getName() Event.TgtDCSGroupName = Event.TgtDCSGroup:getName()
end end
Event.TgtPlayerName = Event.TgtDCSUnit:getPlayerName()
end
if Event.TgtCategory == Object.Category.STATIC then
Event.TgtDCSUnit = Event.target
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
Event.TgtUnitName = Event.TgtDCSUnitName
Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName )
end end
end end
if Event.weapon then if Event.weapon then
Event.Weapon = Event.weapon Event.Weapon = Event.weapon
Event.WeaponName = Event.Weapon:getTypeName() Event.WeaponName = Event.Weapon:getTypeName()
@ -15359,7 +15418,7 @@ function GROUP:IsAlive()
local DCSGroup = self:GetDCSObject() local DCSGroup = self:GetDCSObject()
if DCSGroup then if DCSGroup then
local GroupIsAlive = DCSGroup:isExist() local GroupIsAlive = DCSGroup:isExist() and DCSGroup:getUnit(1) ~= nil
self:T3( GroupIsAlive ) self:T3( GroupIsAlive )
return GroupIsAlive return GroupIsAlive
end end
@ -17726,7 +17785,7 @@ function SCORING:_EventOnDeadOrCrash( Event )
TargetUnitName = Event.IniDCSUnitName TargetUnitName = Event.IniDCSUnitName
TargetGroup = Event.IniDCSGroup TargetGroup = Event.IniDCSGroup
TargetGroupName = Event.IniDCSGroupName TargetGroupName = Event.IniDCSGroupName
TargetPlayerName = TargetUnit:getPlayerName() TargetPlayerName = Event.IniPlayerName
TargetCoalition = TargetUnit:getCoalition() TargetCoalition = TargetUnit:getCoalition()
--TargetCategory = TargetUnit:getCategory() --TargetCategory = TargetUnit:getCategory()
@ -17973,7 +18032,7 @@ function SCORING:_EventOnHit( Event )
InitUnitName = Event.IniDCSUnitName InitUnitName = Event.IniDCSUnitName
InitGroup = Event.IniDCSGroup InitGroup = Event.IniDCSGroup
InitGroupName = Event.IniDCSGroupName InitGroupName = Event.IniDCSGroupName
InitPlayerName = InitUnit:getPlayerName() InitPlayerName = Event.IniPlayerName
InitCoalition = InitUnit:getCoalition() InitCoalition = InitUnit:getCoalition()
--TODO: Workaround Client DCS Bug --TODO: Workaround Client DCS Bug
@ -17995,7 +18054,7 @@ function SCORING:_EventOnHit( Event )
TargetUnitName = Event.TgtDCSUnitName TargetUnitName = Event.TgtDCSUnitName
TargetGroup = Event.TgtDCSGroup TargetGroup = Event.TgtDCSGroup
TargetGroupName = Event.TgtDCSGroupName TargetGroupName = Event.TgtDCSGroupName
TargetPlayerName = TargetUnit:getPlayerName() TargetPlayerName = Event.TgtPlayerName
TargetCoalition = TargetUnit:getCoalition() TargetCoalition = TargetUnit:getCoalition()
--TODO: Workaround Client DCS Bug --TODO: Workaround Client DCS Bug
@ -26119,8 +26178,8 @@ AI_CAS_ZONE = {
-- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol. -- @param Dcs.DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
-- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h. -- @param Dcs.DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Controllable} in km/h.
-- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h. -- @param Dcs.DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Controllable} in km/h.
-- @param Core.Zone#ZONE_BASE EngageZone The zone where the engage will happen.
-- @param Dcs.DCSTypes#AltitudeType PatrolAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO -- @param Dcs.DCSTypes#AltitudeType PatrolAltType The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO
-- @param Core.Zone#ZONE EngageZone
-- @return #AI_CAS_ZONE self -- @return #AI_CAS_ZONE self
function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageZone, PatrolAltType ) function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageZone, PatrolAltType )

View File

@ -0,0 +1,32 @@
---
-- Name: GRP-100 - IsAlive
-- Author: FlightControl
-- Date Created: 23 Feb 2017
--
-- # Situation:
--
-- This test is about checking if IsAlive on GROUP level is working correctly.
-- Two ground forces GROUPS are shooting each other.
-- Check the IsAlive status in the logging of the survivor and the defeat.
--
-- # Test cases:
--
-- 1. Observe the IsAlive statuses in the dcs.log file.
--Create Spawn Groups
local GroupBlue = GROUP:FindByName( "Blue" )
local GroupRed = GROUP:FindByName( "Red" )
local Schedule, ScheduleID = SCHEDULER:New( nil,
--- Variable Declarations
-- @param Wrapper.Group#GROUP GroupBlue
-- @param Wrapper.Group#GROUP GroupRed
function( GroupBlue, GroupRed )
local IsAliveBlue = GroupBlue:IsAlive()
local IsAliveRed = GroupRed:IsAlive()
BASE:E( { IsAliveBlue = IsAliveBlue, IsAliveRed = IsAliveRed } )
end, { GroupBlue, GroupRed }, 1, 1
)

View File

@ -0,0 +1,21 @@
---
-- Name: SCO-100 - Scoring of Statics
-- Author: FlightControl
-- Date Created: 21 Feb 2017
--
-- # Situation:
--
-- A shooting range has been setup. Fly the Ka-50 or the Su-25T to the statics located near the airport, and shoot them.
--
-- # Test cases:
--
-- 1. Observe the scoring granted to your flight when you hit and kill targets.
local HQ = GROUP:FindByName( "HQ", "Bravo HQ" )
local CommandCenter = COMMANDCENTER:New( HQ, "Lima" )
local Scoring = SCORING:New( "Detect Demo" )