fix borgs being unable to state laws with an active flashlight (#30183)

fix borg laws
This commit is contained in:
slarticodefast
2024-07-22 05:55:34 +02:00
committed by GitHub
parent 290542534a
commit 4eed2fd973

View 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>