Skip to content

Commit

Permalink
added IgnoredRoles config to fix an issue with effect #18
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikihero committed Oct 8, 2023
1 parent aacf642 commit 414af50
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions BetterCoinflips/Configs/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ public class Config : IConfig
RoleTypeId.Scp939,
};

[Description("List of ignored roles for the PlayerSwapEffect (#18)")]
public List<RoleTypeId> IgnoredRoles = new()
{
RoleTypeId.Spectator,
RoleTypeId.Filmmaker,
RoleTypeId.Overwatch,
};

[Description("The chance of these good effects happening. It's a proportional chance not a % chance.")]
public int KeycardChance { get; set; } = 20;
public int MedicalKitChance { get; set; } = 35;
Expand Down
2 changes: 1 addition & 1 deletion BetterCoinflips/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class Plugin : Plugin<Config, Configs.Translations>
{
public static Plugin Instance;
public override Version RequiredExiledVersion => new(8, 2, 1, 0);
public override Version Version => new(4, 2, 0);
public override Version Version => new(4, 2, 1, 0);
public override string Author => "Miki_hero";
public override string Name => "BetterCoinflips";
public override string Prefix => "better_cf";
Expand Down
6 changes: 3 additions & 3 deletions BetterCoinflips/Types/CoinEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ namespace BetterCoinflips.Types
{
public class CoinFlipEffect
{
private static readonly Config Cfg = Plugin.Instance.Config;
private static readonly Configs.Translations Translations = Plugin.Instance.Translation;
private static Config Cfg => Plugin.Instance.Config;
private static Configs.Translations Translations => Plugin.Instance.Translation;
private static readonly System.Random Rd = new();

public Action<Player> Execute { get; set; }
Expand Down Expand Up @@ -332,7 +332,7 @@ public CoinFlipEffect(Action<Player> execute, string message)
//17
new CoinFlipEffect(player =>
{
var playerList = Player.List.Where(x => x.Role.Type != RoleTypeId.Spectator).ToList();
var playerList = Player.List.Where(x => !Cfg.IgnoredRoles.Contains(x.Role.Type)).ToList();
playerList.Remove(player);
if (playerList.IsEmpty())
{
Expand Down

0 comments on commit 414af50

Please sign in to comment.