Improvements to weapon switching system
This commit is contained in:
parent
6253014a01
commit
887688a14a
|
@ -196,20 +196,34 @@ end)
|
||||||
|
|
||||||
function SWEP:Think()
|
function SWEP:Think()
|
||||||
local p = self:GetOwner()
|
local p = self:GetOwner()
|
||||||
|
local inv = p:INV_Get()
|
||||||
|
|
||||||
if p:GetReqID1() != self:D_GetID( false ) then
|
local L, R = true, false
|
||||||
if p:GetReqID1() != "" then
|
local curr_l, curr_r = self:D_GetID( true ), self:D_GetID( false )
|
||||||
self:BDeploy( false, p:GetReqID1() )
|
|
||||||
|
if p:GetReqID1() != self:D_GetID( R ) then
|
||||||
|
if inv[p:GetReqID1()] and p:GetReqID1() != "" then
|
||||||
|
if curr_r != "" then
|
||||||
|
-- We already have something equipped here, move it to the offhand
|
||||||
|
self:BDeploy( L, curr_r )
|
||||||
|
p:SetReqID2( curr_r )
|
||||||
|
end
|
||||||
|
self:BDeploy( R, p:GetReqID1() )
|
||||||
else
|
else
|
||||||
self:BHolster( false )
|
self:BHolster( R )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if p:GetReqID2() != self:D_GetID( true ) then
|
if p:GetReqID2() != self:D_GetID( L ) then
|
||||||
if p:GetReqID2() != "" then
|
if inv[p:GetReqID2()] and p:GetReqID2() != "" then
|
||||||
self:BDeploy( true, p:GetReqID2() )
|
if curr_l != "" then
|
||||||
|
-- We already have something equipped here, move it to the offhand
|
||||||
|
self:BDeploy( R, curr_l )
|
||||||
|
p:SetReqID1( curr_l )
|
||||||
|
end
|
||||||
|
self:BDeploy( L, p:GetReqID2() )
|
||||||
else
|
else
|
||||||
self:BHolster( true )
|
self:BHolster( L )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue