fix: restore superlatives methods, fix event update rebuild, remove dead method
- Restore subscribeSuperlatives/unsubscribeSuperlatives/onSuperlativesUpdate on SocketClient (lost during Task 5 refactor) - Fix EventsFeed.updateEvent to rebuild entire element when LLM narration arrives (names may be in different positions) - Remove dead setFollowedEntity method from GameLoop (replaced by SocketServer.rebuildFollowedEntityIds) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { io, Socket } from 'socket.io-client';
|
||||
import type { ServerEvents, ClientEvents, WorldState, StateUpdate, PlayerJoined, PlayerLeft, PlayerInput, NarrationEvent } from '@dflike/shared';
|
||||
import type { ServerEvents, ClientEvents, WorldState, StateUpdate, PlayerJoined, PlayerLeft, PlayerInput, SuperlativesData, NarrationEvent } from '@dflike/shared';
|
||||
|
||||
type TypedSocket = Socket<ServerEvents, ClientEvents>;
|
||||
|
||||
@@ -13,6 +13,7 @@ export class SocketClient {
|
||||
onStateUpdate: ((data: StateUpdate) => void) | null = null;
|
||||
onPlayerJoined: ((data: PlayerJoined) => void) | null = null;
|
||||
onPlayerLeft: ((data: PlayerLeft) => void) | null = null;
|
||||
onSuperlativesUpdate: ((data: SuperlativesData) => void) | null = null;
|
||||
onNarrationEvent: ((data: NarrationEvent) => void) | null = null;
|
||||
onNarrationUpdate: ((data: { id: number; narration: string }) => void) | null = null;
|
||||
onNarrationHistory: ((data: NarrationEvent[]) => void) | null = null;
|
||||
@@ -40,6 +41,10 @@ export class SocketClient {
|
||||
this.onPlayerLeft?.(data);
|
||||
});
|
||||
|
||||
this.socket.on('superlatives-update', (data) => {
|
||||
this.onSuperlativesUpdate?.(data);
|
||||
});
|
||||
|
||||
this.socket.on('narration-event', (data) => this.onNarrationEvent?.(data));
|
||||
this.socket.on('narration-update', (data) => this.onNarrationUpdate?.(data));
|
||||
this.socket.on('narration-history', (data) => this.onNarrationHistory?.(data));
|
||||
@@ -60,6 +65,14 @@ export class SocketClient {
|
||||
this.socket.emit('follow-npc', { entityId });
|
||||
}
|
||||
|
||||
subscribeSuperlatives(): void {
|
||||
this.socket.emit('superlatives-subscribe');
|
||||
}
|
||||
|
||||
unsubscribeSuperlatives(): void {
|
||||
this.socket.emit('superlatives-unsubscribe');
|
||||
}
|
||||
|
||||
disconnect(): void {
|
||||
this.socket.disconnect();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user