Skip to content

Commit

Permalink
Improve context-sensitive exploration data
Browse files Browse the repository at this point in the history
  • Loading branch information
iaincollins committed Apr 18, 2023
1 parent 1c76e06 commit a1745a8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/client/components/panels/nav/navigation-inspector-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ export default function NavigationInspectorPanel ({ systemObject, setSystemObjec
SURFACE_PORTS.includes(base.type) ? surfacePorts.push(base) : settlements.push(base)
)

// Show exploration only if there is intersting data to show
let showExploration = false
if (systemObject.hasOwnProperty('mapped')) showExploration = true
if (isLandable) showExploration = true
if (systemObject.volcanismType !== 'No volcanism') showExploration = true
if (systemObject?.signals?.biological > 0) showExploration = true
if (systemObject.terraformingState && systemObject.terraformingState !== 'Not terraformable' && systemObject.terraformingState !== 'Terraformed') showExploration = true

return (
<div className='inspector navigation-panel__inspector fx-fade-in'>
<div className='inspector__title' onClick={() => { setSystemObjectByName(null) }}>
Expand All @@ -83,14 +91,15 @@ export default function NavigationInspectorPanel ({ systemObject, setSystemObjec
<p className='text-info'>{systemObject.distanceToArrival.toLocaleString(undefined, { maximumFractionDigits: 0 })} Ls</p>
</div>}

{systemObject.type == 'Planet' && systemObject.hasOwnProperty('discovered') && systemObject.hasOwnProperty('mapped') &&
{systemObject.type == 'Planet' && showExploration == true &&
<div className='navigation-panel__inspector-section'>
<h4 className='text-primary'>Exploration</h4>

{systemObject?.mapped
? <p className='text-info text-muted'><i className='icarus-terminal-scan' style={{position: 'relative', top: '.3rem', fontSize: '1.5rem'}}/> Surface scanned</p>
: <p className='text-info'><i className='icarus-terminal-scan' style={{position: 'relative', top: '.3rem', fontSize: '1.5rem'}}/> Surface not scanned</p>}

{systemObject.hasOwnProperty('mapped') && <>
{systemObject.mapped
? <p className='text-info text-muted'><i className='icarus-terminal-scan' style={{position: 'relative', top: '.3rem', fontSize: '1.5rem'}}/> Surface scanned</p>
: <p className='text-info'><i className='icarus-terminal-scan' style={{position: 'relative', top: '.3rem', fontSize: '1.5rem'}}/> Surface not scanned</p>}
</>}
{isLandable ? <p className='text-info'><i className='icarus-terminal-planet-lander' style={{position: 'relative', top: '.3rem', fontSize: '1.5rem'}}/> Landable surface</p> : null}

{systemObject.terraformingState && systemObject.terraformingState !== 'Not terraformable' && systemObject.terraformingState !== 'Terraformed' &&
Expand All @@ -113,7 +122,7 @@ export default function NavigationInspectorPanel ({ systemObject, setSystemObjec
)}
</>}

{systemObject?.discovery?.commander && <p className='text-info'><span className='text-primary'>EDSM Credit</span><br/>Cmdr {systemObject.discovery.commander}</p>}
{/* {systemObject?.discovery?.commander && <p className='text-info'><span className='text-primary'>EDSM Credit</span><br/>Cmdr {systemObject.discovery.commander}</p>} */}
</div>
}

Expand Down
10 changes: 10 additions & 0 deletions src/service/lib/event-handlers/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,23 @@ class System {
}
})
}

// If we have data from a surface scan about the plants, merge it
if (body.signals.biological > 0 && SAASignalsFound[0]?.Genuses) {
body.biologicalGenuses = []
;(SAASignalsFound[0]?.Genuses).map(biologicalSamples => {
body.biologicalGenuses.push(biologicalSamples.Genus_Localised)
})
}

// Only log discovered / mapped if in an unhabited system
// FIXME Suspect this logic isn't entirely correct
const inhabitedSystem = (system?.population > 0 || system?.stations?.length > 0 || system?.ports?.length > 0 || system?.megaships?.length > 0 || system?.settlements?.length > 0)
if (!inhabitedSystem) {
const Scan = await this.eliteLog._query({ event: 'Scan', BodyName: body.name, ScanType: 'Detailed' }, 1)
body.discovered = Scan[0]?.WasDiscovered ?? false
body.mapped = Scan[0]?.WasMapped ?? false
}
}
}

Expand Down

0 comments on commit a1745a8

Please sign in to comment.