Skip to content

Commit

Permalink
Prevent 'double warp' which can break the game
Browse files Browse the repository at this point in the history
  • Loading branch information
j committed Jul 11, 2024
1 parent 9d0ee17 commit 3c375b5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -844,12 +844,17 @@ private void savePos(object sender, RoutedEventArgs e)
restorePosButton.IsEnabled = true;
}

bool inWarp = false;

void doGlobalTP((float, float, float, float, uint) pos)
{//TODO: move this into erprocess
if (inWarp) { return; } //block trying to warp multiple times at once as this can break the game
inWarp = true;
var mapCoordsNow = _process.getMapCoords();
if (pos.Item5 == mapCoordsNow.Item5)
{//same map region. don't attempt warp.
_process.teleportToGlobal(pos);
inWarp = false;
return;
}

Expand Down Expand Up @@ -878,6 +883,7 @@ void doGlobalTP((float, float, float, float, uint) pos)
{
chkPlayerNoGrav.IsChecked = noGravState;
chkPlayerNoDeath.IsChecked = noDeathState;
inWarp = false;
});
});
t.Start();
Expand Down

0 comments on commit 3c375b5

Please sign in to comment.