Update Warehouse.lua

This commit is contained in:
Frank 2019-05-26 21:25:11 +02:00
parent e141823556
commit 256ef2c7b4

View File

@ -3096,7 +3096,7 @@ function WAREHOUSE:FindAssetInDB(group)
if aid~=nil then
local asset=_WAREHOUSEDB.Assets[aid]
self:E({asset=asset})
self:T2({asset=asset})
if asset==nil then
self:_ErrorMessage(string.format("ERROR: Asset for group %s not found in the data base!", group:GetName()), 0)
end
@ -7753,14 +7753,21 @@ function WAREHOUSE:_CheckFuel()
local group=_group --Wrapper.Group#GROUP
if group and group:IsAlive() then
-- Get min fuel of group.
local fuel=group:GetFuelMin()
self:T2(self.wid..string.format("Transport group %s min fuel state = %.2f %%", group:GetName(), fuel))
-- Debug info.
self:T2(self.wid..string.format("Transport group %s min fuel state = %.2f", group:GetName(), fuel))
-- Check if fuel is below threshold for first time.
if fuel<self.lowfuelthresh and not qitem.lowfuel then
self:I(self.wid..string.format("Transport group %s is low on fuel! Min fuel state = %.2f %%", group:GetName(), fuel))
-- Set low fuel flag.
self:I(self.wid..string.format("Transport group %s is low on fuel! Min fuel state = %.2f", group:GetName(), fuel))
qitem.lowfuel=true
-- Trigger low fuel event.
local asset=self:FindAssetInDB(group)
self:AssetLowFuel(asset, qitem)
break
@ -7776,13 +7783,20 @@ function WAREHOUSE:_CheckFuel()
if group and group:IsAlive() then
-- Get min fuel of group.
local fuel=group:GetFuelMin()
self:T2(self.wid..string.format("Cargo group %s min fuel state = %.2f %%", group:GetName(), fuel))
-- Debug output.
self:T2(self.wid..string.format("Cargo group %s min fuel state = %.2f. Threshold = %.2f", group:GetName(), fuel, self.lowfuelthresh))
if fuel<self.lowfuelthresh and qitem.lowfuel then
self:I(self.wid..string.format("Cargo group %s is low on fuel! Min fuel state = %.2f %%", group:GetName(), fuel))
-- Check if fuel is below threshold for first time.
if fuel<self.lowfuelthresh and not qitem.lowfuel then
-- Set low fuel flag.
self:I(self.wid..string.format("Cargo group %s is low on fuel! Min fuel state = %.2f", group:GetName(), fuel))
qitem.lowfuel=true
-- Trigger low fuel event.
local asset=self:FindAssetInDB(group)
self:AssetLowFuel(asset, qitem)
break