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

Issue20373 aicraft hangs midair #20406

Merged
merged 1 commit into from
Nov 17, 2022

Conversation

ThomasChr
Copy link
Contributor

@ThomasChr ThomasChr commented Oct 27, 2022

Fixes #20373

CancelActivity() leads to an Aircraft which stands midair if the IdleBehavior is set to ReturnToBase. Copters can do that, Aicrafts can't.

So I let the aircraft start it's idle activity, this will fix standing in midair.
To make sure that I don't start idle activity on the ground I test if the aircraft is moving (flying) and only start idle if it really is flying.
I wanted to prevent something like idle activity on the airfield.

@ThomasChr ThomasChr force-pushed the issue20373_aicraft_hangs_midair branch 3 times, most recently from 8e07d6b to 3664c7e Compare November 1, 2022 14:55
@ThomasChr
Copy link
Contributor Author

Rebased on bleed to keep it hot and fresh.

@AspectInteractive2
Copy link
Contributor

To make sure that I don't start idle activity on the ground I test if the aircraft is moving (flying) and only start idle if it really is flying. I wanted to prevent something like idle activity on the airfield.

From what I understand planes cannot land on the ground, only on an airfield, and the code above the edit you made already checks for whether an airfield is available. Therefore it would not be possible for the aircraft to be on the ground unless an airfield was available, making the MovementSpeed check redundant. So I would remove the If altogether along with its else clause and only keep the line with FlyIdle.

Separately, for the number of ticks we shouldn't be putting a fixed number such as 25. The number in the above code makes sense, aircraft.Info.NumberOfTicksToVerifyAvailableAirport (currently set to 150), since this is the standard amount of ticks to wait before checking for another airport (see below code snippet).

[Desc("The number of ticks that a airplane will wait to make a new search for an available airport.")]
public readonly int NumberOfTicksToVerifyAvailableAirport = 150;

@ThomasChr ThomasChr force-pushed the issue20373_aicraft_hangs_midair branch from 3664c7e to bfb34bf Compare November 12, 2022 12:06
@ThomasChr
Copy link
Contributor Author

@AspectInteractive2 Thanks for your insight. Now there are no magic numbers anymore :-)

@AspectInteractive2
Copy link
Contributor

Seems to work and the code looks right, particularly as we shouldn't be using CancelActivity() if we can avoid it. Only concern now is if this breaks any existing functionality, though that will require a playtest I am guessing.

@PunkPun PunkPun merged commit bd882c9 into OpenRA:bleed Nov 17, 2022
@PunkPun
Copy link
Member

PunkPun commented Nov 17, 2022

Changelog

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

Successfully merging this pull request may close these issues.

Aircraft with IdleBehavior: ReturnToBase hang midair when last actor they can return to gets sold
3 participants