]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Proper complaining when there's no ammo to reload
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 21 Jan 2011 16:45:38 +0000 (18:45 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 21 Jan 2011 16:45:38 +0000 (18:45 +0200)
qcsrc/server/cl_weaponsystem.qc

index cb8ff3d5985dea0c82729c6d0475a38f03773259..94074f1000cca7cac7569b121586a5e0b183b52e 100644 (file)
@@ -1627,6 +1627,7 @@ void W_SetupProjectileVelocity(entity missile, float pSpeed, float spread)
 #define W_SETUPPROJECTILEVELOCITY(m,s) W_SetupProjectileVelocityEx(m, w_shotdir, v_up, cvar(#s "_speed"), 0, 0, cvar(#s "_spread"), FALSE)
 
 // shared weapon reload code
+.float reload_complain;
 float W_ReloadCheck(float ammo_amount)
 {
        entity e;
@@ -1639,7 +1640,12 @@ float W_ReloadCheck(float ammo_amount)
        // no ammo, so nothing to load
        if(!ammo_amount)
        {
-               print("Cannot reload, not enough ammo\n");
+               if(clienttype(self) == CLIENTTYPE_REAL && self.reload_complain < time)
+               {
+                       play2(self, "weapons/unavailable.wav");
+                       sprint(self, strcat("You don't have any ammo to reload the ^2", W_Name(self.weapon), "\n"));
+                       self.reload_complain = time + 1;
+               }
                self.ammo_counter = -1; // reload later
                W_SwitchToOtherWeapon(self);
                return 0;