diff --git a/Moose/Cargo.lua b/Moose/Cargo.lua index d113e70b1..7a3fb6a6d 100644 --- a/Moose/Cargo.lua +++ b/Moose/Cargo.lua @@ -308,10 +308,23 @@ self:T() end + +function CARGO:IsLoadingToClient() +self:T() + + if self:IsStatusLoading() then + return self.CargoClient + end + + return nil + +end + + function CARGO:IsLoadedInClient() self:T() - if self:IsStatusLoaded() or self:IsStatusLoading() then + if self:IsStatusLoaded() then return self.CargoClient end @@ -380,7 +393,7 @@ self:T() self.CargoClient = Client self.CargoStatus = CARGO.STATUS.LOADING - self:T( "Cargo loaded in Client: " .. CargoClient:GetClientGroupName() ) + self:T( "Cargo " .. self.CargoName .. " loading to Client: " .. CargoClient:GetClientGroupName() ) return self end @@ -390,6 +403,7 @@ self:T() self.CargoClient = Client self.CargoStatus = CARGO.STATUS.LOADED + self:T( "Cargo " .. self.CargoName .. " loaded in Client: " .. CargoClient:GetClientGroupName() ) return self end @@ -452,8 +466,24 @@ self:T() local SpawnCargo = true if self:IsStatusNone() then + local CargoGroup = Group.getByName( self.CargoSpawn:SpawnGroupName() ) + if CargoGroup then + SpawnCargo = false + end + + elseif self:IsStatusLoading() then - elseif self:IsStatusLoaded() or self:IsStatusLoading() then + local Client = self:IsLoadingToClient() + if Client and Client:ClientGroup() then + SpawnCargo = false + else + local CargoGroup = Group.getByName( self.CargoSpawn:SpawnGroupName() ) + if CargoGroup then + SpawnCargo = false + end + end + + elseif self:IsStatusLoaded() then local Client = self:IsLoadedInClient() if Client and Client:ClientGroup() then diff --git a/Moose/PickupTask.lua b/Moose/PickupTask.lua index 92100df64..d9423d73d 100644 --- a/Moose/PickupTask.lua +++ b/Moose/PickupTask.lua @@ -78,7 +78,8 @@ self:T() self:T( { Cargo.ClassName, Cargo.CargoName, Cargo.CargoType, Cargo:IsStatusNone(), Cargo:IsStatusLoaded(), Cargo:IsStatusLoading(), Cargo:IsStatusUnLoaded() } ) - if Cargo:IsStatusNone() or ( Cargo:IsStatusLoaded() and Client ~= Cargo:IsLoadedInClient() ) then + -- If the Cargo has no status, allow the menu option. + if Cargo:IsStatusNone() or ( Cargo:IsStatusLoading() and Client == Cargo:IsLoadingToClient() ) then local MenuAdd = false if Cargo:IsNear( Client, self.CurrentCargoZone ) then @@ -132,7 +133,14 @@ self:T() MenuData.PickupMenu = nil end end - + + for CargoID, Cargo in pairs( Cargos ) do + self:T( { Cargo.ClassName, Cargo.CargoName, Cargo.CargoType, Cargo:IsStatusNone(), Cargo:IsStatusLoaded(), Cargo:IsStatusLoading(), Cargo:IsStatusUnLoaded() } ) + if Cargo:IsStatusLoading() and Client == Cargo:IsLoadingToClient() then + Cargo:StatusNone() + end + end + end