export const eventHandlers = { 'arena:agents:*': { change(msg, chan) { const agentId = msg.sender if(!agentId || typeof(agentId) !== 'string') { console.warn(`[${this.redisId}] Agent event without sender`) return } const newVector = msg.payload?.newVector if(!newVector || typeof(newVector.x) !== 'number' || typeof(newVector.y) !== 'number' || typeof(newVector.z) !== 'number') { console.warn(`[${this.redisId}] Invalid newVector from ${agentId}`) return } const newPosition = msg.payload?.newPosition ?? null this.gpsSrv?.onVectorChange(agentId, newVector, newPosition) }, remove(msg, chan) { const agentId = msg.sender if(!agentId || typeof(agentId) !== 'string') { console.warn(`[${this.redisId}] Agent event without sender`) return } this.gpsSrv?.onAgentRemove(agentId) }, }, }