The aim here is to avoid static data in modules that contain code. Why?
So that we can avoid some potential import loops when the 'inner' module
only wants static data but is already imported by the 'outer' module for
code purposes.
* We now use event_queue.empty() to see if it is indeed empty.
* Changed AppWindow.journal_event() to also use .empty() rather than
`while True`. Keeping the `'if not entry'` check just in case.
This prevents it from calling monitor.get_entry() when the prior run
through the loop has just emptied the queue. Thus we'll only log when
it genuinely IS unexpectedly empty.
* During *game* Shutdown we can send the synthetic 'Shutdown' event
through, and then find and append the actual game 'Shutdown' event
(i.e. this wasn't a crash, which is what the synthetic event is meant
to react to). But AppWindow.journal_event() loop picks up both events
in one call, so the second <<JournalEvent>> sends it working on an
empty queue.
Thus we log in monitor.get_entry() only if the queue is empty *and*
the game is still running.
* NB: Also adds 'Component' to the OTHER place montitor.state is
initialised.
* monitor.on_foot is now monitor.state['on_foot'] as plugins need to
access it.
* EDDB:journal_entry() now stores that in this.on_foot to check later.
* this.on_foot checked in cmdr_data() to actually set station name from
that data if needs be. This avoids setting it to STATION_UNDOCKED if
data['commander']['docked'] is False, when we're on_foot.
NB: No shipyard in tests because data['ships']['shipyard_list'] is an
empty list. This might be the bug not having been fixed, or the station
might genuinely have no ships for sale. We have no way to check in
Odyssey Alpha Phase 1.
* For taxi-usage you 'Embark' on it to take the trip and 'Disembark'
onto foot at the other end.
* Joining a multi-crew session will mean no longer being on foot.
* When quitting a multi-crew session we might miss that you're back
on-foot. Need to test.
Well, it doesn't now raise ServerLagging for a last Journal with a
LoadGame on-foot and in-station.
It does then cause "You're not docked at a station!" to show up.
* I don't want to be checking something against 4.1.x releases when my
last build was with Python 3.8.
# Conflicts:
# config.py
# Conflicts:
# config.py
# Conflicts:
# config.py
* New 'Avoiding potential pitfalls' section to be sure we list them all.
* All plain text now wrapped at 80 columns.
* Re-did all the section headings for consistency, and added many `---`
between sections.
* Headers added within the 'Plugin-specific events' section.
We had a report of a UnicodeDecodeError trying to read an old file. So
try utf-8 first, if it fails try the default, and if nothing else try to
write a new file so the next call should actually work as expected.