Jofthomas HF staff commited on
Commit
2f8c753
·
1 Parent(s): 74518b9

leaving game correctly

Browse files
convex/world.ts CHANGED
@@ -193,10 +193,7 @@ export const leaveWorld = mutation({
193
  await insertInput(ctx, world._id, 'leave', {
194
  playerId: existingPlayer.id,
195
  });
196
- console.log(existingPlayer)
197
-
198
- console.log(existingPlayer.id)
199
- world.players.delete(existingPlayer.id);
200
 
201
  },
202
  });
 
193
  await insertInput(ctx, world._id, 'leave', {
194
  playerId: existingPlayer.id,
195
  });
196
+
 
 
 
197
 
198
  },
199
  });
src/components/buttons/InteractButton.tsx CHANGED
@@ -57,6 +57,7 @@ export default function InteractButton() {
57
  if (isPlaying) {
58
  console.log(`Leaving game for player ${userPlayerId}`);
59
  void leave({ worldId , oauthToken});
 
60
  } else {
61
  console.log(`Joining game`);
62
  void joinInput(worldId);
 
57
  if (isPlaying) {
58
  console.log(`Leaving game for player ${userPlayerId}`);
59
  void leave({ worldId , oauthToken});
60
+ game.world.players.delete(userPlayerId);
61
  } else {
62
  console.log(`Joining game`);
63
  void joinInput(worldId);