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: 6 additions & 3 deletions Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut
Expand Up @@ -261,9 +261,12 @@ 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 )
if ( projectile.GetTeam() != team )
const minEnemyDist = 1000.0 // about 20 meters?
// in rsquirrel extend returns null unlike in vanilla squirrel
array<entity> spawnBlockers = GetPlayerArrayEx( "any", TEAM_ANY, TEAM_ANY, spawnpoint.GetOrigin(), minEnemyDist ) )
fvnkhead marked this conversation as resolved.
Show resolved Hide resolved
spawnBlockers.extend( GetProjectileArrayEx( "any", TEAM_ANY, TEAM_ANY, spawnpoint.GetOrigin(), minEnemyDist ) )
foreach ( entity blocker in spawnBlockers )
if ( blocker.GetTeam() != team )
return false

// los check
Expand Down