mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Improve near npc move
This commit is contained in:
@@ -348,19 +348,19 @@ bool NewRpgMoveNpcAction::Execute(Event event)
|
||||
}
|
||||
else
|
||||
angle = 2 * M_PI * rand_norm(); // A circle around the target.
|
||||
|
||||
x += cos(angle) * INTERACTION_DISTANCE * rand_norm();
|
||||
y += sin(angle) * INTERACTION_DISTANCE * rand_norm();
|
||||
bool exact = true;
|
||||
float rnd = rand_norm();
|
||||
x += cos(angle) * INTERACTION_DISTANCE * rnd;
|
||||
y += sin(angle) * INTERACTION_DISTANCE * rnd;
|
||||
// bool exact = true;
|
||||
if (!unit->GetMap()->CheckCollisionAndGetValidCoords(unit, unit->GetPositionX(), unit->GetPositionY(),
|
||||
unit->GetPositionZ(), x, y, z))
|
||||
{
|
||||
x = unit->GetPositionX();
|
||||
y = unit->GetPositionY();
|
||||
z = unit->GetPositionZ();
|
||||
exact = false;
|
||||
// exact = false;
|
||||
}
|
||||
return MoveTo(mapId, x, y, z, false, false, false, exact);
|
||||
return MoveTo(mapId, x, y, z, false, false, false, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -68,14 +68,14 @@ struct NewRpgInfo
|
||||
break;
|
||||
case NewRpgStatus::NEAR_RANDOM:
|
||||
out << "NEAR_RANDOM";
|
||||
out << "\nlastNearNpc: " << lastNearRandom;
|
||||
out << "\nlastNearRandom: " << lastNearRandom;
|
||||
break;
|
||||
case NewRpgStatus::IDLE:
|
||||
out << "IDLE";
|
||||
break;
|
||||
case NewRpgStatus::REST:
|
||||
out << "REST";
|
||||
out << "\nlastNearNpc: " << lastRest;
|
||||
out << "\nlastRest: " << lastRest;
|
||||
break;
|
||||
default:
|
||||
out << "UNKNOWN";
|
||||
|
||||
Reference in New Issue
Block a user