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

Separate 'Docked' processing to own conditional.

A taxi 'Docked' event has much less data than an own-ship one.  Rather
than put tortured conditionals into the
Location/FSDJump/CarrierJump/Docked conditional I've split Docked into
its own.

There should always be one of the other events to set things like
SystemAddress before a 'Docked' event, so limiting the new conditional
to setting/changing only the station-related state variables.
This commit is contained in:
Athanasius 2021-05-05 12:20:24 +01:00
parent b3032c4c95
commit f1ca2b8283

View File

@ -690,7 +690,13 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
# We're definitely on-foot now
self.state['OnFoot'] = True
elif event_type in ('Location', 'FSDJump', 'Docked', 'CarrierJump'):
elif event_type == 'Docked':
self.station = entry.get('StationName') # May be None
self.station_marketid = entry.get('MarketID') # May be None
self.stationtype = entry.get('StationType') # May be None
self.stationservices = entry.get('StationServices') # None under E:D < 2.4
elif event_type in ('Location', 'FSDJump', 'CarrierJump'):
# alpha4 - any changes ?
# Location:
# New in Odyssey:
@ -710,13 +716,9 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
if 'StarPos' in entry:
self.coordinates = tuple(entry['StarPos']) # type: ignore
elif self.system != entry['StarSystem']:
self.coordinates = None # Docked event doesn't include coordinates
self.systemaddress = entry.get('SystemAddress')
if event_type in ('Location', 'FSDJump', 'CarrierJump'):
self.systempopulation = entry.get('Population')
self.systempopulation = entry.get('Population')
self.system = 'CQC' if entry['StarSystem'] == 'ProvingGround' else entry['StarSystem']
@ -729,7 +731,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
self.station_marketid = entry.get('MarketID') # May be None
self.stationtype = entry.get('StationType') # May be None
self.stationservices = entry.get('StationServices') # None under E:D < 2.4
self.stationservices = entry.get('StationServices') # None in Odyssey for on-foot 'Location'
elif event_type == 'ApproachBody':
self.planet = entry['Body']