From a8579841807940e95b898f0d1e218888228075f6 Mon Sep 17 00:00:00 2001 From: NotZer0Two Date: Sun, 11 Aug 2024 13:12:58 +0200 Subject: [PATCH 1/6] Scale Objects --- Exiled.API/Features/Player.cs | 17 +++++++++++++++++ Exiled.API/Features/Server.cs | 22 +++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index 0d1ba79a25..f925ea1505 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -4107,6 +4107,23 @@ public void SendFakeSceneLoading(string newSceneName) /// The new Scene the client will load. public void SendFakeSceneLoading(ScenesType newSceneName) => SendFakeSceneLoading(newSceneName.ToString()); + /// + /// Scale object for the player. + /// + /// The to move. + /// The scale to change. + public void ScaleNetworkIdentityObject(NetworkIdentity identity, Vector3 scale) + { + identity.gameObject.transform.localScale = scale; + ObjectDestroyMessage objectDestroyMessage = new() + { + netId = identity.netId, + }; + + Connection.Send(objectDestroyMessage, 0); + MirrorExtensions.SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, Connection }); + } + /// /// Converts the player in a human-readable format. /// diff --git a/Exiled.API/Features/Server.cs b/Exiled.API/Features/Server.cs index 4b0c46871c..5fde7e11ba 100644 --- a/Exiled.API/Features/Server.cs +++ b/Exiled.API/Features/Server.cs @@ -12,7 +12,7 @@ namespace Exiled.API.Features using System.Reflection; using Exiled.API.Enums; - + using Exiled.API.Extensions; using GameCore; using Interfaces; @@ -356,5 +356,25 @@ public static void ChangeSceneToAllClients(string newSceneName) /// /// The new Scene the client will load. public static void ChangeSceneToAllClients(ScenesType scene) => ChangeSceneToAllClients(scene.ToString()); + + /// + /// Scales object for all the players. + /// + /// The to move. + /// The scale to change. + public static void ScaleNetworkIdentityObject(NetworkIdentity identity, Vector3 scale) + { + identity.gameObject.transform.localScale = scale; + ObjectDestroyMessage objectDestroyMessage = new() + { + netId = identity.netId, + }; + + foreach (Player ply in Player.List) + { + ply.Connection.Send(objectDestroyMessage, 0); + MirrorExtensions.SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, ply.Connection }); + } + } } } From ea5519a0261c06c899cc68fbda84739d666a2852 Mon Sep 17 00:00:00 2001 From: NotZer0Two Date: Sun, 11 Aug 2024 15:13:54 +0200 Subject: [PATCH 2/6] Fixed the names --- Exiled.API/Features/Player.cs | 4 ++-- Exiled.API/Features/Server.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index f925ea1505..1a854f137a 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -4110,8 +4110,8 @@ public void SendFakeSceneLoading(string newSceneName) /// /// Scale object for the player. /// - /// The to move. - /// The scale to change. + /// The to scale. + /// The scale the object needs to be. public void ScaleNetworkIdentityObject(NetworkIdentity identity, Vector3 scale) { identity.gameObject.transform.localScale = scale; diff --git a/Exiled.API/Features/Server.cs b/Exiled.API/Features/Server.cs index 5fde7e11ba..ae8715b563 100644 --- a/Exiled.API/Features/Server.cs +++ b/Exiled.API/Features/Server.cs @@ -360,8 +360,8 @@ public static void ChangeSceneToAllClients(string newSceneName) /// /// Scales object for all the players. /// - /// The to move. - /// The scale to change. + /// The to scale. + /// The scale the object needs to be. public static void ScaleNetworkIdentityObject(NetworkIdentity identity, Vector3 scale) { identity.gameObject.transform.localScale = scale; From 1a89c4aa5522fcf41d379b224d01846d8d424027 Mon Sep 17 00:00:00 2001 From: ZeroTwo <63092138+NotZer0Two@users.noreply.github.com> Date: Mon, 12 Aug 2024 08:06:22 +0200 Subject: [PATCH 3/6] Update Exiled.API/Features/Server.cs Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> --- Exiled.API/Features/Server.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Exiled.API/Features/Server.cs b/Exiled.API/Features/Server.cs index ae8715b563..f06628898b 100644 --- a/Exiled.API/Features/Server.cs +++ b/Exiled.API/Features/Server.cs @@ -361,7 +361,7 @@ public static void ChangeSceneToAllClients(string newSceneName) /// Scales object for all the players. /// /// The to scale. - /// The scale the object needs to be. + /// The scale the object needs to be set to. public static void ScaleNetworkIdentityObject(NetworkIdentity identity, Vector3 scale) { identity.gameObject.transform.localScale = scale; From 5af80bf90c40a6ac5b29b499a7248dbc054155de Mon Sep 17 00:00:00 2001 From: ZeroTwo <63092138+NotZer0Two@users.noreply.github.com> Date: Mon, 12 Aug 2024 08:06:34 +0200 Subject: [PATCH 4/6] Update Exiled.API/Features/Player.cs Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> --- Exiled.API/Features/Player.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index 1a854f137a..b849b0dd1c 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -4108,7 +4108,7 @@ public void SendFakeSceneLoading(string newSceneName) public void SendFakeSceneLoading(ScenesType newSceneName) => SendFakeSceneLoading(newSceneName.ToString()); /// - /// Scale object for the player. + /// Scales an object for the specified player. /// /// The to scale. /// The scale the object needs to be. From 31f901f3ba9eb9b3c84b94502c70a15e9e3630f0 Mon Sep 17 00:00:00 2001 From: ZeroTwo <63092138+NotZer0Two@users.noreply.github.com> Date: Mon, 12 Aug 2024 08:06:42 +0200 Subject: [PATCH 5/6] Update Exiled.API/Features/Player.cs Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> --- Exiled.API/Features/Player.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index b849b0dd1c..c8eb02c420 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -4111,7 +4111,7 @@ public void SendFakeSceneLoading(string newSceneName) /// Scales an object for the specified player. /// /// The to scale. - /// The scale the object needs to be. + /// The scale the object needs to be set to. public void ScaleNetworkIdentityObject(NetworkIdentity identity, Vector3 scale) { identity.gameObject.transform.localScale = scale; From 9242d885c15a45d72d0a48d4f21073baab81dd04 Mon Sep 17 00:00:00 2001 From: ZeroTwo <63092138+NotZer0Two@users.noreply.github.com> Date: Mon, 12 Aug 2024 08:06:49 +0200 Subject: [PATCH 6/6] Update Exiled.API/Features/Server.cs Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> --- Exiled.API/Features/Server.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Exiled.API/Features/Server.cs b/Exiled.API/Features/Server.cs index f06628898b..75faf572b8 100644 --- a/Exiled.API/Features/Server.cs +++ b/Exiled.API/Features/Server.cs @@ -358,7 +358,7 @@ public static void ChangeSceneToAllClients(string newSceneName) public static void ChangeSceneToAllClients(ScenesType scene) => ChangeSceneToAllClients(scene.ToString()); /// - /// Scales object for all the players. + /// Scales an object for all players. /// /// The to scale. /// The scale the object needs to be set to.