diff --git a/EXILED/Exiled.API/Features/Camera.cs b/EXILED/Exiled.API/Features/Camera.cs
index bfa38b528..5774fcd51 100644
--- a/EXILED/Exiled.API/Features/Camera.cs
+++ b/EXILED/Exiled.API/Features/Camera.cs
@@ -362,6 +362,14 @@ public static Camera Get(Scp079Camera camera079)
/// 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 e5c3bf1c7..b36b4dc3e 100644
--- a/EXILED/Exiled.API/Features/PrefabHelper.cs
+++ b/EXILED/Exiled.API/Features/PrefabHelper.cs
@@ -99,8 +99,10 @@ 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)
+ // TOOD: Only keep this method for Exiled 10
+ 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 +114,7 @@ public static GameObject Spawn(PrefabType prefabType, Vector3 position = default
if (newGameObject.TryGetComponent(out StructurePositionSync positionSync))
{
positionSync.Network_position = position;
- positionSync.Network_rotationY = (sbyte)Mathf.RoundToInt(rotation.Value.eulerAngles.y / 5.625F);
+ positionSync.Network_rotationY = (sbyte)Mathf.RoundToInt(rotation.Value.eulerAngles.y / StructurePositionSync.ConversionRate);
}
#pragma warning disable CS0618 // Type or member is obsolete
@@ -128,11 +130,22 @@ public static GameObject Spawn(PrefabType prefabType, Vector3 position = default
}
#pragma warning restore CS0618 // Type or member is obsolete
- NetworkServer.Spawn(newGameObject);
+ if (spawn)
+ NetworkServer.Spawn(newGameObject);
return newGameObject;
}
+ ///
+ /// Spawns the of the specified .
+ ///
+ /// The .
+ /// The position where the will spawn.
+ /// The rotation of the .
+ /// Returns the instantied.
+ public static GameObject Spawn(PrefabType prefabType, Vector3 position = default, Quaternion? rotation = null)
+ => Spawn(prefabType, position, rotation, true);
+
///
/// Spawns the of the specified .
///
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.
///