Skip to content

Commit 45dc447

Browse files
committed
Fixed issue with discharging to ground generating too much material
1 parent 1c279f5 commit 45dc447

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

scripts/DischargeNode.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -483,11 +483,12 @@ function DischargeNode:updateTick(dt)
483483
local canDischarge = false
484484
local fillLevel = self:getFillLevel()
485485

486-
if fillLevel > 0 and self.vehicle:getIsProcessingEnabled() then
486+
if self.vehicle:getIsProcessingEnabled() then
487487
if self.currentDischargeState == Dischargeable.DISCHARGE_STATE_GROUND then
488-
canDischarge = self:getCanDischargeToGround() and self:getCanDischargeToLand() and self:getCanDischargeAtPosition()
488+
local minLiterToDrop = g_densityMapHeightManager:getMinValidLiterValue(self:getDischargeFillType())
489+
canDischarge = (fillLevel > minLiterToDrop or not self.stopDischargeIfNotPossible) and self:getCanDischargeToGround() and self:getCanDischargeToLand() and self:getCanDischargeAtPosition()
489490
else
490-
canDischarge = self:getCanDischargeToObject()
491+
canDischarge = (fillLevel > 0 or not self.stopDischargeIfNotPossible) and self:getCanDischargeToObject()
491492
end
492493
end
493494

@@ -565,7 +566,7 @@ function DischargeNode:dischargeToGround(emptyLiters)
565566
local fillLevel = self:getFillLevel()
566567
local minLiterToDrop = g_densityMapHeightManager:getMinValidLiterValue(fillType)
567568

568-
self.litersToDrop = math.min(self.litersToDrop + emptyLiters, math.max(self.emptySpeed * 250, minLiterToDrop))
569+
self.litersToDrop = math.min(self.litersToDrop + emptyLiters, math.max(self.emptySpeed * 250, minLiterToDrop), fillLevel)
569570

570571
local minDropReached = self.litersToDrop > minLiterToDrop
571572
local hasMinDropFillLevel = fillLevel > minLiterToDrop

0 commit comments

Comments
 (0)