채팅 소리(스타크래프트 같은 "띠릭"): 새 채팅 줄마다(내가 보낸 줄도) 맑은 두 음이 올라가는 짧은 소리. 크기는 게임 소리 기준(0.15)의 90%로 소리 크기 설정을 그대로 따르고, 소리 끄기면 안 남. 몰려 온 줄은 한 번만. 방에 (다시) 들어올 때 서버가 다시 보내는 지난 채팅은 replay 표시로 조용히. 마피아·라이어 게임 안 채팅도 같은 소리. feedback.test.ts, room.test.ts, chat.e2e.ts에 확인 추가

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-14 09:42:31 +09:00
parent e0139f412e
commit b7d5b3ad75
10 changed files with 212 additions and 7 deletions

View File

@@ -239,6 +239,22 @@ describe('Room chat (2026-10-13)', () => {
expect(b.msgs.filter((m) => m.t === 'chat').map((m) => (m as { text: string }).text)).toEqual(lines);
});
test('lines sent before joining come back marked as replay; live lines are not', () => {
const { room, conn } = harness();
const a = conn('A');
room.join(a, 'player');
room.chat('A', '먼저 한 말');
const b = conn('B');
room.join(b, 'player');
room.chat('A', '지금 한 말');
const got = b.msgs.filter((m) => m.t === 'chat').map((m) => [(m as { text: string }).text, (m as { replay?: true }).replay ?? false]);
expect(got).toEqual([
['먼저 한 말', true],
['지금 한 말', false],
]);
expect((a.msgs.find((m) => m.t === 'chat') as { replay?: true }).replay).toBeUndefined();
});
test('typing at a person\'s pace (a line every 0.4 s) never waits', () => {
const { room, clock, conn } = harness();
room.join(conn('A'), 'player');

View File

@@ -530,7 +530,7 @@ export class Room {
const st = this.stateMessage(u, undefined, true);
if (st) conn.send(st);
if (this.status === 'finished' && this.lastResult) conn.send({ t: 'result', seq: this.seq, result: this.lastResult });
for (const m of this.chatLog) conn.send(m);
for (const m of this.chatLog) conn.send({ ...m, replay: true });
this.scheduleTimer();
return null;
}