Optimise mob moverment a little bit (#12136)
This commit is contained in:
@@ -2,7 +2,6 @@ using Content.Shared.CCVar;
|
||||
using Content.Shared.Input;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Input.Binding;
|
||||
@@ -52,6 +51,7 @@ namespace Content.Shared.Movement.Systems
|
||||
SubscribeLocalEvent<InputMoverComponent, EntParentChangedMessage>(OnInputParentChange);
|
||||
|
||||
_configManager.OnValueChanged(CCVars.CameraRotationLocked, SetCameraRotationLocked, true);
|
||||
_configManager.OnValueChanged(CCVars.GameDiagonalMovement, SetDiagonalMovement, true);
|
||||
}
|
||||
|
||||
private void SetCameraRotationLocked(bool obj)
|
||||
@@ -97,9 +97,12 @@ namespace Content.Shared.Movement.Systems
|
||||
{
|
||||
CommandBinds.Unregister<SharedMoverController>();
|
||||
_configManager.UnsubValueChanged(CCVars.CameraRotationLocked, SetCameraRotationLocked);
|
||||
_configManager.UnsubValueChanged(CCVars.GameDiagonalMovement, SetDiagonalMovement);
|
||||
}
|
||||
|
||||
public bool DiagonalMovementEnabled => _configManager.GetCVar(CCVars.GameDiagonalMovement);
|
||||
public bool DiagonalMovementEnabled { get; private set; }
|
||||
|
||||
private void SetDiagonalMovement(bool value) => DiagonalMovementEnabled = value;
|
||||
|
||||
protected virtual void HandleShuttleInput(EntityUid uid, ShuttleButtons button, ushort subTick, bool state) {}
|
||||
|
||||
@@ -121,6 +124,16 @@ namespace Content.Shared.Movement.Systems
|
||||
Dirty(mover);
|
||||
}
|
||||
|
||||
public Angle GetParentGridAngle(InputMoverComponent mover, EntityQuery<TransformComponent> xformQuery)
|
||||
{
|
||||
var rotation = mover.RelativeRotation;
|
||||
|
||||
if (xformQuery.TryGetComponent(mover.RelativeEntity, out var relativeXform))
|
||||
return (_transform.GetWorldRotation(relativeXform, xformQuery) + rotation);
|
||||
|
||||
return rotation;
|
||||
}
|
||||
|
||||
public Angle GetParentGridAngle(InputMoverComponent mover)
|
||||
{
|
||||
var rotation = mover.RelativeRotation;
|
||||
|
||||
Reference in New Issue
Block a user