From f7ae5d5506480c4633a20066e3bab6fb0db243ce Mon Sep 17 00:00:00 2001 From: Mikhail Reznichenko Date: Mon, 29 Jul 2024 21:51:02 +0300 Subject: [PATCH] Changed vudclear meds + added shakhed belt --- Commands/PluginEnable.cs | 1 + Commands/Shakhed.cs | 45 ++++++++++++++++++++++++++++++++++++++++ Commands/ShakhedBoom.cs | 35 +++++++++++++++++++++++++++++++ Config.cs | 21 +++++++++++++++++++ Handlers/Player.cs | 16 ++++++++++---- Handlers/Server.cs | 1 + VeryUsualDay.cs | 3 ++- VeryUsualDay.csproj | 2 ++ 8 files changed, 119 insertions(+), 5 deletions(-) create mode 100644 Commands/Shakhed.cs create mode 100644 Commands/ShakhedBoom.cs diff --git a/Commands/PluginEnable.cs b/Commands/PluginEnable.cs index 40af29c..83df50d 100644 --- a/Commands/PluginEnable.cs +++ b/Commands/PluginEnable.cs @@ -34,6 +34,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s VeryUsualDay.Instance.JoinedDboys.Clear(); VeryUsualDay.Instance.DBoysQueue.Clear(); VeryUsualDay.Instance.ChaosRooms.Clear(); + VeryUsualDay.Instance.Shakheds.Clear(); // Timing.KillCoroutines("_avel"); Timing.KillCoroutines("_joining"); Timing.KillCoroutines("_prisonTimer"); diff --git a/Commands/Shakhed.cs b/Commands/Shakhed.cs new file mode 100644 index 0000000..64b2354 --- /dev/null +++ b/Commands/Shakhed.cs @@ -0,0 +1,45 @@ +using System; +using System.Linq; +using CommandSystem; +using Exiled.API.Features; + +namespace VeryUsualDay.Commands +{ + [CommandHandler(typeof(RemoteAdminCommandHandler))] + public class Shakhed : ICommand + { + public string Command => "shakhed"; + public string[] Aliases => new string[] { }; + public string Description => "Для FX. Надевает/снимает с игрока пояс шахида. Использование: shakhed [id]"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + if (!VeryUsualDay.Instance.IsEnabledInRound) + { + response = "Режим FX не включён!"; + return false; + } + if (arguments.Count != 1) + { + response = "Использование: shakhed [id]"; + return false; + } + var args = arguments.ToArray(); + if (!Player.TryGet(args[0], out var player)) + { + response = "Не удалось найти игрока."; + return false; + } + + if (VeryUsualDay.Instance.Shakheds.Contains(player.Id)) + { + VeryUsualDay.Instance.Shakheds.Remove(player.Id); + response = "Игрок больше не носит шахид-пояс!"; + return true; + } + VeryUsualDay.Instance.Shakheds.Add(player.Id); + response = "Игрок теперь носит шахид-пояс."; + return true; + } + } +} \ No newline at end of file diff --git a/Commands/ShakhedBoom.cs b/Commands/ShakhedBoom.cs new file mode 100644 index 0000000..086cdf7 --- /dev/null +++ b/Commands/ShakhedBoom.cs @@ -0,0 +1,35 @@ +using System; +using System.Linq; +using CommandSystem; +using Exiled.API.Enums; +using Exiled.API.Features; + +namespace VeryUsualDay.Commands +{ + [CommandHandler(typeof(ClientCommandHandler))] + public class ShakhedBoom : ICommand + { + public string Command => "boom"; + public string[] Aliases => new string[] { }; + public string Description => "Для Foundation-X. Позволяет взорваться, если на вас пояс шахида."; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + if (!VeryUsualDay.Instance.IsEnabledInRound) + { + response = "Режим FX не включён!"; + return false; + } + + var playerSender = Player.Get(sender); + if (!VeryUsualDay.Instance.Shakheds.Contains(playerSender.Id)) + { + response = "Вы не носите пояс шахида."; + return false; + } + playerSender.Explode(ProjectileType.FragGrenade, playerSender); + response = "Бабах."; + return true; + } + } +} \ No newline at end of file diff --git a/Config.cs b/Config.cs index d37ee12..887d3fa 100644 --- a/Config.cs +++ b/Config.cs @@ -825,6 +825,9 @@ public class Config : IConfig [Description("Список вещей, у которых есть иммунитет к чистке командой vudclear (List)")] public List ClearImmunityItems { get; set; } = new List { + ItemType.Medkit, + ItemType.Adrenaline, + ItemType.Painkillers, ItemType.MicroHID, ItemType.GunE11SR, ItemType.GunCOM15, @@ -839,5 +842,23 @@ public class Config : IConfig ItemType.SCP244a, ItemType.SCP244b }; + + [Description("Список DamageType, которые взрывают пояс шахида (List)")] + public List BlowingDamageTypes { get; set; } = new List + { + DamageType.Firearm, + DamageType.Com15, + DamageType.Com18, + DamageType.Com45, + DamageType.Crossvec, + DamageType.Explosion, + DamageType.Frmg0, + DamageType.Fsp9, + DamageType.Logicer, + DamageType.Revolver, + DamageType.Shotgun, + DamageType.AK, + DamageType.E11Sr + }; } } diff --git a/Handlers/Player.cs b/Handlers/Player.cs index a21079d..0850b64 100644 --- a/Handlers/Player.cs +++ b/Handlers/Player.cs @@ -141,12 +141,14 @@ public static void OnDied(DiedEventArgs ev) { VeryUsualDay.Instance.DBoysQueue.Remove(ev.Player.Id); } - if (VeryUsualDay.Instance.JoinedDboys.Contains(ev.Player.Id)) { VeryUsualDay.Instance.JoinedDboys.Remove(ev.Player.Id); } - + if (VeryUsualDay.Instance.Shakheds.Contains(ev.Player.Id)) + { + VeryUsualDay.Instance.Shakheds.Remove(ev.Player.Id); + } if (VeryUsualDay.Instance.CurrentCode == VeryUsualDay.Codes.Green || VeryUsualDay.Instance.CurrentCode == VeryUsualDay.Codes.Emerald) { @@ -167,16 +169,18 @@ public static void OnLeft(LeftEventArgs ev) { VeryUsualDay.Instance.ScpPlayers.Remove(ev.Player.Id); } - if (VeryUsualDay.Instance.DBoysQueue.Contains(ev.Player.Id)) { VeryUsualDay.Instance.DBoysQueue.Remove(ev.Player.Id); } - if (VeryUsualDay.Instance.JoinedDboys.Contains(ev.Player.Id)) { VeryUsualDay.Instance.JoinedDboys.Remove(ev.Player.Id); } + if (VeryUsualDay.Instance.Shakheds.Contains(ev.Player.Id)) + { + VeryUsualDay.Instance.Shakheds.Remove(ev.Player.Id); + } } public static void OnShooting(ShootingEventArgs ev) @@ -222,6 +226,10 @@ public static void OnVerified(VerifiedEventArgs ev) public static void OnHurt(HurtEventArgs ev) { + if (VeryUsualDay.Instance.Config.BlowingDamageTypes.Contains(ev.DamageHandler.Type)) + { + ev.Player.Explode(ProjectileType.FragGrenade, ev.Attacker); + } if (!VeryUsualDay.Instance.IsEnabledInRound || !ev.Player.TryGetSessionVariable("vudmood", out string mood)) return; if (ev.Player.Health <= ev.Player.MaxHealth * 0.1) diff --git a/Handlers/Server.cs b/Handlers/Server.cs index 94a6f19..b781e93 100644 --- a/Handlers/Server.cs +++ b/Handlers/Server.cs @@ -22,6 +22,7 @@ public static void OnWaitingForPlayers() VeryUsualDay.Instance.JoinedDboys.Clear(); VeryUsualDay.Instance.DBoysQueue.Clear(); VeryUsualDay.Instance.ChaosRooms.Clear(); + VeryUsualDay.Instance.Shakheds.Clear(); // Timing.KillCoroutines("_avel"); Timing.KillCoroutines("_joining"); Timing.KillCoroutines("_prisonTimer"); diff --git a/VeryUsualDay.cs b/VeryUsualDay.cs index 0586494..c153822 100644 --- a/VeryUsualDay.cs +++ b/VeryUsualDay.cs @@ -28,7 +28,7 @@ public class VeryUsualDay : Plugin public override string Author => "JustMarfix"; public override string Name => "VeryUsualDay (FX Version)"; - public override Version Version => new Version(4, 3, 1); + public override Version Version => new Version(4, 4, 0); public bool IsEnabledInRound { get; set; } public bool IsLunchtimeActive { get; set; } @@ -36,6 +36,7 @@ public class VeryUsualDay : Plugin public bool IsTeslaEnabled { get; set; } public List JoinedDboys { get; set; } = new List(); public List DBoysQueue { get; set; } = new List(); + public List Shakheds { get; set; } = new List(); public List ChaosRooms { get; set; } = new List(); public int BuoCounter { get; set; } = 1; public int SpawnedDboysCounter { get; set; } = 1; diff --git a/VeryUsualDay.csproj b/VeryUsualDay.csproj index 292eacc..82b68ce 100644 --- a/VeryUsualDay.csproj +++ b/VeryUsualDay.csproj @@ -85,6 +85,8 @@ + +