From: Mircea Kitsune Date: Fri, 11 Feb 2011 20:29:46 +0000 (+0200) Subject: Error case: Skip reloading and warn if attempting to reload a weapon that does not... X-Git-Tag: xonotic-v0.5.0~309^2~7^2~41 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=be25f2d056cac223a8538c19010aa9e030e31c86 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. --- 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;