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 Content.Shared.Construction;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -34,13 +35,21 @@ namespace Content.Server.Construction.Conditions
|
||||
if (airlock.BoltsDown != Value)
|
||||
{
|
||||
if (Value == true)
|
||||
args.PushMarkup(Loc.GetString("construction-condition-airlock-bolt", ("entityName", entity.Name)) + "\n");
|
||||
args.PushMarkup(Loc.GetString("construction-examine-condition-airlock-bolt", ("entityName", entity.Name)) + "\n");
|
||||
else
|
||||
args.PushMarkup(Loc.GetString("construction-condition-airlock-unbolt", ("entityName", entity.Name)) + "\n");
|
||||
args.PushMarkup(Loc.GetString("construction-examine-condition-airlock-unbolt", ("entityName", entity.Name)) + "\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public IEnumerable<ConstructionGuideEntry> GenerateGuideEntry()
|
||||
{
|
||||
yield return new ConstructionGuideEntry()
|
||||
{
|
||||
Localization = Value ? "construction-step-condition-airlock-bolt" : "construction-step-condition-airlock-unbolt"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Examine;
|
||||
@@ -37,5 +38,16 @@ namespace Content.Server.Construction.Conditions
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public IEnumerable<ConstructionGuideEntry> GenerateGuideEntry()
|
||||
{
|
||||
foreach (var condition in Conditions)
|
||||
{
|
||||
foreach (var entry in condition.GenerateGuideEntry())
|
||||
{
|
||||
yield return entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.Components;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.WireHacking;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Examine;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.Construction.Conditions
|
||||
@@ -37,6 +37,21 @@ namespace Content.Server.Construction.Conditions
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO CONSTRUCTION: Examine for this condition.
|
||||
public bool DoExamine(ExaminedEvent args)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString(Value
|
||||
? "construction-examine-condition-all-wires-cut"
|
||||
: "construction-examine-condition-all-wires-intact"));
|
||||
return true;
|
||||
}
|
||||
|
||||
public IEnumerable<ConstructionGuideEntry> GenerateGuideEntry()
|
||||
{
|
||||
yield return new ConstructionGuideEntry()
|
||||
{
|
||||
Localization = Value ? "construction-guide-condition-all-wires-cut"
|
||||
: "construction-guide-condition-all-wires-intact"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Examine;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.Construction.Conditions
|
||||
@@ -24,6 +27,33 @@ namespace Content.Server.Construction.Conditions
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO CONSTRUCTION: Examine for this condition.
|
||||
public bool DoExamine(ExaminedEvent args)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("construction-examine-condition-any-conditions"));
|
||||
|
||||
foreach (var condition in Conditions)
|
||||
{
|
||||
condition.DoExamine(args);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public IEnumerable<ConstructionGuideEntry> GenerateGuideEntry()
|
||||
{
|
||||
yield return new ConstructionGuideEntry()
|
||||
{
|
||||
Localization = "construction-guide-condition-any-conditions",
|
||||
};
|
||||
|
||||
foreach (var condition in Conditions)
|
||||
{
|
||||
foreach (var entry in condition.GenerateGuideEntry())
|
||||
{
|
||||
entry.Padding += 4;
|
||||
yield return entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Maps;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Construction.Conditions
|
||||
{
|
||||
@@ -24,6 +29,15 @@ namespace Content.Server.Construction.Conditions
|
||||
[DataField("hasEntity")]
|
||||
public bool HasEntity { get; private set; }
|
||||
|
||||
[DataField("examineText")]
|
||||
public string? ExamineText { get; }
|
||||
|
||||
[DataField("guideText")]
|
||||
public string? GuideText { get; }
|
||||
|
||||
[DataField("guideIcon")]
|
||||
public SpriteSpecifier? GuideIcon { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The component name in question.
|
||||
/// </summary>
|
||||
@@ -49,6 +63,25 @@ namespace Content.Server.Construction.Conditions
|
||||
return !HasEntity;
|
||||
}
|
||||
|
||||
// TODO CONSTRUCTION: Custom examine for this condition.
|
||||
public bool DoExamine(ExaminedEvent args)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ExamineText))
|
||||
return false;
|
||||
|
||||
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,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Doors.Components;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Examine;
|
||||
@@ -32,13 +33,23 @@ namespace Content.Server.Construction.Conditions
|
||||
if (door.IsWeldedShut != Welded)
|
||||
{
|
||||
if (Welded == true)
|
||||
args.PushMarkup(Loc.GetString("construction-condition-door-weld", ("entityName", entity.Name)) + "\n");
|
||||
args.PushMarkup(Loc.GetString("construction-examine-condition-door-weld", ("entityName", entity.Name)) + "\n");
|
||||
else
|
||||
args.PushMarkup(Loc.GetString("construction-condition-door-unweld", ("entityName", entity.Name)) + "\n");
|
||||
args.PushMarkup(Loc.GetString("construction-examine-condition-door-unweld", ("entityName", entity.Name)) + "\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public IEnumerable<ConstructionGuideEntry> GenerateGuideEntry()
|
||||
{
|
||||
yield return new ConstructionGuideEntry()
|
||||
{
|
||||
Localization = Welded
|
||||
? "construction-guide-condition-door-weld"
|
||||
: "construction-guide-condition-door-unweld",
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
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.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Construction.Conditions
|
||||
{
|
||||
@@ -27,14 +30,25 @@ namespace Content.Server.Construction.Conditions
|
||||
switch (Anchored)
|
||||
{
|
||||
case true when !entity.Transform.Anchored:
|
||||
args.PushMarkup("First, anchor it.");
|
||||
args.PushMarkup(Loc.GetString("construction-examine-condition-entity-anchored"));
|
||||
return true;
|
||||
case false when entity.Transform.Anchored:
|
||||
args.PushMarkup("First, unanchor it.");
|
||||
args.PushMarkup(Loc.GetString("construction-examine-condition-entity-unanchored"));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public IEnumerable<ConstructionGuideEntry> GenerateGuideEntry()
|
||||
{
|
||||
yield return new ConstructionGuideEntry()
|
||||
{
|
||||
Localization = Anchored
|
||||
? "construction-step-condition-entity-anchored"
|
||||
: "construction-step-condition-entity-unanchored",
|
||||
Icon = new SpriteSpecifier.Rsi(new ResourcePath("Objects/Tools/wrench.rsi"), "icon"),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.Construction.Components;
|
||||
using Content.Shared.Construction;
|
||||
@@ -17,6 +18,13 @@ namespace Content.Server.Construction.Conditions
|
||||
[DataDefinition]
|
||||
public class MachineFrameComplete : IGraphCondition
|
||||
{
|
||||
[DataField("guideIconBoard")]
|
||||
public SpriteSpecifier? GuideIconBoard { get; }
|
||||
|
||||
[DataField("guideIconParts")]
|
||||
public SpriteSpecifier? GuideIconPart { get; }
|
||||
|
||||
|
||||
public bool Condition(EntityUid uid, IEntityManager entityManager)
|
||||
{
|
||||
if (!entityManager.TryGetComponent(uid, out MachineFrameComponent? machineFrame))
|
||||
@@ -91,5 +99,22 @@ namespace Content.Server.Construction.Conditions
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public IEnumerable<ConstructionGuideEntry> GenerateGuideEntry()
|
||||
{
|
||||
yield return new ConstructionGuideEntry()
|
||||
{
|
||||
Localization = "construction-step-condition-machine-frame-board",
|
||||
Icon = GuideIconBoard,
|
||||
EntryNumber = 0, // Set this to anything so the guide generation takes this as a numbered step.
|
||||
};
|
||||
|
||||
yield return new ConstructionGuideEntry()
|
||||
{
|
||||
Localization = "construction-step-condition-machine-frame-parts",
|
||||
Icon = GuideIconPart,
|
||||
EntryNumber = 0, // Set this to anything so the guide generation takes this as a numbered step.
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Toilet;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Examine;
|
||||
@@ -27,8 +28,16 @@ namespace Content.Server.Construction.Conditions
|
||||
if (!entity.TryGetComponent(out ToiletComponent? toilet)) return false;
|
||||
if (!toilet.LidOpen) return false;
|
||||
|
||||
args.PushMarkup(Loc.GetString("construction-condition-toilet-lid-closed") + "\n");
|
||||
args.PushMarkup(Loc.GetString("construction-examine-condition-toilet-lid-closed") + "\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
public IEnumerable<ConstructionGuideEntry> GenerateGuideEntry()
|
||||
{
|
||||
yield return new ConstructionGuideEntry()
|
||||
{
|
||||
Localization = "construction-step-condition-toilet-lid-closed"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.Components;
|
||||
using Content.Server.WireHacking;
|
||||
@@ -34,14 +35,24 @@ namespace Content.Server.Construction.Conditions
|
||||
switch (Open)
|
||||
{
|
||||
case true when !wires.IsPanelOpen:
|
||||
args.PushMarkup(Loc.GetString("construction-condition-wire-panel-open"));
|
||||
args.PushMarkup(Loc.GetString("construction-examine-condition-wire-panel-open"));
|
||||
return true;
|
||||
case false when wires.IsPanelOpen:
|
||||
args.PushMarkup(Loc.GetString("construction-condition-wire-panel-close"));
|
||||
args.PushMarkup(Loc.GetString("construction-examine-condition-wire-panel-close"));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public IEnumerable<ConstructionGuideEntry> GenerateGuideEntry()
|
||||
{
|
||||
yield return new ConstructionGuideEntry()
|
||||
{
|
||||
Localization = Open
|
||||
? "construction-step-condition-wire-panel-open"
|
||||
: "construction-step-condition-wire-panel-close"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user