Skip to content

Commit

Permalink
Handle RSW events that uses time better.
Browse files Browse the repository at this point in the history
  • Loading branch information
slackydev committed Jan 17, 2023
1 parent bff67d3 commit 9b461c7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions osr/walker/walker.simba
Original file line number Diff line number Diff line change
Expand Up @@ -826,11 +826,19 @@ You will probably never need to call this directly but it can be used to take a
function TRSWalker.WalkFinalStep(PlayerPoint, WorldPoint: TPoint; WaitUntilDistance: Int32): Boolean;
var
MinimapPoint: TPoint;
event_time: Int64;
begin
event_time := GetTickCount();

// run events
if (@Self.OnWalkEvent <> nil) then
Self.OnWalkEvent(@Self, PlayerPoint, WorldPoint);
if (@Self.OnWalkEventEx <> nil) then
Self.OnWalkEventEx(@Self, PlayerPoint, WorldPoint);

// in case the events used a bit of time, while our character was moving towards a point, we have to update the current position.
if GetTickCount() - event_time > 100 then
PlayerPoint := Self.GetMyPos();

if not Self.Enabled then
Exit(True);
Expand Down Expand Up @@ -858,12 +866,20 @@ function TRSWalker.WalkStep(PlayerPoint, WorldPoint: TPoint): Boolean;
var
MinimapPoint: TPoint;
WaitUntilDistance: Int32;
event_time: Int64;
begin
event_time := GetTickCount();

// run events
if (@Self.OnWalkEvent <> nil) then
Self.OnWalkEvent(@Self, PlayerPoint, WorldPoint);
if (@Self.OnWalkEventEx <> nil) then
Self.OnWalkEventEx(@Self, PlayerPoint, WorldPoint);

// in case the events used a bit of time, while our character was moving towards a point, we have to update the current position.
if GetTickCount() - event_time > 100 then
PlayerPoint := Self.GetMyPos();

if not Self.Enabled then
Exit(True);

Expand Down

0 comments on commit 9b461c7

Please sign in to comment.