Perfected weapon switching, I think
This commit is contained in:
parent
7654f49d58
commit
4ab6312ab1
|
@ -33,12 +33,28 @@ local function beatup( ply, num )
|
||||||
-- If we are selected our currently equipped weapon, holster it.
|
-- If we are selected our currently equipped weapon, holster it.
|
||||||
return wep:D_SetReqID( hand, "" )
|
return wep:D_SetReqID( hand, "" )
|
||||||
else
|
else
|
||||||
if id == wep:D_GetID( !hand ) then
|
if wep:D_GetReqID( hand ) != "" then
|
||||||
-- If the wanted weapon is in the other hand, request to holster it.
|
-- Something is in this hand
|
||||||
wep:D_SetReqID( !hand, "" )
|
|
||||||
end
|
if wep:D_GetReqID( !hand ) != "" then
|
||||||
if wep:D_GetID( !hand ) != "" and wep:D_GetID( hand ) != "" then -- If we have something in this hand, swap it with the other
|
-- Something in the other hand
|
||||||
wep:D_SetReqID( !hand, wep:D_GetID( hand ) )
|
wep:D_SetReqID( !hand, wep:D_GetReqID( hand ) )
|
||||||
|
wep:D_SetReqID( hand, id )
|
||||||
|
return
|
||||||
|
else
|
||||||
|
-- Nothing in the other hand
|
||||||
|
wep:D_SetReqID( !hand, "" )
|
||||||
|
wep:D_SetReqID( hand, id )
|
||||||
|
return
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- Nothing in this hand.
|
||||||
|
if wep:D_GetReqID( !hand ) == id then
|
||||||
|
-- Weapon we want is in the other hand.
|
||||||
|
wep:D_SetReqID( !hand, "" )
|
||||||
|
wep:D_SetReqID( hand, id )
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return wep:D_SetReqID( hand, id )
|
return wep:D_SetReqID( hand, id )
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue