Add support for contraband text to the reagent guidebook (#37113)
* Add contraband text to reagent guidebook * Add reagent for examining * Update Content.Client/Guidebook/Controls/GuideReagentEmbed.xaml.cs --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
@@ -5,14 +5,17 @@ using Content.Client.Guidebook.Richtext;
|
||||
using Content.Client.Message;
|
||||
using Content.Client.UserInterface.ControlExtensions;
|
||||
using Content.Shared.Body.Prototypes;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Chemistry.Reaction;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Contraband;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -27,8 +30,10 @@ public sealed partial class GuideReagentEmbed : BoxContainer, IDocumentTag, ISea
|
||||
[Dependency] private readonly IEntitySystemManager _systemManager = default!;
|
||||
[Dependency] private readonly ILogManager _logManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
[Dependency] private readonly IConfigurationManager _config = default!;
|
||||
|
||||
private readonly ChemistryGuideDataSystem _chemistryGuideData;
|
||||
private readonly ContrabandSystem _contraband;
|
||||
private readonly ISawmill _sawmill;
|
||||
|
||||
public IPrototype? RepresentedPrototype { get; private set; }
|
||||
@@ -39,6 +44,7 @@ public sealed partial class GuideReagentEmbed : BoxContainer, IDocumentTag, ISea
|
||||
IoCManager.InjectDependencies(this);
|
||||
_sawmill = _logManager.GetSawmill("guidebook.reagent");
|
||||
_chemistryGuideData = _systemManager.GetEntitySystem<ChemistryGuideDataSystem>();
|
||||
_contraband = _systemManager.GetEntitySystem<ContrabandSystem>();
|
||||
MouseFilter = MouseFilterMode.Stop;
|
||||
}
|
||||
|
||||
@@ -204,6 +210,25 @@ public sealed partial class GuideReagentEmbed : BoxContainer, IDocumentTag, ISea
|
||||
description.PushNewline();
|
||||
description.AddMarkupOrThrow(Loc.GetString("guidebook-reagent-physical-description",
|
||||
("description", reagent.LocalizedPhysicalDescription)));
|
||||
|
||||
if (_config.GetCVar(CCVars.ContrabandExamine))
|
||||
{
|
||||
// Department-restricted text
|
||||
if (reagent.AllowedJobs.Count > 0 || reagent.AllowedDepartments.Count > 0)
|
||||
{
|
||||
description.PushNewline();
|
||||
description.AddMarkupPermissive(
|
||||
_contraband.GenerateDepartmentExamineMessage(reagent.AllowedDepartments, reagent.AllowedJobs, ContrabandItemType.Reagent));
|
||||
}
|
||||
// Other contraband text
|
||||
else if (reagent.ContrabandSeverity != null &&
|
||||
_prototype.Resolve(reagent.ContrabandSeverity.Value, out var severity))
|
||||
{
|
||||
description.PushNewline();
|
||||
description.AddMarkupPermissive(Loc.GetString(severity.ExamineText, ("type", ContrabandItemType.Reagent)));
|
||||
}
|
||||
}
|
||||
|
||||
ReagentDescription.SetMessage(description);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user