refactor: enhance player update handling to include label and timestamp for improved tracking

This commit is contained in:
MayaTheShy
2026-02-20 04:27:57 -05:00
parent cfd127dfab
commit 38ff06eb04

View File

@@ -329,7 +329,10 @@ wss.on('connection', (ws, req) => {
db.savePlayerPosition(data.playerID, data.position);
broadcastToClients({
type: 'player_update',
player: { id: data.playerID, ...data.position },
playerID: data.playerID,
position: data.position,
label: data.label || null,
timestamp: Date.now(),
});
}
}
@@ -1508,7 +1511,7 @@ app.post('/api/groups/:groupId/command', (req, res) => {
// Player position endpoints
app.post('/api/player/update', (req, res) => {
try {
const { playerID, position, timestamp } = req.body;
const { playerID, position, timestamp, label } = req.body;
if (!playerID || !position) {
return res.status(400).json({ error: 'Missing playerID or position' });
@@ -1521,6 +1524,7 @@ app.post('/api/player/update', (req, res) => {
type: 'player_update',
playerID,
position,
label: label || null,
timestamp: timestamp || Date.now()
});