diff --git a/Content.Shared/Silicons/Laws/SiliconLawPrototype.cs b/Content.Shared/Silicons/Laws/SiliconLawPrototype.cs index d10b86c241..5924c95cdc 100644 --- a/Content.Shared/Silicons/Laws/SiliconLawPrototype.cs +++ b/Content.Shared/Silicons/Laws/SiliconLawPrototype.cs @@ -6,7 +6,7 @@ namespace Content.Shared.Silicons.Laws; [Virtual, DataDefinition] [Serializable, NetSerializable] -public partial class SiliconLaw : IComparable +public partial class SiliconLaw : IComparable, IEquatable { /// /// A locale string which is the actual text of the law. @@ -39,13 +39,27 @@ public partial class SiliconLaw : IComparable return Order.CompareTo(other.Order); } - public bool Equals(SiliconLaw other) + public bool Equals(SiliconLaw? other) { + if (other == null) + return false; return LawString == other.LawString && Order == other.Order && LawIdentifierOverride == other.LawIdentifierOverride; } + public override bool Equals(object? obj) + { + if (obj == null) + return false; + return Equals(obj as SiliconLaw); + } + + public override int GetHashCode() + { + return HashCode.Combine(LawString, Order, LawIdentifierOverride); + } + /// /// Return a shallow clone of this law. ///