From 17c38990efe46e3cc30eaad81179776bd4c2bed5 Mon Sep 17 00:00:00 2001 From: GeorgeEarslight <30686125+GeorgeEarslight@users.noreply.github.com> Date: Sat, 5 Sep 2020 14:50:26 +0300 Subject: [PATCH 1/5] Straw Harvest Premos Support - Straw Harvest Premos Support - AIDriver rogue check fix --- AIDriver.lua | 2 +- CombineAIDriver.lua | 8 ++++++++ CombineUnloadManager.lua | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/AIDriver.lua b/AIDriver.lua index 9085b6582..a57c794bb 100644 --- a/AIDriver.lua +++ b/AIDriver.lua @@ -423,7 +423,7 @@ function AIDriver:driveCourse(dt) self:setSpeed(self:getRecordedSpeed()) end local isInTrigger, isAugerWagonTrigger = self.triggerHandler:isInTrigger() - if self:getIsInFilltrigger() or isInTrigger then + if self:getIsInFilltrigger() then self:setSpeed(self.vehicle.cp.speeds.approach) if isAugerWagonTrigger then self:setSpeed(self.APPROACH_AUGER_TRIGGER_SPEED) diff --git a/CombineAIDriver.lua b/CombineAIDriver.lua index b2700dc80..e21aaf9c9 100644 --- a/CombineAIDriver.lua +++ b/CombineAIDriver.lua @@ -65,8 +65,15 @@ function CombineAIDriver:init(vehicle) self.combine = self.vehicle.spec_combine else local combineImplement = AIDriverUtil.getAIImplementWithSpecialization(self.vehicle, Combine) + local peletizerImplement = AIDriverUtil.getAIImplementWithSpecialization(self.vehicle, FS19_addon_strawHarvest.StrawHarvestPelletizer) if combineImplement then self.combine = combineImplement.spec_combine + elseif peletizerImplement then + self.combine = peletizerImplement + self.combine.fillUnitIndex = 1 + self.combine.spec_aiImplement.rightMarker = self.combine.rootNode + self.combine.spec_aiImplement.leftMarker = self.combine.rootNode + self.combine.spec_aiImplement.backMarker = self.combine.rootNode else self:error('Vehicle is not a combine and could not find implement with spec_combine') end @@ -79,6 +86,7 @@ function CombineAIDriver:init(vehicle) local implementWithPipe = AIDriverUtil.getAIImplementWithSpecialization(self.vehicle, Pipe) if implementWithPipe then self.pipe = implementWithPipe.spec_pipe + self.combine.spec_pipe = self.pipe self.objectWithPipe = implementWithPipe else self:info('Could not find implement with pipe') diff --git a/CombineUnloadManager.lua b/CombineUnloadManager.lua index c21489b20..83741bcfc 100644 --- a/CombineUnloadManager.lua +++ b/CombineUnloadManager.lua @@ -79,7 +79,7 @@ function CombineUnloadManager:addCombineToList(vehicle, driver) driver = driver, combineObject = combineObject, isChopper = courseplay:isChopper(combineObject), - isCombine = courseplay:isCombine(combineObject) and not courseplay:isChopper(combineObject), + isCombine = (courseplay:isCombine(combineObject) or combineObject.isPremos) and not courseplay:isChopper(combineObject), isOnFieldNumber = 0; fillLevel = 0; fillLevelPct = 0; From 785e0a1bc367970c4b37432a35c2a688fa881ca3 Mon Sep 17 00:00:00 2001 From: GeorgeEarslight <30686125+GeorgeEarslight@users.noreply.github.com> Date: Sat, 5 Sep 2020 16:17:12 +0300 Subject: [PATCH 2/5] Forgotten file Forgotten file --- UnloadableFieldworkAIDriver.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/UnloadableFieldworkAIDriver.lua b/UnloadableFieldworkAIDriver.lua index 43cae78b6..e636c2245 100644 --- a/UnloadableFieldworkAIDriver.lua +++ b/UnloadableFieldworkAIDriver.lua @@ -61,6 +61,8 @@ function UnloadableFieldworkAIDriver.create(vehicle) elseif SpecializationUtil.hasSpecialization(Plow, vehicle.specializations) or AIDriverUtil.hasAIImplementWithSpecialization(vehicle, Plow) then return PlowAIDriver(vehicle) + elseif AIDriverUtil.hasAIImplementWithSpecialization(vehicle, FS19_addon_strawHarvest.StrawHarvestPelletizer) then + return CombineAIDriver(vehicle) else return UnloadableFieldworkAIDriver(vehicle) end From f51ba16e30e749a6d9a6ea1ba35afae56802d7f4 Mon Sep 17 00:00:00 2001 From: GeorgeEarslight <30686125+GeorgeEarslight@users.noreply.github.com> Date: Sun, 6 Sep 2020 08:56:46 +0300 Subject: [PATCH 3/5] Pipe spec is already there Pipe spec is already there --- CombineAIDriver.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/CombineAIDriver.lua b/CombineAIDriver.lua index e21aaf9c9..9ea8f9eb6 100644 --- a/CombineAIDriver.lua +++ b/CombineAIDriver.lua @@ -86,7 +86,6 @@ function CombineAIDriver:init(vehicle) local implementWithPipe = AIDriverUtil.getAIImplementWithSpecialization(self.vehicle, Pipe) if implementWithPipe then self.pipe = implementWithPipe.spec_pipe - self.combine.spec_pipe = self.pipe self.objectWithPipe = implementWithPipe else self:info('Could not find implement with pipe') @@ -1012,7 +1011,19 @@ function CombineAIDriver:handlePipe() end function CombineAIDriver:handleCombinePipe() - if self:isFillableTrailerUnderPipe() or self:isAutoDriveWaitingForPipe() or (self:isWaitingForUnload() and self.vehicle.cp.settings.pipeAlwaysUnfold:is(true)) then + + local activeUnloader = nil + local unloader + for _, unloader in ipairs(self.unloaders) do + if unloader.combineToUnload == self then + if unloader.onFieldState == unloader.states.DRIVE_TO_MOVING_COMBINE then + activeUnloader = unloader + break + end + end + end + + if self:isFillableTrailerUnderPipe() or self:isAutoDriveWaitingForPipe() or (self:isWaitingForUnload() and self.vehicle.cp.settings.pipeAlwaysUnfold:is(true)) or activeUnloader ~= nil then self:openPipe() else --wait until the objects under the pipe are gone From 58c02756207e1892290be3a1753bfd25023ec897 Mon Sep 17 00:00:00 2001 From: GeorgeEarslight <30686125+GeorgeEarslight@users.noreply.github.com> Date: Sun, 6 Sep 2020 09:00:18 +0300 Subject: [PATCH 4/5] Non relevant test leftovers Nonrelevant test leftovers, concerning pipe management. --- CombineAIDriver.lua | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/CombineAIDriver.lua b/CombineAIDriver.lua index 9ea8f9eb6..aa97d4ffc 100644 --- a/CombineAIDriver.lua +++ b/CombineAIDriver.lua @@ -1012,18 +1012,7 @@ end function CombineAIDriver:handleCombinePipe() - local activeUnloader = nil - local unloader - for _, unloader in ipairs(self.unloaders) do - if unloader.combineToUnload == self then - if unloader.onFieldState == unloader.states.DRIVE_TO_MOVING_COMBINE then - activeUnloader = unloader - break - end - end - end - - if self:isFillableTrailerUnderPipe() or self:isAutoDriveWaitingForPipe() or (self:isWaitingForUnload() and self.vehicle.cp.settings.pipeAlwaysUnfold:is(true)) or activeUnloader ~= nil then + if self:isFillableTrailerUnderPipe() or self:isAutoDriveWaitingForPipe() or (self:isWaitingForUnload() and self.vehicle.cp.settings.pipeAlwaysUnfold:is(true)) then self:openPipe() else --wait until the objects under the pipe are gone From f8e1697746c4078c2fd543ab74608d9f00fb25a7 Mon Sep 17 00:00:00 2001 From: GeorgeEarslight <30686125+GeorgeEarslight@users.noreply.github.com> Date: Sun, 6 Sep 2020 19:38:54 +0300 Subject: [PATCH 5/5] Revert AIDriver Bad LUA understanding. --- AIDriver.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AIDriver.lua b/AIDriver.lua index a57c794bb..9085b6582 100644 --- a/AIDriver.lua +++ b/AIDriver.lua @@ -423,7 +423,7 @@ function AIDriver:driveCourse(dt) self:setSpeed(self:getRecordedSpeed()) end local isInTrigger, isAugerWagonTrigger = self.triggerHandler:isInTrigger() - if self:getIsInFilltrigger() then + if self:getIsInFilltrigger() or isInTrigger then self:setSpeed(self.vehicle.cp.speeds.approach) if isAugerWagonTrigger then self:setSpeed(self.APPROACH_AUGER_TRIGGER_SPEED)