private readonly ISawmill _sawmill;
+ public ProtoId<GuideEntryPrototype> LastEntry;
+
public GuidebookWindow()
{
RobustXamlLoader.Load(this);
_sawmill.Error($"Failed to parse contents of guide document {entry.Id}.");
}
+
+ LastEntry = entry.Id;
}
public void UpdateGuides(
private GuidebookWindow? _guideWindow;
private MenuButton? GuidebookButton => UIManager.GetActiveUIWidgetOrNull<MenuBar.Widgets.GameTopMenuBar>()?.GuidebookButton;
+ private ProtoId<GuideEntryPrototype>? _lastEntry;
public void OnStateEntered(LobbyState state)
{
GuidebookButton.Pressed = false;
if (_guideWindow != null)
+ {
_guideWindow.ReturnContainer.Visible = false;
+ _lastEntry = _guideWindow.LastEntry;
+ }
}
private void OnWindowOpen()
if (GuidebookButton != null)
GuidebookButton.SetClickPressed(!_guideWindow.IsOpen);
- selected ??= _configuration.GetCVar(CCVars.DefaultGuide);
-
if (guides == null)
{
guides = _prototypeManager.EnumeratePrototypes<GuideEntryPrototype>()
}
}
+ if (selected == null)
+ {
+ if (_lastEntry is { } lastEntry && guides.ContainsKey(lastEntry))
+ {
+ selected = _lastEntry;
+ }
+ else
+ {
+ selected = _configuration.GetCVar(CCVars.DefaultGuide);
+ }
+ }
_guideWindow.UpdateGuides(guides, rootEntries, forceRoot, selected);
// Expand up to depth-2.