1
0

Compare commits

...

2 Commits

Author SHA1 Message Date
888688a019 Full game worked! 2025-10-04 16:50:04 -07:00
3d5b6836ed Fixing asset location problems 2025-10-04 15:30:13 -07:00
25 changed files with 28 additions and 21 deletions

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="height: 512px; width: 512px;"><path d="M0 0h512v512H0z" fill="#000000" fill-opacity="0.01"></path><g class="" transform="translate(0,0)" style=""><path d="M74.5 36A38.5 38.5 0 0 0 36 74.5v363A38.5 38.5 0 0 0 74.5 476h363a38.5 38.5 0 0 0 38.5-38.5v-363A38.5 38.5 0 0 0 437.5 36h-363zm48.97 36.03A50 50 0 0 1 172 122a50 50 0 0 1-100 0 50 50 0 0 1 51.47-49.97zm268 0A50 50 0 0 1 440 122a50 50 0 0 1-100 0 50 50 0 0 1 51.47-49.97zM256 206a50 50 0 0 1 0 100 50 50 0 0 1 0-100zM123.47 340.03A50 50 0 0 1 172 390a50 50 0 0 1-100 0 50 50 0 0 1 51.47-49.97zm268 0A50 50 0 0 1 440 390a50 50 0 0 1-100 0 50 50 0 0 1 51.47-49.97z" fill="#fff" fill-opacity="1"></path></g></svg>

Before

Width:  |  Height:  |  Size: 734 B

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="height: 512px; width: 512px;"><path d="M0 0h512v512H0z" fill="#000000" fill-opacity="0.01"></path><g class="" transform="translate(0,0)" style=""><path d="M74.5 36A38.5 38.5 0 0 0 36 74.5v363A38.5 38.5 0 0 0 74.5 476h363a38.5 38.5 0 0 0 38.5-38.5v-363A38.5 38.5 0 0 0 437.5 36h-363zm48.97 36.03A50 50 0 0 1 172 122a50 50 0 0 1-100 0 50 50 0 0 1 51.47-49.97zm268 0A50 50 0 0 1 440 122a50 50 0 0 1-100 0 50 50 0 0 1 51.47-49.97zm-268 268A50 50 0 0 1 172 390a50 50 0 0 1-100 0 50 50 0 0 1 51.47-49.97zm268 0A50 50 0 0 1 440 390a50 50 0 0 1-100 0 50 50 0 0 1 51.47-49.97z" fill="#fff" fill-opacity="1"></path></g></svg>

Before

Width:  |  Height:  |  Size: 684 B

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="height: 512px; width: 512px;"><path d="M0 0h512v512H0z" fill="#000000" fill-opacity="0.01"></path><g class="" transform="translate(0,0)" style=""><path d="M74.5 36A38.5 38.5 0 0 0 36 74.5v363A38.5 38.5 0 0 0 74.5 476h363a38.5 38.5 0 0 0 38.5-38.5v-363A38.5 38.5 0 0 0 437.5 36h-363zM256 206a50 50 0 0 1 0 100 50 50 0 0 1 0-100z" fill="#fff" fill-opacity="1"></path></g></svg>

Before

Width:  |  Height:  |  Size: 444 B

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="height: 512px; width: 512px;"><path d="M0 0h512v512H0z" fill="#000000" fill-opacity="0.01"></path><g class="" transform="translate(0,0)" style=""><path d="M74.5 36A38.5 38.5 0 0 0 36 74.5v363A38.5 38.5 0 0 0 74.5 476h363a38.5 38.5 0 0 0 38.5-38.5v-363A38.5 38.5 0 0 0 437.5 36h-363zm48.97 36.03A50 50 0 0 1 172 122a50 50 0 0 1-100 0 50 50 0 0 1 51.47-49.97zm268 0A50 50 0 0 1 440 122a50 50 0 0 1-100 0 50 50 0 0 1 51.47-49.97zM122 206a50 50 0 0 1 0 100 50 50 0 0 1 0-100zm268 0a50 50 0 0 1 0 100 50 50 0 0 1 0-100zM123.47 340.03A50 50 0 0 1 172 390a50 50 0 0 1-100 0 50 50 0 0 1 51.47-49.97zm268 0A50 50 0 0 1 440 390a50 50 0 0 1-100 0 50 50 0 0 1 51.47-49.97z" fill="#fff" fill-opacity="1"></path></g></svg>

Before

Width:  |  Height:  |  Size: 777 B

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="height: 512px; width: 512px;"><path d="M0 0h512v512H0z" fill="#000000" fill-opacity="0.01"></path><g class="" transform="translate(0,0)" style=""><path d="M74.5 36A38.5 38.5 0 0 0 36 74.5v363A38.5 38.5 0 0 0 74.5 476h363a38.5 38.5 0 0 0 38.5-38.5v-363A38.5 38.5 0 0 0 437.5 36h-363zm316.97 36.03A50 50 0 0 1 440 122a50 50 0 0 1-100 0 50 50 0 0 1 51.47-49.97zM256 206a50 50 0 0 1 0 100 50 50 0 0 1 0-100zM123.47 340.03A50 50 0 0 1 172 390a50 50 0 0 1-100 0 50 50 0 0 1 51.47-49.97z" fill="#fff" fill-opacity="1"></path></g></svg>

Before

Width:  |  Height:  |  Size: 597 B

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="height: 512px; width: 512px;"><path d="M0 0h512v512H0z" fill="#000000" fill-opacity="0.01"></path><g class="" transform="translate(0,0)" style=""><path d="M74.5 36A38.5 38.5 0 0 0 36 74.5v363A38.5 38.5 0 0 0 74.5 476h363a38.5 38.5 0 0 0 38.5-38.5v-363A38.5 38.5 0 0 0 437.5 36h-363zm316.97 36.03A50 50 0 0 1 440 122a50 50 0 0 1-100 0 50 50 0 0 1 51.47-49.97zm-268 268A50 50 0 0 1 172 390a50 50 0 0 1-100 0 50 50 0 0 1 51.47-49.97z" fill="#fff" fill-opacity="1"></path></g></svg>

Before

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 734 B

After

Width:  |  Height:  |  Size: 734 B

View File

Before

Width:  |  Height:  |  Size: 684 B

After

Width:  |  Height:  |  Size: 684 B

View File

Before

Width:  |  Height:  |  Size: 444 B

After

Width:  |  Height:  |  Size: 444 B

View File

Before

Width:  |  Height:  |  Size: 777 B

After

Width:  |  Height:  |  Size: 777 B

View File

Before

Width:  |  Height:  |  Size: 597 B

After

Width:  |  Height:  |  Size: 597 B

View File

Before

Width:  |  Height:  |  Size: 547 B

After

Width:  |  Height:  |  Size: 547 B

View File

@ -27,18 +27,32 @@ import { assetsPath } from "./Common";
import "./App.css"; import "./App.css";
import equal from "fast-deep-equal"; import equal from "fast-deep-equal";
import itsYourTurnAudio from './assets/its-your-turn.mp3';
import robberAudio from './assets/robber.mp3';
import knightsAudio from './assets/the-knights-who-say-ni.mp3';
import volcanoAudio from './assets/volcano-eruption.mp3';
const audioFiles: Record<string, string> = {
'its-your-turn.mp3': itsYourTurnAudio,
'robber.mp3': robberAudio,
'the-knights-who-say-ni.mp3': knightsAudio,
'volcano-eruption.mp3': volcanoAudio,
};
type AudioEffect = HTMLAudioElement & { hasPlayed?: boolean }; type AudioEffect = HTMLAudioElement & { hasPlayed?: boolean };
const audioEffects: Record<string, AudioEffect | undefined> = {}; const audioEffects: Record<string, AudioEffect | undefined> = {};
const loadAudio = (src: string) => { const loadAudio = (src: string) => {
const audio = document.createElement("audio") as AudioEffect; const audio = document.createElement("audio") as AudioEffect;
audio.src = `${assetsPath}/assets/${src}`; audio.src = audioFiles[src];
console.log("Loading audio:", audio.src);
audio.setAttribute("preload", "auto"); audio.setAttribute("preload", "auto");
audio.setAttribute("controls", "none"); audio.setAttribute("controls", "none");
audio.style.display = "none"; audio.style.display = "none";
document.body.appendChild(audio); document.body.appendChild(audio);
void audio.play(); audio.load();
audio.hasPlayed = true; audio.addEventListener('error', (e) => console.error("Audio load error:", e, audio.src));
audio.addEventListener('canplay', () => console.log("Audio can play:", audio.src));
return audio; return audio;
}; };
@ -322,9 +336,9 @@ const Table: React.FC = () => {
audioEffects.volcano = loadAudio("volcano-eruption.mp3"); audioEffects.volcano = loadAudio("volcano-eruption.mp3");
audioEffects.volcano.volume = volume * volume; audioEffects.volcano.volume = volume * volume;
} else { } else {
if (!audioEffects.volcano.hasPlayed) { if (!audioEffects.volcano.hasPlayed && audioEffects.volcano.readyState >= 2) {
audioEffects.volcano.hasPlayed = true; audioEffects.volcano.hasPlayed = true;
audioEffects.volcano.play(); audioEffects.volcano.play().catch((e) => console.error("Audio play failed:", e));
} }
} }
} else { } else {
@ -340,9 +354,9 @@ const Table: React.FC = () => {
audioEffects.yourTurn = loadAudio("its-your-turn.mp3"); audioEffects.yourTurn = loadAudio("its-your-turn.mp3");
audioEffects.yourTurn.volume = volume * volume; audioEffects.yourTurn.volume = volume * volume;
} else { } else {
if (!audioEffects.yourTurn.hasPlayed) { if (!audioEffects.yourTurn.hasPlayed && audioEffects.yourTurn.readyState >= 2) {
audioEffects.yourTurn.hasPlayed = true; audioEffects.yourTurn.hasPlayed = true;
audioEffects.yourTurn.play(); audioEffects.yourTurn.play().catch((e) => console.error("Audio play failed:", e));
} }
} }
} else if (turn) { } else if (turn) {
@ -356,9 +370,9 @@ const Table: React.FC = () => {
audioEffects.robber = loadAudio("robber.mp3"); audioEffects.robber = loadAudio("robber.mp3");
audioEffects.robber.volume = volume * volume; audioEffects.robber.volume = volume * volume;
} else { } else {
if (!audioEffects.robber.hasPlayed) { if (!audioEffects.robber.hasPlayed && audioEffects.robber.readyState >= 2) {
audioEffects.robber.hasPlayed = true; audioEffects.robber.hasPlayed = true;
audioEffects.robber.play(); audioEffects.robber.play().catch((e) => console.error("Audio play failed:", e));
} }
} }
} else if (turn) { } else if (turn) {
@ -372,9 +386,9 @@ const Table: React.FC = () => {
audioEffects.knights = loadAudio("the-knights-who-say-ni.mp3"); audioEffects.knights = loadAudio("the-knights-who-say-ni.mp3");
audioEffects.knights.volume = volume * volume; audioEffects.knights.volume = volume * volume;
} else { } else {
if (!audioEffects.knights.hasPlayed) { if (!audioEffects.knights.hasPlayed && audioEffects.knights.readyState >= 2) {
audioEffects.knights.hasPlayed = true; audioEffects.knights.hasPlayed = true;
audioEffects.knights.play(); audioEffects.knights.play().catch((e) => console.error("Audio play failed:", e));
} }
} }
} else if (turn && turn.actions && turn.actions.indexOf("playing-knight") === -1) { } else if (turn && turn.actions && turn.actions.indexOf("playing-knight") === -1) {

View File

@ -29,7 +29,7 @@ const Dice: React.FC<DiceProps> = ({ pips }) => {
name = "six"; name = "six";
break; break;
} }
return <img alt={name} className="Dice" src={`${assetsPath}/assets/dice-six-faces-${name}.svg`} />; return <img alt={name} className="Dice" src={`${assetsPath}/gfx/dice-six-faces-${name}.svg`} />;
}; };
export { Dice }; export { Dice };

Binary file not shown.

BIN
client/src/assets/robber.mp3 Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -20,7 +20,7 @@ services:
volumes: volumes:
- ./db:/db:rw - ./db:/db:rw
- ./server/routes:/server/routes:ro - ./server/routes:/server/routes:ro
- ./client/dist:/server/public/ketr.ketran:ro - ./client/build:/server/public/ketr.ketran:ro
working_dir: /server working_dir: /server
environment: environment:
- VITE_BASEPATH=/ketr.ketran - VITE_BASEPATH=/ketr.ketran

View File

@ -1,3 +1,3 @@
{ {
"frontendPath": "/client/build" "frontendPath": "/server/public/ketr.ketran"
} }

View File

@ -273,7 +273,6 @@ const roll = (game, session, dice) => {
return `You already rolled this turn.`; return `You already rolled this turn.`;
} }
processRoll(game, session, dice); processRoll(game, session, dice);
sendUpdateToPlayers(game, { chat: game.chat });
return; return;
case 'volcano': case 'volcano':