mirror of
https://github.com/GoodStartLabs/AI_Diplomacy.git
synced 2026-04-19 12:58:09 +00:00
Can now set the power a game should run as
When creating a game.json, you can set the top level key "power" to any valid key of PowerENUM and the game will always run from that power's perspective.
This commit is contained in:
parent
32cce1bce0
commit
8c2d778065
3 changed files with 8 additions and 4 deletions
|
|
@ -97,7 +97,7 @@ class GameState {
|
|||
constructor(boardName: AvailableMaps) {
|
||||
this.phaseIndex = 0
|
||||
this.boardName = boardName
|
||||
this.currentPower = getRandomPower()
|
||||
this.currentPower = null;
|
||||
this.gameId = 1
|
||||
// State locks
|
||||
this.isSpeaking = false
|
||||
|
|
@ -156,6 +156,8 @@ class GameState {
|
|||
playBtn.disabled = false;
|
||||
speedSelector.disabled = false;
|
||||
|
||||
// Set the poewr if the game specifies it, else random.
|
||||
this.currentPower = this.gameData.power !== undefined ? this.gameData.power : getRandomPower();
|
||||
|
||||
|
||||
const momentsFilePath = `./games/${this.gameId}/moments.json`;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,9 @@ function initScene() {
|
|||
// Load default game file if in debug mode
|
||||
if (config.isDebugMode || isStreamingMode) {
|
||||
gameState.loadGameFile(0);
|
||||
|
||||
// Initialize info panel
|
||||
logger.updateInfoPanel();
|
||||
}
|
||||
|
||||
// Initialize debug menu if in debug mode
|
||||
|
|
@ -69,8 +72,6 @@ function initScene() {
|
|||
// Kick off animation loop
|
||||
animate();
|
||||
|
||||
// Initialize info panel
|
||||
logger.updateInfoPanel();
|
||||
}
|
||||
|
||||
function createCameraPan(): Group {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { z } from 'zod';
|
||||
import { PowerENUMSchema } from './map';
|
||||
import { PowerENUM, PowerENUMSchema } from './map';
|
||||
import { OrderFromString } from './unitOrders';
|
||||
import { ProvinceENUMSchema } from './map';
|
||||
|
||||
|
|
@ -67,6 +67,7 @@ const PhaseSchema = z.object({
|
|||
export const GameSchema = z.object({
|
||||
map: z.string(),
|
||||
id: z.string(),
|
||||
power: PowerENUMSchema.optional(),
|
||||
phases: z.array(PhaseSchema),
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue