Fixed the guidebook listing every single rule (#28680)

* Well i tried this way

* New approach (start)

* Did it

* makes spacelaw available, put it under sec
This commit is contained in:
AJCM-git
2024-06-07 07:28:55 -04:00
committed by GitHub
parent 7ba26f4592
commit accf8adf97
7 changed files with 73 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ using Content.Client.Guidebook.RichText;
using Content.Client.UserInterface.ControlExtensions;
using Content.Client.UserInterface.Controls;
using Content.Client.UserInterface.Controls.FancyTree;
using Content.Client.UserInterface.Systems.Info;
using Content.Shared.Guidebook;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
@@ -36,7 +37,13 @@ public sealed partial class GuidebookWindow : FancyWindow, ILinkClickHandler
private void OnSelectionChanged(TreeItem? item)
{
if (item != null && item.Metadata is GuideEntry entry)
{
ShowGuide(entry);
var isRulesEntry = entry.RuleEntry;
ReturnContainer.Visible = isRulesEntry;
HomeButton.OnPressed += _ => ShowGuide(entry);
}
else
ClearSelectedGuide();
}
@@ -153,6 +160,10 @@ public sealed partial class GuidebookWindow : FancyWindow, ILinkClickHandler
return null;
}
var rulesProto = UserInterfaceManager.GetUIController<InfoUIController>().GetCoreRuleEntry();
if (entry.RuleEntry && entry.Id != rulesProto.Id)
return null;
var item = Tree.AddItem(parent);
item.Metadata = entry;
var name = Loc.GetString(entry.Name);