Spaces:
Sleeping
Sleeping
bug to feature werewolf
Browse files
src/components/PlayerDetails.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import { useSendInput } from '../hooks/sendInput';
|
|
| 9 |
import { Player } from '../../convex/aiTown/player';
|
| 10 |
import { GameId } from '../../convex/aiTown/ids';
|
| 11 |
import { ServerGame } from '../hooks/serverGame';
|
|
|
|
| 12 |
|
| 13 |
export default function PlayerDetails({
|
| 14 |
worldId,
|
|
@@ -32,6 +33,8 @@ export default function PlayerDetails({
|
|
| 32 |
const humanTokenIdentifier = useQuery(api.world.userStatus, { worldId, oauthToken });
|
| 33 |
|
| 34 |
const players = [...game.world.players.values()];
|
|
|
|
|
|
|
| 35 |
const humanPlayer = players.find((p) => p.human === humanTokenIdentifier);
|
| 36 |
const humanConversation = humanPlayer ? game.world.playerConversation(humanPlayer) : undefined;
|
| 37 |
// Always select the other player if we're in a conversation with them.
|
|
@@ -229,6 +232,13 @@ export default function PlayerDetails({
|
|
| 229 |
<p className="leading-tight -m-4 bg-brown-700 text-base sm:text-sm">
|
| 230 |
{!isMe && playerDescription?.description}
|
| 231 |
{isMe && <i>This is you! You are a {playerDescription?.type}</i>}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
{!isMe && inConversationWithMe && (
|
| 233 |
<>
|
| 234 |
<br />
|
|
|
|
| 9 |
import { Player } from '../../convex/aiTown/player';
|
| 10 |
import { GameId } from '../../convex/aiTown/ids';
|
| 11 |
import { ServerGame } from '../hooks/serverGame';
|
| 12 |
+
import { LOBBY_SIZE } from '../../convex/constants';
|
| 13 |
|
| 14 |
export default function PlayerDetails({
|
| 15 |
worldId,
|
|
|
|
| 33 |
const humanTokenIdentifier = useQuery(api.world.userStatus, { worldId, oauthToken });
|
| 34 |
|
| 35 |
const players = [...game.world.players.values()];
|
| 36 |
+
const humans = [...game.world.playersInit.values()].filter(player => player.human)
|
| 37 |
+
|
| 38 |
const humanPlayer = players.find((p) => p.human === humanTokenIdentifier);
|
| 39 |
const humanConversation = humanPlayer ? game.world.playerConversation(humanPlayer) : undefined;
|
| 40 |
// Always select the other player if we're in a conversation with them.
|
|
|
|
| 232 |
<p className="leading-tight -m-4 bg-brown-700 text-base sm:text-sm">
|
| 233 |
{!isMe && playerDescription?.description}
|
| 234 |
{isMe && <i>This is you! You are a {playerDescription?.type}</i>}
|
| 235 |
+
{!isMe && playerDescription?.type =="werewolf" && game.world.gameCycle.cycleState==="LobbyState" && (
|
| 236 |
+
<>
|
| 237 |
+
<br />
|
| 238 |
+
<br />(<i> You are a werewolf, the game has not started yet, we are missing {humans.length - LOBBY_SIZE} humans to start. Stay on the look and </i>)
|
| 239 |
+
</>
|
| 240 |
+
)}
|
| 241 |
+
|
| 242 |
{!isMe && inConversationWithMe && (
|
| 243 |
<>
|
| 244 |
<br />
|