From a38ef0037191ae39cff250aa98024aabeeeb6f3f Mon Sep 17 00:00:00 2001 From: Mikhail Reznichenko Date: Sat, 27 Apr 2024 18:12:47 +0300 Subject: [PATCH] feat: 244 breach and recontainment --- Commands/breach244.cs | 36 ++++++++++++++++++++++++++++++++++++ Commands/recontain244.cs | 40 ++++++++++++++++++++++++++++++++++++++++ VeryUsualDay.csproj | 2 ++ 3 files changed, 78 insertions(+) create mode 100644 Commands/breach244.cs create mode 100644 Commands/recontain244.cs diff --git a/Commands/breach244.cs b/Commands/breach244.cs new file mode 100644 index 0000000..2373d11 --- /dev/null +++ b/Commands/breach244.cs @@ -0,0 +1,36 @@ +using System; +using System.Linq; +using CommandSystem; +using Exiled.API.Features.Pickups; +using InventorySystem.Items.Usables.Scp244; + +namespace VeryUsualDay.Commands +{ + [CommandHandler(typeof(RemoteAdminCommandHandler))] + public class breach244 : ICommand + { + public string Command => "breach244"; + public string[] Aliases => new string[] { }; + public string Description => "Вызывает НУС объекта SCP-244-A/B. Только для СОД."; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + if (!VeryUsualDay.Instance.IsEnabledInRound) + { + response = "Режим СОД не включён!"; + return false; + } + + var counter = 0; + var pickups = Pickup.List.Where(p => (p.Type == ItemType.SCP244a || p.Type == ItemType.SCP244b) && !p.InUse).ToList(); + foreach (var pickup in pickups) + { + pickup.As().State = Scp244State.Active; + counter += 1; + } + + response = $"НУС успешно вызван. Активировано {counter} объекта(ов)."; + return true; + } + } +} \ No newline at end of file diff --git a/Commands/recontain244.cs b/Commands/recontain244.cs new file mode 100644 index 0000000..34defea --- /dev/null +++ b/Commands/recontain244.cs @@ -0,0 +1,40 @@ +using System; +using System.Linq; +using CommandSystem; +using Exiled.API.Features.Pickups; +using InventorySystem.Items.Usables.Scp244; + +namespace VeryUsualDay.Commands +{ + [CommandHandler(typeof(RemoteAdminCommandHandler))] + public class recontain244 : ICommand + { + public string Command => "recontain244"; + public string[] Aliases => new string[] { }; + public string Description => "Вызывает ВОУС объекта SCP-244-A/B. Только для СОД."; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + if (!VeryUsualDay.Instance.IsEnabledInRound) + { + response = "Режим СОД не включён!"; + return false; + } + + var counter = 0; + var pickups = Pickup.List.Where(p => (p.Type == ItemType.SCP244a || p.Type == ItemType.SCP244b) && !p.InUse).ToList(); + foreach (var pickup in pickups) + { + var type = pickup.Type; + var pos = pickup.Position; + var rot = pickup.Rotation; + pickup.Destroy(); + Pickup.CreateAndSpawn(type, pos, rot).As().State = Scp244State.Idle; + counter += 1; + } + + response = $"ВОУС успешно вызвано. Деактивировано {counter} объекта(ов)."; + return true; + } + } +} \ No newline at end of file diff --git a/VeryUsualDay.csproj b/VeryUsualDay.csproj index cc3c17d..c96ce71 100644 --- a/VeryUsualDay.csproj +++ b/VeryUsualDay.csproj @@ -70,6 +70,7 @@ + @@ -80,6 +81,7 @@ +