Skip to content

Commit

Permalink
feat(map,ui,data): metro-style enables align to grid, align to grid d…
Browse files Browse the repository at this point in the history
…isables hyperlane-sensitivity
  • Loading branch information
MichaelMakesGames committed Feb 24, 2024
1 parent 5b115ca commit 672d7c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/renderer/src/lib/map/data/processMapData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ import processTerraIncognitaPath from './processTerraIncognitaPath';
import processVoronoi from './processVoronoi';
import { createHyperlanePaths } from './utils';

export default async function processMapData(gameState: GameState, settings: MapSettings) {
export default async function processMapData(gameState: GameState, rawSettings: MapSettings) {
const settings = { ...rawSettings };
if (settings.hyperlaneMetroStyle) settings.alignStarsToGrid = true;
if (settings.alignStarsToGrid) settings.hyperlaneSensitiveBorders = false;

// get these started right away; await just before needed
const emblemsPromise = timeItAsync('emblems', processEmblems, Object.values(gameState.country));
const countryNamesPromise = timeItAsync('names', processNames, gameState);
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/lib/map/data/processVoronoi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function processVoronoi(
voronoiIndexToSystem[i] = system.id;
return getSystemCoordinates(system.id);
});
if (!settings.alignStarsToGrid && settings.hyperlaneSensitiveBorders) {
if (settings.hyperlaneSensitiveBorders) {
for (const system of Object.values(gameState.galactic_object)) {
const [fromX, fromY] = getSystemCoordinates(system.id);
for (const hyperlane of system.hyperlane) {
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/src/lib/mapSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@ export const mapSettingConfig: MapSettingGroup[] = [
name: 'Align Solar Systems to Grid',
type: 'toggle',
requiresReprocessing: true,
hideIf: (settings) => settings.hyperlaneMetroStyle,
},
],
},
Expand Down Expand Up @@ -713,6 +714,7 @@ export const mapSettingConfig: MapSettingGroup[] = [
<li>Align Solar Systems to Grid</li>
</ul></li>
</ul>`,
hideIf: (settings) => settings.hyperlaneMetroStyle || settings.alignStarsToGrid,
},
{
id: 'voronoiGridSize',
Expand Down

0 comments on commit 672d7c2

Please sign in to comment.