]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
fix borgs being unable to state laws with an active flashlight (#30183)
authorslarticodefast <161409025+slarticodefast@users.noreply.github.com>
Mon, 22 Jul 2024 03:55:34 +0000 (05:55 +0200)
committerGitHub <noreply@github.com>
Mon, 22 Jul 2024 03:55:34 +0000 (13:55 +1000)
fix borg laws

Content.Shared/Silicons/Laws/SiliconLawPrototype.cs

index d10b86c2417d997231751ccfc06c0ff1c0bd502b..5924c95cdc1c09c9dc79343263bb265e368187f5 100644 (file)
@@ -6,7 +6,7 @@ namespace Content.Shared.Silicons.Laws;
 
 [Virtual, DataDefinition]
 [Serializable, NetSerializable]
-public partial class SiliconLaw : IComparable<SiliconLaw>
+public partial class SiliconLaw : IComparable<SiliconLaw>, IEquatable<SiliconLaw>
 {
     /// <summary>
     /// A locale string which is the actual text of the law.
@@ -39,13 +39,27 @@ public partial class SiliconLaw : IComparable<SiliconLaw>
         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);
+    }
+
     /// <summary>
     /// Return a shallow clone of this law.
     /// </summary>