Implemented Cargo limits

Cargo is only allowed to be boarded or a route can only be done if the
limit of the cargo has not been reached! A few additional methods have
been added like IsDeployed. CARGO_GROUP gets the deployed status if it
is transported.
This commit is contained in:
FlightControl
2017-07-06 07:32:44 +02:00
parent 6115e12309
commit b84541f232
3 changed files with 135 additions and 54 deletions

View File

@@ -925,6 +925,7 @@ function CARGO_GROUP:New( CargoGroup, Type, Name, ReportRadius )
self.CargoSet = SET_CARGO:New()
self.CargoObject = CargoGroup
self:SetDeployed( false )
local WeightGroup = 0
@@ -1043,6 +1044,27 @@ function CARGO_GROUP:onafterBoarding( From, Event, To, CargoCarrier, NearRadius,
end
--- Get the amount of cargo units in the group.
-- @param #CARGO_GROUP self
-- @return #CARGO_GROUP
function CARGO_GROUP:GetCount()
return self.CargoSet:Count()
end
--- Set the cargo as deployed
-- @param #CARGO_GROUP self
function CARGO_GROUP:SetDeployed( Deployed )
self.Deployed = Deployed
end
--- Is the cargo deployed
-- @param #CARGO_GROUP self
-- @return #boolean
function CARGO_GROUP:IsDeployed()
return self.Deployed
end
--- Enter UnBoarding State.
-- @param #CARGO_GROUP self
-- @param Core.Point#POINT_VEC2 ToPointVec2