Skip to content

Commit b7b2cc9

Browse files
committed
Fix #107: science containers are listed by part title, and have proper event visibility
1 parent d0cb5a7 commit b7b2cc9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

RasterPropMonitor/Handlers/JSIScienceDisplay.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ private void RefreshModules()
337337
int containerCount = containerModules == null ? 0 : containerModules.Count;
338338
for (int containerIndex = 0; containerIndex < containerCount; ++containerIndex)
339339
{
340-
containersMenu.Add(new TextMenu.Item(containerModules[containerIndex].GetModuleDisplayName(), OpenContainerDetails, containerIndex));
340+
containersMenu.Add(new TextMenu.Item(containerModules[containerIndex].part.partInfo.title, OpenContainerDetails, containerIndex));
341341
}
342342
}
343343

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

357-
for (int actionIndex = 0; actionIndex < containerModule.Actions.Count; ++actionIndex)
357+
containerModule.updateModuleUI();
358+
359+
foreach (var evt in containerModule.events)
358360
{
359-
var action = containerModule.Actions[actionIndex];
360-
detailsMenu.Add(new TextMenu.Item(action.guiName, (id, item) => action.Invoke(activateParam)));
361+
if (evt.guiActive && evt.active)
362+
{
363+
detailsMenu.Add(new TextMenu.Item(evt.GUIName, (id, item) => evt.Invoke()));
364+
}
361365
}
362366

363367
OpenSubMenu(detailsMenu);

0 commit comments

Comments
 (0)