Skip to content

Commit

Permalink
fix(map): prevent GPM's Resource Sites from rendering as planets
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelMakesGames committed Nov 5, 2024
1 parent 6f43523 commit f149100
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
getPlanetRadius,
getPrimaryBodies,
isAsteroid,
isFakePlanet,
isPlanetarySystemPrimaryBody,
isStar,
PLANET_RING_PATTERN,
Expand Down Expand Up @@ -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) => {
Expand Down
9 changes: 9 additions & 0 deletions src/renderer/src/lib/map/solarSystemMap/utils/planets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down

0 comments on commit f149100

Please sign in to comment.