2021-09-15 16:36:43 +02:00
|
|
|
using Content.Shared.Examine;
|
2021-10-07 13:01:27 +02:00
|
|
|
using Content.Shared.Tools;
|
|
|
|
|
using Robust.Shared.Prototypes;
|
|
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
2020-10-08 17:41:23 +02:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Shared.Construction.Steps
|
2020-10-08 17:41:23 +02:00
|
|
|
{
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataDefinition]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class ToolConstructionGraphStep : ConstructionGraphStep
|
2020-10-08 17:41:23 +02:00
|
|
|
{
|
2021-10-07 13:01:27 +02:00
|
|
|
[DataField("tool", required:true, customTypeSerializer:typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
|
2023-08-22 18:14:33 -07:00
|
|
|
public string Tool { get; private set; } = string.Empty;
|
2020-10-08 17:41:23 +02:00
|
|
|
|
2023-08-22 18:14:33 -07:00
|
|
|
[DataField("fuel")] public float Fuel { get; private set; } = 10;
|
2020-10-08 17:41:23 +02:00
|
|
|
|
2023-08-22 18:14:33 -07:00
|
|
|
[DataField("examine")] public string ExamineOverride { get; private set; } = string.Empty;
|
2020-10-08 17:41:23 +02:00
|
|
|
|
2021-09-15 16:36:43 +02:00
|
|
|
public override void DoExamine(ExaminedEvent examinedEvent)
|
2020-10-08 17:41:23 +02:00
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(ExamineOverride))
|
|
|
|
|
{
|
2021-10-07 13:01:27 +02:00
|
|
|
examinedEvent.PushMarkup(Loc.GetString(ExamineOverride));
|
2020-10-08 17:41:23 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-07 13:01:27 +02:00
|
|
|
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))));
|
|
|
|
|
|
2020-10-08 17:41:23 +02:00
|
|
|
}
|
2021-11-02 11:24:32 +01:00
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
};
|
|
|
|
|
}
|
2020-10-08 17:41:23 +02:00
|
|
|
}
|
|
|
|
|
}
|