This commit is contained in:
milo
2026-01-27 22:52:38 +01:00
parent a08e9ed626
commit beabace9eb
3 changed files with 24 additions and 17 deletions

View File

@@ -77,20 +77,24 @@ export function blackjackRoutes(io) {
let changed = false;
for (const p of Object.values(room.players)) {
if (!p.inRound) continue;
const h = p.hands[p.activeHand];
if (!h.hasActed && !h.busted && !h.stood && !h.surrendered) {
h.surrendered = true;
h.stood = true;
h.hasActed = true;
//room.leavingAfterRound[p.id] = true; // kick at end of round
emitToast({ type: "player-timeout", userId: p.id });
changed = true;
} else if (h.hasActed && !h.stood) {
h.stood = true;
//room.leavingAfterRound[p.id] = true; // kick at end of round
emitToast({ type: "player-auto-stand", userId: p.id });
changed = true;
try {
if (!p.inRound) continue;
const h = p.hands[p.activeHand];
if (h && !h.hasActed && !h.busted && !h.stood && !h.surrendered) {
h.surrendered = true;
h.stood = true;
h.hasActed = true;
//room.leavingAfterRound[p.id] = true; // kick at end of round
emitToast({ type: "player-timeout", userId: p.id });
changed = true;
} else if (h && h.hasActed && !h.stood) {
h.stood = true;
//room.leavingAfterRound[p.id] = true; // kick at end of round
emitToast({ type: "player-auto-stand", userId: p.id });
changed = true;
}
} catch (e) {
console.log(e);
}
}
if (changed) emitUpdate("auto-surrender", snapshot(room));