Random spontaneous cleanup PR (#25131)
* Use new Subs.CVar helper Removes manual config OnValueChanged calls, removes need to remember to manually unsubscribe. This both reduces boilerplate and fixes many issues where subscriptions weren't removed on entity system shutdown. * Fix a bunch of warnings * More warning fixes * Use new DateTime serializer to get rid of ISerializationHooks in changelog code. * Get rid of some more ISerializationHooks for enums * And a little more * Apply suggestions from code review Co-authored-by: 0x6273 <0x40@keemail.me> --------- Co-authored-by: 0x6273 <0x40@keemail.me>
This commit is contained in:
committed by
GitHub
parent
d0c174388c
commit
68ce53ae17
@@ -57,13 +57,8 @@ namespace Content.Shared.Movement.Systems
|
||||
|
||||
SubscribeLocalEvent<FollowedComponent, EntParentChangedMessage>(OnFollowedParentChange);
|
||||
|
||||
_configManager.OnValueChanged(CCVars.CameraRotationLocked, SetCameraRotationLocked, true);
|
||||
_configManager.OnValueChanged(CCVars.GameDiagonalMovement, SetDiagonalMovement, true);
|
||||
}
|
||||
|
||||
private void SetCameraRotationLocked(bool obj)
|
||||
{
|
||||
CameraRotationLocked = obj;
|
||||
Subs.CVar(_configManager, CCVars.CameraRotationLocked, obj => CameraRotationLocked = obj, true);
|
||||
Subs.CVar(_configManager, CCVars.GameDiagonalMovement, value => DiagonalMovementEnabled = value, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -141,14 +136,10 @@ namespace Content.Shared.Movement.Systems
|
||||
private void ShutdownInput()
|
||||
{
|
||||
CommandBinds.Unregister<SharedMoverController>();
|
||||
_configManager.UnsubValueChanged(CCVars.CameraRotationLocked, SetCameraRotationLocked);
|
||||
_configManager.UnsubValueChanged(CCVars.GameDiagonalMovement, SetDiagonalMovement);
|
||||
}
|
||||
|
||||
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) {}
|
||||
|
||||
private void OnAutoParentChange(EntityUid uid, AutoOrientComponent component, ref EntParentChangedMessage args)
|
||||
|
||||
Reference in New Issue
Block a user