Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Pryaxis/TShock#3073 #3076

Merged
merged 2 commits into from
Mar 18, 2025
Merged

Fix Pryaxis/TShock#3073 #3076

merged 2 commits into from
Mar 18, 2025

Conversation

sgkoishi
Copy link
Member

@sgkoishi sgkoishi commented Mar 18, 2025

This is a vanilla bug.

Some projectiles move in a way that depends on the position of the player, and they try to compute their 'direction' relative to the player, for example, player.Center - projectile.Center.

The Counterweight appears to use player.Center as its default position, and it also calculates the direction (rotating), which is { X: 0, Y: 0 }. Zero vector can't be normalized and attempt to normalize it will result in { X: NaN, Y: NaN } - so the velocity and position are messed up because NaN values were added to them.

See also:

  • Terraria.Player.Counterweight()
  • Terraria.Projectile.HandleMovement() && aiStyle == 99

@hakusaro hakusaro enabled auto-merge March 18, 2025 08:04
@hakusaro hakusaro merged commit 99e37cc into Pryaxis:general-devel Mar 18, 2025
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When I fight with goblin invasion, TShock Server always kick me very often and many times
2 participants