WS improvements
This commit is contained in:
@ -8,16 +8,14 @@ import WorldRepository from '#repositories/worldRepository'
|
||||
class DateManager {
|
||||
private static readonly CONFIG = {
|
||||
GAME_SPEED: 8, // 24 game hours / 3 real hours
|
||||
UPDATE_INTERVAL: 1000 // 1 second
|
||||
UPDATE_INTERVAL: 1000, // 1 minute
|
||||
} as const
|
||||
|
||||
private io: Server | null = null
|
||||
private intervalId: NodeJS.Timeout | null = null
|
||||
private currentDate = new Date()
|
||||
private readonly logger = Logger.type(LoggerType.APP)
|
||||
private currentDate = new Date()
|
||||
private intervalId: NodeJS.Timeout | null = null
|
||||
|
||||
public async boot(): Promise<void> {
|
||||
this.io = SocketManager.getIO()
|
||||
await this.loadDate()
|
||||
this.startDateLoop()
|
||||
this.logger.info('Date manager loaded')
|
||||
@ -85,7 +83,8 @@ class DateManager {
|
||||
}
|
||||
|
||||
private emitDate(): void {
|
||||
this.io?.emit('date', this.currentDate)
|
||||
const io = SocketManager.getIO()
|
||||
io?.emit('date', this.currentDate)
|
||||
}
|
||||
|
||||
private async saveDate(): Promise<void> {
|
||||
|
Reference in New Issue
Block a user