fix: prevent multiple P2 actions on same offer and improve UI consistency

- Add server validation to prevent P2 from taking multiple actions on the same offer
- Hide P2 action buttons after an action is taken (using \!state.p2Action condition)
- Add offer details display to G3, G4, and G5 (was missing)
- Fix G2 to show offer details instead of just 'Oferta activa'
- Reset game status to PLAYING when changing variant from FINISHED state
- Ensure P2 can only make one decision per offer in all variants
This commit is contained in:
2025-08-08 00:10:10 -06:00
parent 305f19c7b0
commit 9673c6ce9e
6 changed files with 17 additions and 7 deletions

View File

@@ -85,6 +85,10 @@ export class GameRoom extends Room<GameState> {
const player = this.state.players.get(client.sessionId);
if (!player) return;
if (player.role !== "P2") return;
// Prevent multiple actions on the same offer
if (this.state.p2Action) return;
this.state.p2Action = action; // accept | reject | snatch
this.resolveP2Action();