Highlight matching contract fields on the course generator map#1289
Open
helgehelge123 wants to merge 1 commit into
Open
Highlight matching contract fields on the course generator map#1289helgehelge123 wants to merge 1 commit into
helgehelge123 wants to merge 1 commit into
Conversation
… map On the course generator map page, the fields of the player's active field missions now get a pulsing green border when the currently selected vehicle has an implement whose work area type the mission accepts. This makes it easy to spot which of the contract fields (red circles on the map) the vehicle can actually work on when creating a new job. The matching is fully generic and needs no per-mission-type mapping: each field mission already declares the work area types it accepts (mission.workAreaTypes), which is exactly what the base game checks in AbstractFieldMission:getIsWorkAllowed(). We test those against the work area types of the vehicle and all its attached implements. The field polygon of each highlighted mission is fetched once, simplified and cached, and the implement scan is throttled to every 2 seconds, so the per-frame cost of the highlight is negligible. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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 creating a new job on the course generator map, all active contracts show up as identical red circles. With several contracts of different types, there is no way to see on the map which of those fields the currently selected vehicle can actually work on — you have to remember the field numbers or go back and forth with the contracts menu.
Change
The fields of the player's active field missions now get a pulsing green field border on the course generator map page when the currently selected vehicle has a matching implement. Non-matching contracts stay as they are (red circle only).
One file changed, additions only:
CpCourseGeneratorFrame.lua.How the matching works
No per-mission-type mapping is needed. Each field mission already declares the work area types it accepts (
mission.workAreaTypes, e.g.WorkAreaType.PLOWfor plow missions) — the same data the base game checks inAbstractFieldMission:getIsWorkAllowed()before letting a tool work on a mission field. The highlight simply tests those against the work area types of the vehicle and all of its attached implements (using the existingWorkWidthUtil.workAreaIterator/isValidWorkArea, which already excludes ridge markers and combine swath/chopper areas). So the highlight can never disagree with what the game would actually allow.Missions are considered when they belong to the player's farm and are in
RUNNINGorPREPARINGstate.Performance
CpFieldUtil.getFieldPolygon), simplified to ~5 m resolution and cached; the cache is reset when the frame opens.FieldPlotinstance, same drawing path as the existing custom field plots.Testing
Tested in game (FS25 single player, patched zip of the current release): with a hoe attached, the hoeing contract fields pulse green on the map while other contract types keep only their red circle; highlight follows the selected vehicle and updates after attaching a different implement. Confirmed working by the reporter of the request in our group.
Not tested: multiplayer (the code only reads
g_localPlayer.farmIdand mission state client-side, no network traffic involved).Note
The highlight is currently always on. If you would prefer it behind a global setting, happy to add one — just was not sure whether a new setting is wanted for a pure map visualization.
🤖 Generated with Claude Code
Screenshot
Vehicle with a matching implement selected: field 68 (matching active contract) gets the pulsing green border, the other contracts (60, 70, 79) keep just their red circle.