mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-23 23:20:09 -04:00
Core/SAI: Improved SMART_ACTION_JUMP_TO_POS to mirror behavior similar to SMART_ACTION_MOVE_TO_POS (#28547)
* Support for targets other than positions * Added param3 Gravity, to use MoveJumpWithGravity (priority over SpeedZ) * Added param4 UseDefaultGravity (priority over Gravity): 19.29110527038574 * Added param5 PointId, useful for linking the jump to the event SMART_EVENT_MOVEMENTINFORM (Type: 16) * Added param6 ContactDistance * If the target is different from a position, target params for coords allow to add offsets
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "Log.h"
|
||||
#include "Map.h"
|
||||
#include "MotionMaster.h"
|
||||
#include "MovementTypedefs.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "PhasingHandler.h"
|
||||
@@ -1850,9 +1851,29 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
}
|
||||
case SMART_ACTION_JUMP_TO_POS:
|
||||
{
|
||||
for (WorldObject* target : targets)
|
||||
if (Creature* creature = target->ToCreature())
|
||||
creature->GetMotionMaster()->MoveJump(e.target.x, e.target.y, e.target.z, 0.0f, float(e.action.jump.speedxy), float(e.action.jump.speedz)); // @todo add optional jump orientation support?
|
||||
WorldObject* target = nullptr;
|
||||
|
||||
if (!targets.empty())
|
||||
target = Trinity::Containers::SelectRandomContainerElement(targets);
|
||||
|
||||
Position pos(e.target.x, e.target.y, e.target.z);
|
||||
if (target)
|
||||
{
|
||||
float x, y, z;
|
||||
target->GetPosition(x, y, z);
|
||||
if (e.action.jump.ContactDistance > 0)
|
||||
target->GetContactPoint(me, x, y, z, e.action.jump.ContactDistance);
|
||||
pos = Position(x + e.target.x, y + e.target.y, z + e.target.z);
|
||||
}
|
||||
|
||||
if (e.action.jump.Gravity || e.action.jump.UseDefaultGravity)
|
||||
{
|
||||
float gravity = e.action.jump.UseDefaultGravity ? Movement::gravity : e.action.jump.Gravity;
|
||||
me->GetMotionMaster()->MoveJumpWithGravity(pos, float(e.action.jump.SpeedXY), gravity, e.action.jump.PointId);
|
||||
}
|
||||
else
|
||||
me->GetMotionMaster()->MoveJump(pos, float(e.action.jump.SpeedXY), float(e.action.jump.SpeedZ), e.action.jump.PointId);
|
||||
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_GO_SET_LOOT_STATE:
|
||||
|
||||
Reference in New Issue
Block a user