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 if aid~=nil then
local asset=_WAREHOUSEDB.Assets[aid] local asset=_WAREHOUSEDB.Assets[aid]
self:E({asset=asset}) self:T2({asset=asset})
if asset==nil then if asset==nil then
self:_ErrorMessage(string.format("ERROR: Asset for group %s not found in the data base!", group:GetName()), 0) self:_ErrorMessage(string.format("ERROR: Asset for group %s not found in the data base!", group:GetName()), 0)
end end
@ -7754,13 +7754,20 @@ function WAREHOUSE:_CheckFuel()
if group and group:IsAlive() then if group and group:IsAlive() then
-- Get min fuel of group.
local fuel=group:GetFuelMin() 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 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 qitem.lowfuel=true
-- Trigger low fuel event.
local asset=self:FindAssetInDB(group) local asset=self:FindAssetInDB(group)
self:AssetLowFuel(asset, qitem) self:AssetLowFuel(asset, qitem)
break break
@ -7776,13 +7783,20 @@ function WAREHOUSE:_CheckFuel()
if group and group:IsAlive() then if group and group:IsAlive() then
-- Get min fuel of group.
local fuel=group:GetFuelMin() 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 -- Check if fuel is below threshold for first time.
self:I(self.wid..string.format("Cargo group %s is low on fuel! Min fuel state = %.2f %%", group:GetName(), fuel)) 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 qitem.lowfuel=true
-- Trigger low fuel event.
local asset=self:FindAssetInDB(group) local asset=self:FindAssetInDB(group)
self:AssetLowFuel(asset, qitem) self:AssetLowFuel(asset, qitem)
break break