mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 05:27:38 +03:00
will do map refactor tomorrow, for now, planet lighting 🆑 * add: Ported planet lighting for indoor / outdoor areas. * add: Ported day-night cycle functionality. * add: Ported some Storage UI v2 fixes. --------- Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: DoutorWhite <thedoctorwhite@gmail.com> Co-authored-by: Janet Blackquill <uhhadd@gmail.com> (cherry picked from commit 4efb0b3b328dd4eba3095cc3f0a95fad88b49661)
34 lines
998 B
C#
34 lines
998 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 class RoofSystem : SharedRoofSystem
|
|
{
|
|
[Dependency] private readonly SharedMapSystem _maps = default!;
|
|
|
|
private EntityQuery<MapGridComponent> _gridQuery;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
_gridQuery = GetEntityQuery<MapGridComponent>();
|
|
SubscribeLocalEvent<SetRoofComponent, ComponentStartup>(OnFlagStartup);
|
|
}
|
|
|
|
private void OnFlagStartup(Entity<SetRoofComponent> 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);
|
|
}
|
|
}
|