Skip to content

Commit

Permalink
feat: config DisableOnBomb & RestartOnLoad
Browse files Browse the repository at this point in the history
  • Loading branch information
oscar-wos committed Jul 6, 2024
1 parent 9693b24 commit 3913c1b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/AntiRush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public override void Load(bool isReload)
foreach (var controller in Utilities.GetPlayers())
_playerData[controller] = new PlayerData();

Server.ExecuteCommand("mp_restartgame 1");
if (Config.RestartOnLoad)
Server.ExecuteCommand("mp_restartgame 1");
});
}

Expand Down
4 changes: 3 additions & 1 deletion src/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ namespace AntiRush;

public class AntiRushConfig : BasePluginConfig
{
public override int Version { get; set; } = 3;
public override int Version { get; set; } = 4;
[JsonPropertyName("Messages")] public string Messages { get; set; } = "simple";
[JsonPropertyName("DrawZones")] public bool DrawZones { get; set; } = false;
[JsonPropertyName("Warmup")] public bool Warmup { get; set; } = false;
[JsonPropertyName("DisableOnBombPlant")] public bool DisableOnBombPlant { get; set; } = true;
[JsonPropertyName("RestartOnLoad")] public bool RestartOnLoad { get; set; } = true;
[JsonPropertyName("NoRushTime")] public int NoRushTime { get; set; } = 0;
[JsonPropertyName("NoCampTime")] public int NoCampTime { get; set; } = 0;
}
3 changes: 3 additions & 0 deletions src/Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ private HookResult OnRoundStart(EventRoundStart @event, GameEventInfo info)

private HookResult OnBombPlanted(EventBombPlanted @event, GameEventInfo info)
{
if (!Config.DisableOnBombPlant)
return HookResult.Continue;

_bombPlanted = true;
Server.PrintToChatAll($"{Prefix}{Localizer["rushDisabled"]}");

Expand Down
2 changes: 1 addition & 1 deletion src/Globals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace AntiRush;
public partial class AntiRush
{
public override string ModuleName => "AntiRush";
public override string ModuleVersion => "1.0.2";
public override string ModuleVersion => "1.0.3";
public override string ModuleAuthor => "https://github.com/oscar-wos/AntiRush";
public AntiRushConfig Config { get; set; } = new();
public Menu.Menu Menu { get; } = new();
Expand Down
2 changes: 1 addition & 1 deletion src/Listeners.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public partial class AntiRush
{
private void OnTick()
{
if (_warmup && !Config.Warmup)
if (!Config.Warmup && _warmup)
return;

if (Config.NoRushTime != 0 && !_bombPlanted)
Expand Down

0 comments on commit 3913c1b

Please sign in to comment.