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:
@@ -0,0 +1,43 @@
|
||||
using Content.Shared.Movement.Components;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Movement.Systems;
|
||||
|
||||
public abstract partial class SharedMoverController
|
||||
{
|
||||
private void InitializeRelay()
|
||||
{
|
||||
SubscribeLocalEvent<RelayInputMoverComponent, ComponentGetState>(OnRelayGetState);
|
||||
SubscribeLocalEvent<RelayInputMoverComponent, ComponentHandleState>(OnRelayHandleState);
|
||||
SubscribeLocalEvent<RelayInputMoverComponent, ComponentShutdown>(OnRelayShutdown);
|
||||
}
|
||||
|
||||
private void OnRelayShutdown(EntityUid uid, RelayInputMoverComponent component, ComponentShutdown args)
|
||||
{
|
||||
// If relay is removed then cancel all inputs.
|
||||
if (!TryComp<InputMoverComponent>(component.RelayEntity, out var inputMover)) return;
|
||||
SetMoveInput(inputMover, MoveButtons.None);
|
||||
}
|
||||
|
||||
private void OnRelayHandleState(EntityUid uid, RelayInputMoverComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not RelayInputMoverComponentState state) return;
|
||||
|
||||
component.RelayEntity = state.Entity;
|
||||
}
|
||||
|
||||
private void OnRelayGetState(EntityUid uid, RelayInputMoverComponent component, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new RelayInputMoverComponentState()
|
||||
{
|
||||
Entity = component.RelayEntity,
|
||||
};
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
private sealed class RelayInputMoverComponentState : ComponentState
|
||||
{
|
||||
public EntityUid? Entity;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user