Machine upgrading framework [NO CONTENT YET] (#11528)
* upgrading parts baseline * don't hardcode prototypes * 0xsomethingsomething review i sorry i forgot your name
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
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
|
||||
{
|
||||
@@ -9,8 +11,8 @@ namespace Content.Server.Construction.Components
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("requirements")]
|
||||
public readonly Dictionary<MachinePart, int> Requirements = new();
|
||||
[DataField("requirements", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<int, MachinePartPrototype>))]
|
||||
public readonly Dictionary<string, int> Requirements = new();
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("materialRequirements")]
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.Stack;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Construction.Prototypes;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
|
||||
|
||||
namespace Content.Server.Construction.Components
|
||||
{
|
||||
@@ -16,8 +18,8 @@ namespace Content.Server.Construction.Components
|
||||
[ViewVariables]
|
||||
public bool HasBoard => BoardContainer?.ContainedEntities.Count != 0;
|
||||
|
||||
[ViewVariables]
|
||||
public readonly Dictionary<MachinePart, int> Progress = new();
|
||||
[DataField("progress", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<int, MachinePartPrototype>)), ViewVariables]
|
||||
public readonly Dictionary<string, int> Progress = new();
|
||||
|
||||
[ViewVariables]
|
||||
public readonly Dictionary<string, int> MaterialProgress = new();
|
||||
@@ -28,8 +30,8 @@ namespace Content.Server.Construction.Components
|
||||
[ViewVariables]
|
||||
public readonly Dictionary<string, int> TagProgress = new();
|
||||
|
||||
[ViewVariables]
|
||||
public Dictionary<MachinePart, int> Requirements = new();
|
||||
[DataField("requirements", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<int, MachinePartPrototype>)),ViewVariables]
|
||||
public Dictionary<string, int> Requirements = new();
|
||||
|
||||
[ViewVariables]
|
||||
public Dictionary<string, int> MaterialRequirements = new();
|
||||
|
||||
@@ -1,25 +1,14 @@
|
||||
using Content.Shared.Construction.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Server.Construction.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed class MachinePartComponent : Component
|
||||
{
|
||||
// I'm so sorry for hard-coding this. But trust me, it should make things less painful.
|
||||
public static IReadOnlyDictionary<MachinePart, string> Prototypes { get; } = new Dictionary<MachinePart, string>()
|
||||
{
|
||||
{MachinePart.Capacitor, "CapacitorStockPart"},
|
||||
{MachinePart.ScanningModule, "ScanningModuleStockPart"},
|
||||
{MachinePart.Manipulator, "MicroManipulatorStockPart"},
|
||||
{MachinePart.Laser, "MicroLaserStockPart"},
|
||||
{MachinePart.MatterBin, "MatterBinStockPart"},
|
||||
{MachinePart.Ansible, "AnsibleSubspaceStockPart"},
|
||||
{MachinePart.Filter, "FilterSubspaceStockPart"},
|
||||
{MachinePart.Amplifier, "AmplifierSubspaceStockPart"},
|
||||
{MachinePart.Treatment, "TreatmentSubspaceStockPart"},
|
||||
{MachinePart.Analyzer, "AnalyzerSubspaceStockPart"},
|
||||
{MachinePart.Crystal, "CrystalSubspaceStockPart"},
|
||||
{MachinePart.Transmitter, "TransmitterSubspaceStockPart"}
|
||||
};
|
||||
[ViewVariables] [DataField("part")] public MachinePart PartType { get; private set; } = MachinePart.Capacitor;
|
||||
[ViewVariables]
|
||||
[DataField("part", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<MachinePartPrototype>))]
|
||||
public string PartType { get; private set; } = default!;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("rating")]
|
||||
|
||||
Reference in New Issue
Block a user