From 43f6b7cb10f709a480decc6192546fe62f7d865e Mon Sep 17 00:00:00 2001 From: Num1ock Date: Thu, 13 Feb 2025 20:11:59 +0400 Subject: [PATCH 1/7] Added method `Exiled.API.Features.Map.Clean` --- EXILED/Exiled.API/Features/Map.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/EXILED/Exiled.API/Features/Map.cs b/EXILED/Exiled.API/Features/Map.cs index c51fd1665b..4d70be9001 100644 --- a/EXILED/Exiled.API/Features/Map.cs +++ b/EXILED/Exiled.API/Features/Map.cs @@ -13,6 +13,8 @@ namespace Exiled.API.Features using System.Collections.ObjectModel; using System.Linq; + using CommandSystem.Commands.RemoteAdmin.Cleanup; + using Decals; using Enums; using Exiled.API.Extensions; using Exiled.API.Features.Hazards; @@ -27,6 +29,7 @@ namespace Exiled.API.Features using PlayerRoles.Ragdolls; using UnityEngine; using Utils; + using Utils.Networking; using Object = UnityEngine.Object; @@ -271,6 +274,27 @@ public static void CleanAllRagdolls(IEnumerable ragDolls) ragDoll.Destroy(); } + /// + /// Destroy all specified objects. + /// + /// Decal type to destroy. + /// Amount of decals to destroy. + public static void Clean(DecalPoolType decalType, int amount) + { + DecalCleanupMessage msg = new DecalCleanupMessage(decalType, amount); + + msg.SendToAuthenticated(); + } + + /// + /// Destroy specified amount of specified object. + /// + /// Decal type to destroy. + public static void Clean(DecalPoolType decalType) + { + Clean(decalType, int.MaxValue); + } + /// /// Places a blood decal. /// From f3d2ef5d6bd57eba3e92759ae3d562cf3c721d35 Mon Sep 17 00:00:00 2001 From: Num1ock <71600441+Num10ck@users.noreply.github.com> Date: Thu, 13 Feb 2025 21:11:21 +0400 Subject: [PATCH 2/7] Method documentation fix --- EXILED/Exiled.API/Features/Map.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EXILED/Exiled.API/Features/Map.cs b/EXILED/Exiled.API/Features/Map.cs index 4d70be9001..68d8291055 100644 --- a/EXILED/Exiled.API/Features/Map.cs +++ b/EXILED/Exiled.API/Features/Map.cs @@ -275,7 +275,7 @@ public static void CleanAllRagdolls(IEnumerable ragDolls) } /// - /// Destroy all specified objects. + /// Destroy specified amount of specified object. /// /// Decal type to destroy. /// Amount of decals to destroy. @@ -287,7 +287,7 @@ public static void Clean(DecalPoolType decalType, int amount) } /// - /// Destroy specified amount of specified object. + /// Destroy all specified objects. /// /// Decal type to destroy. public static void Clean(DecalPoolType decalType) From cf901d273aa27c73f3b16b0e901a5cd636d9f149 Mon Sep 17 00:00:00 2001 From: Num1ock <71600441+Num10ck@users.noreply.github.com> Date: Fri, 14 Feb 2025 05:40:00 +0400 Subject: [PATCH 3/7] Converted to lambda-expression Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> --- EXILED/Exiled.API/Features/Map.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/EXILED/Exiled.API/Features/Map.cs b/EXILED/Exiled.API/Features/Map.cs index 68d8291055..bf1aadb67d 100644 --- a/EXILED/Exiled.API/Features/Map.cs +++ b/EXILED/Exiled.API/Features/Map.cs @@ -279,12 +279,7 @@ public static void CleanAllRagdolls(IEnumerable ragDolls) /// /// Decal type to destroy. /// Amount of decals to destroy. - public static void Clean(DecalPoolType decalType, int amount) - { - DecalCleanupMessage msg = new DecalCleanupMessage(decalType, amount); - - msg.SendToAuthenticated(); - } + public static void Clean(DecalPoolType decalType, int amount) => new DecalCleanupMessage(decalType, amount).SendToAuthenticated(); /// /// Destroy all specified objects. From 9ab4230b207e3101b34e6ffd968ce5541490d5a7 Mon Sep 17 00:00:00 2001 From: Num1ock <71600441+Num10ck@users.noreply.github.com> Date: Fri, 14 Feb 2025 05:40:54 +0400 Subject: [PATCH 4/7] Converted to lambda-expression Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> --- EXILED/Exiled.API/Features/Map.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/EXILED/Exiled.API/Features/Map.cs b/EXILED/Exiled.API/Features/Map.cs index bf1aadb67d..4a953744f2 100644 --- a/EXILED/Exiled.API/Features/Map.cs +++ b/EXILED/Exiled.API/Features/Map.cs @@ -285,10 +285,7 @@ public static void CleanAllRagdolls(IEnumerable ragDolls) /// Destroy all specified objects. /// /// Decal type to destroy. - public static void Clean(DecalPoolType decalType) - { - Clean(decalType, int.MaxValue); - } + public static void Clean(DecalPoolType decalType) => Clean(decalType, int.MaxValue); /// /// Places a blood decal. From c91885b5c54f3f93771e29fb32def40045a2fe8d Mon Sep 17 00:00:00 2001 From: Num1ock Date: Fri, 14 Feb 2025 17:02:42 +0400 Subject: [PATCH 5/7] fix: Spawning Npc via RA doesn't add it to `Npc.List` --- .../FixRemoteAdminCommandNotAddNpcToList.cs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 EXILED/Exiled.Events/Patches/Fixes/FixRemoteAdminCommandNotAddNpcToList.cs diff --git a/EXILED/Exiled.Events/Patches/Fixes/FixRemoteAdminCommandNotAddNpcToList.cs b/EXILED/Exiled.Events/Patches/Fixes/FixRemoteAdminCommandNotAddNpcToList.cs new file mode 100644 index 0000000000..6b278a76ad --- /dev/null +++ b/EXILED/Exiled.Events/Patches/Fixes/FixRemoteAdminCommandNotAddNpcToList.cs @@ -0,0 +1,32 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.Patches.Fixes +{ +#pragma warning disable SA1313 // Parameter names should begin with lower-case letter + + using System.Linq; + + using Exiled.API.Features; + + using GameCore; + using HarmonyLib; + + /// + /// Fix for RA command does not adding to . + /// + [HarmonyPatch(typeof(DummyUtils), nameof(DummyUtils.SpawnDummy))] + internal static class FixRemoteAdminCommandNotAddNpcToList + { + private static void Postfix(ReferenceHub __result) + { + Npc npc = new Npc(__result); + + Npc.Dictionary.Add(npc.GameObject, npc); + } + } +} From 14a785179e8971d1e2254bf0b7dbb24ed581297f Mon Sep 17 00:00:00 2001 From: Num1ock <71600441+Num10ck@users.noreply.github.com> Date: Fri, 14 Feb 2025 05:40:54 +0400 Subject: [PATCH 6/7] Converted to lambda-expression Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> --- EXILED/Exiled.API/Features/Map.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/EXILED/Exiled.API/Features/Map.cs b/EXILED/Exiled.API/Features/Map.cs index bf1aadb67d..4a953744f2 100644 --- a/EXILED/Exiled.API/Features/Map.cs +++ b/EXILED/Exiled.API/Features/Map.cs @@ -285,10 +285,7 @@ public static void CleanAllRagdolls(IEnumerable ragDolls) /// Destroy all specified objects. /// /// Decal type to destroy. - public static void Clean(DecalPoolType decalType) - { - Clean(decalType, int.MaxValue); - } + public static void Clean(DecalPoolType decalType) => Clean(decalType, int.MaxValue); /// /// Places a blood decal. From 0fd197d8d783f7f9c09181fa1f0c2b17da0f2d86 Mon Sep 17 00:00:00 2001 From: Num1ock Date: Tue, 18 Feb 2025 08:06:33 +0400 Subject: [PATCH 7/7] Wrong patch removed. --- .../FixRemoteAdminCommandNotAddNpcToList.cs | 32 ------------------- 1 file changed, 32 deletions(-) delete mode 100644 EXILED/Exiled.Events/Patches/Fixes/FixRemoteAdminCommandNotAddNpcToList.cs diff --git a/EXILED/Exiled.Events/Patches/Fixes/FixRemoteAdminCommandNotAddNpcToList.cs b/EXILED/Exiled.Events/Patches/Fixes/FixRemoteAdminCommandNotAddNpcToList.cs deleted file mode 100644 index 6b278a76ad..0000000000 --- a/EXILED/Exiled.Events/Patches/Fixes/FixRemoteAdminCommandNotAddNpcToList.cs +++ /dev/null @@ -1,32 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) ExMod Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.Events.Patches.Fixes -{ -#pragma warning disable SA1313 // Parameter names should begin with lower-case letter - - using System.Linq; - - using Exiled.API.Features; - - using GameCore; - using HarmonyLib; - - /// - /// Fix for RA command does not adding to . - /// - [HarmonyPatch(typeof(DummyUtils), nameof(DummyUtils.SpawnDummy))] - internal static class FixRemoteAdminCommandNotAddNpcToList - { - private static void Postfix(ReferenceHub __result) - { - Npc npc = new Npc(__result); - - Npc.Dictionary.Add(npc.GameObject, npc); - } - } -}