diff --git a/app/composables/useWorld.ts b/app/composables/useWorld.ts index 07c1f03..42ac82a 100644 --- a/app/composables/useWorld.ts +++ b/app/composables/useWorld.ts @@ -1,4 +1,4 @@ -import type { WorldSummary } from '~/types/game' +import type { StartDirection, WorldSummary } from '~/types/game' export function useWorld() { const worlds = useState('worlds', () => null) @@ -20,9 +20,9 @@ export function useWorld() { const refresh = () => run(async () => (worlds.value = await ws.send('world.index'))) - /** Joins (or re-enters) a world and returns the player's village there. */ - const join = (worldId: number) => - run(async () => (await ws.send<{ village_id: number }>('world.join', { world_id: worldId })).village_id) + /** Joins (or re-enters) a world, starting in the given quarter of the map, and returns the player's village there. */ + const join = (worldId: number, direction: StartDirection = 'random') => + run(async () => (await ws.send<{ village_id: number }>('world.join', { world_id: worldId, direction })).village_id) return { worlds, error, busy, refresh, join } } diff --git a/app/pages/worlds.vue b/app/pages/worlds.vue index a419d86..f8350f5 100644 --- a/app/pages/worlds.vue +++ b/app/pages/worlds.vue @@ -1,15 +1,21 @@