Skip to content

Commit

Permalink
Added cis_spawn_chance
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyanox62 committed May 19, 2019
1 parent 9476666 commit a9aec44
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CISpy/EventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(() =>
{
Expand Down
1 change: 1 addition & 0 deletions CISpy/GameLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions CISpy/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Role> MTFRoles = new List<Role>();

public static Dictionary<string, bool> SpyDict = new Dictionary<string, bool>();
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a9aec44

Please sign in to comment.