mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* 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>
39 lines
1 KiB
C#
39 lines
1 KiB
C#
using Content.Shared.Tiles;
|
|
using Robust.Shared.Map.Components;
|
|
|
|
namespace Content.Server.Tiles;
|
|
|
|
public sealed partial class RequiresTileSystem : EntitySystem
|
|
{
|
|
/*
|
|
* Needs to be on server as client can't predict QueueDel.
|
|
*/
|
|
|
|
[Dependency] private SharedMapSystem _maps = default!;
|
|
[Dependency] private EntityQuery<RequiresTileComponent> _tilesQuery = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<TileChangedEvent>(OnTileChange);
|
|
}
|
|
|
|
private void OnTileChange(ref TileChangedEvent ev)
|
|
{
|
|
if (!TryComp<MapGridComponent>(ev.Entity, out var grid))
|
|
return;
|
|
|
|
foreach (var change in ev.Changes)
|
|
{
|
|
var anchored = _maps.GetAnchoredEntitiesEnumerator(ev.Entity, grid, change.GridIndices);
|
|
|
|
while (anchored.MoveNext(out var ent))
|
|
{
|
|
if (!_tilesQuery.HasComponent(ent.Value))
|
|
continue;
|
|
|
|
QueueDel(ent.Value);
|
|
}
|
|
}
|
|
}
|
|
}
|