diff --git a/src/modules/cl2/Cl23dObject.ts b/src/modules/cl2/Cl23dObject.ts index c479481..2649efb 100644 --- a/src/modules/cl2/Cl23dObject.ts +++ b/src/modules/cl2/Cl23dObject.ts @@ -396,13 +396,13 @@ export default class Cl23dObject extends THREE.Object3D { try { // 安全连接配置 const client = - mqtt.connect('mqtt://127.0.0.1:9001', { + mqtt.connect('mqtt://10.10.203.239:9001', { path: '/mqtt', clientId: 'virtual-' + item.id, clean: true, connectTimeout: 10000, - username: 'user', - password: 'user', + username: 'admin', + password: 'admin', unixSocket: true, keepalive: 60, }); @@ -459,7 +459,7 @@ export default class Cl23dObject extends THREE.Object3D { //当队列为空时,检查当前车辆所在位置 const pointItem = Model.getItemByXYZ(this.position.x, this.position.y, this.position.z) if (!pointItem || data.content.StartX != pointItem.logicX || data.content.StartY != pointItem.logicY) { - throw new Error('当前车辆所在位置未找到') + // throw new Error('当前车辆所在位置未找到') } } @@ -530,19 +530,29 @@ export default class Cl23dObject extends THREE.Object3D { } while (this.taskList.length > 0) { const task = this.taskList[0] + if (this.currentTask == null) { + this.currentTask = task + } - if (task.OperationType == 0 && ((task.Speed > 0) != (this.currentTask.Speed > 1) || task.Direction != this.currentTask.Direction)) { + if (task.OperationType == 0 + && ((task.Speed > 0) != (this.currentTask.Speed > 0) || task.Direction != this.currentTask.Direction)) { if (!this.currentAnimation || this.currentAnimation == this.rotationAnimation) { // 转向 - this.addRotation(task.Direction) - this.currentAnimation = task + this.addRotation(task.Direction).then(()=>{ + this.executeTask() + }) + this.currentAnimation = this.rotationAnimation + this.currentTask = task } } else if (task.OperationType === 0) { if (!this.currentAnimation || this.currentAnimation == this.travelAnimation) { this.taskList.shift() this.addTravel(task.X, task.Y, task.Speed / 1000) - this.currentAnimation = task + this.currentAnimation = this.travelAnimation + this.currentTask = task } + } else { + } } } @@ -676,7 +686,8 @@ export default class Cl23dObject extends THREE.Object3D { onComplete: () => { this.travelAnimation = null this.currentAnimation = null - resolve() + this.executeTask() + // resolve() } }) this.currentAnimation = this.travelAnimation