Skip to content

Commit

Permalink
TTT: Display inventory with fast weapon switching
Browse files Browse the repository at this point in the history
Weapon switching is functionally identical, but at the added convenience of seeing your inventory at the same time.
  • Loading branch information
MisterDot committed Jul 13, 2015
1 parent fae0c80 commit f73e0f4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions garrysmod/gamemodes/terrortown/gamemode/cl_wepswitch.lua
Expand Up @@ -225,7 +225,7 @@ function WSWITCH:DoSelect(idx)

if self.cv.fast:GetBool() then
-- immediately confirm if fastswitch is on
self:ConfirmSelection()
self:ConfirmSelection(true)
end
end

Expand Down Expand Up @@ -283,15 +283,20 @@ function WSWITCH:Disable()
end

-- Switch to the currently selected weapon
function WSWITCH:ConfirmSelection()
self:Disable()
function WSWITCH:ConfirmSelection(noHide)
if not noHide then self:Disable() end

for k, w in pairs(self.WeaponCache) do
if k == self.Selected and IsValid(w) then
RunConsoleCommand("wepswitch", w:GetClass())
return
end
end
end
end

-- Allow for suppression of the attack command
function WSWITCH:PreventAttack()
return self.Show and !self.cv.fast:GetBool()
end

function WSWITCH:Think()
Expand Down

0 comments on commit f73e0f4

Please sign in to comment.