Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer not to spawn within 20 meters of enemy #512

Merged
merged 9 commits into from Sep 2, 2023
9 changes: 7 additions & 2 deletions Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut
Expand Up @@ -261,10 +261,15 @@ bool function IsSpawnpointValid( entity spawnpoint, int team )
return false
}

array<entity> projectiles = GetProjectileArrayEx( "any", TEAM_ANY, TEAM_ANY, spawnpoint.GetOrigin(), 600 )
foreach ( entity projectile in projectiles )
const minEnemyDist = 1000.0 // about 20 meters?
foreach ( entity projectile in GetProjectileArrayEx( "any", TEAM_ANY, TEAM_ANY, spawnpoint.GetOrigin(), minEnemyDist )
if ( projectile.GetTeam() != team )
return false

// prefer no enemies nearby
foreach ( entity player in GetPlayerArrayEx( "any", TEAM_ANY, TEAM_ANY, spawnpoint.GetOrigin(), minEnemyDist ) )
if ( player.GetTeam() != team )
return false
fvnkhead marked this conversation as resolved.
Show resolved Hide resolved

// los check
return !spawnpoint.IsVisibleToEnemies( team )
Expand Down