Skip to content

Commit 0d5d3a7

Browse files
authored
feat: Add Intercom TrySetOverride(Player, bool) and HasOverride(Player) (#646)
* Add TrySetOverride(Player, bool) and HasOverride(Player) * Fix doc
1 parent 69f9141 commit 0d5d3a7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

EXILED/Exiled.API/Features/Intercom.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,21 @@ public static float SpeechRemainingTime
8888
/// <param name="isStarting">Sets a value indicating whether the sound is the intercom's start speaking sound.</param>
8989
public static void PlaySound(bool isStarting) => GameIntercom._singleton.RpcPlayClip(isStarting);
9090

91+
/// <summary>
92+
/// Modifies whether the player is overriding the intercom to speak globally.
93+
/// </summary>
94+
/// <param name="player">The <see cref="Player"/> whose intercom override state will be changed.</param>
95+
/// <param name="newState">Indicates whether the player should be given the global intercom override.</param>
96+
/// <returns><see langword="true"/> if the player was successfully added or removed from the override list; otherwise, <see langword="false"/>.</returns>
97+
public static bool TrySetOverride(Player player, bool newState) => GameIntercom.TrySetOverride(player?.ReferenceHub, newState);
98+
99+
/// <summary>
100+
/// Checks whether the player is currently overriding the intercom to speak globally.
101+
/// </summary>
102+
/// <param name="player">The <see cref="Player"/> to check for a global intercom override.</param>
103+
/// <returns><see langword="true"/> if the player has global intercom override; otherwise, <see langword="false"/>.</returns>
104+
public static bool HasOverride(Player player) => GameIntercom.HasOverride(player?.ReferenceHub);
105+
91106
/// <summary>
92107
/// Reset the intercom's cooldown.
93108
/// </summary>

0 commit comments

Comments
 (0)