mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-09 04:44:01 +00:00
fix(cockpit): voice refuses entry while on a vessel bridge
Voice entry tracked an aircraft first, which cleared the vessel selection and ended the bridge, and then failed because Cockpit was still active: no bridge, no cockpit, no selected ship, and voice said entry was unavailable. It now refuses before it touches tracking and says to exit the bridge first.
This commit is contained in:
1 parent
b98bc4b0dc
commit
36a2216528
2 files changed
+25
No files matched your search
@@ -172,6 +172,10 @@ export class CockpitCoordinator {
|
||||
_cockpitEntryRefusal() {
|
||||
if (this._contextModeChanging)
|
||||
return 'Context is still changing — try Cockpit again in a moment';
|
||||
// Tracking an aircraft from the bridge ends the bridge and clears the
|
||||
// vessel selection before the entry can run, leaving neither.
|
||||
if (this.cockpitView?.active && this.cockpitView.subjectKind === 'vessel')
|
||||
return 'Cockpit is on a vessel bridge — exit the bridge first, then track an aircraft to enter Cockpit';
|
||||
if (!this._aircraftLayerEnabled)
|
||||
return 'No aircraft layer is on — turn on Flights or Military Flights and track an aircraft to enter Cockpit';
|
||||
return null;
|
||||
|
||||
@@ -199,6 +199,27 @@ test('with no aircraft layer on, entry is refused for that reason, never for Con
|
||||
assert.equal(cockpit.active, false);
|
||||
});
|
||||
|
||||
test('voice entry on a vessel bridge refuses before it touches tracking', (t) => {
|
||||
const { coordinator, cockpit } = fixture(t, { enabled: ['flights'] });
|
||||
let navigated = false;
|
||||
coordinator.services.militaryAwarenessLayer.navigateNext = () => {
|
||||
navigated = true;
|
||||
return true;
|
||||
};
|
||||
// Stand in for a bridge ride: the refusal reads only these two.
|
||||
cockpit.active = true;
|
||||
cockpit.subjectKind = 'vessel';
|
||||
t.after(() => {
|
||||
cockpit.active = false;
|
||||
cockpit.subjectKind = null;
|
||||
});
|
||||
const voice = coordinator.controlCockpit('enter', { targetLayer: 'flights' });
|
||||
assert.equal(voice.ok, false);
|
||||
assert.match(voice.error, /vessel bridge/);
|
||||
assert.equal(navigated, false, 'no aircraft was tracked');
|
||||
assert.equal(cockpit.subjectKind, 'vessel');
|
||||
});
|
||||
|
||||
test('with an aircraft layer on but nothing tracked, the reason is the missing aircraft', (t) => {
|
||||
const { coordinator } = fixture(t, { enabled: ['military'] });
|
||||
assert.equal(
|
||||
|
||||
Reference in new issue
Block a user