This commit is contained in:
parent
056511ac63
commit
51f8412d46
1 changed files with 19 additions and 4 deletions
|
@ -742,20 +742,35 @@ bool CNpcEnemy::processSensor()
|
||||||
{
|
{
|
||||||
if ( playerXDistSqr + playerYDistSqr < 10000 )
|
if ( playerXDistSqr + playerYDistSqr < 10000 )
|
||||||
{
|
{
|
||||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
// only attack if within path extents
|
||||||
m_extension = 0;
|
|
||||||
m_velocity = 5;
|
s32 minX, maxX;
|
||||||
m_base = Pos;
|
m_npcPath.getPathXExtents( &minX, &maxX );
|
||||||
|
|
||||||
if ( playerXDist < 0 )
|
if ( playerXDist < 0 )
|
||||||
{
|
{
|
||||||
m_extendDir = EXTEND_LEFT;
|
m_extendDir = EXTEND_LEFT;
|
||||||
|
|
||||||
|
if ( ( Pos.vx + playerXDist - 128 ) < minX )
|
||||||
|
{
|
||||||
|
return( false );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_extendDir = EXTEND_RIGHT;
|
m_extendDir = EXTEND_RIGHT;
|
||||||
|
|
||||||
|
if ( ( Pos.vx + playerXDist + 128 ) > maxX )
|
||||||
|
{
|
||||||
|
return( false );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||||
|
m_extension = 0;
|
||||||
|
m_velocity = 5;
|
||||||
|
m_base = Pos;
|
||||||
|
|
||||||
return( true );
|
return( true );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue