UNIT and POSITIONABLE
- Removed pcall for GetVec3 and GetAmmo

CHIEF
- Deploy resources if zone is empty and owned by itself
This commit is contained in:
Frank 2023-06-15 19:12:26 +02:00
parent eec7e5f8d9
commit bffb3e7778
3 changed files with 27 additions and 24 deletions

View File

@ -2579,7 +2579,9 @@ function CHIEF:CheckOpsZoneQueue()
local zoneName=stratzone.opszone.zone:GetName()
-- Check coalition and importance.
if ownercoalition~=self.coalition and (stratzone.importance==nil or stratzone.importance<=vip) and (not stratzone.opszone:IsStopped()) then
if (ownercoalition~=self.coalition or (ownercoalition==self.coalition and stratzone.opszone:IsEmpty()))
and (stratzone.importance==nil or stratzone.importance<=vip)
and (not stratzone.opszone:IsStopped()) then
-- Debug info.
self:T(self.lid..string.format("Zone %s [%s] is owned by coalition %d", zoneName, stratzone.opszone:GetState(), ownercoalition))

View File

@ -239,18 +239,19 @@ end
function POSITIONABLE:GetVec3()
local DCSPositionable = self:GetDCSObject()
if DCSPositionable then
local status, vec3 = pcall(
function()
local vec3 = DCSPositionable:getPoint()
return vec3
end
)
--local vec3 = DCSPositionable:getPoint()
if status then
return vec3
else
self:E( { "Cannot get Vec3 from DCS Object", Positionable = self, Alive = self:IsAlive() } )
end
-- local status, vec3 = pcall(
-- function()
-- local vec3 = DCSPositionable:getPoint()
-- return vec3
-- end
-- )
local vec3 = DCSPositionable:getPoint()
return vec3
-- if status then
-- return vec3
-- else
-- self:E( { "Cannot get Vec3 from DCS Object", Positionable = self, Alive = self:IsAlive() } )
-- end
end
-- ERROR!
self:E( { "Cannot get the Positionable DCS Object for GetVec3", Positionable = self, Alive = self:IsAlive() } )

View File

@ -703,17 +703,17 @@ function UNIT:GetAmmo()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSObject()
if DCSUnit then
local status, unitammo = pcall(
function()
local UnitAmmo = DCSUnit:getAmmo()
return UnitAmmo
end
)
if status then
return unitammo
end
--local UnitAmmo = DCSUnit:getAmmo()
--return UnitAmmo
-- local status, unitammo = pcall(
-- function()
-- local UnitAmmo = DCSUnit:getAmmo()
-- return UnitAmmo
-- end
-- )
-- if status then
-- return unitammo
-- end
local UnitAmmo = DCSUnit:getAmmo()
return UnitAmmo
end
return nil
end