Skip to content

Commit

Permalink
Small adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
schwiti6190 committed Oct 13, 2024
1 parent 06e4cde commit 6c22612
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/ai/controllers/MotorController.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function MotorController:init(vehicle, implement)
self.isValid = true
self.fuelThresholdSetting = g_Courseplay.globalSettings.fuelThreshold
self.refuelData = {
active = false,
timer = CpTemporaryObject(true),
hasChanged = false,
lastFillLevels = {
Expand Down Expand Up @@ -56,7 +57,7 @@ function MotorController:update()
end
end
local needsFuelLowInfo = false
if self.refuelData.timer:get() then
if self.refuelData.active then
--- Only apply this if no refueling is active.
if self:isFuelLow(self.fuelThresholdSetting:getValue()) then
self.vehicle:stopCurrentAIJob(AIMessageErrorOutOfFuel.new())
Expand Down Expand Up @@ -106,6 +107,7 @@ function MotorController:onStartRefuelling()
ImplementUtil.hasFillLevelChanged(self.refuelData.lastFillLevels, true)
self.refuelData.hasChanged = false
self.refuelData.timer:set(false, 10 * 1000)
self.refuelData.active = true
end

function MotorController:onUpdateRefuelling()
Expand All @@ -122,6 +124,7 @@ function MotorController:onStopRefuelling()
if spec.fillTrigger.isFilling then
self.implement:setFillUnitIsFilling(false)
end
self.refuelData.active = false
end

function MotorController:onFinished()
Expand Down

0 comments on commit 6c22612

Please sign in to comment.