1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-20 10:57:37 +03:00

Inara plugin now maintains Station Name when on_foot

This commit is contained in:
Athanasius 2021-03-30 17:51:25 +01:00
parent bd4489974d
commit 734cb9ed11

View File

@ -59,6 +59,7 @@ this.storedmodules: Optional[OrderedDictT[str, Any]] = None
this.loadout: Optional[OrderedDictT[str, Any]] = None
this.fleet: Optional[List[OrderedDictT[str, Any]]] = None
this.shipswap: bool = False # just swapped ship
this.on_foot = False
# last time we updated, if unset in config this is 0, which means an instant update
LAST_UPDATE_CONF_KEY = 'inara_last_update'
@ -330,6 +331,7 @@ def journal_entry(
elif (ks := killswitch.get_disabled(f'plugins.inara.journal.event.{entry["event"]}')).disabled:
logger.warning(f'event {entry["event"]} processing has been disabled via killswitch: {ks.reason}')
this.on_foot = state['on_foot']
event_name: str = entry['event']
this.cmdr = cmdr
this.FID = state['FID']
@ -380,6 +382,10 @@ def journal_entry(
this.system_population = pop
this.station = entry.get('StationName', this.station)
# on_foot station detection
if not this.station and entry['event'] == 'Location' and entry['BodyType'] == 'Station':
this.station = entry['Body']
this.station_marketid = entry.get('MarketID', this.station_marketid) or this.station_marketid
# We might pick up StationName in DockingRequested, make sure we clear it if leaving
if event_name in ('Undocked', 'FSDJump', 'SupercruiseEntry'):
@ -1069,7 +1075,7 @@ def cmdr_data(data: CAPIData, is_beta):
this.system_link.update_idletasks()
if config.get_str('station_provider') == 'Inara':
if data['commander']['docked']:
if data['commander']['docked'] or this.on_foot and this.station:
this.station_link['text'] = this.station
elif data['lastStarport']['name'] and data['lastStarport']['name'] != "":