Files
wwdpublic/Content.Server/Atmos/EntitySystems/FixGridAtmosOnRoundStartSystem.cs
Gersoon 908e0ab9cd MakeRespriteGreatAgainPart1 (#644)
* UltraMegaCommit

* Fix1

* Fix2

* Fix3

* Update monotile_frame.yml

* Fix4

* Fix5
2025-06-28 11:30:19 +03:00

38 lines
1.2 KiB
C#

using Content.Server.GameTicking;
using Content.Server.GameTicking.Events;
using Content.Server.Atmos.Components;
using Robust.Shared.Console;
namespace Content.Server.Atmos.EntitySystems;
/// <summary>
/// Executes the fixgridatmos console command for any entity with
/// <see cref="FixGridAtmosOnRoundStartComponent"/> when a round starts.
/// </summary>
public sealed partial class FixGridAtmosOnRoundStartSystem : EntitySystem
{
[Dependency] private readonly IConsoleHost _consoleHost = default!;
[Dependency] private readonly IEntityManager _entities = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RoundStartedEvent>(OnRoundStarted);
}
private void OnRoundStarted(RoundStartedEvent ev)
{
var query = AllEntityQuery<FixGridAtmosOnRoundStartComponent, TransformComponent>();
while (query.MoveNext(out var uid, out _, out var xform))
{
if (xform.GridUid is not { } grid)
continue;
if (!_entities.TryGetNetEntity(grid, out var netGrid))
continue;
_consoleHost.ExecuteCommand($"fixgridatmos {netGrid.Value.Id}");
}
}
}