]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/bot/waypoints.qc
improve bot waypoint auditing
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / waypoints.qc
index 3cbec876133800b150f002fbc6b6ca7f5fb7dcd6..3bfb53264f19c241fbc562e21ba9ba6a09cfe463 100644 (file)
@@ -16,7 +16,7 @@ entity waypoint_spawn(vector m1, vector m2, float f)
        }
 
        w = spawn();
-       w.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP;
+       w.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
        w.classname = "waypoint";
        w.wpflags = f;
        setorigin(w, (m1 + m2) * 0.5);
@@ -37,7 +37,7 @@ entity waypoint_spawn(vector m1, vector m2, float f)
                        }
                        else
                        {
-                               if(cvar("developer"))
+                               if(autocvar_developer)
                                {
                                        print("A generated waypoint is stuck in solid at ", vtos(w.origin), "\n");
                                        backtrace("Waypoint stuck");
@@ -50,7 +50,7 @@ entity waypoint_spawn(vector m1, vector m2, float f)
        waypoint_clearlinks(w);
        //waypoint_schedulerelink(w);
 
-       if (cvar("g_waypointeditor"))
+       if (autocvar_g_waypointeditor)
        {
                m1 = w.mins;
                m2 = w.maxs;
@@ -154,8 +154,8 @@ void waypoint_think()
        local entity e;
        local vector sv, sm1, sm2, ev, em1, em2, dv;
 
-       stepheightvec = cvar("sv_stepheight") * '0 0 1';
-       bot_navigation_movemode = ((cvar("bot_navigation_ignoreplayers")) ? MOVE_NOMONSTERS : MOVE_NORMAL);
+       stepheightvec = autocvar_sv_stepheight * '0 0 1';
+       bot_navigation_movemode = ((autocvar_bot_navigation_ignoreplayers) ? MOVE_NOMONSTERS : MOVE_NORMAL);
 
        //dprint("waypoint_think wpisbox = ", ftos(self.wpisbox), "\n");
        sm1 = self.origin + self.mins;
@@ -251,7 +251,7 @@ void waypoint_schedulerelink(entity wp)
        if (wp == world)
                return;
        // TODO: add some sort of visible box in edit mode for box waypoints
-       if (cvar("g_waypointeditor"))
+       if (autocvar_g_waypointeditor)
        {
                local vector m1, m2;
                m1 = wp.mins;
@@ -776,7 +776,10 @@ void waypoint_spawnforteleporter(entity e, vector destination, float timetaken)
 {
        local entity w;
        local entity dw;
-       w = waypoint_spawn(e.absmin, e.absmax, WAYPOINTFLAG_GENERATED | WAYPOINTFLAG_TELEPORT | WAYPOINTFLAG_NORELINK);
+       vector org;
+       org = (e.absmin + e.absmax) * 0.5;
+       org = waypoint_fixorigin(org);
+       w = waypoint_spawn(org, org, WAYPOINTFLAG_GENERATED | WAYPOINTFLAG_TELEPORT | WAYPOINTFLAG_NORELINK);
        dw = waypoint_spawn(destination, destination, WAYPOINTFLAG_GENERATED);
        // one way link to the destination
        w.wp00 = dw;