etqw-sdk/base/script/projectiles/targetedmissile.script
2008-05-29 00:00:00 +00:00

32 lines
793 B
Text

/***********************************************************************
projectile_targetedmissile.script
***********************************************************************/
object projectile_targetedmissile : projectile_homingmissile {
void UpdateFocusedTargeting();
};
void projectile_targetedmissile::UpdateFocusedTargeting() {
vector enemyOrg;
vector dir;
player myPlayer = getOwner();
if ( myPlayer == $null_entity ) {
return;
}
enemyOrg = myPlayer.lastValidTarget;
enemyOrg = enemyOrg - getWorldOrigin(); // adjust for own origin
dir = sys.vecNormalize( enemyOrg );
float maxTurnRate = 135.0f * ( sys.getTime() - spawnTime );
if ( maxTurnRate > 180.0f ) {
maxTurnRate = 180.0f;
}
turnTowards( dir, maxTurnRate );
}