From 886a39951f32195c7ea9bdf92808176b70090990 Mon Sep 17 00:00:00 2001 From: Just-a-Unity-Dev <67359748+Just-a-Unity-Dev@users.noreply.github.com> Date: Thu, 9 Nov 2023 15:02:42 +0800 Subject: [PATCH 1/2] show point on console where i aim at --- Content.Client/Shuttles/UI/RadarControl.cs | 12 ++++++++++++ Content.Server/_FTL/ShipWeapons/ShipWeaponsSystem.cs | 10 +++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Content.Client/Shuttles/UI/RadarControl.cs b/Content.Client/Shuttles/UI/RadarControl.cs index 35ddda8d40..ce4b225a5b 100644 --- a/Content.Client/Shuttles/UI/RadarControl.cs +++ b/Content.Client/Shuttles/UI/RadarControl.cs @@ -44,6 +44,8 @@ public sealed class RadarControl : MapGridControl private Dictionary> _docks = new(); + private EntityCoordinates? _clickedCoordinates = null; + public bool ShowIFF { get; set; } = true; public bool ShowDocks { get; set; } = true; @@ -60,6 +62,10 @@ public sealed class RadarControl : MapGridControl public RadarControl() : base(64f, 256f, 256f) { _transform = _entManager.System(); + OnRadarClick += coordinates => + { + _clickedCoordinates = coordinates; + }; } public void SetMatrix(EntityCoordinates? coordinates, Angle? angle) @@ -195,6 +201,12 @@ protected override void Draw(DrawingHandleScreen handle) // Draw radar position on the station handle.DrawCircle(ScalePosition(invertedPosition), 5f, Color.Lime); + if (_clickedCoordinates.HasValue) + { + var cc = _clickedCoordinates.Value.Position - offset; + cc.Y = -cc.Y; + handle.DrawCircle(ScalePosition(cc), 5f, Color.Lime); + } var shown = new HashSet(); diff --git a/Content.Server/_FTL/ShipWeapons/ShipWeaponsSystem.cs b/Content.Server/_FTL/ShipWeapons/ShipWeaponsSystem.cs index 5841940f89..444f55a7fe 100644 --- a/Content.Server/_FTL/ShipWeapons/ShipWeaponsSystem.cs +++ b/Content.Server/_FTL/ShipWeapons/ShipWeaponsSystem.cs @@ -115,6 +115,7 @@ private void UpdateUserInterface(EntityUid uid, GunnerConsoleComponent? componen return; var consoleTransform = Transform(uid); + Log.Info(consoleTransform.Coordinates.Position.ToString()); TryComp(uid, out var radar); var totalAmmo = 0; @@ -146,7 +147,14 @@ private void UpdateUserInterface(EntityUid uid, GunnerConsoleComponent? componen } var range = radar?.MaxRange ?? SharedRadarConsoleSystem.DefaultMaxRange; - var state = new GunnerConsoleBoundInterfaceState(remainingAmmo, totalAmmo, range, weapons, _entityManager.GetNetCoordinates(consoleTransform.Coordinates), consoleTransform.LocalRotation); + var state = new GunnerConsoleBoundInterfaceState( + remainingAmmo, + totalAmmo, + range, + weapons, + _entityManager.GetNetCoordinates(consoleTransform.Coordinates), + consoleTransform.LocalRotation + ); _userInterface.TrySetUiState(uid, ShipWeaponTargetingUiKey.Key, state); } From c70133fd90b79eb498650d5598f00e5b21f7daf6 Mon Sep 17 00:00:00 2001 From: Just-a-Unity-Dev <67359748+Just-a-Unity-Dev@users.noreply.github.com> Date: Thu, 9 Nov 2023 16:16:16 +0800 Subject: [PATCH 2/2] and more --- Content.Client/Shuttles/UI/RadarControl.cs | 11 +++++++---- .../_FTL/ShipWeapons/GunnerConsoleWindow.xaml.cs | 7 ++++++- Content.Server/_FTL/ShipWeapons/ShipWeaponsSystem.cs | 2 -- Resources/Locale/en-US/_ftl/ship-weapons.ftl | 4 ++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Content.Client/Shuttles/UI/RadarControl.cs b/Content.Client/Shuttles/UI/RadarControl.cs index ce4b225a5b..f4e4896eb6 100644 --- a/Content.Client/Shuttles/UI/RadarControl.cs +++ b/Content.Client/Shuttles/UI/RadarControl.cs @@ -195,17 +195,20 @@ protected override void Draw(DrawingHandleScreen handle) DrawDocks(handle, ourGridId.Value, matrix); } - var invertedPosition = _coordinates.Value.Position - offset; - invertedPosition.Y = -invertedPosition.Y; + var padPosition = _coordinates.Value.Position; + var consolePosition = _coordinates.Value.Position - padPosition; + padPosition.Y = -padPosition.Y; + consolePosition.Y = -consolePosition.Y; // Don't need to transform the InvWorldMatrix again as it's already offset to its position. // Draw radar position on the station - handle.DrawCircle(ScalePosition(invertedPosition), 5f, Color.Lime); + handle.DrawCircle(ScalePosition(padPosition), 5f, Color.Blue); + handle.DrawCircle(ScalePosition(consolePosition), 5f, Color.BlueViolet); if (_clickedCoordinates.HasValue) { var cc = _clickedCoordinates.Value.Position - offset; cc.Y = -cc.Y; - handle.DrawCircle(ScalePosition(cc), 5f, Color.Lime); + handle.DrawCircle(ScalePosition(cc), 5f, Color.Orange); } var shown = new HashSet(); diff --git a/Content.Client/_FTL/ShipWeapons/GunnerConsoleWindow.xaml.cs b/Content.Client/_FTL/ShipWeapons/GunnerConsoleWindow.xaml.cs index a1662b92c0..a7a43b40fa 100644 --- a/Content.Client/_FTL/ShipWeapons/GunnerConsoleWindow.xaml.cs +++ b/Content.Client/_FTL/ShipWeapons/GunnerConsoleWindow.xaml.cs @@ -42,7 +42,12 @@ public void SetMatrix(EntityCoordinates? coordinates, Angle? angle) public void UpdateState(GunnerConsoleBoundInterfaceState scc) { // update the radar - var radarState = new RadarConsoleBoundInterfaceState(scc.MaxRange, scc.Coordinates, scc.Angle, scc.Weapons); + var radarState = new RadarConsoleBoundInterfaceState( + scc.MaxRange, + scc.Coordinates, + scc.Angle, + scc.Weapons + ); RadarScreen.UpdateState(radarState); // update ammo text diff --git a/Content.Server/_FTL/ShipWeapons/ShipWeaponsSystem.cs b/Content.Server/_FTL/ShipWeapons/ShipWeaponsSystem.cs index 444f55a7fe..88111b9918 100644 --- a/Content.Server/_FTL/ShipWeapons/ShipWeaponsSystem.cs +++ b/Content.Server/_FTL/ShipWeapons/ShipWeaponsSystem.cs @@ -69,7 +69,6 @@ private void OnPerformActionWeapon(EntityUid uid, GunnerConsoleComponent compone case ShipWeaponAction.Chamber: break; } - } } UpdateUserInterface(uid, component); @@ -115,7 +114,6 @@ private void UpdateUserInterface(EntityUid uid, GunnerConsoleComponent? componen return; var consoleTransform = Transform(uid); - Log.Info(consoleTransform.Coordinates.Position.ToString()); TryComp(uid, out var radar); var totalAmmo = 0; diff --git a/Resources/Locale/en-US/_ftl/ship-weapons.ftl b/Resources/Locale/en-US/_ftl/ship-weapons.ftl index ecc32fb83a..947ca88624 100644 --- a/Resources/Locale/en-US/_ftl/ship-weapons.ftl +++ b/Resources/Locale/en-US/_ftl/ship-weapons.ftl @@ -14,8 +14,8 @@ gunner-console-button-fire-text = Fire gunner-console-button-chamber-text = Chamber Guns gunner-console-button-eject-text = Eject Mags -signal-port-name-weapons-output = Weapon Output Port +signal-port-name-weapons-output = Pad Control Port signal-port-name-weapons-output-description = Link the output port to the input port here. -signal-port-name-weapons-input = Weapon Input Port +signal-port-name-weapons-input = Weapon Control Port signal-port-name-weapons-input-description = Link the input port to the output port here.