Page MenuHomeWildfire Games

Unit Motion - make sure units that die while moving don't keep their obstruction
ClosedPublic

Authored by wraitii on Jul 10 2019, 8:35 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP22451: Unit Motion - make sure units that die while moving don't keep their obstruction
Summary

Introduced by rP22355.

As said on irc:

15:14 < wraitii> The issue is that cmpObstruction registers and obstruction shape when the entity gets a valid position, and deletes it when it moves out of the world
15:15 < wraitii> So when MT_Destroy is sent
15:15 < wraitii> we go through Obstruction->OnDestroy, which clears the shapee as expected
15:16 < wraitii> Then we go through UnitAI->OnDestroy, which calls the "leave" handlers of the states, some of which call StopMoving(), which succeeds if cmpUnitMotion still exists (it does), which calls "FaceToPoint", which advertises a position change
15:16 < wraitii> Which puts us in Obstruction->OnPositionChanged, which notices we don't have an obstruction, and recreates an obstruction shape
15:16 < wraitii> which is perfectly logical behaviour, but ends up meaning that units in movement keep their obstruction shape when they die, which is obviously broken

A more general fix might be to stop receiving messages when an entity starts being destroyed, but that sounds more likely to break everything so I will consider this later.

Test Plan

Notice how units that die while walking no longer keep their obstruction

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/23/display/redirect

This revision was not accepted when it landed; it landed in state Needs Review.Jul 10 2019, 8:43 PM
This revision was automatically updated to reflect the committed changes.