Skip to content

Commit 4d3359d

Browse files
committed
Remove variable tickrate
1 parent 023eac9 commit 4d3359d

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

src/core/configuration/Config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export enum GameEnv {
2828
}
2929

3030
export interface ServerConfig {
31-
turnIntervalMs(gameType?: GameType): number;
31+
turnIntervalMs(): number;
3232
startDelay(gameType: GameType): number;
3333
gameCreationRate(): number;
3434
lobbyMaxPlayers(
@@ -74,7 +74,7 @@ export interface NukeMagnitude {
7474
}
7575

7676
export interface Config {
77-
turnIntervalMs(gameType?: GameType): number;
77+
turnIntervalMs(): number;
7878
samHittingChance(): number;
7979
samWarheadHittingChance(): number;
8080
spawnImmunityDuration(): Tick;

src/core/configuration/DefaultConfig.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,7 @@ export abstract class DefaultServerConfig implements ServerConfig {
172172
}
173173
abstract numWorkers(): number;
174174
abstract env(): GameEnv;
175-
turnIntervalMs(gameType?: GameType): number {
176-
if (gameType && gameType === GameType.Singleplayer) {
177-
return 10;
178-
}
175+
turnIntervalMs(): number {
179176
return 100;
180177
}
181178
// Start game immediately for single player games, with delay for multiplayer games
@@ -280,8 +277,8 @@ export class DefaultConfig implements Config {
280277
return this._serverConfig;
281278
}
282279

283-
turnIntervalMs(gameType?: GameType): number {
284-
return this._serverConfig.turnIntervalMs(gameType);
280+
turnIntervalMs(): number {
281+
return this._serverConfig.turnIntervalMs();
285282
}
286283

287284
userSettings(): UserSettings {

src/server/GameServer.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,10 @@ export class GameServer {
430430
}
431431
this.gameStartInfo = result.data satisfies GameStartInfo;
432432

433-
const turnInterval = this.config.turnIntervalMs(this.gameConfig.gameType);
434-
this.endTurnIntervalID = setInterval(() => this.endTurn(), turnInterval);
433+
this.endTurnIntervalID = setInterval(
434+
() => this.endTurn(),
435+
this.config.turnIntervalMs(),
436+
);
435437
this.activeClients.forEach((c) => {
436438
this.log.info("sending start message", {
437439
clientID: c.clientID,

0 commit comments

Comments
 (0)