Spaces:
Sleeping
Sleeping
plan
Browse files- patches/convex/world.ts +4 -5
patches/convex/world.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
import { ConvexError, v } from 'convex/values';
|
| 2 |
import { internalMutation, mutation, query } from './_generated/server';
|
| 3 |
import { characters } from '../data/characters';
|
| 4 |
-
import { Descriptions } from '../data/characters';
|
| 5 |
import { insertInput } from './aiTown/insertInput';
|
| 6 |
import {
|
| 7 |
DEFAULT_NAME,
|
|
@@ -107,7 +106,6 @@ export const userStatus = query({
|
|
| 107 |
if (!oauthToken) {
|
| 108 |
return null;
|
| 109 |
}
|
| 110 |
-
|
| 111 |
|
| 112 |
return oauthToken;
|
| 113 |
},
|
|
@@ -140,13 +138,14 @@ export const joinWorld = mutation({
|
|
| 140 |
throw new ConvexError(`Invalid world ID: ${args.worldId}`);
|
| 141 |
}
|
| 142 |
// Select a random character description
|
| 143 |
-
const randomCharacter =
|
| 144 |
-
|
| 145 |
return await insertInput(ctx, world._id, 'join', {
|
| 146 |
name: randomCharacter.name,
|
| 147 |
character: randomCharacter.character,
|
| 148 |
description: randomCharacter.identity,
|
| 149 |
-
tokenIdentifier:
|
|
|
|
| 150 |
role: "villager",
|
| 151 |
});
|
| 152 |
},
|
|
|
|
| 1 |
import { ConvexError, v } from 'convex/values';
|
| 2 |
import { internalMutation, mutation, query } from './_generated/server';
|
| 3 |
import { characters } from '../data/characters';
|
|
|
|
| 4 |
import { insertInput } from './aiTown/insertInput';
|
| 5 |
import {
|
| 6 |
DEFAULT_NAME,
|
|
|
|
| 106 |
if (!oauthToken) {
|
| 107 |
return null;
|
| 108 |
}
|
|
|
|
| 109 |
|
| 110 |
return oauthToken;
|
| 111 |
},
|
|
|
|
| 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 |
+
tokenIdentifier: randomCharacter.name,
|
| 148 |
+
plan:randomCharacter.plan,
|
| 149 |
role: "villager",
|
| 150 |
});
|
| 151 |
},
|