mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-22 08:18:13 +00:00
refactor: improve readability of NukeWars config and fix pre-commit hook
This commit is contained in:
+1
-1
@@ -5,4 +5,4 @@
|
||||
export PATH="/usr/local/bin:$HOME/.npm-global/bin:$HOME/.nvm/versions/node/$(node -v)/bin:$PATH"
|
||||
|
||||
# Then run lint-staged if tests pass
|
||||
cmd lint-staged
|
||||
npx lint-staged
|
||||
|
||||
@@ -12,13 +12,13 @@ import {
|
||||
PlayerInfo,
|
||||
PlayerType,
|
||||
Quads,
|
||||
TeamGameType,
|
||||
TerrainType,
|
||||
TerraNullius,
|
||||
Tick,
|
||||
Trios,
|
||||
UnitInfo,
|
||||
UnitType,
|
||||
TeamGameType,
|
||||
} from "../game/Game";
|
||||
import { TileRef } from "../game/GameMap";
|
||||
import { PlayerView } from "../game/GameView";
|
||||
@@ -317,8 +317,13 @@ export class DefaultConfig implements Config {
|
||||
|
||||
spawnNPCs(): boolean {
|
||||
return !this._gameConfig.disableNPCs;
|
||||
}
|
||||
|
||||
isUnitDisabled(unitType: UnitType): boolean {
|
||||
if (this._gameConfig.gameMode === GameMode.Team && this._gameConfig.teamGameType === TeamGameType.NukeWars) {
|
||||
if (
|
||||
this._gameConfig.gameMode === GameMode.Team &&
|
||||
this._gameConfig.teamGameType === TeamGameType.NukeWars
|
||||
) {
|
||||
const allowedUnits = [
|
||||
UnitType.City,
|
||||
UnitType.Port,
|
||||
@@ -629,7 +634,10 @@ export class DefaultConfig implements Config {
|
||||
|
||||
numPreparationPhaseTurns(): number {
|
||||
// Preparation phase duration (Nuke Wars uses a 3 minute prep phase)
|
||||
if (this._gameConfig.gameMode === GameMode.Team && this._gameConfig.teamGameType === TeamGameType.NukeWars) {
|
||||
if (
|
||||
this._gameConfig.gameMode === GameMode.Team &&
|
||||
this._gameConfig.teamGameType === TeamGameType.NukeWars
|
||||
) {
|
||||
return 180 * 10; // 180 seconds * 10 ticks/sec
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user