Skip to content

Commit 9a9246c

Browse files
authored
Merge pull request #2347 from colsw/stateupdate
Include 'missing?' Loadout event properties in 'state'
2 parents 2f73933 + 583ee4f commit 9a9246c

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

PLUGINS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,10 @@ Content of `state` (updated to the current journal entry):
655655
| `ShipType` | `str` | Internal name for the current ship type |
656656
| `HullValue` | `int` | Current ship value, excluding modules |
657657
| `ModulesValue` | `int` | Value of the current ship's modules |
658+
| `UnladenMass` | `float` | Unladen mass of current ship |
659+
| `CargoCapacity` | `int` | Max cargo capacity of current ship |
660+
| `MaxJumpRange` | `float` | Unladen jump range of current ship |
661+
| `FuelCapacity` | `dict[str,float]` | Current max capacity of Main & Reserve tanks |
658662
| `Rebuy` | `int` | Current ship's rebuy cost |
659663
| `Modules` | `dict` | Currently fitted modules |
660664
| `NavRoute` | `dict` | Last plotted multi-hop route[1] |

monitor.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ def __init_state(self) -> None:
141141
'ShipType': None,
142142
'HullValue': None,
143143
'ModulesValue': None,
144+
'UnladenMass': None,
145+
'CargoCapacity': None,
146+
'MaxJumpRange': None,
147+
'FuelCapacity': None,
144148
'Rebuy': None,
145149
'Modules': None,
146150
'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
680684
self.state['ShipType'] = self.canonicalise(entry['Ship'])
681685
self.state['HullValue'] = entry.get('HullValue') # not present on exiting Outfitting
682686
self.state['ModulesValue'] = entry.get('ModulesValue') # not present on exiting Outfitting
687+
self.state['UnladenMass'] = entry.get('UnladenMass')
688+
self.state['CargoCapacity'] = entry.get('CargoCapacity')
689+
self.state['MaxJumpRange'] = entry.get('MaxJumpRange')
690+
self.state['FuelCapacity'] = {}
691+
self.state['FuelCapacity']['Main'] = entry.get('FuelCapacity')['Main']
692+
self.state['FuelCapacity']['Reserve'] = entry.get('FuelCapacity')['Reserve']
683693
self.state['Rebuy'] = entry.get('Rebuy')
684694
# Remove spurious differences between initial Loadout event and subsequent
685695
self.state['Modules'] = {}

0 commit comments

Comments
 (0)