[3.3.5][master] Core/Movement: Smooth movement #13467 (#18020)

Implement smooth movement for all waypoint pathing and escortai

(cherry picked from commit 28050f338d)
This commit is contained in:
Riztazz
2016-11-25 00:31:10 +01:00
committed by joschiwald
parent 27cdd4b257
commit 05fb27dae4
17 changed files with 662 additions and 635 deletions

View File

@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AreaBoundary.h"
#include "ScriptMgr.h"
#include "Creature.h"
#include "forge_of_souls.h"

View File

@@ -27,6 +27,7 @@
#include "PassiveAI.h"
#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "Spell.h"
#include "SpellInfo.h"
#include "SpellScript.h"
@@ -876,11 +877,15 @@ class npc_brann_bronzebeard_algalon : public CreatureScript
public:
npc_brann_bronzebeard_algalon() : CreatureScript("npc_brann_bronzebeard_algalon") { }
struct npc_brann_bronzebeard_algalonAI : public CreatureAI
struct npc_brann_bronzebeard_algalonAI : public npc_escortAI
{
npc_brann_bronzebeard_algalonAI(Creature* creature) : CreatureAI(creature)
npc_brann_bronzebeard_algalonAI(Creature* creature) : npc_escortAI(creature)
{
_currentPoint = 0;
SetDespawnAtEnd(false);
SetDespawnAtFar(false);
for (uint8 i = 0; i < MAX_BRANN_WAYPOINTS_INTRO; ++i)
AddWaypoint(i, BrannIntroWaypoint[i].GetPositionX(), BrannIntroWaypoint[i].GetPositionY(), BrannIntroWaypoint[i].GetPositionZ());
}
void DoAction(int32 action) override
@@ -888,14 +893,12 @@ class npc_brann_bronzebeard_algalon : public CreatureScript
switch (action)
{
case ACTION_START_INTRO:
_currentPoint = 0;
_events.Reset();
me->SetWalk(false);
_events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, 1);
Start(false, true);
break;
case ACTION_FINISH_INTRO:
Talk(SAY_BRANN_ALGALON_INTRO_2);
_events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, 1);
SetEscortPaused(false);
break;
case ACTION_OUTRO:
me->GetMotionMaster()->MovePoint(POINT_BRANN_OUTRO, BrannOutroPos[1]);
@@ -905,38 +908,27 @@ class npc_brann_bronzebeard_algalon : public CreatureScript
}
}
void MovementInform(uint32 movementType, uint32 pointId) override
void WaypointReached(uint32 pointId) override
{
if (movementType != POINT_MOTION_TYPE)
return;
uint32 delay = 1;
_currentPoint = pointId + 1;
switch (pointId)
{
case 2:
delay = 8000;
me->SetWalk(true);
SetEscortPaused(true);
_events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, 8000);
SetRun(false);
break;
case 5:
me->SetWalk(false);
SetRun(true);
SetEscortPaused(true);
Talk(SAY_BRANN_ALGALON_INTRO_1);
_events.ScheduleEvent(EVENT_SUMMON_ALGALON, 7500);
return;
case 9:
me->DespawnOrUnsummon(1);
return;
case POINT_BRANN_OUTRO:
case POINT_BRANN_OUTRO_END:
return;
break;
}
_events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, delay);
}
void UpdateAI(uint32 diff) override
{
UpdateVictim();
npc_escortAI::UpdateAI(diff);
if (_events.Empty())
return;
@@ -948,8 +940,7 @@ class npc_brann_bronzebeard_algalon : public CreatureScript
switch (eventId)
{
case EVENT_BRANN_MOVE_INTRO:
if (_currentPoint < MAX_BRANN_WAYPOINTS_INTRO)
me->GetMotionMaster()->MovePoint(_currentPoint, BrannIntroWaypoint[_currentPoint]);
SetEscortPaused(false);
break;
case EVENT_SUMMON_ALGALON:
if (Creature* algalon = me->GetMap()->SummonCreature(NPC_ALGALON, AlgalonSummonPos))
@@ -967,7 +958,6 @@ class npc_brann_bronzebeard_algalon : public CreatureScript
private:
EventMap _events;
uint32 _currentPoint;
};
CreatureAI* GetAI(Creature* creature) const override