]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
If a round hasn't started yet forbid primary and secondary fire, allow switching...
authorterencehill <piuntn@gmail.com>
Wed, 4 Jan 2017 17:43:35 +0000 (18:43 +0100)
committerterencehill <piuntn@gmail.com>
Wed, 4 Jan 2017 17:43:35 +0000 (18:43 +0100)
qcsrc/common/mutators/mutator/overkill/sv_overkill.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/server/weapons/weaponsystem.qc

index 98233d2e9baad840be9ec51d734ed59b30fe73f5..db030b94ce4224b772e1b9200c6951b284572a49 100644 (file)
@@ -119,7 +119,7 @@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink)
                return;
 
        if(PHYS_INPUT_BUTTON_ATCK2(player))
-       if( !forbidWeaponUse(player) || player.weapon_blocked // allow if weapon is blocked
+       if( !forbidWeaponUse(player) || player.weapon_blocked // allow if weapon is reloading
                || (round_handler_IsActive() && !round_handler_IsRoundStarted()) )
        if(time >= player.jump_interval)
        {
index eff656a6e1dce2ae5f271c4de27c454a6a654dc7..897ad437f6408dc2b556a1d3416f298882002c1e 100644 (file)
@@ -315,7 +315,8 @@ void W_Hagar_Attack2_Load_Release(entity actor, .entity weaponentity)
 void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity)
 {
        // loadable hagar secondary attack, must always run each frame
-
+       if(round_handler_IsActive() && !round_handler_IsRoundStarted())
+               return;
        if(time < game_starttime)
                return;
 
index 2e0ee09bf8df718d593943e4a777f0b99d1627b5..a91f7916a52469ed1c6c2e5d04ca5ad12dd36506 100644 (file)
@@ -418,7 +418,6 @@ void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void(
 bool forbidWeaponUse(entity player)
 {
        if (time < game_starttime && !autocvar_sv_ready_restart_after_countdown) return true;
-       if (round_handler_IsActive() && !round_handler_IsRoundStarted()) return true;
        if (player.player_blocked) return true;
        if (gameover) return true;
        if (STAT(FROZEN, player)) return true;
@@ -438,13 +437,18 @@ void W_WeaponFrame(Player actor, .entity weaponentity)
 
        if (!this || actor.health < 1) return;  // Dead player can't use weapons and injure impulse commands
 
+       int button_atck = PHYS_INPUT_BUTTON_ATCK(actor);
+       int button_atck2 = PHYS_INPUT_BUTTON_ATCK2(actor);
+
+       if (round_handler_IsActive() && !round_handler_IsRoundStarted())
+               button_atck = button_atck2 = 0; // forbid primary and secondary fire, switching is allowed
 
        if (forbidWeaponUse(actor))
        {
                if (this.state != WS_CLEAR)
                {
                        Weapon wpn = this.m_weapon;
-                       w_ready(wpn, actor, weaponentity, PHYS_INPUT_BUTTON_ATCK(actor) | (PHYS_INPUT_BUTTON_ATCK2(actor) << 1));
+                       w_ready(wpn, actor, weaponentity, button_atck | (button_atck2 << 1));
                        return;
                }
        }
@@ -549,6 +553,9 @@ void W_WeaponFrame(Player actor, .entity weaponentity)
                bool block_weapon = false;
                {
                        bool key_pressed = PHYS_INPUT_BUTTON_HOOK(actor) && !actor.vehicle;
+                       if (round_handler_IsActive() && !round_handler_IsRoundStarted())
+                               key_pressed = false;
+
                        Weapon off = actor.offhand;
                        if (off && !(actor.weapons & WEPSET(HOOK)))
                        {
@@ -560,7 +567,7 @@ void W_WeaponFrame(Player actor, .entity weaponentity)
                                        W_SwitchWeapon(actor, WEP_HOOK, weaponentity);
                                actor.hook_switchweapon = key_pressed;
                                Weapon h = WEP_HOOK;
-                               block_weapon = (this.m_weapon == h && (PHYS_INPUT_BUTTON_ATCK(actor) || key_pressed));
+                               block_weapon = (this.m_weapon == h && (button_atck || key_pressed));
                                h.wr_think(h, actor, weaponentity, block_weapon ? 1 : 0);
                        }
                }
@@ -575,7 +582,7 @@ void W_WeaponFrame(Player actor, .entity weaponentity)
             TC(Weapon, e);
                        if (w != WEP_Null)
                        {
-                               e.wr_think(e, actor, weaponentity, PHYS_INPUT_BUTTON_ATCK(actor) | (PHYS_INPUT_BUTTON_ATCK2(actor) << 1));
+                               e.wr_think(e, actor, weaponentity, button_atck | (button_atck2 << 1));
                        }
                        else if (e)
                        {
@@ -592,7 +599,7 @@ void W_WeaponFrame(Player actor, .entity weaponentity)
                                v_up = up;
                                Weapon wpn = this.m_weapon;
                                this.weapon_think(wpn, actor, weaponentity,
-                                       PHYS_INPUT_BUTTON_ATCK(actor) | (PHYS_INPUT_BUTTON_ATCK2(actor) << 1));
+                                       button_atck | (button_atck2 << 1));
                        }
                        else
                        {