General Actions to handlers Refacto
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
|
||||
export function construct(redisCnx) {
|
||||
const tickMs = redisCnx.gpsSrv?.getGpsSettings().collisionTickMs ?? 100
|
||||
setInterval(() => {
|
||||
redisCnx.gpsSrv?.tickArena()
|
||||
}, tickMs)
|
||||
}
|
||||
|
||||
export const eventHandlers = {
|
||||
'arena:lifecycle': {
|
||||
onYourMarks(msg, chan) {
|
||||
const srv = this.gpsSrv
|
||||
if(!srv) return
|
||||
srv.onYourMarks(msg.payload ?? {}).catch(err => {
|
||||
console.error(`[${this.redisId}] onYourMarks failed:`, err)
|
||||
srv.publishReadyToStart({ success: false, err: err.message ?? 'onYourMarks failed' })
|
||||
})
|
||||
},
|
||||
bigBang(msg, chan) {
|
||||
this.gpsSrv?.onBigBang(msg.payload ?? {})
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user