feat: reroll 一键重刷
This commit is contained in:
1 parent
3eced7bdba
commit
816d9dffcc
21 files changed
+709
-27
No files matched your search
@@ -315,6 +315,8 @@ export class Lobby {
|
||||
case 'room.removeBot': return this.removeBot(session, msg);
|
||||
case 'room.kick': return this.kick(session, msg);
|
||||
case 'room.start': return this.start(session);
|
||||
case 'room.rerollSetup': return this.rerollSetup(session, msg);
|
||||
case 'room.cancelReroll': return this.rerollSetup(session, msg, true);
|
||||
case 'room.loadout': return this.loadout(session, msg);
|
||||
case 'room.ownership': return this.ownership(session, msg);
|
||||
case 'room.diy': return this.diy(session, msg);
|
||||
@@ -575,6 +577,17 @@ export class Lobby {
|
||||
return this.startMatch(room, key);
|
||||
}
|
||||
|
||||
/** Host authorization stays in the lobby; the match owns the vote and setup. */
|
||||
rerollSetup(session, msg, cancel = false) {
|
||||
const room = this.roomOf(session);
|
||||
if (!room) return fail(ERR.NOT_IN_ROOM);
|
||||
if (room.spectatorOf(session.playerId)) return fail(ERR.SPECTATOR);
|
||||
if (room.hostId !== session.playerId) return fail(ERR.NOT_HOST);
|
||||
const method = cancel ? 'cancelSetupReroll' : 'requestSetupReroll';
|
||||
if (!room.match || typeof room.match[method] !== 'function') return fail(ERR.WRONG_PHASE);
|
||||
return this.callMatch(room, method, session.playerId, cancel ? msg.voteId : msg.setupRevision) || fail(ERR.INTERNAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* room.loadout (DESIGN §16): check the operator loadout against the game data, store it on the session and the seat,
|
||||
* and — while a match runs — hand it to the match (accepted only during INFO_CHECK, see the header).
|
||||
|
||||
Reference in new issue
Block a user