@@ -2,7 +2,7 @@
2 import { clan } from 'urbit-ob';
2 import { clan } from 'urbit-ob';
4 import { normalizeId, filterIdsForChildMoons } from 'lib/id';
4 import { normalizeId, filterIdsForChildMoons } from 'lib/id';
5− import { getSpawnedPoints } from 'lib/api';
5+ import { getSpawnedPoints, getUnlockedSpawnedPoints, getLockedSpawnedPoints } from 'lib/api';
6 import store from 'stores/store';
6 import store from 'stores/store';
7 import ShipListings from '@/ShipListings.svelte';
7 import ShipListings from '@/ShipListings.svelte';
@@ -11,7 +11,10 @@
12 let rawSpawnedPointsPromise: any;
12 let rawSpawnedPointsPromise: any;
13 let rawSpawnedPoints: any = null;
13 let rawSpawnedPoints: any = null;
14+ let rawLockedPointsPromise: any;
15+ let rawLockedPoints: any = null;
14 let spawnedPoints: string[] = [];
16 let spawnedPoints: string[] = [];
17+ let lockedPoints: string[] = [];
16 $: shipClass = clan(patp);
19 $: shipClass = clan(patp);
17 $: azPoint = ['galaxy', 'star', 'planet'].includes(shipClass);
20 $: azPoint = ['galaxy', 'star', 'planet'].includes(shipClass);
@@ -19,8 +22,19 @@
19 $: spawnableClassPlural = !canSpawnPoints ? '' : (shipClass === 'galaxy' ? 'Star' : 'Planet');
22 $: spawnableClassPlural = !canSpawnPoints ? '' : (shipClass === 'galaxy' ? 'Star' : 'Planet');
21 rawSpawnedPoints = null;
24 rawSpawnedPoints = null;
25+ rawLockedPoints = null;
22 if (canSpawnPoints) {
26 if (canSpawnPoints) {
23− rawSpawnedPointsPromise = getSpawnedPoints(patp);
27+ let galaxy = shipClass === 'galaxy';
28+ let getSpawnedPointsFunc = galaxy ? getUnlockedSpawnedPoints : getSpawnedPoints;
30+ rawLockedPointsPromise = getLockedSpawnedPoints(patp);
31+ rawLockedPointsPromise.then((info) => {
32+ rawLockedPoints = info;
33+ }).catch((error) => {
34+ rawLockedPoints = { error };
37+ rawSpawnedPointsPromise = getSpawnedPointsFunc(patp);
24 rawSpawnedPointsPromise.then((info) => {
38 rawSpawnedPointsPromise.then((info) => {
25 rawSpawnedPoints = info;
39 rawSpawnedPoints = info;
26 }).catch((error) => {
40 }).catch((error) => {
@@ -34,6 +48,12 @@
34 spawnedPoints = rawSpawnedPoints?.points.map(patpToShip);
48 spawnedPoints = rawSpawnedPoints?.points.map(patpToShip);
53+ if (rawLockedPoints?.points) {
54+ lockedPoints = rawLockedPoints?.points.map(patpToShip);
37 $: trueSpawnedCount = spawnedCount || spawnedPoints.length;
57 $: trueSpawnedCount = spawnedCount || spawnedPoints.length;
38 $: spawnedTab = {
58 $: spawnedTab = {
39 name: 'Spawned',
59 name: 'Spawned',
@@ -42,6 +62,13 @@
42 points: spawnedPoints,
62 points: spawnedPoints,
43 count: trueSpawnedCount,
63 count: trueSpawnedCount,
67+ plural: 'Locked ' + spawnableClassPlural + (lockedPoints.length == 1 ? '' : 's'),
68+ promise: rawLockedPointsPromise,
69+ points: lockedPoints,
70+ count: lockedPoints.length,
45 $: moons = filterIdsForChildMoons($store.peers, patp).map(patpToShip);
72 $: moons = filterIdsForChildMoons($store.peers, patp).map(patpToShip);
46 $: moonsTab = {
73 $: moonsTab = {
47 name: 'Moons',
74 name: 'Moons',
@@ -57,6 +84,9 @@
57 if (spawnedCount !== undefined || spawnedPoints.length > 0) {
84 if (spawnedCount !== undefined || spawnedPoints.length > 0) {
58 tabs.push(spawnedTab);
85 tabs.push(spawnedTab);
87+ if (lockedPoints.length > 0) {
88+ tabs.push(lockedTab);
60 if (azPoint) {
90 if (azPoint) {
61 tabs.push(moonsTab);
91 tabs.push(moonsTab);
@@ -82,8 +112,8 @@
84 {#if tab}
114 {#if tab}
85− <div class="mt-2">
115+ <div>
86− <h3 class="text-lg">
116+ <h3 class="text-lg m-2">
87 {#if tab.count}
117 {#if tab.count}
88 {tab.count} {tab.plural}:
118 {tab.count} {tab.plural}:
@@ -97,6 +127,7 @@
97 <ShipListings
127 <ShipListings
98 ships={tab.points}
128 ships={tab.points}
99 linkToShips
129 linkToShips
130+ differentiateContacts