Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: changed the way to control DisableMovement.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jul 12, 2023
1 parent 9573440 commit 27324a3
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion RotationSolver.Basic/Service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,26 @@ internal class Service
[Signature("F3 0F 10 05 ?? ?? ?? ?? 0F 2E C6 0F 8A", ScanType = ScanType.StaticAddress, Fallibility = Fallibility.Infallible)]
static IntPtr forceDisableMovementPtr;
private static unsafe ref int ForceDisableMovement => ref *(int*)(forceDisableMovementPtr + 4);

static bool _canMove = true;
internal static unsafe bool CanMove
{
get => ForceDisableMovement == 0;
set => ForceDisableMovement = value || DataCenter.NoPoslock ? 0 : 1;
set
{
var realCanMove = value || DataCenter.NoPoslock;
if (_canMove == realCanMove) return;
_canMove = realCanMove;

if (!realCanMove)
{
ForceDisableMovement++;
}
else if(ForceDisableMovement > 0)
{
ForceDisableMovement--;
}
}
}

public static float CountDownTime => Countdown.TimeRemaining;
Expand Down

0 comments on commit 27324a3

Please sign in to comment.