From d54d2465e18b69e58d0f4fd4d6c1656f55ca8d67 Mon Sep 17 00:00:00 2001 From: icedream Date: Sat, 21 Dec 2013 04:17:33 +0100 Subject: [PATCH] Prevent the weapon from shooting when pointing at invalid model. See #1 for more info on invalid model. --- lua/weapons/disguiser/init.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/weapons/disguiser/init.lua b/lua/weapons/disguiser/init.lua index 690e806..0255870 100644 --- a/lua/weapons/disguiser/init.lua +++ b/lua/weapons/disguiser/init.lua @@ -278,10 +278,16 @@ function SWEP:PrimaryAttack() return false end + // Make sure the new model is actually marked as a prop + if ( + string.sub(string.lower(entity:GetClass()), 1, 5) != "prop_" + && string.sub(string.lower(entity:GetClass()), -5, -1) != "_prop" + && string.find(string.lower(entity:GetClass()), "_prop_") == nil + ) then return false end + // Now let's disguise, shall we? self:DoShootEffect(trace.HitPos, trace.HitNormal, trace.Entity, trace.PhysicsBone, IsFirstTimePredicted()) self:Disguise(entity) - end // this is usually triggered on right mouse click