Allow disabling the seeder unit of cultivators with a seeder configuration (#989)#1285
Open
helgehelge123 wants to merge 1 commit into
Open
Conversation
The Horsch Finer 6 SL, Väderstad TopDown 600 and Dalbo Powerchain 800 gained a seeder unit configuration (vehicle type cultivatingSowingMachine) with game patch 1.8. Their sowing machine spec needs activation, so getAIRequiresTurnOn() returns true and Courseplay hid the optional sowing setting for them. The seeder unit was always turned on by the base game AI and could not be disabled, even when the user only wanted to cultivate (Courseplay#989). Three changes: 1. The optional sowing setting is now also visible for implements that have both the SowingMachine and the Cultivator specialization. 2. While a CP job is running and sowing is disabled by the user, TurnOnVehicle.getAIRequiresTurnOn() returns false for these implements. Without this, TurnOnVehicle:getCanAIImplementContinueWork() fails for machines that require turning on but are turned off, so the driver would lower the implement and then stand still forever. The override intentionally checks the specializations directly instead of the setting's getIsDisabled(), as that would recurse back into getAIRequiresTurnOn() via isOptionalSowingMachineSettingVisible(). 3. needsRefilling() no longer asks for seeds when sowing is disabled or when the seed fill unit has capacity 0. Machines like the Finer 6 SL seeder unit have no real seed tank (capacity 0 means they can always consume, see SowingMachine:getSowingMachineCanConsume) and could never be refilled, so CP kept waiting for a refill that can't happen. Fixes Courseplay#989
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #989.
The Horsch Finer 6 SL, Väderstad TopDown 600 and Dalbo Powerchain 800 gained a seeder unit configuration (vehicle type
cultivatingSowingMachine) with game patch 1.8. Their sowing machine spec hasneedsActivation="true", sogetAIRequiresTurnOn()returnstrueand Courseplay hides the optional sowing setting for them. As a result the seeder unit is always turned on by the base game AI and cannot be disabled, even when the user only wants to cultivate.Changes
CpVehicleSettings: the optional sowing setting (optionalSowingMachineEnabled) is now also visible for implements that have both theSowingMachineand theCultivatorspecialization, not only for passive sowing machines that don't require turning on.isOptionalSowingMachineSettingDisabled()mirrors the visibility check.SowingMachineController: while a CP job is running and sowing is disabled by the user, an override ofTurnOnVehicle.getAIRequiresTurnOn()returnsfalsefor these implements. Without this,TurnOnVehicle:getCanAIImplementContinueWork()fails for machines that require turning on but are turned off, so the driver lowers the implement and then stands still forever, waiting inWAITING_FOR_LOWER.getIsDisabled(): that would callisOptionalSowingMachineSettingVisible(), which itself callsgetAIRequiresTurnOn(), resulting in an infinite recursion (stack overflow every update loop).SowingMachineController:needsRefilling(): no seeds are requested when sowing is disabled, or when the seed fill unit has capacity 0. The Finer 6 SL seeder unit has no real seed tank (capacity="0", which perSowingMachine:getSowingMachineCanConsume()means it can always consume) — CP treated it as permanently empty and kept waiting for a refill that can never happen ("tank is empty" stop when sowing was enabled).Behavior
Cultivatorspecialization the setting stays hidden/disabled andgetAIRequiresTurnOn()falls through to the original implementation.Testing
Tested in SP on game version 1.10 with the Horsch Finer 6 SL (seeder unit configuration):