Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crew monitor general tweaks and QoL changes #1053

Merged
merged 8 commits into from
Mar 11, 2024
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Client.Pinpointer.UI;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.GameObjects; // Frontier modification

namespace Content.Client.Medical.CrewMonitoring;

Expand Down Expand Up @@ -63,7 +64,9 @@ protected override void Draw(DrawingHandleScreen handle)
if (!LocalizedNames.TryGetValue(netEntity, out var name))
name = "Unknown";

var message = name + "\nLocation: [x = " + MathF.Round(blip.Coordinates.X) + ", y = " + MathF.Round(blip.Coordinates.Y) + "]";
// Text location of the blip will display GPS coordinates for the purpose of being able to find a person via GPS
// Previously it displayed coordinates relative to the center of the station, which had no use.
var message = name + "\nLocation: [x = " + MathF.Round(blip.MapCoordinates.X) + ", y = " + MathF.Round(blip.MapCoordinates.Y) + "]"; // Frontier modification

_trackedEntityLabel.Text = message;
_trackedEntityPanel.Visible = true;
Expand Down
13 changes: 10 additions & 3 deletions Content.Client/Medical/CrewMonitoring/CrewMonitoringWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public sealed partial class CrewMonitoringWindow : FancyWindow
private readonly IEntityManager _entManager;
private readonly IPrototypeManager _prototypeManager;
private readonly SpriteSystem _spriteSystem;
private readonly SharedTransformSystem _transformSystem; // Frontier modification

private NetEntity? _trackedEntity;
private bool _tryToScrollToListFocus;
Expand All @@ -39,6 +40,7 @@ public CrewMonitoringWindow(string stationName, EntityUid? mapUid)
_entManager = IoCManager.Resolve<IEntityManager>();
_prototypeManager = IoCManager.Resolve<IPrototypeManager>();
_spriteSystem = _entManager.System<SpriteSystem>();
_transformSystem = _entManager.System<SharedTransformSystem>(); // Frontier modification

_blipTexture = _spriteSystem.Frame0(new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/NavMap/beveled_circle.png")));

Expand Down Expand Up @@ -149,7 +151,7 @@ public void ShowSensors(List<SuitSensorStatus> sensors, EntityUid monitor, Entit
// Show monitor on nav map
if (monitorCoords != null && _blipTexture != null)
{
NavMap.TrackedEntities[_entManager.GetNetEntity(monitor)] = new NavMapBlip(monitorCoords.Value, _blipTexture, Color.Cyan, true, false);
NavMap.TrackedEntities[_entManager.GetNetEntity(monitor)] = new NavMapBlip(monitorCoords.Value, monitorCoords.Value.ToMap(_entManager, _transformSystem), _blipTexture, Color.Cyan, true, false); // Frontier modification
}
}

Expand Down Expand Up @@ -273,10 +275,13 @@ private void PopulateDepartmentList(IEnumerable<SuitSensorStatus> departmentSens
jobContainer.AddChild(jobIcon);
}

// Job name
// Job name area
// Frontier modification
// Made in its name appear location name as its much more convenient
// While job icons should do good enough job of conveying job
var jobLabel = new Label()
{
Text = sensor.Job,
Text = sensor.LocationName,
HorizontalExpand = true,
ClipText = true,
};
Expand All @@ -289,6 +294,7 @@ private void PopulateDepartmentList(IEnumerable<SuitSensorStatus> departmentSens
NavMap.TrackedEntities.TryAdd(sensor.SuitSensorUid,
new NavMapBlip
(coordinates.Value,
coordinates.Value.ToMap(_entManager, _transformSystem), // Frontier modification
_blipTexture,
(_trackedEntity == null || sensor.SuitSensorUid == _trackedEntity) ? Color.LimeGreen : Color.LimeGreen * Color.DimGray,
sensor.SuitSensorUid == _trackedEntity));
Expand Down Expand Up @@ -355,6 +361,7 @@ private void UpdateSensorsTable(NetEntity? currTrackedEntity, NetEntity? prevTra
{
data = new NavMapBlip
(data.Coordinates,
data.Coordinates.ToMap(_entManager, _transformSystem), // Frontier modification
data.Texture,
(currTrackedEntity == null || castSensor.SuitSensorUid == currTrackedEntity) ? Color.LimeGreen : Color.LimeGreen * Color.DimGray,
castSensor.SuitSensorUid == currTrackedEntity);
Expand Down
4 changes: 3 additions & 1 deletion Content.Client/Pinpointer/UI/NavMapControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -642,14 +642,16 @@ protected Vector2 GetOffset()
public struct NavMapBlip
{
public EntityCoordinates Coordinates;
public MapCoordinates MapCoordinates; //Frontier modification
public Texture Texture;
public Color Color;
public bool Blinks;
public bool Selectable;

public NavMapBlip(EntityCoordinates coordinates, Texture texture, Color color, bool blinks, bool selectable = true)
public NavMapBlip(EntityCoordinates coordinates, MapCoordinates mapCoordinates, Texture texture, Color color, bool blinks, bool selectable = true) //Frontier modification
{
Coordinates = coordinates;
MapCoordinates = mapCoordinates; // Frontier modification
Texture = texture;
Color = color;
Blinks = blinks;
Expand Down
6 changes: 4 additions & 2 deletions Content.Client/Power/PowerMonitoringWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public sealed partial class PowerMonitoringWindow : FancyWindow
private readonly IEntityManager _entManager;
private readonly SpriteSystem _spriteSystem;
private readonly IGameTiming _gameTiming;
private readonly SharedTransformSystem _transformSystem; // Frontier modification

private const float BlinkFrequency = 1f;

Expand All @@ -39,6 +40,7 @@ public PowerMonitoringWindow(PowerMonitoringConsoleBoundUserInterface userInterf
RobustXamlLoader.Load(this);
_entManager = IoCManager.Resolve<IEntityManager>();
_gameTiming = IoCManager.Resolve<IGameTiming>();
_transformSystem = _entManager.System<SharedTransformSystem>(); // Frontier modification

_spriteSystem = _entManager.System<SpriteSystem>();
_owner = owner;
Expand Down Expand Up @@ -166,7 +168,7 @@ public void ShowEntites
if (monitorCoords != null && mon != null)
{
var texture = _spriteSystem.Frame0(new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/NavMap/beveled_circle.png")));
var blip = new NavMapBlip(monitorCoords.Value, texture, Color.Cyan, true, false);
var blip = new NavMapBlip(monitorCoords.Value, monitorCoords.Value.ToMap(_entManager, _transformSystem), texture, Color.Cyan, true, false); // Frontier modification
NavMap.TrackedEntities[mon.Value] = blip;
}

Expand Down Expand Up @@ -233,7 +235,7 @@ private void AddTrackedEntityToNavMap(NetEntity netEntity, PowerMonitoringDevice
if (_focusEntity != null && usedEntity != _focusEntity && !entitiesOfInterest.Contains(usedEntity.Value))
modulator = Color.DimGray;

var blip = new NavMapBlip(coords, _spriteSystem.Frame0(texture), color * modulator, blink);
var blip = new NavMapBlip(coords, coords.ToMap(_entManager, _transformSystem), _spriteSystem.Frame0(texture), color * modulator, blink); //Frontier modification
NavMap.TrackedEntities[netEntity] = blip;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
using Content.Server.DeviceNetwork.Systems;
using Content.Server.Medical.SuitSensors;
using Content.Server.Power.Components;
using Content.Server.Station.Systems;
//using Content.Server.Station.Systems;
using Robust.Shared.Map; // Frontier modification
using Content.Shared.DeviceNetwork;
using Content.Shared.Medical.SuitSensor;
using Robust.Shared.Timing;
Expand All @@ -15,7 +16,7 @@ public sealed class CrewMonitoringServerSystem : EntitySystem
[Dependency] private readonly SuitSensorSystem _sensors = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly DeviceNetworkSystem _deviceNetworkSystem = default!;
[Dependency] private readonly StationSystem _stationSystem = default!;
//[Dependency] private readonly StationSystem _stationSystem = default!; // Frontier modification

private const float UpdateRate = 3f;
private float _updateDiff;
Expand Down Expand Up @@ -66,16 +67,18 @@ public override void Update(float frameTime)
}

/// <summary>
/// Returns the address of the currently active server for the given station id if there is one
/// Returns the address of the currently active server for the given map (instead of station id) if there is one
/// </summary>
public bool TryGetActiveServerAddress(EntityUid stationId, out string? address)
//public bool TryGetActiveServerAddress(EntityUid stationId, out string? address) // Frontier modification
public bool TryGetActiveServerAddress(MapId map, out string? address) // Frontier modification
{
var servers = EntityQueryEnumerator<CrewMonitoringServerComponent, DeviceNetworkComponent>();
var servers = EntityQueryEnumerator<CrewMonitoringServerComponent, DeviceNetworkComponent, TransformComponent>(); // Frontier modification
(EntityUid id, CrewMonitoringServerComponent server, DeviceNetworkComponent device)? last = default;

while (servers.MoveNext(out var uid, out var server, out var device))
while (servers.MoveNext(out var uid, out var server, out var device, out var xform)) // Frontier modification
{
if (!_stationSystem.GetOwningStation(uid)?.Equals(stationId) ?? true)
//if (!_stationSystem.GetOwningStation(uid)?.Equals(stationId) ?? true)
if (xform.MapID != map) //Frontier modification
continue;

if (!server.Available)
Expand Down
6 changes: 4 additions & 2 deletions Content.Server/Medical/SuitSensors/SuitSensorComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ public sealed partial class SuitSensorComponent : Component
[DataField("nextUpdate", customTypeSerializer:typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan NextUpdate = TimeSpan.Zero;


/* -- Frontier modification
/// <summary>
/// The station this suit sensor belongs to. If it's null the suit didn't spawn on a station and the sensor doesn't work.
/// </summary>
[DataField("station")]
public EntityUid? StationId = null;

*/

/// <summary>
/// The server the suit sensor sends it state to.
/// The suit sensor will try connecting to a new server when no server is connected.
Expand Down
Loading
Loading