Find last location if no FSDJump found.
This commit is contained in:
parent
e97f527937
commit
b8745fa7e3
1 changed files with 21 additions and 5 deletions
|
@ -76,15 +76,31 @@ export class JournalInterface extends EventEmitter {
|
||||||
this.emit('ENTERED_NEW_SYSTEM')
|
this.emit('ENTERED_NEW_SYSTEM')
|
||||||
return false
|
return false
|
||||||
} else if (last) {
|
} else if (last) {
|
||||||
log('Warning: unable to find last hyperspace jump. Current location unknown.')
|
log('Unable to find last hyperspace jump. Searching for last known location.')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
if (this.location.name !== 'Unknown') {
|
lineReader.eachLine(this.currentJournal, (raw: string, last: boolean) => {
|
||||||
log('Attempting to find scanned bodies in current system.')
|
if (raw) {
|
||||||
this.getScannedBodies()
|
const line = JSON.parse(raw)
|
||||||
}
|
|
||||||
|
if (line.event === 'Location') {
|
||||||
|
this.location = new System(line.StarSystem)
|
||||||
|
log(`Current location set to ${this.location.name}.`)
|
||||||
|
this.emit('ENTERED_NEW_SYSTEM')
|
||||||
|
return false
|
||||||
|
} else if (last) {
|
||||||
|
log('WARNING: Unable to find last known location.')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).then(() => {
|
||||||
|
if (this.location.name !== 'Unknown') {
|
||||||
|
log('Attempting to find scanned bodies in current system.')
|
||||||
|
this.getScannedBodies()
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue