Add a button to set the job positions to the vehicle position - #1314
Draft
helgehelge123 wants to merge 2 commits into
Draft
Add a button to set the job positions to the vehicle position#1314helgehelge123 wants to merge 2 commits into
helgehelge123 wants to merge 2 commits into
Conversation
getNumberOfItemsInSection() built contextActionMapping by iterating the CONTEXT_ACTIONS table with pairs(). That table has integer keys assigned in the constructor, so pairs() returns them in Lua hash order, not in index order, and the buttons in the lower right corner could show up in any order. Use ipairs() so the buttons always appear in the order the actions are defined in. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
When creating a job while already standing on the field, the target position and the field/silo position still have to be picked on the map, which is fiddly and easy to get wrong. Add a "Target & field to vehicle" button to the job parameter list that sets both to the vehicle's current position in one click, the target position also gets the direction the vehicle is facing. It is placed in a group of its own right below the position parameters, so it is not clicked by accident, and only shows up for jobs that actually have such a position. The same action is available as a context button in the lower right corner and bound to a new, rebindable input action CP_SET_POSITIONS_TO_VEHICLE (KEY_v by default, that key is unused in the menu), so the usual work flow can be done with the keyboard alone: V set the positions, C generate the course, X start the job. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
|
Die Übersetzung muss in die MasterTranslation.xml https://github.com/Courseplay/Courseplay_FS25/wiki/Translations |
Contributor
Tensuko
marked this pull request as draft
August 25, 2026 10:03
Author
|
@Tensuko Hättest du einen Wunsch in welche Kategorie es mit aufgenommen werden könnte, um eine Zeile zu sparen? |
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
When a job is created from the course generator page, the vehicle is usually already standing on the field, in position - but the target position and the field position still have to be picked on the map. That means two mouse picks for something the vehicle already knows, and it is easy to drop the field position on a neighbouring field or a headland of the wrong field.
What this adds
A Target & field to vehicle button in the job parameter list, which sets the target position (including the direction the vehicle is facing) and the field/silo position to the vehicle's current position with one click.
Details:
invalidmarker is hidden, it can't be invalid).validateParameters()andupdateParameterValueTexts()run, so the field boundary detection restarts for the new field position, just like after picking it manually.getCanBeChanged()) are left alone.Key binding
The same action is also available as a context button in the lower right corner, bound to a new rebindable input action
CP_SET_POSITIONS_TO_VEHICLE,KEY_vby default.KEY_vis not used by anyMENU_*action in the base game input bindings, it is only bound to vehicle and construction actions, which are not active while the menu is open.The context button is only active while a job is being created and while nothing is being picked on the map, so the usual workflow can be done from the keyboard alone: V set the positions, C generate the course, X start the job.
That order is also the reason for the first commit in this PR:
getNumberOfItemsInSection()builtcontextActionMappingby iteratingCONTEXT_ACTIONSwithpairs(). The table has integer keys, but they are assigned in the table constructor, sopairs()returns them in hash order and the context buttons could show up in any order. Usingipairs()makes the order deterministic and follows the order the actions are defined in.Translations are added for English and German, other languages fall back to English.
Testing
Tested in game with Courseplay 8.1.0.3 (screenshot above, German UI, bale collecting job): the button sets both positions to the vehicle position including its direction, the
Vkey does the same, the button list keeps the intended order, and the button is not shown outside of job creation.🤖 Generated with Claude Code