Skip to content

Commit 2b6ae10

Browse files
committed
Use NaiveMove directly in NaiveMoveTowards methods
1 parent 202e81e commit 2b6ae10

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/DashStates/DreamTunnelDash/DreamTunnelDash.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -415,23 +415,18 @@ static void UseInsteadIfDreamTunnelDashing<T>(ILCursor cursor, T cb) where T : D
415415
}
416416
}
417417

418-
// hopefully the tasers don't kill me for this
419418
private static void NaiveMoveTowardsX(Player player, float targetX, float maxAmount, Collision _)
420419
{
421420
float toX = Calc.Approach(player.ExactPosition.X, targetX, maxAmount);
422-
player.movementCounter.X += (float) ((double) toX - player.Position.X - player.movementCounter.X);
423-
int x = (int) Math.Round(player.movementCounter.X);
424-
player.Position.X += x;
425-
player.movementCounter.X -= x;
421+
float moveX = (float) ((double) toX - player.Position.X - player.movementCounter.X);
422+
player.NaiveMove(Vector2.UnitX * moveX);
426423
}
427424

428425
private static void NaiveMoveTowardsY(Player player, float targetY, float maxAmount, Collision _)
429426
{
430427
float toY = Calc.Approach(player.ExactPosition.Y, targetY, maxAmount);
431-
player.movementCounter.Y += (float) ((double) toY - player.Position.Y - player.movementCounter.Y);
432-
int y = (int) Math.Round(player.movementCounter.Y);
433-
player.Position.Y += y;
434-
player.movementCounter.Y -= y;
428+
float moveY = (float) ((double) toY - player.Position.Y - player.movementCounter.Y);
429+
player.NaiveMove(Vector2.UnitY * moveY);
435430
}
436431

437432
// Patch any method that checks the player's State

0 commit comments

Comments
 (0)