feat: Implement block deletion handling in WebSocket message processing

This commit is contained in:
MayaTheShy
2026-02-20 02:34:21 -05:00
parent 67b2d7eb2e
commit 0e6d4acfdd

View File

@@ -134,6 +134,16 @@ export const useTurtleStore = create((set, get) => ({
}
}));
}
} else if (data.type === 'block_deleted') {
// Remove a block from the world map (turtle moved into it)
if (data.x !== undefined && data.y !== undefined && data.z !== undefined) {
set(state => {
const key = `${data.x},${data.y},${data.z}`;
return {
worldBlocks: state.worldBlocks.filter(b => `${b.x},${b.y},${b.z}` !== key)
};
});
}
}
} catch (error) {
console.error('Error processing message:', error);