From: AeonLucid Date: Mon, 2 Nov 2020 18:55:05 +0000 (+0100) Subject: Send chat message to self by default X-Git-Tag: v1.2.2~43 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=fbe996b0c3548fc2a7decebb3a0498fcd510e74c;p=rhonda%2Fimpostor.git Send chat message to self by default --- diff --git a/src/Impostor.Api/Net/Inner/Objects/IInnerPlayerControl.cs b/src/Impostor.Api/Net/Inner/Objects/IInnerPlayerControl.cs index f79fbf6..cd031db 100644 --- a/src/Impostor.Api/Net/Inner/Objects/IInnerPlayerControl.cs +++ b/src/Impostor.Api/Net/Inner/Objects/IInnerPlayerControl.cs @@ -93,9 +93,12 @@ namespace Impostor.Api.Net.Inner.Objects /// Visible to only the current. /// /// The message to send. - /// The player that should receive this chat message. + /// + /// The player that should receive this chat message. + /// When left as null, will send message to self. + /// /// Task that must be awaited. - ValueTask SendChatToPlayerAsync(string text, IInnerPlayerControl player); + ValueTask SendChatToPlayerAsync(string text, IInnerPlayerControl? player = null); /// /// Sets the current to infected (impostor) . diff --git a/src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.Api.cs b/src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.Api.cs index d73d324..78337b9 100644 --- a/src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.Api.cs +++ b/src/Impostor.Server/Net/Inner/Objects/InnerPlayerControl.Api.cs @@ -1,6 +1,5 @@ using System.Threading.Tasks; using Impostor.Api.Innersloth.Customization; -using Impostor.Api.Net; using Impostor.Api.Net.Inner.Objects; using Impostor.Api.Net.Inner.Objects.Components; @@ -86,8 +85,13 @@ namespace Impostor.Server.Net.Inner.Objects await _game.FinishRpcAsync(writer); } - public async ValueTask SendChatToPlayerAsync(string text, IInnerPlayerControl player) + public async ValueTask SendChatToPlayerAsync(string text, IInnerPlayerControl? player = null) { + if (player == null) + { + player = this; + } + using var writer = _game.StartRpc(NetId, RpcCalls.SendChat); writer.Write(text); await _game.FinishRpcAsync(writer, player.OwnerId);