]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Split the combo over time into its own entity and keep the orb visible for the durati...
authorMario <mario.mario@y7mail.com>
Tue, 8 Oct 2024 14:33:10 +0000 (00:33 +1000)
committerMario <mario.mario@y7mail.com>
Tue, 8 Oct 2024 14:33:10 +0000 (00:33 +1000)
qcsrc/common/weapons/weapon/electro.qc

index a39c7f2d5eaf174358a99c47e401ef2e2e4f91a4..594c39289ecebae8cb92468f29e5cb9e14b28aec 100644 (file)
@@ -68,6 +68,28 @@ void W_Electro_ExplodeComboThink(entity this)
        this.projectiledeathtype |= HITTYPE_SPAM; // ensure it doesn't spam its effect
 }
 
+void W_Electro_Orb_ExplodeOverTime(entity this)
+{
+       entity newproj = spawn();
+       newproj.classname = this.classname;
+       newproj.solid = this.solid;
+       setorigin(newproj, this.origin);
+       setmodel(newproj, MDL_PROJECTILE_ELECTRO);
+       setsize(newproj, this.mins, this.maxs);
+       newproj.owner = this.owner;
+       newproj.realowner = this.realowner;
+       newproj.weaponentity_fld = this.weaponentity_fld;
+       newproj.projectiledeathtype = WEP_ELECTRO.m_id | HITTYPE_BOUNCE; // use THIS type for a combo because primary can't bounce
+
+       setthink(newproj, W_Electro_ExplodeComboThink);
+       newproj.nextthink = time;
+       newproj.ltime = time + WEP_CVAR(WEP_ELECTRO, combo_duration);
+       set_movetype(newproj, MOVETYPE_NONE);
+
+       // fire the first damage tick immediately
+       getthink(newproj)(newproj);
+}
+
 void W_Electro_ExplodeCombo(entity this)
 {
        W_Electro_TriggerCombo(this.origin, WEP_CVAR(WEP_ELECTRO, combo_comboradius), this.realowner);
@@ -78,18 +100,9 @@ void W_Electro_ExplodeCombo(entity this)
 
        if(WEP_CVAR(WEP_ELECTRO, combo_duration))
        {
-               this.projectiledeathtype = WEP_ELECTRO.m_id | HITTYPE_BOUNCE; // use THIS type for a combo because primary can't bounce
-               this.event_damage = func_null;
-               settouch(this, func_null);
-               this.effects |= EF_NODRAW; // hide the orb, rely only on the effect
-
-               setthink(this, W_Electro_ExplodeComboThink);
-               this.nextthink = time;
-               this.ltime = time + WEP_CVAR(WEP_ELECTRO, combo_duration);
-               set_movetype(this, MOVETYPE_NONE);
+               W_Electro_Orb_ExplodeOverTime(this);
 
-               // fire the first damage tick immediately
-               getthink(this)(this);
+               delete(this);
                return;
        }