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
TargetCoalition = Event.IniCoalition
--TargetCategory = TargetUnit:getCategory()
--TargetCategory = TargetUnit:getDesc().category -- Workaround
TargetCategory = Event.IniCategory
TargetType = Event.IniTypeName

View File

@ -1083,7 +1083,7 @@ function EVENT:onEvent( Event )
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
---
@ -1208,7 +1208,7 @@ function EVENT:onEvent( Event )
---
-- Target category.
Event.TgtObjectCategory = Object.getCategory(Event.target) --Event.target:getCategory()
Event.TgtObjectCategory = Object.getCategory(Event.target)
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.
--Event.Place=UNIT:Find(Event.place)
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.PlaceName=Event.Place:GetName()
end

View File

@ -544,7 +544,7 @@ do -- COORDINATE
if ZoneObject then
-- Get category of scanned object.
local ObjectCategory = ZoneObject:getCategory()
local ObjectCategory = Object.getCategory(ZoneObject)
-- Check for unit or static objects
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 then
local ObjectCategory = ZoneObject:getCategory()
--local name=ZoneObject:getName()
--env.info(string.format("Zone object %s", tostring(name)))
--self:E(ZoneObject)
-- Get object category.
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
@ -2801,7 +2798,7 @@ function ZONE_POLYGON:Scan( ObjectCategories, UnitCategories )
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

View File

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

View File

@ -673,7 +673,7 @@ do
return self
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({targetdata})
local targetunit = nil

View File

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

View File

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