diff --git a/Exiled.API/Features/Toys/Light.cs b/Exiled.API/Features/Toys/Light.cs
index 2d2a729791..2f088ca7b2 100644
--- a/Exiled.API/Features/Toys/Light.cs
+++ b/Exiled.API/Features/Toys/Light.cs
@@ -1,108 +1,135 @@
-// -----------------------------------------------------------------------
-//
-// Copyright (c) Exiled Team. All rights reserved.
-// Licensed under the CC BY-SA 3.0 license.
-//
-// -----------------------------------------------------------------------
-
-namespace Exiled.API.Features.Toys
-{
- using System.Linq;
-
- using AdminToys;
-
- using Enums;
- using Exiled.API.Interfaces;
-
- using UnityEngine;
-
- ///
- /// A wrapper class for .
- ///
- public class Light : AdminToy, IWrapper
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// The of the toy.
- internal Light(LightSourceToy lightSourceToy)
- : base(lightSourceToy, AdminToyType.LightSource)
- {
- Base = lightSourceToy;
- }
-
- ///
- /// Gets the base .
- ///
- public LightSourceToy Base { get; }
-
- ///
- /// Gets or sets the intensity of the light.
- ///
- public float Intensity
- {
- get => Base.NetworkLightIntensity;
- set => Base.NetworkLightIntensity = value;
- }
-
- ///
- /// Gets or sets the range of the light.
- ///
- public float Range
- {
- get => Base.NetworkLightRange;
- set => Base.NetworkLightRange = value;
- }
-
- ///
- /// Gets or sets the color of the primitive.
- ///
- public Color Color
- {
- get => Base.NetworkLightColor;
- set => Base.NetworkLightColor = value;
- }
-
- ///
- /// Gets or sets a value indicating whether the light should cause shadows from other objects.
- ///
- public bool ShadowEmission
- {
- get => Base.NetworkLightShadows;
- set => Base.NetworkLightShadows = value;
- }
-
- ///
- /// Creates a new .
- ///
- /// The position of the .
- /// The rotation of the .
- /// The scale of the .
- /// Whether the should be initially spawned.
- /// The new .
- public static Light Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, bool spawn = true)
- {
- Light light = new(Object.Instantiate(ToysHelper.LightBaseObject));
-
- light.AdminToyBase.transform.position = position ?? Vector3.zero;
- light.AdminToyBase.transform.eulerAngles = rotation ?? Vector3.zero;
- light.AdminToyBase.transform.localScale = scale ?? Vector3.one;
-
- if (spawn)
- light.Spawn();
-
- return light;
- }
-
- ///
- /// Gets the belonging to the .
- ///
- /// The instance.
- /// The corresponding instance.
- public static Light Get(LightSourceToy lightSourceToy)
- {
- AdminToy adminToy = Map.Toys.FirstOrDefault(x => x.AdminToyBase == lightSourceToy);
- return adminToy is not null ? adminToy as Light : new Light(lightSourceToy);
- }
- }
+// -----------------------------------------------------------------------
+//
+// Copyright (c) Exiled Team. All rights reserved.
+// Licensed under the CC BY-SA 3.0 license.
+//
+// -----------------------------------------------------------------------
+
+namespace Exiled.API.Features.Toys
+{
+ using System;
+ using System.Linq;
+
+ using AdminToys;
+
+ using Enums;
+ using Exiled.API.Interfaces;
+
+ using UnityEngine;
+
+ ///
+ /// A wrapper class for .
+ ///
+ public class Light : AdminToy, IWrapper
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The of the toy.
+ internal Light(LightSourceToy lightSourceToy)
+ : base(lightSourceToy, AdminToyType.LightSource)
+ {
+ Base = lightSourceToy;
+ }
+
+ ///
+ /// Gets the base .
+ ///
+ public LightSourceToy Base { get; }
+
+ ///
+ /// Gets or sets the intensity of the light.
+ ///
+ public float Intensity
+ {
+ get => Base.NetworkLightIntensity;
+ set => Base.NetworkLightIntensity = value;
+ }
+
+ ///
+ /// Gets or sets the range of the light.
+ ///
+ public float Range
+ {
+ get => Base.NetworkLightRange;
+ set => Base.NetworkLightRange = value;
+ }
+
+ ///
+ /// Gets or sets the color of the primitive.
+ ///
+ public Color Color
+ {
+ get => Base.NetworkLightColor;
+ set => Base.NetworkLightColor = value;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the light should cause shadows from other objects.
+ ///
+ public bool ShadowEmission
+ {
+ get => Base.NetworkLightShadows;
+ set => Base.NetworkLightShadows = value;
+ }
+
+ ///
+ /// Creates a new .
+ ///
+ /// The position of the .
+ /// The rotation of the .
+ /// The scale of the .
+ /// Whether the should be initially spawned.
+ /// The new .
+ [Obsolete("Use Create(Vector3, Vector3, Vector3, bool, Color) instead.", true)]
+ public static Light Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, bool spawn = true)
+ {
+ Light light = new(UnityEngine.Object.Instantiate(ToysHelper.LightBaseObject));
+
+ light.AdminToyBase.transform.position = position ?? Vector3.zero;
+ light.AdminToyBase.transform.eulerAngles = rotation ?? Vector3.zero;
+ light.AdminToyBase.transform.localScale = scale ?? Vector3.one;
+
+ if (spawn)
+ light.Spawn();
+
+ return light;
+ }
+
+ ///
+ /// Creates a new .
+ ///
+ /// The position of the .
+ /// The rotation of the .
+ /// The scale of the .
+ /// Whether the should be initially spawned.
+ /// The color of the .
+ /// The new .
+ public static Light Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, bool spawn = true, Color? color = null)
+ {
+ Light light = new(UnityEngine.Object.Instantiate(ToysHelper.LightBaseObject));
+
+ light.AdminToyBase.transform.position = position ?? Vector3.zero;
+ light.AdminToyBase.transform.eulerAngles = rotation ?? Vector3.zero;
+ light.AdminToyBase.transform.localScale = scale ?? Vector3.one;
+
+ if (spawn)
+ light.Spawn();
+
+ light.Color = color ?? Color.gray;
+
+ return light;
+ }
+
+ ///
+ /// Gets the belonging to the .
+ ///
+ /// The instance.
+ /// The corresponding instance.
+ public static Light Get(LightSourceToy lightSourceToy)
+ {
+ AdminToy adminToy = Map.Toys.FirstOrDefault(x => x.AdminToyBase == lightSourceToy);
+ return adminToy is not null ? adminToy as Light : new Light(lightSourceToy);
+ }
+ }
}
\ No newline at end of file
diff --git a/Exiled.API/Features/Toys/Primitive.cs b/Exiled.API/Features/Toys/Primitive.cs
index 6aa1585b75..2a141f133b 100644
--- a/Exiled.API/Features/Toys/Primitive.cs
+++ b/Exiled.API/Features/Toys/Primitive.cs
@@ -1,149 +1,228 @@
-// -----------------------------------------------------------------------
-//
-// Copyright (c) Exiled Team. All rights reserved.
-// Licensed under the CC BY-SA 3.0 license.
-//
-// -----------------------------------------------------------------------
-
-namespace Exiled.API.Features.Toys
-{
- using System;
- using System.Linq;
-
- using AdminToys;
-
- using Enums;
- using Exiled.API.Interfaces;
-
- using UnityEngine;
-
- using Object = UnityEngine.Object;
-
- ///
- /// A wrapper class for .
- ///
- public class Primitive : AdminToy, IWrapper
- {
- private bool collidable = true;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The of the toy.
- internal Primitive(PrimitiveObjectToy toyAdminToyBase)
- : base(toyAdminToyBase, AdminToyType.PrimitiveObject)
- {
- Base = toyAdminToyBase;
-
- Vector3 scale = Base.transform.localScale;
- collidable = scale.x > 0f || scale.y > 0f || scale.z > 0f;
- }
-
- ///
- /// Gets the base .
- ///
- public PrimitiveObjectToy Base { get; }
-
- ///
- /// Gets or sets the type of the primitive.
- ///
- public PrimitiveType Type
- {
- get => Base.NetworkPrimitiveType;
- set => Base.NetworkPrimitiveType = value;
- }
-
- ///
- /// Gets or sets the material color of the primitive.
- ///
- public Color Color
- {
- get => Base.NetworkMaterialColor;
- set => Base.NetworkMaterialColor = value;
- }
-
- ///
- /// Gets or sets a value indicating whether the primitive can be collided with.
- ///
- public bool Collidable
- {
- get => collidable;
- set
- {
- collidable = value;
- RefreshCollidable();
- }
- }
-
- ///
- /// Creates a new .
- ///
- /// The position of the .
- /// The rotation of the .
- /// The scale of the .
- /// Whether or not the should be initially spawned.
- /// The new .
- public static Primitive Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, bool spawn = true)
- {
- Primitive primitive = new(Object.Instantiate(ToysHelper.PrimitiveBaseObject));
-
- primitive.AdminToyBase.transform.position = position ?? Vector3.zero;
- primitive.AdminToyBase.transform.eulerAngles = rotation ?? Vector3.zero;
- primitive.AdminToyBase.transform.localScale = scale ?? Vector3.one;
-
- if (spawn)
- primitive.Spawn();
-
- primitive.AdminToyBase.NetworkScale = primitive.AdminToyBase.transform.localScale;
-
- return primitive;
- }
-
- ///
- /// Creates a new .
- ///
- /// The type of primitive to spawn.
- /// The position of the .
- /// The rotation of the .
- /// The scale of the .
- /// Whether or not the should be initially spawned.
- /// The new .
- public static Primitive Create(PrimitiveType primitiveType = PrimitiveType.Sphere, Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, bool spawn = true)
- {
- Primitive primitive = new(Object.Instantiate(ToysHelper.PrimitiveBaseObject));
-
- primitive.AdminToyBase.transform.position = position ?? Vector3.zero;
- primitive.AdminToyBase.transform.eulerAngles = rotation ?? Vector3.zero;
- primitive.AdminToyBase.transform.localScale = scale ?? Vector3.one;
-
- if (spawn)
- primitive.Spawn();
-
- primitive.AdminToyBase.NetworkScale = primitive.AdminToyBase.transform.localScale;
- primitive.Base.NetworkPrimitiveType = primitiveType;
-
- return primitive;
- }
-
- ///
- /// Gets the belonging to the .
- ///
- /// The instance.
- /// The corresponding instance.
- public static Primitive Get(PrimitiveObjectToy primitiveObjectToy)
- {
- AdminToy adminToy = Map.Toys.FirstOrDefault(x => x.AdminToyBase == primitiveObjectToy);
- return adminToy is not null ? adminToy as Primitive : new Primitive(primitiveObjectToy);
- }
-
- private void RefreshCollidable()
- {
- UnSpawn();
-
- Vector3 scale = Scale;
- Base.transform.localScale = Collidable ? new Vector3(Math.Abs(scale.x), Math.Abs(scale.y), Math.Abs(scale.z)) : new Vector3(-Math.Abs(scale.x), -Math.Abs(scale.y), -Math.Abs(scale.z));
-
- Spawn();
- }
- }
-}
\ No newline at end of file
+// -----------------------------------------------------------------------
+//
+// Copyright (c) Exiled Team. All rights reserved.
+// Licensed under the CC BY-SA 3.0 license.
+//
+// -----------------------------------------------------------------------
+
+namespace Exiled.API.Features.Toys
+{
+ using System;
+ using System.Linq;
+
+ using AdminToys;
+
+ using Enums;
+ using Exiled.API.Interfaces;
+ using Exiled.API.Structs;
+ using UnityEngine;
+
+ using Object = UnityEngine.Object;
+
+ ///
+ /// A wrapper class for .
+ ///
+ public class Primitive : AdminToy, IWrapper
+ {
+ private bool collidable = true;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The of the toy.
+ internal Primitive(PrimitiveObjectToy toyAdminToyBase)
+ : base(toyAdminToyBase, AdminToyType.PrimitiveObject)
+ {
+ Base = toyAdminToyBase;
+
+ Vector3 scale = Base.transform.localScale;
+ collidable = scale.x > 0f || scale.y > 0f || scale.z > 0f;
+ }
+
+ ///
+ /// Gets the base .
+ ///
+ public PrimitiveObjectToy Base { get; }
+
+ ///
+ /// Gets or sets the type of the primitive.
+ ///
+ public PrimitiveType Type
+ {
+ get => Base.NetworkPrimitiveType;
+ set => Base.NetworkPrimitiveType = value;
+ }
+
+ ///
+ /// Gets or sets the material color of the primitive.
+ ///
+ public Color Color
+ {
+ get => Base.NetworkMaterialColor;
+ set => Base.NetworkMaterialColor = value;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the primitive can be collided with.
+ ///
+ public bool Collidable
+ {
+ get => collidable;
+ set
+ {
+ collidable = value;
+ RefreshCollidable();
+ }
+ }
+
+ ///
+ /// Creates a new .
+ ///
+ /// The position of the .
+ /// The rotation of the .
+ /// The scale of the .
+ /// Whether or not the should be initially spawned.
+ /// The new .
+ [Obsolete("Use Create(Vector3, Vector3, Vector3, bool, Color) instead.", true)]
+ public static Primitive Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, bool spawn = true)
+ {
+ Primitive primitive = new(Object.Instantiate(ToysHelper.PrimitiveBaseObject));
+
+ primitive.AdminToyBase.transform.position = position ?? Vector3.zero;
+ primitive.AdminToyBase.transform.eulerAngles = rotation ?? Vector3.zero;
+ primitive.AdminToyBase.transform.localScale = scale ?? Vector3.one;
+
+ if (spawn)
+ primitive.Spawn();
+
+ primitive.AdminToyBase.NetworkScale = primitive.AdminToyBase.transform.localScale;
+
+ return primitive;
+ }
+
+ ///
+ /// Creates a new .
+ ///
+ /// The type of primitive to spawn.
+ /// The position of the .
+ /// The rotation of the .
+ /// The scale of the .
+ /// Whether or not the should be initially spawned.
+ /// The new .
+ [Obsolete("Use Create(PrimitiveType, Vector3, Vector3, Vector3, bool, Color) instead.", true)]
+ public static Primitive Create(PrimitiveType primitiveType = PrimitiveType.Sphere, Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, bool spawn = true)
+ {
+ Primitive primitive = new(Object.Instantiate(ToysHelper.PrimitiveBaseObject));
+
+ primitive.AdminToyBase.transform.position = position ?? Vector3.zero;
+ primitive.AdminToyBase.transform.eulerAngles = rotation ?? Vector3.zero;
+ primitive.AdminToyBase.transform.localScale = scale ?? Vector3.one;
+
+ if (spawn)
+ primitive.Spawn();
+
+ primitive.AdminToyBase.NetworkScale = primitive.AdminToyBase.transform.localScale;
+ primitive.Base.NetworkPrimitiveType = primitiveType;
+
+ return primitive;
+ }
+
+ ///
+ /// Creates a new .
+ ///
+ /// The position of the .
+ /// The rotation of the .
+ /// The scale of the .
+ /// Whether or not the should be initially spawned.
+ /// The color of the .
+ /// The new .
+ public static Primitive Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, bool spawn = true, Color? color = null)
+ {
+ Primitive primitive = new(Object.Instantiate(ToysHelper.PrimitiveBaseObject));
+
+ primitive.AdminToyBase.transform.position = position ?? Vector3.zero;
+ primitive.AdminToyBase.transform.eulerAngles = rotation ?? Vector3.zero;
+ primitive.AdminToyBase.transform.localScale = scale ?? Vector3.one;
+
+ if (spawn)
+ primitive.Spawn();
+
+ primitive.AdminToyBase.NetworkScale = primitive.AdminToyBase.transform.localScale;
+ primitive.Color = color ?? Color.gray;
+
+ return primitive;
+ }
+
+ ///
+ /// Creates a new .
+ ///
+ /// The type of primitive to spawn.
+ /// The position of the .
+ /// The rotation of the .
+ /// The scale of the .
+ /// Whether or not the should be initially spawned.
+ /// The color of the .
+ /// The new .
+ public static Primitive Create(PrimitiveType primitiveType = PrimitiveType.Sphere, Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, bool spawn = true, Color? color = null)
+ {
+ Primitive primitive = new(Object.Instantiate(ToysHelper.PrimitiveBaseObject));
+
+ primitive.AdminToyBase.transform.position = position ?? Vector3.zero;
+ primitive.AdminToyBase.transform.eulerAngles = rotation ?? Vector3.zero;
+ primitive.AdminToyBase.transform.localScale = scale ?? Vector3.one;
+
+ if (spawn)
+ primitive.Spawn();
+
+ primitive.AdminToyBase.NetworkScale = primitive.AdminToyBase.transform.localScale;
+ primitive.Base.NetworkPrimitiveType = primitiveType;
+ primitive.Color = color ?? Color.gray;
+
+ return primitive;
+ }
+
+ ///
+ /// Creates a new .
+ ///
+ /// The settings of the .
+ /// The new .
+ public static Primitive Create(PrimitiveSettings primitiveSettings)
+ {
+ Primitive primitive = new(Object.Instantiate(ToysHelper.PrimitiveBaseObject));
+
+ primitive.AdminToyBase.transform.position = primitiveSettings.Position;
+ primitive.AdminToyBase.transform.eulerAngles = primitiveSettings.Rotation;
+ primitive.AdminToyBase.transform.localScale = primitiveSettings.Scale;
+
+ if (primitiveSettings.Spawn)
+ primitive.Spawn();
+
+ primitive.AdminToyBase.NetworkScale = primitive.AdminToyBase.transform.localScale;
+ primitive.Base.NetworkPrimitiveType = primitiveSettings.PrimitiveType;
+ primitive.Color = primitiveSettings.Color;
+
+ return primitive;
+ }
+
+ ///
+ /// Gets the belonging to the .
+ ///
+ /// The instance.
+ /// The corresponding instance.
+ public static Primitive Get(PrimitiveObjectToy primitiveObjectToy)
+ {
+ AdminToy adminToy = Map.Toys.FirstOrDefault(x => x.AdminToyBase == primitiveObjectToy);
+ return adminToy is not null ? adminToy as Primitive : new Primitive(primitiveObjectToy);
+ }
+
+ private void RefreshCollidable()
+ {
+ UnSpawn();
+
+ Vector3 scale = Scale;
+ Base.transform.localScale = Collidable ? new Vector3(Math.Abs(scale.x), Math.Abs(scale.y), Math.Abs(scale.z)) : new Vector3(-Math.Abs(scale.x), -Math.Abs(scale.y), -Math.Abs(scale.z));
+
+ Spawn();
+ }
+ }
+}
diff --git a/Exiled.API/Structs/PrimitiveSettings.cs b/Exiled.API/Structs/PrimitiveSettings.cs
new file mode 100644
index 0000000000..2abae14390
--- /dev/null
+++ b/Exiled.API/Structs/PrimitiveSettings.cs
@@ -0,0 +1,66 @@
+// -----------------------------------------------------------------------
+//
+// Copyright (c) Exiled Team. All rights reserved.
+// Licensed under the CC BY-SA 3.0 license.
+//
+// -----------------------------------------------------------------------
+
+namespace Exiled.API.Structs
+{
+ using UnityEngine;
+
+ ///
+ /// Settings for primitives.
+ ///
+ public struct PrimitiveSettings
+ {
+ ///
+ /// Initializes a new instance of the struct.
+ ///
+ /// The type of the primitive.
+ /// The color of the primitive.
+ /// The position of the primitive.
+ /// The rotation of the primitive.
+ /// The scale of the primitive.
+ /// Whether or not the primitive should be spawned.
+ public PrimitiveSettings(PrimitiveType primitiveType, Color color, Vector3 position, Vector3 rotation, Vector3 scale, bool spawn)
+ {
+ PrimitiveType = primitiveType;
+ Color = color;
+ Position = position;
+ Rotation = rotation;
+ Scale = scale;
+ Spawn = spawn;
+ }
+
+ ///
+ /// Gets the primitive type.
+ ///
+ public PrimitiveType PrimitiveType { get; }
+
+ ///
+ /// Gets the primitive color.
+ ///
+ public Color Color { get; }
+
+ ///
+ /// Gets the primitive position.
+ ///
+ public Vector3 Position { get; }
+
+ ///
+ /// Gets the primitive rotation.
+ ///
+ public Vector3 Rotation { get; }
+
+ ///
+ /// Gets the primitive scale.
+ ///
+ public Vector3 Scale { get; }
+
+ ///
+ /// Gets a value indicating whether or not the primitive should be spawned.
+ ///
+ public bool Spawn { get; }
+ }
+}
\ No newline at end of file