From 9e1abe07ef79c22876733644610798417f8f7e57 Mon Sep 17 00:00:00 2001 From: miniduikboot Date: Sun, 18 Aug 2024 11:16:44 +0200 Subject: [PATCH] Switch PlayerName writes to Outfit In 2024.6.18 Innersloth changed the storage location of the PlayerName from PlayerInfo to PlayerOutfit. If we don't set the PlayerName, we'll send an incomplete PlayerInfo to new players, so new players are unable to stay connected as they will not receive complete PlayerInfo objects before a timeout in the client activates. Because we publish PlayerName in the API, we can't completely remove the PlayerName field from PlayerInfo. We also use it internally in a few places, so I don't this is worth removing. --- src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.Api.cs | 2 +- src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.cs | 2 +- src/Impostor.Server/Net/Inner/Objects/InnerPlayerInfo.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.Api.cs b/src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.Api.cs index bd711618..46bb7094 100644 --- a/src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.Api.cs +++ b/src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.Api.cs @@ -20,7 +20,7 @@ namespace Impostor.Server.Net.Inner.Objects public async ValueTask SetNameAsync(string name) { - PlayerInfo.PlayerName = name; + PlayerInfo.CurrentOutfit.PlayerName = name; using var writer = Game.StartRpc(NetId, RpcCalls.SetName); writer.Write(name); diff --git a/src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.cs b/src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.cs index 16fa42ed..113226d6 100644 --- a/src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.cs +++ b/src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.cs @@ -686,7 +686,7 @@ namespace Impostor.Server.Net.Inner.Objects } } - PlayerInfo.PlayerName = name; + PlayerInfo.CurrentOutfit.PlayerName = name; return true; } diff --git a/src/Impostor.Server/Net/Inner/Objects/InnerPlayerInfo.cs b/src/Impostor.Server/Net/Inner/Objects/InnerPlayerInfo.cs index 1a9de063..66410d6f 100644 --- a/src/Impostor.Server/Net/Inner/Objects/InnerPlayerInfo.cs +++ b/src/Impostor.Server/Net/Inner/Objects/InnerPlayerInfo.cs @@ -34,7 +34,7 @@ namespace Impostor.Server.Net.Inner.Objects public int ClientId { get; internal set; } - public string PlayerName { get; internal set; } = string.Empty; + public string PlayerName => CurrentOutfit.PlayerName; public Dictionary Outfits { get; } = new() {