Skip to content

Commit

Permalink
Changed vudclear meds + added shakhed belt
Browse files Browse the repository at this point in the history
  • Loading branch information
JustMarfix committed Jul 29, 2024
1 parent 8853120 commit f7ae5d5
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 5 deletions.
1 change: 1 addition & 0 deletions Commands/PluginEnable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public bool Execute(ArraySegment<string> 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");
Expand Down
45 changes: 45 additions & 0 deletions Commands/Shakhed.cs
Original file line number Diff line number Diff line change
@@ -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<string> 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;
}
}
}
35 changes: 35 additions & 0 deletions Commands/ShakhedBoom.cs
Original file line number Diff line number Diff line change
@@ -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<string> 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;
}
}
}
21 changes: 21 additions & 0 deletions Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,9 @@ public class Config : IConfig
[Description("Список вещей, у которых есть иммунитет к чистке командой vudclear (List<ItemType>)")]
public List<ItemType> ClearImmunityItems { get; set; } = new List<ItemType>
{
ItemType.Medkit,
ItemType.Adrenaline,
ItemType.Painkillers,
ItemType.MicroHID,
ItemType.GunE11SR,
ItemType.GunCOM15,
Expand All @@ -839,5 +842,23 @@ public class Config : IConfig
ItemType.SCP244a,
ItemType.SCP244b
};

[Description("Список DamageType, которые взрывают пояс шахида (List<DamageType>)")]
public List<DamageType> BlowingDamageTypes { get; set; } = new List<DamageType>
{
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
};
}
}
16 changes: 12 additions & 4 deletions Handlers/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions Handlers/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
3 changes: 2 additions & 1 deletion VeryUsualDay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ public class VeryUsualDay : Plugin<Config>
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; }
public bool IsDboysSpawnAllowed { get; set; }
public bool IsTeslaEnabled { get; set; }
public List<int> JoinedDboys { get; set; } = new List<int>();
public List<int> DBoysQueue { get; set; } = new List<int>();
public List<int> Shakheds { get; set; } = new List<int>();
public List<RoomType> ChaosRooms { get; set; } = new List<RoomType>();
public int BuoCounter { get; set; } = 1;
public int SpawnedDboysCounter { get; set; } = 1;
Expand Down
2 changes: 2 additions & 0 deletions VeryUsualDay.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
<Compile Include="Commands\recontain244.cs" />
<Compile Include="Commands\redoors.cs" />
<Compile Include="Commands\RoleDistribution.cs" />
<Compile Include="Commands\Shakhed.cs" />
<Compile Include="Commands\ShakhedBoom.cs" />
<Compile Include="Commands\spawn035.cs" />
<Compile Include="Commands\SetCode.cs" />
<Compile Include="Commands\spawn035_2.cs" />
Expand Down

0 comments on commit f7ae5d5

Please sign in to comment.