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
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
player
PlayerPlayer to change.
type
RoleTypeIdModel type.
skipJump
boolWhether to skip the little jump that works around an invisibility issue.
unitId
byteThe 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
player
PlayerPlayer to change.
type
RoleTypeIdModel type.
playersToAffect
IEnumerable<Player>The players who should see the changed appearance.
skipJump
boolWhether to skip the little jump that works around an invisibility issue.
unitId
byteThe 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
scene
ScenesTypeThe 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
identity
NetworkIdentityTarget object.
customAction
Action<NetworkIdentity>Edit function.
MessageTranslated(Player, 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, bool makeHold = false, bool makeNoise = true, bool isSubtitles = true)
Parameters
player
PlayerTarget to send.
words
stringThe message to be reproduced.
translation
stringThe translation should be show in the subtitles.
makeHold
boolSame on MessageTranslated(string, string, bool, bool, bool)'s isHeld.
makeNoise
boolSame on MessageTranslated(string, string, bool, bool, bool)'s isNoisy.
isSubtitles
boolSame 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
player
PlayerTarget to send.
identity
NetworkIdentityThe Mirror.NetworkIdentity to move.
pos
Vector3The position to change.
MoveNetworkIdentityObject(NetworkIdentity, Vector3)
Moves object for all the players.
public static void MoveNetworkIdentityObject(this NetworkIdentity identity, Vector3 pos)
Parameters
identity
NetworkIdentityThe Mirror.NetworkIdentity to move.
pos
Vector3The position to change.
PlayBeepSound(Player)
Plays a beep sound that only the target player
can hear.
public static void PlayBeepSound(this Player player)
Parameters
player
PlayerTarget 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
player
PlayerTarget to send.
words
stringAnnouncement words.
makeHold
boolSame on Message(string, bool, bool, bool)'s isHeld.
makeNoise
boolSame on Message(string, bool, bool, bool)'s isNoisy.
isSubtitles
boolSame on Message(string, bool, bool, bool)'s isSubtitles.
PlayGunSound(Player, Vector3, ItemType, byte, byte)
Plays a gun sound that only the player
can hear.
public static void PlayGunSound(this Player player, Vector3 position, ItemType itemType, byte volume, byte audioClipId = 0)
Parameters
player
PlayerTarget to play.
position
Vector3Position to play on.
itemType
ItemTypeWeapon' sound to play.
volume
byteSound's volume to set.
audioClipId
byteGunAudioMessage's audioClipId to set (default = 0).
ResetIntercomDisplayText()
Resync DisplayText.
public static void ResetIntercomDisplayText()
ResyncSyncVar(NetworkIdentity, Type, string)
Force resync to client's Mirror.SyncVarAttribute.
public static void ResyncSyncVar(NetworkIdentity behaviorOwner, Type targetType, string propertyName)
Parameters
behaviorOwner
NetworkIdentityMirror.NetworkIdentity of object that owns Mirror.NetworkBehaviour.
targetType
TypeMirror.NetworkBehaviour's type.
propertyName
stringProperty 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
player
PlayerTarget to send.
identity
NetworkIdentityThe Mirror.NetworkIdentity to scale.
scale
Vector3The 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
identity
NetworkIdentityThe Mirror.NetworkIdentity to scale.
scale
Vector3The scale the object needs to be set to.
SendFakeSceneLoading(Player, ScenesType)
Sends to the player a Fake Change Scene.
public static void SendFakeSceneLoading(this Player player, ScenesType newSceneName)
Parameters
player
PlayerThe player to send the Scene.
newSceneName
ScenesTypeThe 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
target
PlayerTarget to send.
behaviorOwner
NetworkIdentityMirror.NetworkIdentity of object that owns Mirror.NetworkBehaviour.
targetType
TypeMirror.NetworkBehaviour's type.
customAction
Action<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
target
PlayerTarget to send.
behaviorOwner
NetworkIdentityMirror.NetworkIdentity of object that owns Mirror.NetworkBehaviour.
targetType
TypeMirror.NetworkBehaviour's type.
propertyName
stringProperty name starting with Network.
value
TValue 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
target
PlayerTarget to send.
behaviorOwner
NetworkIdentityMirror.NetworkIdentity of object that owns Mirror.NetworkBehaviour.
targetType
TypeMirror.NetworkBehaviour's type.
rpcName
stringProperty name starting with Rpc.
values
object[]Values of send to target.
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
target
PlayerOnly this player can see the name changed.
player
PlayerPlayer that will desync the CustomName.
name
stringNickname 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
player
PlayerOnly this player can see info.
target
PlayerTarget to set info.
info
stringSetting 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
room
RoomRoom to modify.
target
PlayerOnly this player can see room color.
color
ColorColor 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)