Files
tbd-station-14/Content.Shared/Preferences/Loadouts/Loadout.cs
metalgearsloth f0fbedd640 Fix RoleLoadout equality (#28737)
* Fix RoleLoadout equality

Knew it was janky but thought SequenceEqual was better than it is so we just do it manually.

* Also implement this
2024-06-15 16:52:49 +10:00

32 lines
833 B
C#

using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
namespace Content.Shared.Preferences.Loadouts;
/// <summary>
/// Specifies the selected prototype and custom data for a loadout.
/// </summary>
[Serializable, NetSerializable, DataDefinition]
public sealed partial class Loadout : IEquatable<Loadout>
{
[DataField]
public ProtoId<LoadoutPrototype> Prototype;
public bool Equals(Loadout? other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return Prototype.Equals(other.Prototype);
}
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is Loadout other && Equals(other);
}
public override int GetHashCode()
{
return Prototype.GetHashCode();
}
}