Skip to content

Conversation

itsrenderman
Copy link
Contributor

@itsrenderman itsrenderman commented Dec 27, 2024

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

Screenshot 2024-12-27 121841

Example showing a player with the same DisplayName and Name

Screenshot 2024-12-27 122021


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:

  • I declare that this contribution was created in whole or in part by me.
  • I declare that I have the right to submit this contribution under the terms of this repository's license and declarations.
  • 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.

@itsrenderman
Copy link
Contributor Author

itsrenderman commented Dec 27, 2024

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.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant