From 668d120d60f9cc65413647ff30a6d639fca16f52 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Mon, 26 Aug 2024 18:22:32 +0200 Subject: [PATCH 1/2] CTLD Small fix for crate removal --- Moose Development/Moose/Ops/CTLD.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Ops/CTLD.lua b/Moose Development/Moose/Ops/CTLD.lua index d1332db63..5cfbe085a 100644 --- a/Moose Development/Moose/Ops/CTLD.lua +++ b/Moose Development/Moose/Ops/CTLD.lua @@ -2945,11 +2945,12 @@ end -- @param Wrapper.Unit#UNIT _unit Unit -- @param #number _dist Distance -- @param #boolean _ignoreweight Find everything in range, ignore loadable weight +-- @param #boolean ignoretype Find everything in range, ignore loadable type name -- @return #table Crates Table of crates -- @return #number Number Number of crates found -- @return #table CratesGC Table of crates possibly loaded by GC -- @return #number NumberGC Number of crates possibly loaded by GC -function CTLD:_FindCratesNearby( _group, _unit, _dist, _ignoreweight) +function CTLD:_FindCratesNearby( _group, _unit, _dist, _ignoreweight, ignoretype) self:T(self.lid .. " _FindCratesNearby") local finddist = _dist local location = _group:GetCoordinate() @@ -2962,7 +2963,7 @@ function CTLD:_FindCratesNearby( _group, _unit, _dist, _ignoreweight) local loadedmass = 0 local unittype = "none" local capabilities = {} - local maxmass = 2000 + --local maxmass = 2000 local maxloadable = 2000 local IsHook = self:IsHook(_unit) if not _ignoreweight then @@ -2984,6 +2985,7 @@ function CTLD:_FindCratesNearby( _group, _unit, _dist, _ignoreweight) --self:I(self.lid .. " Loading restricted: " .. tostring(restricted)) local staticpos = static:GetCoordinate() --or dcsunitpos local cando = cargo:UnitCanCarry(_unit) + if ignoretype == true then cando = true end --self:I(self.lid .. " Unit can carry: " .. tostring(cando)) --- Testing local distance = self:_GetDistance(location,staticpos) From 68b2b452cc0fd39ce2769b81ab8494846b60694b Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Mon, 26 Aug 2024 18:30:41 +0200 Subject: [PATCH 2/2] xx --- Moose Development/Moose/Ops/CTLD.lua | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Moose Development/Moose/Ops/CTLD.lua b/Moose Development/Moose/Ops/CTLD.lua index 5cfbe085a..d7282531d 100644 --- a/Moose Development/Moose/Ops/CTLD.lua +++ b/Moose Development/Moose/Ops/CTLD.lua @@ -186,19 +186,19 @@ CTLD_CARGO = { -- @return #boolean Outcome function CTLD_CARGO:UnitCanCarry(Unit) local outcome = false - UTILS.PrintTableToLog(self.TypeNames) - if (not self.TypeNames) or (not Unit) or (not Unit:IsAlive()) then - return false - end - local unittype = Unit:GetTypeName() or "none" - --self:I("Checking for type name: "..unittype) - for _,_typeName in pairs(self.TypeNames or {}) do - if _typeName == unittype then - outcome = true - break + if not self.TypeNames then return true end + if Unit and Unit:IsAlive() then + local unittype = Unit:GetTypeName() or "none" + --self:I("Checking for type name: "..unittype) + for _,_typeName in pairs(self.TypeNames or {}) do + if _typeName == unittype then + outcome = true + break + end end + return outcome end - return outcome + return true end --- Add Resource Map information table