@@ -252,105 +252,113 @@ export function populateGraph(g: Graph, chartData: ChartPoint[], bySponsor: bool
252 if (itsYou) {
252 if (itsYou) {
253 g.setNodeAttribute(gPatp, 'color', colors.YOUR_GAL);
253 g.setNodeAttribute(gPatp, 'color', colors.YOUR_GAL);
255− g.addNode(sPatp, {
256+ g.addNode(sPatp, {
256− label: sPatp,
257+ label: sPatp,
257− size: starSize,
258+ size: starSize,
258− color: itsYou ? colors.YOU : colors.GOLDT2,
259+ color: itsYou ? colors.YOU : colors.GOLDT2,
259− x: starX,
260+ x: starX,
260− y: starY,
261+ y: starY,
261− zIndex: 8,
262+ zIndex: 8,
263− if (lastStarArm == arm) {
264− g.addEdge(sPatp, lastStarPatp, {
265− color: colors.LGREY,
270− g.addEdge(sPatp, gPatp, {
271− color: colors.LGREY,
264+ if (lastStarArm == arm) {
265+ g.addEdge(sPatp, lastStarPatp, {
266+ color: colors.LGREY,
271+ g.addEdge(sPatp, gPatp, {
272+ color: colors.LGREY,
276− lastStarArm = arm;
277+ lastStarArm = arm;
277− lastStarPatp = sPatp;
278+ lastStarPatp = sPatp;
278− if (star.sponsor) {
279+ if (star.sponsor) {
279− sponsorEdges.push([sPatp, star.sponsor, {
280+ sponsorEdges.push([sPatp, star.sponsor, {
280− color: colors.GREEN,
281+ color: colors.GREEN,
281− size: 0.2,
282+ size: 0.2,
282− zIndex: 11,
283+ zIndex: 11,
286− const planets = star[subsKey] || [];
287− const numPlanets = planets.length;
288− // const maxPlanetDistance = starSize * 1.6 * 4000 * 64;
289− const maxPlanetDistance = minDistanceBetweenStars * 0.45;
290− const minPlanetDistance = maxPlanetDistance / 4;
292− coords: planetCoords,
293− numArms: numPlanetArms,
294− minDistanceBetween: minDistanceBetweenPlanets,
295− } = arrangePointsInSpirals(numPlanets,
297− maxDistance: maxPlanetDistance,
298− minDistance: minPlanetDistance,
302− makeSingleArmCircle: true,
304− let lastPlanetArm = null;
305− let lastPlanetPatp = null;
306− planets.forEach((planet, pi) => {
307− const pPatp = planet.patp;
308− const [planetX, planetY] = planetCoords[pi].coords;
309− const arm = planetCoords[pi].arm;
310− const planetSize = Math.sqrt(Math.min(minPlanetDistance, minDistanceBetweenPlanets)) / 1300;
311− const planetEdgeSize = planetSize / 3;
312− const itsYou = pPatp === '~' + window.ship;
314− g.setNodeAttribute(sPatp, 'color', colors.YOUR_STAR);
315− g.setNodeAttribute(gPatp, 'color', colors.YOUR_GAL);
318− g.addNode(pPatp, {
287+ const planets = star[subsKey] || [];
319− label: pPatp,
288+ const numPlanets = planets.length;
320− size: planetSize,
289+ // const maxPlanetDistance = starSize * 1.6 * 4000 * 64;
321− color: itsYou ? colors.YOU : (planet.dominion == 'l2' ? colors.GREEN : colors.BLUE),
290+ const maxPlanetDistance = minDistanceBetweenStars * 0.45;
322− x: planetX,
291+ const minPlanetDistance = maxPlanetDistance / 4;
323− y: planetY,
292+ const {
324− zIndex: 6,
293+ coords: planetCoords,
294+ numArms: numPlanetArms,
295+ minDistanceBetween: minDistanceBetweenPlanets,
296+ } = arrangePointsInSpirals(numPlanets,
298+ maxDistance: maxPlanetDistance,
299+ minDistance: minPlanetDistance,
303+ makeSingleArmCircle: true,
326− if (lastPlanetArm == arm) {
305+ let lastPlanetArm = null;
327− g.addEdge(pPatp, lastPlanetPatp, {
306+ let lastPlanetPatp = null;
328− color: colors.DGREY,
307+ planets.forEach((planet, pi) => {
308+ const pPatp = planet.patp;
309+ const [planetX, planetY] = planetCoords[pi].coords;
310+ const arm = planetCoords[pi].arm;
311+ const planetSize = Math.sqrt(Math.min(minPlanetDistance, minDistanceBetweenPlanets)) / 1300;
329− size: planetEdgeSize,
312+ const planetEdgeSize = planetSize / 3;
313+ const itsYou = pPatp === '~' + window.ship;
315+ g.setNodeAttribute(sPatp, 'color', colors.YOUR_STAR);
316+ g.setNodeAttribute(gPatp, 'color', colors.YOUR_GAL);
322+ color: itsYou ? colors.YOU : (planet.dominion == 'l2' ? colors.GREEN : colors.BLUE),
330− zIndex: 5,
325+ zIndex: 6,
332− } else {
327+ if (lastPlanetArm == arm) {
333− if (numPlanetArms == 1) {
334− g.addEdge(pPatp, sPatp, {
328+ g.addEdge(pPatp, lastPlanetPatp, {
335 color: colors.DGREY,
329 color: colors.DGREY,
336 size: planetEdgeSize,
330 size: planetEdgeSize,
337 zIndex: 5,
331 zIndex: 5,
334+ if (numPlanetArms == 1) {
335+ g.addEdge(pPatp, sPatp, {
336+ color: colors.DGREY,
337+ size: planetEdgeSize,
342+ if (planet.sponsor) {
343+ sponsorEdges.push([pPatp, planet.sponsor, {
344+ color: colors.GREEN,
345+ size: planetEdgeSize,
349+ lastPlanetArm = arm;
350+ lastPlanetPatp = pPatp;
352+ let msg = `Couldn't add ${pPatp} to the graph`;
353+ console.error(msg, e);
354+ alertMe(msg + '\n' + e.message);
341− if (planet.sponsor) {
342− sponsorEdges.push([pPatp, planet.sponsor, {
343− color: colors.GREEN,
344− size: planetEdgeSize,
348− } catch (e) {
357+ } catch (e) {
349− console.error(`Couldn't add ${pPatp} to the graph`, e);
358+ let msg = `Couldn't add ${sPatp} to the graph`;
350− }
359+ console.error(msg, e);
351− lastPlanetArm = arm;
360+ alertMe(msg + '\n' + e.message);
352− lastPlanetPatp = pPatp;
356 sponsorEdges.forEach(([point, sponsor, attrs]) => {
364 sponsorEdges.forEach(([point, sponsor, attrs]) => {
@@ -361,3 +369,7 @@ export function populateGraph(g: Graph, chartData: ChartPoint[], bySponsor: bool
362 return g;
370 return g;
373+function alertMe(msg: string) {
374+ alert('Encountered an error, please tell ~midlev-mindyr: ' + msg);