Spaces:
Sleeping
Sleeping
adding role
Browse files- patches/characters.ts +1 -1
- patches/convex/world.ts +13 -10
- patches/src/components/PlayerDetails.tsx +1 -1
patches/characters.ts
CHANGED
@@ -19,7 +19,7 @@ export const Descriptions = [
|
|
19 |
// },
|
20 |
{
|
21 |
name: 'Lucky',
|
22 |
-
character: '
|
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 |
-
//
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
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>
|
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 />
|