Allow chemical-fueled generators to use multiple reagents (#24258)

multi-reagent generators
This commit is contained in:
Nemanja
2024-01-20 20:25:52 -05:00
committed by GitHub
parent ecc21d8f52
commit 691c3d55b8
3 changed files with 38 additions and 25 deletions

View File

@@ -2,6 +2,7 @@
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Power.Generator;
@@ -13,11 +14,10 @@ namespace Content.Server.Power.Generator;
public sealed partial class ChemicalFuelGeneratorAdapterComponent : Component
{
/// <summary>
/// The reagent to accept as fuel.
/// A dictionary relating a reagent to accept as fuel to a value to multiply reagent amount by to get fuel amount.
/// </summary>
[DataField("reagent", customTypeSerializer: typeof(PrototypeIdSerializer<ReagentPrototype>))]
[ViewVariables(VVAccess.ReadWrite)]
public string Reagent = "WeldingFuel";
[DataField]
public Dictionary<ProtoId<ReagentPrototype>, float> Reagents = new();
/// <summary>
/// The name of <see cref="Solution"/>.
@@ -32,16 +32,10 @@ public sealed partial class ChemicalFuelGeneratorAdapterComponent : Component
[DataField("solutionRef")]
public Entity<SolutionComponent>? Solution = null;
/// <summary>
/// Value to multiply reagent amount by to get fuel amount.
/// </summary>
[DataField("multiplier"), ViewVariables(VVAccess.ReadWrite)]
public float Multiplier = 1f;
/// <summary>
/// How much reagent (can be fractional) is left in the generator.
/// Stored in units of <see cref="FixedPoint2.Epsilon"/>.
/// </summary>
[DataField("fractionalReagent"), ViewVariables(VVAccess.ReadWrite)]
public float FractionalReagent;
[DataField]
public Dictionary<ProtoId<ReagentPrototype>, float> FractionalReagents = new();
}