Permalink
Browse files

Fixed right clicking on entities sending M2 to SV

Fixes a problem where right clicking on an entity with a weapon that has
secondary fire selected causing the secondary fire to be triggered.

This isn't beautiful, but it does the job.
  • Loading branch information...
1 parent 7658c99 commit 8b51995acc6c042cf7afc538ef3897a961aee33f @robotboy655 robotboy655 committed Apr 3, 2015
Showing with 7 additions and 0 deletions.
  1. +7 −0 garrysmod/lua/includes/modules/properties.lua
@@ -183,8 +183,14 @@ if ( CLIENT ) then
-- Hook the GUIMousePressed call, which is called when the client clicks on the
-- gui.
--
+
+ local wasPressed = false
hook.Add( "PreventScreenClicks", "PropertiesPreventClicks", function()
+ if ( !input.IsButtonDown( MOUSE_RIGHT ) ) then wasPressed = false end
+
+ if ( wasPressed && input.IsButtonDown( MOUSE_RIGHT ) && !input.IsButtonDown( MOUSE_LEFT ) ) then return true end
+
if ( !IsValid( vgui.GetHoveredPanel() ) || vgui.GetHoveredPanel() != g_ContextMenu ) then return end
local ply = LocalPlayer()
@@ -202,6 +208,7 @@ if ( CLIENT ) then
local hovered = GetHovered( EyePos(), ply:GetAimVector() )
if ( IsValid( hovered ) ) then
+ wasPressed = true
return true
end

0 comments on commit 8b51995

Please sign in to comment.