From 4c7239c5ecbde271998cb1584fab8e2500f176e1 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 25 May 2023 08:22:51 +0200 Subject: [PATCH] Bugfixes --- Moose Development/Moose/Ops/RescueHelo.lua | 4 +++- Moose Development/Moose/Utilities/Utils.lua | 17 +++++++++++++++++ .../Moose/Wrapper/Controllable.lua | 12 ++++++++---- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/Moose Development/Moose/Ops/RescueHelo.lua b/Moose Development/Moose/Ops/RescueHelo.lua index 4820b6501..b341c8a14 100644 --- a/Moose Development/Moose/Ops/RescueHelo.lua +++ b/Moose Development/Moose/Ops/RescueHelo.lua @@ -805,7 +805,9 @@ function RESCUEHELO:_OnEventCrashOrEject(EventData) self:T(self.lid..text) -- Get coordinate of unit. - local coord=unit:GetCoordinate() + --local coord=unit:GetCoordinate() + local Vec3 = EventData.IniDCSUnit:getPoint() -- Vec3 + local coord = COORDINATE:NewFromVec3(Vec3) if coord and self.rescuezone:IsCoordinateInZone(coord) then diff --git a/Moose Development/Moose/Utilities/Utils.lua b/Moose Development/Moose/Utilities/Utils.lua index b2daf3229..2e3ff8ff0 100644 --- a/Moose Development/Moose/Utilities/Utils.lua +++ b/Moose Development/Moose/Utilities/Utils.lua @@ -385,6 +385,23 @@ UTILS.BasicSerialize = function(s) end end +function UTILS.PrintTableToLog(table, indent) + if not table then + BASE:E("No table passed!") + return + end + if not indent then indent = 0 end + for k, v in pairs(table) do + if type(v) == "table" then + BASE:I(string.rep(" ", indent) .. tostring(k) .. " = {") + UTILS.PrintTableToLog(v, indent + 1) + BASE:I(string.rep(" ", indent) .. "}") + else + BASE:I(string.rep(" ", indent) .. tostring(k) .. " = " .. tostring(v)) + end + end +end + UTILS.ToDegree = function(angle) return angle*180/math.pi diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index 4234d43b7..c6117c328 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -690,7 +690,8 @@ function CONTROLLABLE:CommandActivateACLS( UnitID, Name, Delay ) if Delay and Delay > 0 then SCHEDULER:New( nil, self.CommandActivateACLS, { self, UnitID, Name }, Delay ) else - self:SetCommand( CommandActivateACLS ) + local controller = self:_GetController() + controller:setCommand( CommandActivateACLS ) end return self @@ -711,7 +712,8 @@ function CONTROLLABLE:CommandDeactivateACLS( Delay ) if Delay and Delay > 0 then SCHEDULER:New( nil, self.CommandDeactivateACLS, { self }, Delay ) else - self:SetCommand( CommandDeactivateACLS ) + local controller = self:_GetController() + controller:setCommand( CommandDeactivateACLS ) end return self @@ -772,7 +774,8 @@ function CONTROLLABLE:CommandActivateLink4(Frequency, UnitID, Callsign, Delay) if Delay and Delay>0 then SCHEDULER:New(nil, self.CommandActivateLink4, {self, Frequency, UnitID, Callsign}, Delay) else - self:SetCommand(CommandActivateLink4) + local controller = self:_GetController() + controller:setCommand(CommandActivateLink4) end return self @@ -810,7 +813,8 @@ function CONTROLLABLE:CommandDeactivateLink4(Delay) if Delay and Delay>0 then SCHEDULER:New(nil, self.CommandDeactivateLink4, {self}, Delay) else - self:SetCommand(CommandDeactivateLink4) + local controller = self:_GetController() + controller:setCommand(CommandDeactivateLink4) end return self