]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/turrets/sv_turrets.qc
Use the ONGROUND macros
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / sv_turrets.qc
index 9ab9a32118c7e81e70c8daff361741c38473ab15..1d58686bb038e2a5a010024219ac0379145f2c84 100644 (file)
@@ -31,7 +31,7 @@ vector turret_aim_generic()
                        prep = pre_pos + (self.enemy.velocity * (impact_time + mintime));
 
                        if(self.aim_flags & TFL_AIM_ZPREDICT)
-                       if(!(self.enemy.flags & FL_ONGROUND))
+                       if(!IS_ONGROUND(self.enemy))
                        if(self.enemy.movetype == MOVETYPE_WALK || self.enemy.movetype == MOVETYPE_TOSS || self.enemy.movetype == MOVETYPE_BOUNCE)
                        {
                                float vz;
@@ -360,7 +360,7 @@ bool turret_send(entity this, entity to, float sf)
        return true;
 }
 
-void load_unit_settings(entity ent, float is_reload)
+void load_unit_settings(entity ent, bool is_reload)
 {SELFPARAM();
        string unitname = ent.netname;
        string sbase;
@@ -1200,25 +1200,18 @@ void turret_link()
 }
 
 void turrets_manager_think()
-{SELFPARAM();
-       self.nextthink = time + 1;
+{
+       SELFPARAM();
+       this.nextthink = time + 1;
 
-       entity e;
        if (autocvar_g_turrets_reloadcvars == 1)
        {
-               e = nextent(world);
-               while (e)
-               {
-                       if (IS_TURRET(e))
-                       {
-                               load_unit_settings(e,1);
-                               Turret tur = get_turretinfo(self.m_id);
-                               tur.tr_think(tur);
-                       }
-
-                       e = nextent(e);
-               }
-               cvar_set("g_turrets_reloadcvars","0");
+               FOREACH_ENTITY(IS_TURRET(it), LAMBDA(
+                       load_unit_settings(it, true);
+                       Turret tur = get_turretinfo(it.m_id);
+                       tur.tr_think(tur);
+               ));
+               cvar_set("g_turrets_reloadcvars", "0");
        }
 }