1
0

SharedSuitSensor.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using Content.Shared.DoAfter;
  2. using Robust.Shared.Map;
  3. using Robust.Shared.Serialization;
  4. namespace Content.Shared.Medical.SuitSensor;
  5. [Serializable, NetSerializable]
  6. public sealed class SuitSensorStatus
  7. {
  8. public SuitSensorStatus(NetEntity suitSensorUid, string name, string job, string jobIcon, List<string> jobDepartments)
  9. {
  10. SuitSensorUid = suitSensorUid;
  11. Name = name;
  12. Job = job;
  13. JobIcon = jobIcon;
  14. JobDepartments = jobDepartments;
  15. }
  16. public TimeSpan Timestamp;
  17. public NetEntity SuitSensorUid;
  18. public string Name;
  19. public string Job;
  20. public string JobIcon;
  21. public List<string> JobDepartments;
  22. public bool IsAlive;
  23. public int? TotalDamage;
  24. public int? TotalDamageThreshold;
  25. public float? DamagePercentage => TotalDamageThreshold == null || TotalDamage == null ? null : TotalDamage / (float) TotalDamageThreshold;
  26. public NetCoordinates? Coordinates;
  27. }
  28. [Serializable, NetSerializable]
  29. public enum SuitSensorMode : byte
  30. {
  31. /// <summary>
  32. /// Sensor doesn't send any information about owner
  33. /// </summary>
  34. SensorOff = 0,
  35. /// <summary>
  36. /// Sensor sends only binary status (alive/dead)
  37. /// </summary>
  38. SensorBinary = 1,
  39. /// <summary>
  40. /// Sensor sends health vitals status
  41. /// </summary>
  42. SensorVitals = 2,
  43. /// <summary>
  44. /// Sensor sends vitals status and GPS position
  45. /// </summary>
  46. SensorCords = 3
  47. }
  48. public static class SuitSensorConstants
  49. {
  50. public const string NET_NAME = "name";
  51. public const string NET_JOB = "job";
  52. public const string NET_JOB_ICON = "jobIcon";
  53. public const string NET_JOB_DEPARTMENTS = "jobDepartments";
  54. public const string NET_IS_ALIVE = "alive";
  55. public const string NET_TOTAL_DAMAGE = "vitals";
  56. public const string NET_TOTAL_DAMAGE_THRESHOLD = "vitalsThreshold";
  57. public const string NET_COORDINATES = "coords";
  58. public const string NET_SUIT_SENSOR_UID = "uid";
  59. ///Used by the CrewMonitoringServerSystem to send the status of all connected suit sensors to each crew monitor
  60. public const string NET_STATUS_COLLECTION = "suit-status-collection";
  61. }
  62. [Serializable, NetSerializable]
  63. public sealed partial class SuitSensorChangeDoAfterEvent : DoAfterEvent
  64. {
  65. public SuitSensorMode Mode { get; private set; } = SuitSensorMode.SensorOff;
  66. public SuitSensorChangeDoAfterEvent(SuitSensorMode mode)
  67. {
  68. Mode = mode;
  69. }
  70. public override DoAfterEvent Clone() => this;
  71. }