X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fweapons%2Fweaponsystem.qc;h=1605db39d2228550b50bce4ab04041b7349e3cbe;hb=627f552545e5fb21aca7d81d7630adde3c61ad94;hp=93d2af55b49c94ec83fe07c400cf3ac75254a931;hpb=b5442fdfdf2e03ce9ac6d80508037a8a7b4c35ba;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 93d2af55b..1605db39d 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -70,7 +70,7 @@ vector CL_Weapon_GetShotOrg(int wpn) void CL_Weaponentity_Think(entity this) { this.nextthink = time; - if (gameover) this.frame = this.anim_idle.x; + if (game_stopped) this.frame = this.anim_idle.x; .entity weaponentity = this.weaponentity_fld; if (this.owner.(weaponentity) != this) { @@ -418,11 +418,9 @@ 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 (game_stopped) return true; if (STAT(FROZEN, player)) return true; - if (player.weapon_blocked) return true; if (MUTATOR_CALLHOOK(ForbidWeaponUse, player)) return true; return false; } @@ -438,13 +436,34 @@ 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; + } + } + + if(autocvar_g_weaponswitch_debug == 2 && weaponslot(weaponentity) > 0) + { + .entity wepe1 = weaponentities[0]; + entity wep1 = actor.(wepe1); + this.m_switchweapon = wep1.m_switchweapon; + if(!(this.m_switchweapon.spawnflags & WEP_FLAG_DUALWIELD)) + { + this.m_weapon = WEP_Null; + this.m_switchingweapon = WEP_Null; + this.m_switchweapon = WEP_Null; + this.state = WS_CLEAR; + this.weaponname = ""; return; } } @@ -455,7 +474,6 @@ void W_WeaponFrame(Player actor, .entity weaponentity) this.m_switchingweapon = WEP_Null; this.state = WS_CLEAR; this.weaponname = ""; - // actor.items &= ~IT_AMMO; return; } @@ -499,7 +517,7 @@ void W_WeaponFrame(Player actor, .entity weaponentity) this.clip_load = this.clip_size = 0; } - weapon_thinkf(actor, weaponentity, WFRAME_IDLE, newwep.switchdelay_raise, w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, newwep.switchdelay_raise, w_ready); break; } case WS_DROP: @@ -550,6 +568,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))) { @@ -561,7 +582,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); } } @@ -576,7 +597,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) { @@ -593,7 +614,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 {