From 41db52ded8f716cf86f209465524c65b51928544 Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Mon, 10 Apr 2023 01:38:27 +0700 Subject: [PATCH] Add `SendVoiceMessage()` command to `EPlayer` --- sources/Chat/ChatAPI.uc | 2 +- sources/Players/EPlayer.uc | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/sources/Chat/ChatAPI.uc b/sources/Chat/ChatAPI.uc index fbe7cbe..fefb49d 100644 --- a/sources/Chat/ChatAPI.uc +++ b/sources/Chat/ChatAPI.uc @@ -81,7 +81,7 @@ enum BuiltInVoiceMessage { BIVM_AutoPatriarchMinigun, BIVM_AutoPatriarchRocketLauncher, BIVM_AutoGrabbedByClot, - BIVM_AutoFleashpoundSpotted, + BIVM_AutoFleshpoundSpotted, BIVM_AutoGorefastSpotted, BIVM_AutoScrakeSpotted, BIVM_AutoSirenSpotten, diff --git a/sources/Players/EPlayer.uc b/sources/Players/EPlayer.uc index 20dd00e..9897f98 100644 --- a/sources/Players/EPlayer.uc +++ b/sources/Players/EPlayer.uc @@ -17,7 +17,8 @@ * You should have received a copy of the GNU General Public License * along with Acedia. If not, see . */ -class EPlayer extends EInterface; +class EPlayer extends EInterface + dependsOn(ChatApi); // How this `EPlayer` is identified by the server var private User identity; @@ -504,6 +505,19 @@ public final function /* borrow */ ConsoleWriter BorrowConsole() return consoleInstance.ForPlayer(self); } +/// Sends specified voice message from the caller player to all players in the game. +public final function SendVoiceMessage(ChatApi.BuiltInVoiceMessage voiceMessage) { + local PlayerController controller; + local ChatApi.NativeVoiceMessage nativeMessage; + + if (voiceMessage == BIVM_Unknown) return; + controller = GetController(); + if (controller == none) return; + nativeMessage = _.chat._enumIntoNativeVoiceMessage(voiceMessage); + + controller.ServerSpeech(nativeMessage.type, nativeMessage.index, ""); +} + /// Sends a text message to notify the player about a particular event or situation, displayed /// as a notification. ///