PowerMonitoringCableNetworksComponent.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using Robust.Shared.GameStates;
  2. using Robust.Shared.Serialization;
  3. namespace Content.Shared.Power;
  4. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
  5. [Access(typeof(SharedPowerMonitoringConsoleSystem))]
  6. public sealed partial class PowerMonitoringCableNetworksComponent : Component
  7. {
  8. /// <summary>
  9. /// A dictionary of the all the nav map chunks that contain anchored power cables
  10. /// </summary>
  11. [ViewVariables, AutoNetworkedField]
  12. public Dictionary<Vector2i, PowerCableChunk> AllChunks = new();
  13. /// <summary>
  14. /// A dictionary of the all the nav map chunks that contain anchored power cables
  15. /// that are directly connected to the console's current focus
  16. /// </summary>
  17. [ViewVariables, AutoNetworkedField]
  18. public Dictionary<Vector2i, PowerCableChunk> FocusChunks = new();
  19. }
  20. [Serializable, NetSerializable]
  21. public struct PowerCableChunk
  22. {
  23. public readonly Vector2i Origin;
  24. /// <summary>
  25. /// Bitmask dictionary for power cables, 1 for occupied and 0 for empty.
  26. /// </summary>
  27. public int[] PowerCableData;
  28. public PowerCableChunk(Vector2i origin)
  29. {
  30. Origin = origin;
  31. PowerCableData = new int[3];
  32. }
  33. }