Merged
Conversation
Player objects updated to add a crew name designation and a display name that returns the username and if set, CrewName. Exposed properties for IPlayer objects.
Pass and store a player's crew name and handle server-provided username overrides. Changes: ClientPlayerManager.AddPlayer now accepts crewName and sets NetworkedPlayer.CrewName; NetworkClient stores Username and CrewName, exposes DisplayName, initializes Username from settings, and applies packet.OverrideUsername on login; NetworkServer includes OverrideUsername in the login response and sends CrewName in the PlayerJoined packet; clientbound packets (LoginResponse, PlayerJoined) get new fields for OverrideUsername and CrewName. This enables showing crew tags in player names and resolving duplicate-username conflicts.
Map markers will now show the crewname if available
…ername when applicable Replace cached localPlayerUsername with a read-only property that returns NetworkLifecycle.Instance.Client.DisplayName or falls back to Multiplayer.Settings.GetUserName(). Use player.DisplayName when building the list and use the new LocalPlayerUsername for the local entry. Removes stale initialization and adds null-safe access to the client display name so the UI shows up-to-date names.
Add a clientbound packet and handlers to propagate player preferences (currently crew name) to clients. Introduces ClientboundPlayerPreferencesUpdatePacket, NetworkServer.SendPlayerPreferencesUpdate, and a client handler in NetworkClient. Adds ClientPlayerManager.UpdatePreferences and OnPlayerPrefsUpdated event to update the local NetworkedPlayer state, and updates NetworkedMapMarkersController to refresh displayed crew names when preferences change.
Bump MAX_CREW_NAME_LENGTH from 5 to 6 to allow a longer crew name. Fix a bug in the CrewName setter where a truncated name was immediately overwritten by the original value
Introduce support for setting player crew names via chat: add new /crew (and /sc) command handling in ChatManager with a SetCrewNameMessage handler that supports host-managed and optional client-set crew names. Add a new AllowClientCrewNames setting (with UI attributes) to control whether clients can change their own crew. Add related locale keys and translations (help texts and messages for disallowed, player not found, and joined announcements) and corresponding constants in Locale.cs.
Replace direct NetworkedPlayer/Transform usage with the MPAPI IPlayer wrappers and unify host/client handling. The patch iterates ServerPlayerWrappers or ClientPlayerWrappers via IPlayer, reads Position and RotationY properties (adjusted by WorldMover), and adds the player's CrewName to the dispatched JSON. Also updates usings (adds MPAPI, LINQ, Collections) and removes direct Transform access to improve compatibility with the new player abstraction.
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.
Adds in the ability to assign players to a crew. This is a string-only implementation and may be updated in the future when company modes are added.