Class MirrorExtensions
- Namespace
- Exiled.API.Extensions
- Assembly
- Exiled.API.dll
A set of extensions for Mirror Networking.
public static class MirrorExtensions- Inheritance
- 
      
      MirrorExtensions
- Inherited Members
Properties
AdminToyBaseSyncVars
Gets all AdminToys.AdminToyBase sync var names.
public static string[] AdminToyBaseSyncVars { get; }Property Value
- string[]
RpcFullNames
Gets Rpc's FullName string corresponding to StringExtensions(format:classname.methodname).
public static ReadOnlyDictionary<string, string> RpcFullNames { get; }Property Value
SendSpawnMessageMethodInfo
Gets a NetworkServer.SendSpawnMessage's MethodInfo.
public static MethodInfo SendSpawnMessageMethodInfo { get; }Property Value
SetDirtyBitsMethodInfo
Gets a SetSyncVarDirtyBit(ulong)'s MethodInfo.
public static MethodInfo SetDirtyBitsMethodInfo { get; }Property Value
SyncVarDirtyBits
Gets a all DirtyBit ulong from StringExtensions(format:classname.methodname).
public static ReadOnlyDictionary<string, ulong> SyncVarDirtyBits { get; }Property Value
WriterExtensions
Gets MethodInfo corresponding to Type.
public static ReadOnlyDictionary<Type, MethodInfo> WriterExtensions { get; }Property Value
Methods
ChangeAppearance(Player, RoleTypeId, bool, byte)
Change Player character model for appearance. It will continue until Player's PlayerRoles.RoleTypeId changes.
public static void ChangeAppearance(this Player player, RoleTypeId type, bool skipJump = false, byte unitId = 0)Parameters
- playerPlayer
- Player to change. 
- typeRoleTypeId
- Model type. 
- skipJumpbool
- Whether to skip the little jump that works around an invisibility issue. 
- unitIdbyte
- The UnitNameId to use for the player's new role, if the player's new role uses unit names. (is NTF). 
ChangeAppearance(Player, RoleTypeId, IEnumerable<Player>, bool, byte)
Change Player character model for appearance. It will continue until Player's PlayerRoles.RoleTypeId changes.
public static void ChangeAppearance(this Player player, RoleTypeId type, IEnumerable<Player> playersToAffect, bool skipJump = false, byte unitId = 0)Parameters
- playerPlayer
- Player to change. 
- typeRoleTypeId
- Model type. 
- playersToAffectIEnumerable<Player>
- The players who should see the changed appearance. 
- skipJumpbool
- Whether to skip the little jump that works around an invisibility issue. 
- unitIdbyte
- The UnitNameId to use for the player's new role, if the player's new role uses unit names. (is NTF). 
ChangeSceneToAllClients(ScenesType)
Emulation of the method SCP:SL uses to change scene.
public static void ChangeSceneToAllClients(ScenesType scene)Parameters
- sceneScenesType
- The new Scene the client will load. 
EditNetworkObject(NetworkIdentity, Action<NetworkIdentity>)
Edit Mirror.NetworkIdentity's parameter and sync.
public static void EditNetworkObject(NetworkIdentity identity, Action<NetworkIdentity> customAction)Parameters
- identityNetworkIdentity
- Target object. 
- customActionAction<NetworkIdentity>
- Edit function. 
MessageTranslated(Player, string, string, string, bool, bool, bool)
Send CASSIE announcement with custom subtitles for translation that only Player can hear and see it.
public static void MessageTranslated(this Player player, string words, string translation, string customSubtitles, bool makeHold = false, bool makeNoise = true, bool isSubtitles = true)Parameters
- playerPlayer
- Target to send. 
- wordsstring
- The message to be reproduced. 
- translationstring
- The translation should be show in the subtitles. 
- customSubtitlesstring
- The custom subtitles to show. 
- makeHoldbool
- Same on MessageTranslated(string, string, bool, bool, bool)'s isHeld. 
- makeNoisebool
- Same on MessageTranslated(string, string, bool, bool, bool)'s isNoisy. 
- isSubtitlesbool
- Same on MessageTranslated(string, string, bool, bool, bool)'s isSubtitles. 
MoveNetworkIdentityObject(Player, NetworkIdentity, Vector3)
Moves object for the player.
public static void MoveNetworkIdentityObject(this Player player, NetworkIdentity identity, Vector3 pos)Parameters
- playerPlayer
- Target to send. 
- identityNetworkIdentity
- The Mirror.NetworkIdentity to move. 
- posVector3
- The position to change. 
MoveNetworkIdentityObject(NetworkIdentity, Vector3)
Moves object for all the players.
public static void MoveNetworkIdentityObject(this NetworkIdentity identity, Vector3 pos)Parameters
- identityNetworkIdentity
- The Mirror.NetworkIdentity to move. 
- posVector3
- The position to change. 
PlaceBlood(Player, Vector3, Vector3, RoleTypeId, int)
Place blood that only the player can see.
public static void PlaceBlood(this Player player, Vector3 position, Vector3 origin, RoleTypeId roleTypeId, int gettingShotSoundIndex)Parameters
- playerPlayer
- Target to play. 
- positionVector3
- The position of the blood decal. 
- originVector3
- The direction of the blood decal. 
- roleTypeIdRoleTypeId
- The RoleTypeId from who blood come from. 
- gettingShotSoundIndexint
- The sound than player get when getting shot. 
PlayBeepSound(Player)
Plays a beep sound that only the target player can hear.
public static void PlayBeepSound(this Player player)Parameters
- playerPlayer
- Target to play sound to. 
PlayCassieAnnouncement(Player, string, bool, bool, bool)
Send CASSIE announcement that only Player can hear.
public static void PlayCassieAnnouncement(this Player player, string words, bool makeHold = false, bool makeNoise = true, bool isSubtitles = false)Parameters
- playerPlayer
- Target to send. 
- wordsstring
- Announcement words. 
- makeHoldbool
- Same on Message(string, bool, bool, bool)'s isHeld. 
- makeNoisebool
- Same on Message(string, bool, bool, bool)'s isNoisy. 
- isSubtitlesbool
- Same on Message(string, bool, bool, bool)'s isSubtitles. 
PlayGunSound(Player, Vector3, FirearmType, float, int)
Plays a gun sound that only the player can hear.
public static void PlayGunSound(this Player player, Vector3 position, FirearmType firearmType, float pitch = 1, int clipIndex = 0)Parameters
- playerPlayer
- Target to play. 
- positionVector3
- Position to play on. 
- firearmTypeFirearmType
- Weapon's sound to play. 
- pitchfloat
- Speed of sound. 
- clipIndexint
- Index of clip. 
PlayGunSound(Player, Vector3, ItemType, byte, byte)
Plays a gun sound that only the player can hear.
[Obsolete("This method is not working. Use PlayGunSound(Player, Vector3, FirearmType, float, int, bool) overload instead.")]
public static void PlayGunSound(this Player player, Vector3 position, ItemType itemType, byte volume, byte audioClipId = 0)Parameters
- playerPlayer
- Target to play. 
- positionVector3
- Position to play on. 
- itemTypeItemType
- Weapon' sound to play. 
- volumebyte
- Sound's volume to set. 
- audioClipIdbyte
- GunAudioMessage's audioClipId to set (default = 0). 
ResetIntercomDisplayText()
Resync DisplayText.
public static void ResetIntercomDisplayText()ResyncEffectTo(Player, Player, EffectType)
Resynchronizes a specific effect from the effect owner to the target player.
public static void ResyncEffectTo(this Player effectOwner, Player target, EffectType effect)Parameters
- effectOwnerPlayer
- The player who owns the effect to be resynchronized. 
- targetPlayer
- The target player to whom the effect will be resynchronized. 
- effectEffectType
- The type of effect to be resynchronized. 
ResyncEffectTo(Player, IEnumerable<Player>, EffectType)
Resynchronizes a specific effect from the effect owner to the target players.
public static void ResyncEffectTo(this Player effectOwner, IEnumerable<Player> targets, EffectType effect)Parameters
- effectOwnerPlayer
- The player who owns the effect to be resynchronized. 
- targetsIEnumerable<Player>
- The list of target players to whom the effect will be resynchronized. 
- effectEffectType
- The type of effect to be resynchronized. 
ResyncKeycardItem(CustomKeycardItem)
Makes the server resend a message to all clients updating a keycards details to current values.
public static void ResyncKeycardItem(CustomKeycardItem customKeycardItem)Parameters
- customKeycardItemCustomKeycardItem
- The keycard to resync. 
ResyncKeycardPickup(CustomKeycardPickup)
Makes the server resend a message to all clients updating a keycards details to current values.
public static void ResyncKeycardPickup(CustomKeycardPickup customKeycard)Parameters
- customKeycardCustomKeycardPickup
- The keycard to resync. 
ResyncSyncVar(NetworkIdentity, Type, string)
Force resync to client's Mirror.SyncVarAttribute.
public static void ResyncSyncVar(NetworkIdentity behaviorOwner, Type targetType, string propertyName)Parameters
- behaviorOwnerNetworkIdentity
- Mirror.NetworkIdentity of object that owns Mirror.NetworkBehaviour. 
- targetTypeType
- Mirror.NetworkBehaviour's type. 
- propertyNamestring
- Property name starting with Network. 
ScaleNetworkIdentityObject(Player, NetworkIdentity, Vector3)
Scales an object for the specified player.
public static void ScaleNetworkIdentityObject(this Player player, NetworkIdentity identity, Vector3 scale)Parameters
- playerPlayer
- Target to send. 
- identityNetworkIdentity
- The Mirror.NetworkIdentity to scale. 
- scaleVector3
- The scale the object needs to be set to. 
ScaleNetworkIdentityObject(NetworkIdentity, Vector3)
Scales an object for all players.
public static void ScaleNetworkIdentityObject(this NetworkIdentity identity, Vector3 scale)Parameters
- identityNetworkIdentity
- The Mirror.NetworkIdentity to scale. 
- scaleVector3
- The scale the object needs to be set to. 
SendFakeEffectTo(Player, Player, EffectType, byte)
Sends a fake effect to a target player, simulating the effect as if it originated from the effect owner.
public static void SendFakeEffectTo(this Player effectOwner, Player target, EffectType effect, byte intensity)Parameters
- effectOwnerPlayer
- The player who owns the effect. 
- targetPlayer
- The target player to whom the effect will be sent. 
- effectEffectType
- The type of effect to be sent. 
- intensitybyte
- The intensity of the effect. 
SendFakeEffectTo(Player, IEnumerable<Player>, EffectType, byte)
Sends a fake effect to a list of target players, simulating the effect as if it originated from the effect owner.
public static void SendFakeEffectTo(this Player effectOwner, IEnumerable<Player> targets, EffectType effect, byte intensity)Parameters
- effectOwnerPlayer
- The player who owns the effect. 
- targetsIEnumerable<Player>
- The list of target players to whom the effect will be sent. 
- effectEffectType
- The type of effect to be sent. 
- intensitybyte
- The intensity of the effect. 
SendFakeSceneLoading(Player, ScenesType)
Sends to the player a Fake Change Scene.
public static void SendFakeSceneLoading(this Player player, ScenesType newSceneName)Parameters
- playerPlayer
- The player to send the Scene. 
- newSceneNameScenesType
- The new Scene the client will load. 
SendFakeSyncObject(Player, NetworkIdentity, Type, Action<NetworkWriter>)
Send fake values to client's Mirror.SyncObject.
public static void SendFakeSyncObject(Player target, NetworkIdentity behaviorOwner, Type targetType, Action<NetworkWriter> customAction)Parameters
- targetPlayer
- Target to send. 
- behaviorOwnerNetworkIdentity
- Mirror.NetworkIdentity of object that owns Mirror.NetworkBehaviour. 
- targetTypeType
- Mirror.NetworkBehaviour's type. 
- customActionAction<NetworkWriter>
- Custom writing action. 
Examples
EffectOnlySCP207.
MirrorExtensions.SendFakeSyncObject(player, player.NetworkIdentity, typeof(PlayerEffectsController), (writer) => {
 writer.WriteULong(1ul);                                            // DirtyObjectsBit
 writer.WriteUInt(1);                                               // DirtyIndexCount
 writer.WriteByte((byte)SyncList<byte>.Operation.OP_SET);     // Operations
 writer.WriteUInt(17);                                              // EditIndex
});SendFakeSyncVar<T>(Player, NetworkIdentity, Type, string, T)
Send fake values to client's Mirror.SyncVarAttribute.
public static void SendFakeSyncVar<T>(this Player target, NetworkIdentity behaviorOwner, Type targetType, string propertyName, T value)Parameters
- targetPlayer
- Target to send. 
- behaviorOwnerNetworkIdentity
- Mirror.NetworkIdentity of object that owns Mirror.NetworkBehaviour. 
- targetTypeType
- Mirror.NetworkBehaviour's type. 
- propertyNamestring
- Property name starting with Network. 
- valueT
- Value of send to target. 
Type Parameters
- T
- Target SyncVar property type. 
SendFakeTargetRpc(Player, NetworkIdentity, Type, string, params object[])
Send fake values to client's Mirror.ClientRpcAttribute.
public static void SendFakeTargetRpc(Player target, NetworkIdentity behaviorOwner, Type targetType, string rpcName, params object[] values)Parameters
- targetPlayer
- Target to send. 
- behaviorOwnerNetworkIdentity
- Mirror.NetworkIdentity of object that owns Mirror.NetworkBehaviour. 
- targetTypeType
- Mirror.NetworkBehaviour's type. 
- rpcNamestring
- Property name starting with Rpc. 
- valuesobject[]
- Values of send to target. 
SetFakeSpectatable(Player, Player, bool)
Makes a player not spectatable to another player.
public static void SetFakeSpectatable(Player target, Player viewer, bool value)Parameters
- targetPlayer
- The player who will become not spectatable. 
- viewerPlayer
- The viewer who will see this change. 
- valuebool
- The faked value. 
SetIntercomDisplayTextForTargetOnly(Player, string)
Sets DisplayText that only the target player can see.
public static void SetIntercomDisplayTextForTargetOnly(this Player target, string text)Parameters
SetName(Player, Player, string)
Sets DisplayNickname of a player that only the target player can see.
public static void SetName(this Player target, Player player, string name)Parameters
- targetPlayer
- Only this player can see the name changed. 
- playerPlayer
- Player that will desync the CustomName. 
- namestring
- Nickname to set. 
SetPlayerInfoForTargetOnly(Player, Player, string)
Set CustomInfo on the target player that only the player can see.
public static void SetPlayerInfoForTargetOnly(this Player player, Player target, string info)Parameters
- playerPlayer
- Only this player can see info. 
- targetPlayer
- Target to set info. 
- infostring
- Setting info. 
SetRoomColorForTargetOnly(Room, Player, Color)
Sets Color of a room that only the target player can see.
public static void SetRoomColorForTargetOnly(this Room room, Player target, Color color)Parameters
- roomRoom
- Room to modify. 
- targetPlayer
- Only this player can see room color. 
- colorColor
- Color to set. 
SetRoomLightsForTargetOnly(Room, Player, bool)
Sets the lights of a room to be either on or off, visible only to the target player.
public static void SetRoomLightsForTargetOnly(this Room room, Player target, bool value)