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 the inaccuracy used when lock on in Missile. #21040

Merged
merged 1 commit into from Sep 8, 2023
Merged

Conversation

dnqbob
Copy link
Contributor

@dnqbob dnqbob commented Sep 7, 2023

Fix regression from #18009

It should be just an oversight

@PunkPun
Copy link
Member

PunkPun commented Sep 8, 2023

Looks like it was done this way for every projectile on purpose 76dfda1

@dnqbob
Copy link
Contributor Author

dnqbob commented Sep 8, 2023

No, this PR is not related to change standalone inaccuracy to util, it is related to an oversight in 76dfda1.

			var inaccuracy = lockOn && info.LockOnInaccuracy.Length > -1 ? info.LockOnInaccuracy.Length : info.Inaccuracy.Length;

			if (inaccuracy > 0)
			{
				inaccuracy = Util.ApplyPercentageModifiers(inaccuracy, args.InaccuracyModifiers);

				var maxOffset = 0;
				switch (info.InaccuracyType)
				{
					case InaccuracyType.Maximum:
						maxOffset = inaccuracy * (targetPosition - pos).Length / args.Weapon.Range.Length;
						break;
					case InaccuracyType.PerCellIncrement:
						maxOffset = inaccuracy * (targetPosition - pos).Length / 1024;
						break;
					case InaccuracyType.Absolute:
						maxOffset = inaccuracy;
						break;
				}
			var inaccuracy = lockOn && info.LockOnInaccuracy.Length > -1 ? info.LockOnInaccuracy.Length : info.Inaccuracy.Length;

			var maxInaccuracyOffset = Util.GetProjectileInaccuracy(info.Inaccuracy.Length, info.InaccuracyType, args);
			offset = WVec.FromPDF(world.SharedRandom, 2) * maxInaccuracyOffset / 1024;
``

@dnqbob
Copy link
Contributor Author

dnqbob commented Sep 8, 2023

You can see in old code of 76dfda1,
Missile should use LockOnInaccuracy when lock on, and use Inaccuracy when it does not lock on, while the change in 76dfda1 make the missile all use Inaccuracy no matter it locks on or not. I think the author just simply make a mistake on this one.

@PunkPun PunkPun merged commit 5b0f69b into OpenRA:bleed Sep 8, 2023
3 checks passed
@PunkPun
Copy link
Member

PunkPun commented Sep 8, 2023

Changelog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants