From b08ff805b4aaa7bb85b541a46bb7cad13537399c Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Fri, 20 Feb 2026 00:18:49 -0500 Subject: [PATCH] feat: Add player state management to turtle store --- client/src/store/turtleStore.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/client/src/store/turtleStore.js b/client/src/store/turtleStore.js index a107ace..3fb71d4 100644 --- a/client/src/store/turtleStore.js +++ b/client/src/store/turtleStore.js @@ -10,6 +10,7 @@ console.log('📡 API URL:', API_URL); export const useTurtleStore = create((set, get) => ({ // State turtles: {}, + players: {}, worldBlocks: [], selectedTurtleId: null, connected: false, @@ -65,6 +66,17 @@ export const useTurtleStore = create((set, get) => ({ selectedTurtleId: newSelectedId }; }); + } else if (data.type === 'player_update') { + set(state => ({ + players: { + ...state.players, + [data.playerID]: { + playerID: data.playerID, + position: data.position, + timestamp: data.timestamp + } + } + })); } } catch (error) { console.error('Error processing message:', error);