]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/electro.qc
New cvar for electro balls to get their lifetime from after sticking
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / electro.qc
index c2ec43e8c374bddbdb917343ce44f98b1a08a42e..d80703175983b87eb0c046ffa68e42276aad0d4e 100644 (file)
@@ -312,7 +312,11 @@ void W_Electro_Orb_Stick(entity this, entity to)
        newproj.weaponentity_fld = this.weaponentity_fld;
 
        settouch(newproj, func_null);
-       newproj.death_time = this.death_time;
+       if(WEP_CVAR_SEC(electro, stick_lifetime) > 0){
+               newproj.death_time = time + WEP_CVAR_SEC(electro, stick_lifetime);
+       }else{
+               newproj.death_time = this.death_time;
+       }
        newproj.use = this.use;
        newproj.flags = this.flags;
        IL_PUSH(g_projectiles, newproj);
@@ -351,8 +355,13 @@ void W_Electro_Orb_Touch(entity this, entity toucher)
                spamsound(this, CH_SHOTS, SND_ELECTRO_BOUNCE, VOL_BASE, ATTEN_NORM);
                this.projectiledeathtype |= HITTYPE_BOUNCE;
 
-               if(WEP_CVAR_SEC(electro, stick))
-                       W_Electro_Orb_Stick(this, toucher);
+               if(WEP_CVAR_SEC(electro, stick)){
+                       if(WEP_CVAR_SEC(electro, stick_lifetime) == 0){
+                               W_Electro_Explode(this, toucher);
+                       } else {
+                               W_Electro_Orb_Stick(this, toucher);
+                       }
+               }
        }
 }