daddies about to kill himself BUT I fixed it :D
This commit is contained in:
parent
9856e6e6cc
commit
95b96ddb7b
|
@ -1,65 +1,56 @@
|
||||||
|
|
||||||
-- Weapon ID
|
-- Weapon ID
|
||||||
function SWEP:D_GetID( hand )
|
function SWEP:D_GetID( hand )
|
||||||
return hand and self:GetWep2() or self:GetWep1()
|
return (hand == true) and self:GetWep2() or (hand == false) and self:GetWep1()
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:D_SetID( hand, value )
|
function SWEP:D_SetID( hand, value )
|
||||||
return hand and self:SetWep2( value ) or self:SetWep1( value )
|
return (hand == true) and self:SetWep2( value ) or (hand == false) and self:SetWep1( value )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Wep. Clip ID
|
-- Wep. Clip ID
|
||||||
function SWEP:D_GetMagID( hand )
|
function SWEP:D_GetMagID( hand )
|
||||||
return hand and self:GetWep2_Clip() or self:GetWep1_Clip()
|
return (hand == true) and self:GetWep2_Clip() or (hand == false) and self:GetWep1_Clip()
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:D_SetMagID( hand, value )
|
function SWEP:D_SetMagID( hand, value )
|
||||||
print( "SetMagID: " .. tostring(hand) .. " given " .. value )
|
return (hand == true) and self:SetWep2_Clip( value ) or (hand == false) and self:SetWep1_Clip( value )
|
||||||
return hand and self:SetWep2_Clip( value ) or self:SetWep1_Clip( value )
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Weapon Firemode
|
-- Weapon Firemode
|
||||||
function SWEP:D_GetFiremode( hand )
|
function SWEP:D_GetFiremode( hand )
|
||||||
assert( hand != nil )
|
return (hand == true) and self:GetWep2_Firemode() or (hand == false) and self:GetWep1_Firemode()
|
||||||
return hand and self:GetWep2_Firemode() or self:GetWep1_Firemode()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:D_SetFiremode( hand, value )
|
function SWEP:D_SetFiremode( hand, value )
|
||||||
assert( hand != nil )
|
return (hand == true) and self:SetWep2_Firemode( value ) or (hand == false) and self:SetWep1_Firemode( value )
|
||||||
return hand and self:SetWep2_Firemode( value ) or self:SetWep1_Firemode( value )
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Weapon Burst
|
-- Weapon Burst
|
||||||
function SWEP:D_GetBurst( hand )
|
function SWEP:D_GetBurst( hand )
|
||||||
assert( hand != nil )
|
return (hand == true) and self:GetWep2_Burst() or (hand == false) and self:GetWep1_Burst()
|
||||||
return hand and self:GetWep2_Burst() or self:GetWep1_Burst()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:D_SetBurst( hand, value )
|
function SWEP:D_SetBurst( hand, value )
|
||||||
assert( hand != nil )
|
return (hand == true) and self:SetWep2_Burst( value ) or (hand == false) and self:SetWep1_Burst( value )
|
||||||
return hand and self:SetWep2_Burst( value ) or self:SetWep1_Burst( value )
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Internal SWEP Delay
|
-- Internal SWEP Delay
|
||||||
function SWEP:D_GetDelay( hand )
|
function SWEP:D_GetDelay( hand )
|
||||||
assert( hand != nil )
|
return (hand == true) and self:GetDelay2() or (hand == false) and self:GetDelay1()
|
||||||
return hand and self:GetDelay2() or self:GetDelay1()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:D_SetDelay( hand, value )
|
function SWEP:D_SetDelay( hand, value )
|
||||||
assert( hand != nil )
|
return (hand == true) and self:SetDelay2( value ) or (hand == false) and self:SetDelay1( value )
|
||||||
return hand and self:SetDelay2( value ) or self:SetDelay1( value )
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Internal SWEP Clip
|
-- Internal SWEP Clip
|
||||||
function SWEP:D_GetClip( hand )
|
function SWEP:D_GetClip( hand )
|
||||||
assert( hand != nil )
|
return (hand == true) and self:Clip2() or (hand == false) and self:Clip1()
|
||||||
return hand and self:Clip2() or self:Clip1()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:D_SetClip( hand, value )
|
function SWEP:D_SetClip( hand, value )
|
||||||
assert( hand != nil )
|
return (hand == true) and self:SetClip2( value ) or (hand == false) and self:SetClip1( value )
|
||||||
return hand and self:SetClip2( value ) or self:SetClip1( value )
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:BDeploy( hand, id )
|
function SWEP:BDeploy( hand, id )
|
||||||
|
|
|
@ -77,6 +77,7 @@ function SWEP:B_Ammo( hand, value )
|
||||||
local p = self:GetOwner()
|
local p = self:GetOwner()
|
||||||
local inv = p:INV_Get()
|
local inv = p:INV_Get()
|
||||||
self:D_SetClip( hand, value )
|
self:D_SetClip( hand, value )
|
||||||
|
print( hand, value )
|
||||||
assert( self:D_GetMagID( hand ) != "", "There is no magazine loaded!" )
|
assert( self:D_GetMagID( hand ) != "", "There is no magazine loaded!" )
|
||||||
inv[ self:D_GetMagID( hand ) ].Ammo = value
|
inv[ self:D_GetMagID( hand ) ].Ammo = value
|
||||||
end
|
end
|
||||||
|
@ -104,8 +105,8 @@ function SWEP:Reload()
|
||||||
local p = self:GetOwner()
|
local p = self:GetOwner()
|
||||||
local inv = p:INV_Get()
|
local inv = p:INV_Get()
|
||||||
if p:KeyPressed( IN_RELOAD ) then
|
if p:KeyPressed( IN_RELOAD ) then
|
||||||
for i=1, 2 do
|
-- for i=1, 2 do
|
||||||
local hand = i==2
|
local hand = self:GetTempHandedness()--true--i==2
|
||||||
local wep_table = self:BTable( hand )
|
local wep_table = self:BTable( hand )
|
||||||
local wep_class = self:BClass( hand )
|
local wep_class = self:BClass( hand )
|
||||||
if wep_table then
|
if wep_table then
|
||||||
|
@ -135,9 +136,18 @@ function SWEP:Reload()
|
||||||
PrintTable( maglist )
|
PrintTable( maglist )
|
||||||
local mag = maglist[1]
|
local mag = maglist[1]
|
||||||
if mag then
|
if mag then
|
||||||
wep_table.Loaded = mag
|
if hand then
|
||||||
self:D_SetMagID( hand, mag )
|
self:SetWep2_Clip( mag )
|
||||||
self:D_SetClip( hand, inv[mag].Ammo )
|
self:SetClip2( inv[mag].Ammo )
|
||||||
|
inv[self:GetWep2()].Loaded = mag
|
||||||
|
else
|
||||||
|
self:SetWep1_Clip( mag )
|
||||||
|
self:SetClip1( inv[mag].Ammo )
|
||||||
|
inv[self:GetWep1()].Loaded = mag
|
||||||
|
end
|
||||||
|
-- wep_table.Loaded = mag
|
||||||
|
-- self:D_SetMagID( hand, mag )
|
||||||
|
-- self:D_SetClip( hand, inv[mag].Ammo )
|
||||||
B_Sound( self, wep_class.Sound_MagIn )
|
B_Sound( self, wep_class.Sound_MagIn )
|
||||||
else
|
else
|
||||||
B_Sound( self, "Common.NoAmmo" )
|
B_Sound( self, "Common.NoAmmo" )
|
||||||
|
@ -145,7 +155,7 @@ function SWEP:Reload()
|
||||||
end
|
end
|
||||||
self:TPReload()
|
self:TPReload()
|
||||||
end
|
end
|
||||||
end
|
-- end
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -162,6 +172,11 @@ function SWEP:Think()
|
||||||
else
|
else
|
||||||
self:SetUserAim( p:KeyDown( IN_ATTACK2 ) )
|
self:SetUserAim( p:KeyDown( IN_ATTACK2 ) )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if p:KeyPressed( IN_ZOOM ) and (SERVER or (CLIENT and IsFirstTimePredicted())) then
|
||||||
|
self:SetTempHandedness( !self:GetTempHandedness() )
|
||||||
|
end
|
||||||
|
|
||||||
self:SetAim( math.Approach( self:GetAim(), self:GetUserAim() and 1 or 0, FrameTime()/0.2 ) )
|
self:SetAim( math.Approach( self:GetAim(), self:GetUserAim() and 1 or 0, FrameTime()/0.2 ) )
|
||||||
|
|
||||||
if !p:KeyDown( IN_ATTACK ) then
|
if !p:KeyDown( IN_ATTACK ) then
|
||||||
|
|
|
@ -746,7 +746,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
||||||
draw.SimpleText( "Clip2: " .. wep:Clip2(), "Trebuchet24", bx+mx, by+24*0, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
draw.SimpleText( "Clip2: " .. wep:Clip2(), "Trebuchet24", bx+mx, by+24*0, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
||||||
draw.SimpleText( "ID2: " .. wep:GetWep2(), "Trebuchet24", bx+mx, by+24*1, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
draw.SimpleText( "ID2: " .. wep:GetWep2(), "Trebuchet24", bx+mx, by+24*1, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
||||||
draw.SimpleText( "MagID2: " .. wep:D_GetMagID( true ), "Trebuchet24", bx+mx, by+24*2, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
draw.SimpleText( "MagID2: " .. wep:D_GetMagID( true ), "Trebuchet24", bx+mx, by+24*2, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
||||||
draw.SimpleText( "T_MagID2: " .. wep1_table.Loaded, "Trebuchet24", bx+mx, by+24*3, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
draw.SimpleText( "T_MagID2: " .. wep2_table.Loaded, "Trebuchet24", bx+mx, by+24*3, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end )
|
end )
|
||||||
|
|
|
@ -196,8 +196,6 @@ hook.Add("StartCommand", "Benny_INV_StartCommand", function( ply, cmd )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
wep:SetTempHandedness( cmd:KeyDown( IN_ZOOM ) )
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue