Skip to content

Fix the inaccuracy used when lock on in Missile.#21040

Merged
PunkPun merged 1 commit into
OpenRA:bleedfrom
dnqbob:lockon
Sep 8, 2023
Merged

Fix the inaccuracy used when lock on in Missile.#21040
PunkPun merged 1 commit into
OpenRA:bleedfrom
dnqbob:lockon

Conversation

@dnqbob
Copy link
Copy Markdown
Contributor

@dnqbob dnqbob commented Sep 7, 2023

Fix regression from #18009

It should be just an oversight

@PunkPun
Copy link
Copy Markdown
Member

PunkPun commented Sep 8, 2023

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

@dnqbob
Copy link
Copy Markdown
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
Copy Markdown
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
@PunkPun
Copy link
Copy Markdown
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.

2 participants