Adding automatic start to playing if we set an env variable.

Also added a dev container that will hot load your code, so we can make
sure out environments are identical.
This commit is contained in:
Tyler Marques 2025-03-19 09:36:31 -04:00
parent f00a037aed
commit 40851c572e
No known key found for this signature in database
GPG key ID: 7672EFD79378341C
2 changed files with 18 additions and 4 deletions

View file

@ -17,6 +17,7 @@ import { config } from "./config";
//const isDebugMode = process.env.NODE_ENV === 'development' || localStorage.getItem('debug') === 'true';
const isDebugMode = config.isDebugMode;
const isStreamingMode = import.meta.env.VITE_STREAMING_MODE
// --- CORE VARIABLES ---
@ -40,11 +41,16 @@ function initScene() {
initMap(gameState.scene).then(() => {
// Update info panel with initial power information
logger.updateInfoPanel();
// Load default game file if in debug mode
if (isDebugMode) {
if (isDebugMode || isStreamingMode) {
loadDefaultGameFile();
}
if (isStreamingMode) {
setTimeout(() => {
togglePlayback()
}, 2000)
}
})
}).catch(err => {
console.error("Error loading coordinates:", err);
@ -86,7 +92,7 @@ function animate() {
gameState.unitAnimations.length === 0 && gameState.isPlaying) {
console.log("Animation check: messages done, not speaking, no animations running");
if (gameState.gameData && gameState.gameData.phases) {
// Get previous phase index
const prevIndex = gameState.phaseIndex > 0 ?
@ -174,7 +180,7 @@ function loadDefaultGameFile() {
console.log("Loading default game file for debug mode...");
// Path to the default game file
const defaultGameFilePath = './test-game.json';
const defaultGameFilePath = './default_game.json';
fetch(defaultGameFilePath)
.then(response => {

View file

@ -14,3 +14,11 @@ services:
ports:
- "4173:4173"
- "5173:5173"
diplomacy-dev:
build: ai_animation
ports:
- "4173:4173"
- "5173:5173"
command: ["npm", "run", "dev-all"]
volumes:
- "./ai_animation/:/app/"