1
0

AirtightComponent.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using Content.Server.Atmos.EntitySystems;
  2. using Content.Shared.Atmos;
  3. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
  4. namespace Content.Server.Atmos.Components
  5. {
  6. [RegisterComponent, Access(typeof(AirtightSystem))]
  7. public sealed partial class AirtightComponent : Component
  8. {
  9. public (EntityUid Grid, Vector2i Tile) LastPosition { get; set; }
  10. /// <summary>
  11. /// The directions in which this entity should block airflow, relative to its own reference frame.
  12. /// </summary>
  13. [DataField("airBlockedDirection", customTypeSerializer: typeof(FlagSerializer<AtmosDirectionFlags>))]
  14. public int InitialAirBlockedDirection { get; set; } = (int) AtmosDirection.All;
  15. /// <summary>
  16. /// The directions in which the entity is currently blocking airflow, relative to the grid that the entity is on.
  17. /// I.e., this is a variant of <see cref="InitialAirBlockedDirection"/> that takes into account the entity's
  18. /// current rotation.
  19. /// </summary>
  20. [ViewVariables]
  21. public int CurrentAirBlockedDirection;
  22. /// <summary>
  23. /// Whether the airtight entity is currently blocking airflow.
  24. /// </summary>
  25. [DataField]
  26. public bool AirBlocked { get; set; } = true;
  27. /// <summary>
  28. /// If true, entities on this tile will attempt to draw air from surrounding tiles when they become unblocked
  29. /// and currently have no air. This is generally only required when <see cref="NoAirWhenFullyAirBlocked"/> is
  30. /// true, or if the entity is likely to occupy the same tile as another no-air airtight entity.
  31. /// </summary>
  32. [DataField]
  33. public bool FixVacuum { get; set; } = true;
  34. // I think fixvacuum exists to ensure that repeatedly closing/opening air-blocking doors doesn't end up
  35. // depressurizing a room. However it can also effectively be used as a means of generating gasses for free
  36. // TODO ATMOS Mass conservation. Make it actually push/pull air from adjacent tiles instead of destroying & creating,
  37. // TODO ATMOS Do we need these two fields?
  38. [DataField("rotateAirBlocked")]
  39. public bool RotateAirBlocked { get; set; } = true;
  40. // TODO ATMOS remove this? What is this even for??
  41. [DataField("fixAirBlockedDirectionInitialize")]
  42. public bool FixAirBlockedDirectionInitialize { get; set; } = true;
  43. /// <summary>
  44. /// If true, then the tile that this entity is on will have no air at all if all directions are blocked.
  45. /// </summary>
  46. [DataField]
  47. public bool NoAirWhenFullyAirBlocked { get; set; } = true;
  48. /// <inheritdoc cref="CurrentAirBlockedDirection"/>
  49. [Access(Other = AccessPermissions.ReadWriteExecute)]
  50. public AtmosDirection AirBlockedDirection => (AtmosDirection)CurrentAirBlockedDirection;
  51. }
  52. }