Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Due to absence of any discussion around the issue and the approach for the solution, I've decided to just make a PR with one possible solution that I deemed the most straightforward. The solution uses Vanilla `SelectionDrawer.DrawSelectionBracketFor` while providing the specific material, which will handle the color. The method was likely changed in 1.4 to support custom materials due to the need of custom colors for the selector due to storage groups. The materials are stored inside of `PlayerInfo` object. The materials are created using `MaterialPool.MatFrom`, so they should be cached by the game (and will be re-used if a player leaves and rejoins). `MaterialPropertyBlock` could no longer be used here due to the Vanilla method not using it, as it instead opted into using `Material` to override the default one. As for performance, a slight hit is unavoidable due to the current handling not being fully complete, skipping couple of cases (mentioned in the referenced issue). This is also compatible with Vehicle Framework, as its prefix to `SelectionDrawer.DrawSelectionBracketFor` will be actually used by MP to draw diagonal selection boxes around vehicles (instead of only rectangular ones, even if vehicle is driving diagonally).
- Loading branch information