Browse Source

Add `SendVoiceMessage()` command to `EPlayer`

pull/14/head
Anton Tarasenko 2 years ago
parent
commit
41db52ded8
  1. 2
      sources/Chat/ChatAPI.uc
  2. 16
      sources/Players/EPlayer.uc

2
sources/Chat/ChatAPI.uc

@ -81,7 +81,7 @@ enum BuiltInVoiceMessage {
BIVM_AutoPatriarchMinigun, BIVM_AutoPatriarchMinigun,
BIVM_AutoPatriarchRocketLauncher, BIVM_AutoPatriarchRocketLauncher,
BIVM_AutoGrabbedByClot, BIVM_AutoGrabbedByClot,
BIVM_AutoFleashpoundSpotted, BIVM_AutoFleshpoundSpotted,
BIVM_AutoGorefastSpotted, BIVM_AutoGorefastSpotted,
BIVM_AutoScrakeSpotted, BIVM_AutoScrakeSpotted,
BIVM_AutoSirenSpotten, BIVM_AutoSirenSpotten,

16
sources/Players/EPlayer.uc

@ -17,7 +17,8 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with Acedia. If not, see <https://www.gnu.org/licenses/>. * along with Acedia. If not, see <https://www.gnu.org/licenses/>.
*/ */
class EPlayer extends EInterface; class EPlayer extends EInterface
dependsOn(ChatApi);
// How this `EPlayer` is identified by the server // How this `EPlayer` is identified by the server
var private User identity; var private User identity;
@ -504,6 +505,19 @@ public final function /* borrow */ ConsoleWriter BorrowConsole()
return consoleInstance.ForPlayer(self); 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 /// Sends a text message to notify the player about a particular event or situation, displayed
/// as a notification. /// as a notification.
/// ///

Loading…
Cancel
Save