From 607729b77bfd91ed72bbdc5e8a999ee289a6dddc Mon Sep 17 00:00:00 2001 From: A_D Date: Fri, 4 Jun 2021 00:15:57 +0200 Subject: [PATCH] added setCommanderTravelLocation from Location event --- plugins/inara.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/plugins/inara.py b/plugins/inara.py index 0577d626..c6795bd0 100644 --- a/plugins/inara.py +++ b/plugins/inara.py @@ -1156,6 +1156,27 @@ def journal_entry( # noqa: C901, CCR001 new_add_event('updateCommanderSuitLoadout', entry['timestamp'], to_send) + elif event_name == "Location": + to_send = { + 'starsystemName': entry['StarSystem'], + 'starsystemCoords': entry['StarPos'], + } + + if entry['Docked']: + to_send['stationName'] = entry['StationName'] + to_send['marketID'] = entry['MarketID'] + + if entry['Docked'] and entry['BodyType'] == 'Planet': + # we're Docked, but we're not on a Station, thus we're docked at a planetary base of some kind + # and thus, we SHOULD include starsystemBodyName + to_send['starsystemBodyName'] = entry['Body'] + + if 'Longitude' in entry and 'Latitude' in entry: + # These were included thus we are landed + to_send['starsystemBodyCoords'] = [entry['Latitude'], entry['Longitude']] + + new_add_event('setCommanderTravelLocation', entry['timestamp'], to_send) + # Community Goals if event_name == 'CommunityGoal': # Remove any unsent