using Content.Server.Light.Components; using Content.Shared.Light.EntitySystems; using Robust.Shared.Map.Components; namespace Content.Server.Light.EntitySystems; /// public sealed class RoofSystem : SharedRoofSystem { [Dependency] private readonly SharedMapSystem _maps = default!; private EntityQuery _gridQuery; public override void Initialize() { base.Initialize(); _gridQuery = GetEntityQuery(); SubscribeLocalEvent(OnFlagStartup); } private void OnFlagStartup(Entity ent, ref ComponentStartup args) { var xform = Transform(ent.Owner); if (_gridQuery.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); } }