Game/AI: Implement option to move a creature back to Homeposition on Evade. (#24492)

* Game/AI: Implement option to move a creature back to Homeposition on Evade.

* If ToHomePosition (action param 1) is 1 > Move to last stored position
* If ToHomePosition (action param 1) is 0 > Move to homeposition
* Ref: https://github.com/TrinityCore/TrinityCore/issues/24226

* Add parameter for walkmode

* Game/AI: SAI SMART_ACTION_EVADE - Rename ToHomePosition to ToRespawnPosition and store point from GetRespawnPosition.

* Game/AI: SAI SMART_ACTION_EVADE - Rename ToHomePosition to ToRespawnPosition

* Remove broken bits, simplify the code

* Update comments

* Code cleanup

Co-authored-by: jackpoz <[email protected]>
(cherry picked from commit 02fca032e1d497be08681de0bfd7bca979f0dafd)
This commit is contained in:
Rushor
2022-02-05 22:51:52 +01:00
committed by Shauren
parent 9fe5a7297d
commit dfeb8c267f
2 changed files with 14 additions and 1 deletions
@@ -836,6 +836,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!me)
break;
// Reset home position to respawn position if specified in the parameters
if (e.action.evade.toRespawnPosition == 0)
{
float homeX, homeY, homeZ, homeO;
me->GetRespawnPosition(homeX, homeY, homeZ, &homeO);
me->SetHomePosition(homeX, homeY, homeZ, homeO);
}
me->AI()->EnterEvadeMode();
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_EVADE: Creature %s EnterEvadeMode", me->GetGUID().ToString().c_str());
break;