From 90f7472a8040044f64268a84a65c488055c46c1e Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 20 Jun 2011 18:42:22 +0200 Subject: [PATCH] Fix yet another bug, "Active weapon: X" centerprint spam in the first round of a NIX game. --- qcsrc/server/mutators/mutator_nix.qc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/qcsrc/server/mutators/mutator_nix.qc b/qcsrc/server/mutators/mutator_nix.qc index bed98afba..f429115ff 100644 --- a/qcsrc/server/mutators/mutator_nix.qc +++ b/qcsrc/server/mutators/mutator_nix.qc @@ -61,10 +61,13 @@ void NIX_GiveCurrentWeapon() nix_weapon = nix_nextweapon; nix_weapon_ammo = nix_nextweapon_ammo; nix_nextweapon = 0; - nix_nextchange = time + autocvar_g_balance_nix_roundtime; + if (!nix_nextchange) // no round played yet? + nix_nextchange = time; // start the first round now! + else + nix_nextchange = time + autocvar_g_balance_nix_roundtime; //weapon_action(nix_weapon, WR_PRECACHE); // forget it, too slow } - + if(nix_nextchange != self.nix_lastchange_id) // this shall only be called once per round! { self.nix_lastchange_id = nix_nextchange; @@ -98,13 +101,13 @@ void NIX_GiveCurrentWeapon() if(dt >= 1 && dt <= 5) self.nix_lastinfotime = -42; else - Send_CSQC_Centerprint_Generic(self, CPID_NIX_WPNCHANGE, strcat("^2Active weapon: ^3", W_Name(nix_weapon)), 2, dt); + Send_CSQC_Centerprint_Generic(self, CPID_NIX_WPNCHANGE, strcat("^2Active weapon: ^3", W_Name(nix_weapon)), 2, 0); } if(self.nix_lastinfotime != dt) { self.nix_lastinfotime = dt; // initial value 0 should count as "not seen" if(dt >= 1 && dt <= 5) - Send_CSQC_Centerprint_Generic(self, CPID_NIX_WPNCHANGE, strcat("^3%d^2 seconds until weapon change...\n\nNext weapon: ^3", W_Name(nix_nextweapon), "\n"), 1, dt); // TODO: send this msg only once + Send_CSQC_Centerprint_Generic(self, CPID_NIX_WPNCHANGE, strcat("^3%d^2 seconds until weapon change...\n\nNext weapon: ^3", W_Name(nix_nextweapon)), 1, dt); } if(!(self.items & IT_UNLIMITED_WEAPON_AMMO) && time > self.nix_nextincr) @@ -229,7 +232,7 @@ MUTATOR_DEFINITION(mutator_nix) { g_nix_with_laser = autocvar_g_nix_with_laser; - nix_nextchange = time; + nix_nextchange = 0; nix_nextweapon = 0; NIX_precache(); -- 2.39.2