From c7e50b28fe31e20b064f812758d8a0f5e889ea74 Mon Sep 17 00:00:00 2001 From: fvnkhead <98965760+fvnkhead@users.noreply.github.com> Date: Sat, 2 Sep 2023 19:50:28 +0300 Subject: Prefer not to spawn within 20 meters of enemy (#512) It indeed can't hurt Co-authored-by: uniboi <64006268+uniboi@users.noreply.github.com> --- Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut index 5bf150c0..4956375b 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut @@ -261,9 +261,12 @@ bool function IsSpawnpointValid( entity spawnpoint, int team ) return false } - array 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 ) + spawnBlockers.extend( GetProjectileArrayEx( "any", TEAM_ANY, TEAM_ANY, spawnpoint.GetOrigin(), minEnemyDist ) ) + foreach ( entity blocker in spawnBlockers ) + if ( blocker.GetTeam() != team ) return false // los check -- cgit v1.2.3