Loadout.cs 833 B

12345678910111213141516171819202122232425262728293031
  1. using Robust.Shared.Prototypes;
  2. using Robust.Shared.Serialization;
  3. namespace Content.Shared.Preferences.Loadouts;
  4. /// <summary>
  5. /// Specifies the selected prototype and custom data for a loadout.
  6. /// </summary>
  7. [Serializable, NetSerializable, DataDefinition]
  8. public sealed partial class Loadout : IEquatable<Loadout>
  9. {
  10. [DataField]
  11. public ProtoId<LoadoutPrototype> Prototype;
  12. public bool Equals(Loadout? other)
  13. {
  14. if (ReferenceEquals(null, other)) return false;
  15. if (ReferenceEquals(this, other)) return true;
  16. return Prototype.Equals(other.Prototype);
  17. }
  18. public override bool Equals(object? obj)
  19. {
  20. return ReferenceEquals(this, obj) || obj is Loadout other && Equals(other);
  21. }
  22. public override int GetHashCode()
  23. {
  24. return Prototype.GetHashCode();
  25. }
  26. }