Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
HomeMovementGenerator.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "Creature.h"
7#include "CreatureAI.h"
9#include "MoveSpline.h"
10#include "MoveSplineInit.h"
11#include "WorldPacket.h"
12
17
19{
20 if (arrived)
21 {
23 owner->SetWalk(true);
24 owner->LoadCreaturesAddon(true);
25 owner->AI()->JustReachedHome();
26 }
27}
28
30
32{
34 return;
35
36 Movement::MoveSplineInit init(owner);
37 float x, y, z, o;
38 // at apply we can select more nice return points base at current movegen
39 if (owner->GetMotionMaster()->empty() || !owner->GetMotionMaster()->top()->GetResetPosition(owner, x, y, z))
40 {
41 owner->GetHomePosition(x, y, z, o);
42 init.SetFacing(o);
43 }
44 init.MoveTo(x, y, z);
45 init.SetWalk(false);
46 init.Launch();
47
48 arrived = false;
49
51}
52
54{
55 arrived = owner->movespline->Finalized();
56 return !arrived;
57}
std::uint32_t uint32
Definition Define.h:77
@ UNIT_STATE_DISTRACTED
Definition Unit.h:524
@ UNIT_STATE_EVADE
Definition Unit.h:533
@ UNIT_STATE_ALL_STATE
Definition Unit.h:550
@ UNIT_STATE_ROOT
Definition Unit.h:522
@ UNIT_STATE_STUNNED
Definition Unit.h:515
virtual void JustReachedHome()
Definition CreatureAI.h:123
bool LoadCreaturesAddon(bool reload=false)
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition Creature.h:628
CreatureAI * AI() const
Definition Creature.h:483
_Ty top() const
bool empty() const
void SetWalk(bool enable)
void SetFacing(float angle)
void MoveTo(const Vector3 &destination, bool generatePath=true, bool forceDestination=false)
virtual bool GetResetPosition(Unit *, float &, float &, float &)
void ClearUnitState(uint32 f)
Definition Unit.h:1489
MotionMaster * GetMotionMaster()
Definition Unit.h:2605
bool SetWalk(bool enable)
Definition Unit.cpp:9137
bool HasUnitState(const uint32 f) const
Definition Unit.h:1485
std::unique_ptr< Movement::MoveSpline > movespline
Definition Unit.h:2837