Skip to content

Commit

Permalink
Fix #107: science containers are listed by part title, and have prope…
Browse files Browse the repository at this point in the history
…r event visibility
  • Loading branch information
JonnyOThan committed Nov 10, 2023
1 parent d0cb5a7 commit b7b2cc9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions RasterPropMonitor/Handlers/JSIScienceDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ private void RefreshModules()
int containerCount = containerModules == null ? 0 : containerModules.Count;
for (int containerIndex = 0; containerIndex < containerCount; ++containerIndex)
{
containersMenu.Add(new TextMenu.Item(containerModules[containerIndex].GetModuleDisplayName(), OpenContainerDetails, containerIndex));
containersMenu.Add(new TextMenu.Item(containerModules[containerIndex].part.partInfo.title, OpenContainerDetails, containerIndex));
}
}

Expand All @@ -354,10 +354,14 @@ private void OpenContainerDetails(int containerIndex, TextMenu.Item containerIte
var detailsMenu = new TextMenu();
detailsMenu.menuTitle = containerModule.GUIName;

for (int actionIndex = 0; actionIndex < containerModule.Actions.Count; ++actionIndex)
containerModule.updateModuleUI();

foreach (var evt in containerModule.events)
{
var action = containerModule.Actions[actionIndex];
detailsMenu.Add(new TextMenu.Item(action.guiName, (id, item) => action.Invoke(activateParam)));
if (evt.guiActive && evt.active)
{
detailsMenu.Add(new TextMenu.Item(evt.GUIName, (id, item) => evt.Invoke()));
}
}

OpenSubMenu(detailsMenu);
Expand Down

0 comments on commit b7b2cc9

Please sign in to comment.