diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index a889023..062a37a 100644 --- a/LuaFunctions.cpp +++ b/LuaFunctions.cpp @@ -263,6 +263,9 @@ ElunaRegister UnitMethods[] = { "GetVehicleKit", &LuaUnit::GetVehicleKit }, // :GetVehicleKit() - Gets unit's Vehicle kit if the unit is a vehicle // {"GetVehicle", &LuaUnit::GetVehicle}, // :GetVehicle() - Gets the Vehicle kit of the vehicle the unit is on #endif +#ifdef MANGOS + { "GetMovementType", &LuaUnit::GetMovementType }, +#endif // Setters { "SetFaction", &LuaUnit::SetFaction }, // :SetFaction(factionId) - Sets the unit's faction diff --git a/UnitMethods.h b/UnitMethods.h index ac2ad98..2d73c57 100644 --- a/UnitMethods.h +++ b/UnitMethods.h @@ -880,6 +880,42 @@ namespace LuaUnit return 1; } + /** + * Returns the current movement type for this [Unit]. + * + *
+    * enum MovementGeneratorType
+    * {
+    *     IDLE_MOTION_TYPE                = 0,
+    *     RANDOM_MOTION_TYPE              = 1,
+    *     WAYPOINT_MOTION_TYPE            = 2,
+    *     MAX_DB_MOTION_TYPE              = 3,
+    * 
+    *     CONFUSED_MOTION_TYPE            = 4,
+    *     CHASE_MOTION_TYPE               = 5,
+    *     HOME_MOTION_TYPE                = 6,
+    *     FLIGHT_MOTION_TYPE              = 7,
+    *     POINT_MOTION_TYPE               = 8,
+    *     FLEEING_MOTION_TYPE             = 9,
+    *     DISTRACT_MOTION_TYPE            = 10,
+    *     ASSISTANCE_MOTION_TYPE          = 11,
+    *     ASSISTANCE_DISTRACT_MOTION_TYPE = 12,          
+    *     TIMED_FLEEING_MOTION_TYPE       = 13,
+    *     FOLLOW_MOTION_TYPE              = 14,
+    *     EFFECT_MOTION_TYPE              = 15,
+    * };
+    * 
+ * + * @return MovementGeneratorType movementType + */ +#ifdef MANGOS + int GetMovementType(Eluna* /*E*/, lua_State* L, Unit* unit) + { + Eluna::Push(L, unit->GetMotionMaster()->GetCurrentMovementGeneratorType()); + return 1; + } +#endif + /* SETTERS */ int SetOwnerGUID(Eluna* /*E*/, lua_State* L, Unit* unit) {