Update server/src/index.js

This commit is contained in:
2025-11-13 17:07:28 +00:00
parent 2b60b6e9ed
commit d522408928

View File

@@ -197,8 +197,9 @@ io.on('connection', socket => {
socket.on('move:click', target => {
const p = socketsToPlayers.get(socket.id);
if (!p) return;
p.x = Math.max(0, Math.min(WORLD.width, target.x));
p.y = Math.max(0, Math.min(WORLD.height, target.y));
// You can store target on the server if you want later:
p.targetX = Math.max(0, Math.min(WORLD.width, target.x));
p.targetY = Math.max(0, Math.min(WORLD.height, target.y));
});
socket.on('gather', async ({ nodeId }, ack) => {