style: Remove unused sendCommand function from turtleStore

This commit is contained in:
MayaTheShy
2026-02-20 03:43:40 -05:00
parent 885ebf698d
commit c02bb7db68

View File

@@ -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);