Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
2e605f5
Update VoiceChatting.cs
MS-crew Aug 31, 2025
8811284
Update and rename VoiceChattingEventArgs.cs to SendingVoiceMessageEve…
MS-crew Aug 31, 2025
7583d53
Create ReceivingVoiceMessageEventArgs.cs
MS-crew Aug 31, 2025
ed7f6ef
Update Player.cs
MS-crew Aug 31, 2025
84ab46b
Update and rename ChangingSpeakerStatusAndVoiceChatting.cs to Changin…
MS-crew Aug 31, 2025
0184020
Delete EXILED/Exiled.Events/EventArgs/Player/TransmittingEventArgs.cs
MS-crew Aug 31, 2025
e193f71
Update Player.cs
MS-crew Aug 31, 2025
82a1a89
Create TransmittingEventArgs.cs
MS-crew Sep 2, 2025
cd95b99
Update Player.cs
MS-crew Sep 2, 2025
6a00aa4
Update Player.cs
MS-crew Sep 2, 2025
165daed
Update Player.cs
MS-crew Sep 2, 2025
42835aa
Update Player.cs
MS-crew Sep 2, 2025
48ce392
Create VoiceChattingEventArgs.cs
MS-crew Sep 2, 2025
6f69830
Update TransmittingEventArgs.cs
MS-crew Sep 2, 2025
348e597
Update Player.cs
MS-crew Sep 2, 2025
20946df
Update ReceivingVoiceMessageEventArgs.cs
MS-crew Sep 2, 2025
5373c75
Update SendingVoiceMessageEventArgs.cs
MS-crew Sep 2, 2025
013b482
Update SendingVoiceMessageEventArgs.cs
MS-crew Sep 2, 2025
baeea31
Update Player.cs
MS-crew Sep 2, 2025
d488fa1
Update Player.cs
MS-crew Sep 2, 2025
61facfa
Update Events.cs
MS-crew Sep 2, 2025
b3b1db4
Update VoiceChatting.cs
MS-crew Sep 2, 2025
537a7c5
Update VoiceChatting.cs
MS-crew Sep 2, 2025
60f84b8
Update VoiceChatting.cs
MS-crew Sep 2, 2025
8ae25da
Update SendingVoiceMessageEventArgs.cs
MS-crew Sep 2, 2025
b48142c
Update TransmittingEventArgs.cs
MS-crew Sep 2, 2025
278f787
Merge branch 'dev' into VoiceChat
MS-crew Sep 10, 2025
4f5a0be
Reverted braking changes
MS-crew Sep 10, 2025
0d38d9d
deleted useless
MS-crew Sep 10, 2025
496bb99
.
MS-crew Sep 10, 2025
e74ad0e
doc
louis1706 Jan 24, 2026
c21c521
Merge branch 'ExMod-Team:master' into VoiceChat
MS-crew Jan 27, 2026
904fc21
checked its working
MS-crew Jan 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions EXILED/Exiled.API/Extensions/MirrorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ public static void SendFakeEffectTo(this Player effectOwner, Player target, Effe
/// </summary>
/// <param name="target">The player who will become not spectatable.</param>
/// <param name="viewer">The viewer who will see this change.</param>
/// <param name="value">The faked value.</param>
public static void SetFakeSpectatable(Player target, Player viewer, bool value) => viewer.Connection.Send(new SpectatableVisibilityMessages.SpectatableVisibilityMessage(target.ReferenceHub, value));
/// <param name="isforceHidden">Determine if the player will be force hidden.</param>
public static void SetFakeSpectatable(Player target, Player viewer, bool isforceHidden) => viewer.Connection.Send(new SpectatableVisibilityMessages.SpectatableVisibilityMessage(target.ReferenceHub, isforceHidden));

/// <summary>
/// Makes the server resend a message to all clients updating a keycards details to current values.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// -----------------------------------------------------------------------
// <copyright file="ReceivingVoiceMessageEventArgs.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------using System;

namespace Exiled.Events.EventArgs.Player
{
using Exiled.API.Features;
using Exiled.Events.EventArgs.Interfaces;
using PlayerRoles.Voice;
using VoiceChat.Networking;

using IVoiceRole = API.Features.Roles.IVoiceRole;

/// <summary>
/// Contains all information before player receiving a voice message.
/// </summary>
public class ReceivingVoiceMessageEventArgs : IPlayerEvent, IDeniableEvent
{
/// <summary>
/// Initializes a new instance of the <see cref="ReceivingVoiceMessageEventArgs" /> class.
/// </summary>
/// <param name="voiceMessage">The voice message being sent.</param>
/// <param name="receiver">The player receiving the voice message.</param>
/// <param name="sender">The player sending the voice message.</param>
/// <param name="isAllowed">A value indicating whether the player is allowed to receive the voice message.</param>
public ReceivingVoiceMessageEventArgs(VoiceMessage voiceMessage, Player receiver, Player sender, bool isAllowed)
{
Player = receiver;
VoiceMessage = voiceMessage;
Sender = sender;

if (Sender.Role is IVoiceRole iVR)
{
VoiceModule = iVR.VoiceModule;
}

IsAllowed = isAllowed;
}

/// <summary>
/// Gets the player receiving the voice message.
/// </summary>
public Player Player { get; }

/// <summary>
/// Gets the player sended the voice message.
/// </summary>
public Player Sender { get; }

/// <summary>
/// Gets or sets the <see cref="Sender"/>'s <see cref="VoiceMessage" />.
/// </summary>
public VoiceMessage VoiceMessage { get; set; }

/// <summary>
/// Gets the <see cref="Sender"/>'s <see cref="VoiceModuleBase" />.
/// </summary>
public VoiceModuleBase VoiceModule { get; }

/// <summary>
/// Gets or sets a value indicating whether the player can receive the voice message.
/// </summary>
public bool IsAllowed { get; set; }
}
}
17 changes: 13 additions & 4 deletions EXILED/Exiled.Events/EventArgs/Player/TransmittingEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ namespace Exiled.Events.EventArgs.Player

using PlayerRoles.Voice;

using VoiceChat.Networking;

/// <summary>
/// Contains all information regarding the player using the radio.
/// </summary>
Expand All @@ -23,16 +25,18 @@ public class TransmittingEventArgs : IPlayerEvent, IDeniableEvent
/// <param name="player">
/// <inheritdoc cref="Player" />
/// </param>
/// <param name="voiceModule">
/// <inheritdoc cref="VoiceModule" />
/// <param name="voiceMessage">
/// <inheritdoc cref="VoiceMessage" />
/// </param>
/// <param name="isAllowed">
/// <inheritdoc cref="IsAllowed" />
/// </param>
public TransmittingEventArgs(Player player, VoiceModuleBase voiceModule, bool isAllowed = true)
public TransmittingEventArgs(Player player, VoiceMessage voiceMessage, bool isAllowed)
{
Player = player;
VoiceModule = voiceModule;
VoiceMessage = voiceMessage;
if (player.Role is IVoiceRole voiceRole)
VoiceModule = voiceRole.VoiceModule;
IsAllowed = isAllowed;
}

Expand All @@ -41,6 +45,11 @@ public TransmittingEventArgs(Player player, VoiceModuleBase voiceModule, bool is
/// </summary>
public Player Player { get; }

/// <summary>
/// Gets or sets the <see cref="Player"/>'s <see cref="VoiceMessage" />.
/// </summary>
public VoiceMessage VoiceMessage { get; set; }

/// <summary>
/// Gets the <see cref="Player"/>'s <see cref="VoiceModuleBase" />.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,15 @@ public class VoiceChattingEventArgs : IPlayerEvent, IDeniableEvent
/// <param name="voiceMessage">
/// <inheritdoc cref="VoiceMessage" />
/// </param>
/// <param name="voiceModule">
/// <inheritdoc cref="VoiceModule" />
/// </param>
/// <param name="isAllowed">
/// <inheritdoc cref="IsAllowed" />
/// </param>
public VoiceChattingEventArgs(Player player, VoiceMessage voiceMessage, VoiceModuleBase voiceModule, bool isAllowed = true)
public VoiceChattingEventArgs(Player player, VoiceMessage voiceMessage, bool isAllowed)
{
Player = player;
VoiceMessage = voiceMessage;
VoiceModule = voiceModule;
if (player.Role is IVoiceRole voiceRole)
VoiceModule = voiceRole.VoiceModule;
IsAllowed = isAllowed;
}

Expand Down
4 changes: 4 additions & 0 deletions EXILED/Exiled.Events/Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public override void OnEnabled()

ServerSpecificSettingsSync.ServerOnSettingValueReceived += SettingBase.OnSettingUpdated;

LabApi.Events.Handlers.PlayerEvents.SendingVoiceMessage += Handlers.Player.OnVoiceChatting;
LabApi.Events.Handlers.PlayerEvents.ReceivingVoiceMessage += Handlers.Player.OnReceivingVoiceMessage;
LabApi.Events.Handlers.PlayerEvents.ReloadingWeapon += Handlers.Player.OnReloadingWeapon;
LabApi.Events.Handlers.PlayerEvents.UnloadingWeapon += Handlers.Player.OnUnloadingWeapon;

Expand Down Expand Up @@ -133,6 +135,8 @@ public override void OnDisabled()

ServerSpecificSettingsSync.ServerOnSettingValueReceived -= SettingBase.OnSettingUpdated;

LabApi.Events.Handlers.PlayerEvents.SendingVoiceMessage -= Handlers.Player.OnVoiceChatting;
LabApi.Events.Handlers.PlayerEvents.ReceivingVoiceMessage -= Handlers.Player.OnReceivingVoiceMessage;
LabApi.Events.Handlers.PlayerEvents.ReloadingWeapon -= Handlers.Player.OnReloadingWeapon;
LabApi.Events.Handlers.PlayerEvents.UnloadingWeapon -= Handlers.Player.OnUnloadingWeapon;

Expand Down
38 changes: 36 additions & 2 deletions EXILED/Exiled.Events/Handlers/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,11 @@ public class Player
/// </summary>
public static Event<VoiceChattingEventArgs> VoiceChatting { get; set; } = new();

/// <summary>
/// Invoked before a <see cref="API.Features.Player"/> receiving a voice message.
/// </summary>
public static Event<ReceivingVoiceMessageEventArgs> ReceivingVoiceMessage { get; set; } = new();

/// <summary>
/// Invoked before a <see cref="API.Features.Player"/> makes noise.
/// </summary>
Expand Down Expand Up @@ -1042,8 +1047,37 @@ public static void OnUnloadingWeapon(PlayerUnloadingWeaponEventArgs ev)
/// <summary>
/// Invoked after a <see cref="API.Features.Player"/> presses the voicechat key.
/// </summary>
/// <param name="ev">The <see cref="VoiceChattingEventArgs"/> instance.</param>
public static void OnVoiceChatting(VoiceChattingEventArgs ev) => VoiceChatting.InvokeSafely(ev);
/// <param name="ev">The <see cref="PlayerSendingVoiceMessageEventArgs"/> instance.</param>
public static void OnVoiceChatting(PlayerSendingVoiceMessageEventArgs ev)
{
VoiceChattingEventArgs evVoiceChatting = new(ev.Player, ev.Message, ev.IsAllowed);
VoiceChatting.InvokeSafely(evVoiceChatting);

ev.IsAllowed = evVoiceChatting.IsAllowed;
ev.Message = evVoiceChatting.VoiceMessage;

if(ev.Message.Channel == VoiceChat.VoiceChatChannel.Radio)
{
TransmittingEventArgs evTransmitting = new(ev.Player, ev.Message, ev.IsAllowed);
OnTransmitting(evTransmitting);

ev.Message = evTransmitting.VoiceMessage;
ev.IsAllowed = evTransmitting.IsAllowed;
}
}

/// <summary>
/// Invoked before a <see cref="API.Features.Player"/> receiving a voice message.
/// </summary>
/// <param name="ev">The <see cref="ReceivingVoiceMessageEventArgs"/> instance.</param>
public static void OnReceivingVoiceMessage(PlayerReceivingVoiceMessageEventArgs ev)
{
ReceivingVoiceMessageEventArgs evReceivingVoiceMessage = new(ev.Message, ev.Player, ev.Sender, ev.IsAllowed);
ReceivingVoiceMessage.InvokeSafely(evReceivingVoiceMessage);

ev.IsAllowed = evReceivingVoiceMessage.IsAllowed;
ev.Message = evReceivingVoiceMessage.VoiceMessage;
}

/// <summary>
/// Called before a <see cref="API.Features.Player"/> makes noise.
Expand Down
150 changes: 0 additions & 150 deletions EXILED/Exiled.Events/Patches/Events/Player/VoiceChatting.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
// <copyright file="ChangingSpeakerStatusAndVoiceChatting.cs" company="ExMod Team">
// <copyright file="ChangingSpeakerStatus.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
Expand All @@ -26,12 +26,11 @@ namespace Exiled.Events.Patches.Events.Scp079

/// <summary>
/// Patches Scp079VoiceModule.ServerIsSending />.
/// Adds the <see cref="Scp079.ChangingSpeakerStatus" /> and the <see cref="Handlers.Player.VoiceChatting"/> events.
/// Adds the <see cref="Scp079.ChangingSpeakerStatus" /> event.
/// </summary>
[EventPatch(typeof(Scp079), nameof(Scp079.ChangingSpeakerStatus))]
[EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.VoiceChatting))]
[HarmonyPatch(typeof(VoiceModuleBase), nameof(VoiceModuleBase.ServerIsSending), MethodType.Setter)]
internal static class ChangingSpeakerStatusAndVoiceChatting
internal static class ChangingSpeakerStatus
{
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
Expand Down Expand Up @@ -101,4 +100,4 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
ListPool<CodeInstruction>.Pool.Return(newInstructions);
}
}
}
}
Loading