fix: hide empty/AI-crewed vehicle labels in 'Players Only' mode - #534
Merged
Conversation
In 'Players Only' unit-label mode, vehicle names still appeared even when the vehicle was empty or crewed only by AI. Now vehicle labels are shown only when at least one player is aboard (crew.names is non-empty); empty or AI-only vehicles are hidden, matching the implied behaviour of the setting. Applies to both the DOM (Leaflet) and default canvas renderers. Updates tests accordingly and adds a player-crewed vehicle case. Refs OCAP2/OCAP#96
Coverage Report for ui
File Coverage
|
||||||||||||||||||||||||||||||||||||||
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.
Summary
Addresses OCAP2/OCAP#96.
When Unit labels is set to "Players Only", vehicle names still showed even if the vehicle was empty or crewed only by AI. This PR makes
"Players Only"hide empty/AI-only vehicle labels, showing a vehicle's name only when it actually has a player aboard (i.e.crew.namesis non-empty).Changes
ui/src/renderers/leaflet/leafletRenderer.ts(DOM renderer) — trackcrewHasPlayerper entity; in"players"mode, hide the popup unless the entity is a player or a vehicle with player crew (both inupdateEntityMarkerandrefreshPopupVisibility).ui/src/renderers/leaflet/entityCanvasLayer.ts(default canvas renderer) — in"players"mode only draw a vehicle label when it has player crew.entityCanvasLayer.test.ts— AI-only vehicle now hidden in"players"mode; added a case confirming a player-crewed vehicle still shows its crew labels.Verification
tsc --noEmitcleanvitest run— 1624 tests pass (75 files)vite buildsucceeds