Jofthomas HF staff commited on
Commit
c76a8e4
1 Parent(s): 8cbe088

adding role

Browse files
patches/characters.ts CHANGED
@@ -19,7 +19,7 @@ export const Descriptions = [
19
  // },
20
  {
21
  name: 'Lucky',
22
- character: 'c1',
23
  identity: `Lucky is always happy and curious, and he loves cheese. He spends
24
  most of his time reading about the history of science and traveling
25
  through the galaxy on whatever ship will take him. He's very articulate and
 
19
  // },
20
  {
21
  name: 'Lucky',
22
+ character: 'f1',
23
  identity: `Lucky is always happy and curious, and he loves cheese. He spends
24
  most of his time reading about the history of science and traveling
25
  through the galaxy on whatever ship will take him. He's very articulate and
patches/convex/world.ts CHANGED
@@ -137,16 +137,19 @@ export const joinWorld = mutation({
137
  if (!world) {
138
  throw new ConvexError(`Invalid world ID: ${args.worldId}`);
139
  }
140
- // const { tokenIdentifier } = identity;
141
- return await insertInput(ctx, world._id, 'join', {
142
- name,
143
- character: characters[Math.floor(Math.random() * characters.length)].name,
144
- description: `${oauthToken} is a human player`,
145
- // description: `${identity.givenName} is a human player`,
146
- tokenIdentifier: oauthToken,
147
- });
148
- },
149
- });
 
 
 
150
 
151
  export const leaveWorld = mutation({
152
  args: {
 
137
  if (!world) {
138
  throw new ConvexError(`Invalid world ID: ${args.worldId}`);
139
  }
140
+ // Select a random character description
141
+ const randomCharacter = characters[Math.floor(Math.random() * characters.length)];
142
+
143
+ return await insertInput(ctx, world._id, 'join', {
144
+ name: randomCharacter.name,
145
+ character: randomCharacter.character,
146
+ description: randomCharacter.identity,
147
+ plan: randomCharacter.plan,
148
+ tokenIdentifier: oauthToken,
149
+ role: "villager",
150
+ });
151
+ },
152
+ });
153
 
154
  export const leaveWorld = mutation({
155
  args: {
patches/src/components/PlayerDetails.tsx CHANGED
@@ -227,7 +227,7 @@ export default function PlayerDetails({
227
  <div className="desc my-6">
228
  <p className="leading-tight -m-4 bg-brown-700 text-base sm:text-sm">
229
  {!isMe && playerDescription?.description}
230
- {isMe && <i>This is you!</i>}
231
  {!isMe && inConversationWithMe && (
232
  <>
233
  <br />
 
227
  <div className="desc my-6">
228
  <p className="leading-tight -m-4 bg-brown-700 text-base sm:text-sm">
229
  {!isMe && playerDescription?.description}
230
+ {isMe && <i>You are a {playerDescription?.role}</i>}
231
  {!isMe && inConversationWithMe && (
232
  <>
233
  <br />