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
|
else
|
||||||
angle = 2 * M_PI * rand_norm(); // A circle around the target.
|
angle = 2 * M_PI * rand_norm(); // A circle around the target.
|
||||||
|
float rnd = rand_norm();
|
||||||
x += cos(angle) * INTERACTION_DISTANCE * rand_norm();
|
x += cos(angle) * INTERACTION_DISTANCE * rnd;
|
||||||
y += sin(angle) * INTERACTION_DISTANCE * rand_norm();
|
y += sin(angle) * INTERACTION_DISTANCE * rnd;
|
||||||
bool exact = true;
|
// bool exact = true;
|
||||||
if (!unit->GetMap()->CheckCollisionAndGetValidCoords(unit, unit->GetPositionX(), unit->GetPositionY(),
|
if (!unit->GetMap()->CheckCollisionAndGetValidCoords(unit, unit->GetPositionX(), unit->GetPositionY(),
|
||||||
unit->GetPositionZ(), x, y, z))
|
unit->GetPositionZ(), x, y, z))
|
||||||
{
|
{
|
||||||
x = unit->GetPositionX();
|
x = unit->GetPositionX();
|
||||||
y = unit->GetPositionY();
|
y = unit->GetPositionY();
|
||||||
z = unit->GetPositionZ();
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -68,14 +68,14 @@ struct NewRpgInfo
|
|||||||
break;
|
break;
|
||||||
case NewRpgStatus::NEAR_RANDOM:
|
case NewRpgStatus::NEAR_RANDOM:
|
||||||
out << "NEAR_RANDOM";
|
out << "NEAR_RANDOM";
|
||||||
out << "\nlastNearNpc: " << lastNearRandom;
|
out << "\nlastNearRandom: " << lastNearRandom;
|
||||||
break;
|
break;
|
||||||
case NewRpgStatus::IDLE:
|
case NewRpgStatus::IDLE:
|
||||||
out << "IDLE";
|
out << "IDLE";
|
||||||
break;
|
break;
|
||||||
case NewRpgStatus::REST:
|
case NewRpgStatus::REST:
|
||||||
out << "REST";
|
out << "REST";
|
||||||
out << "\nlastNearNpc: " << lastRest;
|
out << "\nlastRest: " << lastRest;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
out << "UNKNOWN";
|
out << "UNKNOWN";
|
||||||
|
|||||||
Reference in New Issue
Block a user