Files
space-station-14/Content.Server/Light/EntitySystems/RoofSystem.cs
T
Eveloop 22a547c7c8 Use dependency injection for EntityQuery<T>s in Content.Server (#43566)
* Replace usages of EntityQuery with dependency injected ones in Content.Server

* Remove unused EntityQuery dependencies

* Restore CheckPressureAndFire override method

* Revert EntityQuery refactor changes to DisposalTubeSystem.cs & DisposableSystem.cs

* Infer Transform/Metadata directly instead of passing (#43479)

* Resolve RA0049, RA0051 errors (#43479)

* Resolve RA0049, RA0051 errors (#43479)

* Apply suggestions from code review

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2026-05-17 15:59:37 +00:00

32 lines
969 B
C#

using Content.Server.Light.Components;
using Content.Shared.Light.EntitySystems;
using Robust.Shared.Map.Components;
namespace Content.Server.Light.EntitySystems;
/// <inheritdoc/>
public sealed partial class RoofSystem : SharedRoofSystem
{
[Dependency] private SharedMapSystem _maps = default!;
[Dependency] private EntityQuery<MapGridComponent> _mapGridQuery = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SetRoofComponent, ComponentStartup>(OnFlagStartup);
}
private void OnFlagStartup(Entity<SetRoofComponent> ent, ref ComponentStartup args)
{
var xform = Transform(ent.Owner);
if (_mapGridQuery.TryComp(xform.GridUid, out var grid))
{
var index = _maps.LocalToTile(xform.GridUid.Value, grid, xform.Coordinates);
SetRoof((xform.GridUid.Value, grid, null), index, ent.Comp.Value);
}
QueueDel(ent.Owner);
}
}