Holstering fixes, don't equip both of same wep!
This commit is contained in:
parent
ee326c4919
commit
76d6f63350
|
@ -153,7 +153,7 @@ function SWEP:BHolster( hand )
|
|||
end
|
||||
|
||||
local p = self:GetOwner()
|
||||
B_Sound( self, "Common.Holster" )
|
||||
--B_Sound( self, "Common.Holster" )
|
||||
local item = self:BTable( hand )
|
||||
if item then
|
||||
local class = WeaponGet(item.Class)
|
||||
|
|
|
@ -198,6 +198,8 @@ end)
|
|||
|
||||
function SWEP:BStartHolster( hand )
|
||||
if self:D_GetHolstering( hand ) == -1 then
|
||||
B_Sound( self, "Common.Holster" )
|
||||
-- print( "Holstering the " .. (hand and "LEFT" or "RIGHT") )
|
||||
self:D_SetHolstering( hand, 1 )
|
||||
end
|
||||
end
|
||||
|
@ -225,14 +227,21 @@ function SWEP:Think()
|
|||
for i=1, 2 do
|
||||
local hand = i==2
|
||||
local req = self:D_GetReqID( hand )
|
||||
local req_o = self:D_GetReqID( !hand )
|
||||
local curr = self:D_GetID( hand )
|
||||
local curr_o = self:D_GetID( !hand )
|
||||
if req != curr then
|
||||
if curr != "" then
|
||||
-- require holster first
|
||||
self:BStartHolster( hand )
|
||||
else
|
||||
local otherhasthis = curr_o == req
|
||||
if req != "" and inv[req] then
|
||||
self:BDeploy( hand, req )
|
||||
if otherhasthis then
|
||||
self:BStartHolster( !hand )
|
||||
else
|
||||
self:BDeploy( hand, req )
|
||||
end
|
||||
else
|
||||
self:BStartHolster( hand )
|
||||
end
|
||||
|
|
|
@ -19,6 +19,7 @@ local function beatup( ply, num )
|
|||
local inv = ply:INV_Get()
|
||||
local wep = ply:BennyCheck()
|
||||
local iflip = table.Flip( inv )
|
||||
local hand = ply:KeyDown(IN_ZOOM)
|
||||
|
||||
local invid = 0
|
||||
for _, item in pairs( weighted ) do
|
||||
|
@ -28,27 +29,20 @@ local function beatup( ply, num )
|
|||
invid = invid + 1
|
||||
if num == 0 then num = 10 end
|
||||
if num == invid then
|
||||
if ply:KeyDown(IN_ZOOM) then
|
||||
if id == wep:D_GetID( true ) then
|
||||
return ply:SetReqID2("")
|
||||
else
|
||||
return ply:SetReqID2(id)
|
||||
end
|
||||
if id == wep:D_GetID( hand ) then
|
||||
-- If we are selected our currently equipped weapon, holster it.
|
||||
return wep:D_SetReqID( hand, "" )
|
||||
else
|
||||
if id == wep:D_GetID( false ) then
|
||||
return ply:SetReqID1("")
|
||||
else
|
||||
return ply:SetReqID1(id)
|
||||
if id == wep:D_GetID( !hand ) then
|
||||
-- If the wanted weapon is in the other hand, request to holster it.
|
||||
wep:D_SetReqID( !hand, "" )
|
||||
end
|
||||
return wep:D_SetReqID( hand, id )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if ply:KeyDown(IN_ZOOM) then
|
||||
return ply:SetReqID2( "" )
|
||||
else
|
||||
return ply:SetReqID1( "" )
|
||||
end
|
||||
return wep:D_SetReqID( hand, "" )
|
||||
end
|
||||
|
||||
hook.Add( "PlayerButtonDown", "Benny_PlayerButtonDown_Inv", function( ply, button )
|
||||
|
|
Loading…
Reference in New Issue