diff --git a/Content.Client/Buckle/BuckleSystem.cs b/Content.Client/Buckle/BuckleSystem.cs index e558ab70af..90f13f3854 100644 --- a/Content.Client/Buckle/BuckleSystem.cs +++ b/Content.Client/Buckle/BuckleSystem.cs @@ -1,9 +1,26 @@ +using Content.Client.Buckle.Strap; using Content.Shared.Buckle; +using Content.Shared.Buckle.Components; +using Robust.Shared.GameStates; namespace Content.Client.Buckle { internal sealed class BuckleSystem : SharedBuckleSystem { + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnStrapHandleState); + } + private void OnStrapHandleState(EntityUid uid, StrapComponent component, ref ComponentHandleState args) + { + if (args.Current is not StrapComponentState state) return; + component.Position = state.Position; + component.BuckleOffsetUnclamped = state.BuckleOffsetClamped; + component.BuckledEntities.Clear(); + component.BuckledEntities.UnionWith(state.BuckledEntities); + component.MaxBuckleDistance = state.MaxBuckleDistance; + } } } diff --git a/Content.Client/Buckle/Strap/StrapComponent.cs b/Content.Client/Buckle/Strap/StrapComponent.cs index 27da0cfe3e..efdc42fe8f 100644 --- a/Content.Client/Buckle/Strap/StrapComponent.cs +++ b/Content.Client/Buckle/Strap/StrapComponent.cs @@ -1,6 +1,5 @@ using Content.Shared.Buckle.Components; using Content.Shared.DragDrop; -using Robust.Shared.GameObjects; namespace Content.Client.Buckle.Strap { diff --git a/Content.Client/EscapeMenu/UI/Tabs/KeyRebindTab.xaml.cs b/Content.Client/EscapeMenu/UI/Tabs/KeyRebindTab.xaml.cs index 56b038a7b0..d1045b6cce 100644 --- a/Content.Client/EscapeMenu/UI/Tabs/KeyRebindTab.xaml.cs +++ b/Content.Client/EscapeMenu/UI/Tabs/KeyRebindTab.xaml.cs @@ -172,6 +172,15 @@ namespace Content.Client.EscapeMenu.UI.Tabs AddButton(ContentKeyFunctions.Loadout8); AddButton(ContentKeyFunctions.Loadout9); + AddHeader("ui-options-header-shuttle"); + AddButton(ContentKeyFunctions.ShuttleStrafeUp); + AddButton(ContentKeyFunctions.ShuttleStrafeRight); + AddButton(ContentKeyFunctions.ShuttleStrafeLeft); + AddButton(ContentKeyFunctions.ShuttleStrafeDown); + AddButton(ContentKeyFunctions.ShuttleRotateLeft); + AddButton(ContentKeyFunctions.ShuttleRotateRight); + AddButton(ContentKeyFunctions.ShuttleBrake); + AddHeader("ui-options-header-map-editor"); AddButton(EngineKeyFunctions.EditorPlaceObject); AddButton(EngineKeyFunctions.EditorCancelPlace); diff --git a/Content.Client/Eye/EyeLerpingSystem.cs b/Content.Client/Eye/EyeLerpingSystem.cs index f687005f46..7befae2fb6 100644 --- a/Content.Client/Eye/EyeLerpingSystem.cs +++ b/Content.Client/Eye/EyeLerpingSystem.cs @@ -94,7 +94,7 @@ public sealed class EyeLerpingSystem : EntitySystem return; // We can't lerp if the mob can't move! - if (!TryComp(mob, out IMoverComponent? mover)) + if (!TryComp(mob, out InputMoverComponent? mover)) return; LerpEye(_eyeManager.CurrentEye, frameTime, mover.LastGridAngle, _playerActiveEye); diff --git a/Content.Client/Input/ContentContexts.cs b/Content.Client/Input/ContentContexts.cs index 2c588a9a29..fe46cf4c26 100644 --- a/Content.Client/Input/ContentContexts.cs +++ b/Content.Client/Input/ContentContexts.cs @@ -33,6 +33,11 @@ namespace Content.Client.Input common.AddFunction(ContentKeyFunctions.EditorCopyObject); var human = contexts.GetContext("human"); + human.AddFunction(EngineKeyFunctions.MoveUp); + human.AddFunction(EngineKeyFunctions.MoveDown); + human.AddFunction(EngineKeyFunctions.MoveLeft); + human.AddFunction(EngineKeyFunctions.MoveRight); + human.AddFunction(EngineKeyFunctions.Walk); human.AddFunction(ContentKeyFunctions.SwapHands); human.AddFunction(ContentKeyFunctions.Drop); human.AddFunction(ContentKeyFunctions.UseItemInHand); @@ -89,7 +94,7 @@ namespace Content.Client.Input aghost.AddFunction(ContentKeyFunctions.Drop); aghost.AddFunction(ContentKeyFunctions.ThrowItemInHand); - var ghost = contexts.New("ghost", "common"); + var ghost = contexts.New("ghost", "human"); ghost.AddFunction(EngineKeyFunctions.MoveUp); ghost.AddFunction(EngineKeyFunctions.MoveDown); ghost.AddFunction(EngineKeyFunctions.MoveLeft); diff --git a/Content.Client/Physics/Controllers/MoverController.cs b/Content.Client/Physics/Controllers/MoverController.cs index 6db507f00e..6a75df3364 100644 --- a/Content.Client/Physics/Controllers/MoverController.cs +++ b/Content.Client/Physics/Controllers/MoverController.cs @@ -1,10 +1,7 @@ -using Content.Shared.MobState.Components; -using Content.Shared.Movement; using Content.Shared.Movement.Components; using Content.Shared.Movement.Systems; using Content.Shared.Pulling.Components; using Robust.Client.Player; -using Robust.Shared.Map; using Robust.Shared.Physics; using Robust.Shared.Player; using Robust.Shared.Timing; @@ -20,10 +17,32 @@ namespace Content.Client.Physics.Controllers { base.UpdateBeforeSolve(prediction, frameTime); - if (_playerManager.LocalPlayer?.ControlledEntity is not {Valid: true} player || - !TryComp(player, out IMoverComponent? mover) || - !TryComp(player, out PhysicsComponent? body) || - !TryComp(player, out TransformComponent? xform)) + if (_playerManager.LocalPlayer?.ControlledEntity is not {Valid: true} player) + return; + + if (TryComp(player, out var relayMover)) + { + if (relayMover.RelayEntity != null) + HandleClientsideMovement(relayMover.RelayEntity.Value, frameTime); + + return; + } + + HandleClientsideMovement(player, frameTime); + } + + private void HandleClientsideMovement(EntityUid player, float frameTime) + { + if (!TryComp(player, out InputMoverComponent? mover) || + !TryComp(player, out TransformComponent? xform)) return; + + PhysicsComponent? body = null; + + if (mover.ToParent && HasComp(xform.ParentUid)) + { + if (!TryComp(xform.ParentUid, out body)) return; + } + else if (!TryComp(player, out body)) { return; } @@ -65,13 +84,7 @@ namespace Content.Client.Physics.Controllers } // Server-side should just be handled on its own so we'll just do this shizznit - if (TryComp(player, out IMobMoverComponent? mobMover)) - { - HandleMobMovement(mover, body, mobMover, xform, frameTime); - return; - } - - HandleKinematicMovement(mover, body); + HandleMobMovement(mover, body, xform, frameTime); } protected override Filter GetSoundPlayers(EntityUid mover) diff --git a/Content.Client/Shuttles/BUI/ShuttleConsoleBoundUserInterface.cs b/Content.Client/Shuttles/BUI/ShuttleConsoleBoundUserInterface.cs index 63f71f8dc2..d405658420 100644 --- a/Content.Client/Shuttles/BUI/ShuttleConsoleBoundUserInterface.cs +++ b/Content.Client/Shuttles/BUI/ShuttleConsoleBoundUserInterface.cs @@ -18,7 +18,6 @@ public sealed class ShuttleConsoleBoundUserInterface : BoundUserInterface { base.Open(); _window = new ShuttleConsoleWindow(); - _window.ShuttleModePressed += OnShuttleModePressed; _window.UndockPressed += OnUndockPressed; _window.StartAutodockPressed += OnAutodockPressed; _window.StopAutodockPressed += OnStopAutodockPressed; @@ -65,11 +64,6 @@ public sealed class ShuttleConsoleBoundUserInterface : BoundUserInterface SendMessage(new UndockRequestMessage() {DockEntity = obj}); } - private void OnShuttleModePressed(ShuttleMode obj) - { - SendMessage(new ShuttleModeRequestMessage() {Mode = obj}); - } - protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); diff --git a/Content.Client/Shuttles/Systems/ShuttleConsoleSystem.cs b/Content.Client/Shuttles/Systems/ShuttleConsoleSystem.cs index 7ae419c358..f9e01c09fd 100644 --- a/Content.Client/Shuttles/Systems/ShuttleConsoleSystem.cs +++ b/Content.Client/Shuttles/Systems/ShuttleConsoleSystem.cs @@ -1,16 +1,43 @@ +using Content.Shared.Input; using Content.Shared.Shuttles.Components; -using Content.Shared.Shuttles.Events; using Content.Shared.Shuttles.Systems; +using Robust.Client.Input; +using Robust.Client.Player; using Robust.Shared.GameStates; namespace Content.Client.Shuttles.Systems { public sealed class ShuttleConsoleSystem : SharedShuttleConsoleSystem { + [Dependency] private readonly IInputManager _input = default!; + [Dependency] private readonly IPlayerManager _playerManager = default!; + public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnHandleState); + var shuttle = _input.Contexts.New("shuttle", "common"); + shuttle.AddFunction(ContentKeyFunctions.ShuttleStrafeUp); + shuttle.AddFunction(ContentKeyFunctions.ShuttleStrafeDown); + shuttle.AddFunction(ContentKeyFunctions.ShuttleStrafeLeft); + shuttle.AddFunction(ContentKeyFunctions.ShuttleStrafeRight); + shuttle.AddFunction(ContentKeyFunctions.ShuttleRotateLeft); + shuttle.AddFunction(ContentKeyFunctions.ShuttleRotateRight); + shuttle.AddFunction(ContentKeyFunctions.ShuttleBrake); + } + + public override void Shutdown() + { + base.Shutdown(); + _input.Contexts.Remove("shuttle"); + } + + protected override void HandlePilotShutdown(EntityUid uid, PilotComponent component, ComponentShutdown args) + { + base.HandlePilotShutdown(uid, component, args); + if (_playerManager.LocalPlayer?.ControlledEntity != uid) return; + + _input.Contexts.SetActiveContext("human"); } private void OnHandleState(EntityUid uid, PilotComponent component, ref ComponentHandleState args) @@ -21,6 +48,7 @@ namespace Content.Client.Shuttles.Systems if (!console.IsValid()) { component.Console = null; + _input.Contexts.SetActiveContext("human"); return; } @@ -32,6 +60,7 @@ namespace Content.Client.Shuttles.Systems component.Console = shuttleConsoleComponent; ActionBlockerSystem.UpdateCanMove(uid); + _input.Contexts.SetActiveContext("shuttle"); } } } diff --git a/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml b/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml index 548c136d0a..fe80948aa8 100644 --- a/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml +++ b/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml @@ -83,10 +83,6 @@ Align="Right"/> -