Merge remote-tracking branch 'upstream/stable' into ed-27-05-2025-upstream-sync

# Conflicts:
#	.github/CODEOWNERS
#	Content.Client/Guidebook/Controls/GuideReagentReaction.xaml.cs
#	Content.IntegrationTests/Tests/Chemistry/TryAllReactionsTest.cs
#	Content.Server/Procedural/DungeonJob/DungeonJob.OreDunGen.cs
#	Resources/Prototypes/Entities/Effects/chemistry_effects.yml
#	Resources/Prototypes/Entities/Mobs/Customization/Markings/human_hair.yml
#	Resources/Prototypes/GameRules/meteorswarms.yml
#	Resources/Prototypes/Procedural/dungeon_configs.yml
This commit is contained in:
Ed
2025-05-27 12:21:14 +03:00
1165 changed files with 76878 additions and 44718 deletions

View File

@@ -1,3 +1,4 @@
using System.Diagnostics;
using System.Linq;
using Content.Client.Guidebook.RichText;
using Content.Client.UserInterface.ControlExtensions;
@@ -8,6 +9,7 @@ using Content.Shared.CCVar;
using Content.Shared.Guidebook;
using Content.Shared.Localizations;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Configuration;
@@ -17,7 +19,7 @@ using Robust.Shared.Prototypes;
namespace Content.Client.Guidebook.Controls;
[GenerateTypedNameReferences]
public sealed partial class GuidebookWindow : FancyWindow, ILinkClickHandler
public sealed partial class GuidebookWindow : FancyWindow, ILinkClickHandler, IAnchorClickHandler
{
[Dependency] private readonly DocumentParsingManager _parsingMan = default!;
[Dependency] private readonly IResourceManager _resourceManager = default!;
@@ -57,6 +59,38 @@ public sealed partial class GuidebookWindow : FancyWindow, ILinkClickHandler
ShowGuide(entry);
}
public void HandleAnchor(IPrototypeLinkControl prototypeLinkControl)
{
var prototype = prototypeLinkControl.LinkedPrototype;
if (prototype == null)
return;
var (linkableControls, _) = GetLinkableControlsAndLinks(EntryContainer);
foreach (var linkableControl in linkableControls)
{
if (linkableControl.RepresentedPrototype != prototype)
continue;
if (linkableControl is not Control control)
return;
// Check if the target item is currently filtered out
if (!control.Visible)
control.Visible = true;
UserInterfaceManager.DeferAction(() =>
{
if (control.GetControlScrollPosition() is not {} position)
return;
Scroll.HScrollTarget = position.X;
Scroll.VScrollTarget = position.Y;
});
break;
}
}
private void OnSelectionChanged(TreeItem? item)
{
if (item != null && item.Metadata is GuideEntry entry)
@@ -98,6 +132,23 @@ public sealed partial class GuidebookWindow : FancyWindow, ILinkClickHandler
}
LastEntry = entry.Id;
var (linkableControls, linkControls) = GetLinkableControlsAndLinks(EntryContainer);
HashSet<IPrototype> availablePrototypeLinks = new();
foreach (var linkableControl in linkableControls)
{
var prototype = linkableControl.RepresentedPrototype;
if (prototype != null)
availablePrototypeLinks.Add(prototype);
}
foreach (var linkControl in linkControls)
{
var prototype = linkControl.LinkedPrototype;
if (prototype != null && availablePrototypeLinks.Contains(prototype))
linkControl.EnablePrototypeLink();
}
}
public void UpdateGuides(
@@ -216,4 +267,30 @@ public sealed partial class GuidebookWindow : FancyWindow, ILinkClickHandler
}
}
}
private static (List<IPrototypeRepresentationControl>, List<IPrototypeLinkControl>) GetLinkableControlsAndLinks(Control parent)
{
List<IPrototypeRepresentationControl> linkableList = new();
List<IPrototypeLinkControl> linkList = new();
foreach (var child in parent.Children)
{
var hasChildren = child.ChildCount > 0;
if (child is IPrototypeLinkControl linkChild)
linkList.Add(linkChild);
else if (child is IPrototypeRepresentationControl linkableChild)
linkableList.Add(linkableChild);
if (!hasChildren)
continue;
var (childLinkableList, childLinkList) = GetLinkableControlsAndLinks(child);
linkableList.AddRange(childLinkableList);
linkList.AddRange(childLinkList);
}
return (linkableList, linkList);
}
}