[10431] Correcting issues with flying creatures falling to ground at death.

Simplified the way FallGround works and death states are set in a more logical way when a mob is in fact DEAD_FALLING.
Visual will in some cases not be correct. Notes in code for details.

Thanks to Lynx fixing Map::GetHeight
It now return mapHeight as last resort, making FallGround work as expected.
This fix reveal one (known) bug, and therefore a temp hack is added in TargetedMovegen, to be sure Z is not the ground Z for a creature that are able to fly.
Other creatures will follow by the ground level Z (in other words, they will no longer follow in the air).
This commit is contained in:
NoFantasy 2010-09-01 00:30:45 +02:00
parent 7df3f06d87
commit 32e3e252fb
6 changed files with 57 additions and 28 deletions

View file

@ -74,6 +74,12 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T &owner)
if( i_destinationHolder.HasDestination() && i_destinationHolder.GetDestinationDiff(x,y,z) < bothObjectSize )
return;
*/
// Just a temp hack, GetContactPoint/GetClosePoint in above code use UpdateGroundPositionZ (in GetNearPoint)
// and then has the wrong z to use when creature try follow unit in the air.
if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->canFly())
z = i_target->GetPositionZ();
Traveller<T> traveller(owner);
i_destinationHolder.SetDestination(traveller, x, y, z);