mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* Hope I'm not forgetting anything... * They call me the sender the way I'm sending it. * remove commented out YAML * last of the slop * fix test fails * first batch of test fails * no more test fails * make cryo pods work again. * Make cryo work better-er * I didn't like that a firesuit helmet was so effective on its own so I decided to be a dick about it. * review.com * oop * actually real quick do this * fix YAML issues * IHeatContainer my beloved <3 * borger * not networked :( * jackets * burgeewqjfrwjkhaskfjfsahjkfsahjkfsahjkfsajhkfsa * utter yaml nonsense * phishing --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
128 lines
4.3 KiB
C#
128 lines
4.3 KiB
C#
using System.Linq;
|
|
using Content.Server.Administration.Logs;
|
|
using Content.Server.Atmos.Components;
|
|
using Content.Server.Atmos.Reactions;
|
|
using Content.Server.Fluids.EntitySystems;
|
|
using Content.Server.NodeContainer.EntitySystems;
|
|
using Content.Shared.Atmos;
|
|
using Content.Shared.Atmos.Components;
|
|
using Content.Shared.Atmos.EntitySystems;
|
|
using Content.Shared.Damage.Systems;
|
|
using Content.Shared.Decals;
|
|
using Content.Shared.Doors.Components;
|
|
using Content.Shared.Maps;
|
|
using JetBrains.Annotations;
|
|
using Robust.Server.GameObjects;
|
|
using Robust.Shared.Audio.Systems;
|
|
using Robust.Shared.Containers;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Physics.Systems;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Threading;
|
|
|
|
namespace Content.Server.Atmos.EntitySystems;
|
|
|
|
/// <summary>
|
|
/// This is our SSAir equivalent, if you need to interact with or query atmos in any way, go through this.
|
|
/// </summary>
|
|
[UsedImplicitly]
|
|
public sealed partial class AtmosphereSystem : SharedAtmosphereSystem
|
|
{
|
|
[Dependency] private ITileDefinitionManager _tileDefinitionManager = default!;
|
|
[Dependency] private IAdminLogManager _adminLog = default!;
|
|
[Dependency] private IParallelManager _parallel = default!;
|
|
[Dependency] private EntityLookupSystem _lookup = default!;
|
|
[Dependency] private SharedContainerSystem _containers = default!;
|
|
[Dependency] private SharedPhysicsSystem _physics = default!;
|
|
[Dependency] private GasTileOverlaySystem _gasTileOverlaySystem = default!;
|
|
[Dependency] private SharedAudioSystem _audio = default!;
|
|
[Dependency] private SharedMapSystem _mapSystem = default!;
|
|
[Dependency] private TileSystem _tile = default!;
|
|
[Dependency] private MapSystem _map = default!;
|
|
[Dependency] public PuddleSystem Puddle = default!;
|
|
[Dependency] private DamageableSystem _damage = default!;
|
|
|
|
[Dependency] private EntityQuery<GridAtmosphereComponent> _gridAtmosQuery = default!;
|
|
[Dependency] private EntityQuery<MapAtmosphereComponent> _mapAtmosQuery = default!;
|
|
[Dependency] private EntityQuery<AirtightComponent> _airtightQuery = default!;
|
|
[Dependency] private EntityQuery<FirelockComponent> _firelockQuery = default!;
|
|
|
|
private const float ExposedUpdateDelay = 1f;
|
|
|
|
private HashSet<EntityUid> _entSet = new();
|
|
|
|
private string[] _burntDecals = [];
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
UpdatesAfter.Add(typeof(NodeGroupSystem));
|
|
|
|
InitializeGases();
|
|
InitializeCommands();
|
|
InitializeCVars();
|
|
InitializeGridAtmosphere();
|
|
InitializeMap();
|
|
|
|
SubscribeLocalEvent<TileChangedEvent>(OnTileChanged);
|
|
SubscribeLocalEvent<PrototypesReloadedEventArgs>(OnPrototypesReloaded);
|
|
|
|
CacheDecals();
|
|
CacheGases();
|
|
}
|
|
|
|
public override void Shutdown()
|
|
{
|
|
base.Shutdown();
|
|
|
|
ShutdownCommands();
|
|
}
|
|
|
|
private void OnTileChanged(ref TileChangedEvent ev)
|
|
{
|
|
foreach (var change in ev.Changes)
|
|
{
|
|
InvalidateTile(ev.Entity.Owner, change.GridIndices);
|
|
}
|
|
}
|
|
|
|
private void OnPrototypesReloaded(PrototypesReloadedEventArgs ev)
|
|
{
|
|
if (ev.WasModified<DecalPrototype>())
|
|
CacheDecals();
|
|
if (ev.WasModified<GasReactionPrototype>())
|
|
CacheGases();
|
|
}
|
|
|
|
public override void Update(float frameTime)
|
|
{
|
|
base.Update(frameTime);
|
|
|
|
UpdateProcessing(frameTime);
|
|
UpdateHighPressure(frameTime);
|
|
|
|
var delay = TimeSpan.FromSeconds(ExposedUpdateDelay);
|
|
|
|
var query = EntityQueryEnumerator<AtmosExposedComponent, TransformComponent>();
|
|
while (query.MoveNext(out var uid, out var exposed, out var transform))
|
|
{
|
|
if (exposed.LastExposure + delay > _gameTiming.CurTime)
|
|
continue;
|
|
|
|
var air = GetContainingMixture((uid, transform));
|
|
|
|
if (air == null)
|
|
continue;
|
|
|
|
var updateEvent = new AtmosExposedUpdateEvent(transform.Coordinates, air, transform, ExposedUpdateDelay, exposed.ExposedArea);
|
|
RaiseLocalEvent(uid, ref updateEvent);
|
|
exposed.LastExposure = _gameTiming.CurTime;
|
|
}
|
|
}
|
|
|
|
private void CacheDecals()
|
|
{
|
|
_burntDecals = ProtoMan.EnumeratePrototypes<DecalPrototype>().Where(x => x.Tags.Contains("burnt")).Select(x => x.ID).ToArray();
|
|
}
|
|
}
|