ReagentData.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using Content.Shared.FixedPoint;
  2. using Robust.Shared.Serialization;
  3. namespace Content.Shared.Chemistry.Reagent;
  4. [ImplicitDataDefinitionForInheritors, Serializable, NetSerializable]
  5. public abstract partial class ReagentData : IEquatable<ReagentData>
  6. {
  7. /// <summary>
  8. /// Convert to a string representation. This if for logging & debugging. This is not localized and should not be
  9. /// shown to players.
  10. /// </summary>
  11. public virtual string ToString(string prototype, FixedPoint2 quantity)
  12. {
  13. return $"{prototype}:{GetType().Name}:{quantity}";
  14. }
  15. /// <summary>
  16. /// Convert to a string representation. This if for logging & debugging. This is not localized and should not be
  17. /// shown to players.
  18. /// </summary>
  19. public virtual string ToString(string prototype)
  20. {
  21. return $"{prototype}:{GetType().Name}";
  22. }
  23. public abstract bool Equals(ReagentData? other);
  24. public override bool Equals(object? obj)
  25. {
  26. if (ReferenceEquals(null, obj))
  27. return false;
  28. if (ReferenceEquals(this, obj))
  29. return true;
  30. if (obj.GetType() != GetType())
  31. return false;
  32. return Equals((ReagentData) obj);
  33. }
  34. public abstract override int GetHashCode();
  35. public abstract ReagentData Clone();
  36. }