EDCD / EDCD/EDMarketConnector

EDMC incorrectly sets current ship to Nomad when renaming the SLV

Open
#2,689 0 comments 0 reactions 0 assignees View on GitHub
bug unconfirmed
Dominant language
Python
Stars
1.3k
Forks
182
Avg merge
1m
Merged PRs (30d)
1

Description

Changing the name/ID of Nomad in the Livery tab emits a `SetUserShipName` event similar to those used with normal ships:
```json
{ "timestamp":"2026-07-18T13:31:02Z", "event":"SetUserShipName", "Ship":"lander01", "ShipID":53, "UserShipName":"a muha tozhe vertolet", "UserShipId":"EX-XSH" }
```

EDMC treats this event as a sign that CMDR is currently sitting in the renamed ship, which is wrong in this case. This leads to:

1) Incorrect data being written to the state object and later passed to the plugins;
```python3
# monitor.py:648
elif event_type == 'setusershipname':
self.state['ShipID'] = entry['ShipID']
if 'UserShipId' in entry: # Only present when changing the ship's ident
self.state['ShipIdent'] = entry['UserShipId']

self.state['ShipName'] = entry.get('UserShipName')
self.state['ShipType'] = self.canonicalise(entry['Ship'])
```

2) Incorrect indication of the current ship in the UI and broken links to EDSY/Coriolis;

(screenshots)
CMDR is inside a Caspian Explorer; EDMC thinks they are inside Nomad
EDSY doesn't know what to do with ShipID 53
Coriolis can't import the ship either
(note: this is not a URI length issue since the browser used is, in fact, Firefox)

3) Incorrect data being sent to Inara:
```python3
# plugins/inara.py:764
elif event_name == 'SetUserShipName':
new_add_event(
'setCommanderShip',
entry['timestamp'],
{
'shipType': state['ShipType'],
'shipGameID': state['ShipID'],
'shipName': state['ShipName'], # Can be None
'shipIdent': state['ShipIdent'], # Can be None
'isCurrentShip': True,
}
)
```

4) Incorrect data *probably* being sent to Coriolis CMDR API. I don't have a Coriolis account, so I can't check it by myself, but judging from a quick glance over the code, I'd assume it makes EDMC send the actual current ship's build (modules and engineering) under the name and ID of Nomad.
```python3
# plugins/coriolis.py:636
def _handle_ship_event(
cmdr: str, api_key: str, event_name: str,
entry: dict[str, Any], state: dict[str, Any],
) -> None:
"""Build and send a ship loadout payload for a ship event."""
loadout = _build_loadout(state)
if not loadout:
return
# ...
_send_to_cmdr_api(cmdr, api_key, payload)
```
```python3
# plugins/coriolis.py:370
def _build_loadout(state: dict[str, Any]) -> dict[str, Any] | None: # noqa: CCR001
"""
Build a loadout dict from EDMC state, similar to Inara's make_loadout.

Returns None if the state has no module information yet.
"""
if not state.get("Modules"):
return None

modules = []
for m in state["Modules"].values():
# ...

return {
"shipType": state.get("ShipType", ""),
"shipID": state.get("ShipID"),
"shipName": state.get("ShipName", ""),
"shipIdent": state.get("ShipIdent", ""),
"modules": modules,
"hullValue": state.get("HullValue"),
"modulesValue": state.get("ModulesValue"),
"rebuy": state.get("Rebuy"),
}
```

Contributor guide

Open the contributing guide

Research direction

Start by tracing the SetUserShipName handling at monitor.py:648 and how state is consumed by plugins/inara.py:764 and plugins/coriolis.py:636. Verify the behavior when renaming the SLV: the current ship state and current-ship payloads should remain unchanged, while normal ship renames should continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.