# Conflicts: # Content.Server/Access/Systems/AgentIDCardSystem.cs # Content.Server/GameTicking/Rules/ChangelingRuleSystem.cs # Content.Server/GameTicking/Rules/ThiefRuleSystem.cs # Content.Server/Medical/SuitSensors/SuitSensorSystem.cs # Content.Server/Zombies/ZombieSystem.cs # Content.Shared/Clothing/EntitySystems/SharedChameleonClothingSystem.cs # Content.Shared/Standing/StandingStateComponent.cs # Content.Shared/Standing/StandingStateSystem.cs # Content.Shared/Stunnable/SharedStunSystem.Knockdown.cs # Content.Shared/Stunnable/SharedStunSystem.cs # Resources/Locale/en-US/_strings/game-ticking/game-presets/preset-changeling.ftl # Resources/Locale/en-US/_strings/ghost/observer-role.ftl # Resources/Locale/en-US/_strings/robotics/borg_modules.ftl # Resources/Prototypes/Entities/Clothing/Ears/specific.yml # Resources/Prototypes/Entities/Clothing/Eyes/specific.yml # Resources/Prototypes/Entities/Clothing/Hands/specific.yml # Resources/Prototypes/Entities/Clothing/Head/specific.yml # Resources/Prototypes/Entities/Clothing/Neck/specific.yml # Resources/Prototypes/Entities/Clothing/OuterClothing/specific.yml # Resources/Prototypes/Entities/Clothing/Shoes/specific.yml # Resources/Prototypes/Entities/Clothing/Uniforms/specific.yml # Resources/Prototypes/Entities/Mobs/NPCs/animals.yml # Resources/Prototypes/Entities/Objects/Materials/Sheets/glass.yml # Resources/Prototypes/Entities/Objects/Materials/Sheets/metal.yml # Resources/Prototypes/Entities/Objects/Materials/Sheets/other.yml # Resources/Prototypes/Entities/Objects/Materials/parts.yml # Resources/Prototypes/Entities/Objects/Specific/Robotics/borg_modules.yml
84 lines
2.1 KiB
C#
84 lines
2.1 KiB
C#
using Content.Shared.FixedPoint;
|
|
using Robust.Shared.Serialization;
|
|
|
|
namespace Content.Shared.Chemistry.Reagent;
|
|
|
|
/// <summary>
|
|
/// Simple struct for storing a <see cref="ReagentId"/> & quantity tuple.
|
|
/// </summary>
|
|
[Serializable, NetSerializable]
|
|
[DataDefinition]
|
|
public partial struct ReagentQuantity : IEquatable<ReagentQuantity>
|
|
{
|
|
[DataField("Quantity", required:true)]
|
|
public FixedPoint2 Quantity { get; private set; }
|
|
|
|
[IncludeDataField]
|
|
[ViewVariables]
|
|
public ReagentId Reagent { get; private set; }
|
|
|
|
public ReagentQuantity(string reagentId, FixedPoint2 quantity, List<ReagentData>? data = null)
|
|
: this(new ReagentId(reagentId, data), quantity)
|
|
{
|
|
}
|
|
|
|
public ReagentQuantity(ReagentId reagent, FixedPoint2 quantity)
|
|
{
|
|
Reagent = reagent;
|
|
Quantity = quantity;
|
|
}
|
|
|
|
public ReagentQuantity() : this(default, default)
|
|
{
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return Reagent.ToString(Quantity);
|
|
}
|
|
|
|
public void Deconstruct(out string prototype, out FixedPoint2 quantity, out List<ReagentData>? data)
|
|
{
|
|
prototype = Reagent.Prototype;
|
|
quantity = Quantity;
|
|
data = Reagent.Data;
|
|
}
|
|
|
|
public void Deconstruct(out ReagentId id, out FixedPoint2 quantity)
|
|
{
|
|
id = Reagent;
|
|
quantity = Quantity;
|
|
}
|
|
|
|
//Starlight-start
|
|
public void SetQuantity(FixedPoint2 quantity)
|
|
{
|
|
Quantity = quantity;
|
|
}
|
|
//Starlight-end
|
|
|
|
public bool Equals(ReagentQuantity other)
|
|
{
|
|
return Quantity == other.Quantity && Reagent.Equals(other.Reagent);
|
|
}
|
|
|
|
public override bool Equals(object? obj)
|
|
{
|
|
return obj is ReagentQuantity other && Equals(other);
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return HashCode.Combine(Reagent.GetHashCode(), Quantity);
|
|
}
|
|
|
|
public static bool operator ==(ReagentQuantity left, ReagentQuantity right)
|
|
{
|
|
return left.Equals(right);
|
|
}
|
|
|
|
public static bool operator !=(ReagentQuantity left, ReagentQuantity right)
|
|
{
|
|
return !(left == right);
|
|
}
|
|
}
|