]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Tweak flight buff to be more reliable (only needs crouch to trigger change of gravity)
authorMario <mario@smbclan.net>
Mon, 9 Jan 2017 20:21:28 +0000 (06:21 +1000)
committerMario <mario@smbclan.net>
Mon, 9 Jan 2017 20:21:28 +0000 (06:21 +1000)
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc

index 7f2f084ee902ed54995d8cef30d40b1a43c536ca..57a5bf5793c7ccaf6285b8a9ae96b35c9e1236d9 100644 (file)
@@ -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)
        {