From eb046737510a4505dc9302ea479b8c58a4e2ca72 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Mon, 19 Apr 2021 12:30:24 +0100 Subject: [PATCH] PLUGINS.md: Document dual-type of Suits, and helper functions. --- PLUGINS.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/PLUGINS.md b/PLUGINS.md index 04012421..e09e8359 100644 --- a/PLUGINS.md +++ b/PLUGINS.md @@ -537,10 +537,17 @@ Content of `state` (updated to the current journal entry): | `Data` | `dict` | 'Data' MicroResources in Odyssey, `int` count each. | | `BackPack` | `dict` | `dict` of Odyssey MicroResources in backpack. | | `SuitCurrent` | `dict` | CAPI-returned data of currently worn suit. NB: May be `None` if no data. | -| `Suits` | `dict` | CAPI-returned data of owned suits. NB: May be `None` if no data. | +| `Suits` | `dict` or `list`[1] | CAPI-returned data of owned suits. NB: Type depends on if array is sparse or not. May be `None` if no data. | | `SuitLoadoutCurrent` | `dict` | CAPI-returned data of current Suit Loadout. NB: May be `None` if no data. | | `SuitLoadouts` | `dict` | CAPI-returned data of all Suit Loadouts. NB: May be `None` if no data. | +[1] - With `Suits` there's a caveat depending on all the slots from 0 are +contiguously used or not. If they are then the type is `list` and +indexing is purely numeric. If not then it's a `dict` and you need to index it +with a string. There is `companion.index_possibly_sparse_list()` to aid +with this, or if you wish to iterate over it use `companion.listify()` to +fill in any gaps and have a `list` to operate on. + New in version 4.1.6: `CargoJSON` contains the raw data from the last read of `Cargo.json` passed