From: terencehill Date: Mon, 5 Apr 2021 12:30:57 +0000 (+0200) Subject: Compact some electro code X-Git-Tag: xonotic-v0.8.5~469 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3199314a3f040a432a15cd9fa0afc4e9248c0881;p=xonotic%2Fxonotic-data.pk3dir.git Compact some electro code --- diff --git a/qcsrc/common/effects/qc/rubble.qc b/qcsrc/common/effects/qc/rubble.qc index f0a29bd5b..78bacbc10 100644 --- a/qcsrc/common/effects/qc/rubble.qc +++ b/qcsrc/common/effects/qc/rubble.qc @@ -15,7 +15,7 @@ void LimitedChildrenRubble(IntrusiveList list, string cname, int limit, void(ent // compare to all other matching entities IL_EACH(list, it.classname == cname, { - if(!parent ||parent == it.owner){ + if(!parent || parent == it.owner){ ++c; if(!oldest || oldesttime > it.creationtime) { diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index 274cf4ff2..1505503b3 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -35,16 +35,10 @@ void W_Electro_TriggerCombo(vector org, float rad, entity own) setthink(e, W_Electro_ExplodeCombo); // delay combo chains, looks cooler - e.nextthink = - ( - time - + - (WEP_CVAR(electro, combo_speed) ? - (vlen(e.WarpZone_findradius_dist) / WEP_CVAR(electro, combo_speed)) - : - 0 - ) - ); + float delay = 0; + if (WEP_CVAR(electro, combo_speed)) + delay = vlen(e.WarpZone_findradius_dist) / WEP_CVAR(electro, combo_speed); + e.nextthink = time + delay; } e = e.chain; } @@ -181,17 +175,10 @@ void W_Electro_Bolt_Think(entity this) // (the bolt and orb should explode together because they interacted together) // while keeping the chaining delay. setthink(e, W_Electro_ExplodeCombo); - e.nextthink = - ( - time - + - (WEP_CVAR_PRI(electro, midaircombo_speed) ? - (vlen(e.WarpZone_findradius_dist) / WEP_CVAR_PRI(electro, midaircombo_speed)) - : - 0 - ) - ); - + float delay = 0; + if (WEP_CVAR_PRI(electro, midaircombo_speed)) + delay = vlen(e.WarpZone_findradius_dist) / WEP_CVAR_PRI(electro, midaircombo_speed); + e.nextthink = time + delay; ++found; } @@ -346,17 +333,11 @@ void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float this.realowner = inflictor.realowner; this.classname = "electro_orb_chain"; setthink(this, W_Electro_ExplodeCombo); - this.nextthink = time + - ( - // bound the length, inflictor may be in a galaxy far far away (warpzones) - min( - WEP_CVAR(electro, combo_radius), - vlen(this.origin - inflictor.origin) - ) - / - // delay combo chains, looks cooler - WEP_CVAR(electro, combo_speed) - ); + // delay combo chains, looks cooler + // bound the length, inflictor may be in a galaxy far far away (warpzones) + float len = min(WEP_CVAR(electro, combo_radius), vlen(this.origin - inflictor.origin)); + float delay = len / WEP_CVAR(electro, combo_speed); + this.nextthink = time + delay; } else {