From: slarticodefast <161409025+slarticodefast@users.noreply.github.com> Date: Mon, 22 Jul 2024 03:55:34 +0000 (+0200) Subject: fix borgs being unable to state laws with an active flashlight (#30183) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=4eed2fd97367f82af5bc220b36237837c012c7ae;p=space-station-14.git fix borgs being unable to state laws with an active flashlight (#30183) fix borg laws --- 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. ///