machine upgrade guidebook (#13511)

* machine upgrade guidebook

* oops

* guidehelpcomponent

* build, damn you
This commit is contained in:
Nemanja
2023-01-16 11:53:23 -05:00
committed by GitHub
parent 52e50bd34f
commit fd9e1f3738
19 changed files with 113 additions and 10 deletions

View File

@@ -1,4 +1,6 @@
namespace Content.Server.Construction.Components
using Content.Shared.Construction.Components;
namespace Content.Server.Construction.Components
{
[RequiresExplicitImplementation]
public interface IRefreshParts

View File

@@ -1,53 +0,0 @@
using Content.Shared.Construction.Prototypes;
using Content.Shared.Stacks;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
namespace Content.Server.Construction.Components
{
[RegisterComponent]
public sealed class MachineBoardComponent : Component
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[DataField("requirements", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<int, MachinePartPrototype>))]
public readonly Dictionary<string, int> Requirements = new();
[DataField("materialRequirements")]
public readonly Dictionary<string, int> MaterialIdRequirements = new();
[DataField("tagRequirements")]
public readonly Dictionary<string, GenericPartInfo> TagRequirements = new();
[DataField("componentRequirements")]
public readonly Dictionary<string, GenericPartInfo> ComponentRequirements = new();
[ViewVariables(VVAccess.ReadWrite)]
[DataField("prototype")]
public string? Prototype { get; private set; }
public IEnumerable<KeyValuePair<StackPrototype, int>> MaterialRequirements
{
get
{
foreach (var (materialId, amount) in MaterialIdRequirements)
{
var material = _prototypeManager.Index<StackPrototype>(materialId);
yield return new KeyValuePair<StackPrototype, int>(material, amount);
}
}
}
}
[Serializable]
[DataDefinition]
public struct GenericPartInfo
{
[DataField("Amount")]
public int Amount;
[DataField("ExamineName")]
public string ExamineName;
[DataField("DefaultPrototype")]
public string DefaultPrototype;
}
}

View File

@@ -1,4 +1,5 @@
using Content.Shared.Construction.Prototypes;
using Content.Shared.Construction.Components;
using Content.Shared.Construction.Prototypes;
using Robust.Shared.Containers;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;

View File

@@ -1,23 +0,0 @@
using Content.Shared.Construction.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Construction.Components
{
[RegisterComponent]
public sealed class MachinePartComponent : Component
{
[DataField("part", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<MachinePartPrototype>))]
public string PartType { get; private set; } = default!;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("rating")]
public int Rating { get; private set; } = 1;
/// <summary>
/// This number is used in tests to ensure that you can't use high quality machines for arbitrage. In
/// principle there is nothing wrong with using higher quality parts, but you have to be careful to not
/// allow them to be put into a lathe or something like that.
/// </summary>
public const int MaxRating = 4;
}
}