From 69da7a0b198606c475be4f68710b7a5e4c1f684a Mon Sep 17 00:00:00 2001 From: NotZer0Two Date: Sun, 11 Aug 2024 11:25:40 +0200 Subject: [PATCH 1/3] MoveNetworkObject Added --- .../Exiled.API/Extensions/MirrorExtensions.cs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/EXILED/Exiled.API/Extensions/MirrorExtensions.cs b/EXILED/Exiled.API/Extensions/MirrorExtensions.cs index 8b30327d4..21fe13f72 100644 --- a/EXILED/Exiled.API/Extensions/MirrorExtensions.cs +++ b/EXILED/Exiled.API/Extensions/MirrorExtensions.cs @@ -342,6 +342,44 @@ public static void MessageTranslated(this Player player, string words, string tr } } + /// + /// Moves object for the player. + /// + /// Target to send. + /// The to move. + /// The position to change. + public static void MoveNetworkIdentityObject(this Player player, NetworkIdentity identity, Vector3 pos) + { + identity.gameObject.transform.position = pos; + ObjectDestroyMessage objectDestroyMessage = new() + { + netId = identity.netId, + }; + + player.Connection.Send(objectDestroyMessage, 0); + SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, player.Connection }); + } + + /// + /// Moves object for all the players. + /// + /// The to move. + /// The position to change. + public static void MoveNetworkIdentityObject(this NetworkIdentity identity, Vector3 pos) + { + identity.gameObject.transform.position = pos; + ObjectDestroyMessage objectDestroyMessage = new() + { + netId = identity.netId, + }; + + foreach (Player ply in Player.List) + { + ply.Connection.Send(objectDestroyMessage, 0); + SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, ply.Connection }); + } + } + /// /// Send fake values to client's . /// From 33040eb0150ccfbe6a9fd592f7881b2182db49f7 Mon Sep 17 00:00:00 2001 From: NotZer0Two Date: Sun, 18 Aug 2024 17:04:32 +0200 Subject: [PATCH 2/3] fix builds --- EXILED/Exiled.API/Extensions/MirrorExtensions.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/EXILED/Exiled.API/Extensions/MirrorExtensions.cs b/EXILED/Exiled.API/Extensions/MirrorExtensions.cs index 92fd1caee..a59db9e4c 100644 --- a/EXILED/Exiled.API/Extensions/MirrorExtensions.cs +++ b/EXILED/Exiled.API/Extensions/MirrorExtensions.cs @@ -410,6 +410,7 @@ public static void MoveNetworkIdentityObject(this NetworkIdentity identity, Vect SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, ply.Connection }); } } + /// /// Scales an object for all players. /// From 5737064090d2d3fef364a2e6d1595cd1678d6c92 Mon Sep 17 00:00:00 2001 From: NotZer0Two Date: Wed, 21 Aug 2024 08:27:00 +0200 Subject: [PATCH 3/3] Fix Builds --- EXILED/Exiled.API/Extensions/MirrorExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/Exiled.API/Extensions/MirrorExtensions.cs b/EXILED/Exiled.API/Extensions/MirrorExtensions.cs index c1df8f916..e23172b6f 100644 --- a/EXILED/Exiled.API/Extensions/MirrorExtensions.cs +++ b/EXILED/Exiled.API/Extensions/MirrorExtensions.cs @@ -373,7 +373,7 @@ public static void MoveNetworkIdentityObject(this Player player, NetworkIdentity player.Connection.Send(objectDestroyMessage, 0); SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, player.Connection }); } - + /// /// Sends to the player a Fake Change Scene. ///