Core/Objects: cache current liquid status of objects when updating position data and use it to replace unnecessary vmap lookups

Port From (https://github.com/TrinityCore/TrinityCore/commit/d18d2b84f2c3e6e1005316625da80c99dd414bcc)
This commit is contained in:
hondacrx
2022-02-17 16:55:41 -05:00
parent abf34c53b4
commit 5bd2878a4e
5 changed files with 32 additions and 56 deletions
-24
View File
@@ -1914,30 +1914,6 @@ namespace Game.Entities
return startLevel;
}
public override bool IsUnderWater()
{
return IsInWater() &&
GetPositionZ() < (GetMap().GetWaterLevel(GetPhaseShift(), GetPositionX(), GetPositionY()) - 2);
}
public override bool IsInWater()
{
return m_isInWater;
}
public override void SetInWater(bool inWater)
{
if (m_isInWater == inWater)
return;
//define player in water by opcodes
//move player's guid into HateOfflineList of those mobs
//which can't swim and move guid back into ThreatList when
//on surface.
// @todo exist also swimming mobs, and function must be symmetric to enter/leave water
m_isInWater = inWater;
// Call base
base.SetInWater(inWater);
}
public void ValidateMovementInfo(MovementInfo mi)
{
var RemoveViolatingFlags = new Action<bool, MovementFlag>((check, maskToRemove) =>