]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Electro combo over time: repeat explosion effect every x seconds (0.75s for g_balance...
authorterencehill <piuntn@gmail.com>
Tue, 8 Oct 2024 21:58:44 +0000 (23:58 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 8 Oct 2024 21:58:44 +0000 (23:58 +0200)
qcsrc/common/weapons/weapon/electro.qc

index 594c39289ecebae8cb92468f29e5cb9e14b28aec..66ea172dcd2f7cce03af534ea148801f97278976 100644 (file)
@@ -51,6 +51,8 @@ void W_Electro_TriggerCombo(vector org, float rad, entity own)
        }
 }
 
+float ExplodeOverTime_eff_interval;
+.float ltime2;
 void W_Electro_ExplodeComboThink(entity this)
 {
        if(time >= this.ltime)
@@ -64,6 +66,17 @@ void W_Electro_ExplodeComboThink(entity this)
        float damage = WEP_CVAR(WEP_ELECTRO, combo_damage) * PHYS_INPUT_TIMELENGTH;
        float edgedamage = WEP_CVAR(WEP_ELECTRO, combo_edgedamage) * PHYS_INPUT_TIMELENGTH;
 
+       if (time > this.ltime2) // show explosion effect every ExplodeOverTime_eff_interval seconds
+       {
+               this.projectiledeathtype &= ~HITTYPE_SPAM;
+               if (!this.ltime2)
+               {
+                       ExplodeOverTime_eff_interval = (this.ltime - time) / ceil(((this.ltime - time) + 0.01) / 0.9);
+                       this.ltime2 = time + ExplodeOverTime_eff_interval;
+               }
+               else
+                       this.ltime2 += ExplodeOverTime_eff_interval;
+       }
        RadiusDamage(this, this.realowner, damage, edgedamage, WEP_CVAR(WEP_ELECTRO, combo_radius), NULL, NULL, 0, this.projectiledeathtype, this.weaponentity_fld, NULL);
        this.projectiledeathtype |= HITTYPE_SPAM; // ensure it doesn't spam its effect
 }