ConstructionGL2 Part 2: Better guided steps and recipes. (#5103)
This commit is contained in:
committed by
GitHub
parent
5be8271907
commit
5a5006e4cf
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Examine;
|
||||
@@ -5,6 +6,7 @@ using JetBrains.Annotations;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -15,7 +17,9 @@ namespace Content.Server.Construction.Conditions
|
||||
public class ContainerNotEmpty : IGraphCondition
|
||||
{
|
||||
[DataField("container")] public string Container { get; private set; } = string.Empty;
|
||||
[DataField("text")] public string Text { get; private set; } = string.Empty;
|
||||
[DataField("examineText")] public string? ExamineText { get; }
|
||||
[DataField("guideText")] public string? GuideText { get; }
|
||||
[DataField("guideIcon")] public SpriteSpecifier? GuideIcon { get; }
|
||||
|
||||
public bool Condition(EntityUid uid, IEntityManager entityManager)
|
||||
{
|
||||
@@ -28,6 +32,9 @@ namespace Content.Server.Construction.Conditions
|
||||
|
||||
public bool DoExamine(ExaminedEvent args)
|
||||
{
|
||||
if (ExamineText == null)
|
||||
return false;
|
||||
|
||||
var entity = args.Examined;
|
||||
|
||||
if (!entity.TryGetComponent(out ContainerManagerComponent? containerManager) ||
|
||||
@@ -36,9 +43,20 @@ namespace Content.Server.Construction.Conditions
|
||||
if (container.ContainedEntities.Count != 0)
|
||||
return false;
|
||||
|
||||
args.PushMarkup(Text);
|
||||
args.PushMarkup(Loc.GetString(ExamineText));
|
||||
return true;
|
||||
}
|
||||
|
||||
public IEnumerable<ConstructionGuideEntry> GenerateGuideEntry()
|
||||
{
|
||||
if (GuideText == null)
|
||||
yield break;
|
||||
|
||||
yield return new ConstructionGuideEntry()
|
||||
{
|
||||
Localization = GuideText,
|
||||
Icon = GuideIcon,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user