Core/Entities: unit states cleanup

Port From (https://github.com/TrinityCore/TrinityCore/commit/70c26d53cb94f0e78a57ecc2279c960370891aa4)
This commit is contained in:
hondacrx
2021-08-08 23:44:54 -04:00
parent 26a2eced6e
commit b039353f1a
5 changed files with 51 additions and 39 deletions
+7 -2
View File
@@ -441,6 +441,8 @@ namespace Game.Entities
break;
}
}
AddUnitState(UnitState.Charmed);
return true;
}
@@ -542,8 +544,7 @@ namespace Game.Entities
IsAIEnabled = false;
}
if (!HasUnitState(UnitState.LostControl))
player.SetClientControl(this, true);
player.SetClientControl(this, true);
}
EngageWithTarget(charmer);
@@ -553,6 +554,10 @@ namespace Game.Entities
playerCharmer.SendRemoveControlBar();
else if (IsTypeId(TypeId.Player) || (IsTypeId(TypeId.Unit) && !IsGuardian()))
DeleteCharmInfo();
// reset confused movement for example
ApplyControlStatesIfNeeded();
ClearUnitState(UnitState.Charmed);
}
public void GetAllMinionsByEntry(List<TempSummon> Minions, uint entry)