monitor: Track all System and Body state in monitor.state

* Minor grammar edit only in PLUGINS.md (I was checking if it explicitly
  stated what data is expected in the synthetic 'StartUp' event, it doesn't).
* First changes to move some monitor properties into the monitor.state
  dictionary.  This is for system or body data.
* Re-factored the generation of 'StartUp' event into
  `EDLogs.synthesize_startup_event()`.  It's done in two places, so was
  anti-DRY.
* In general any bulk setting of system & body data is now done in the
  same order for comparison clarity.
* A little of the location tracking has been duplicated from plugins/eddn.py.
  This is with a view to switching *it* to using the state version.
This commit is contained in:
Athanasius committed 2023-01-11 19:43:14 +00:00
1 parent 6bd0b042b1
commit 86b0aa4550
3 files changed
+108 -84

No files matched your search

+9
View File
@@ -2208,6 +2208,14 @@ def journal_entry( # noqa: C901, CCR001
entry
)
# TODO - uncomment this, i.e. use monitor.py tracking, not also here
# Copy some state into module-held variables because we might need it
# outside of this function.
# this.body_name = state['Body']
# this.body_id = state['BodyID']
# this.coordinates = state['StarPos']
# this.systemaddress = state['SystemAddress']
# Track location
if event_name == 'supercruiseexit':
# For any orbital station we have no way of determining the body
@@ -2360,6 +2368,7 @@ def journal_entry( # noqa: C901, CCR001
# add planet to Docked event for planetary stations if known
if event_name == 'docked' and this.body_name:
# FIXME - Is this correct if using monitor.py tracking ?
entry['Body'] = this.body_name
entry['BodyType'] = 'Planet'