]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/steerlib.qc
Properly support team field on trigger_multiple
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / steerlib.qc
index 5312eb8140b06d1002e3c6471ec98238d8112622..3418a2c4e375a80c0506dcf58400018c918297fd 100644 (file)
@@ -2,6 +2,7 @@
 #if defined(CSQC)
 #elif defined(MENUQC)
 #elif defined(SVQC)
+    #include "pathlib/utility.qh"
 #endif
 
 /**
@@ -144,7 +145,7 @@ vector steerlib_wander(entity this, float range, float tresh, vector oldpoint)
     vector wander_point;
     wander_point = v_forward - oldpoint;
 
-    if (vlen(wander_point) > tresh)
+    if (vdist(wander_point, >, tresh))
         return oldpoint;
 
     range = bound(0,range,1);
@@ -340,51 +341,6 @@ vector steerlib_traceavoid_flat(entity this, float pitch, float length, vector v
     return normalize(leftwish + rightwish + frontwish);
 }
 
-bool beamsweep_badpoint(vector point, bool waterok)
-{
-    if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
-        return true;
-
-    int pc = pointcontents(point);
-    int pc2 = pointcontents(point - '0 0 1');
-    
-    if(pc == CONTENT_EMPTY && pc2 == CONTENT_SOLID)
-        return false;
-    if(pc == CONTENT_EMPTY && pc2 == CONTENT_WATER && waterok)
-        return false;
-    if(pc == CONTENT_WATER && waterok)
-        return false;
-    return true;
-
-    /*switch(pc)
-    {
-        case CONTENT_SOLID: break;
-        case CONTENT_SLIME: break;
-        case CONTENT_LAVA:  break;
-
-        case CONTENT_SKY:
-            return true;
-
-        case CONTENT_EMPTY:
-            if (pc2 == CONTENT_SOLID)
-                return 0;
-
-            if (pc2 == CONTENT_WATER)
-                if(waterok)
-                    return 0;
-
-            break;
-
-        case CONTENT_WATER:
-            if(waterok)
-                return 0;
-
-            break;
-    }
-
-    return true;*/
-}
-
 //#define BEAMSTEER_VISUAL
 float beamsweep(entity this, vector from, vector dir,float length, float step,float step_up, float step_down)
 {
@@ -398,7 +354,7 @@ float beamsweep(entity this, vector from, vector dir,float length, float step,fl
     if(trace_fraction == 1.0)
         return 0;
 
-    if(beamsweep_badpoint(trace_endpos,0))
+    if(!location_isok(trace_endpos, false, false))
         return 0;
 
     a = trace_endpos;
@@ -414,7 +370,7 @@ float beamsweep(entity this, vector from, vector dir,float length, float step,fl
         if(trace_fraction == 1.0)
             return i / length;
 
-        if(beamsweep_badpoint(trace_endpos,0))
+        if(!location_isok(trace_endpos, false, false))
             return i / length;
 #ifdef BEAMSTEER_VISUAL
         te_lightning1(NULL,a+u,b+u);
@@ -570,6 +526,8 @@ void spawn_flocker(entity this)
     flocker.health     = 10;
     flocker.pos1      = normalize(flocker.velocity + randomvec() * 0.1);
 
+    IL_PUSH(g_flockers, flocker);
+
     this.cnt = this.cnt -1;
 
 }
@@ -603,7 +561,7 @@ void flocker_hunter_think(entity this)
 
     if(!this.enemy)
     {
-        FOREACH_ENTITY_FLOAT(flock_id, this.flock_id,
+        IL_EACH(g_flockers, it.flock_id == this.flock_id,
         {
             if(it == this.owner || it == ee)
                 continue;
@@ -654,6 +612,9 @@ spawnfunc(flockerspawn)
     this.enemy.nextthink = time + 10;
     this.enemy.flock_id  = this.flock_id;
     this.enemy.owner     = this;
+
+    IL_PUSH(g_flockers, this);
+    IL_PUSH(g_flockers, this.enemy);
 }
 #endif