From 2214fd75c9fb9dbac1fc5bef7e0f47c7b86e3289 Mon Sep 17 00:00:00 2001 From: "@Someone" <45270312+Someone-193@users.noreply.github.com> Date: Sat, 30 May 2026 15:37:05 -0400 Subject: [PATCH 1/4] Revert "fix: Error" This reverts commit e2d55f098e665542675d68421da106814297db16. --- EXILED/Exiled.API/Features/Hazards/AmnesticCloudHazard.cs | 3 --- EXILED/Exiled.API/Features/Hazards/TantrumHazard.cs | 6 +----- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/EXILED/Exiled.API/Features/Hazards/AmnesticCloudHazard.cs b/EXILED/Exiled.API/Features/Hazards/AmnesticCloudHazard.cs index ed8721d357..cc9bff8d67 100644 --- a/EXILED/Exiled.API/Features/Hazards/AmnesticCloudHazard.cs +++ b/EXILED/Exiled.API/Features/Hazards/AmnesticCloudHazard.cs @@ -7,8 +7,6 @@ namespace Exiled.API.Features.Hazards { - using System; - using Exiled.API.Enums; using PlayerRoles.PlayableScps.Scp939; @@ -34,7 +32,6 @@ public AmnesticCloudHazard(Scp939AmnesticCloudInstance hazard) /// /// Gets the amnestic cloud prefab. /// - [Obsolete("This only work as default component")] public static Scp939AmnesticCloudInstance AmnesticCloudPrefab { get diff --git a/EXILED/Exiled.API/Features/Hazards/TantrumHazard.cs b/EXILED/Exiled.API/Features/Hazards/TantrumHazard.cs index 441ab28f44..2e36627d8b 100644 --- a/EXILED/Exiled.API/Features/Hazards/TantrumHazard.cs +++ b/EXILED/Exiled.API/Features/Hazards/TantrumHazard.cs @@ -7,13 +7,10 @@ namespace Exiled.API.Features.Hazards { - using System; - using Exiled.API.Enums; using global::Hazards; using Mirror; using RelativePositioning; - using UnityEngine; /// @@ -36,7 +33,6 @@ public TantrumHazard(TantrumEnvironmentalHazard hazard) /// /// Gets the tantrum prefab. /// - [Obsolete("This only work as default component")] public static TantrumEnvironmentalHazard TantrumPrefab { get @@ -92,7 +88,7 @@ public Transform CorrectPosition /// The instance. public static TantrumHazard PlaceTantrum(Vector3 position, bool isActive = true) { - TantrumEnvironmentalHazard tantrum = UnityEngine.Object.Instantiate(PrefabHelper.GetPrefab(PrefabType.TantrumObj)).GetComponent(); + TantrumEnvironmentalHazard tantrum = Object.Instantiate(TantrumPrefab); if (!isActive) tantrum.SynchronizedPosition = new(position); From 6211b549694cf873bd956ad92618fc291a71b1f4 Mon Sep 17 00:00:00 2001 From: "@Someone" <45270312+Someone-193@users.noreply.github.com> Date: Sat, 30 May 2026 15:37:07 -0400 Subject: [PATCH 2/4] Revert "fix: Toys.Create Wrapper" This reverts commit 8fd68012a6d38be2ea9b2df98a2784dfa3d3e6a4. --- EXILED/Exiled.API/Features/PrefabHelper.cs | 1 - EXILED/Exiled.API/Features/Toys/CameraToy.cs | 25 +++------ EXILED/Exiled.API/Features/Toys/Capybara.cs | 7 +-- .../Features/Toys/InteractableToy.cs | 7 +-- EXILED/Exiled.API/Features/Toys/Light.cs | 3 +- EXILED/Exiled.API/Features/Toys/Primitive.cs | 51 +++++++++---------- .../Features/Toys/ShootingTargetToy.cs | 9 ++-- EXILED/Exiled.API/Features/Toys/Speaker.cs | 9 ++-- EXILED/Exiled.API/Features/Toys/Text.cs | 7 +-- EXILED/Exiled.API/Features/Toys/Waypoint.cs | 7 +-- 10 files changed, 42 insertions(+), 84 deletions(-) diff --git a/EXILED/Exiled.API/Features/PrefabHelper.cs b/EXILED/Exiled.API/Features/PrefabHelper.cs index 5b9b651466..22579651ac 100644 --- a/EXILED/Exiled.API/Features/PrefabHelper.cs +++ b/EXILED/Exiled.API/Features/PrefabHelper.cs @@ -86,7 +86,6 @@ public static bool TryGetPrefab(PrefabType prefabType, out GameObject gameObject /// The . /// The type. /// Returns the . - [Obsolete("This only work as default component")] public static T GetPrefab(PrefabType prefabType) where T : Component { diff --git a/EXILED/Exiled.API/Features/Toys/CameraToy.cs b/EXILED/Exiled.API/Features/Toys/CameraToy.cs index 4b0e042259..85727a176f 100644 --- a/EXILED/Exiled.API/Features/Toys/CameraToy.cs +++ b/EXILED/Exiled.API/Features/Toys/CameraToy.cs @@ -7,8 +7,6 @@ namespace Exiled.API.Features.Toys { - using System; - using AdminToys; using Exiled.API.Enums; @@ -18,8 +16,6 @@ namespace Exiled.API.Features.Toys using CameraType = Enums.CameraType; - using Object = UnityEngine.Object; - /// /// A wrapper class for . /// @@ -35,31 +31,26 @@ internal CameraToy(Scp079CameraToy scp079CameraToy) /// /// Gets the prefab for EzArm Camera prefab. /// - [Obsolete("This is only valid as a default component", false)] public static Scp079CameraToy EzArmCameraPrefab { get; } = PrefabHelper.GetPrefab(PrefabType.EzArmCameraToy); /// /// Gets the prefab for Ez Camera prefab. /// - [Obsolete("This is only valid as a default component", false)] public static Scp079CameraToy EzCameraPrefab { get; } = PrefabHelper.GetPrefab(PrefabType.EzCameraToy); /// /// Gets the prefab for Hcz Camera prefab. /// - [Obsolete("This is only valid as a default component", false)] public static Scp079CameraToy HczCameraPrefab { get; } = PrefabHelper.GetPrefab(PrefabType.HczCameraToy); /// /// Gets the prefab for Lcz Camera prefab. /// - [Obsolete("This is only valid as a default component", false)] public static Scp079CameraToy LczCameraPrefab { get; } = PrefabHelper.GetPrefab(PrefabType.LczCameraToy); /// /// Gets the prefab for Sz Camera prefab. /// - [Obsolete("This is only valid as a default component", false)] public static Scp079CameraToy SzCameraPrefab { get; } = PrefabHelper.GetPrefab(PrefabType.SzCameraToy); /// @@ -146,23 +137,23 @@ public string Name /// The new . 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) { - PrefabType? prefabType = type switch + Scp079CameraToy prefab = type switch { - CameraType.EzArmCameraToy => PrefabType.EzArmCameraToy, - CameraType.EzCameraToy => PrefabType.EzCameraToy, - CameraType.HczCameraToy => PrefabType.HczCameraToy, - CameraType.LczCameraToy => PrefabType.LczCameraToy, - CameraType.SzCameraToy => PrefabType.SzCameraToy, + CameraType.EzArmCameraToy => EzArmCameraPrefab, + CameraType.EzCameraToy => EzCameraPrefab, + CameraType.HczCameraToy => HczCameraPrefab, + CameraType.LczCameraToy => LczCameraPrefab, + CameraType.SzCameraToy => SzCameraPrefab, _ => null, }; - if (prefabType == null) + if (prefab == null) { Log.Warn("Invalid Camera Type for prefab"); return null; } - CameraToy toy = new(Object.Instantiate(PrefabHelper.GetPrefab(prefabType.Value), parent).GetComponent()) + CameraToy toy = new(Object.Instantiate(prefab, parent)) { Name = name, }; diff --git a/EXILED/Exiled.API/Features/Toys/Capybara.cs b/EXILED/Exiled.API/Features/Toys/Capybara.cs index 9e6e03e41b..d615b25a1b 100644 --- a/EXILED/Exiled.API/Features/Toys/Capybara.cs +++ b/EXILED/Exiled.API/Features/Toys/Capybara.cs @@ -7,8 +7,6 @@ namespace Exiled.API.Features.Toys { - using System; - using AdminToys; using Enums; @@ -17,8 +15,6 @@ namespace Exiled.API.Features.Toys using UnityEngine; - using Object = UnityEngine.Object; - /// /// A wrapper class for . /// @@ -34,7 +30,6 @@ internal Capybara(CapybaraToy capybaraToy) /// /// Gets the prefab. /// - [Obsolete("This is only valid as a default component", false)] public static CapybaraToy Prefab { get; } = PrefabHelper.GetPrefab(PrefabType.CapybaraToy); /// @@ -85,7 +80,7 @@ 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 = new(Object.Instantiate(PrefabHelper.GetPrefab(PrefabType.CapybaraToy), parent).GetComponent()) + Capybara toy = new(Object.Instantiate(Prefab, parent)) { Collidable = collidable, }; diff --git a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs index cb14bb71e6..1653e69b78 100644 --- a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs +++ b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs @@ -7,8 +7,6 @@ namespace Exiled.API.Features.Toys { - using System; - using AdminToys; using Exiled.API.Enums; @@ -18,8 +16,6 @@ namespace Exiled.API.Features.Toys using static AdminToys.InvisibleInteractableToy; - using Object = UnityEngine.GameObject; - /// /// A wrapper class for . /// @@ -35,7 +31,6 @@ internal InteractableToy(InvisibleInteractableToy invisibleInteractableToy) /// /// Gets the prefab. /// - [Obsolete("This is only valid as a default component", false)] public static InvisibleInteractableToy Prefab { get; } = PrefabHelper.GetPrefab(PrefabType.InvisibleInteractableToy); /// @@ -120,7 +115,7 @@ 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 = new(Object.Instantiate(PrefabHelper.GetPrefab(PrefabType.InvisibleInteractableToy), parent).GetComponent()) + InteractableToy toy = new(Object.Instantiate(Prefab, parent)) { Shape = shape, IsLocked = isLocked, diff --git a/EXILED/Exiled.API/Features/Toys/Light.cs b/EXILED/Exiled.API/Features/Toys/Light.cs index 282d29ccc7..9e167d1bb5 100644 --- a/EXILED/Exiled.API/Features/Toys/Light.cs +++ b/EXILED/Exiled.API/Features/Toys/Light.cs @@ -35,7 +35,6 @@ internal Light(LightSourceToy lightSourceToy) /// /// Gets the prefab. /// - [Obsolete("This is only valid as a default component", false)] public static LightSourceToy Prefab => PrefabHelper.GetPrefab(PrefabType.LightSourceToy); /// @@ -147,7 +146,7 @@ public static Light Create(Vector3? position = null, Vector3? rotation = null, V /// 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(PrefabHelper.GetPrefab(PrefabType.LightSourceToy)).GetComponent()) + Light light = new(UnityEngine.Object.Instantiate(Prefab)) { Position = position ?? Vector3.zero, Rotation = Quaternion.Euler(rotation ?? Vector3.zero), diff --git a/EXILED/Exiled.API/Features/Toys/Primitive.cs b/EXILED/Exiled.API/Features/Toys/Primitive.cs index 7fb0a2ec03..9ca95036da 100644 --- a/EXILED/Exiled.API/Features/Toys/Primitive.cs +++ b/EXILED/Exiled.API/Features/Toys/Primitive.cs @@ -34,7 +34,6 @@ internal Primitive(PrimitiveObjectToy toyAdminToyBase) /// /// Gets the prefab. /// - [Obsolete("This is only valid as a default component", false)] public static PrimitiveObjectToy Prefab => PrefabHelper.GetPrefab(PrefabType.PrimitiveObjectToy); /// @@ -121,13 +120,12 @@ public static Primitive Create(PrimitiveType primitiveType = PrimitiveType.Spher /// 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(Object.Instantiate(PrefabHelper.GetPrefab(PrefabType.PrimitiveObjectToy)).GetComponent())) - { - Position = position ?? Vector3.zero, - Rotation = Quaternion.Euler(rotation ?? Vector3.zero), - Scale = scale ?? Vector3.one, - Color = color ?? Color.gray, - }; + Primitive primitive = new(Object.Instantiate(Prefab)); + + primitive.Position = position ?? Vector3.zero; + primitive.Rotation = Quaternion.Euler(rotation ?? Vector3.zero); + primitive.Scale = scale ?? Vector3.one; + primitive.Color = color ?? Color.gray; if (spawn) primitive.Spawn(); @@ -147,12 +145,11 @@ public static Primitive Create(Vector3? position /*= null*/, Vector3? rotation / /// 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(Object.Instantiate(PrefabHelper.GetPrefab(PrefabType.PrimitiveObjectToy))).GetComponent()) - { - Position = position ?? Vector3.zero, - Rotation = Quaternion.Euler(rotation ?? Vector3.zero), - Scale = scale ?? Vector3.one, - }; + Primitive primitive = new(Object.Instantiate(Prefab)); + + primitive.Position = position ?? Vector3.zero; + primitive.Rotation = Quaternion.Euler(rotation ?? Vector3.zero); + primitive.Scale = scale ?? Vector3.one; primitive.Base.NetworkPrimitiveType = primitiveType; primitive.Color = color ?? Color.gray; @@ -176,13 +173,12 @@ public static Primitive Create(PrimitiveType primitiveType /*= PrimitiveType.Sph /// The new . public static Primitive Create(PrimitiveType primitiveType /*= PrimitiveType.Sphere*/, PrimitiveFlags flags, Vector3? position /*= null*/, Vector3? rotation /*= null*/, Vector3? scale /*= null*/, bool spawn /*= true*/, Color? color /*= null*/) { - Primitive primitive = new(Object.Instantiate(Object.Instantiate(PrefabHelper.GetPrefab(PrefabType.PrimitiveObjectToy))).GetComponent()) - { - Position = position ?? Vector3.zero, - Rotation = Quaternion.Euler(rotation ?? Vector3.zero), - Scale = scale ?? Vector3.one, - Flags = flags, - }; + Primitive primitive = new(Object.Instantiate(Prefab)); + + primitive.Position = position ?? Vector3.zero; + primitive.Rotation = Quaternion.Euler(rotation ?? Vector3.zero); + primitive.Scale = scale ?? Vector3.one; + primitive.Flags = flags; primitive.Base.NetworkPrimitiveType = primitiveType; primitive.Color = color ?? Color.gray; @@ -200,13 +196,12 @@ public static Primitive Create(PrimitiveType primitiveType /*= PrimitiveType.Sph /// The new . public static Primitive Create(PrimitiveSettings primitiveSettings) { - Primitive primitive = new(Object.Instantiate(PrefabHelper.GetPrefab(PrefabType.PrimitiveObjectToy)).GetComponent()) - { - Position = primitiveSettings.Position, - Rotation = Quaternion.Euler(primitiveSettings.Rotation), - Scale = primitiveSettings.Scale, - Flags = primitiveSettings.Flags, - }; + Primitive primitive = new(Object.Instantiate(Prefab)); + + primitive.Position = primitiveSettings.Position; + primitive.Rotation = Quaternion.Euler(primitiveSettings.Rotation); + primitive.Scale = primitiveSettings.Scale; + primitive.Flags = primitiveSettings.Flags; primitive.Base.NetworkPrimitiveType = primitiveSettings.PrimitiveType; primitive.Color = primitiveSettings.Color; diff --git a/EXILED/Exiled.API/Features/Toys/ShootingTargetToy.cs b/EXILED/Exiled.API/Features/Toys/ShootingTargetToy.cs index d9f659ca94..86246ffd28 100644 --- a/EXILED/Exiled.API/Features/Toys/ShootingTargetToy.cs +++ b/EXILED/Exiled.API/Features/Toys/ShootingTargetToy.cs @@ -49,19 +49,16 @@ internal ShootingTargetToy(ShootingTarget target) /// /// Gets the prefab for Sport Shooting Target. /// - [Obsolete("This is only valid as a default component", false)] public static ShootingTarget SportShootingTargetPrefab => PrefabHelper.GetPrefab(PrefabType.SportTarget); /// /// Gets the prefab for DBoy Shooting Target. /// - [Obsolete("This is only valid as a default component", false)] public static ShootingTarget DboyShootingTargetPrefab => PrefabHelper.GetPrefab(PrefabType.DBoyTarget); /// /// Gets the prefab for Binary Shooting Target. /// - [Obsolete("This is only valid as a default component", false)] public static ShootingTarget BinaryShootingTargetPrefab => PrefabHelper.GetPrefab(PrefabType.BinaryTarget); /// @@ -181,19 +178,19 @@ public static ShootingTargetToy Create(ShootingTargetType type, Vector3? positio { case ShootingTargetType.ClassD: { - shootingTargetToy = new(Object.Instantiate(Object.Instantiate(PrefabHelper.GetPrefab(PrefabType.DBoyTarget).GetComponent()))); + shootingTargetToy = new(Object.Instantiate(DboyShootingTargetPrefab)); break; } case ShootingTargetType.Binary: { - shootingTargetToy = new(Object.Instantiate(Object.Instantiate(PrefabHelper.GetPrefab(PrefabType.BinaryTarget).GetComponent()))); + shootingTargetToy = new(Object.Instantiate(BinaryShootingTargetPrefab)); break; } default: { - shootingTargetToy = new(Object.Instantiate(Object.Instantiate(PrefabHelper.GetPrefab(PrefabType.SportTarget).GetComponent()))); + shootingTargetToy = new(Object.Instantiate(SportShootingTargetPrefab)); break; } } diff --git a/EXILED/Exiled.API/Features/Toys/Speaker.cs b/EXILED/Exiled.API/Features/Toys/Speaker.cs index 425b8e8bfd..8b0af6bd79 100644 --- a/EXILED/Exiled.API/Features/Toys/Speaker.cs +++ b/EXILED/Exiled.API/Features/Toys/Speaker.cs @@ -7,7 +7,6 @@ namespace Exiled.API.Features.Toys { - using System; using System.Collections.Generic; using AdminToys; @@ -15,8 +14,7 @@ namespace Exiled.API.Features.Toys using Exiled.API.Interfaces; using UnityEngine; using VoiceChat.Networking; - - using Object = UnityEngine.Object; + using VoiceChat.Playbacks; /// /// A wrapper class for . @@ -33,7 +31,6 @@ internal Speaker(SpeakerToy speakerToy) /// /// Gets the prefab. /// - [Obsolete("This is only valid as a default component", false)] public static SpeakerToy Prefab => PrefabHelper.GetPrefab(PrefabType.SpeakerToy); /// @@ -112,7 +109,7 @@ public byte ControllerId /// The new . public static Speaker Create(Vector3? position, Vector3? rotation, Vector3? scale, bool spawn) { - Speaker speaker = new(Object.Instantiate(PrefabHelper.GetPrefab(PrefabType.SpeakerToy)).GetComponent()) + Speaker speaker = new(UnityEngine.Object.Instantiate(Prefab)) { Position = position ?? Vector3.zero, Rotation = Quaternion.Euler(rotation ?? Vector3.zero), @@ -134,7 +131,7 @@ public static Speaker Create(Vector3? position, Vector3? rotation, Vector3? scal /// The new . public static Speaker Create(Transform transform, bool spawn, bool worldPositionStays = true) { - Speaker speaker = new(Object.Instantiate(PrefabHelper.GetPrefab(PrefabType.SpeakerToy), transform, worldPositionStays).GetComponent()) + Speaker speaker = new(Object.Instantiate(Prefab, transform, worldPositionStays)) { Position = transform.position, Rotation = transform.rotation, diff --git a/EXILED/Exiled.API/Features/Toys/Text.cs b/EXILED/Exiled.API/Features/Toys/Text.cs index d3ed1b822d..055993e4a7 100644 --- a/EXILED/Exiled.API/Features/Toys/Text.cs +++ b/EXILED/Exiled.API/Features/Toys/Text.cs @@ -7,8 +7,6 @@ namespace Exiled.API.Features.Toys { - using System; - using AdminToys; using Exiled.API.Enums; @@ -16,8 +14,6 @@ namespace Exiled.API.Features.Toys using UnityEngine; - using Object = UnityEngine.GameObject; - /// /// A wrapper class for . /// @@ -33,7 +29,6 @@ internal Text(TextToy textToy) /// /// Gets the prefab. /// - [Obsolete("This is only valid as a default component", false)] public static TextToy Prefab { get; } = PrefabHelper.GetPrefab(PrefabType.TextToy); /// @@ -106,7 +101,7 @@ 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 = new(Object.Instantiate(PrefabHelper.GetPrefab(PrefabType.TextToy).GetComponent(), parent)) + Text textToy = new(Object.Instantiate(Prefab, parent)) { TextFormat = text, DisplaySize = displaySize ?? new Vector3(50, 50), diff --git a/EXILED/Exiled.API/Features/Toys/Waypoint.cs b/EXILED/Exiled.API/Features/Toys/Waypoint.cs index 6f7ef2d1fa..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; - using AdminToys; using Exiled.API.Enums; @@ -16,8 +14,6 @@ namespace Exiled.API.Features.Toys using UnityEngine; - using Object = UnityEngine.Object; - /// /// A wrapper class for . /// @@ -33,7 +29,6 @@ internal Waypoint(WaypointToy waypointToy) /// /// Gets the prefab. /// - [Obsolete("This is only valid as a default component", false)] public static WaypointToy Prefab { get; } = PrefabHelper.GetPrefab(PrefabType.WaypointToy); /// @@ -111,7 +106,7 @@ 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 = new(Object.Instantiate(PrefabHelper.GetPrefab(PrefabType.WaypointToy).GetComponent(), parent)) + Waypoint toy = new(Object.Instantiate(Prefab, parent)) { Priority = priority, BoundsSize = scale ?? Vector3.one * 255.9961f, From 3fd90d9630a178014e00b395a6b01273c62d59d9 Mon Sep 17 00:00:00 2001 From: "@Someone" <45270312+Someone-193@users.noreply.github.com> Date: Sat, 30 May 2026 16:58:49 -0400 Subject: [PATCH 3/4] 9.14.1 changes + refactor prefab registration --- EXILED/EXILED.props | 2 +- EXILED/Exiled.API/Enums/PrefabType.cs | 87 ++++++-- EXILED/Exiled.API/Features/PrefabHelper.cs | 10 +- EXILED/Exiled.API/Features/Scp559.cs | 2 +- EXILED/Exiled.API/Features/Toys/CameraToy.cs | 10 +- EXILED/Exiled.API/Features/Toys/Capybara.cs | 2 +- .../Features/Toys/InteractableToy.cs | 2 +- EXILED/Exiled.API/Features/Toys/Light.cs | 2 +- EXILED/Exiled.API/Features/Toys/Primitive.cs | 2 +- .../Features/Toys/ShootingTargetToy.cs | 6 +- EXILED/Exiled.API/Features/Toys/Speaker.cs | 2 +- EXILED/Exiled.API/Features/Toys/Text.cs | 2 +- EXILED/Exiled.API/Features/Toys/Waypoint.cs | 2 +- .../Handlers/Internal/ClientStarted.cs | 187 ++++++++++++++---- EXILED/Exiled.Loader/AutoUpdateFiles.cs | 2 +- 15 files changed, 238 insertions(+), 82 deletions(-) diff --git a/EXILED/EXILED.props b/EXILED/EXILED.props index ef4111d7eb..67f89d438a 100644 --- a/EXILED/EXILED.props +++ b/EXILED/EXILED.props @@ -15,7 +15,7 @@ - 9.14.0 + 9.14.1 false diff --git a/EXILED/Exiled.API/Enums/PrefabType.cs b/EXILED/Exiled.API/Enums/PrefabType.cs index c3ce00898d..e32ff0ce42 100644 --- a/EXILED/Exiled.API/Enums/PrefabType.cs +++ b/EXILED/Exiled.API/Enums/PrefabType.cs @@ -7,6 +7,8 @@ namespace Exiled.API.Enums { + using System; + using Exiled.API.Features.Attributes; /// @@ -29,37 +31,39 @@ public enum PrefabType [Prefab(3038351124, "LCZ BreakableDoor")] LCZBreakableDoor, + [Obsolete("This prefab no longer exists")] [Prefab(400539138, "HCZ OneSided")] HCZOneSided, + [Obsolete("This prefab no longer exists")] [Prefab(2060920286, "HCZ TwoSided")] HCZTwoSided, [Prefab(3343949480, "OpenHallway")] HCZOpenHallway, - [Prefab(3999209566, "OpenHallway Construct A")] + [Prefab(3999209566, "Broken Electrical Box Open Connector")] HCZOpenHallway_Construct_A, - [Prefab(38976586, "OpenHallway Clutter A")] + [Prefab(38976586, "Pipes Long Open Connector")] HCZOpenHallway_Clutter_A, - [Prefab(1687661105, "OpenHallway Clutter B")] + [Prefab(1687661105, "Simple Boxes Open Connector")] HCZOpenHallway_Clutter_B, - [Prefab(147203050, "OpenHallway Clutter C")] + [Prefab(147203050, "Pipes Short Open Connector")] HCZOpenHallway_Clutter_C, - [Prefab(1102032353, "OpenHallway Clutter D")] + [Prefab(1102032353, "Boxes Ladder Open Connector")] HCZOpenHallway_Clutter_D, - [Prefab(2490430134, "OpenHallway Clutter E")] + [Prefab(2490430134, "Tank-Supported Shelf Open Connector")] HCZOpenHallway_Clutter_E, - [Prefab(2673083832, "OpenHallway Clutter F")] + [Prefab(2673083832, "Angled Fences Open Connector")] HCZOpenHallway_Clutter_F, - [Prefab(2536312960, "OpenHallway Clutter G")] + [Prefab(2536312960, "Huge Orange Pipes Open Connector")] HCZOpenHallway_Clutter_G, [Prefab(2176035362, "HCZ BulkDoor")] @@ -86,10 +90,11 @@ public enum PrefabType [Prefab(712426663, "SpeakerToy")] SpeakerToy, - [Prefab(2672653014, "RegularKeycardPickup")] + [Prefab(2672653014, "KeycardPickup")] RegularKeycardPickup, - [Prefab(335436768, "ChaosKeycardPickup")] + // TODO: remove duplicate with KeycardPickupChaos + [Prefab(2842703865, "KeycardPickup_Chaos")] ChaosKeycardPickup, [Prefab(248357067, "RadioPickup")] @@ -98,6 +103,7 @@ public enum PrefabType [Prefab(1925130715, "FirearmPickup")] FirearmPickup, + [Obsolete("This prefab no longer exists")] [Prefab(1925130715, "Com15Pickup")] Com15Pickup, @@ -119,18 +125,22 @@ public enum PrefabType [Prefab(4056235189, "Ammo12gaPickup")] Ammo12gaPickup, + [Obsolete("This prefab no longer exists")] [Prefab(212068596, "E11SRPickup")] E11SRPickup, + [Obsolete("This prefab no longer exists")] [Prefab(1982658896, "CrossvecPickup")] CrossvecPickup, [Prefab(2474630775, "Ammo556mmPickup")] Ammo556mmPickup, + [Obsolete("This prefab no longer exists")] [Prefab(3462306180, "Fsp9Pickup")] Fsp9Pickup, + [Obsolete("This prefab no longer exists")] [Prefab(2405374689, "LogicerPickup")] LogicerPickup, @@ -149,6 +159,7 @@ public enum PrefabType [Prefab(2344368365, "Ammo9mmPickup")] Ammo9mmPickup, + [Obsolete("This prefab no longer exists")] [Prefab(1749039070, "Com18Pickup")] Com18Pickup, @@ -176,12 +187,15 @@ public enum PrefabType [Prefab(3164421243, "Heavy Armor Pickup")] HeavyArmorPickup, + [Obsolete("This prefab no longer exists")] [Prefab(1861159387, "RevolverPickup")] RevolverPickup, + [Obsolete("This prefab no longer exists")] [Prefab(3814984482, "AkPickup")] AkPickup, + [Obsolete("This prefab no longer exists")] [Prefab(3180035653, "ShotgunPickup")] ShotgunPickup, @@ -200,9 +214,11 @@ public enum PrefabType [Prefab(2702950243, "SCP1853Pickup")] SCP1853Pickup, + [Obsolete("This prefab no longer exists")] [Prefab(3881162440, "DisruptorPickup")] DisruptorPickup, + [Obsolete("This prefab no longer exists")] [Prefab(504857316, "Com45Pickup")] Com45Pickup, @@ -215,9 +231,11 @@ public enum PrefabType [Prefab(1209253563, "AntiSCP207Pickup")] AntiSCP207Pickup, + [Obsolete("This prefab no longer exists")] [Prefab(2216560136, "FRMG0Pickup")] FRMG0Pickup, + [Obsolete("This prefab no longer exists")] [Prefab(74988289, "A7Pickup")] A7Pickup, @@ -290,49 +308,55 @@ public enum PrefabType [Prefab(2409733045, "FlashbangProjectile")] FlashbangProjectile, - [Prefab(1062458989, "SCP-173_Ragdoll")] + [Prefab(1062458989, "SCP-173 Ragdoll")] Scp173Ragdoll, + [Obsolete("This prefab no longer exists")] [Prefab(1951328980, "Ragdoll_1")] Ragdoll1, - [Prefab(992490681, "SCP-106_Ragdoll")] + [Prefab(992490681, "SCP-106 Ragdoll")] Scp106Ragdoll, + [Obsolete("This prefab no longer exists")] [Prefab(3219675689, "Ragdoll_4")] Ragdoll4, - [Prefab(417388851, "Ragdoll_7")] + [Prefab(417388851, "SCP-049 Ragdoll")] Ragdoll7, + [Obsolete("This prefab no longer exists")] [Prefab(3185790062, "Ragdoll_6")] Ragdoll6, + [Obsolete("This prefab no longer exists")] [Prefab(2567420661, "Ragdoll_8")] Ragdoll8, - [Prefab(149379640, "SCP-096_Ragdoll")] + [Prefab(149379640, "SCP-096 Ragdoll")] Scp096Ragdoll, - [Prefab(1862774274, "Ragdoll_10")] + [Prefab(1862774274, "Zombie Ragdoll")] Ragdoll10, + [Obsolete("This prefab no longer exists")] [Prefab(2710373253, "Ragdoll_Tut")] RagdollTutorial, + [Obsolete("This prefab no longer exists")] [Prefab(1389252654, "Ragdoll_12")] Ragdoll12, - [Prefab(3175759689, "SCP-939_Ragdoll")] + [Prefab(3175759689, "SCP-939 Ragdoll")] Scp939Ragdoll, - [Prefab(3721192489, "Scp3114_Ragdoll")] + [Prefab(3721192489, "SCP-3114 Ragdoll")] Scp3114Ragdoll, [Prefab(2588580243, "ElevatorChamber")] ElevatorChamber, - [Prefab(1757973841, "ElevatorChamber_Gates")] + [Prefab(1757973841, "ElevatorChamber Gates")] ElevatorChamber_Gates, [Prefab(912031041, "ElevatorChamberNuke")] @@ -344,7 +368,7 @@ public enum PrefabType [Prefab(3539746802, "Sinkhole")] Sinkhole, - [Prefab(1548138668, "AutoRagdoll")] + [Prefab(1548138668, "Auto Humanoid Ragdoll")] AutoRagdoll, [Prefab(1323017091, "ElevatorChamberCargo")] @@ -365,7 +389,7 @@ public enum PrefabType [Prefab(2026969629, "LczCameraToy")] LczCameraToy, - [Prefab(1548138668, "SzCameraToy")] + [Prefab(1734743361, "SzCameraToy")] SzCameraToy, [Prefab(2842703865, "KeycardPickup_Chaos")] @@ -386,78 +410,99 @@ public enum PrefabType [Prefab(1891631329, "PrismaticCloud")] PrismaticCloud, - [Prefab(3938583646, "TantrumObj (Brown Candy)")] + [Prefab(2157375951, "TantrumObj (Brown Candy)")] TantrumObjBrownCandy, [Prefab(1145481038, "Scp1509Pickup")] Scp1509Pickup, + [Obsolete("Only available for Halloween and AprilFools.")] [Prefab(1359696107, "Hubert Moon")] HubertMoon, + [Obsolete("Only available for Halloween and AprilFools.")] [Prefab(4075838184, "Scp018Projectile Halloween")] Scp018ProjectileHalloween, + [Obsolete("Only available for Halloween and AprilFools.")] [Prefab(3262457219, "JailbirdPickup Halloween")] JailbirdPickupHalloween, [Prefab(1712001893, "Scp1509PedestalStructure Variant")] Scp1509PedestalStructureVariant, + [Obsolete("Only available for Halloween and AprilFools.")] [Prefab(517392265, "SCP-173 Ragdoll - MrNutty Sombrero Variant")] Scp173RagdollMrNuttySombreroVariant, + [Obsolete("Only available for Halloween and AprilFools.")] [Prefab(2174094462, "SCP-049 Ragdoll Halloween")] Scp049RagdollHalloween, + [Obsolete("Only available for Halloween and AprilFools.")] [Prefab(4255002108, "SCP-096 Ragdoll Halloween")] Scp096RagdollHalloween, + [Obsolete("Only available for Halloween and AprilFools.")] [Prefab(2556293836, "Zombie Ragdoll Halloween")] ZombieRagdollHalloween, + [Obsolete("Only available for Halloween and AprilFools.")] [Prefab(213466224, "SCP-939 Ragdoll Halloween")] Scp939RagdollHalloween, + [Obsolete("Only available for Christmas and AprilFools.")] [Prefab(689741320, "SCP-559 Cake")] Scp559Cake, + [Obsolete("Only available for Christmas and AprilFools.")] [Prefab(2657863153, "SCP-956")] Scp956, + [Obsolete("Only available for Christmas and AprilFools.")] [Prefab(1205960739, "SCP-2536 Tree")] Scp2536, + [Obsolete("Only available for Christmas and AprilFools.")] [Prefab(2102014206, "Snowpile")] Snowpile, + [Obsolete("Only available for Christmas and AprilFools.")] [Prefab(3401975113, "Scp018Projectile Christmas")] Scp018ProjectileChristmas, + [Obsolete("Only available for Christmas and AprilFools.")] [Prefab(3223468476, "SnowballProjectile")] SnowballProjectile, + [Obsolete("Only available for Christmas and AprilFools.")] [Prefab(296717882, "CoalPickup")] CoalPickup, + [Obsolete("Only available for Christmas and AprilFools.")] [Prefab(409273101, "TapePlayerPickup")] Scp1507TapePickup, + [Obsolete("Only available for Christmas and AprilFools.")] [Prefab(3971391978, "Scp021JPickup")] Scp021JPickup, + [Obsolete("Only available for Christmas and AprilFools.")] [Prefab(142820664, "CoalProjectile")] CoalProjectile, + [Obsolete("Only available for Christmas and AprilFools.")] [Prefab(2405470903, "Scp2536Projectile")] Scp2536Projectile, + [Obsolete("Only available for Christmas and AprilFools.")] [Prefab(1496232901, "SCP-173 Ragdoll Variant")] Scp173RagdollChristmas, [Prefab(6069361, "SnowPoop - TantrumObj")] SnowTantrum, + [Obsolete("Only available for Christmas and AprilFools.")] [Prefab(3654754970, "SCP-1507 Ragdoll")] Scp1507Ragdoll, } diff --git a/EXILED/Exiled.API/Features/PrefabHelper.cs b/EXILED/Exiled.API/Features/PrefabHelper.cs index 22579651ac..e5c3bf1c71 100644 --- a/EXILED/Exiled.API/Features/PrefabHelper.cs +++ b/EXILED/Exiled.API/Features/PrefabHelper.cs @@ -44,11 +44,7 @@ public static class PrefabHelper /// /// The . /// The corresponding . - public static PrefabAttribute GetPrefabAttribute(this PrefabType prefabType) - { - Type type = prefabType.GetType(); - return type.GetField(Enum.GetName(type, prefabType)).GetCustomAttribute(); - } + public static PrefabAttribute GetPrefabAttribute(this PrefabType prefabType) => typeof(PrefabType).GetField(prefabType.ToString()).GetCustomAttribute(); /// /// Gets the of the specified . @@ -57,7 +53,9 @@ public static PrefabAttribute GetPrefabAttribute(this PrefabType prefabType) /// Returns the . public static GameObject GetPrefab(PrefabType prefabType) { +#pragma warning disable CS0618 // Type or member is obsolete if (prefabType is PrefabType.HCZOneSided or PrefabType.HCZTwoSided) +#pragma warning restore CS0618 // Type or member is obsolete { prefabType = PrefabType.HCZBreakableDoor; } @@ -117,6 +115,7 @@ public static GameObject Spawn(PrefabType prefabType, Vector3 position = default positionSync.Network_rotationY = (sbyte)Mathf.RoundToInt(rotation.Value.eulerAngles.y / 5.625F); } +#pragma warning disable CS0618 // Type or member is obsolete if (prefabType is PrefabType.HCZOneSided or PrefabType.HCZTwoSided or PrefabType.HCZBreakableDoor) { newGameObject.GetComponent().Network_syncBitmask = prefabType switch @@ -127,6 +126,7 @@ public static GameObject Spawn(PrefabType prefabType, Vector3 position = default _ => 0 }; } +#pragma warning restore CS0618 // Type or member is obsolete NetworkServer.Spawn(newGameObject); diff --git a/EXILED/Exiled.API/Features/Scp559.cs b/EXILED/Exiled.API/Features/Scp559.cs index 246a030d7f..e742c1a09c 100644 --- a/EXILED/Exiled.API/Features/Scp559.cs +++ b/EXILED/Exiled.API/Features/Scp559.cs @@ -18,7 +18,7 @@ namespace Exiled.API.Features /// /// Represents a cake. /// - [Obsolete("Only availaible for Christmas and AprilFools.")] + [Obsolete("Only available for Christmas and AprilFools.")] public class Scp559 : IWrapper, IPosition { /// diff --git a/EXILED/Exiled.API/Features/Toys/CameraToy.cs b/EXILED/Exiled.API/Features/Toys/CameraToy.cs index 85727a176f..54a7128e63 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 { get; } = PrefabHelper.GetPrefab(PrefabType.EzArmCameraToy); + public static Scp079CameraToy EzArmCameraPrefab { get; internal set; } /// /// Gets the prefab for Ez Camera prefab. /// - public static Scp079CameraToy EzCameraPrefab { get; } = PrefabHelper.GetPrefab(PrefabType.EzCameraToy); + public static Scp079CameraToy EzCameraPrefab { get; internal set; } /// /// Gets the prefab for Hcz Camera prefab. /// - public static Scp079CameraToy HczCameraPrefab { get; } = PrefabHelper.GetPrefab(PrefabType.HczCameraToy); + public static Scp079CameraToy HczCameraPrefab { get; internal set; } /// /// Gets the prefab for Lcz Camera prefab. /// - public static Scp079CameraToy LczCameraPrefab { get; } = PrefabHelper.GetPrefab(PrefabType.LczCameraToy); + public static Scp079CameraToy LczCameraPrefab { get; internal set; } /// /// Gets the prefab for Sz Camera prefab. /// - public static Scp079CameraToy SzCameraPrefab { get; } = PrefabHelper.GetPrefab(PrefabType.SzCameraToy); + public static Scp079CameraToy SzCameraPrefab { get; internal set; } /// /// Gets the base . diff --git a/EXILED/Exiled.API/Features/Toys/Capybara.cs b/EXILED/Exiled.API/Features/Toys/Capybara.cs index d615b25a1b..fcfca34296 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 { get; } = PrefabHelper.GetPrefab(PrefabType.CapybaraToy); + public static CapybaraToy Prefab { get; internal set; } /// /// Gets the base . diff --git a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs index 1653e69b78..72072063d0 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 { get; } = PrefabHelper.GetPrefab(PrefabType.InvisibleInteractableToy); + public static InvisibleInteractableToy Prefab { get; internal set; } /// /// Gets the base . diff --git a/EXILED/Exiled.API/Features/Toys/Light.cs b/EXILED/Exiled.API/Features/Toys/Light.cs index 9e167d1bb5..ed0d562617 100644 --- a/EXILED/Exiled.API/Features/Toys/Light.cs +++ b/EXILED/Exiled.API/Features/Toys/Light.cs @@ -35,7 +35,7 @@ internal Light(LightSourceToy lightSourceToy) /// /// Gets the prefab. /// - public static LightSourceToy Prefab => PrefabHelper.GetPrefab(PrefabType.LightSourceToy); + public static LightSourceToy Prefab { get; internal set; } /// /// Gets the base . diff --git a/EXILED/Exiled.API/Features/Toys/Primitive.cs b/EXILED/Exiled.API/Features/Toys/Primitive.cs index 9ca95036da..c8a34168db 100644 --- a/EXILED/Exiled.API/Features/Toys/Primitive.cs +++ b/EXILED/Exiled.API/Features/Toys/Primitive.cs @@ -34,7 +34,7 @@ internal Primitive(PrimitiveObjectToy toyAdminToyBase) /// /// Gets the prefab. /// - public static PrimitiveObjectToy Prefab => PrefabHelper.GetPrefab(PrefabType.PrimitiveObjectToy); + public static PrimitiveObjectToy Prefab { get; internal set; } /// /// Gets the base . diff --git a/EXILED/Exiled.API/Features/Toys/ShootingTargetToy.cs b/EXILED/Exiled.API/Features/Toys/ShootingTargetToy.cs index 86246ffd28..a7995a5b2c 100644 --- a/EXILED/Exiled.API/Features/Toys/ShootingTargetToy.cs +++ b/EXILED/Exiled.API/Features/Toys/ShootingTargetToy.cs @@ -49,17 +49,17 @@ internal ShootingTargetToy(ShootingTarget target) /// /// Gets the prefab for Sport Shooting Target. /// - public static ShootingTarget SportShootingTargetPrefab => PrefabHelper.GetPrefab(PrefabType.SportTarget); + public static ShootingTarget SportShootingTargetPrefab { get; internal set; } /// /// Gets the prefab for DBoy Shooting Target. /// - public static ShootingTarget DboyShootingTargetPrefab => PrefabHelper.GetPrefab(PrefabType.DBoyTarget); + public static ShootingTarget DboyShootingTargetPrefab { get; internal set; } /// /// Gets the prefab for Binary Shooting Target. /// - public static ShootingTarget BinaryShootingTargetPrefab => PrefabHelper.GetPrefab(PrefabType.BinaryTarget); + public static ShootingTarget BinaryShootingTargetPrefab { get; internal set; } /// /// Gets the base-game for this target. diff --git a/EXILED/Exiled.API/Features/Toys/Speaker.cs b/EXILED/Exiled.API/Features/Toys/Speaker.cs index 8b0af6bd79..e71bb729cb 100644 --- a/EXILED/Exiled.API/Features/Toys/Speaker.cs +++ b/EXILED/Exiled.API/Features/Toys/Speaker.cs @@ -31,7 +31,7 @@ internal Speaker(SpeakerToy speakerToy) /// /// Gets the prefab. /// - public static SpeakerToy Prefab => PrefabHelper.GetPrefab(PrefabType.SpeakerToy); + public static SpeakerToy Prefab { get; internal set; } /// /// Gets the base . diff --git a/EXILED/Exiled.API/Features/Toys/Text.cs b/EXILED/Exiled.API/Features/Toys/Text.cs index 055993e4a7..ad22ac6827 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 { get; } = PrefabHelper.GetPrefab(PrefabType.TextToy); + public static TextToy Prefab { get; internal set; } /// /// Gets the base . diff --git a/EXILED/Exiled.API/Features/Toys/Waypoint.cs b/EXILED/Exiled.API/Features/Toys/Waypoint.cs index 0de33936a7..706d1e6a50 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 { get; } = PrefabHelper.GetPrefab(PrefabType.WaypointToy); + public static WaypointToy Prefab { get; internal set; } /// /// Gets the base . diff --git a/EXILED/Exiled.Events/Handlers/Internal/ClientStarted.cs b/EXILED/Exiled.Events/Handlers/Internal/ClientStarted.cs index 9baf84c36c..18091b6710 100644 --- a/EXILED/Exiled.Events/Handlers/Internal/ClientStarted.cs +++ b/EXILED/Exiled.Events/Handlers/Internal/ClientStarted.cs @@ -7,12 +7,16 @@ namespace Exiled.Events.Handlers.Internal { + using System; using System.Collections.Generic; using System.Linq; + using System.Reflection; + using AdminToys; using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Attributes; + using Exiled.API.Features.Toys; using Mirror; using PlayerRoles.Ragdolls; using UnityEngine; @@ -27,67 +31,174 @@ internal static class ClientStarted /// public static void OnClientStarted() { - PrefabHelper.Prefabs.Clear(); + // required for logging + try + { + PrefabHelper.Prefabs.Clear(); - Dictionary prefabs = new(); + Dictionary prefabs = new(); - foreach (KeyValuePair prefab in NetworkClient.prefabs) - { - if (!prefabs.ContainsKey(prefab.Key)) + Log.Debug(string.Empty); + Log.Debug("//////// ALL PREFABS ////////"); + Log.Debug(string.Empty); + + foreach (KeyValuePair prefab in NetworkClient.prefabs) { - if (!prefab.Value.TryGetComponent(out NetworkBehaviour component)) + if (!prefabs.ContainsKey(prefab.Key)) { - Log.Error($"Failed to get component for prefab: {prefab.Value.name} ({prefab.Key})"); - continue; + if (!prefab.Value.TryGetComponent(out NetworkBehaviour component)) + { + Log.Error($"Failed to get component for prefab: {prefab.Value.name} ({prefab.Key})"); + continue; + } + + Log.Debug($"{prefab.Key}: {component.name}"); + + prefabs.Add(prefab.Key, (prefab.Value, component)); } + } - prefabs.Add(prefab.Key, (prefab.Value, component)); + Log.Debug(string.Empty); + + foreach (NetworkIdentity ragdollPrefab in RagdollManager.AllRagdollPrefabs) + { + if (!prefabs.ContainsKey(ragdollPrefab.assetId)) + { + if (!ragdollPrefab.TryGetComponent(out BasicRagdoll component)) + { + Log.Error($"Failed to get component for ragdoll prefab: {ragdollPrefab.name}"); + continue; + } + + prefabs.Add(ragdollPrefab.assetId, (ragdollPrefab.gameObject, component)); + } } - } - foreach (NetworkIdentity ragdollPrefab in RagdollManager.AllRagdollPrefabs) - { - if (!prefabs.ContainsKey(ragdollPrefab.assetId)) + HashSet found = new(); + + for (int i = 0; i < EnumUtils.Values.Length; i++) { - if (!ragdollPrefab.TryGetComponent(out BasicRagdoll component)) + PrefabType prefabType = EnumUtils.Values[i]; + + // skip obsolete prefabs + if (typeof(PrefabType).GetField(prefabType.ToString()).GetCustomAttribute() != null) + continue; + + PrefabAttribute attribute = prefabType.GetPrefabAttribute(); + + if (prefabs.TryGetValue(attribute.AssetId, out (GameObject, Component) tuple)) { - Log.Error($"Failed to get component for ragdoll prefab: {ragdollPrefab.name}"); + if (attribute.Name != tuple.Item1.name) + Log.Warn($"Invalid Name {prefabType}: {attribute.Name} ({attribute.AssetId}) -> {tuple.Item1.name} ({attribute.AssetId})"); + + PrefabHelper.Prefabs.Add(prefabType, prefabs.FirstOrDefault(prefab => prefab.Key == attribute.AssetId || prefab.Value.Item1.name.Contains(attribute.Name)).Value); + + if (!found.Add(attribute.AssetId)) + Log.Debug($"Duplicate entry! {prefabType}: {attribute.Name} ({attribute.AssetId})"); + continue; } - prefabs.Add(ragdollPrefab.assetId, (ragdollPrefab.gameObject, component)); + if (TryGet(attribute.Name, out KeyValuePair value)) + { + Log.Warn($"Invalid AssetId {prefabType}: {attribute.Name} ({attribute.AssetId}) -> {value.Value.Item1.name} ({value.Key})"); + + PrefabHelper.Prefabs.Add(prefabType, prefabs.FirstOrDefault(prefab => prefab.Key == attribute.AssetId || (prefab.Value.Item1?.name.Contains(attribute.Name) ?? false)).Value); + + if (!found.Add(value.Key)) + Log.Warn($"Duplicate entry! {prefabType}: {attribute.Name} ({attribute.AssetId})"); + + continue; + } + + Log.Warn($"Useless prefab {prefabType}: {attribute.Name} ({attribute.AssetId})"); } - } - for (int i = 0; i < EnumUtils.Values.Length; i++) - { - PrefabType prefabType = EnumUtils.Values[i]; - PrefabAttribute attribute = prefabType.GetPrefabAttribute(); - if (prefabs.TryGetValue(attribute.AssetId, out (GameObject, Component) tuple)) + foreach (KeyValuePair missing in prefabs) { - if (attribute.Name != tuple.Item1.name) - Log.Warn($"Not valid Name {prefabType}: {attribute.Name} ({attribute.AssetId}) -> {tuple.Item1.name} ({attribute.AssetId})"); + if (found.Contains(missing.Key)) + continue; - PrefabHelper.Prefabs.Add(prefabType, prefabs.FirstOrDefault(prefab => prefab.Key == attribute.AssetId || prefab.Value.Item1.name.Contains(attribute.Name)).Value); - prefabs.Remove(attribute.AssetId); - continue; + Log.Warn($"Missing prefab in {nameof(PrefabType)}: {missing.Value.Item1.name} ({missing.Key})"); } - KeyValuePair? value = prefabs.FirstOrDefault(x => x.Value.Item1.name == attribute.Name); - if (value.HasValue) + // set all admin toy prefab caches and log any missing prefabs + CameraToy.EzArmCameraPrefab = PrefabHelper.GetPrefab(PrefabType.EzArmCameraToy); + if (!CameraToy.EzArmCameraPrefab) + Log.Warn("EzArmCamera prefab could not be found!"); + + CameraToy.EzCameraPrefab = PrefabHelper.GetPrefab(PrefabType.EzCameraToy); + if (!CameraToy.EzCameraPrefab) + Log.Warn("EzCamera prefab could not be found!"); + + CameraToy.HczCameraPrefab = PrefabHelper.GetPrefab(PrefabType.HczCameraToy); + if (!CameraToy.HczCameraPrefab) + Log.Warn("HczCamera prefab could not be found!"); + + CameraToy.LczCameraPrefab = PrefabHelper.GetPrefab(PrefabType.LczCameraToy); + if (!CameraToy.LczCameraPrefab) + Log.Warn("LczCamera prefab could not be found!"); + + CameraToy.SzCameraPrefab = PrefabHelper.GetPrefab(PrefabType.SzCameraToy); + if (!CameraToy.SzCameraPrefab) + Log.Warn("SzCamera prefab could not be found!"); + + Capybara.Prefab = PrefabHelper.GetPrefab(PrefabType.CapybaraToy); + if (!Capybara.Prefab) + Log.Warn("Capybara prefab could not be found!"); + + InteractableToy.Prefab = PrefabHelper.GetPrefab(PrefabType.InvisibleInteractableToy); + if (!InteractableToy.Prefab) + Log.Warn("InteractableToy prefab could not be found!"); + + API.Features.Toys.Light.Prefab = PrefabHelper.GetPrefab(PrefabType.LightSourceToy); + if (!API.Features.Toys.Light.Prefab) + Log.Warn("Light prefab could not be found!"); + + Primitive.Prefab = PrefabHelper.GetPrefab(PrefabType.PrimitiveObjectToy); + if (!Primitive.Prefab) + Log.Warn("Primitive prefab could not be found!"); + + ShootingTargetToy.SportShootingTargetPrefab = PrefabHelper.GetPrefab(PrefabType.SportTarget); + if (!ShootingTargetToy.SportShootingTargetPrefab) + Log.Warn("SportShootingTarget prefab could not be found!"); + + ShootingTargetToy.DboyShootingTargetPrefab = PrefabHelper.GetPrefab(PrefabType.DBoyTarget); + if (!ShootingTargetToy.DboyShootingTargetPrefab) + Log.Warn("DboyShootingTarget prefab could not be found!"); + + ShootingTargetToy.BinaryShootingTargetPrefab = PrefabHelper.GetPrefab(PrefabType.BinaryTarget); + if (!ShootingTargetToy.BinaryShootingTargetPrefab) + Log.Warn("BinaryShootingTarget prefab could not be found!"); + + Speaker.Prefab = PrefabHelper.GetPrefab(PrefabType.SpeakerToy); + if (!Speaker.Prefab) + Log.Warn("Speaker prefab could not be found!"); + + Text.Prefab = PrefabHelper.GetPrefab(PrefabType.TextToy); + if (!Text.Prefab) + Log.Warn("Text prefab could not be found!"); + + Waypoint.Prefab = PrefabHelper.GetPrefab(PrefabType.WaypointToy); + if (!Waypoint.Prefab) + Log.Warn("Waypoint prefab could not be found!"); + + bool TryGet(string name, out KeyValuePair tuple) { - Log.Warn($"Not valid AssetId {prefabType}: {attribute.Name} ({attribute.AssetId}) -> {value.Value.Value.Item1.name} ({value.Value.Key})"); + foreach (KeyValuePair kvp in prefabs.Where(kvp => kvp.Value.Item1.name == name)) + { + tuple = kvp; + return true; + } - PrefabHelper.Prefabs.Add(prefabType, prefabs.FirstOrDefault(prefab => prefab.Key == attribute.AssetId || prefab.Value.Item1.name.Contains(attribute.Name)).Value); - prefabs.Remove(value.Value.Key); - continue; + tuple = default; + return false; } - - Log.Warn($"Useless prefab {prefabType}: {attribute.Name} ({attribute.AssetId})"); } - - foreach (KeyValuePair missing in prefabs) - Log.Warn($"Missing prefab in {nameof(PrefabType)}: {missing.Value.Item1.name} ({missing.Key})"); + catch (Exception ex) + { + Log.Error(ex); + } } } } \ No newline at end of file diff --git a/EXILED/Exiled.Loader/AutoUpdateFiles.cs b/EXILED/Exiled.Loader/AutoUpdateFiles.cs index cca1835ddb..385b5a2307 100644 --- a/EXILED/Exiled.Loader/AutoUpdateFiles.cs +++ b/EXILED/Exiled.Loader/AutoUpdateFiles.cs @@ -17,6 +17,6 @@ public static class AutoUpdateFiles /// /// Gets which SCP: SL version generated Exiled. /// - public static readonly Version RequiredSCPSLVersion = new(14, 2, 0, 6); + public static readonly Version RequiredSCPSLVersion = new(14, 2, 0, 7); } } \ No newline at end of file From 8c9e29f398cadc8f0a1ca1b0820acfbf78f838b4 Mon Sep 17 00:00:00 2001 From: "@Someone" <45270312+Someone-193@users.noreply.github.com> Date: Sat, 30 May 2026 17:05:03 -0400 Subject: [PATCH 4/4] re-add support for OneSided and TwoSided --- EXILED/Exiled.API/Enums/PrefabType.cs | 3 +-- EXILED/Exiled.Events/Handlers/Internal/ClientStarted.cs | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/EXILED/Exiled.API/Enums/PrefabType.cs b/EXILED/Exiled.API/Enums/PrefabType.cs index e32ff0ce42..2f4dc531cd 100644 --- a/EXILED/Exiled.API/Enums/PrefabType.cs +++ b/EXILED/Exiled.API/Enums/PrefabType.cs @@ -31,11 +31,10 @@ public enum PrefabType [Prefab(3038351124, "LCZ BreakableDoor")] LCZBreakableDoor, - [Obsolete("This prefab no longer exists")] + // TODO: refactor HCZ door wall connector support [Prefab(400539138, "HCZ OneSided")] HCZOneSided, - [Obsolete("This prefab no longer exists")] [Prefab(2060920286, "HCZ TwoSided")] HCZTwoSided, diff --git a/EXILED/Exiled.Events/Handlers/Internal/ClientStarted.cs b/EXILED/Exiled.Events/Handlers/Internal/ClientStarted.cs index 18091b6710..9c2938be83 100644 --- a/EXILED/Exiled.Events/Handlers/Internal/ClientStarted.cs +++ b/EXILED/Exiled.Events/Handlers/Internal/ClientStarted.cs @@ -79,6 +79,8 @@ public static void OnClientStarted() for (int i = 0; i < EnumUtils.Values.Length; i++) { PrefabType prefabType = EnumUtils.Values[i]; + if (prefabType is PrefabType.HCZOneSided or PrefabType.HCZTwoSided) + continue; // skip obsolete prefabs if (typeof(PrefabType).GetField(prefabType.ToString()).GetCustomAttribute() != null)