]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
bots now can handle paths through warpzones
authorRudolf Polzer <divverent@xonotic.org>
Sun, 7 Aug 2011 15:27:57 +0000 (17:27 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Sun, 7 Aug 2011 15:29:17 +0000 (17:29 +0200)
qcsrc/server/sv_main.qc
qcsrc/server/t_teleporters.qc
qcsrc/warpzonelib/server.qc
qcsrc/warpzonelib/server.qh

index d11a7e3fd0651819c60945e5b11f7393565ee596..15f43ad9eb730f980a1c40827213b13106c84a55 100644 (file)
@@ -389,3 +389,20 @@ void SV_OnEntityPreSpawnFunction()
                return;
        }
 }
+
+void WarpZone_PostInitialize_Callback(void)
+{
+       // create waypoint links for warpzones
+       entity e;
+       for(e = world; (e = find(e, classname, "trigger_warpzone")); )
+       {
+               vector src, dst;
+               src = (e.absmin + e.absmax) * 0.5;
+               makevectors(e.warpzone_angles);
+               src = src + ((e.warpzone_origin - src) * v_forward) * v_forward + 16 * v_right;
+               dst = (e.enemy.absmin + e.enemy.absmax) * 0.5;
+               makevectors(e.enemy.warpzone_angles);
+               dst = dst + ((e.enemy.warpzone_origin - dst) * v_forward) * v_forward - 16 * v_right;
+               waypoint_spawnforteleporter_v(e, src, dst, 0);
+       }
+}
index 003fcbc05f711f75330dbac6c5eaf293a45cfbe1..0adbd5196af1731fecf51774167e77816d161c1b 100644 (file)
@@ -251,14 +251,12 @@ void teleport_findtarget (void)
        entity e;
        float n;
 
-       RandomSelection_Init();
        n = 0;
        for(e = world; (e = find(e, targetname, self.target)); )
        {
                ++n;
-               waypoint_spawnforteleporter(self, e.origin, 0);
                if(e.movetype == MOVETYPE_NONE)
-                       RandomSelection_Add(e, 0, string_null, 1, 1);
+                       waypoint_spawnforteleporter(self, e.origin, 0);
                if(e.classname != "info_teleport_destination")
                        print("^3MAPPER ERROR: teleporter does target an invalid teleport destination entity. Angles will not work.\n");
        }
@@ -273,7 +271,6 @@ void teleport_findtarget (void)
        {
                // exactly one dest - bots love that
                self.enemy = find(e, targetname, self.target);
-               self.dest = self.enemy.origin;
        }
        else
        {
index 94209205ba6b6e15d0000181d5115c61818051ae..4d44fe84e73327d4ff9a7762dcf35daa56ae72ad 100644 (file)
@@ -770,6 +770,7 @@ void WarpZone_StartFrame()
                        WarpZone_InitStep_UpdateTransform();
                self = e;
                WarpZones_Reconnect();
+               WarpZone_PostInitialize_Callback();
        }
 
        if(warpzone_warpzones_exist)
index 621e0f9517169e3d9ea22a8329baad9347decbfb..7a301a8b82aff76fcca1c6417d4cfbd440a7d12a 100644 (file)
@@ -10,3 +10,5 @@ const float ENT_CLIENT_WARPZONE;
 const float ENT_CLIENT_WARPZONE_CAMERA;
 
 void WarpZone_PlayerPhysics_FixVAngle(void);
+
+void WarpZone_PostInitialize_Callback(void);