From: Mario Date: Sun, 18 Aug 2019 10:40:27 +0000 (+1000) Subject: Add an option (off by default) to allow the vortex to charge even while not in hand X-Git-Tag: xonotic-v0.8.5~1384 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=f6eba5d1edfbdbb4a6f1578d904ae8d38ddf6dbe;ds=sidebyside Add an option (off by default) to allow the vortex to charge even while not in hand --- diff --git a/bal-wep-mario.cfg b/bal-wep-mario.cfg index 69ea365681..8ae104ae86 100644 --- a/bal-wep-mario.cfg +++ b/bal-wep-mario.cfg @@ -290,6 +290,7 @@ set g_balance_crylink_weaponthrowable 1 // }}} // {{{ #8: Vortex set g_balance_vortex_charge 0 +set g_balance_vortex_charge_always 0 set g_balance_vortex_charge_animlimit 0.5 set g_balance_vortex_charge_limit 1 set g_balance_vortex_charge_maxspeed 800 diff --git a/bal-wep-nexuiz25.cfg b/bal-wep-nexuiz25.cfg index ccf1a7de96..95b62730c9 100644 --- a/bal-wep-nexuiz25.cfg +++ b/bal-wep-nexuiz25.cfg @@ -290,6 +290,7 @@ set g_balance_crylink_weaponthrowable 1 // }}} // {{{ #8: Vortex set g_balance_vortex_charge 0 +set g_balance_vortex_charge_always 0 set g_balance_vortex_charge_animlimit 0.5 set g_balance_vortex_charge_limit 1 set g_balance_vortex_charge_maxspeed 800 diff --git a/bal-wep-samual.cfg b/bal-wep-samual.cfg index 4549f99c70..109c3d8f84 100644 --- a/bal-wep-samual.cfg +++ b/bal-wep-samual.cfg @@ -290,6 +290,7 @@ set g_balance_crylink_weaponthrowable 1 // }}} // {{{ #8: Vortex set g_balance_vortex_charge 1 +set g_balance_vortex_charge_always 0 set g_balance_vortex_charge_animlimit 0.5 set g_balance_vortex_charge_limit 1 set g_balance_vortex_charge_maxspeed 800 diff --git a/bal-wep-xdf.cfg b/bal-wep-xdf.cfg index 62d1cbb44a..aaf3124617 100644 --- a/bal-wep-xdf.cfg +++ b/bal-wep-xdf.cfg @@ -290,6 +290,7 @@ set g_balance_crylink_weaponthrowable 1 // }}} // {{{ #8: Vortex set g_balance_vortex_charge 0 +set g_balance_vortex_charge_always 0 set g_balance_vortex_charge_animlimit 0.5 set g_balance_vortex_charge_limit 1 set g_balance_vortex_charge_maxspeed 800 diff --git a/bal-wep-xonotic.cfg b/bal-wep-xonotic.cfg index bf33f599a8..7d552e56b9 100644 --- a/bal-wep-xonotic.cfg +++ b/bal-wep-xonotic.cfg @@ -290,6 +290,7 @@ set g_balance_crylink_weaponthrowable 1 // }}} // {{{ #8: Vortex set g_balance_vortex_charge 1 +set g_balance_vortex_charge_always 0 set g_balance_vortex_charge_animlimit 0.5 set g_balance_vortex_charge_limit 1 set g_balance_vortex_charge_maxspeed 800 diff --git a/bal-wep-xpm.cfg b/bal-wep-xpm.cfg index 5152579ab3..14a8159c03 100644 --- a/bal-wep-xpm.cfg +++ b/bal-wep-xpm.cfg @@ -290,6 +290,7 @@ set g_balance_crylink_weaponthrowable 1 // }}} // {{{ #8: Vortex set g_balance_vortex_charge 1 +set g_balance_vortex_charge_always 0 set g_balance_vortex_charge_animlimit 0.5 set g_balance_vortex_charge_limit 1 set g_balance_vortex_charge_maxspeed 800 diff --git a/qcsrc/common/weapons/weapon/vortex.qc b/qcsrc/common/weapons/weapon/vortex.qc index fec4d756e9..af7fac6241 100644 --- a/qcsrc/common/weapons/weapon/vortex.qc +++ b/qcsrc/common/weapons/weapon/vortex.qc @@ -159,6 +159,12 @@ void W_Vortex_Attack(Weapon thiswep, entity actor, .entity weaponentity, float i .float vortex_chargepool_pauseregen_finished; +void W_Vortex_Charge(entity actor, .entity weaponentity, float dt) +{ + if(WEP_CVAR(vortex, charge) && actor.(weaponentity).vortex_charge < WEP_CVAR(vortex, charge_limit)) + actor.(weaponentity).vortex_charge = min(1, actor.(weaponentity).vortex_charge + WEP_CVAR(vortex, charge_rate) * dt / W_TICSPERFRAME); +} + METHOD(Vortex, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) { if(bot_aim(actor, weaponentity, 1000000, 0, 1, false)) @@ -171,8 +177,8 @@ METHOD(Vortex, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) } METHOD(Vortex, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { - if(WEP_CVAR(vortex, charge) && actor.(weaponentity).vortex_charge < WEP_CVAR(vortex, charge_limit)) - actor.(weaponentity).vortex_charge = min(1, actor.(weaponentity).vortex_charge + WEP_CVAR(vortex, charge_rate) * frametime / W_TICSPERFRAME); + if(!WEP_CVAR(vortex, charge_always)) + W_Vortex_Charge(actor, weaponentity, frametime); if(WEP_CVAR_SEC(vortex, chargepool)) if(actor.(weaponentity).vortex_chargepool_ammo < 1) diff --git a/qcsrc/common/weapons/weapon/vortex.qh b/qcsrc/common/weapons/weapon/vortex.qh index 570464cb91..783e42a8ea 100644 --- a/qcsrc/common/weapons/weapon/vortex.qh +++ b/qcsrc/common/weapons/weapon/vortex.qh @@ -27,6 +27,7 @@ CLASS(Vortex, Weapon) P(class, prefix, chargepool_pause_regen, float, SEC) \ P(class, prefix, chargepool_regen, float, SEC) \ P(class, prefix, charge, float, NONE) \ + P(class, prefix, charge_always, float, NONE) \ P(class, prefix, charge_animlimit, float, NONE) \ P(class, prefix, charge_limit, float, NONE) \ P(class, prefix, charge_maxspeed, float, NONE) \ @@ -66,4 +67,6 @@ SPAWNFUNC_WEAPON(weapon_nex, WEP_VORTEX) #ifdef SVQC .float vortex_lasthit; + +void W_Vortex_Charge(entity actor, .entity weaponentity, float dt); #endif diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 3a99e31ded..5029da7df9 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2194,6 +2194,8 @@ bool PlayerThink(entity this) for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { .entity weaponentity = weaponentities[slot]; + if(WEP_CVAR(vortex, charge_always)) + W_Vortex_Charge(this, weaponentity, frametime); W_WeaponFrame(this, weaponentity); }