From 694321064d439a983ba08087b0b78d7951943686 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Mon, 18 Oct 2021 12:20:06 +0100 Subject: [PATCH] EDDN: Rename is_horizons() and document that it's for CAPI data only OK, it has `data` passed in, so this should be obvious, but let's make it explicit both by name and in the docstring. The docstring now also emphasies that *this* check **MUST** be used for CAPI data, as it's dependent only on the availability of Horizons on the account, and not on the `LoadGame` flags. --- plugins/eddn.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/plugins/eddn.py b/plugins/eddn.py index 6768d023..31ab721c 100644 --- a/plugins/eddn.py +++ b/plugins/eddn.py @@ -452,7 +452,7 @@ Msg:\n{msg}''' # Horizons flag - will hit at least Int_PlanetApproachSuite other than at engineer bases ("Colony"), # prison or rescue Megaships, or under Pirate Attack etc - horizons: bool = is_horizons( + horizons: bool = capi_is_horizons( data['lastStarport'].get('economies', {}), modules, ships @@ -500,7 +500,7 @@ Msg:\n{msg}''' """ modules, ships = self.safe_modules_and_ships(data) - horizons: bool = is_horizons( + horizons: bool = capi_is_horizons( data['lastStarport'].get('economies', {}), modules, ships @@ -1432,10 +1432,19 @@ def cmdr_data(data: CAPIData, is_beta: bool) -> Optional[str]: # noqa: CCR001 MAP_STR_ANY = Mapping[str, Any] -def is_horizons(economies: MAP_STR_ANY, modules: MAP_STR_ANY, ships: MAP_STR_ANY) -> bool: +def capi_is_horizons(economies: MAP_STR_ANY, modules: MAP_STR_ANY, ships: MAP_STR_ANY) -> bool: """ Indicate if the supplied data indicates a player has Horizons access. + This is to be used **only** for CAPI-sourced data and **MUST** be used + for CAPI data!!! + + If the account has Horizons access then CAPI `/shipyard` will always see + the Horizons-only modules/ships. You can**NOT** use the Journal horizons + flag for this! If logged in to the base game on an account with Horizons, + which is all of them now, CAPI `/shipyard` will *still* return all of the + Horizons-only modules and ships. + :param economies: Economies of where the Cmdr is docked. :param modules: Modules available at the docked station. :param ships: Ships available at the docked station.