X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fweapons%2Fweaponsystem.qc;h=b75881127a219008f56faaad9d086817d922ab4c;hb=af230839d237b3e8d617f0dccf5d650e88744ac0;hp=e7ab90c39eb2441408dcb86027b8de34e7c377d1;hpb=797bf448a96c0c13d783c7c919bb2caf6fa16707;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index e7ab90c39..b75881127 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -435,13 +435,20 @@ void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void( } } -bool forbidWeaponUse(entity player) +bool weaponUseForbidden(entity player) +{ + if (round_handler_IsActive() && !round_handler_IsRoundStarted()) return true; + if (MUTATOR_CALLHOOK(ForbidWeaponUse, player)) return true; + return false; +} + +bool weaponLocked(entity player) { if (time < game_starttime && !sv_ready_restart_after_countdown) return true; if (player.player_blocked) return true; if (game_stopped) return true; if (STAT(FROZEN, player)) return true; - if (MUTATOR_CALLHOOK(ForbidWeaponUse, player)) return true; + if (MUTATOR_CALLHOOK(LockWeapon, player)) return true; return false; } @@ -459,10 +466,10 @@ void W_WeaponFrame(Player actor, .entity weaponentity) int button_atck = PHYS_INPUT_BUTTON_ATCK(actor); int button_atck2 = PHYS_INPUT_BUTTON_ATCK2(actor); - if (round_handler_IsActive() && !round_handler_IsRoundStarted()) + if (weaponUseForbidden(actor)) button_atck = button_atck2 = 0; // forbid primary and secondary fire, switching is allowed - if (forbidWeaponUse(actor)) + if (weaponLocked(actor)) { if (this.state != WS_CLEAR) { @@ -591,7 +598,7 @@ 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()) + if (weaponUseForbidden(actor)) key_pressed = false; Weapon off = actor.offhand;