* Fix RoleLoadout equality Knew it was janky but thought SequenceEqual was better than it is so we just do it manually. * Also implement this
32 lines
833 B
C#
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();
|
|
}
|
|
}
|