]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bot waypoints: don't create waypoints for jumppads that can be used only by a specifi...
authorterencehill <piuntn@gmail.com>
Sat, 13 Oct 2018 14:58:59 +0000 (16:58 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 13 Oct 2018 14:58:59 +0000 (16:58 +0200)
qcsrc/common/mapobjects/trigger/jumppads.qc

index ca1faeaf93c2ddd97e8c3ef052c3d770122cde26..a61935eb8c5633515f95924872fb9daa25a49ccf 100644 (file)
@@ -360,6 +360,10 @@ bool trigger_push_test(entity this, entity item)
                        if(t.move_movetype != MOVETYPE_NONE)
                                continue;
 
+                       // bots can't tell teamed jumppads from normal ones
+                       if (this.team)
+                               continue;
+
                        entity e = spawn();
                        setsize(e, PL_MIN_CONST, PL_MAX_CONST);
                        e.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
@@ -466,32 +470,41 @@ bool trigger_push_test(entity this, entity item)
                else if(n == 1)
                {
                        // exactly one dest - bots love that
-                       this.enemy = find(NULL, targetname, this.target);
+                       if (!this.team)
+                               this.enemy = find(NULL, targetname, this.target);
+                       else // bots can't tell teamed jumppads from normal ones
+                               this.enemy = NULL;
                }
                else
                {
                        // have to use random selection every single time
                        this.enemy = NULL;
                }
+
        }
 #ifdef SVQC
        else
        {
-               entity e = spawn();
-               setsize(e, PL_MIN_CONST, PL_MAX_CONST);
-               e.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
-               setorigin(e, org);
-               e.velocity = this.movedir;
-               tracetoss(e, e);
-               if (item)
+               if (!this.team)
                {
-                       bool r = (trace_ent == item);
+                       entity e = spawn();
+                       setsize(e, PL_MIN_CONST, PL_MAX_CONST);
+                       e.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
+                       setorigin(e, org);
+                       e.velocity = this.movedir;
+                       tracetoss(e, e);
+                       if (item)
+                       {
+                               bool r = (trace_ent == item);
+                               delete(e);
+                               return r;
+                       }
+                       if (!(boxesoverlap(this.absmin, this.absmax + eZ * 50, trace_endpos + PL_MIN_CONST, trace_endpos + PL_MAX_CONST)))
+                               waypoint_spawnforteleporter(this, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity), e);
                        delete(e);
-                       return r;
                }
-               if (!(boxesoverlap(this.absmin, this.absmax + eZ * 50, trace_endpos + PL_MIN_CONST, trace_endpos + PL_MAX_CONST)))
-                       waypoint_spawnforteleporter(this, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity), e);
-               delete(e);
+               else if (item)
+                       return false;
        }
 
        defer(this, 0.1, trigger_push_updatelink);