From df00a6be70fee855a0c0af4e74deec3083702f30 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Fri, 20 Feb 2026 02:02:04 -0500 Subject: [PATCH] feat: Add handling for 'blocks_discovered' message to update worldBlocks in turtle store --- client/src/store/turtleStore.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/client/src/store/turtleStore.js b/client/src/store/turtleStore.js index af1c9c9..8940bbe 100644 --- a/client/src/store/turtleStore.js +++ b/client/src/store/turtleStore.js @@ -86,6 +86,17 @@ export const useTurtleStore = create((set, get) => ({ return { worldBlocks: Array.from(blockMap.values()) }; }); } + } else if (data.type === 'blocks_discovered') { + if (data.blocks && Array.isArray(data.blocks)) { + set(state => { + const blockMap = new Map(state.worldBlocks.map(b => [`${b.x},${b.y},${b.z}`, b])); + data.blocks.forEach(block => { + const key = `${block.x},${block.y},${block.z}`; + blockMap.set(key, block); + }); + return { worldBlocks: Array.from(blockMap.values()) }; + }); + } } } catch (error) { console.error('Error processing message:', error);