Merge branch 'master' into develop

This commit is contained in:
Frank 2023-11-16 22:32:17 +01:00
commit 067285f870
8 changed files with 24 additions and 23 deletions

View File

@ -2023,8 +2023,6 @@ end
TargetPlayerName = Event.IniPlayerName TargetPlayerName = Event.IniPlayerName
TargetCoalition = Event.IniCoalition TargetCoalition = Event.IniCoalition
--TargetCategory = TargetUnit:getCategory()
--TargetCategory = TargetUnit:getDesc().category -- Workaround
TargetCategory = Event.IniCategory TargetCategory = Event.IniCategory
TargetType = Event.IniTypeName TargetType = Event.IniTypeName

View File

@ -1083,7 +1083,7 @@ function EVENT:onEvent( Event )
if Event.initiator then if Event.initiator then
Event.IniObjectCategory = Object.getCategory(Event.initiator) --Event.initiator:getCategory() Event.IniObjectCategory = Object.getCategory(Event.initiator)
if Event.IniObjectCategory == Object.Category.STATIC then if Event.IniObjectCategory == Object.Category.STATIC then
--- ---
@ -1208,7 +1208,7 @@ function EVENT:onEvent( Event )
--- ---
-- Target category. -- Target category.
Event.TgtObjectCategory = Object.getCategory(Event.target) --Event.target:getCategory() Event.TgtObjectCategory = Object.getCategory(Event.target)
if Event.TgtObjectCategory == Object.Category.UNIT then if Event.TgtObjectCategory == Object.Category.UNIT then
--- ---
@ -1302,7 +1302,7 @@ function EVENT:onEvent( Event )
-- However, this is not a big thing, as the aircraft the pilot ejected from is usually long crashed before the ejected pilot touches the ground. -- However, this is not a big thing, as the aircraft the pilot ejected from is usually long crashed before the ejected pilot touches the ground.
--Event.Place=UNIT:Find(Event.place) --Event.Place=UNIT:Find(Event.place)
else else
if Event.place:isExist() and Event.place:getCategory() ~= Object.Category.SCENERY then if Event.place:isExist() and Object.getCategory(Event.place) ~= Object.Category.SCENERY then
Event.Place=AIRBASE:Find(Event.place) Event.Place=AIRBASE:Find(Event.place)
Event.PlaceName=Event.Place:GetName() Event.PlaceName=Event.Place:GetName()
end end

View File

@ -544,7 +544,7 @@ do -- COORDINATE
if ZoneObject then if ZoneObject then
-- Get category of scanned object. -- Get category of scanned object.
local ObjectCategory = ZoneObject:getCategory() local ObjectCategory = Object.getCategory(ZoneObject)
-- Check for unit or static objects -- Check for unit or static objects
if ObjectCategory==Object.Category.UNIT and ZoneObject:isExist() then if ObjectCategory==Object.Category.UNIT and ZoneObject:isExist() then

View File

@ -1093,11 +1093,8 @@ function ZONE_RADIUS:Scan( ObjectCategories, UnitCategories )
--if ZoneObject:isExist() then --FF: isExist always returns false for SCENERY objects since DCS 2.2 and still in DCS 2.5 --if ZoneObject:isExist() then --FF: isExist always returns false for SCENERY objects since DCS 2.2 and still in DCS 2.5
if ZoneObject then if ZoneObject then
local ObjectCategory = ZoneObject:getCategory() -- Get object category.
local ObjectCategory = Object.getCategory(ZoneObject)
--local name=ZoneObject:getName()
--env.info(string.format("Zone object %s", tostring(name)))
--self:E(ZoneObject)
if ( ObjectCategory == Object.Category.UNIT and ZoneObject:isExist() and ZoneObject:isActive() ) or (ObjectCategory == Object.Category.STATIC and ZoneObject:isExist()) then if ( ObjectCategory == Object.Category.UNIT and ZoneObject:isExist() and ZoneObject:isActive() ) or (ObjectCategory == Object.Category.STATIC and ZoneObject:isExist()) then
@ -2801,7 +2798,7 @@ function ZONE_POLYGON:Scan( ObjectCategories, UnitCategories )
if ZoneObject then if ZoneObject then
local ObjectCategory = ZoneObject:getCategory() local ObjectCategory = Object.getCategory(ZoneObject)
if ( ObjectCategory == Object.Category.UNIT and ZoneObject:isExist() and ZoneObject:isActive() ) or (ObjectCategory == Object.Category.STATIC and ZoneObject:isExist()) then if ( ObjectCategory == Object.Category.UNIT and ZoneObject:isExist() and ZoneObject:isActive() ) or (ObjectCategory == Object.Category.STATIC and ZoneObject:isExist()) then

View File

@ -484,7 +484,7 @@ function SEAD:HandleEventShot( EventData )
end end
return self return self
end end
local targetcat = _target:getCategory() -- Identify category local targetcat = Object.getCategory(_target) -- Identify category
local _targetUnit = nil -- Wrapper.Unit#UNIT local _targetUnit = nil -- Wrapper.Unit#UNIT
local _targetgroup = nil -- Wrapper.Group#GROUP local _targetgroup = nil -- Wrapper.Group#GROUP
self:T(string.format("*** Targetcat = %d",targetcat)) self:T(string.format("*** Targetcat = %d",targetcat))

View File

@ -673,7 +673,7 @@ do
return self return self
end end
local targetcat = targetdata:getCategory() -- Identify category local targetcat = Object.getCategory(targetdata) -- Identify category
self:T(string.format("Target Category (3=STATIC, 1=UNIT)= %s",tostring(targetcat))) self:T(string.format("Target Category (3=STATIC, 1=UNIT)= %s",tostring(targetcat)))
self:T({targetdata}) self:T({targetdata})
local targetunit = nil local targetunit = nil

View File

@ -4,7 +4,7 @@
-- --
-- ### Author: **FlightControl** -- ### Author: **FlightControl**
-- --
-- ### Contributions: -- ### Contributions: **funkyfranky
-- --
-- === -- ===
-- --
@ -12,12 +12,13 @@
-- @image MOOSE.JPG -- @image MOOSE.JPG
--- @type OBJECT --- OBJECT class.
-- @type OBJECT
-- @extends Core.Base#BASE -- @extends Core.Base#BASE
-- @field #string ObjectName The name of the Object. -- @field #string ObjectName The name of the Object.
--- Wrapper class to hendle the DCS Object objects. --- Wrapper class to handle the DCS Object objects.
-- --
-- * Support all DCS Object APIs. -- * Support all DCS Object APIs.
-- * Enhance with Object specific APIs not in the DCS Object API set. -- * Enhance with Object specific APIs not in the DCS Object API set.
@ -43,9 +44,15 @@ OBJECT = {
-- @param #OBJECT self -- @param #OBJECT self
-- @param DCS#Object ObjectName The Object name -- @param DCS#Object ObjectName The Object name
-- @return #OBJECT self -- @return #OBJECT self
function OBJECT:New( ObjectName, Test ) function OBJECT:New( ObjectName)
-- Inherit BASE class.
local self = BASE:Inherit( self, BASE:New() ) local self = BASE:Inherit( self, BASE:New() )
-- Debug output.
self:F2( ObjectName ) self:F2( ObjectName )
-- Set object name.
self.ObjectName = ObjectName self.ObjectName = ObjectName
return self return self
@ -64,15 +71,14 @@ function OBJECT:GetID()
return ObjectID return ObjectID
end end
BASE:E( { "Cannot GetID", Name = self.ObjectName, Class = self:GetClassName() } ) self:E( { "Cannot GetID", Name = self.ObjectName, Class = self:GetClassName() } )
return nil return nil
end end
--- Destroys the OBJECT. --- Destroys the OBJECT.
-- @param #OBJECT self -- @param #OBJECT self
-- @return #boolean true if the object is destroyed. -- @return #boolean Returns `true` if the object is destroyed or #nil if the object is nil.
-- @return #nil The DCS Unit is not existing or alive.
function OBJECT:Destroy() function OBJECT:Destroy()
local DCSObject = self:GetDCSObject() local DCSObject = self:GetDCSObject()
@ -83,7 +89,7 @@ function OBJECT:Destroy()
return true return true
end end
BASE:E( { "Cannot Destroy", Name = self.ObjectName, Class = self:GetClassName() } ) self:E( { "Cannot Destroy", Name = self.ObjectName, Class = self:GetClassName() } )
return nil return nil
end end

View File

@ -367,7 +367,7 @@ function WEAPON:GetTarget()
if object then if object then
-- Get object category. -- Get object category.
local category=object:getCategory() local category=Object.getCategory(object)
--Target name --Target name
local name=object:getName() local name=object:getName()