mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
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 <giacomopoz@gmail.com>
This commit is contained in:
@@ -822,6 +822,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;
|
||||
|
||||
@@ -480,7 +480,7 @@ enum SMART_ACTION
|
||||
SMART_ACTION_ALLOW_COMBAT_MOVEMENT = 21, // AllowCombatMovement (0 = stop combat based movement, anything else continue attacking)
|
||||
SMART_ACTION_SET_EVENT_PHASE = 22, // Phase
|
||||
SMART_ACTION_INC_EVENT_PHASE = 23, // Value (may be negative to decrement phase, should not be 0)
|
||||
SMART_ACTION_EVADE = 24, // No Params
|
||||
SMART_ACTION_EVADE = 24, // toRespawnPosition (0 = Move to RespawnPosition, 1 = Move to last stored home position)
|
||||
SMART_ACTION_FLEE_FOR_ASSIST = 25, // With Emote
|
||||
SMART_ACTION_CALL_GROUPEVENTHAPPENS = 26, // QuestID
|
||||
SMART_ACTION_COMBAT_STOP = 27, //
|
||||
@@ -1177,6 +1177,11 @@ struct SmartAction
|
||||
uint32 intensity;
|
||||
} overrideWeather;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 toRespawnPosition;
|
||||
} evade;
|
||||
|
||||
//! Note for any new future actions
|
||||
//! All parameters must have type uint32
|
||||
|
||||
|
||||
Reference in New Issue
Block a user