From 166ffefd86004b2a312853152a71cd80bf5c4c39 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Wed, 24 Aug 2011 16:14:21 +0200 Subject: [PATCH] impulse 911: check if the destination location is "somewhat close" to a spawnpoint --- qcsrc/server/miscfunctions.qc | 8 ++++++++ 1 file changed, 8 insertions(+) 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; -- 2.39.2