Files
wwdpublic/Content.Server/Shuttles/Systems/RadarConsoleSystem.cs
RedFoxIV af21168537 Fuselage rust (#551)
* the definition of insanity

* the definition of insanity

* the definition of insanity

* we have hullrot at home

* maybe the real hullrot was the friends we made along the way

* john hullrot

* i am going to hullroooooot

* it's hullrotver

* we're so hullback

* we're rotting the hull with this one

* hullmerge

* the hullrot is leaking

* never gonna rot you up

* hullfresh

* john starsector

* god i wish we had grid collision damage
2025-06-11 11:04:48 +03:00

60 lines
2.0 KiB
C#

using System.Numerics;
using Content.Server.UserInterface;
using Content.Shared.Shuttles.BUIStates;
using Content.Shared.Shuttles.Components;
using Content.Shared.Shuttles.Systems;
using Content.Shared.PowerCell;
using Content.Shared.Movement.Components;
using Robust.Server.GameObjects;
using Robust.Shared.Map;
namespace Content.Server.Shuttles.Systems;
public sealed class RadarConsoleSystem : SharedRadarConsoleSystem
{
[Dependency] private readonly ShuttleConsoleSystem _console = default!;
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RadarConsoleComponent, ComponentStartup>(OnRadarStartup);
}
private void OnRadarStartup(EntityUid uid, RadarConsoleComponent component, ComponentStartup args)
{
UpdateState(uid, component);
}
protected override void UpdateState(EntityUid uid, RadarConsoleComponent component)
{
var xform = Transform(uid);
var onGrid = xform.ParentUid == xform.GridUid;
EntityCoordinates? coordinates = onGrid ? xform.Coordinates : null;
Angle? angle = onGrid ? xform.LocalRotation : null;
if (component.FollowEntity)
{
coordinates = new EntityCoordinates(uid, Vector2.Zero);
angle = Math.PI; // WWDP EDIT 0->Pi - Flips handheld mass scanners around so that they're less annoying to use
}
if (_uiSystem.HasUi(uid, RadarConsoleUiKey.Key))
{
NavInterfaceState state;
var docks = _console.GetAllDocks();
if (coordinates != null && angle != null)
{
state = _console.GetNavState(uid, docks, coordinates.Value, angle.Value);
}
else
{
state = _console.GetNavState(uid, docks);
}
_uiSystem.SetUiState(uid, RadarConsoleUiKey.Key, new NavBoundUserInterfaceState(state));
}
}
}