Jofthomas HF staff commited on
Commit
841082c
1 Parent(s): 7dd16f4
patches/characters.ts CHANGED
@@ -214,6 +214,13 @@ export const characters = [
214
  spritesheetData: f8SpritesheetData,
215
  speed: 0.15,
216
  },
 
 
 
 
 
 
 
217
  ];
218
 
219
  // Characters move at 0.75 tiles per second.
 
214
  spritesheetData: f8SpritesheetData,
215
  speed: 0.15,
216
  },
217
+ {
218
+ name: 'c1',
219
+ textureUrl: '/ai-town/assets/GrayCat.png',
220
+ spritesheetData: c1SpritesheetData,
221
+ speed: 0.19,
222
+ },
223
+
224
  ];
225
 
226
  // Characters move at 0.75 tiles per second.
patches/convex/aiTown/agentOperations.ts CHANGED
@@ -128,21 +128,21 @@ export const agentDoSomething = internalAction({
128
  return;
129
  } else {
130
  // TODO: have LLM choose the activity & emoji
131
- // const activity = ACTIVITIES[Math.floor(Math.random() * ACTIVITIES.length)];
132
- // await sleep(Math.random() * 1000);
133
- // await ctx.runMutation(api.aiTown.main.sendInput, {
134
- // worldId: args.worldId,
135
- // name: 'finishDoSomething',
136
- // args: {
137
- // operationId: args.operationId,
138
- // agentId: agent.id,
139
- // activity: {
140
- // description: activity.description,
141
- // emoji: activity.emoji,
142
- // until: Date.now() + activity.duration,
143
- // },
144
- // },
145
- // });
146
  return;
147
  }
148
  }
@@ -177,4 +177,4 @@ function wanderDestination(worldMap: WorldMap) {
177
  x: 1 + Math.floor(Math.random() * (worldMap.width - 2)),
178
  y: 1 + Math.floor(Math.random() * (worldMap.height - 2)),
179
  };
180
- }
 
128
  return;
129
  } else {
130
  // TODO: have LLM choose the activity & emoji
131
+ const activity = ACTIVITIES[Math.floor(Math.random() * ACTIVITIES.length)];
132
+ await sleep(Math.random() * 1000);
133
+ await ctx.runMutation(api.aiTown.main.sendInput, {
134
+ worldId: args.worldId,
135
+ name: 'finishDoSomething',
136
+ args: {
137
+ operationId: args.operationId,
138
+ agentId: agent.id,
139
+ activity: {
140
+ description: activity.description,
141
+ emoji: activity.emoji,
142
+ until: Date.now() + activity.duration,
143
+ },
144
+ },
145
+ });
146
  return;
147
  }
148
  }
 
177
  x: 1 + Math.floor(Math.random() * (worldMap.width - 2)),
178
  y: 1 + Math.floor(Math.random() * (worldMap.height - 2)),
179
  };
180
+ }
patches/convex/aiTown/gameCycle.ts CHANGED
@@ -115,18 +115,11 @@ const onStateChange = (prevState: CycleState, newState: CycleState, game: Game,
115
  })
116
  };
117
  if (prevState === 'PlayerKillVoting') {
118
- const werewolves = [...game.world.players.values()].filter((were) => {
119
- game.playerDescriptions.get(were.id)?.type === 'werewolf'
120
- })
121
- if (werewolves.length != 0) {
122
- const mostVotedPlayer = processVotes(game.world.gameVotes, [...game.world.players.values()])[0];
123
- const playerToKill = game.world.players.get(mostVotedPlayer.playerId);
124
- console.log(`killing: ${playerToKill?.id}, with ${game.world.gameVotes.length} votes`)
125
- if (playerToKill) {
126
- playerToKill.kill(game, now);
127
- }
128
- } else {
129
- console.log('no werewolves, nobody was killed')
130
  }
131
  game.world.gameVotes = [];
132
  }
 
115
  })
116
  };
117
  if (prevState === 'PlayerKillVoting') {
118
+ const mostVotedPlayer = processVotes(game.world.gameVotes, [...game.world.players.values()])[0];
119
+ const playerToKill = game.world.players.get(mostVotedPlayer.playerId);
120
+ console.log(`killing: ${playerToKill?.id}, with ${game.world.gameVotes.length} votes`)
121
+ if (playerToKill) {
122
+ playerToKill.kill(game, now);
 
 
 
 
 
 
 
123
  }
124
  game.world.gameVotes = [];
125
  }
patches/src/App.tsx CHANGED
@@ -23,7 +23,7 @@ export default function Home() {
23
  return (
24
  <main className="relative flex min-h-screen flex-col items-center justify-between font-body game-background">
25
 
26
- <ReactModal
27
  isOpen={helpModalOpen}
28
  onRequestClose={() => setHelpModalOpen(false)}
29
  style={modalStyles}
 
23
  return (
24
  <main className="relative flex min-h-screen flex-col items-center justify-between font-body game-background">
25
 
26
+ <ReactModal
27
  isOpen={helpModalOpen}
28
  onRequestClose={() => setHelpModalOpen(false)}
29
  style={modalStyles}
patches/src/components/Character.tsx CHANGED
@@ -85,10 +85,10 @@ export const Character = ({
85
 
86
  return (
87
  <Container x={x} y={y} interactive={true} pointerdown={onClick} cursor="pointer">
88
- {/* {isThinking && (
89
  // TODO: We'll eventually have separate assets for thinking and speech animations.
90
  <Text x={-20} y={-10} scale={{ x: -0.8, y: 0.8 }} text={'💭'} anchor={{ x: 0.5, y: 0.5 }} />
91
- )} */}
92
  {isSpeaking && (
93
  // TODO: We'll eventually have separate assets for thinking and speech animations.
94
  <Text x={18} y={-10} scale={0.8} text={'💬'} anchor={{ x: 0.5, y: 0.5 }} />
 
85
 
86
  return (
87
  <Container x={x} y={y} interactive={true} pointerdown={onClick} cursor="pointer">
88
+ {isThinking && (
89
  // TODO: We'll eventually have separate assets for thinking and speech animations.
90
  <Text x={-20} y={-10} scale={{ x: -0.8, y: 0.8 }} text={'💭'} anchor={{ x: 0.5, y: 0.5 }} />
91
+ )}
92
  {isSpeaking && (
93
  // TODO: We'll eventually have separate assets for thinking and speech animations.
94
  <Text x={18} y={-10} scale={0.8} text={'💬'} anchor={{ x: 0.5, y: 0.5 }} />