diff --git a/Moose Development/Moose/Core/Cargo.lua b/Moose Development/Moose/Core/Cargo.lua index 230cc4e05..4f9dbd560 100644 --- a/Moose Development/Moose/Core/Cargo.lua +++ b/Moose Development/Moose/Core/Cargo.lua @@ -357,7 +357,11 @@ function CARGO:IsInZone( Zone ) if self:IsLoaded() then return Zone:IsPointVec2InZone( self.CargoCarrier:GetPointVec2() ) else - return Zone:IsPointVec2InZone( self.CargoObject:GetPointVec2() ) + if self.CargoObject:GetSize() ~= 0 then + return Zone:IsPointVec2InZone( self.CargoObject:GetPointVec2() ) + else + return false + end end return nil diff --git a/Moose Development/Moose/Tasking/Task_CARGO.lua b/Moose Development/Moose/Tasking/Task_CARGO.lua index c6f902dc1..e919cc740 100644 --- a/Moose Development/Moose/Tasking/Task_CARGO.lua +++ b/Moose Development/Moose/Tasking/Task_CARGO.lua @@ -770,6 +770,17 @@ do -- TASK_CARGO return self end + function TASK_CARGO:SetGoalTotal() + + self.GoalTotal = self.SetCargo:Count() + end + + function TASK_CARGO:GetGoalTotal() + + return self.GoalTotal + end + + end @@ -924,11 +935,16 @@ do -- TASK_CARGO_TRANSPORT return CargoDeployed end - - --- - - - + --- @param #TASK_CARGO_TRANSPORT self + function TASK_CARGO_TRANSPORT:onafterGoal( TaskUnit, From, Event, To ) + local CargoSet = self.CargoSet + + if self:IsAllCargoTransported() then + self:Success() + end + + self:__Goal( -10 ) + end end diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index 5ee4d7da8..f004b9e1c 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -2395,5 +2395,16 @@ function CONTROLLABLE:IsAirPlane() return nil end +function CONTROLLABLE:GetSize() + + local DCSObject = self:GetDCSObject() + + if DCSObject then + return 1 + else + return 0 + end +end + -- Message APIs \ No newline at end of file diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index 403a52a2c..8e1deed6e 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -353,8 +353,13 @@ function GROUP:GetSize() if DCSGroup then local GroupSize = DCSGroup:getSize() - self:T3( GroupSize ) - return GroupSize + + if GroupSize then + self:T3( GroupSize ) + return GroupSize + else + return 0 + end end return nil