Checkpoint Eibenreith ink architecture
This commit is contained in:
+6
-2
@@ -272,7 +272,7 @@ io.on('connection', (socket) => {
|
||||
|
||||
socket.on(
|
||||
'playerCommand',
|
||||
async (data: { command?: string }) => {
|
||||
async (data: { command?: string; requestId?: number }) => {
|
||||
const engine = sessions.get(socket.id);
|
||||
if (!engine?.isRunning()) {
|
||||
socket.emit('error', {
|
||||
@@ -282,6 +282,7 @@ io.on('connection', (socket) => {
|
||||
}
|
||||
|
||||
const input = String(data?.command ?? '').trim();
|
||||
const requestId = Number(data?.requestId || 0);
|
||||
if (!input) return;
|
||||
debugLog(`playerCommand from ${socket.id}: ${input}`);
|
||||
|
||||
@@ -292,7 +293,10 @@ io.on('connection', (socket) => {
|
||||
paragraphs: turn.paragraphs.length,
|
||||
statusLine: turn.gameState?.statusLine,
|
||||
});
|
||||
socket.emit('narrativeResponse', toClientTurn(turn));
|
||||
socket.emit(
|
||||
'narrativeResponse',
|
||||
withClientRequestId(toClientTurn(turn), Number.isInteger(requestId) && requestId > 0 ? requestId : undefined),
|
||||
);
|
||||
} catch (error) {
|
||||
console.error('[zcode] playerCommand error:', error);
|
||||
socket.emit('error', {
|
||||
|
||||
Reference in New Issue
Block a user