From 60f3b524e2a644cb8afe07ef8595b3bc55b0636d Mon Sep 17 00:00:00 2001 From: Athanasius Date: Thu, 14 Oct 2021 13:04:52 +0100 Subject: [PATCH] EDDN: codexentry: Always set BodyName from Status.json, ID if Journal matches Partial data is better than no data, or bad data. So if Status.json BodyName is available, always use it. *Then* see if Journal BodyName matches that, and if so set BodyID. Close-orbiting bodies might therefore cause BodyName to be set without BodyID, but then it's up to EDDN listeners to make a decision, rather than making it for them. --- plugins/eddn.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/plugins/eddn.py b/plugins/eddn.py index 1225cd59..a7afd2a9 100644 --- a/plugins/eddn.py +++ b/plugins/eddn.py @@ -804,15 +804,13 @@ Msg:\n{msg}''' entry = ret - # Body Name and ID, if available - # Status.json BodyName is set as soon as the Orbital Cruise/Glide HUD - # activates. - # Journal ApproachBody only occurs once inside Orbital Cruise altitude. - # So we check that both are set, and match, then use the Status.json - # value. - if this.status_body_name is not None and this.status_body_name == this.body_name: + # Set BodyName if it's available from Status.json + if this.status_body_name is not None: entry['BodyName'] = this.status_body_name - entry['BodyID'] = this.body_id + # Only set BodyID if journal BodyName matches the Status.json one. + # This avoids binary body issues. + if this.status_body_name == this.body_name: + entry['BodyID'] = this.body_id ####################################################################### msg = {