From: Mario Date: Mon, 23 Nov 2015 14:12:05 +0000 (+1000) Subject: Move the vortex charge thing into a mini mutator (why this can't be done in the weapo... X-Git-Tag: xonotic-v0.8.2~1631 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=48a4dbe422d3af0676cd78effe06cf9d85543f08;p=xonotic%2Fxonotic-data.pk3dir.git Move the vortex charge thing into a mini mutator (why this can't be done in the weapon frame function is beyond me) --- diff --git a/qcsrc/common/physics.qc b/qcsrc/common/physics.qc index 299a0570e..34f5663d5 100644 --- a/qcsrc/common/physics.qc +++ b/qcsrc/common/physics.qc @@ -912,22 +912,6 @@ void PM_check_blocked() #endif } -void PM_check_vortex() -{SELFPARAM(); -#ifdef SVQC - // WEAPONTODO - float xyspeed = vlen(vec2(self.velocity)); - if (self.weapon == WEP_VORTEX.m_id && WEP_CVAR(vortex, charge) && WEP_CVAR(vortex, charge_velocity_rate) && xyspeed > WEP_CVAR(vortex, charge_minspeed)) - { - // add a maximum of charge_velocity_rate when going fast (f = 1), gradually increasing from minspeed (f = 0) to maxspeed - xyspeed = min(xyspeed, WEP_CVAR(vortex, charge_maxspeed)); - float f = (xyspeed - WEP_CVAR(vortex, charge_minspeed)) / (WEP_CVAR(vortex, charge_maxspeed) - WEP_CVAR(vortex, charge_minspeed)); - // add the extra charge - self.vortex_charge = min(1, self.vortex_charge + WEP_CVAR(vortex, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH); - } -#endif -} - void PM_fly(float maxspd_mod) {SELFPARAM(); // noclipping or flying @@ -1588,8 +1572,6 @@ void PM_Main(entity this) else PM_air(buttons_prev, maxspeed_mod); - PM_check_vortex(); - :end if (IS_ONGROUND(this)) this.lastground = time; diff --git a/qcsrc/common/weapons/weapon/vortex.qc b/qcsrc/common/weapons/weapon/vortex.qc index 8a90679b8..dfb6354dd 100644 --- a/qcsrc/common/weapons/weapon/vortex.qc +++ b/qcsrc/common/weapons/weapon/vortex.qc @@ -104,6 +104,22 @@ NET_HANDLE(TE_CSQC_VORTEXBEAMPARTICLE, bool isNew) spawnfunc(weapon_vortex) { weapon_defaultspawnfunc(this, WEP_VORTEX); } spawnfunc(weapon_nex) { spawnfunc_weapon_vortex(this); } +REGISTER_MUTATOR(vortex_charge, true); + +MUTATOR_HOOKFUNCTION(vortex_charge, GetPressedKeys) +{SELFPARAM(); + // WEAPONTODO + float xyspeed = vlen(vec2(self.velocity)); + if (self.weapon == WEP_VORTEX.m_id && WEP_CVAR(vortex, charge) && WEP_CVAR(vortex, charge_velocity_rate) && xyspeed > WEP_CVAR(vortex, charge_minspeed)) + { + // add a maximum of charge_velocity_rate when going fast (f = 1), gradually increasing from minspeed (f = 0) to maxspeed + xyspeed = min(xyspeed, WEP_CVAR(vortex, charge_maxspeed)); + float f = (xyspeed - WEP_CVAR(vortex, charge_minspeed)) / (WEP_CVAR(vortex, charge_maxspeed) - WEP_CVAR(vortex, charge_minspeed)); + // add the extra charge + self.vortex_charge = min(1, self.vortex_charge + WEP_CVAR(vortex, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH); + } +} + void W_Vortex_Attack(Weapon thiswep, float issecondary) {SELFPARAM(); float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo, charge;