ConstructionGL2 Part 2: Better guided steps and recipes. (#5103)
This commit is contained in:
committed by
GitHub
parent
5be8271907
commit
5a5006e4cf
@@ -1,10 +1,12 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Examine;
|
||||
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;
|
||||
|
||||
@@ -14,8 +16,17 @@ namespace Content.Server.Construction.Conditions
|
||||
[DataDefinition]
|
||||
public class ContainerEmpty : IGraphCondition
|
||||
{
|
||||
[DataField("container")] public string Container { get; private set; } = string.Empty;
|
||||
[DataField("text")] public string Text { get; private set; } = string.Empty;
|
||||
[DataField("container")]
|
||||
public string Container { get; } = string.Empty;
|
||||
|
||||
[DataField("examineText")]
|
||||
public string? ExamineText { get; }
|
||||
|
||||
[DataField("guideStep")]
|
||||
public string? GuideText { get; }
|
||||
|
||||
[DataField("guideIcon")]
|
||||
public SpriteSpecifier? GuideIcon { get; }
|
||||
|
||||
public bool Condition(EntityUid uid, IEntityManager entityManager)
|
||||
{
|
||||
@@ -28,6 +39,9 @@ namespace Content.Server.Construction.Conditions
|
||||
|
||||
public bool DoExamine(ExaminedEvent args)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ExamineText))
|
||||
return false;
|
||||
|
||||
var entity = args.Examined;
|
||||
|
||||
if (!entity.TryGetComponent(out ContainerManagerComponent? containerManager) ||
|
||||
@@ -36,9 +50,19 @@ 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 (string.IsNullOrEmpty(GuideText))
|
||||
yield break;
|
||||
|
||||
yield return new ConstructionGuideEntry()
|
||||
{
|
||||
Localization = GuideText,
|
||||
Icon = GuideIcon,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user