From: Mario Date: Tue, 8 Oct 2024 14:33:10 +0000 (+1000) Subject: Split the combo over time into its own entity and keep the orb visible for the durati... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9f26c44002734767c15028f3c1188c9fae574caa;p=xonotic%2Fxonotic-data.pk3dir.git Split the combo over time into its own entity and keep the orb visible for the duration of the effect --- diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index a39c7f2d5..594c39289 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; }