This is the safest approach to avoid animation conflicts/visual glitches when the 'host' is responsible for both resupply types.
The new WithResupplyAnimation trait will simply play a looping animation as long as the actor is resupplying in any form.

As a byproduct, this makes the repair/reload animations look more like in the originals and less erratic.
We don't have a WithRearmOverlay yet, so I'll leave a refactor of WithRepairOverlay for later.

This comment has been minimized.

edited

Basically, the ultimate goal of this PR, #14357 which it was split from and the PR(s) that will follow, is to allow actors to be reloaded and repaired at the same time (right now on bleed, actors that need both will be rearmed first, then repaired, as both are separate activities that are queued in Repairable).

The problem is that on bleed, the reload/repair animation (of the building) is played once on every repair/reload step, instead of just looping continuously.
So if repairing and rearming happened in parallel, depending on their interval it's possible that a repair step happens just a tick after a rearm step, resulting in restarting the service depot animation before the last one finished.
This is also already an issue with rearming or repairing when the resupply interval is shorter than the animation, as in that case it restarts prematurely as well.

This PR simply makes the resupply animations of helipads, service depots and so on loop at consistent speed as long as the building is either repairing or rearming (or both) some actor.

By the way, this also makes the animations look more like in the original, where the animation speed wasn't tied to the repair/reload speed, either, making it look less hectic.

It appears that if an actor dies while an activity is active, it will be disposed before the activities' TickOuter can tick one last time, so OnLastRun is never triggered.
As OpenRA#15543 showed this can lead to some nasty bugs.
This commit makes Activity.Cancel run OnLastRun directly if the actor IsDead when the cancel is triggered.

It appears that if an actor dies while an activity is active, it will be disposed before the activities' TickOuter can tick one last time, so OnLastRun is never triggered.
As OpenRA#15543 showed this can lead to some nasty bugs.
This commit enforces a proper activity end on actor death/disposal.

This comment has been minimized.

edited

Rebased onto updated #15622 and fixed that ResupplyAircraft only notified INotifyRepair (unconditionally).
It now checks which of the (Child-)activities was running on disposal and then notifies the correct interface accordingly.

This is the safest approach to avoid conflicts/visual glitches when the host is responsible for both resupply types.
The new trait will simply play a looping animation as long as the actor is resupplying in any form.

Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.