Spaces:
Sleeping
Sleeping
random
Browse files- patches/convex/world.ts +2 -1
patches/convex/world.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 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,
|
|
@@ -139,7 +140,7 @@ export const joinWorld = mutation({
|
|
| 139 |
throw new ConvexError(`Invalid world ID: ${args.worldId}`);
|
| 140 |
}
|
| 141 |
// Select a random character description
|
| 142 |
-
const randomCharacter =
|
| 143 |
console.log(randomCharacter)
|
| 144 |
return await insertInput(ctx, world._id, 'join', {
|
| 145 |
name: randomCharacter.name,
|
|
|
|
| 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,
|
|
|
|
| 140 |
throw new ConvexError(`Invalid world ID: ${args.worldId}`);
|
| 141 |
}
|
| 142 |
// Select a random character description
|
| 143 |
+
const randomCharacter = Descriptions[Math.floor(Math.random() * Descriptions.length)];
|
| 144 |
console.log(randomCharacter)
|
| 145 |
return await insertInput(ctx, world._id, 'join', {
|
| 146 |
name: randomCharacter.name,
|