More holstering WIP

This commit is contained in:
Fesiug 2023-12-08 01:22:22 -05:00
parent 43de9503eb
commit 65b2c701b7
4 changed files with 19 additions and 9 deletions

View File

@ -32,6 +32,9 @@ function SWEP:BFire( hand )
if self:D_GetDelay( hand ) > CurTime() then
return
end
if self:D_GetHolstering( hand ) > 0 then
return
end
if self:D_GetClip( hand ) == 0 then
if self:D_GetBurst( hand ) >= 1 then
return

View File

@ -119,7 +119,7 @@ function SWEP:BDeploy( hand, id )
-- This breaks prediction somewhat!!
-- return -- PROTO: If you're in the middle of holstering, cancel it
elseif self:D_GetID( hand ) != "" then
self:BHolster( hand )
return--self:BHolster( hand )
end
local p = self:GetOwner()
local inv = p:INV_Get()
@ -133,6 +133,7 @@ function SWEP:BDeploy( hand, id )
self:D_SetMagID( hand, "" )
self:D_SetClip( hand, 0 )
self:D_SetSpread( hand, 0 )
self:D_SetDelay( hand, CurTime() + 0.35 )
B_Sound( self, "Common.Deploy" )
if item.Loaded and item.Loaded != "" then
local mid = item.Loaded

View File

@ -204,12 +204,11 @@ end
function SWEP:BThinkHolster( hand )
if self:D_GetHolstering( hand ) > 0 then
self:D_SetHolstering( hand, math.Approach( self:D_GetHolstering( hand ), 0, FrameTime() / 0.2 ) )
self:D_SetHolstering( hand, math.Approach( self:D_GetHolstering( hand ), 0, FrameTime() / 0.35 ) )
end
if self:D_GetHolstering( hand ) == 0 then
self:D_SetHolstering( hand, -1 )
self:BHolster( hand )
self:D_SetReqID( hand, "" )
end
end
@ -222,13 +221,20 @@ function SWEP:Think()
for i=1, 1 do
local hand = i==2
if self:D_GetReqID( hand ) != self:D_GetID( hand ) then
if inv[self:D_GetReqID( hand )] and self:D_GetReqID( hand ) != "" then
self:BDeploy( hand, p:GetReqID1() )
local req = self:D_GetReqID( hand )
local curr = self:D_GetID( hand )
if req != curr then
if curr != "" then
-- require holster first
self:BStartHolster( hand )
else
if req != "" and inv[req] then
self:BDeploy( hand, req )
else
self:BStartHolster( hand )
end
end
end
self:BThinkHolster( R )
-- print( self:D_GetReqID( hand ), self:D_GetID( hand ) )
@ -260,7 +266,7 @@ function SWEP:Think()
end
local ht = "normal"
if self:GetUserAim() then
if self:GetUserAim() and self:D_GetHolstering( false ) < 0 then
if self:BClass( false ) then
if self:BClass( true ) then
ht = "duel"

View File

@ -956,7 +956,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
end
end
if wep then
if false and wep then
surface.SetDrawColor( color_white )
surface.DrawRect( sw/2 - ss(400)/2, sh/2 - ss(8)/2, ss(400*wep:GetWep1_Holstering()), ss(8) )