From 253ed62d467208665f7a896754012fd50e38533d Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Tue, 13 Jun 2023 08:35:27 +0200 Subject: [PATCH] Fixes --- Moose Development/Moose/Core/Set.lua | 2 +- Moose Development/Moose/Wrapper/Airbase.lua | 2 +- .../Moose/Wrapper/Positionable.lua | 19 ++++++++++--------- Moose Development/Moose/Wrapper/Unit.lua | 19 +++++++++++++------ 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/Moose Development/Moose/Core/Set.lua b/Moose Development/Moose/Core/Set.lua index a2363beac..1d06739f9 100644 --- a/Moose Development/Moose/Core/Set.lua +++ b/Moose Development/Moose/Core/Set.lua @@ -3040,7 +3040,7 @@ do -- SET_UNIT -- @param Wrapper.Unit#UNIT MUnit -- @return #SET_UNIT self function SET_UNIT:IsIncludeObject( MUnit ) - self:F2( MUnit ) + self:F2( {MUnit} ) local MUnitInclude = false diff --git a/Moose Development/Moose/Wrapper/Airbase.lua b/Moose Development/Moose/Wrapper/Airbase.lua index 4aeb5b21b..64a23f3cd 100644 --- a/Moose Development/Moose/Wrapper/Airbase.lua +++ b/Moose Development/Moose/Wrapper/Airbase.lua @@ -679,7 +679,7 @@ AIRBASE.Sinai = { ["Tel_Nof"] = "Tel Nof", ["Abu_Rudeis"] = "Abu Rudeis", ["Inshas_Airbase"] = "Inshas Airbase", - ["Ben-Gurion"] = "Ben-Gurion", + ["Ben_Gurion"] = "Ben-Gurion", ["Bir_Hasanah"] = "Bir Hasanah", ["Cairo_West"] = "Cairo West", } diff --git a/Moose Development/Moose/Wrapper/Positionable.lua b/Moose Development/Moose/Wrapper/Positionable.lua index 5016aac7f..a935282f7 100644 --- a/Moose Development/Moose/Wrapper/Positionable.lua +++ b/Moose Development/Moose/Wrapper/Positionable.lua @@ -237,22 +237,23 @@ end -- @return DCS#Vec3 The 3D point vector of the POSITIONABLE. -- @return #nil The POSITIONABLE is not existing or alive. function POSITIONABLE:GetVec3() - local DCSPositionable = self:GetDCSObject() - if DCSPositionable then - - local vec3 = DCSPositionable:getPoint() - - if vec3 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( "ERROR: Cannot get vec3!" ) + self:E( { "Cannot get Vec3 from DCS Object", Positionable = self, Alive = self:IsAlive() } ) end end - -- ERROR! - self:E( { "Cannot GetVec3", Positionable = self, Alive = self:IsAlive() } ) + self:E( { "Cannot get the Positionable DCS Object for GetVec3", Positionable = self, Alive = self:IsAlive() } ) return nil end diff --git a/Moose Development/Moose/Wrapper/Unit.lua b/Moose Development/Moose/Wrapper/Unit.lua index e716269a2..1ffcf5fe3 100644 --- a/Moose Development/Moose/Wrapper/Unit.lua +++ b/Moose Development/Moose/Wrapper/Unit.lua @@ -681,20 +681,27 @@ end --- Returns the Unit's ammunition. -- @param #UNIT self --- @return DCS#Unit.Ammo Table with ammuntion of the unit (or nil). This can be a complex table! +-- @return DCS#Unit.Ammo Table with ammuntion of the unit (or nil). This can be a complex table! function UNIT:GetAmmo() self:F2( self.UnitName ) - local DCSUnit = self:GetDCSObject() - if DCSUnit then - 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 + --- Sets the Unit's Internal Cargo Mass, in kg -- @param #UNIT self -- @param #number mass to set cargo to