The real movement refactor (#9645)
* The real movement refactor * ref events * Jetpack cleanup * a * Vehicles partially working * Balance tweaks * Restore some shitcode * AAAAAAAA * Even more prediction * ECS compstate trying to fix this * yml * vehicles kill me * Don't lock keys * a * Fix problem * Fix sounds * shuttle inputs * Shuttle controls * space brakes * Keybinds * Fix merge * Handle shutdown * Fix keys * Bump friction * fix buckle offset * Fix relay and friction * Fix jetpack turning * contexts amirite
This commit is contained in:
@@ -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<PilotComponent, ComponentHandleState>(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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user