Cmdr
Cmdr copied to clipboard
Support player display names and merge Util.GetNames with transformInstanceSet
Display Name Support
Related to #335
This pull request adds support for Player.DisplayName in command argument completions.
Usernames are now displayed one of two ways:
- DisplayName (Username)
- Username
Only the player's username is displayed if the Player's DisplayName and Name are the same.
This functionality is implemented through the Util.lua module, eliminating the need to modify the various different built-in types (such as Player, PlayerId, Team).
This should also assist with compatibility of any custom types created by Cmdr users, assuming they are also using the utility functions available through Cmdr.
Example showing players with a different DisplayName and Name
Example showing a player with the same DisplayName and Name
Merge Util.GetNames with transformInstanceSet
I made this change as a result of seeing both methods having a very similar functionality.
The only difference was Util.GetNames supported values not needing a Name property, defaulting to tostring when it didn't exist.
Adding this functionality to transformInstanceSet has no breaking effects on any internal code, and any users interacting with Cmdr's utiltiies should also not be affected, given transformInstanceSet is not accessible by default.
This change is essentially just the removal of unnecessary code repetition.
Declarations:
- [x] I declare that this contribution was created in whole or in part by me.
- [X] I declare that I have the right to submit this contribution under the terms of this repository's license and declarations.
- [X] I understand and agree that this contribution and a record of it are public, maintained permanently, and may be redistributed under the terms of this repository's license.
It should also be noted that players are only able to use alphabetic characters in their display names, thus preventing any forms of trickery with the name completions.