Spaces:
Sleeping
Sleeping
fix lobby
Browse files
src/components/Game.tsx
CHANGED
|
@@ -24,8 +24,7 @@ import { LOBBY_SIZE } from '../../convex/constants';
|
|
| 24 |
export const SHOW_DEBUG_UI = !!import.meta.env.VITE_SHOW_DEBUG_UI;
|
| 25 |
|
| 26 |
export function GameStateLabel(game: GameObj, me: PlayerDescription | undefined) {
|
| 27 |
-
const humans = [...game.world.
|
| 28 |
-
console.log('Human player seen by lobby',game.world.players.values())
|
| 29 |
switch (game.world.gameCycle.cycleState) {
|
| 30 |
case 'Day':
|
| 31 |
return {
|
|
|
|
| 24 |
export const SHOW_DEBUG_UI = !!import.meta.env.VITE_SHOW_DEBUG_UI;
|
| 25 |
|
| 26 |
export function GameStateLabel(game: GameObj, me: PlayerDescription | undefined) {
|
| 27 |
+
const humans = [...game.world.playersInit.values()].filter(player => player.human).length
|
|
|
|
| 28 |
switch (game.world.gameCycle.cycleState) {
|
| 29 |
case 'Day':
|
| 30 |
return {
|
src/components/buttons/InteractButton.tsx
CHANGED
|
@@ -58,7 +58,14 @@ export default function InteractButton() {
|
|
| 58 |
console.log(`Leaving game for player ${userPlayerId}`);
|
| 59 |
void leave({ worldId , oauthToken});
|
| 60 |
console.log("game.world",game.world)
|
| 61 |
-
game.world.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
} else {
|
| 63 |
if (game.world.gameCycle.cycleState==="LobbyState"){
|
| 64 |
console.log(`Joining game`);
|
|
|
|
| 58 |
console.log(`Leaving game for player ${userPlayerId}`);
|
| 59 |
void leave({ worldId , oauthToken});
|
| 60 |
console.log("game.world",game.world)
|
| 61 |
+
if (game.world.gameCycle.cycleState==="LobbyState"){
|
| 62 |
+
game.world.playersInit.delete(userPlayerId);
|
| 63 |
+
game.world.players.delete(userPlayerId);
|
| 64 |
+
}else{
|
| 65 |
+
game.world.players.delete(userPlayerId);
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
|
| 69 |
} else {
|
| 70 |
if (game.world.gameCycle.cycleState==="LobbyState"){
|
| 71 |
console.log(`Joining game`);
|