diff --git a/Content.Client/Shuttles/UI/RadarControl.cs b/Content.Client/Shuttles/UI/RadarControl.cs index 19cdd7d9b91..5fb3197f48b 100644 --- a/Content.Client/Shuttles/UI/RadarControl.cs +++ b/Content.Client/Shuttles/UI/RadarControl.cs @@ -178,6 +178,8 @@ protected override void Draw(DrawingHandleScreen handle) mapPosition.Position, xform.WorldRotation + _rotation.Value); + var shown = new HashSet(); + // Draw our grid in detail var ourGridId = _coordinates.Value.GetGridUid(_entManager); if (_entManager.TryGetComponent(ourGridId, out var ourGrid) && @@ -188,7 +190,7 @@ protected override void Draw(DrawingHandleScreen handle) Matrix3.Multiply(in ourGridMatrix, in offsetMatrix, out var matrix); DrawGrid(handle, matrix, ourGrid, Color.MediumSpringGreen, true); - DrawDocks(handle, ourGridId.Value, matrix); + DrawDocks(handle, ourGridId.Value, matrix, shown); } var invertedPosition = _coordinates.Value.Position - offset; @@ -198,8 +200,6 @@ protected override void Draw(DrawingHandleScreen handle) // Draw radar position on the station handle.DrawCircle(ScalePosition(invertedPosition), 5f, Color.Lime); - var shown = new HashSet(); - // Draw other grids... differently foreach (var grid in _mapManager.FindGridsIntersecting(mapPosition.MapId, new Box2(mapPosition.Position - MaxRadarRange, mapPosition.Position + MaxRadarRange))) @@ -288,7 +288,7 @@ protected override void Draw(DrawingHandleScreen handle) // Detailed view DrawGrid(handle, matty, grid, color, true); - DrawDocks(handle, grid.Owner, matty); + DrawDocks(handle, grid.Owner, matty, shown); } foreach (var (ent, _) in _iffControls) @@ -315,7 +315,7 @@ private void ClearLabel(EntityUid uid) _iffControls.Remove(uid); } - private void DrawDocks(DrawingHandleScreen handle, EntityUid uid, Matrix3 matrix) + private void DrawDocks(DrawingHandleScreen handle, EntityUid uid, Matrix3 matrix, HashSet shown) { if (!ShowDocks) return; @@ -324,6 +324,9 @@ private void DrawDocks(DrawingHandleScreen handle, EntityUid uid, Matrix3 matrix if (_docks.TryGetValue(uid, out var docks)) { + // Keep track of which logical docks we've already drawn labels on, to prevent + // duplicating labels for each group of docks. + var labeled = new HashSet(); foreach (var state in docks) { var ent = state.Entity; @@ -353,6 +356,27 @@ private void DrawDocks(DrawingHandleScreen handle, EntityUid uid, Matrix3 matrix handle.DrawPrimitives(DrawPrimitiveTopology.TriangleFan, verts, color.WithAlpha(0.8f)); handle.DrawPrimitives(DrawPrimitiveTopology.LineStrip, verts, color); + + // draw dock label + if (state.Name != null && !labeled.Contains(state.Name)) + { + labeled.Add(state.Name); + Label label; + if (!_iffControls.TryGetValue(ent, out var control)) + { + label = new Label(); + _iffControls[ent] = label; + AddChild(label); + } + else + { + label = (Label) control; + } + shown.Add(ent); + label.Visible = true; + label.Text = state.Name; + LayoutContainer.SetPosition(label, ScalePosition(uiPosition)); + } } } } diff --git a/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml.cs b/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml.cs index 0c1fa4f2163..8b0bd7af226 100644 --- a/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml.cs +++ b/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml.cs @@ -181,6 +181,7 @@ private void UpdateDocks(List docks) // We also need to make up some pseudonumber as well for these. _docks.Clear(); + docks.Sort(new DockComparer()); foreach (var dock in docks) { var grid = _docks.GetOrNew(dock.Coordinates.EntityId); diff --git a/Content.Shared/Shuttles/BUIStates/RadarConsoleBoundInterfaceState.cs b/Content.Shared/Shuttles/BUIStates/RadarConsoleBoundInterfaceState.cs index 061b862baa5..5592196256b 100644 --- a/Content.Shared/Shuttles/BUIStates/RadarConsoleBoundInterfaceState.cs +++ b/Content.Shared/Shuttles/BUIStates/RadarConsoleBoundInterfaceState.cs @@ -49,6 +49,23 @@ public sealed class DockingInterfaceState public Color HighlightedColor; } +public class DockComparer: IComparer +{ + public int Compare(DockingInterfaceState? a, DockingInterfaceState? b) + { + if (a == null) + return -1; + else if (b == null) + return 1; + else if (a.Name != null && b.Name != null) + return a.Name.CompareTo(b.Name); + else if (a.Name != null) // a has a name but b doesn't + return 1; + else // neither are named, compare by Uid + return a.Entity.CompareTo(b.Entity); + } +} + [Serializable, NetSerializable] public enum RadarConsoleUiKey : byte { diff --git a/Resources/Maps/frontier.yml b/Resources/Maps/frontier.yml index fafbb83b8ea..0c9f8fa212b 100644 --- a/Resources/Maps/frontier.yml +++ b/Resources/Maps/frontier.yml @@ -143,7 +143,7 @@ entities: tiles: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAXwAAAF8AAABeAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== type: MapGrid - type: Broadphase - - angularDamping: 0.05 + - angularDamping: 10000 linearDamping: 10000 fixedRotation: False bodyType: Dynamic @@ -151,8 +151,8 @@ entities: - fixtures: {} type: Fixtures - type: OccluderTree - - linearDamping: 10000 - angularDamping: 10000 + - angularDamping: 10000 + linearDamping: 10000 type: Shuttle - type: GridPathfinding - gravityShakeSound: !type:SoundPathSpecifier @@ -3207,214 +3207,290 @@ entities: pos: -33.5,-25.5 parent: 2173 type: Transform + - name: 2A + type: Docking - uid: 2171 components: - rot: -1.5707963267948966 rad pos: -33.5,-26.5 parent: 2173 type: Transform + - name: 2A + type: Docking - uid: 2172 components: - rot: -1.5707963267948966 rad pos: -33.5,-27.5 parent: 2173 type: Transform + - name: 2A + type: Docking - uid: 2175 components: - pos: -28.5,-30.5 parent: 2173 type: Transform + - name: 2B + type: Docking - uid: 2176 components: - rot: 1.5707963267948966 rad pos: -25.5,-27.5 parent: 2173 type: Transform + - name: 2C + type: Docking - uid: 2177 components: - rot: 1.5707963267948966 rad pos: -25.5,-26.5 parent: 2173 type: Transform + - name: 2C + type: Docking - uid: 2178 components: - rot: 1.5707963267948966 rad pos: -25.5,-25.5 parent: 2173 type: Transform + - name: 2C + type: Docking - uid: 2179 components: - pos: -1.5,-0.5 parent: 2173 type: Transform + - name: 6 + type: Docking - uid: 2180 components: - pos: 0.5,-0.5 parent: 2173 type: Transform + - name: 6 + type: Docking - uid: 2181 components: - pos: 27.5,-30.5 parent: 2173 type: Transform + - name: 3B + type: Docking - uid: 2182 components: - pos: 28.5,-30.5 parent: 2173 type: Transform + - name: 3B + type: Docking - uid: 2183 components: - pos: 29.5,-30.5 parent: 2173 type: Transform + - name: 3B + type: Docking - uid: 2184 components: - rot: -1.5707963267948966 rad pos: 24.5,-27.5 parent: 2173 type: Transform + - name: 3A + type: Docking - uid: 2185 components: - rot: -1.5707963267948966 rad pos: 24.5,-26.5 parent: 2173 type: Transform + - name: 3A + type: Docking - uid: 2186 components: - rot: -1.5707963267948966 rad pos: 24.5,-25.5 parent: 2173 type: Transform + - name: 3A + type: Docking - uid: 2187 components: - rot: 1.5707963267948966 rad pos: 32.5,-27.5 parent: 2173 type: Transform + - name: 3C + type: Docking - uid: 2188 components: - rot: 1.5707963267948966 rad pos: 32.5,-26.5 parent: 2173 type: Transform + - name: 3C + type: Docking - uid: 2189 components: - rot: 1.5707963267948966 rad pos: 32.5,-25.5 parent: 2173 type: Transform + - name: 3C + type: Docking - uid: 2190 components: - rot: 1.5707963267948966 rad pos: 61.5,1.5 parent: 2173 type: Transform + - name: 4B + type: Docking - uid: 2191 components: - rot: 1.5707963267948966 rad pos: 61.5,2.5 parent: 2173 type: Transform + - name: 4B + type: Docking - uid: 2192 components: - rot: 1.5707963267948966 rad pos: 61.5,3.5 parent: 2173 type: Transform + - name: 4B + type: Docking - uid: 2193 components: - pos: 58.5,-1.5 parent: 2173 type: Transform + - name: 4A + type: Docking - uid: 2194 components: - pos: 57.5,-1.5 parent: 2173 type: Transform + - name: 4A + type: Docking - uid: 2195 components: - pos: 56.5,-1.5 parent: 2173 type: Transform + - name: 4A + type: Docking - uid: 2196 components: - rot: -1.5707963267948966 rad pos: -6.5,43.5 parent: 2173 type: Transform + - name: 5A + type: Docking - uid: 2197 components: - rot: -1.5707963267948966 rad pos: -6.5,44.5 parent: 2173 type: Transform + - name: 5A + type: Docking - uid: 2198 components: - rot: -1.5707963267948966 rad pos: -6.5,45.5 parent: 2173 type: Transform + - name: 5A + type: Docking - uid: 2199 components: - rot: 1.5707963267948966 rad pos: 12.5,53.5 parent: 2173 type: Transform + - name: 5B + type: Docking - uid: 2200 components: - rot: 1.5707963267948966 rad pos: 12.5,54.5 parent: 2173 type: Transform + - name: 5B + type: Docking - uid: 2201 components: - rot: 1.5707963267948966 rad pos: 12.5,55.5 parent: 2173 type: Transform + - name: 5B + type: Docking - uid: 2202 components: - pos: -57.5,-1.5 parent: 2173 type: Transform + - name: 1B + type: Docking - uid: 2203 components: - pos: -58.5,-1.5 parent: 2173 type: Transform + - name: 1B + type: Docking - uid: 2204 components: - pos: -59.5,-1.5 parent: 2173 type: Transform + - name: 1B + type: Docking - uid: 2205 components: - rot: -1.5707963267948966 rad pos: -62.5,1.5 parent: 2173 type: Transform + - name: 1A + type: Docking - uid: 2206 components: - rot: -1.5707963267948966 rad pos: -62.5,2.5 parent: 2173 type: Transform + - name: 1A + type: Docking - uid: 2207 components: - rot: -1.5707963267948966 rad pos: -62.5,3.5 parent: 2173 type: Transform + - name: 1A + type: Docking - uid: 5801 components: - pos: -29.5,-30.5 parent: 2173 type: Transform + - name: 2B + type: Docking - uid: 5805 components: - pos: -30.5,-30.5 parent: 2173 type: Transform + - name: 2B + type: Docking - proto: AirlockHeadOfPersonnelGlassLocked entities: - uid: 4113 @@ -15343,12 +15419,6 @@ entities: - pos: -54.5,4.5 parent: 2173 type: Transform - - uid: 2838 - components: - - rot: 1.5707963267948966 rad - pos: 12.5,14.5 - parent: 2173 - type: Transform - uid: 4169 components: - pos: -24.5,4.5 @@ -15400,6 +15470,14 @@ entities: - pos: 43.5,13.5 parent: 2173 type: Transform +- proto: ComputerShuttle + entities: + - uid: 2838 + components: + - rot: 1.5707963267948966 rad + pos: 12.5,14.5 + parent: 2173 + type: Transform - proto: ComputerStationRecords entities: - uid: 2633