mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-06-09 13:26:34 +02:00
22a547c7c8
* 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>
32 lines
969 B
C#
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);
|
|
}
|
|
}
|