Fixed goal problem in TASK_CARGO_TRANSPORT more or less, needs further investigation

This commit is contained in:
FlightControl 2017-07-02 12:44:27 +02:00
parent f221047eba
commit af230d9874
4 changed files with 44 additions and 8 deletions

View File

@ -357,7 +357,11 @@ function CARGO:IsInZone( Zone )
if self:IsLoaded() then if self:IsLoaded() then
return Zone:IsPointVec2InZone( self.CargoCarrier:GetPointVec2() ) return Zone:IsPointVec2InZone( self.CargoCarrier:GetPointVec2() )
else else
if self.CargoObject:GetSize() ~= 0 then
return Zone:IsPointVec2InZone( self.CargoObject:GetPointVec2() ) return Zone:IsPointVec2InZone( self.CargoObject:GetPointVec2() )
else
return false
end
end end
return nil return nil

View File

@ -770,6 +770,17 @@ do -- TASK_CARGO
return self return self
end end
function TASK_CARGO:SetGoalTotal()
self.GoalTotal = self.SetCargo:Count()
end
function TASK_CARGO:GetGoalTotal()
return self.GoalTotal
end
end end
@ -924,11 +935,16 @@ do -- TASK_CARGO_TRANSPORT
return CargoDeployed return CargoDeployed
end 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 end

View File

@ -2395,5 +2395,16 @@ function CONTROLLABLE:IsAirPlane()
return nil return nil
end end
function CONTROLLABLE:GetSize()
local DCSObject = self:GetDCSObject()
if DCSObject then
return 1
else
return 0
end
end
-- Message APIs -- Message APIs

View File

@ -353,8 +353,13 @@ function GROUP:GetSize()
if DCSGroup then if DCSGroup then
local GroupSize = DCSGroup:getSize() local GroupSize = DCSGroup:getSize()
if GroupSize then
self:T3( GroupSize ) self:T3( GroupSize )
return GroupSize return GroupSize
else
return 0
end
end end
return nil return nil