Skip to content

Commit c8aa542

Browse files
authored
[PR #2350] Future-proofing for competitive modopts
They were scattered all over the place. Some were missing so this patch also fixes that: * tourney rooms lacked the speed caps. * all other room types except tourney lacked mutelobby.
1 parent cf09efc commit c8aa542

5 files changed

Lines changed: 15 additions & 14 deletions

File tree

Shared/LobbyClient/Battle.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,13 @@ public override string ToString()
119119
return $"{ModName} {MapName} ({NonSpectatorCount}+{SpectatorCount}/{MaxPlayers})";
120120
}
121121

122-
122+
public void SetCompetitiveModoptions()
123+
{
124+
ModOptions["MinSpeed"] = "1";
125+
ModOptions["MaxSpeed"] = "1";
126+
ModOptions["mutespec"] = "mute";
127+
ModOptions["mutelobby"] = "mute";
128+
}
123129

124130
public LobbyHostingContext GetContext()
125131
{

ZkLobbyServer/MatchMaker/MatchMakerBattle.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ public MatchMakerBattle(ZkLobbyServer server, MatchMaker.ProposedBattle bat, str
2626

2727
if (ModOptions == null) ModOptions = new Dictionary<string, string>();
2828

29-
// hacky way to send some extra start setup data
30-
if (bat.QueueType.Mode != AutohostMode.GameChickens) ModOptions["mutespec"] = "mute";
29+
// proper way to send some extra start setup data
30+
if (bat.QueueType.Mode != AutohostMode.GameChickens)
31+
SetCompetitiveModoptions();
3132
ModOptions["MatchMakerType"] = bat.QueueType.Name;
32-
ModOptions["MinSpeed"] = "1";
33-
ModOptions["MaxSpeed"] = "1";
3433

3534
ValidateAndFillDetails();
3635
}

ZkLobbyServer/MatchMaker/PlanetWarsServerBattle.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public PlanetWarsServerBattle(ZkLobbyServer server, PlanetWarsMatchMaker.AttackO
2929

3030
if (ModOptions == null) ModOptions = new Dictionary<string, string>();
3131

32-
ModOptions["mutespec"] = "mute";
32+
SetCompetitiveModoptions();
3333

3434
ValidateAndFillDetails();
3535
}
@@ -52,4 +52,4 @@ public override void ValidateBattleStatus(UserBattleStatus ubs)
5252
}
5353
}
5454
}
55-
}
55+
}

ZkLobbyServer/MatchMaker/TourneyBattle.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public TourneyBattle(ZkLobbyServer server, TourneyPrototype prototype) : base(se
3131
Mode = prototype.TeamPlayers.Max(x => x.Count) == 1 ? AutohostMode.Game1v1 : AutohostMode.None;
3232
MaxPlayers = prototype.TeamPlayers.Sum(x=>x.Count);
3333
ModOptions = prototype.ModOptions;
34-
ModOptions["mutespec"] = "mute";
35-
ModOptions["mutelobby"] = "mute";
36-
ModOptions["allyreclaim"] = "1";
34+
35+
SetCompetitiveModoptions();
36+
ModOptions["allyreclaim"] = "1"; // even more competitive than the above
3737

3838
ValidateAndFillDetails();
3939
}

ZkLobbyServer/SpringieInterface/StartSetup.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ public static LobbyHostingContext GetDedicatedServerStartSetup(LobbyHostingConte
6969

7070
if (attacker == defender) defender = null;
7171

72-
ret.ModOptions["MinSpeed"] = "1";
73-
ret.ModOptions["MaxSpeed"] = "1";
74-
ret.ModOptions["mutespec"] = "mute";
75-
7672
ret.ModOptions["attackingFaction"] = attacker.Shortcut;
7773
ret.ModOptions["attackingFactionName"] = attacker.Name;
7874
ret.ModOptions["attackingFactionColor"] = attacker.Color;

0 commit comments

Comments
 (0)