diff --git a/CISpy/EventHandler.cs b/CISpy/EventHandler.cs index 2885877..5339028 100644 --- a/CISpy/EventHandler.cs +++ b/CISpy/EventHandler.cs @@ -46,7 +46,7 @@ public void OnRoundEnd(RoundEndEvent ev) public void OnTeamRespawn(TeamRespawnEvent ev) { - if (Plugin.isEnabled && !ev.SpawnChaos) + if (Plugin.isEnabled && !ev.SpawnChaos && Plugin.rand.Next(1, 101) <= Plugin.spawnChance) { Timing.Next(() => { diff --git a/CISpy/GameLogic.cs b/CISpy/GameLogic.cs index 7061463..9db9af9 100644 --- a/CISpy/GameLogic.cs +++ b/CISpy/GameLogic.cs @@ -15,6 +15,7 @@ public void LoadConfig() Plugin.guardChance = Plugin.instance.GetConfigInt("cis_guard_chance"); Plugin.MTFRoles = Plugin.instance.GetConfigIntList("cis_spy_roles").Select(x => (Role)x).ToList(); Plugin.canSpawnWithGrenade = Plugin.instance.GetConfigBool("cis_spawn_with_grenade"); + Plugin.spawnChance = Plugin.instance.GetConfigInt("cis_spawn_chance"); } public static int CountRoles(Role role) diff --git a/CISpy/Plugin.cs b/CISpy/Plugin.cs index 98fc4e1..d2e0b5d 100644 --- a/CISpy/Plugin.cs +++ b/CISpy/Plugin.cs @@ -26,6 +26,7 @@ public class Plugin : Smod2.Plugin public static bool isEnabled = false; public static int guardChance = 50; public static bool canSpawnWithGrenade = true; + public static int spawnChance = 40; public static List MTFRoles = new List(); public static Dictionary SpyDict = new Dictionary(); @@ -54,6 +55,7 @@ public override void Register() 13 }, false, true, "Which roles can be a spy.")); AddConfig(new Smod2.Config.ConfigSetting("cis_spawn_with_grenade", true, false, true, "If spies should be able to spawn with frag grenades")); + AddConfig(new Smod2.Config.ConfigSetting("cis_spawn_chance", 40, false, true, "The chance for a CISpy to spawn in an MTF wave.")); } public static int LevenshteinDistance(string s, string t)