did stuff

This commit is contained in:
legop3
2025-11-13 13:54:14 -05:00
parent 4d5a918921
commit d601e9aa82
22 changed files with 565 additions and 13 deletions
+2 -3
View File
@@ -1,7 +1,6 @@
const { v4: uuidv4 } = require('uuid');
const io = require('../globals/io');
const roverManager = require('./roverManager');
const { isAdmin } = require('./authService');
const pendingCommands = new Map(); // id -> { roverId }
@@ -40,8 +39,8 @@ io.on('connection', (socket) => {
if (!roverId) {
throw new Error('roverId required');
}
if (!roverManager.isDriver(roverId, socket) && !isAdmin(socket)) {
throw new Error('Not controlling this rover');
if (!roverManager.canDrive(roverId, socket)) {
throw new Error('Not your turn or no control');
}
const payload = data ? { ...data } : {};
const id = issueCommand(roverId, { type, ...payload });