This commit is contained in:
Charles 2001-04-04 20:10:29 +00:00
parent 056511ac63
commit 51f8412d46

View file

@ -742,19 +742,34 @@ bool CNpcEnemy::processSensor()
{
if ( playerXDistSqr + playerYDistSqr < 10000 )
{
m_controlFunc = NPC_CONTROL_CLOSE;
m_extension = 0;
m_velocity = 5;
m_base = Pos;
// only attack if within path extents
s32 minX, maxX;
m_npcPath.getPathXExtents( &minX, &maxX );
if ( playerXDist < 0 )
{
m_extendDir = EXTEND_LEFT;
if ( ( Pos.vx + playerXDist - 128 ) < minX )
{
return( false );
}
}
else
{
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 );
}