From c02bb7db6862fb44d47ef6c5d580706d212a67b9 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Fri, 20 Feb 2026 03:43:40 -0500 Subject: [PATCH] style: Remove unused sendCommand function from turtleStore --- client/src/store/turtleStore.js | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/client/src/store/turtleStore.js b/client/src/store/turtleStore.js index e167984..4bb8ea4 100644 --- a/client/src/store/turtleStore.js +++ b/client/src/store/turtleStore.js @@ -216,35 +216,6 @@ export const useTurtleStore = create((set, get) => ({ set({ worldBlocks: Array.from(blockMap.values()) }); }, - sendCommand: async (turtleId, command, param = null) => { - const { ws } = get(); - - console.log(`🎮 Sending command to turtle ${turtleId}: ${command}`, param ? `(param: ${JSON.stringify(param)})` : ''); - - if (ws && ws.readyState === WebSocket.OPEN) { - ws.send(JSON.stringify({ - type: 'command', - turtleID: turtleId, - command, - param - })); - console.log(' ✅ Sent via WebSocket'); - } else { - // Fallback to REST API - console.log(' ⚠️ WebSocket not connected, using REST API fallback'); - try { - await fetch(`${API_URL}/turtle/${turtleId}/command`, { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ command, param }) - }); - console.log(' ✅ Sent via REST API'); - } catch (error) { - console.error(' ❌ Error sending command:', error); - } - } - }, - // Set turtle state machine state via REST API setTurtleState: async (turtleId, stateName, stateData = {}) => { console.log(`🔄 Setting state for turtle ${turtleId}: ${stateName}`, stateData);