From f14910030c33896495d46b89d3b689d896c18f56 Mon Sep 17 00:00:00 2001 From: Michael Moore Date: Tue, 5 Nov 2024 14:11:40 -0600 Subject: [PATCH] fix(map): prevent GPM's Resource Sites from rendering as planets --- .../src/lib/map/solarSystemMap/SolarSystemMap.svelte | 4 +++- src/renderer/src/lib/map/solarSystemMap/utils/planets.ts | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/renderer/src/lib/map/solarSystemMap/SolarSystemMap.svelte b/src/renderer/src/lib/map/solarSystemMap/SolarSystemMap.svelte index de02560..d24d303 100644 --- a/src/renderer/src/lib/map/solarSystemMap/SolarSystemMap.svelte +++ b/src/renderer/src/lib/map/solarSystemMap/SolarSystemMap.svelte @@ -34,6 +34,7 @@ getPlanetRadius, getPrimaryBodies, isAsteroid, + isFakePlanet, isPlanetarySystemPrimaryBody, isStar, PLANET_RING_PATTERN, @@ -128,7 +129,8 @@ $: planets = system.planet .map((planetId) => gameState.planets.planet[planetId]) - .filter(isDefined); + .filter(isDefined) + .filter((planet) => !isFakePlanet(planet)); $: systemConnections = system.hyperlane .map((h) => { diff --git a/src/renderer/src/lib/map/solarSystemMap/utils/planets.ts b/src/renderer/src/lib/map/solarSystemMap/utils/planets.ts index ed7733f..185332f 100644 --- a/src/renderer/src/lib/map/solarSystemMap/utils/planets.ts +++ b/src/renderer/src/lib/map/solarSystemMap/utils/planets.ts @@ -30,6 +30,15 @@ export function isMoon(planet: Planet) { return Boolean(planet.is_moon); } +/** + * Finds Stellaris "planets" that aren't actually planets (or moons/stars) + * @param planet + * @returns + */ +export function isFakePlanet(planet: Planet) { + return planet.planet_class === 'pc_gpm_res'; // Guill's Planet Modifiers "Resource Site" +} + export function getPlanetRadius(planet: Planet, settings: MapSettings) { return Math.sqrt( planet.planet_size *