diff --git a/Content.Client/Shuttles/BUI/ShuttleConsoleBoundUserInterface.cs b/Content.Client/Shuttles/BUI/ShuttleConsoleBoundUserInterface.cs index e677181419e..9643b5e9fe6 100644 --- a/Content.Client/Shuttles/BUI/ShuttleConsoleBoundUserInterface.cs +++ b/Content.Client/Shuttles/BUI/ShuttleConsoleBoundUserInterface.cs @@ -8,7 +8,7 @@ namespace Content.Client.Shuttles.BUI; [UsedImplicitly] -public sealed class ShuttleConsoleBoundUserInterface : BoundUserInterface +public sealed partial class ShuttleConsoleBoundUserInterface : BoundUserInterface // Frontier: added partial { [ViewVariables] private ShuttleConsoleWindow? _window; @@ -26,6 +26,7 @@ protected override void Open() _window.RequestBeaconFTL += OnFTLBeaconRequest; _window.DockRequest += OnDockRequest; _window.UndockRequest += OnUndockRequest; + NfOpen(); // Frontier } private void OnUndockRequest(NetEntity entity) diff --git a/Content.Client/Shuttles/UI/NavScreen.xaml b/Content.Client/Shuttles/UI/NavScreen.xaml index c97aeda05be..789b2a65a1d 100644 --- a/Content.Client/Shuttles/UI/NavScreen.xaml +++ b/Content.Client/Shuttles/UI/NavScreen.xaml @@ -65,5 +65,48 @@ Text="{controls:Loc 'shuttle-console-dock-toggle'}" TextAlign="Center" ToggleMode="True"/> + + + + + + + + + + + + + + + + + + + + + - diff --git a/Content.Client/Shuttles/UI/NavScreen.xaml.cs b/Content.Client/Shuttles/UI/NavScreen.xaml.cs index 91d95aaa042..73af6f62185 100644 --- a/Content.Client/Shuttles/UI/NavScreen.xaml.cs +++ b/Content.Client/Shuttles/UI/NavScreen.xaml.cs @@ -28,6 +28,8 @@ public NavScreen() DockToggle.OnToggled += OnDockTogglePressed; DockToggle.Pressed = NavRadar.ShowDocks; + + NfInitialize(); // Frontier Initialization for the NavScreen } public void SetShuttle(EntityUid? shuttle) @@ -50,6 +52,7 @@ private void OnDockTogglePressed(BaseButton.ButtonEventArgs args) public void UpdateState(NavInterfaceState scc) { NavRadar.UpdateState(scc); + NfUpdateState(); // Frontier Update State } public void SetMatrix(EntityCoordinates? coordinates, Angle? angle) diff --git a/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml.cs b/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml.cs index a4b42fb672c..8df3eb4d93e 100644 --- a/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml.cs +++ b/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml.cs @@ -62,6 +62,8 @@ public ShuttleConsoleWindow() { UndockRequest?.Invoke(entity); }; + + NfInitialize(); // Frontier Initialization for the ShuttleConsoleWindow } private void ClearModes(ShuttleConsoleMode mode) diff --git a/Content.Client/Shuttles/UI/ShuttleNavControl.xaml.cs b/Content.Client/Shuttles/UI/ShuttleNavControl.xaml.cs index 0b8720add21..51fd68e679f 100644 --- a/Content.Client/Shuttles/UI/ShuttleNavControl.xaml.cs +++ b/Content.Client/Shuttles/UI/ShuttleNavControl.xaml.cs @@ -1,4 +1,5 @@ using System.Numerics; +using Content.Client.Station; // Frontier using Content.Shared.Shuttles.BUIStates; using Content.Shared.Shuttles.Components; using Content.Shared.Shuttles.Systems; @@ -7,13 +8,11 @@ using Robust.Client.Graphics; using Robust.Client.UserInterface; using Robust.Client.UserInterface.XAML; -using Robust.Shared.Collections; using Robust.Shared.Input; using Robust.Shared.Map; using Robust.Shared.Map.Components; using Robust.Shared.Physics; using Robust.Shared.Physics.Components; -using Robust.Shared.Utility; namespace Content.Client.Shuttles.UI; @@ -21,6 +20,8 @@ namespace Content.Client.Shuttles.UI; public sealed partial class ShuttleNavControl : BaseShuttleControl { [Dependency] private readonly IMapManager _mapManager = default!; + [Dependency] private readonly IUserInterfaceManager _uiManager = default!; + private readonly StationSystem _station; // Frontier private readonly SharedShuttleSystem _shuttles; private readonly SharedTransformSystem _transform; @@ -48,6 +49,7 @@ public ShuttleNavControl() : base(64f, 256f, 256f) RobustXamlLoader.Load(this); _shuttles = EntManager.System(); _transform = EntManager.System(); + _station = EntManager.System(); // Frontier } public void SetMatrix(EntityCoordinates? coordinates, Angle? angle) @@ -110,6 +112,8 @@ public void UpdateState(NavInterfaceState state) ActualRadarRange = Math.Clamp(ActualRadarRange, WorldMinRange, WorldMaxRange); _docks = state.Docks; + + NfUpdateState(state); // Frontier Update State } protected override void Draw(DrawingHandleScreen handle) diff --git a/Content.Client/_NF/Shuttles/BUI/ShuttleConsoleBoundUserInterface.cs b/Content.Client/_NF/Shuttles/BUI/ShuttleConsoleBoundUserInterface.cs new file mode 100644 index 00000000000..715c67f888f --- /dev/null +++ b/Content.Client/_NF/Shuttles/BUI/ShuttleConsoleBoundUserInterface.cs @@ -0,0 +1,26 @@ +// New Frontiers - This file is licensed under AGPLv3 +// Copyright (c) 2024 New Frontiers Contributors +// See AGPLv3.txt for details. +using Content.Client.Shuttles.UI; +using Content.Shared._NF.Shuttles.Events; + +namespace Content.Client.Shuttles.BUI +{ + public sealed partial class ShuttleConsoleBoundUserInterface + { + private void NfOpen() + { + _window ??= new ShuttleConsoleWindow(); + _window.OnInertiaDampeningModeChanged += OnInertiaDampeningModeChanged; + } + private void OnInertiaDampeningModeChanged(NetEntity? entityUid, InertiaDampeningMode mode) + { + SendMessage(new SetInertiaDampeningRequest + { + ShuttleEntityUid = entityUid, + Mode = mode, + }); + } + + } +} diff --git a/Content.Client/_NF/Shuttles/UI/NavScreen.xaml.cs b/Content.Client/_NF/Shuttles/UI/NavScreen.xaml.cs new file mode 100644 index 00000000000..25369baddf6 --- /dev/null +++ b/Content.Client/_NF/Shuttles/UI/NavScreen.xaml.cs @@ -0,0 +1,83 @@ +// New Frontiers - This file is licensed under AGPLv3 +// Copyright (c) 2024 New Frontiers Contributors +// See AGPLv3.txt for details. +using Content.Shared._NF.Shuttles.Events; +using Robust.Client.UserInterface.Controls; + +namespace Content.Client.Shuttles.UI +{ + public sealed partial class NavScreen + { + private readonly ButtonGroup _buttonGroup = new(); + public event Action? OnInertiaDampeningModeChanged; + + private void NfInitialize() + { + // Frontier - IFF search + IffSearchCriteria.OnTextChanged += args => OnIffSearchChanged(args.Text); + + // Frontier - Maximum IFF Distance + MaximumIFFDistanceValue.GetChild(0).GetChild(1).Margin = new Thickness(8, 0, 0, 0); + MaximumIFFDistanceValue.OnValueChanged += args => OnRangeFilterChanged(args); + + DampenerOff.OnPressed += _ => SetDampenerMode(InertiaDampeningMode.Off); + DampenerOn.OnPressed += _ => SetDampenerMode(InertiaDampeningMode.Dampen); + AnchorOn.OnPressed += _ => SetDampenerMode(InertiaDampeningMode.Anchor); + + DampenerOff.Group = _buttonGroup; + DampenerOn.Group = _buttonGroup; + AnchorOn.Group = _buttonGroup; + + // Send off a request to get the current dampening mode. + _entManager.TryGetNetEntity(_shuttleEntity, out var shuttle); + OnInertiaDampeningModeChanged?.Invoke(shuttle, InertiaDampeningMode.Query); + } + + private void SetDampenerMode(InertiaDampeningMode mode) + { + NavRadar.DampeningMode = mode; + _entManager.TryGetNetEntity(_shuttleEntity, out var shuttle); + OnInertiaDampeningModeChanged?.Invoke(shuttle, mode); + } + + private void NfUpdateState() + { + if (NavRadar.DampeningMode == InertiaDampeningMode.Station) + { + DampenerModeButtons.Visible = false; + } + else + { + DampenerModeButtons.Visible = true; + DampenerOff.Pressed = NavRadar.DampeningMode == InertiaDampeningMode.Off; + DampenerOn.Pressed = NavRadar.DampeningMode == InertiaDampeningMode.Dampen; + AnchorOn.Pressed = NavRadar.DampeningMode == InertiaDampeningMode.Anchor; + } + } + + // Frontier - Maximum IFF Distance + private void OnRangeFilterChanged(int value) + { + NavRadar.MaximumIFFDistance = (float) value; + } + + private void NfAddShuttleDesignation(EntityUid? shuttle) + { + // Frontier - PR #1284 Add Shuttle Designation + if (_entManager.TryGetComponent(shuttle, out var metadata)) + { + var shipNameParts = metadata.EntityName.Split(' '); + var designation = shipNameParts[^1]; + if (designation.Length > 2 && designation[2] == '-') + { + NavDisplayLabel.Text = string.Join(' ', shipNameParts[..^1]); + ShuttleDesignation.Text = designation; + } + else + NavDisplayLabel.Text = metadata.EntityName; + } + // End Frontier - PR #1284 + } + + } +} diff --git a/Content.Client/_NF/Shuttles/UI/ShuttleConsoleWindow.xaml.cs b/Content.Client/_NF/Shuttles/UI/ShuttleConsoleWindow.xaml.cs new file mode 100644 index 00000000000..7ba3f952b46 --- /dev/null +++ b/Content.Client/_NF/Shuttles/UI/ShuttleConsoleWindow.xaml.cs @@ -0,0 +1,21 @@ +// New Frontiers - This file is licensed under AGPLv3 +// Copyright (c) 2024 New Frontiers Contributors +// See AGPLv3.txt for details. +using Content.Shared._NF.Shuttles.Events; + +namespace Content.Client.Shuttles.UI +{ + public sealed partial class ShuttleConsoleWindow + { + public event Action? OnInertiaDampeningModeChanged; + + private void NfInitialize() + { + NavContainer.OnInertiaDampeningModeChanged += (entity, mode) => + { + OnInertiaDampeningModeChanged?.Invoke(entity, mode); + }; + } + + } +} diff --git a/Content.Client/_NF/Shuttles/UI/ShuttleNavControl.xaml.cs b/Content.Client/_NF/Shuttles/UI/ShuttleNavControl.xaml.cs new file mode 100644 index 00000000000..3520967548e --- /dev/null +++ b/Content.Client/_NF/Shuttles/UI/ShuttleNavControl.xaml.cs @@ -0,0 +1,131 @@ +// New Frontiers - This file is licensed under AGPLv3 +// Copyright (c) 2024 New Frontiers Contributors +// See AGPLv3.txt for details. +using Content.Shared._NF.Shuttles.Events; +using Content.Shared.Shuttles.BUIStates; +using Robust.Shared.Physics.Components; +using System.Numerics; +using Robust.Client.Graphics; +using Robust.Shared.Collections; + +namespace Content.Client.Shuttles.UI +{ + public sealed partial class ShuttleNavControl + { + public InertiaDampeningMode DampeningMode { get; set; } + + private void NfUpdateState(NavInterfaceState state) + { + + if (!EntManager.GetCoordinates(state.Coordinates).HasValue || + !EntManager.TryGetComponent(EntManager.GetCoordinates(state.Coordinates).GetValueOrDefault().EntityId,out TransformComponent? transform) || + !EntManager.TryGetComponent(transform.GridUid, out PhysicsComponent? physicsComponent)) + { + return; + } + + DampeningMode = state.DampeningMode; + } + + // New Frontiers - Maximum IFF Distance - checks distance to object, draws if closer than max range + // This code is licensed under AGPLv3. See AGPLv3.txt + private bool NfCheckShouldDrawIffRangeCondition(bool shouldDrawIff, PhysicsComponent gridBody, Matrix3x2 matty) + { + if (shouldDrawIff && MaximumIFFDistance >= 0.0f) + { + var gridCentre = Vector2.Transform(gridBody.LocalCenter, matty); + var distance = gridCentre.Length(); + + if (distance > MaximumIFFDistance) + { + shouldDrawIff = false; + } + } + + return shouldDrawIff; + } + + private static void NfAddBlipToList(List blipDataList, bool isOutsideRadarCircle, Vector2 uiPosition, int uiXCentre, int uiYCentre, Color color) + { + blipDataList.Add(new BlipData + { + IsOutsideRadarCircle = isOutsideRadarCircle, + UiPosition = uiPosition, + VectorToPosition = uiPosition - new Vector2(uiXCentre, uiYCentre), + Color = color + }); + } + + /** + * Frontier - Adds blip style triangles that are on ships or pointing towards ships on the edges of the radar. + * Draws blips at the BlipData's uiPosition and uses VectorToPosition to rotate to point towards ships. + */ + private void NfDrawBlips(DrawingHandleBase handle, List blipDataList) + { + var blipValueList = new Dictionary>(); + + foreach (var blipData in blipDataList) + { + var triangleShapeVectorPoints = new[] + { + new Vector2(0, 0), + new Vector2(RadarBlipSize, 0), + new Vector2(RadarBlipSize * 0.5f, RadarBlipSize) + }; + + if (blipData.IsOutsideRadarCircle) + { + // Calculate the angle of rotation + var angle = (float) Math.Atan2(blipData.VectorToPosition.Y, blipData.VectorToPosition.X) + -1.6f; + + // Manually create a rotation matrix + var cos = (float) Math.Cos(angle); + var sin = (float) Math.Sin(angle); + float[,] rotationMatrix = { { cos, -sin }, { sin, cos } }; + + // Rotate each vertex + for (var i = 0; i < triangleShapeVectorPoints.Length; i++) + { + var vertex = triangleShapeVectorPoints[i]; + var x = vertex.X * rotationMatrix[0, 0] + vertex.Y * rotationMatrix[0, 1]; + var y = vertex.X * rotationMatrix[1, 0] + vertex.Y * rotationMatrix[1, 1]; + triangleShapeVectorPoints[i] = new Vector2(x, y); + } + } + + var triangleCenterVector = + (triangleShapeVectorPoints[0] + triangleShapeVectorPoints[1] + triangleShapeVectorPoints[2]) / 3; + + // Calculate the vectors from the center to each vertex + var vectorsFromCenter = new Vector2[3]; + for (int i = 0; i < 3; i++) + { + vectorsFromCenter[i] = (triangleShapeVectorPoints[i] - triangleCenterVector) * UIScale; + } + + // Calculate the vertices of the new triangle + var newVerts = new Vector2[3]; + for (var i = 0; i < 3; i++) + { + newVerts[i] = (blipData.UiPosition * UIScale) + vectorsFromCenter[i]; + } + + if (!blipValueList.TryGetValue(blipData.Color, out var valueList)) + { + valueList = new ValueList(); + + } + valueList.Add(newVerts[0]); + valueList.Add(newVerts[1]); + valueList.Add(newVerts[2]); + blipValueList[blipData.Color] = valueList; + } + + // One draw call for every color we have + foreach (var color in blipValueList) + { + handle.DrawPrimitives(DrawPrimitiveTopology.TriangleList, color.Value.Span, color.Key); + } + } + } +} diff --git a/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs b/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs index e37be3d1a52..264323dabeb 100644 --- a/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs +++ b/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs @@ -3,6 +3,7 @@ using Content.Server.Shuttles.Components; using Content.Server.Shuttles.Events; using Content.Server.Station.Systems; +using Content.Shared._NF.Shuttles.Events; // Frontier using Content.Shared.ActionBlocker; using Content.Shared.Alert; using Content.Shared.Popups; @@ -257,7 +258,7 @@ private void UpdateState(EntityUid consoleUid, ref DockingInterfaceState? dockSt } else { - navState = new NavInterfaceState(0f, null, null, new Dictionary>()); + navState = new NavInterfaceState(0f, null, null, new Dictionary>(), InertiaDampeningMode.Dampen); // Frontier: inertia dampening); mapState = new ShuttleMapInterfaceState( FTLState.Invalid, default, @@ -372,7 +373,7 @@ public void ClearPilots(ShuttleConsoleComponent component) public NavInterfaceState GetNavState(Entity entity, Dictionary> docks) { if (!Resolve(entity, ref entity.Comp1, ref entity.Comp2)) - return new NavInterfaceState(SharedRadarConsoleSystem.DefaultMaxRange, null, null, docks); + return new NavInterfaceState(SharedRadarConsoleSystem.DefaultMaxRange, null, null, docks, Shared._NF.Shuttles.Events.InertiaDampeningMode.Dampen); // Frontier: add inertia dampening return GetNavState( entity, @@ -388,13 +389,14 @@ public NavInterfaceState GetNavState( Angle angle) { if (!Resolve(entity, ref entity.Comp1, ref entity.Comp2)) - return new NavInterfaceState(SharedRadarConsoleSystem.DefaultMaxRange, GetNetCoordinates(coordinates), angle, docks); + return new NavInterfaceState(SharedRadarConsoleSystem.DefaultMaxRange, GetNetCoordinates(coordinates), angle, docks, InertiaDampeningMode.Dampen); // Frontier: add inertial dampening return new NavInterfaceState( entity.Comp1.MaxRange, GetNetCoordinates(coordinates), angle, - docks); + docks, + _shuttle.NfGetInertiaDampeningMode(entity)); // Frontier: inertia dampening } /// diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.cs index a10d0d56144..95f0bf93d43 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.cs @@ -69,6 +69,9 @@ public override void Initialize() SubscribeLocalEvent(OnGridInit); SubscribeLocalEvent(OnGridFixtureChange); + + NfInitialize(); // Frontier Initialization for the ShuttleSystem + } public override void Update(float frameTime) diff --git a/Content.Server/_NF/Shuttles/Systems/ShuttleSystem.cs b/Content.Server/_NF/Shuttles/Systems/ShuttleSystem.cs new file mode 100644 index 00000000000..f027d3cce44 --- /dev/null +++ b/Content.Server/_NF/Shuttles/Systems/ShuttleSystem.cs @@ -0,0 +1,86 @@ +// New Frontiers - This file is licensed under AGPLv3 +// Copyright (c) 2024 New Frontiers Contributors +// See AGPLv3.txt for details. +using Content.Server._NF.Station.Components; +using Content.Server.Shuttles.Components; +using Content.Shared._NF.Shuttles.Events; +using Content.Shared.Shipyard.Components; +using Robust.Shared.Physics.Components; + +namespace Content.Server.Shuttles.Systems; + +public sealed partial class ShuttleSystem +{ + private const float SpaceFrictionStrength = 0.0015f; + private const float AnchorDampeningStrength = 0.5f; + private void NfInitialize() + { + SubscribeLocalEvent(OnSetInertiaDampening); + } + + private void OnSetInertiaDampening(EntityUid uid, ShuttleConsoleComponent component, SetInertiaDampeningRequest args) + { + // Ensure that the entity requested is a valid shuttle (stations should not be togglable) + if (!EntityManager.TryGetComponent(uid, out TransformComponent? transform) || + !transform.GridUid.HasValue || + !EntityManager.TryGetComponent(transform.GridUid, out PhysicsComponent? physicsComponent) || + !EntityManager.TryGetComponent(transform.GridUid, out ShuttleComponent? shuttleComponent)) + { + return; + } + + if (args.Mode == InertiaDampeningMode.Query) + { + _console.RefreshShuttleConsoles(transform.GridUid.Value); + return; + } + + if (!EntityManager.HasComponent(transform.GridUid) || + EntityManager.HasComponent(_station.GetOwningStation(transform.GridUid))) + { + return; + } + + var linearDampeningStrength = args.Mode switch + { + InertiaDampeningMode.Off => SpaceFrictionStrength, + InertiaDampeningMode.Dampen => shuttleComponent.LinearDamping, + InertiaDampeningMode.Anchor => AnchorDampeningStrength, + _ => shuttleComponent.LinearDamping, // other values: default to some sane behaviour (assume normal dampening) + }; + + var angularDampeningStrength = args.Mode switch + { + InertiaDampeningMode.Off => SpaceFrictionStrength, + InertiaDampeningMode.Dampen => shuttleComponent.AngularDamping, + InertiaDampeningMode.Anchor => AnchorDampeningStrength, + _ => shuttleComponent.AngularDamping, // other values: default to some sane behaviour (assume normal dampening) + }; + + _physics.SetLinearDamping(transform.GridUid.Value, physicsComponent, linearDampeningStrength); + _physics.SetAngularDamping(transform.GridUid.Value, physicsComponent, angularDampeningStrength); + _console.RefreshShuttleConsoles(transform.GridUid.Value); + } + + public InertiaDampeningMode NfGetInertiaDampeningMode(EntityUid entity) + { + if (!EntityManager.TryGetComponent(entity, out var xform)) + return InertiaDampeningMode.Dampen; + + // Not a shuttle, shouldn't be togglable + if (!EntityManager.HasComponent(xform.GridUid) || + EntityManager.HasComponent(_station.GetOwningStation(xform.GridUid))) + return InertiaDampeningMode.Station; + + if (!EntityManager.TryGetComponent(xform.GridUid, out PhysicsComponent? physicsComponent)) + return InertiaDampeningMode.Dampen; + + if (physicsComponent.LinearDamping >= AnchorDampeningStrength) + return InertiaDampeningMode.Anchor; + else if (physicsComponent.LinearDamping <= SpaceFrictionStrength) + return InertiaDampeningMode.Off; + else + return InertiaDampeningMode.Dampen; + } + +} diff --git a/Content.Server/_NF/Station/Components/StationDampeningComponent.cs b/Content.Server/_NF/Station/Components/StationDampeningComponent.cs new file mode 100644 index 00000000000..f6e184077a9 --- /dev/null +++ b/Content.Server/_NF/Station/Components/StationDampeningComponent.cs @@ -0,0 +1,10 @@ +// New Frontiers - This file is licensed under AGPLv3 +// Copyright (c) 2024 New Frontiers Contributors +// See AGPLv3.txt for details. + +namespace Content.Server._NF.Station.Components; + +[RegisterComponent] +public sealed partial class StationDampeningComponent : Component +{ +} diff --git a/Content.Shared/Shuttles/BUIStates/NavInterfaceState.cs b/Content.Shared/Shuttles/BUIStates/NavInterfaceState.cs index a6f4c01657d..70716742dd2 100644 --- a/Content.Shared/Shuttles/BUIStates/NavInterfaceState.cs +++ b/Content.Shared/Shuttles/BUIStates/NavInterfaceState.cs @@ -1,5 +1,6 @@ using Robust.Shared.Map; using Robust.Shared.Serialization; +using Content.Shared._NF.Shuttles.Events; // Frontier - InertiaDampeningMode access namespace Content.Shared.Shuttles.BUIStates; @@ -20,16 +21,23 @@ public sealed class NavInterfaceState public Dictionary> Docks; + /// + /// Frontier - the state of the shuttle's inertial dampeners + /// + public InertiaDampeningMode DampeningMode; + public NavInterfaceState( float maxRange, NetCoordinates? coordinates, Angle? angle, - Dictionary> docks) + Dictionary> docks, + InertiaDampeningMode dampeningMode) // Frontier: add dampeningMode { MaxRange = maxRange; Coordinates = coordinates; Angle = angle; Docks = docks; + DampeningMode = dampeningMode; // Frontier } } diff --git a/Content.Shared/_NF/Shuttles/Events/SetInertiaDampeningRequest.cs b/Content.Shared/_NF/Shuttles/Events/SetInertiaDampeningRequest.cs new file mode 100644 index 00000000000..70d7dddabb5 --- /dev/null +++ b/Content.Shared/_NF/Shuttles/Events/SetInertiaDampeningRequest.cs @@ -0,0 +1,27 @@ +// New Frontiers - This file is licensed under AGPLv3 +// Copyright (c) 2024 New Frontiers Contributors +// See AGPLv3.txt for details. +using Robust.Shared.Serialization; + +namespace Content.Shared._NF.Shuttles.Events +{ + /// + /// Raised on the client when it wishes to change the inertial dampening of a ship. + /// + [Serializable, NetSerializable] + public sealed class SetInertiaDampeningRequest : BoundUserInterfaceMessage + { + public NetEntity? ShuttleEntityUid { get; set; } + public InertiaDampeningMode Mode { get; set; } + } + + [Serializable, NetSerializable] + public enum InertiaDampeningMode : byte + { + Off = 0, + Dampen = 1, + Anchor = 2, + Station = 3, // Reserved for station status, should not be used in requests. + Query = 255 // Reserved for requests - does not set the mode, only returns its state. + } +} diff --git a/Resources/Locale/en-US/_NF/shuttles/console.ftl b/Resources/Locale/en-US/_NF/shuttles/console.ftl new file mode 100644 index 00000000000..d518dc22130 --- /dev/null +++ b/Resources/Locale/en-US/_NF/shuttles/console.ftl @@ -0,0 +1,3 @@ +shuttle-console-inertia-dampener-off = Cruise +shuttle-console-inertia-dampener-dampen = Drive +shuttle-console-inertia-dampener-anchor = Park \ No newline at end of file