mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-29 06:07:57 +03:00
Update curiosity and MoveDone()
This commit is contained in:
parent
5869ba06bc
commit
09eb130b6d
2 changed files with 13 additions and 12 deletions
|
@ -209,7 +209,7 @@ void PlayerBot::MoveThink(void)
|
||||||
m_vCurrentGoal = origin;
|
m_vCurrentGoal = origin;
|
||||||
VectorAdd2D(m_vCurrentGoal, m_Path.CurrentDelta(), m_vCurrentGoal);
|
VectorAdd2D(m_vCurrentGoal, m_Path.CurrentDelta(), m_vCurrentGoal);
|
||||||
|
|
||||||
if (m_Path.Complete(origin)) {
|
if (MoveDone()) {
|
||||||
// Clear the path
|
// Clear the path
|
||||||
m_Path.Clear();
|
m_Path.Clear();
|
||||||
}
|
}
|
||||||
|
@ -659,7 +659,7 @@ Move to the specified position
|
||||||
void PlayerBot::MoveTo(Vector vPos, float *vLeashHome, float fLeashRadius)
|
void PlayerBot::MoveTo(Vector vPos, float *vLeashHome, float fLeashRadius)
|
||||||
{
|
{
|
||||||
m_vTargetPos = vPos;
|
m_vTargetPos = vPos;
|
||||||
m_Path.FindPath(origin, vPos, this, 0, vLeashHome, fLeashRadius * fLeashRadius);
|
m_Path.FindPath(origin, m_vTargetPos, this, 0, vLeashHome, fLeashRadius * fLeashRadius);
|
||||||
|
|
||||||
NewMove();
|
NewMove();
|
||||||
|
|
||||||
|
@ -792,6 +792,8 @@ Returns true if the bot has done moving
|
||||||
*/
|
*/
|
||||||
bool PlayerBot::MoveDone(void)
|
bool PlayerBot::MoveDone(void)
|
||||||
{
|
{
|
||||||
|
PathInfo* next;
|
||||||
|
|
||||||
if (!m_bPathing) {
|
if (!m_bPathing) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -804,12 +806,10 @@ bool PlayerBot::MoveDone(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_Path.NextNode()) {
|
|
||||||
Vector delta = Vector(m_Path.CurrentPathGoal()) - origin;
|
Vector delta = Vector(m_Path.CurrentPathGoal()) - origin;
|
||||||
if (delta.lengthXYSquared() < Square(16)) {
|
if (delta.lengthXYSquared() < Square(16) && delta.z < maxs.z) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -905,7 +905,7 @@ void PlayerBot::NoticeEvent(Vector vPos, int iType, Entity *pEnt, float fDistanc
|
||||||
Sentient* pSentOwner;
|
Sentient* pSentOwner;
|
||||||
float fRangeFactor;
|
float fRangeFactor;
|
||||||
|
|
||||||
fRangeFactor = Q_min(4.0 / 3.0 - ((4.0 / 3.0 * fDistanceSquared) / fRadiusSquared), 1);
|
fRangeFactor = 1.0 - (fDistanceSquared / fRadiusSquared);
|
||||||
|
|
||||||
if (fRangeFactor < random()) {
|
if (fRangeFactor < random()) {
|
||||||
return;
|
return;
|
||||||
|
@ -961,7 +961,7 @@ void PlayerBot::NoticeEvent(Vector vPos, int iType, Entity *pEnt, float fDistanc
|
||||||
case AI_EVENT_GRENADE:
|
case AI_EVENT_GRENADE:
|
||||||
default:
|
default:
|
||||||
m_iCuriousTime = level.inttime + 20000;
|
m_iCuriousTime = level.inttime + 20000;
|
||||||
m_vLastCuriousPos = vPos;
|
m_vNewCuriousPos = vPos;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1147,11 +1147,11 @@ bool PlayerBot::CheckCondition_Curious(void)
|
||||||
|
|
||||||
void PlayerBot::State_Curious(void)
|
void PlayerBot::State_Curious(void)
|
||||||
{
|
{
|
||||||
//AimAt( m_vLastCuriousPos );
|
|
||||||
AimAtAimNode();
|
AimAtAimNode();
|
||||||
|
|
||||||
if (!MoveToBestAttractivePoint(3) && !IsMoving()) {
|
if (!MoveToBestAttractivePoint(3) && (!IsMoving() || m_vLastCuriousPos != m_vNewCuriousPos)) {
|
||||||
MoveTo(m_vLastCuriousPos);
|
MoveTo(m_vNewCuriousPos);
|
||||||
|
m_vLastCuriousPos = m_vNewCuriousPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MoveDone()) {
|
if (MoveDone()) {
|
||||||
|
|
|
@ -68,6 +68,7 @@ private:
|
||||||
int m_iCuriousTime;
|
int m_iCuriousTime;
|
||||||
int m_iAttackTime;
|
int m_iAttackTime;
|
||||||
Vector m_vLastCuriousPos;
|
Vector m_vLastCuriousPos;
|
||||||
|
Vector m_vNewCuriousPos;
|
||||||
Vector m_vOldEnemyPos;
|
Vector m_vOldEnemyPos;
|
||||||
Vector m_vLastEnemyPos;
|
Vector m_vLastEnemyPos;
|
||||||
Vector m_vLastDeathPos;
|
Vector m_vLastDeathPos;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue