From 9f26c44002734767c15028f3c1188c9fae574caa Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 9 Oct 2024 00:33:10 +1000 Subject: [PATCH] Split the combo over time into its own entity and keep the orb visible for the duration of the effect --- qcsrc/common/weapons/weapon/electro.qc | 35 ++++++++++++++++++-------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index a39c7f2d5e..594c39289e 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -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; } -- 2.39.2