From 47bfaee94ddeaf35ffca5d34cf66691119545105 Mon Sep 17 00:00:00 2001 From: Saskyc Date: Thu, 26 Mar 2026 15:05:10 +0100 Subject: [PATCH 1/3] All changes in this commit are non-breaking. Camera.cs changes: New method to get camera from GameObject and TryGet method with it. PrefabHelper.cs changes: Simple bool defining if prefab should be spawned by server or not. AdminToy.cs changes: Method to Get AdminToy by GameObject, which basically just gets the component. It's there to make lives of developers easier. --- EXILED/Exiled.API/Features/Camera.cs | 26 +++++++++++++++++++++ EXILED/Exiled.API/Features/PrefabHelper.cs | 6 +++-- EXILED/Exiled.API/Features/Toys/AdminToy.cs | 14 +++++++++-- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/EXILED/Exiled.API/Features/Camera.cs b/EXILED/Exiled.API/Features/Camera.cs index fa17a7754..6ad52cb29 100644 --- a/EXILED/Exiled.API/Features/Camera.cs +++ b/EXILED/Exiled.API/Features/Camera.cs @@ -5,6 +5,8 @@ // // ----------------------------------------------------------------------- +using PlayerRoles.PlayableScps.Scp079; + namespace Exiled.API.Features { using System; @@ -274,6 +276,22 @@ public bool IsBeingUsed /// A or if not found. public static Camera Get(Scp079Camera camera079) => camera079 != null ? Camera079ToCamera.TryGetValue(camera079, out Camera camera) ? camera : new(camera079) : null; + /// + /// Gets the belonging to the , if any. + /// + /// The of the camera. + /// A or if not found. + public static Camera Get(GameObject gameObject) + { + foreach (Scp079InteractableBase scp079InteractableBase in Scp079InteractableBase.AllInstances) + { + if (scp079InteractableBase.gameObject == gameObject) + return Get((Scp079Camera)scp079InteractableBase); + } + + return null; + } + /// /// Gets a given the specified . /// @@ -318,6 +336,14 @@ public bool IsBeingUsed /// if is not , or if is . public static bool TryGet(Scp079Camera camera, out Camera result) => (result = Get(camera)) != null; + /// + /// Gets the belonging to the , if any. + /// + /// The of the camera. + /// The instance of which base. + /// if is not , or if is . + public static bool TryGet(GameObject gameObject, out Camera result) => (result = Get(gameObject)) != null; + /// /// Gets a given the specified . /// diff --git a/EXILED/Exiled.API/Features/PrefabHelper.cs b/EXILED/Exiled.API/Features/PrefabHelper.cs index 179991e63..0b1b66a8d 100644 --- a/EXILED/Exiled.API/Features/PrefabHelper.cs +++ b/EXILED/Exiled.API/Features/PrefabHelper.cs @@ -96,8 +96,9 @@ public static T GetPrefab(PrefabType prefabType) /// The . /// The position where the will spawn. /// The rotation of the . + /// Whether the should be initially spawned. /// Returns the instantied. - public static GameObject Spawn(PrefabType prefabType, Vector3 position = default, Quaternion? rotation = null) + public static GameObject Spawn(PrefabType prefabType, Vector3 position = default, Quaternion? rotation = null, bool spawn = true) { if (!TryGetPrefab(prefabType, out GameObject gameObject)) return null; @@ -112,7 +113,8 @@ public static GameObject Spawn(PrefabType prefabType, Vector3 position = default positionSync.Network_rotationY = (sbyte)Mathf.RoundToInt(rotation.Value.eulerAngles.y / 5.625F); } - NetworkServer.Spawn(newGameObject); + if (spawn) + NetworkServer.Spawn(newGameObject); return newGameObject; } diff --git a/EXILED/Exiled.API/Features/Toys/AdminToy.cs b/EXILED/Exiled.API/Features/Toys/AdminToy.cs index c93cee110..99fa27e4e 100644 --- a/EXILED/Exiled.API/Features/Toys/AdminToy.cs +++ b/EXILED/Exiled.API/Features/Toys/AdminToy.cs @@ -176,12 +176,22 @@ public static AdminToy Get(AdminToyBase adminToyBase) /// /// Gets the by . /// - /// The to convert into an admintoy. + /// The to convert into an AdminToy. /// The specified type. - /// The admintoy wrapper for the given . + /// The AdminToy wrapper for the given . public static T Get(AdminToyBase adminToyBase) where T : AdminToy => Get(adminToyBase) as T; + /// + /// Gets the by . + /// + /// The to convert into AdminToy. + /// The specified type. + /// The AdminToy wrapper for the given . + public static T Get(GameObject gameObject) + where T : AdminToy + => Get(gameObject.GetComponent()) as T; + /// /// Spawns the toy into the game. Use to remove it. /// From 304d50f46eed27ca2858d7c56cc855e06a90e316 Mon Sep 17 00:00:00 2001 From: Saskyc Date: Thu, 26 Mar 2026 15:16:58 +0100 Subject: [PATCH 2/3] Camera had wrongly ordered using PlayerRoles.PlayableScps.Scp079; --- EXILED/Exiled.API/Features/Camera.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/EXILED/Exiled.API/Features/Camera.cs b/EXILED/Exiled.API/Features/Camera.cs index 6ad52cb29..a12d9e2a8 100644 --- a/EXILED/Exiled.API/Features/Camera.cs +++ b/EXILED/Exiled.API/Features/Camera.cs @@ -5,8 +5,6 @@ // // ----------------------------------------------------------------------- -using PlayerRoles.PlayableScps.Scp079; - namespace Exiled.API.Features { using System; @@ -17,6 +15,7 @@ namespace Exiled.API.Features using Exiled.API.Extensions; using Exiled.API.Interfaces; using MapGeneration; + using PlayerRoles.PlayableScps.Scp079; using PlayerRoles.PlayableScps.Scp079.Cameras; using UnityEngine; From 855522865b5846d273ef243861df35102cbb8490 Mon Sep 17 00:00:00 2001 From: Saskyc Date: Fri, 27 Mar 2026 22:10:38 +0100 Subject: [PATCH 3/3] Changed so now uses List instead of base game list created by NW --- EXILED/Exiled.API/Features/Camera.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/EXILED/Exiled.API/Features/Camera.cs b/EXILED/Exiled.API/Features/Camera.cs index a12d9e2a8..7c4958fdd 100644 --- a/EXILED/Exiled.API/Features/Camera.cs +++ b/EXILED/Exiled.API/Features/Camera.cs @@ -282,10 +282,12 @@ public bool IsBeingUsed /// A or if not found. public static Camera Get(GameObject gameObject) { - foreach (Scp079InteractableBase scp079InteractableBase in Scp079InteractableBase.AllInstances) + foreach (Camera camera in List) { - if (scp079InteractableBase.gameObject == gameObject) - return Get((Scp079Camera)scp079InteractableBase); + if (camera.GameObject == gameObject) + { + return camera; + } } return null;