From: Rudolf Polzer Date: Wed, 24 Aug 2011 14:14:21 +0000 (+0200) Subject: impulse 911: check if the destination location is "somewhat close" to a spawnpoint X-Git-Tag: xonotic-v0.5.0~63 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=166ffefd86004b2a312853152a71cd80bf5c4c39;p=xonotic%2Fxonotic-data.pk3dir.git impulse 911: check if the destination location is "somewhat close" to a spawnpoint --- diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 0dca3ab28..61df00dd0 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -2476,6 +2476,7 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f { float m, i; vector start, org, delta, end, enddown, mstart; + entity sp; m = e.dphitcontentsmask; e.dphitcontentsmask = goodcontents | badcontents; @@ -2528,6 +2529,13 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f if (trace_fraction >= 1) continue; + // rule 4: we must "see" some spawnpoint + for(sp = world; (sp = find(sp, classname, "info_player_deathmatch")); ) + if(checkpvs(mstart, sp)) + break; + if(!sp) + continue; + // find a random vector to "look at" end_x = org_x + random() * delta_x; end_y = org_y + random() * delta_y;