From 7dda54f36d6007491c4787d94bfb2fc64a8df710 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Sat, 25 Jun 2022 14:28:04 +0200 Subject: [PATCH 1/3] UTILS - Fix for Gazelle Door Check --- Moose Development/Moose/Utilities/Utils.lua | 53 ++++++++++----------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/Moose Development/Moose/Utilities/Utils.lua b/Moose Development/Moose/Utilities/Utils.lua index 77f4d536e..d9308e8b5 100644 --- a/Moose Development/Moose/Utilities/Utils.lua +++ b/Moose Development/Moose/Utilities/Utils.lua @@ -1782,71 +1782,68 @@ end --@return #boolean Outcome - true if a (loading door) is open, false if not, nil if none exists. function UTILS.IsLoadingDoorOpen( unit_name ) - local ret_val = false local unit = Unit.getByName(unit_name) + if unit ~= nil then local type_name = unit:getTypeName() + BASE:T("TypeName = ".. type_name) - if type_name == "Mi-8MT" and unit:getDrawArgumentValue(38) == 1 or unit:getDrawArgumentValue(86) == 1 or unit:getDrawArgumentValue(250) < 0 then + if type_name == "Mi-8MT" and (unit:getDrawArgumentValue(38) == 1 or unit:getDrawArgumentValue(86) == 1 or unit:getDrawArgumentValue(250) < 0) then BASE:T(unit_name .. " Cargo doors are open or cargo door not present") - ret_val = true + return true end - if type_name == "Mi-24P" and unit:getDrawArgumentValue(38) == 1 or unit:getDrawArgumentValue(86) == 1 then + if type_name == "Mi-24P" and (unit:getDrawArgumentValue(38) == 1 or unit:getDrawArgumentValue(86) == 1) then BASE:T(unit_name .. " a side door is open") - ret_val = true + return true end - if type_name == "UH-1H" and unit:getDrawArgumentValue(43) == 1 or unit:getDrawArgumentValue(44) == 1 then + if type_name == "UH-1H" and (unit:getDrawArgumentValue(43) == 1 or unit:getDrawArgumentValue(44) == 1) then BASE:T(unit_name .. " a side door is open ") - ret_val = true + return true + end + + if string.find(type_name, "SA342" ) and (unit:getDrawArgumentValue(34) == 1) then + BASE:T(unit_name .. " front door(s) are open or doors removed") + return true end - if string.find(type_name, "SA342" ) and unit:getDrawArgumentValue(34) == 1 or unit:getDrawArgumentValue(38) == 1 then - BASE:T(unit_name .. " front door(s) are open") - ret_val = true - end - - if string.find(type_name, "Hercules") and unit:getDrawArgumentValue(1215) == 1 and unit:getDrawArgumentValue(1216) == 1 then + if string.find(type_name, "Hercules") and (unit:getDrawArgumentValue(1215) == 1 and unit:getDrawArgumentValue(1216) == 1) then BASE:T(unit_name .. " rear doors are open") - ret_val = true + return true end if string.find(type_name, "Hercules") and (unit:getDrawArgumentValue(1220) == 1 or unit:getDrawArgumentValue(1221) == 1) then BASE:T(unit_name .. " para doors are open") - ret_val = true + return true end - if string.find(type_name, "Hercules") and unit:getDrawArgumentValue(1217) == 1 then + if string.find(type_name, "Hercules") and (unit:getDrawArgumentValue(1217) == 1) then BASE:T(unit_name .. " side door is open") - ret_val = true + return true end if string.find(type_name, "Bell-47") then -- bell aint got no doors so always ready to load injured soldiers BASE:T(unit_name .. " door is open") - ret_val = true + return true end - if string.find(type_name, "UH-60L") and (unit:getDrawArgumentValue(401) == 1) or (unit:getDrawArgumentValue(402) == 1) then + if string.find(type_name, "UH-60L") and (unit:getDrawArgumentValue(401) == 1 or unit:getDrawArgumentValue(402) == 1) then BASE:T(unit_name .. " cargo door is open") - ret_val = true + return true end - if string.find(type_name, "UH-60L" ) and unit:getDrawArgumentValue(38) == 1 or unit:getDrawArgumentValue(400) == 1 then + if string.find(type_name, "UH-60L" ) and (unit:getDrawArgumentValue(38) == 1 or unit:getDrawArgumentValue(400) == 1 ) then BASE:T(unit_name .. " front door(s) are open") - ret_val = true + return true end if type_name == "AH-64D_BLK_II" then BASE:T(unit_name .. " front door(s) are open") - ret_val = true -- no doors on this one ;) + return true -- no doors on this one ;) end - if ret_val == false then - BASE:T(unit_name .. " all doors are closed") - end - - return ret_val + return false end -- nil From ad5a0a5cd93367334b4958bd911818f7b46b7e21 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Sat, 25 Jun 2022 17:24:37 +0200 Subject: [PATCH 2/3] CSAR - hand back descriptive name as 3rd parameter on event Boarded() --- Moose Development/Moose/Ops/CSAR.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Ops/CSAR.lua b/Moose Development/Moose/Ops/CSAR.lua index 76281a3f1..06cd10ae0 100644 --- a/Moose Development/Moose/Ops/CSAR.lua +++ b/Moose Development/Moose/Ops/CSAR.lua @@ -165,7 +165,7 @@ -- -- The pilot has been boarded to the helicopter. Use e.g. `function my_csar:OnAfterBoarded(...)` to link into this event: -- --- function my_csar:OnAfterBoarded(from, event, to, heliname, groupname) +-- function my_csar:OnAfterBoarded(from, event, to, heliname, groupname, description) -- ... your code here ... -- end -- @@ -492,6 +492,7 @@ function CSAR:New(Coalition, Template, Alias) -- @param #string To To state. -- @param #string Heliname Name of the helicopter group. -- @param #string Woundedgroupname Name of the downed pilot\'s group. + -- @param #string Description Descriptive name of the group. --- On After "Returning" event. Heli can return home with downed pilot(s). -- @function [parent=#CSAR] OnAfterReturning @@ -1317,7 +1318,7 @@ function CSAR:_PickupUnit(_heliUnit, _pilotName, _woundedGroup, _woundedGroupNam self:_DisplayMessageToSAR(_heliUnit, string.format("%s: %s I\'m in! Get to the MASH ASAP! ", _heliName, _pilotName), self.messageTime,true,true) - self:__Boarded(5,_heliName,_woundedGroupName) + self:__Boarded(5,_heliName,_woundedGroupName,grouptable.desc) return self end From 6cfa24340f8d8b121c49cf672945155a78836fdf Mon Sep 17 00:00:00 2001 From: Frank Date: Fri, 1 Jul 2022 23:10:10 +0200 Subject: [PATCH 3/3] Update Range.lua - Fixed bug in strafing runs --- Moose Development/Moose/Functional/Range.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Functional/Range.lua b/Moose Development/Moose/Functional/Range.lua index 6b4a3bc14..e7aa20889 100644 --- a/Moose Development/Moose/Functional/Range.lua +++ b/Moose Development/Moose/Functional/Range.lua @@ -3018,7 +3018,7 @@ function RANGE:_CheckInZone( _unitName ) if shots and accur then _text = _text .. string.format( "\nTotal rounds fired %d. Accuracy %.1f %%.", shots, accur ) end - _text = _text .. string.format( "\n%s", _result.text ) + _text = _text .. string.format( "\n%s", resulttext ) -- Send message. self:_DisplayMessageToGroup( _unit, _text )