Browse Source

Fixed issues with some LUA movement scripts, also mobs engaged in combat should stop more abruptly and not run past you

Image 4 years ago
parent
commit
c0632906b6
2 changed files with 5 additions and 3 deletions
  1. 1 1
      EQ2/source/WorldServer/Entity.cpp
  2. 4 2
      EQ2/source/WorldServer/Spawn.cpp

+ 1 - 1
EQ2/source/WorldServer/Entity.cpp

@@ -1324,7 +1324,7 @@ float Entity::CalculateCastingSpeedMod() {
 float Entity::GetSpeed() {
 	float ret = speed > GetBaseSpeed() ? speed : GetBaseSpeed();
 
-	if (EngagedInCombat())
+	if (EngagedInCombat() && GetMaxSpeed() > 0.0f)
 		ret = GetMaxSpeed();
 
 	if (IsStealthed() || IsInvis())

+ 4 - 2
EQ2/source/WorldServer/Spawn.cpp

@@ -2478,6 +2478,8 @@ MovementLocation* Spawn::GetLastRunningLocation(){
 void Spawn::AddRunningLocation(float x, float y, float z, float speed, float distance_away, bool attackable, bool finished_adding_locations, string lua_function, bool isMapped){
 	if(speed == 0)
 		return;
+
+	((Entity*)this)->SetSpeed(speed);
 	MovementLocation* current_location = 0;
 
 	float distance = GetDistance(x, y, z, distance_away != 0);
@@ -2639,7 +2641,7 @@ void Spawn::CalculateRunningLocation(bool stop){
 		SetPos(&appearance.pos.Y3, GetY(), false);
 		SetPos(&appearance.pos.Z3, GetZ(), false);
 	}
-	else if (removed && movement_locations->size() > 0) {
+	else if (removed && movement_locations && movement_locations->size() > 0) {
 		MovementLocation* current_location = movement_locations->at(0);
 		if (movement_locations->size() > 1) {
 			MovementLocation* data = movement_locations->at(1);
@@ -2658,7 +2660,7 @@ void Spawn::CalculateRunningLocation(bool stop){
 				GetZone()->movementMgr->NavigateTo((Entity*)this, GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ());
 		}
 		else
-			GetZone()->movementMgr->StopNavigation((Entity*)this);
+			((Entity*)this)->HaltMovement();
 	} 
 }
 float Spawn::GetFaceTarget(float x, float z) {