]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/electro.qc
Set air_finished to 0 while player is out of water instead of updating it to time...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / electro.qc
index 85f2df77a8e7cc01e3eeb8f291610240095596bc..69ccc4251bff69dbd7dacb70975cdf1966c62434 100644 (file)
@@ -152,17 +152,48 @@ void W_Electro_Bolt_Think(entity this)
                // loop through nearby orbs and trigger them
                while(e)
                {
-                       if(e.classname == "electro_orb" && (WEP_CVAR_PRI(electro, midaircombo_own) || DIFF_TEAM(this.owner, e.owner)))
+                       if(e.classname == "electro_orb")
                        {
-                               // change owner to whoever caused the combo explosion
-                               e.realowner = this.realowner;
-                               e.takedamage = DAMAGE_NO;
-                               e.classname = "electro_orb_chain";
-
-                               // explode first orb immediately, other orbs will chain with delay
-                               W_Electro_ExplodeCombo(e);
+                               bool explode;
+                               if (this.owner == e.owner)
+                               {
+                                       explode = WEP_CVAR_PRI(electro, midaircombo_own);
+                               }
+                               else if (SAME_TEAM(this.owner, e.owner))
+                               {
+                                       explode = WEP_CVAR_PRI(electro, midaircombo_teammate);
+                               }
+                               else
+                               {
+                                       explode = WEP_CVAR_PRI(electro, midaircombo_enemy);
+                               }
 
-                               ++found;
+                               if (explode)
+                               {
+                                       // change owner to whoever caused the combo explosion
+                                       e.realowner = this.realowner;
+                                       e.takedamage = DAMAGE_NO;
+                                       e.classname = "electro_orb_chain";
+
+                                       // Only first orb explosion uses midaircombo_speed, others use the normal combo_speed.
+                                       // This allows to avoid the delay on the first explosion which looks better
+                                       // (the bolt and orb should explode together because they interacted together)
+                                       // while keeping the chaining delay.
+                                       setthink(e, W_Electro_ExplodeCombo);
+                                       e.nextthink =
+                                       (
+                                               time
+                                               +
+                                               (WEP_CVAR_PRI(electro, midaircombo_speed) ?
+                                                       (vlen(e.WarpZone_findradius_dist) / WEP_CVAR_PRI(electro, midaircombo_speed))
+                                                       :
+                                                       0
+                                               )
+                                       );
+
+
+                                       ++found;
+                               }
                        }
                        e = e.chain;
                }