diff --git a/Modules/OptionHolder.cs b/Modules/OptionHolder.cs index 63ac58611..f5e1c817c 100644 --- a/Modules/OptionHolder.cs +++ b/Modules/OptionHolder.cs @@ -384,6 +384,8 @@ public static class Options public static OptionItem DleksChance; public static OptionItem AirshipChance; public static OptionItem FungleChance; + public static OptionItem MinPlayersForAirship; + public static OptionItem MinPlayersForFungle; public static OptionItem GodfatherCancelVote; @@ -1925,6 +1927,14 @@ public static class Options FungleChance = new IntegerOptionItem(19922, "FungleChance", new(0, 100, 5), 0, TabGroup.GameSettings) .SetParent(RandomMapsMode) .SetValueFormat(OptionFormat.Percent); + + MinPlayersForAirship = new IntegerOptionItem(19915, "MinPlayersForAirship", new(1, 15, 1), 10, TabGroup.GameSettings) + .SetParent(AirshipChance) + .SetValueFormat(OptionFormat.Players); + + MinPlayersForFungle = new IntegerOptionItem(19923, "MinPlayersForFungle", new(1, 15, 1), 8, TabGroup.GameSettings) + .SetParent(FungleChance) + .SetValueFormat(OptionFormat.Players); LoadingPercentage = 69; diff --git a/Patches/GameStartManagerPatch.cs b/Patches/GameStartManagerPatch.cs index 259d32109..5232553ba 100644 --- a/Patches/GameStartManagerPatch.cs +++ b/Patches/GameStartManagerPatch.cs @@ -589,6 +589,11 @@ public static class GameStartRandomMap 5 => Options.FungleChance.GetInt(), _ => 0 }); + + int playerCount = Main.AllPlayerControls.Length; + if (playerCount < Options.MinPlayersForAirship.GetInt()) chance.Remove(4); + if (playerCount < Options.MinPlayersForFungle.GetInt()) chance.Remove(5); + byte[] pool = chance.SelectMany(x => Enumerable.Repeat(x.Key, x.Value / 5)).ToArray(); return pool.Length == 0 ? chance.Keys.RandomElement() : pool.RandomElement(); } diff --git a/Resources/Lang/en_US.json b/Resources/Lang/en_US.json index b49f5ea1e..5ab992394 100644 --- a/Resources/Lang/en_US.json +++ b/Resources/Lang/en_US.json @@ -3469,6 +3469,8 @@ "DleksChance": "Chance that the map is dlekS ehT", "AirshipChance": "Chance that the map is Airship", "FungleChance": "Chance that the map is The Fungle", + "MinPlayersForAirship": "Minimum Players for Airship", + "MinPlayersForFungle": "Minimum Players for The Fungle", "CamouflageMode.Default": "Default", "CamouflageMode.Host": "Host", "CamouflageMode.Karpe": "KARPED1EM",