Spaces:
Sleeping
Sleeping
try
Browse files- src/components/Game.tsx +3 -3
src/components/Game.tsx
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
import { useRef, useState
|
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.
|
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.
|
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':
|