Skip to content

Feature crewnames#129

Merged
AMacro merged 11 commits intobetafrom
feature-crewnames
Mar 22, 2026
Merged

Feature crewnames#129
AMacro merged 11 commits intobetafrom
feature-crewnames

Conversation

@AMacro
Copy link
Owner

@AMacro AMacro commented Mar 22, 2026

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.

AMacro added 11 commits March 21, 2026 15:02
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.
@AMacro AMacro self-assigned this Mar 22, 2026
@AMacro AMacro added the enhancement New feature or request label Mar 22, 2026
@AMacro AMacro merged commit 0c097c5 into beta Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant