mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-28 09:50:28 +00:00
Equalize team sizes (#992)
## Description: Ensure that team sizes are equal. Closes #841 ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors --------- Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
This commit is contained in:
co-authored by
Scott Anderson
parent
9089de959b
commit
9831461604
@@ -137,11 +137,19 @@ export abstract class DefaultServerConfig implements ServerConfig {
|
||||
return 60 * 1000;
|
||||
}
|
||||
|
||||
lobbyMaxPlayers(map: GameMapType, mode: GameMode): number {
|
||||
lobbyMaxPlayers(
|
||||
map: GameMapType,
|
||||
mode: GameMode,
|
||||
numPlayerTeams: number | undefined,
|
||||
): number {
|
||||
const [l, m, s] = numPlayersConfig[map] ?? [50, 30, 20];
|
||||
const r = Math.random();
|
||||
const base = r < 0.3 ? l : r < 0.6 ? m : s;
|
||||
return Math.min(mode === GameMode.Team ? Math.ceil(base * 1.5) : base, 150);
|
||||
let p = Math.min(mode === GameMode.Team ? Math.ceil(base * 1.5) : base, l);
|
||||
if (numPlayerTeams !== undefined) {
|
||||
p -= p % numPlayerTeams;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
workerIndex(gameID: GameID): number {
|
||||
|
||||
Reference in New Issue
Block a user