From 18d71776b38b800eda749314199291a8f2f1c56f Mon Sep 17 00:00:00 2001 From: Connor Date: Fri, 27 Dec 2024 20:29:31 +0000 Subject: [PATCH 1/2] Update monitor.py Added properties of the loadout event which are missing from state: UnladenMass, CargoCapacity, MaxJumpRange, and FuelCapacity --- monitor.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/monitor.py b/monitor.py index e19d6ad56..ff7f09856 100644 --- a/monitor.py +++ b/monitor.py @@ -141,6 +141,10 @@ def __init_state(self) -> None: 'ShipType': None, 'HullValue': None, 'ModulesValue': None, + 'UnladenMass': None, + 'CargoCapacity': None, + 'MaxJumpRange': None, + 'FuelCapacity': None, 'Rebuy': None, 'Modules': None, 'CargoJSON': None, # The raw data from the last time cargo.json was read @@ -680,6 +684,12 @@ def parse_entry(self, line: bytes) -> MutableMapping[str, Any]: # noqa: C901, C self.state['ShipType'] = self.canonicalise(entry['Ship']) self.state['HullValue'] = entry.get('HullValue') # not present on exiting Outfitting self.state['ModulesValue'] = entry.get('ModulesValue') # not present on exiting Outfitting + self.state['UnladenMass'] = entry.get('UnladenMass') + self.state['CargoCapacity'] = entry.get('CargoCapacity') + self.state['MaxJumpRange'] = entry.get('MaxJumpRange') + self.state['FuelCapacity'] = {} + self.state['FuelCapacity']['Main'] = entry.get('FuelCapacity')['Main'] + self.state['FuelCapacity']['Reserve'] = entry.get('FuelCapacity')['Reserve'] self.state['Rebuy'] = entry.get('Rebuy') # Remove spurious differences between initial Loadout event and subsequent self.state['Modules'] = {} From 583ee4fa505392fa217a272d61ddc33c6aa2ace5 Mon Sep 17 00:00:00 2001 From: Connor Date: Fri, 27 Dec 2024 20:40:41 +0000 Subject: [PATCH 2/2] Update PLUGINS.md update state table to match newly added values from loadout events --- PLUGINS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PLUGINS.md b/PLUGINS.md index eee376c05..69f7934ed 100644 --- a/PLUGINS.md +++ b/PLUGINS.md @@ -655,6 +655,10 @@ Content of `state` (updated to the current journal entry): | `ShipType` | `str` | Internal name for the current ship type | | `HullValue` | `int` | Current ship value, excluding modules | | `ModulesValue` | `int` | Value of the current ship's modules | +| `UnladenMass` | `float` | Unladen mass of current ship | +| `CargoCapacity` | `int` | Max cargo capacity of current ship | +| `MaxJumpRange` | `float` | Unladen jump range of current ship | +| `FuelCapacity` | `dict[str,float]` | Current max capacity of Main & Reserve tanks | | `Rebuy` | `int` | Current ship's rebuy cost | | `Modules` | `dict` | Currently fitted modules | | `NavRoute` | `dict` | Last plotted multi-hop route[1] |