feat: Implement block deletion handling in WebSocket message processing
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user