Update Warehouse.lua

- requests should no longer be processed if warehouse has no airbase
This commit is contained in:
Frank 2020-12-29 21:41:15 +01:00
parent a171c22ce4
commit 6e35b80daf

View File

@ -7179,7 +7179,9 @@ function WAREHOUSE:_CheckRequestNow(request)
_assetcategory=_assets[1].category _assetcategory=_assets[1].category
-- Check available parking for air asset units. -- Check available parking for air asset units.
if self.airbase and (_assetcategory==Group.Category.AIRPLANE or _assetcategory==Group.Category.HELICOPTER) then if _assetcategory==Group.Category.AIRPLANE or _assetcategory==Group.Category.HELICOPTER then
if self.airbase then
if self:IsRunwayOperational() then if self:IsRunwayOperational() then
@ -7199,6 +7201,15 @@ function WAREHOUSE:_CheckRequestNow(request)
return false return false
end end
else
-- No airbase!
local text=string.format("Warehouse %s: Request denied! No airbase", self.alias)
self:_InfoMessage(text, 5)
return false
end
end end
-- Add this here or gettransport fails -- Add this here or gettransport fails
@ -7220,14 +7231,37 @@ function WAREHOUSE:_CheckRequestNow(request)
local _transportcategory=_transports[1].category local _transportcategory=_transports[1].category
-- Check available parking for transport units. -- Check available parking for transport units.
if self.airbase and (_transportcategory==Group.Category.AIRPLANE or _transportcategory==Group.Category.HELICOPTER) then if _transportcategory==Group.Category.AIRPLANE or _transportcategory==Group.Category.HELICOPTER then
if self.airbase then
if self:IsRunwayOperational() then
local Parking=self:_FindParkingForAssets(self.airbase,_transports) local Parking=self:_FindParkingForAssets(self.airbase,_transports)
-- No parking ==> return false
if Parking==nil then if Parking==nil then
local text=string.format("Warehouse %s: Request denied! Not enough free parking spots for all transports at the moment.", self.alias) local text=string.format("Warehouse %s: Request denied! Not enough free parking spots for all transports at the moment.", self.alias)
self:_InfoMessage(text, 5) self:_InfoMessage(text, 5)
return false return false
end end
else
-- Runway destroyed.
local text=string.format("Warehouse %s: Request denied! Runway is still destroyed", self.alias)
self:_InfoMessage(text, 5)
return false
end
else
-- No airbase
local text=string.format("Warehouse %s: Request denied! No airbase currently!", self.alias)
self:_InfoMessage(text, 5)
return false
end
end end
else else