Jofthomas commited on
Commit
126d4dd
·
1 Parent(s): 8989235
Files changed (1) hide show
  1. src/components/Game.tsx +3 -3
src/components/Game.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { useRef, useState,useEffect } from 'react';
2
  import PixiGame from './PixiGame.tsx';
3
 
4
  import { useElementSize } from 'usehooks-ts';
@@ -28,13 +28,13 @@ export function GameStateLabel(game: GameObj, me: PlayerDescription | undefined)
28
 
29
  useEffect(() => {
30
  const updateHumanPlayers = () => {
31
- const humanCount = [...game.world.players.values()].filter(player => player.human).length;
32
  setHumans(humanCount);
33
  };
34
 
35
  // Update the count of human players when the component mounts and when game.world.players changes
36
  updateHumanPlayers();
37
- }, [game.world.players]);
38
 
39
  switch (game.world.gameCycle.cycleState) {
40
  case 'Day':
 
1
+ import { useRef, useState } from 'react';
2
  import PixiGame from './PixiGame.tsx';
3
 
4
  import { useElementSize } from 'usehooks-ts';
 
28
 
29
  useEffect(() => {
30
  const updateHumanPlayers = () => {
31
+ const humanCount = [...game.world.playersInit.values()].filter(player => player.human).length;
32
  setHumans(humanCount);
33
  };
34
 
35
  // Update the count of human players when the component mounts and when game.world.players changes
36
  updateHumanPlayers();
37
+ }, [game.world.playersInit]);
38
 
39
  switch (game.world.gameCycle.cycleState) {
40
  case 'Day':