From 4eed2fd97367f82af5bc220b36237837c012c7ae Mon Sep 17 00:00:00 2001 From: slarticodefast <161409025+slarticodefast@users.noreply.github.com> Date: Mon, 22 Jul 2024 05:55:34 +0200 Subject: [PATCH] fix borgs being unable to state laws with an active flashlight (#30183) fix borg laws --- .../Silicons/Laws/SiliconLawPrototype.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) 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. /// -- 2.51.2