From be25f2d056cac223a8538c19010aa9e030e31c86 Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Fri, 11 Feb 2011 22:29:46 +0200 Subject: [PATCH] Error case: Skip reloading and warn if attempting to reload a weapon that does not have WEP_FLAG_RELOADABLE. Useful for players that make new weapons, if they ever forget to add it. --- qcsrc/server/cl_weaponsystem.qc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/qcsrc/server/cl_weaponsystem.qc b/qcsrc/server/cl_weaponsystem.qc index 42128129e..2c8fd6cbd 100644 --- a/qcsrc/server/cl_weaponsystem.qc +++ b/qcsrc/server/cl_weaponsystem.qc @@ -1722,6 +1722,14 @@ void W_ReloadStart() void W_Reload(float sent_ammo_min, float sent_ammo_amount, float sent_time, string sent_sound) { + entity e; + e = get_weaponinfo(self.weapon); + if not(e.spawnflags & WEP_FLAG_RELOADABLE) // don't reload weapons that don't have the RELOADABLE flag + { + dprint("Warning: Attempted to reload a weapon that does not have the WEP_FLAG_RELOADABLE spawnflag. Fix your code!"); + return; + } + self.reload_ammo_min = sent_ammo_min; self.reload_ammo_amount = sent_ammo_amount; self.reload_time = sent_time; -- 2.39.2