tons of cursor-shit cleaning, finished implementing cnxId in observer
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
|
||||
export const eventHandlers = {
|
||||
'arena:agents:*': {
|
||||
change(msg, chan) {
|
||||
change(msg, chan, sender, cnxId) {
|
||||
const agentId = msg.sender
|
||||
if(!agentId || typeof(agentId) !== 'string') {
|
||||
console.warn(`[${this.redisId}] Agent event without sender`)
|
||||
@@ -15,7 +15,7 @@ export const eventHandlers = {
|
||||
const newPosition = msg.payload?.newPosition ?? null
|
||||
this.gpsSrv?.onVectorChange(agentId, newVector, newPosition)
|
||||
},
|
||||
remove(msg, chan) {
|
||||
remove(msg, chan, sender, cnxId) {
|
||||
const agentId = msg.sender
|
||||
if(!agentId || typeof(agentId) !== 'string') {
|
||||
console.warn(`[${this.redisId}] Agent event without sender`)
|
||||
|
||||
@@ -10,7 +10,7 @@ export const dispatchMessage = createDispatchMessage({
|
||||
eventHandlers,
|
||||
actionRules(redisCnx) {
|
||||
const gps = redisCnx.config.gps ?? {}
|
||||
const arenaChannel = gps.bus?.arena?.actionsChannel
|
||||
const arenaChannel = gps.arenaActionsChannel
|
||||
return({
|
||||
channels: arenaChannel ? [arenaChannel] : [],
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
export function construct(redisCnx) {
|
||||
const tickMs = redisCnx.gpsSrv?.getGpsSettings().collisionTickMs ?? 100
|
||||
const tickMs = redisCnx.gpsSrv?.gpsConfig.collisionTickMs ?? 100
|
||||
setInterval(() => {
|
||||
redisCnx.gpsSrv?.tickArena()
|
||||
}, tickMs)
|
||||
@@ -8,7 +8,7 @@ export function construct(redisCnx) {
|
||||
|
||||
export const eventHandlers = {
|
||||
'arena:lifecycle': {
|
||||
onYourMarks(msg, chan) {
|
||||
onYourMarks(msg, chan, sender, cnxId) {
|
||||
const srv = this.gpsSrv
|
||||
if(!srv) return
|
||||
srv.onYourMarks(msg.payload ?? {}).catch(err => {
|
||||
@@ -16,16 +16,16 @@ export const eventHandlers = {
|
||||
srv.publishReadyToStart({ success: false, err: err.message ?? 'onYourMarks failed' })
|
||||
})
|
||||
},
|
||||
bigBang(msg, chan) {
|
||||
bigBang(msg, chan, sender, cnxId) {
|
||||
this.gpsSrv?.onBigBang(msg.payload ?? {})
|
||||
},
|
||||
simulationPaused(msg, chan) {
|
||||
simulationPaused(msg, chan, sender, cnxId) {
|
||||
this.gpsSrv?.onSimulationPaused(msg.payload ?? {})
|
||||
},
|
||||
simulationResumed(msg, chan) {
|
||||
simulationResumed(msg, chan, sender, cnxId) {
|
||||
this.gpsSrv?.onSimulationResumed(msg.payload ?? {})
|
||||
},
|
||||
simulationStopped(msg, chan) {
|
||||
simulationStopped(msg, chan, sender, cnxId) {
|
||||
const srv = this.gpsSrv
|
||||
if(!srv) return
|
||||
srv.onSimulationStopped(msg.payload ?? {}).catch(err => {
|
||||
|
||||
Reference in New Issue
Block a user