Update UI when FSDJump is detected.

This commit is contained in:
punkfairie 2023-05-09 13:40:32 -07:00
parent d68ae26032
commit 32d5919778
3 changed files with 13 additions and 0 deletions

View file

@ -205,6 +205,7 @@ export class JournalInterface extends EventEmitter {
// CMDR jumped to new system, so update current location.
case 'FSDJump': {
this.location = new System(line.StarSystem)
log(`FSD Jump detected, current location updated to ${this.location.name}.`)
this.emit('ENTERED_NEW_SYSTEM')
break
}

View file

@ -53,6 +53,8 @@ if (journal.journalDir === null) {
journal.watchDirectory()
journal.watchJournal()
/* --------------------------------------------------------------------------- init complete ---- */
journal.once('INIT_COMPLETE', () => {
if (journal.location !== null) {
$('#currentSystem')
@ -71,3 +73,12 @@ journal.once('INIT_COMPLETE', () => {
})
}
})
/* ---------------------------------------------------------------------- entered new system ---- */
journal.on('ENTERED_NEW_SYSTEM', () => {
$('#highValueScans').children().remove()
$('#lowValueScans').children().remove()
$('#currentSystemName').text(journal.location.name)
})

View file

@ -3,6 +3,7 @@
const buildRings = (body) => {
const rings = $('<span>')
const seperator = $('<span>').text(' ) ')
rings.appendChild(seperator)
body.Rings.forEach((ring) => {
const ringClass = ring.RingClass.replace('eRingClass_', '')