From: Mario Date: Mon, 9 Jan 2017 20:21:28 +0000 (+1000) Subject: Tweak flight buff to be more reliable (only needs crouch to trigger change of gravity) X-Git-Tag: xonotic-v0.8.2~305 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0372586e4e6dfb8bf4cb9fa1bc2cfb3ad367b222;p=xonotic%2Fxonotic-data.pk3dir.git Tweak flight buff to be more reliable (only needs crouch to trigger change of gravity) --- diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index 7f2f084ee..57a5bf579 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -595,10 +595,6 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerJump) if(player.buffs & BUFF_JUMP.m_itemid) M_ARGV(1, float) = autocvar_g_buffs_jump_height; - - if(player.buffs & BUFF_FLIGHT.m_itemid) - if(!IS_JUMP_HELD(player) && PHYS_INPUT_BUTTON_CROUCH(player)) - player.gravity *= -1; } MUTATOR_HOOKFUNCTION(buffs, MonsterMove) @@ -791,12 +787,25 @@ MUTATOR_HOOKFUNCTION(buffs, WeaponSpeedFactor) M_ARGV(0, float) *= autocvar_g_buffs_disability_weaponspeed; } +.bool buff_flight_crouchheld; + MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink) { entity player = M_ARGV(0, entity); if(game_stopped || IS_DEAD(player)) return; + if(player.buffs & BUFF_FLIGHT.m_itemid) + { + if(!PHYS_INPUT_BUTTON_CROUCH(player)) + player.buff_flight_crouchheld = false; + else if(!player.buff_flight_crouchheld) + { + player.buff_flight_crouchheld = true; + player.gravity *= -1; + } + } + if(time < player.buff_disability_time) if(time >= player.buff_disability_effect_time) {