Skip to content

Allow disabling the seeder unit of cultivators with a seeder configuration (#989)#1285

Open
helgehelge123 wants to merge 1 commit into
Courseplay:mainfrom
helgehelge123:fix-989-optional-sowing-cultivator
Open

Allow disabling the seeder unit of cultivators with a seeder configuration (#989)#1285
helgehelge123 wants to merge 1 commit into
Courseplay:mainfrom
helgehelge123:fix-989-optional-sowing-cultivator

Conversation

@helgehelge123

Copy link
Copy Markdown

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 has needsActivation="true", so getAIRequiresTurnOn() returns true and 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

  1. CpVehicleSettings: the optional sowing setting (optionalSowingMachineEnabled) is now also visible for implements that have both the SowingMachine and the Cultivator specialization, not only for passive sowing machines that don't require turning on. isOptionalSowingMachineSettingDisabled() mirrors the visibility check.

  2. SowingMachineController: while a CP job is running and sowing is disabled by the user, an override of 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 lowers the implement and then stands still forever, waiting in WAITING_FOR_LOWER.

    ⚠️ The override intentionally checks the specializations directly instead of using the setting's getIsDisabled(): that would call isOptionalSowingMachineSettingVisible(), which itself calls getAIRequiresTurnOn(), resulting in an infinite recursion (stack overflow every update loop).

  3. 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 per SowingMachine: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

  • Setting "Sowing option" appears in the vehicle settings (seeder section) for cultivators with a seeder unit configuration.
  • Default is off (consistent with the existing optional sowing semantics), so the driver cultivates only; enabling it makes the driver seed as before.
  • Normal seed drills are unaffected: without the Cultivator specialization the setting stays hidden/disabled and getAIRequiresTurnOn() falls through to the original implementation.

Testing

Tested in SP on game version 1.10 with the Horsch Finer 6 SL (seeder unit configuration):

  • Sowing option off: driver drives the course and only cultivates, seeder stays off, no refill request.
  • Sowing option on: driver seeds, no more bogus "tank is empty" stop (capacity-0 tank).
  • Manual driving and giants helper unaffected (override only active while a CP job is running).

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Horsch Finer 6 SL Sämaschieneneinheit nicht in CP deaktivierbar. (Mit config lösbar?)

1 participant