Fix dock radar colours (#38942)

* Fix docking colours

* Add comments and fallback

* Better comments!
This commit is contained in:
UpAndLeaves
2025-08-12 21:09:00 +01:00
committed by GitHub
parent c76d21e973
commit 9b6cb79fa2
4 changed files with 19 additions and 5 deletions

View File

@@ -40,6 +40,8 @@ public sealed partial class ShuttleDockControl : BaseShuttleControl
private readonly HashSet<DockingPortState> _drawnDocks = new(); private readonly HashSet<DockingPortState> _drawnDocks = new();
private readonly Dictionary<DockingPortState, Button> _dockButtons = new(); private readonly Dictionary<DockingPortState, Button> _dockButtons = new();
private readonly Color _fallbackHighlightedColor = Color.Magenta;
/// <summary> /// <summary>
/// Store buttons for every other dock /// Store buttons for every other dock
/// </summary> /// </summary>
@@ -213,11 +215,11 @@ public sealed partial class ShuttleDockControl : BaseShuttleControl
if (HighlightedDock == dock.Entity) if (HighlightedDock == dock.Entity)
{ {
otherDockColor = Color.ToSrgb(Color.Magenta); otherDockColor = Color.ToSrgb(dock.HighlightedColor);
} }
else else
{ {
otherDockColor = Color.ToSrgb(Color.Purple); otherDockColor = Color.ToSrgb(dock.Color);
} }
/* /*
@@ -311,7 +313,7 @@ public sealed partial class ShuttleDockControl : BaseShuttleControl
ScalePosition(Vector2.Transform(new Vector2(-0.5f, 0.5f), rotation)), ScalePosition(Vector2.Transform(new Vector2(-0.5f, 0.5f), rotation)),
ScalePosition(Vector2.Transform(new Vector2(0.5f, -0.5f), rotation))); ScalePosition(Vector2.Transform(new Vector2(0.5f, -0.5f), rotation)));
var dockColor = Color.Magenta; var dockColor = _viewedState?.HighlightedColor ?? _fallbackHighlightedColor;
var connectionColor = Color.Pink; var connectionColor = Color.Pink;
handle.DrawRect(ourDockConnection, connectionColor.WithAlpha(0.2f)); handle.DrawRect(ourDockConnection, connectionColor.WithAlpha(0.2f));

View File

@@ -321,7 +321,7 @@ public sealed partial class ShuttleNavControl : BaseShuttleControl
continue; continue;
} }
var color = Color.ToSrgb(Color.Magenta); var color = Color.ToSrgb(state.HighlightedColor);
var verts = new[] var verts = new[]
{ {

View File

@@ -235,6 +235,8 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem
_xformQuery.TryGetComponent(comp.DockedWith, out var otherDockXform) ? _xformQuery.TryGetComponent(comp.DockedWith, out var otherDockXform) ?
GetNetEntity(otherDockXform.GridUid) : GetNetEntity(otherDockXform.GridUid) :
null, null,
Color = comp.RadarColor,
HighlightedColor = comp.HighlightedRadarColor
}; };
gridDocks.Add(state); gridDocks.Add(state);

View File

@@ -17,4 +17,14 @@ public sealed class DockingPortState
public bool Connected => GridDockedWith != null; public bool Connected => GridDockedWith != null;
public NetEntity? GridDockedWith; public NetEntity? GridDockedWith;
/// <summary>
/// The default colour used to shade a dock on a radar screen
/// </summary>
public Color Color;
/// <summary>
/// The colour used to shade a dock on a radar screen if it is highlighted (hovered over/selected on docking screen/shown in the main ship radar)
/// </summary>
public Color HighlightedColor;
} }