fix(Core/Unit): Invalidate update object cache when changing health in the same world update tick. (#19287)

* fix(Core/Unit): Invalidate update object cache when changing health in the same world update tick.

Should fix an issue when the client sees dead NPCs when they are not.

* Fix styling

* Another codestyle fix
This commit is contained in:
Anton Popovichenko
2024-07-05 20:42:22 +02:00
committed by GitHub
parent 9453bfbad2
commit 04acfd96a0
2 changed files with 16 additions and 0 deletions

View File

@@ -21628,6 +21628,20 @@ bool Unit::IsInDisallowedMountForm() const
return false;
}
void Unit::SetUInt32Value(uint16 index, uint32 value)
{
Object::SetUInt32Value(index, value);
switch (index)
{
// Invalidating the cache on health change should fix an issue where the client sees dead NPCs when they are not.
// We might also need to invalidate the cache for some other fields as well.
case UNIT_FIELD_HEALTH:
InvalidateValuesUpdateCache();
break;
}
}
std::string Unit::GetDebugInfo() const
{
std::stringstream sstr;