| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using Content.Shared.Examine;
- using Content.Shared.Tools;
- using Robust.Shared.Prototypes;
- using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
- namespace Content.Shared.Construction.Steps
- {
- [DataDefinition]
- public sealed partial class ToolConstructionGraphStep : ConstructionGraphStep
- {
- [DataField("tool", required:true, customTypeSerializer:typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
- public string Tool { get; private set; } = string.Empty;
- [DataField("fuel")] public float Fuel { get; private set; } = 10;
- [DataField("examine")] public string ExamineOverride { get; private set; } = string.Empty;
- public override void DoExamine(ExaminedEvent examinedEvent)
- {
- if (!string.IsNullOrEmpty(ExamineOverride))
- {
- examinedEvent.PushMarkup(Loc.GetString(ExamineOverride));
- return;
- }
- if (string.IsNullOrEmpty(Tool) || !IoCManager.Resolve<IPrototypeManager>().TryIndex(Tool, out ToolQualityPrototype? quality))
- return;
- examinedEvent.PushMarkup(Loc.GetString("construction-use-tool-entity", ("toolName", Loc.GetString(quality.ToolName))));
- }
- public override ConstructionGuideEntry GenerateGuideEntry()
- {
- var quality = IoCManager.Resolve<IPrototypeManager>().Index<ToolQualityPrototype>(Tool);
- return new ConstructionGuideEntry()
- {
- Localization = "construction-presenter-tool-step",
- Arguments = new (string, object)[]{("tool", quality.ToolName)},
- Icon = quality.Icon,
- };
- }
- }
- }
|