Prepare game updates and single-process PM2 deployment

This commit is contained in:
2026-10-14 19:13:36 +09:00
parent 4f24129e29
commit 22792bc2b4
50 changed files with 1546 additions and 197 deletions
+7 -2
View File
@@ -44,7 +44,7 @@ export function createMatchController(config: ControllerConfig) {
if (state.phase === 'countdown' && clock.now() >= state.startsAt) engine.beginTurn(state.startsAt);
else if (state.phase === 'revealing' && clock.now() >= state.reveal!.revealEndsAt) engine.beginTurn(state.reveal!.revealEndsAt);
state = engine.view();
if (state.phase === 'selecting' && clock.now() >= state.deadline) engine.resolve([state.ownAction, engine.botAction()]);
if (state.phase === 'selecting' && (state.ownAction || clock.now() >= state.deadline)) engine.resolve([state.ownAction, engine.botAction()]);
publish(); state = engine.view();
if (state.phase === 'finished') { void record(); return; }
const next = state.phase === 'countdown' ? state.startsAt : state.phase === 'selecting' ? state.deadline : state.reveal!.revealEndsAt;
@@ -69,7 +69,12 @@ export function createMatchController(config: ControllerConfig) {
if (!saved) engine.start();
tick();
},
async submitAction(action: ActionId) { if (friend?.recovering) return false; const accepted = engine.lockAction(action); if (accepted) publish(); return accepted; },
async submitAction(action: ActionId) {
if (friend?.recovering) return false;
const accepted = engine.lockAction(action);
if (accepted) { if (friend) { publish(); friend.submitAction(); } else tick(); }
return accepted;
},
async leave() {
if (friend) { await friend.leave(); await record(); return; }
clock.clearTimeout(timer);