]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/electro.qc
Merge branch 'master' into Mario/csqc_muzzleflash
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / electro.qc
index c1709322e44b14f30b2e84898efdb785ea213d21..61acc0dd75eec382c186983fb98cd6923c0ee3db 100644 (file)
@@ -175,9 +175,22 @@ void W_Electro_Bolt_Think(entity this)
                                        e.takedamage = DAMAGE_NO;
                                        e.classname = "electro_orb_chain";
 
-                                       // explode first orb immediately, other orbs will chain with delay
+                                       // 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;
+                                       e.nextthink =
+                                       (
+                                               time
+                                               +
+                                               (WEP_CVAR_PRI(electro, midaircombo_speed) ?
+                                                       (vlen(e.WarpZone_findradius_dist) / WEP_CVAR_PRI(electro, midaircombo_speed))
+                                                       :
+                                                       0
+                                               )
+                                       );
+
 
                                        ++found;
                                }
@@ -214,7 +227,7 @@ void W_Electro_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity)
                thiswep.m_id
        );
 
-       Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_ELECTRO_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
 
        proj = new(electro_bolt);
        proj.owner = proj.realowner = actor;
@@ -365,7 +378,7 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor, .entity weaponentity)
 
        w_shotdir = v_forward; // no TrueAim for grenades please
 
-       Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_ELECTRO_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
 
        entity proj = new(electro_orb);
        proj.owner = proj.realowner = actor;