From 2d28b183f8ac92deabc418c28660fe30e9494ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20SAVA=C5=9E?= Date: Mon, 2 Feb 2026 17:20:35 +0300 Subject: [PATCH 01/11] added --- EXILED/Exiled.API/Features/Toys/CameraToy.cs | 106 ++++++++++++++++-- EXILED/Exiled.API/Features/Toys/Capybara.cs | 77 ++++++++++++- .../Features/Toys/InteractableToy.cs | 92 ++++++++++++++- EXILED/Exiled.API/Features/Toys/Text.cs | 82 +++++++++++++- EXILED/Exiled.API/Features/Toys/Waypoint.cs | 90 ++++++++++++++- 5 files changed, 434 insertions(+), 13 deletions(-) diff --git a/EXILED/Exiled.API/Features/Toys/CameraToy.cs b/EXILED/Exiled.API/Features/Toys/CameraToy.cs index 0e2b856b65..9d32920174 100644 --- a/EXILED/Exiled.API/Features/Toys/CameraToy.cs +++ b/EXILED/Exiled.API/Features/Toys/CameraToy.cs @@ -7,17 +7,15 @@ namespace Exiled.API.Features.Toys { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - using AdminToys; + using Exiled.API.Enums; using Exiled.API.Interfaces; + using UnityEngine; + using CameraType = Enums.CameraType; + /// /// A wrapper class for . /// @@ -30,6 +28,31 @@ public class CameraToy : AdminToy, IWrapper internal CameraToy(Scp079CameraToy scp079CameraToy) : base(scp079CameraToy, AdminToyType.CameraToy) => Base = scp079CameraToy; + /// + /// Gets the prefab for EzArm Camera prefab. + /// + public static Scp079CameraToy EzArmCameraPrefab => PrefabHelper.GetPrefab(PrefabType.EzArmCameraToy); + + /// + /// Gets the prefab for Ez Camera prefab. + /// + public static Scp079CameraToy EzCameraPrefab => PrefabHelper.GetPrefab(PrefabType.EzCameraToy); + + /// + /// Gets the prefab for Hcz Camera prefab. + /// + public static Scp079CameraToy HczCameraPrefab => PrefabHelper.GetPrefab(PrefabType.HczCameraToy); + + /// + /// Gets the prefab for Lcz Camera prefab. + /// + public static Scp079CameraToy LczCameraPrefab => PrefabHelper.GetPrefab(PrefabType.LczCameraToy); + + /// + /// Gets the prefab for Sz Camera prefab. + /// + public static Scp079CameraToy SzCameraPrefab => PrefabHelper.GetPrefab(PrefabType.SzCameraToy); + /// /// Gets the base . /// @@ -79,5 +102,74 @@ public string Name get => Base.NetworkLabel; set => Base.NetworkLabel = value; } + + /// + /// Creates a new with a specified type. + /// + /// The of the camera. + /// The position of the camera. + /// The new . + public static CameraToy Create(CameraType type, Vector3 position) => Create(type: type, position: position); + + /// + /// Creates a new with a specified type and name. + /// + /// The of the camera. + /// The position of the camera. + /// The name (label) of the camera. + /// The new . + public static CameraToy Create(CameraType type, Vector3 position, string name) => Create(type: type, position: position, name: name); + + /// + /// Creates a new . + /// + /// The of the camera. + /// The position of the camera. + /// The rotation of the camera. + /// The scale of the camera. + /// The name (label) of the camera. + /// The room associated with this camera. + /// The vertical limits. Leave null to use prefab default. + /// The horizontal limits. Leave null to use prefab default. + /// The zoom limits. Leave null to use prefab default. + /// Whether the camera should be initially spawned. + /// The new . + public static CameraToy Create(CameraType type, Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, string name = "New Camera", Room room = null, Vector2? verticalConstraint = null, Vector2? horizontalConstraint = null, Vector2? zoomConstraint = null, bool spawn = true) + { + Scp079CameraToy prefab = type switch + { + CameraType.EzArmCameraToy => EzArmCameraPrefab, + CameraType.EzCameraToy => EzCameraPrefab, + CameraType.HczCameraToy => HczCameraPrefab, + CameraType.LczCameraToy => LczCameraPrefab, + CameraType.SzCameraToy => SzCameraPrefab, + _ => EzArmCameraPrefab + }; + + CameraToy toy = new(Object.Instantiate(prefab)) + { + Position = position ?? Vector3.zero, + Rotation = Quaternion.Euler(rotation ?? Vector3.zero), + Scale = scale ?? Vector3.one, + Name = name, + }; + + if (verticalConstraint.HasValue) + toy.VerticalConstraint = verticalConstraint.Value; + + if (horizontalConstraint.HasValue) + toy.HorizontalConstraint = horizontalConstraint.Value; + + if (zoomConstraint.HasValue) + toy.ZoomConstraint = zoomConstraint.Value; + + if (room != null) + toy.Room = room; + + if (spawn) + toy.Spawn(); + + return toy; + } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Toys/Capybara.cs b/EXILED/Exiled.API/Features/Toys/Capybara.cs index e15b3600d6..ae45961a5c 100644 --- a/EXILED/Exiled.API/Features/Toys/Capybara.cs +++ b/EXILED/Exiled.API/Features/Toys/Capybara.cs @@ -8,9 +8,13 @@ namespace Exiled.API.Features.Toys { using AdminToys; + using Enums; + using Exiled.API.Interfaces; + using UnityEngine; + /// /// A wrapper class for . /// @@ -41,5 +45,76 @@ public bool Collidable get => Base.NetworkCollisionsEnabled; set => Base.NetworkCollisionsEnabled = value; } + + /// + /// Creates a new at the specified position. + /// + /// The position of the . + /// The new . + public static Capybara Create(Vector3 position) => Create(position: position); + + /// + /// Creates a new with a specific position and rotation. + /// + /// The position of the . + /// The rotation of the . + /// The new . + public static Capybara Create(Vector3 position, Vector3 rotation) => Create(position: position, rotation: rotation); + + /// + /// Creates a new based on a Transform. + /// + /// The transform to spawn at. + /// The new . + public static Capybara Create(Transform transform) => Create(transform: transform, spawn: true); + + /// + /// Creates a new . + /// + /// The position of the . + /// The rotation of the . + /// The scale of the . + /// Whether the capybara has collision enabled. + /// Whether the should be initially spawned. + /// The new . + public static Capybara Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, bool collidable = true, bool spawn = true) + { + Capybara toy = new(Object.Instantiate(Prefab)) + { + Position = position ?? Vector3.zero, + Rotation = Quaternion.Euler(rotation ?? Vector3.zero), + Scale = scale ?? Vector3.one, + Collidable = collidable, + }; + + if (spawn) + toy.Spawn(); + + return toy; + } + + /// + /// Creates a new from a Transform. + /// + /// The transform to create this on. + /// Whether the capybara has collision enabled. + /// Whether the should be initially spawned. + /// Whether the should keep the same world position. + /// The new . + public static Capybara Create(Transform transform, bool collidable = true, bool spawn = true, bool worldPositionStays = true) + { + Capybara toy = new(Object.Instantiate(Prefab, transform, worldPositionStays)) + { + Position = transform.position, + Rotation = transform.rotation, + Scale = transform.localScale, + Collidable = collidable, + }; + + if (spawn) + toy.Spawn(); + + return toy; + } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs index c6c73936cd..39a6aae78a 100644 --- a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs +++ b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs @@ -8,8 +8,10 @@ namespace Exiled.API.Features.Toys { using AdminToys; + using Exiled.API.Enums; using Exiled.API.Interfaces; + using UnityEngine; using static AdminToys.InvisibleInteractableToy; @@ -17,7 +19,7 @@ namespace Exiled.API.Features.Toys /// /// A wrapper class for . /// - internal class InteractableToy : AdminToy, IWrapper + public class InteractableToy : AdminToy, IWrapper { /// /// Initializes a new instance of the class. @@ -26,6 +28,11 @@ internal class InteractableToy : AdminToy, IWrapper internal InteractableToy(InvisibleInteractableToy invisibleInteractableToy) : base(invisibleInteractableToy, AdminToyType.InvisibleInteractableToy) => Base = invisibleInteractableToy; + /// + /// Gets the prefab. + /// + public static InvisibleInteractableToy Prefab => PrefabHelper.GetPrefab(PrefabType.InvisibleInteractableToy); + /// /// Gets the base . /// @@ -57,5 +64,86 @@ public bool IsLocked get => Base.NetworkIsLocked; set => Base.NetworkIsLocked = value; } + + /// + /// Creates a new at the specified position. + /// + /// The position of the . + /// The new . + public static InteractableToy Create(Vector3 position) => Create(position: position); + + /// + /// Creates a new with a specific position and shape. + /// + /// The position of the . + /// The shape of the collider. + /// The new . + public static InteractableToy Create(Vector3 position, ColliderShape shape) => Create(position: position, shape: shape); + + /// + /// Creates a new with a specific position, shape, and interaction duration. + /// + /// The position of the . + /// The shape of the collider. + /// How long the interaction takes. + /// The new . + public static InteractableToy Create(Vector3 position, ColliderShape shape, float duration) => Create(position: position, shape: shape, interactionDuration: duration); + + /// + /// Creates a new . + /// + /// The position of the . + /// The rotation of the . + /// The scale of the . + /// The shape of the collider. + /// How long the interaction takes. + /// Whether the object is locked. + /// Whether the should be initially spawned. + /// The new . + public static InteractableToy Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, ColliderShape shape = ColliderShape.Sphere, float interactionDuration = 1f, bool isLocked = false, bool spawn = true) + { + InteractableToy toy = new(Object.Instantiate(Prefab)) + { + Position = position ?? Vector3.zero, + Rotation = Quaternion.Euler(rotation ?? Vector3.zero), + Scale = scale ?? Vector3.one, + Shape = shape, + InteractionDuration = interactionDuration, + IsLocked = isLocked, + }; + + if (spawn) + toy.Spawn(); + + return toy; + } + + /// + /// Creates a new from a Transform. + /// + /// The transform to create this on. + /// The shape of the collider. + /// How long the interaction takes. + /// Whether the object is locked. + /// Whether the should be initially spawned. + /// Whether the should keep the same world position. + /// The new . + public static InteractableToy Create(Transform transform, ColliderShape shape = ColliderShape.Sphere, float interactionDuration = 1f, bool isLocked = false, bool spawn = true, bool worldPositionStays = true) + { + InteractableToy toy = new(Object.Instantiate(Prefab, transform, worldPositionStays)) + { + Position = transform.position, + Rotation = transform.rotation, + Scale = transform.localScale, + Shape = shape, + InteractionDuration = interactionDuration, + IsLocked = isLocked, + }; + + if (spawn) + toy.Spawn(); + + return toy; + } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Toys/Text.cs b/EXILED/Exiled.API/Features/Toys/Text.cs index fe2543a42f..737c6a5e4e 100644 --- a/EXILED/Exiled.API/Features/Toys/Text.cs +++ b/EXILED/Exiled.API/Features/Toys/Text.cs @@ -8,8 +8,10 @@ namespace Exiled.API.Features.Toys { using AdminToys; - using Enums; + + using Exiled.API.Enums; using Exiled.API.Interfaces; + using UnityEngine; /// @@ -51,5 +53,83 @@ public Vector2 DisplaySize get => Base.Network_displaySize; set => Base.Network_displaySize = value; } + + /// + /// Creates a new at the specified position. + /// + /// The position of the . + /// The text content to display. + /// The new . + public static Text Create(Vector3 position, string text) => Create(position: position, text: text, spawn: true); + + /// + /// Creates a new with a specific position, text, and display size. + /// + /// The position of the . + /// The text content to display. + /// The display size of the text. + /// The new . + public static Text Create(Vector3 position, string text, Vector2 displaySize) => Create(position: position, text: text, displaySize: displaySize, spawn: true); + + /// + /// Creates a new based on a Transform. + /// + /// The transform to spawn at. + /// The text content to display. + /// The new . + public static Text Create(Transform transform, string text) => Create(transform: transform, text: text, spawn: true); + + /// + /// Creates a new . + /// + /// The position of the . + /// The rotation of the . + /// The scale of the . + /// The text content to display. + /// The display size of the text. + /// Whether the should be initially spawned. + /// The new . + public static Text Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, string text = "Default Text", Vector2? displaySize = null, bool spawn = true) + { + Text textToy = new(Object.Instantiate(Prefab)) + { + Position = position ?? Vector3.zero, + Rotation = Quaternion.Euler(rotation ?? Vector3.zero), + Scale = scale ?? Vector3.one, + TextFormat = text, + DisplaySize = displaySize ?? Vector2.one, + }; + + if (spawn) + textToy.Spawn(); + + return textToy; + } + + /// + /// Creates a new from a Transform. + /// + /// The transform to create this on. + /// The text content to display. + /// The display size of the text. + /// Whether the should be initially spawned. + /// Whether the should keep the same world position. + /// The new . + public static Text Create(Transform transform, string text = "Default Text", Vector2? displaySize = null, bool spawn = true, bool worldPositionStays = true) + { + Text textToy = new(Object.Instantiate(Prefab, transform, worldPositionStays)) + { + Position = transform.position, + Rotation = transform.rotation, + Scale = transform.localScale, + TextFormat = text, + DisplaySize = displaySize ?? Vector2.one, + }; + + if (spawn) + textToy.Spawn(); + + return textToy; + } } } diff --git a/EXILED/Exiled.API/Features/Toys/Waypoint.cs b/EXILED/Exiled.API/Features/Toys/Waypoint.cs index 5f65aec1f2..fd52bf38d9 100644 --- a/EXILED/Exiled.API/Features/Toys/Waypoint.cs +++ b/EXILED/Exiled.API/Features/Toys/Waypoint.cs @@ -8,8 +8,10 @@ namespace Exiled.API.Features.Toys { using AdminToys; - using Enums; + + using Exiled.API.Enums; using Exiled.API.Interfaces; + using UnityEngine; /// @@ -61,9 +63,93 @@ public Bounds Bounds set => Base.NetworkBoundsSize = value.size; } + /// + /// Gets or sets the bounds size this waypoint encapsulates. + /// + public Vector3 BoundsSize + { + get => Base.NetworkBoundsSize; + set => Base.NetworkBoundsSize = value; + } + /// /// Gets the id of the Waypoint used for . /// public byte WaypointId => Base._waypointId; + + /// + /// Creates a new at the specified position. + /// + /// The position of the . + /// The new . + public static Waypoint Create(Vector3 position) => Create(position: position); + + /// + /// Creates a new with a specific position and size (bounds). + /// + /// The position of the . + /// The size of the bounds (Applied to NetworkBoundsSize). + /// The new . + public static Waypoint Create(Vector3 position, Vector3 size) => Create(position: position, scale: size); + + /// + /// Creates a new based on a Transform. + /// + /// The transform to spawn at (LocalScale is applied to Bounds). + /// The new . + public static Waypoint Create(Transform transform) => Create(transform: transform, spawn: true); + + /// + /// Creates a new . + /// + /// The position of the . + /// The rotation of the . + /// The size of the bounds (This is NOT localScale, it applies to NetworkBoundsSize). + /// The priority of the waypoint. + /// Whether to visualize the bounds. + /// Whether the should be initially spawned. + /// The new . + public static Waypoint Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, float priority = 0f, bool visualizeBounds = false, bool spawn = true) + { + Waypoint toy = new(Object.Instantiate(Prefab)) + { + Position = position ?? Vector3.zero, + Rotation = Quaternion.Euler(rotation ?? Vector3.zero), + BoundsSize = scale ?? Vector3.one * 255.9961f, + Priority = priority, + VisualizeBounds = visualizeBounds, + }; + + if (spawn) + toy.Spawn(); + + return toy; + } + + /// + /// Creates a new from a Transform. + /// + /// The transform to create this on. + /// The priority of the waypoint. + /// Whether to visualize the bounds. + /// Whether the should be initially spawned. + /// Whether the should keep the same world position. + /// The new . + public static Waypoint Create(Transform transform, float priority = 0f, bool visualizeBounds = false, bool spawn = true, bool worldPositionStays = true) + { + Waypoint toy = new(Object.Instantiate(Prefab, transform, worldPositionStays)) + { + Position = transform.position, + Rotation = transform.rotation, + BoundsSize = transform.localScale, + Priority = priority, + VisualizeBounds = visualizeBounds, + }; + + if (spawn) + toy.Spawn(); + + return toy; + } } -} +} \ No newline at end of file From 27effc03f286f4005f02da565041394133030e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20SAVA=C5=9E?= Date: Mon, 2 Feb 2026 17:24:02 +0300 Subject: [PATCH 02/11] fix infinite loops --- EXILED/Exiled.API/Features/Toys/CameraToy.cs | 4 ++-- EXILED/Exiled.API/Features/Toys/Capybara.cs | 4 ++-- EXILED/Exiled.API/Features/Toys/InteractableToy.cs | 4 ++-- EXILED/Exiled.API/Features/Toys/Waypoint.cs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/EXILED/Exiled.API/Features/Toys/CameraToy.cs b/EXILED/Exiled.API/Features/Toys/CameraToy.cs index 9d32920174..cfef185d43 100644 --- a/EXILED/Exiled.API/Features/Toys/CameraToy.cs +++ b/EXILED/Exiled.API/Features/Toys/CameraToy.cs @@ -109,7 +109,7 @@ public string Name /// The of the camera. /// The position of the camera. /// The new . - public static CameraToy Create(CameraType type, Vector3 position) => Create(type: type, position: position); + public static CameraToy Create(CameraType type, Vector3 position) => Create(type: type, position: position, spawn: true); /// /// Creates a new with a specified type and name. @@ -118,7 +118,7 @@ public string Name /// The position of the camera. /// The name (label) of the camera. /// The new . - public static CameraToy Create(CameraType type, Vector3 position, string name) => Create(type: type, position: position, name: name); + public static CameraToy Create(CameraType type, Vector3 position, string name) => Create(type: type, position: position, name: name, spawn: true); /// /// Creates a new . diff --git a/EXILED/Exiled.API/Features/Toys/Capybara.cs b/EXILED/Exiled.API/Features/Toys/Capybara.cs index ae45961a5c..4ebfc6714b 100644 --- a/EXILED/Exiled.API/Features/Toys/Capybara.cs +++ b/EXILED/Exiled.API/Features/Toys/Capybara.cs @@ -51,7 +51,7 @@ public bool Collidable /// /// The position of the . /// The new . - public static Capybara Create(Vector3 position) => Create(position: position); + public static Capybara Create(Vector3 position) => Create(position: position, spawn: true); /// /// Creates a new with a specific position and rotation. @@ -59,7 +59,7 @@ public bool Collidable /// The position of the . /// The rotation of the . /// The new . - public static Capybara Create(Vector3 position, Vector3 rotation) => Create(position: position, rotation: rotation); + public static Capybara Create(Vector3 position, Vector3 rotation) => Create(position: position, rotation: rotation, spawn: true); /// /// Creates a new based on a Transform. diff --git a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs index 39a6aae78a..ea4abda0db 100644 --- a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs +++ b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs @@ -70,7 +70,7 @@ public bool IsLocked /// /// The position of the . /// The new . - public static InteractableToy Create(Vector3 position) => Create(position: position); + public static InteractableToy Create(Vector3 position) => Create(position: position, spawn: true); /// /// Creates a new with a specific position and shape. @@ -78,7 +78,7 @@ public bool IsLocked /// The position of the . /// The shape of the collider. /// The new . - public static InteractableToy Create(Vector3 position, ColliderShape shape) => Create(position: position, shape: shape); + public static InteractableToy Create(Vector3 position, ColliderShape shape) => Create(position: position, shape: shape, spawn: true); /// /// Creates a new with a specific position, shape, and interaction duration. diff --git a/EXILED/Exiled.API/Features/Toys/Waypoint.cs b/EXILED/Exiled.API/Features/Toys/Waypoint.cs index fd52bf38d9..e5c63b2dad 100644 --- a/EXILED/Exiled.API/Features/Toys/Waypoint.cs +++ b/EXILED/Exiled.API/Features/Toys/Waypoint.cs @@ -82,7 +82,7 @@ public Vector3 BoundsSize /// /// The position of the . /// The new . - public static Waypoint Create(Vector3 position) => Create(position: position); + public static Waypoint Create(Vector3 position) => Create(position: position, spawn: true); /// /// Creates a new with a specific position and size (bounds). @@ -90,7 +90,7 @@ public Vector3 BoundsSize /// The position of the . /// The size of the bounds (Applied to NetworkBoundsSize). /// The new . - public static Waypoint Create(Vector3 position, Vector3 size) => Create(position: position, scale: size); + public static Waypoint Create(Vector3 position, Vector3 size) => Create(position: position, scale: size, spawn: true); /// /// Creates a new based on a Transform. From b288331d6cd51054a6892468f54fb045f007c72a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20SAVA=C5=9E?= Date: Mon, 2 Feb 2026 21:58:36 +0300 Subject: [PATCH 03/11] => to { get; } = --- EXILED/Exiled.API/Features/Toys/CameraToy.cs | 10 +++++----- EXILED/Exiled.API/Features/Toys/Capybara.cs | 2 +- EXILED/Exiled.API/Features/Toys/InteractableToy.cs | 2 +- EXILED/Exiled.API/Features/Toys/Text.cs | 2 +- EXILED/Exiled.API/Features/Toys/Waypoint.cs | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/EXILED/Exiled.API/Features/Toys/CameraToy.cs b/EXILED/Exiled.API/Features/Toys/CameraToy.cs index cfef185d43..5f37e9992f 100644 --- a/EXILED/Exiled.API/Features/Toys/CameraToy.cs +++ b/EXILED/Exiled.API/Features/Toys/CameraToy.cs @@ -31,27 +31,27 @@ internal CameraToy(Scp079CameraToy scp079CameraToy) /// /// Gets the prefab for EzArm Camera prefab. /// - public static Scp079CameraToy EzArmCameraPrefab => PrefabHelper.GetPrefab(PrefabType.EzArmCameraToy); + public static Scp079CameraToy EzArmCameraPrefab { get; } = PrefabHelper.GetPrefab(PrefabType.EzArmCameraToy); /// /// Gets the prefab for Ez Camera prefab. /// - public static Scp079CameraToy EzCameraPrefab => PrefabHelper.GetPrefab(PrefabType.EzCameraToy); + public static Scp079CameraToy EzCameraPrefab { get; } = PrefabHelper.GetPrefab(PrefabType.EzCameraToy); /// /// Gets the prefab for Hcz Camera prefab. /// - public static Scp079CameraToy HczCameraPrefab => PrefabHelper.GetPrefab(PrefabType.HczCameraToy); + public static Scp079CameraToy HczCameraPrefab { get; } = PrefabHelper.GetPrefab(PrefabType.HczCameraToy); /// /// Gets the prefab for Lcz Camera prefab. /// - public static Scp079CameraToy LczCameraPrefab => PrefabHelper.GetPrefab(PrefabType.LczCameraToy); + public static Scp079CameraToy LczCameraPrefab { get; } = PrefabHelper.GetPrefab(PrefabType.LczCameraToy); /// /// Gets the prefab for Sz Camera prefab. /// - public static Scp079CameraToy SzCameraPrefab => PrefabHelper.GetPrefab(PrefabType.SzCameraToy); + public static Scp079CameraToy SzCameraPrefab { get; } = PrefabHelper.GetPrefab(PrefabType.SzCameraToy); /// /// Gets the base . diff --git a/EXILED/Exiled.API/Features/Toys/Capybara.cs b/EXILED/Exiled.API/Features/Toys/Capybara.cs index 4ebfc6714b..ea5e19240f 100644 --- a/EXILED/Exiled.API/Features/Toys/Capybara.cs +++ b/EXILED/Exiled.API/Features/Toys/Capybara.cs @@ -30,7 +30,7 @@ internal Capybara(CapybaraToy capybaraToy) /// /// Gets the prefab. /// - public static CapybaraToy Prefab => PrefabHelper.GetPrefab(PrefabType.CapybaraToy); + public static CapybaraToy Prefab { get; } = PrefabHelper.GetPrefab(PrefabType.CapybaraToy); /// /// Gets the base . diff --git a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs index ea4abda0db..6572dbcc08 100644 --- a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs +++ b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs @@ -31,7 +31,7 @@ internal InteractableToy(InvisibleInteractableToy invisibleInteractableToy) /// /// Gets the prefab. /// - public static InvisibleInteractableToy Prefab => PrefabHelper.GetPrefab(PrefabType.InvisibleInteractableToy); + public static InvisibleInteractableToy Prefab { get; } = PrefabHelper.GetPrefab(PrefabType.InvisibleInteractableToy); /// /// Gets the base . diff --git a/EXILED/Exiled.API/Features/Toys/Text.cs b/EXILED/Exiled.API/Features/Toys/Text.cs index 737c6a5e4e..bffa6a2c60 100644 --- a/EXILED/Exiled.API/Features/Toys/Text.cs +++ b/EXILED/Exiled.API/Features/Toys/Text.cs @@ -29,7 +29,7 @@ internal Text(TextToy textToy) /// /// Gets the prefab. /// - public static TextToy Prefab => PrefabHelper.GetPrefab(PrefabType.TextToy); + public static TextToy Prefab { get; } = PrefabHelper.GetPrefab(PrefabType.TextToy); /// /// Gets the base . diff --git a/EXILED/Exiled.API/Features/Toys/Waypoint.cs b/EXILED/Exiled.API/Features/Toys/Waypoint.cs index e5c63b2dad..4c507d2255 100644 --- a/EXILED/Exiled.API/Features/Toys/Waypoint.cs +++ b/EXILED/Exiled.API/Features/Toys/Waypoint.cs @@ -29,7 +29,7 @@ internal Waypoint(WaypointToy waypointToy) /// /// Gets the prefab. /// - public static WaypointToy Prefab => PrefabHelper.GetPrefab(PrefabType.WaypointToy); + public static WaypointToy Prefab { get; } = PrefabHelper.GetPrefab(PrefabType.WaypointToy); /// /// Gets the base . From 87a213eaaa54d95c7d04f7c8b923f1473649594d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20SAVA=C5=9E?= Date: Mon, 2 Feb 2026 23:14:03 +0300 Subject: [PATCH 04/11] world positon to local postion --- EXILED/Exiled.API/Features/Toys/CameraToy.cs | 7 ++++--- EXILED/Exiled.API/Features/Toys/Capybara.cs | 10 ++++------ EXILED/Exiled.API/Features/Toys/InteractableToy.cs | 12 ++++++------ EXILED/Exiled.API/Features/Toys/Text.cs | 7 ++++--- EXILED/Exiled.API/Features/Toys/Waypoint.cs | 11 ++++++----- 5 files changed, 24 insertions(+), 23 deletions(-) diff --git a/EXILED/Exiled.API/Features/Toys/CameraToy.cs b/EXILED/Exiled.API/Features/Toys/CameraToy.cs index 5f37e9992f..9abedf23f4 100644 --- a/EXILED/Exiled.API/Features/Toys/CameraToy.cs +++ b/EXILED/Exiled.API/Features/Toys/CameraToy.cs @@ -148,12 +148,13 @@ public static CameraToy Create(CameraType type, Vector3? position = null, Vector CameraToy toy = new(Object.Instantiate(prefab)) { - Position = position ?? Vector3.zero, - Rotation = Quaternion.Euler(rotation ?? Vector3.zero), - Scale = scale ?? Vector3.one, Name = name, }; + toy.Transform.localPosition = position ?? Vector3.zero; + toy.Transform.localRotation = Quaternion.Euler(rotation ?? Vector3.zero); + toy.Transform.localScale = scale ?? Vector3.one; + if (verticalConstraint.HasValue) toy.VerticalConstraint = verticalConstraint.Value; diff --git a/EXILED/Exiled.API/Features/Toys/Capybara.cs b/EXILED/Exiled.API/Features/Toys/Capybara.cs index ea5e19240f..663f00168d 100644 --- a/EXILED/Exiled.API/Features/Toys/Capybara.cs +++ b/EXILED/Exiled.API/Features/Toys/Capybara.cs @@ -81,12 +81,13 @@ public static Capybara Create(Vector3? position = null, Vector3? rotation = null { Capybara toy = new(Object.Instantiate(Prefab)) { - Position = position ?? Vector3.zero, - Rotation = Quaternion.Euler(rotation ?? Vector3.zero), - Scale = scale ?? Vector3.one, Collidable = collidable, }; + toy.Transform.localPosition = position ?? Vector3.zero; + toy.Transform.localRotation = Quaternion.Euler(rotation ?? Vector3.zero); + toy.Transform.localScale = scale ?? Vector3.one; + if (spawn) toy.Spawn(); @@ -105,9 +106,6 @@ public static Capybara Create(Transform transform, bool collidable = true, bool { Capybara toy = new(Object.Instantiate(Prefab, transform, worldPositionStays)) { - Position = transform.position, - Rotation = transform.rotation, - Scale = transform.localScale, Collidable = collidable, }; diff --git a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs index 6572dbcc08..a1fe2a05ed 100644 --- a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs +++ b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs @@ -12,6 +12,8 @@ namespace Exiled.API.Features.Toys using Exiled.API.Enums; using Exiled.API.Interfaces; + using LabApi.Features.Wrappers; + using UnityEngine; using static AdminToys.InvisibleInteractableToy; @@ -104,14 +106,15 @@ public static InteractableToy Create(Vector3? position = null, Vector3? rotation { InteractableToy toy = new(Object.Instantiate(Prefab)) { - Position = position ?? Vector3.zero, - Rotation = Quaternion.Euler(rotation ?? Vector3.zero), - Scale = scale ?? Vector3.one, Shape = shape, InteractionDuration = interactionDuration, IsLocked = isLocked, }; + toy.Transform.localPosition = position ?? Vector3.zero; + toy.Transform.localRotation = Quaternion.Euler(rotation ?? Vector3.zero); + toy.Transform.localScale = scale ?? Vector3.one; + if (spawn) toy.Spawn(); @@ -132,9 +135,6 @@ public static InteractableToy Create(Transform transform, ColliderShape shape = { InteractableToy toy = new(Object.Instantiate(Prefab, transform, worldPositionStays)) { - Position = transform.position, - Rotation = transform.rotation, - Scale = transform.localScale, Shape = shape, InteractionDuration = interactionDuration, IsLocked = isLocked, diff --git a/EXILED/Exiled.API/Features/Toys/Text.cs b/EXILED/Exiled.API/Features/Toys/Text.cs index bffa6a2c60..43288676a8 100644 --- a/EXILED/Exiled.API/Features/Toys/Text.cs +++ b/EXILED/Exiled.API/Features/Toys/Text.cs @@ -100,6 +100,10 @@ public static Text Create(Vector3? position = null, Vector3? rotation = null, Ve DisplaySize = displaySize ?? Vector2.one, }; + textToy.Transform.localPosition = position ?? Vector3.zero; + textToy.Transform.localRotation = Quaternion.Euler(rotation ?? Vector3.zero); + textToy.Transform.localScale = scale ?? Vector3.one; + if (spawn) textToy.Spawn(); @@ -119,9 +123,6 @@ public static Text Create(Transform transform, string text = "Default Text", Vec { Text textToy = new(Object.Instantiate(Prefab, transform, worldPositionStays)) { - Position = transform.position, - Rotation = transform.rotation, - Scale = transform.localScale, TextFormat = text, DisplaySize = displaySize ?? Vector2.one, }; diff --git a/EXILED/Exiled.API/Features/Toys/Waypoint.cs b/EXILED/Exiled.API/Features/Toys/Waypoint.cs index 4c507d2255..db8a65ecdf 100644 --- a/EXILED/Exiled.API/Features/Toys/Waypoint.cs +++ b/EXILED/Exiled.API/Features/Toys/Waypoint.cs @@ -12,6 +12,8 @@ namespace Exiled.API.Features.Toys using Exiled.API.Enums; using Exiled.API.Interfaces; + using LabApi.Features.Wrappers; + using UnityEngine; /// @@ -113,13 +115,14 @@ public static Waypoint Create(Vector3? position = null, Vector3? rotation = null { Waypoint toy = new(Object.Instantiate(Prefab)) { - Position = position ?? Vector3.zero, - Rotation = Quaternion.Euler(rotation ?? Vector3.zero), BoundsSize = scale ?? Vector3.one * 255.9961f, - Priority = priority, VisualizeBounds = visualizeBounds, + Priority = priority, }; + toy.Transform.localPosition = position ?? Vector3.zero; + toy.Transform.localRotation = Quaternion.Euler(rotation ?? Vector3.zero); + if (spawn) toy.Spawn(); @@ -139,8 +142,6 @@ public static Waypoint Create(Transform transform, float priority = 0f, bool vis { Waypoint toy = new(Object.Instantiate(Prefab, transform, worldPositionStays)) { - Position = transform.position, - Rotation = transform.rotation, BoundsSize = transform.localScale, Priority = priority, VisualizeBounds = visualizeBounds, From cee287b568875427db970743141f95cae0f59cb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20SAVA=C5=9E?= Date: Mon, 2 Feb 2026 23:14:30 +0300 Subject: [PATCH 05/11] m --- EXILED/Exiled.API/Features/Toys/Waypoint.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/EXILED/Exiled.API/Features/Toys/Waypoint.cs b/EXILED/Exiled.API/Features/Toys/Waypoint.cs index db8a65ecdf..9c14963fa4 100644 --- a/EXILED/Exiled.API/Features/Toys/Waypoint.cs +++ b/EXILED/Exiled.API/Features/Toys/Waypoint.cs @@ -12,8 +12,6 @@ namespace Exiled.API.Features.Toys using Exiled.API.Enums; using Exiled.API.Interfaces; - using LabApi.Features.Wrappers; - using UnityEngine; /// From 83c532a8baa5fc81c9386445a57c84d4086eefdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20SAVA=C5=9E?= Date: Mon, 2 Feb 2026 23:35:55 +0300 Subject: [PATCH 06/11] one core create --- EXILED/Exiled.API/Features/Toys/Capybara.cs | 45 +++++--------- .../Features/Toys/InteractableToy.cs | 58 +++++++++---------- EXILED/Exiled.API/Features/Toys/Text.cs | 57 ++++++++---------- EXILED/Exiled.API/Features/Toys/Waypoint.cs | 54 +++++------------ 4 files changed, 79 insertions(+), 135 deletions(-) diff --git a/EXILED/Exiled.API/Features/Toys/Capybara.cs b/EXILED/Exiled.API/Features/Toys/Capybara.cs index 663f00168d..18779c662e 100644 --- a/EXILED/Exiled.API/Features/Toys/Capybara.cs +++ b/EXILED/Exiled.API/Features/Toys/Capybara.cs @@ -66,48 +66,33 @@ public bool Collidable /// /// The transform to spawn at. /// The new . - public static Capybara Create(Transform transform) => Create(transform: transform, spawn: true); + public static Capybara Create(Transform transform) => Create(parent: transform, spawn: true); /// /// Creates a new . /// - /// The position of the . - /// The rotation of the . - /// The scale of the . + /// The local position of the . + /// The local rotation of the . + /// The local scale of the . + /// The transform to create this on. /// Whether the capybara has collision enabled. /// Whether the should be initially spawned. + /// Whether the should keep the same world position. /// The new . - public static Capybara Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, bool collidable = true, bool spawn = true) + public static Capybara Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, Transform parent = null, bool collidable = true, bool spawn = true, bool worldPositionStays = true) { - Capybara toy = new(Object.Instantiate(Prefab)) - { - Collidable = collidable, - }; + Capybara toy = parent ? new(Object.Instantiate(Prefab, parent, worldPositionStays)) : new(Object.Instantiate(Prefab)); - toy.Transform.localPosition = position ?? Vector3.zero; - toy.Transform.localRotation = Quaternion.Euler(rotation ?? Vector3.zero); - toy.Transform.localScale = scale ?? Vector3.one; + if (position.HasValue) + toy.Transform.localPosition = position.Value; - if (spawn) - toy.Spawn(); + if (rotation.HasValue) + toy.Transform.localRotation = Quaternion.Euler(rotation.Value); - return toy; - } + if (scale.HasValue) + toy.Transform.localScale = scale.Value; - /// - /// Creates a new from a Transform. - /// - /// The transform to create this on. - /// Whether the capybara has collision enabled. - /// Whether the should be initially spawned. - /// Whether the should keep the same world position. - /// The new . - public static Capybara Create(Transform transform, bool collidable = true, bool spawn = true, bool worldPositionStays = true) - { - Capybara toy = new(Object.Instantiate(Prefab, transform, worldPositionStays)) - { - Collidable = collidable, - }; + toy.Collidable = collidable; if (spawn) toy.Spawn(); diff --git a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs index a1fe2a05ed..a1664ecf51 100644 --- a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs +++ b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs @@ -89,56 +89,50 @@ public bool IsLocked /// The shape of the collider. /// How long the interaction takes. /// The new . - public static InteractableToy Create(Vector3 position, ColliderShape shape, float duration) => Create(position: position, shape: shape, interactionDuration: duration); + public static InteractableToy Create(Vector3 position, ColliderShape shape, float duration) => Create(position: position, shape: shape, interactionDuration: duration, spawn: true); /// - /// Creates a new . + /// Creates a new from a Transform. /// - /// The position of the . - /// The rotation of the . - /// The scale of the . + /// The transform to create this on. /// The shape of the collider. /// How long the interaction takes. /// Whether the object is locked. /// Whether the should be initially spawned. + /// Whether the should keep the same world position. /// The new . - public static InteractableToy Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, ColliderShape shape = ColliderShape.Sphere, float interactionDuration = 1f, bool isLocked = false, bool spawn = true) - { - InteractableToy toy = new(Object.Instantiate(Prefab)) - { - Shape = shape, - InteractionDuration = interactionDuration, - IsLocked = isLocked, - }; - - toy.Transform.localPosition = position ?? Vector3.zero; - toy.Transform.localRotation = Quaternion.Euler(rotation ?? Vector3.zero); - toy.Transform.localScale = scale ?? Vector3.one; - - if (spawn) - toy.Spawn(); - - return toy; - } + public static InteractableToy Create(Transform transform, ColliderShape shape = ColliderShape.Sphere, float interactionDuration = 1f, bool isLocked = false, bool spawn = true, bool worldPositionStays = true) + => Create(parent: transform, shape: shape, interactionDuration: interactionDuration, isLocked: isLocked, spawn: spawn, worldPositionStays: worldPositionStays); /// - /// Creates a new from a Transform. + /// Creates a new . /// - /// The transform to create this on. + /// The local position of the . + /// The local rotation of the . + /// The local scale of the . /// The shape of the collider. /// How long the interaction takes. /// Whether the object is locked. + /// The transform to create this on. /// Whether the should be initially spawned. /// Whether the should keep the same world position. /// The new . - public static InteractableToy Create(Transform transform, ColliderShape shape = ColliderShape.Sphere, float interactionDuration = 1f, bool isLocked = false, bool spawn = true, bool worldPositionStays = true) + public static InteractableToy Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, ColliderShape shape = ColliderShape.Sphere, float interactionDuration = 1f, bool isLocked = false, Transform parent = null, bool spawn = true, bool worldPositionStays = true) { - InteractableToy toy = new(Object.Instantiate(Prefab, transform, worldPositionStays)) - { - Shape = shape, - InteractionDuration = interactionDuration, - IsLocked = isLocked, - }; + InteractableToy toy = parent ? new(Object.Instantiate(Prefab, parent, worldPositionStays)) : new(Object.Instantiate(Prefab)); + + if (position.HasValue) + toy.Transform.localPosition = position.Value; + + if (rotation.HasValue) + toy.Transform.localRotation = Quaternion.Euler(rotation.Value); + + if (scale.HasValue) + toy.Transform.localScale = scale.Value; + + toy.Shape = shape; + toy.InteractionDuration = interactionDuration; + toy.IsLocked = isLocked; if (spawn) toy.Spawn(); diff --git a/EXILED/Exiled.API/Features/Toys/Text.cs b/EXILED/Exiled.API/Features/Toys/Text.cs index 43288676a8..38b72602f2 100644 --- a/EXILED/Exiled.API/Features/Toys/Text.cs +++ b/EXILED/Exiled.API/Features/Toys/Text.cs @@ -77,55 +77,44 @@ public Vector2 DisplaySize /// The transform to spawn at. /// The text content to display. /// The new . - public static Text Create(Transform transform, string text) => Create(transform: transform, text: text, spawn: true); + public static Text Create(Transform transform, string text) => Create(parent: transform, text: text, spawn: true); /// - /// Creates a new . + /// Creates a new based on a Transform with custom size. /// - /// The position of the . - /// The rotation of the . - /// The scale of the . + /// The transform to spawn at. /// The text content to display. /// The display size of the text. - /// Whether the should be initially spawned. /// The new . - public static Text Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, string text = "Default Text", Vector2? displaySize = null, bool spawn = true) - { - Text textToy = new(Object.Instantiate(Prefab)) - { - Position = position ?? Vector3.zero, - Rotation = Quaternion.Euler(rotation ?? Vector3.zero), - Scale = scale ?? Vector3.one, - TextFormat = text, - DisplaySize = displaySize ?? Vector2.one, - }; - - textToy.Transform.localPosition = position ?? Vector3.zero; - textToy.Transform.localRotation = Quaternion.Euler(rotation ?? Vector3.zero); - textToy.Transform.localScale = scale ?? Vector3.one; - - if (spawn) - textToy.Spawn(); - - return textToy; - } + public static Text Create(Transform transform, string text, Vector2 displaySize) => Create(parent: transform, text: text, displaySize: displaySize, spawn: true); /// - /// Creates a new from a Transform. + /// Creates a new . /// - /// The transform to create this on. + /// The local position of the . + /// The local rotation of the . + /// The local scale of the . /// The text content to display. /// The display size of the text. + /// The transform to create this on. /// Whether the should be initially spawned. /// Whether the should keep the same world position. /// The new . - public static Text Create(Transform transform, string text = "Default Text", Vector2? displaySize = null, bool spawn = true, bool worldPositionStays = true) + public static Text Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, string text = "Default Text", Vector2? displaySize = null, Transform parent = null, bool spawn = true, bool worldPositionStays = true) { - Text textToy = new(Object.Instantiate(Prefab, transform, worldPositionStays)) - { - TextFormat = text, - DisplaySize = displaySize ?? Vector2.one, - }; + Text textToy = parent ? new(Object.Instantiate(Prefab, parent, worldPositionStays)) : new(Object.Instantiate(Prefab)); + + if (position.HasValue) + textToy.Transform.localPosition = position.Value; + + if (rotation.HasValue) + textToy.Transform.localRotation = Quaternion.Euler(rotation.Value); + + if (scale.HasValue) + textToy.Transform.localScale = scale.Value; + + textToy.TextFormat = text; + textToy.DisplaySize = displaySize ?? Vector2.one; if (spawn) textToy.Spawn(); diff --git a/EXILED/Exiled.API/Features/Toys/Waypoint.cs b/EXILED/Exiled.API/Features/Toys/Waypoint.cs index 9c14963fa4..802f4726ff 100644 --- a/EXILED/Exiled.API/Features/Toys/Waypoint.cs +++ b/EXILED/Exiled.API/Features/Toys/Waypoint.cs @@ -7,6 +7,8 @@ namespace Exiled.API.Features.Toys { + using System.Drawing; + using AdminToys; using Exiled.API.Enums; @@ -77,13 +79,6 @@ public Vector3 BoundsSize /// public byte WaypointId => Base._waypointId; - /// - /// Creates a new at the specified position. - /// - /// The position of the . - /// The new . - public static Waypoint Create(Vector3 position) => Create(position: position, spawn: true); - /// /// Creates a new with a specific position and size (bounds). /// @@ -96,8 +91,9 @@ public Vector3 BoundsSize /// Creates a new based on a Transform. /// /// The transform to spawn at (LocalScale is applied to Bounds). + /// The size of the bounds (Applied to NetworkBoundsSize). /// The new . - public static Waypoint Create(Transform transform) => Create(transform: transform, spawn: true); + public static Waypoint Create(Transform transform, Vector3 size) => Create(parent: transform, scale: size, spawn: true); /// /// Creates a new . @@ -105,45 +101,25 @@ public Vector3 BoundsSize /// The position of the . /// The rotation of the . /// The size of the bounds (This is NOT localScale, it applies to NetworkBoundsSize). + /// The transform to create this on. /// The priority of the waypoint. /// Whether to visualize the bounds. /// Whether the should be initially spawned. + /// Whether the should keep the same world position. /// The new . - public static Waypoint Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, float priority = 0f, bool visualizeBounds = false, bool spawn = true) + public static Waypoint Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, Transform parent = null, float priority = 0f, bool visualizeBounds = false, bool spawn = true, bool worldPositionStays = true) { - Waypoint toy = new(Object.Instantiate(Prefab)) - { - BoundsSize = scale ?? Vector3.one * 255.9961f, - VisualizeBounds = visualizeBounds, - Priority = priority, - }; + Waypoint toy = parent ? new(Object.Instantiate(Prefab, parent, worldPositionStays)) : new(Object.Instantiate(Prefab)); - toy.Transform.localPosition = position ?? Vector3.zero; - toy.Transform.localRotation = Quaternion.Euler(rotation ?? Vector3.zero); + if (position.HasValue) + toy.Transform.localPosition = position.Value; - if (spawn) - toy.Spawn(); + if (rotation.HasValue) + toy.Transform.localRotation = Quaternion.Euler(rotation.Value); - return toy; - } - - /// - /// Creates a new from a Transform. - /// - /// The transform to create this on. - /// The priority of the waypoint. - /// Whether to visualize the bounds. - /// Whether the should be initially spawned. - /// Whether the should keep the same world position. - /// The new . - public static Waypoint Create(Transform transform, float priority = 0f, bool visualizeBounds = false, bool spawn = true, bool worldPositionStays = true) - { - Waypoint toy = new(Object.Instantiate(Prefab, transform, worldPositionStays)) - { - BoundsSize = transform.localScale, - Priority = priority, - VisualizeBounds = visualizeBounds, - }; + toy.BoundsSize = scale ?? Vector3.one * 255.9961f; + toy.VisualizeBounds = visualizeBounds; + toy.Priority = priority; if (spawn) toy.Spawn(); From 2808948ff49387e871b96f437cd94c11db801d59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20SAVA=C5=9E?= Date: Tue, 3 Feb 2026 00:00:30 +0300 Subject: [PATCH 07/11] someth'ng --- EXILED/Exiled.API/Features/Toys/CameraToy.cs | 21 ++++++------ EXILED/Exiled.API/Features/Toys/Capybara.cs | 27 ++++++---------- .../Features/Toys/InteractableToy.cs | 32 +++++++------------ EXILED/Exiled.API/Features/Toys/Text.cs | 21 ++++-------- EXILED/Exiled.API/Features/Toys/Waypoint.cs | 23 ++++++------- 5 files changed, 48 insertions(+), 76 deletions(-) diff --git a/EXILED/Exiled.API/Features/Toys/CameraToy.cs b/EXILED/Exiled.API/Features/Toys/CameraToy.cs index 9abedf23f4..e2ba11f337 100644 --- a/EXILED/Exiled.API/Features/Toys/CameraToy.cs +++ b/EXILED/Exiled.API/Features/Toys/CameraToy.cs @@ -107,7 +107,7 @@ public string Name /// Creates a new with a specified type. /// /// The of the camera. - /// The position of the camera. + /// The local position of the camera. /// The new . public static CameraToy Create(CameraType type, Vector3 position) => Create(type: type, position: position, spawn: true); @@ -115,7 +115,7 @@ public string Name /// Creates a new with a specified type and name. /// /// The of the camera. - /// The position of the camera. + /// The local position of the camera. /// The name (label) of the camera. /// The new . public static CameraToy Create(CameraType type, Vector3 position, string name) => Create(type: type, position: position, name: name, spawn: true); @@ -123,10 +123,11 @@ public string Name /// /// Creates a new . /// + /// The transform to create this on. /// The of the camera. - /// The position of the camera. - /// The rotation of the camera. - /// The scale of the camera. + /// The local position of the camera. + /// The local rotation of the camera. + /// The local scale of the camera. /// The name (label) of the camera. /// The room associated with this camera. /// The vertical limits. Leave null to use prefab default. @@ -134,7 +135,7 @@ public string Name /// The zoom limits. Leave null to use prefab default. /// Whether the camera should be initially spawned. /// The new . - public static CameraToy Create(CameraType type, Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, string name = "New Camera", Room room = null, Vector2? verticalConstraint = null, Vector2? horizontalConstraint = null, Vector2? zoomConstraint = null, bool spawn = true) + public static CameraToy Create(Transform parent = null, CameraType type = CameraType.EzArmCameraToy, Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, string name = "New Camera", Room room = null, Vector2? verticalConstraint = null, Vector2? horizontalConstraint = null, Vector2? zoomConstraint = null, bool spawn = true) { Scp079CameraToy prefab = type switch { @@ -146,13 +147,11 @@ public static CameraToy Create(CameraType type, Vector3? position = null, Vector _ => EzArmCameraPrefab }; - CameraToy toy = new(Object.Instantiate(prefab)) - { - Name = name, - }; + CameraToy toy = parent ? new(Object.Instantiate(prefab, parent)) : new(Object.Instantiate(prefab)); + toy.Name = name; toy.Transform.localPosition = position ?? Vector3.zero; - toy.Transform.localRotation = Quaternion.Euler(rotation ?? Vector3.zero); + toy.Transform.localRotation = rotation ?? Quaternion.identity; toy.Transform.localScale = scale ?? Vector3.one; if (verticalConstraint.HasValue) diff --git a/EXILED/Exiled.API/Features/Toys/Capybara.cs b/EXILED/Exiled.API/Features/Toys/Capybara.cs index 18779c662e..589e674ce6 100644 --- a/EXILED/Exiled.API/Features/Toys/Capybara.cs +++ b/EXILED/Exiled.API/Features/Toys/Capybara.cs @@ -49,17 +49,17 @@ public bool Collidable /// /// Creates a new at the specified position. /// - /// The position of the . + /// The local position of the . /// The new . public static Capybara Create(Vector3 position) => Create(position: position, spawn: true); /// /// Creates a new with a specific position and rotation. /// - /// The position of the . - /// The rotation of the . + /// The local position of the . + /// The local rotation of the . /// The new . - public static Capybara Create(Vector3 position, Vector3 rotation) => Create(position: position, rotation: rotation, spawn: true); + public static Capybara Create(Vector3 position, Quaternion rotation) => Create(position: position, rotation: rotation, spawn: true); /// /// Creates a new based on a Transform. @@ -71,28 +71,21 @@ public bool Collidable /// /// Creates a new . /// + /// The transform to create this on. /// The local position of the . /// The local rotation of the . /// The local scale of the . - /// The transform to create this on. /// Whether the capybara has collision enabled. /// Whether the should be initially spawned. - /// Whether the should keep the same world position. /// The new . - public static Capybara Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, Transform parent = null, bool collidable = true, bool spawn = true, bool worldPositionStays = true) + public static Capybara Create(Transform parent = null, Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, bool collidable = true, bool spawn = true) { - Capybara toy = parent ? new(Object.Instantiate(Prefab, parent, worldPositionStays)) : new(Object.Instantiate(Prefab)); - - if (position.HasValue) - toy.Transform.localPosition = position.Value; - - if (rotation.HasValue) - toy.Transform.localRotation = Quaternion.Euler(rotation.Value); - - if (scale.HasValue) - toy.Transform.localScale = scale.Value; + Capybara toy = parent ? new(Object.Instantiate(Prefab, parent)) : new(Object.Instantiate(Prefab)); toy.Collidable = collidable; + toy.Transform.localPosition = position ?? Vector3.one; + toy.Transform.localRotation = rotation ?? Quaternion.identity; + toy.Transform.localScale = scale ?? Vector3.one; if (spawn) toy.Spawn(); diff --git a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs index a1664ecf51..cf8ce95b1f 100644 --- a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs +++ b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs @@ -70,14 +70,14 @@ public bool IsLocked /// /// Creates a new at the specified position. /// - /// The position of the . + /// The local position of the . /// The new . public static InteractableToy Create(Vector3 position) => Create(position: position, spawn: true); /// /// Creates a new with a specific position and shape. /// - /// The position of the . + /// The local position of the . /// The shape of the collider. /// The new . public static InteractableToy Create(Vector3 position, ColliderShape shape) => Create(position: position, shape: shape, spawn: true); @@ -85,7 +85,7 @@ public bool IsLocked /// /// Creates a new with a specific position, shape, and interaction duration. /// - /// The position of the . + /// The local position of the . /// The shape of the collider. /// How long the interaction takes. /// The new . @@ -99,40 +99,32 @@ public bool IsLocked /// How long the interaction takes. /// Whether the object is locked. /// Whether the should be initially spawned. - /// Whether the should keep the same world position. /// The new . - public static InteractableToy Create(Transform transform, ColliderShape shape = ColliderShape.Sphere, float interactionDuration = 1f, bool isLocked = false, bool spawn = true, bool worldPositionStays = true) - => Create(parent: transform, shape: shape, interactionDuration: interactionDuration, isLocked: isLocked, spawn: spawn, worldPositionStays: worldPositionStays); + public static InteractableToy Create(Transform transform, ColliderShape shape = ColliderShape.Sphere, float interactionDuration = 1f, bool isLocked = false, bool spawn = true) + => Create(parent: transform, shape: shape, interactionDuration: interactionDuration, isLocked: isLocked, spawn: spawn); /// /// Creates a new . /// + /// The transform to create this on. /// The local position of the . /// The local rotation of the . /// The local scale of the . /// The shape of the collider. /// How long the interaction takes. /// Whether the object is locked. - /// The transform to create this on. /// Whether the should be initially spawned. - /// Whether the should keep the same world position. /// The new . - public static InteractableToy Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, ColliderShape shape = ColliderShape.Sphere, float interactionDuration = 1f, bool isLocked = false, Transform parent = null, bool spawn = true, bool worldPositionStays = true) + public static InteractableToy Create(Transform parent = null, Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, ColliderShape shape = ColliderShape.Sphere, float interactionDuration = 1f, bool isLocked = false, bool spawn = true) { - InteractableToy toy = parent ? new(Object.Instantiate(Prefab, parent, worldPositionStays)) : new(Object.Instantiate(Prefab)); - - if (position.HasValue) - toy.Transform.localPosition = position.Value; - - if (rotation.HasValue) - toy.Transform.localRotation = Quaternion.Euler(rotation.Value); - - if (scale.HasValue) - toy.Transform.localScale = scale.Value; + InteractableToy toy = parent ? new(Object.Instantiate(Prefab, parent)) : new(Object.Instantiate(Prefab)); toy.Shape = shape; - toy.InteractionDuration = interactionDuration; toy.IsLocked = isLocked; + toy.InteractionDuration = interactionDuration; + toy.Transform.localPosition = position ?? Vector3.zero; + toy.Transform.localRotation = rotation ?? Quaternion.identity; + toy.Transform.localScale = scale ?? Vector3.one; if (spawn) toy.Spawn(); diff --git a/EXILED/Exiled.API/Features/Toys/Text.cs b/EXILED/Exiled.API/Features/Toys/Text.cs index 38b72602f2..fb95a46b26 100644 --- a/EXILED/Exiled.API/Features/Toys/Text.cs +++ b/EXILED/Exiled.API/Features/Toys/Text.cs @@ -57,7 +57,7 @@ public Vector2 DisplaySize /// /// Creates a new at the specified position. /// - /// The position of the . + /// The local position of the . /// The text content to display. /// The new . public static Text Create(Vector3 position, string text) => Create(position: position, text: text, spawn: true); @@ -65,7 +65,7 @@ public Vector2 DisplaySize /// /// Creates a new with a specific position, text, and display size. /// - /// The position of the . + /// The local position of the . /// The text content to display. /// The display size of the text. /// The new . @@ -98,23 +98,16 @@ public Vector2 DisplaySize /// The display size of the text. /// The transform to create this on. /// Whether the should be initially spawned. - /// Whether the should keep the same world position. /// The new . - public static Text Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, string text = "Default Text", Vector2? displaySize = null, Transform parent = null, bool spawn = true, bool worldPositionStays = true) + public static Text Create(Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, string text = "Default Text", Vector2? displaySize = null, Transform parent = null, bool spawn = true) { - Text textToy = parent ? new(Object.Instantiate(Prefab, parent, worldPositionStays)) : new(Object.Instantiate(Prefab)); - - if (position.HasValue) - textToy.Transform.localPosition = position.Value; - - if (rotation.HasValue) - textToy.Transform.localRotation = Quaternion.Euler(rotation.Value); - - if (scale.HasValue) - textToy.Transform.localScale = scale.Value; + Text textToy = parent ? new(Object.Instantiate(Prefab, parent)) : new(Object.Instantiate(Prefab)); textToy.TextFormat = text; textToy.DisplaySize = displaySize ?? Vector2.one; + textToy.Transform.localPosition = position ?? Vector3.one; + textToy.Transform.localRotation = rotation ?? Quaternion.identity; + textToy.Transform.localScale = scale ?? Vector3.one; if (spawn) textToy.Spawn(); diff --git a/EXILED/Exiled.API/Features/Toys/Waypoint.cs b/EXILED/Exiled.API/Features/Toys/Waypoint.cs index 802f4726ff..cc9b05dc3e 100644 --- a/EXILED/Exiled.API/Features/Toys/Waypoint.cs +++ b/EXILED/Exiled.API/Features/Toys/Waypoint.cs @@ -98,28 +98,23 @@ public Vector3 BoundsSize /// /// Creates a new . /// - /// The position of the . - /// The rotation of the . - /// The size of the bounds (This is NOT localScale, it applies to NetworkBoundsSize). /// The transform to create this on. + /// The local position of the . + /// The local rotation of the . + /// The size of the bounds (This is NOT localScale, it applies to NetworkBoundsSize). /// The priority of the waypoint. /// Whether to visualize the bounds. /// Whether the should be initially spawned. - /// Whether the should keep the same world position. /// The new . - public static Waypoint Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, Transform parent = null, float priority = 0f, bool visualizeBounds = false, bool spawn = true, bool worldPositionStays = true) + public static Waypoint Create(Transform parent = null, Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, float priority = 0f, bool visualizeBounds = false, bool spawn = true) { - Waypoint toy = parent ? new(Object.Instantiate(Prefab, parent, worldPositionStays)) : new(Object.Instantiate(Prefab)); - - if (position.HasValue) - toy.Transform.localPosition = position.Value; - - if (rotation.HasValue) - toy.Transform.localRotation = Quaternion.Euler(rotation.Value); + Waypoint toy = parent ? new(Object.Instantiate(Prefab, parent)) : new(Object.Instantiate(Prefab)); - toy.BoundsSize = scale ?? Vector3.one * 255.9961f; - toy.VisualizeBounds = visualizeBounds; toy.Priority = priority; + toy.VisualizeBounds = visualizeBounds; + toy.Transform.localPosition = position ?? Vector3.one; + toy.Transform.localRotation = rotation ?? Quaternion.identity; + toy.BoundsSize = scale ?? Vector3.one * 255.9961f; if (spawn) toy.Spawn(); From c94bb94702adfa608addf8bf9fc2132f027e1e3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20SAVA=C5=9E?= Date: Tue, 3 Feb 2026 00:03:59 +0300 Subject: [PATCH 08/11] zero --- EXILED/Exiled.API/Features/Toys/Capybara.cs | 2 +- EXILED/Exiled.API/Features/Toys/Text.cs | 2 +- EXILED/Exiled.API/Features/Toys/Waypoint.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/EXILED/Exiled.API/Features/Toys/Capybara.cs b/EXILED/Exiled.API/Features/Toys/Capybara.cs index 589e674ce6..de57c1575f 100644 --- a/EXILED/Exiled.API/Features/Toys/Capybara.cs +++ b/EXILED/Exiled.API/Features/Toys/Capybara.cs @@ -83,7 +83,7 @@ public static Capybara Create(Transform parent = null, Vector3? position = null, Capybara toy = parent ? new(Object.Instantiate(Prefab, parent)) : new(Object.Instantiate(Prefab)); toy.Collidable = collidable; - toy.Transform.localPosition = position ?? Vector3.one; + toy.Transform.localPosition = position ?? Vector3.zero; toy.Transform.localRotation = rotation ?? Quaternion.identity; toy.Transform.localScale = scale ?? Vector3.one; diff --git a/EXILED/Exiled.API/Features/Toys/Text.cs b/EXILED/Exiled.API/Features/Toys/Text.cs index fb95a46b26..7daf9334af 100644 --- a/EXILED/Exiled.API/Features/Toys/Text.cs +++ b/EXILED/Exiled.API/Features/Toys/Text.cs @@ -105,7 +105,7 @@ public static Text Create(Vector3? position = null, Quaternion? rotation = null, textToy.TextFormat = text; textToy.DisplaySize = displaySize ?? Vector2.one; - textToy.Transform.localPosition = position ?? Vector3.one; + textToy.Transform.localPosition = position ?? Vector3.zero; textToy.Transform.localRotation = rotation ?? Quaternion.identity; textToy.Transform.localScale = scale ?? Vector3.one; diff --git a/EXILED/Exiled.API/Features/Toys/Waypoint.cs b/EXILED/Exiled.API/Features/Toys/Waypoint.cs index cc9b05dc3e..81bfe89403 100644 --- a/EXILED/Exiled.API/Features/Toys/Waypoint.cs +++ b/EXILED/Exiled.API/Features/Toys/Waypoint.cs @@ -112,7 +112,7 @@ public static Waypoint Create(Transform parent = null, Vector3? position = null, toy.Priority = priority; toy.VisualizeBounds = visualizeBounds; - toy.Transform.localPosition = position ?? Vector3.one; + toy.Transform.localPosition = position ?? Vector3.zero; toy.Transform.localRotation = rotation ?? Quaternion.identity; toy.BoundsSize = scale ?? Vector3.one * 255.9961f; From 511e84a8b1bb9f28deb0885f2c46a8d765316e99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20SAVA=C5=9E?= Date: Tue, 3 Feb 2026 00:12:50 +0300 Subject: [PATCH 09/11] updaate --- EXILED/Exiled.API/Features/Toys/CameraToy.cs | 6 ++++-- EXILED/Exiled.API/Features/Toys/Capybara.cs | 6 ++++-- EXILED/Exiled.API/Features/Toys/InteractableToy.cs | 10 ++++++---- EXILED/Exiled.API/Features/Toys/Text.cs | 8 +++++--- EXILED/Exiled.API/Features/Toys/Waypoint.cs | 10 ++++++---- 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/EXILED/Exiled.API/Features/Toys/CameraToy.cs b/EXILED/Exiled.API/Features/Toys/CameraToy.cs index e2ba11f337..0f1c0a83a5 100644 --- a/EXILED/Exiled.API/Features/Toys/CameraToy.cs +++ b/EXILED/Exiled.API/Features/Toys/CameraToy.cs @@ -147,9 +147,11 @@ public static CameraToy Create(Transform parent = null, CameraType type = Camera _ => EzArmCameraPrefab }; - CameraToy toy = parent ? new(Object.Instantiate(prefab, parent)) : new(Object.Instantiate(prefab)); + CameraToy toy = new(Object.Instantiate(prefab, parent)) + { + Name = name, + }; - toy.Name = name; toy.Transform.localPosition = position ?? Vector3.zero; toy.Transform.localRotation = rotation ?? Quaternion.identity; toy.Transform.localScale = scale ?? Vector3.one; diff --git a/EXILED/Exiled.API/Features/Toys/Capybara.cs b/EXILED/Exiled.API/Features/Toys/Capybara.cs index de57c1575f..d615b25a1b 100644 --- a/EXILED/Exiled.API/Features/Toys/Capybara.cs +++ b/EXILED/Exiled.API/Features/Toys/Capybara.cs @@ -80,9 +80,11 @@ public bool Collidable /// The new . public static Capybara Create(Transform parent = null, Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, bool collidable = true, bool spawn = true) { - Capybara toy = parent ? new(Object.Instantiate(Prefab, parent)) : new(Object.Instantiate(Prefab)); + Capybara toy = new(Object.Instantiate(Prefab, parent)) + { + Collidable = collidable, + }; - toy.Collidable = collidable; toy.Transform.localPosition = position ?? Vector3.zero; toy.Transform.localRotation = rotation ?? Quaternion.identity; toy.Transform.localScale = scale ?? Vector3.one; diff --git a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs index cf8ce95b1f..55bdf2d886 100644 --- a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs +++ b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs @@ -117,11 +117,13 @@ public static InteractableToy Create(Transform transform, ColliderShape shape = /// The new . public static InteractableToy Create(Transform parent = null, Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, ColliderShape shape = ColliderShape.Sphere, float interactionDuration = 1f, bool isLocked = false, bool spawn = true) { - InteractableToy toy = parent ? new(Object.Instantiate(Prefab, parent)) : new(Object.Instantiate(Prefab)); + InteractableToy toy = new(Object.Instantiate(Prefab, parent)) + { + Shape = shape, + IsLocked = isLocked, + InteractionDuration = interactionDuration, + }; - toy.Shape = shape; - toy.IsLocked = isLocked; - toy.InteractionDuration = interactionDuration; toy.Transform.localPosition = position ?? Vector3.zero; toy.Transform.localRotation = rotation ?? Quaternion.identity; toy.Transform.localScale = scale ?? Vector3.one; diff --git a/EXILED/Exiled.API/Features/Toys/Text.cs b/EXILED/Exiled.API/Features/Toys/Text.cs index 7daf9334af..055993e4a7 100644 --- a/EXILED/Exiled.API/Features/Toys/Text.cs +++ b/EXILED/Exiled.API/Features/Toys/Text.cs @@ -101,10 +101,12 @@ public Vector2 DisplaySize /// The new . public static Text Create(Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, string text = "Default Text", Vector2? displaySize = null, Transform parent = null, bool spawn = true) { - Text textToy = parent ? new(Object.Instantiate(Prefab, parent)) : new(Object.Instantiate(Prefab)); + Text textToy = new(Object.Instantiate(Prefab, parent)) + { + TextFormat = text, + DisplaySize = displaySize ?? new Vector3(50, 50), + }; - textToy.TextFormat = text; - textToy.DisplaySize = displaySize ?? Vector2.one; textToy.Transform.localPosition = position ?? Vector3.zero; textToy.Transform.localRotation = rotation ?? Quaternion.identity; textToy.Transform.localScale = scale ?? Vector3.one; diff --git a/EXILED/Exiled.API/Features/Toys/Waypoint.cs b/EXILED/Exiled.API/Features/Toys/Waypoint.cs index 81bfe89403..efc50513da 100644 --- a/EXILED/Exiled.API/Features/Toys/Waypoint.cs +++ b/EXILED/Exiled.API/Features/Toys/Waypoint.cs @@ -108,13 +108,15 @@ public Vector3 BoundsSize /// The new . public static Waypoint Create(Transform parent = null, Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, float priority = 0f, bool visualizeBounds = false, bool spawn = true) { - Waypoint toy = parent ? new(Object.Instantiate(Prefab, parent)) : new(Object.Instantiate(Prefab)); + Waypoint toy = new(Object.Instantiate(Prefab, parent)) + { + Priority = priority, + BoundsSize = scale ?? Vector3.one * 255.9961f, + VisualizeBounds = visualizeBounds, + }; - toy.Priority = priority; - toy.VisualizeBounds = visualizeBounds; toy.Transform.localPosition = position ?? Vector3.zero; toy.Transform.localRotation = rotation ?? Quaternion.identity; - toy.BoundsSize = scale ?? Vector3.one * 255.9961f; if (spawn) toy.Spawn(); From fea04a2c1dfea522df126452f3b54d3d9ad624dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20SAVA=C5=9E?= Date: Tue, 3 Feb 2026 00:37:57 +0300 Subject: [PATCH 10/11] remove useless using --- EXILED/Exiled.API/Features/Toys/InteractableToy.cs | 2 -- EXILED/Exiled.API/Features/Toys/Waypoint.cs | 2 -- 2 files changed, 4 deletions(-) diff --git a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs index 55bdf2d886..1653e69b78 100644 --- a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs +++ b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs @@ -12,8 +12,6 @@ namespace Exiled.API.Features.Toys using Exiled.API.Enums; using Exiled.API.Interfaces; - using LabApi.Features.Wrappers; - using UnityEngine; using static AdminToys.InvisibleInteractableToy; diff --git a/EXILED/Exiled.API/Features/Toys/Waypoint.cs b/EXILED/Exiled.API/Features/Toys/Waypoint.cs index efc50513da..0de33936a7 100644 --- a/EXILED/Exiled.API/Features/Toys/Waypoint.cs +++ b/EXILED/Exiled.API/Features/Toys/Waypoint.cs @@ -7,8 +7,6 @@ namespace Exiled.API.Features.Toys { - using System.Drawing; - using AdminToys; using Exiled.API.Enums; From 7fe113460858d3f0a8ba10b0ddd50ea874ba914b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20SAVA=C5=9E?= Date: Wed, 4 Feb 2026 12:27:48 +0300 Subject: [PATCH 11/11] return nulll --- EXILED/Exiled.API/Features/Toys/CameraToy.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/EXILED/Exiled.API/Features/Toys/CameraToy.cs b/EXILED/Exiled.API/Features/Toys/CameraToy.cs index 0f1c0a83a5..85727a176f 100644 --- a/EXILED/Exiled.API/Features/Toys/CameraToy.cs +++ b/EXILED/Exiled.API/Features/Toys/CameraToy.cs @@ -144,9 +144,15 @@ public static CameraToy Create(Transform parent = null, CameraType type = Camera CameraType.HczCameraToy => HczCameraPrefab, CameraType.LczCameraToy => LczCameraPrefab, CameraType.SzCameraToy => SzCameraPrefab, - _ => EzArmCameraPrefab + _ => null, }; + if (prefab == null) + { + Log.Warn("Invalid Camera Type for prefab"); + return null; + } + CameraToy toy = new(Object.Instantiate(prefab, parent)) { Name = name,