Designated them better.

This commit is contained in:
Fesiug 2023-11-13 23:05:47 -05:00
parent 26fd76c4fd
commit d6b40ab31f
2 changed files with 33 additions and 33 deletions

View File

@ -1,53 +1,53 @@
-- Weapon ID -- Weapon ID
function SWEP:DGetWep( hand ) function SWEP:D_GetID( hand )
return hand and self:GetWep2() or self:GetWep1() return hand and self:GetWep2() or self:GetWep1()
end end
function SWEP:DSetWep( hand, value ) function SWEP:D_SetID( hand, value )
return hand and self:SetWep2( value ) or self:SetWep1( value ) return hand and self:SetWep2( value ) or self:SetWep1( value )
end end
-- Wep. Clip ID
function SWEP:D_GetMagID( hand )
return hand and self:GetWep1Clip() or self:GetWep1Clip()
end
function SWEP:D_SetMagID( hand, value )
return hand and self:SetWep1Clip( value ) or self:SetWep1Clip( value )
end
-- Weapon Firemode -- Weapon Firemode
function SWEP:DGetFiremode( hand ) function SWEP:D_GetFiremode( hand )
return hand and self:GetWep2_Firemode() or self:GetWep1_Firemode() return hand and self:GetWep2_Firemode() or self:GetWep1_Firemode()
end end
function SWEP:DSetFiremode( hand, value ) function SWEP:D_SetFiremode( hand, value )
return hand and self:SetWep2_Firemode( value ) or self:SetWep1_Firemode( value ) return hand and self:SetWep2_Firemode( value ) or self:SetWep1_Firemode( value )
end end
-- Internal SWEP Delay -- Internal SWEP Delay
function SWEP:DGetDelay( hand ) function SWEP:D_GetDelay( hand )
return hand and self:Clip2() or self:Clip1() return hand and self:Clip2() or self:Clip1()
end end
function SWEP:DSetDelay( hand, value ) function SWEP:D_SetDelay( hand, value )
return hand and self:SetDelay2( value ) or self:SetDelay1( value ) return hand and self:SetDelay2( value ) or self:SetDelay1( value )
end end
-- Internal SWEP Clip -- Internal SWEP Clip
function SWEP:DGetClip( hand ) function SWEP:D_GetClip( hand )
return hand and self:Clip2() or self:Clip1() return hand and self:Clip2() or self:Clip1()
end end
function SWEP:DSetClip( hand, value ) function SWEP:D_SetClip( hand, value )
return hand and self:SetClip2( value ) or self:SetClip1( value ) return hand and self:SetClip2( value ) or self:SetClip1( value )
end end
-- Wep. Clip ID
function SWEP:DGetWepClip( hand )
return hand and self:GetWep1Clip() or self:GetWep1Clip()
end
function SWEP:DSetWepClip( hand, value )
return hand and self:SetWep1Clip( value ) or self:SetWep1Clip( value )
end
function SWEP:BDeploy( hand, id ) function SWEP:BDeploy( hand, id )
if self:DGetWep( hand ) == id then if self:D_GetWep( hand ) == id then
return -- PROTO: If you're in the middle of holstering, cancel it return -- PROTO: If you're in the middle of holstering, cancel it
elseif self:DGetWep( hand ) != "" then elseif self:D_GetWep( hand ) != "" then
self:BHolster( hand ) self:BHolster( hand )
end end
local p = self:GetOwner() local p = self:GetOwner()
@ -58,8 +58,8 @@ function SWEP:BDeploy( hand, id )
assert( item, "That item doesn't exist. " .. tostring(item) ) assert( item, "That item doesn't exist. " .. tostring(item) )
self:DSetWep( hand, id ) self:D_SetWep( hand, id )
self:DSetWepClip( hand, item.Loaded ) self:D_SetMagID( hand, item.Loaded )
-- PROTO: Make grenade/melee/firearm logic way way better. -- PROTO: Make grenade/melee/firearm logic way way better.
if class.Features == "firearm" then if class.Features == "firearm" then
@ -67,14 +67,14 @@ function SWEP:BDeploy( hand, id )
assert( item[ "Ammo" .. item.Loaded ], "That magazine doesn't exist." ) assert( item[ "Ammo" .. item.Loaded ], "That magazine doesn't exist." )
end end
self:DSetClip( hand, item.Loaded == 0 and 0 or item[ "Ammo" .. item.Loaded ] ) self:D_SetClip( hand, item.Loaded == 0 and 0 or item[ "Ammo" .. item.Loaded ] )
else else
self:DSetClip( hand, 0 ) self:D_SetClip( hand, 0 )
end end
end end
function SWEP:BHolster( hand ) function SWEP:BHolster( hand )
if self:DGetWep( hand ) == "" then if self:D_GetWep( hand ) == "" then
return -- What the hell are you holstering..? return -- What the hell are you holstering..?
end end
local p = self:GetOwner() local p = self:GetOwner()
@ -85,10 +85,10 @@ function SWEP:BHolster( hand )
if class.Holster then class.Holster( self, self:BTable( false ) ) end if class.Holster then class.Holster( self, self:BTable( false ) ) end
self:DSetWep( hand, "" ) self:D_SetWep( hand, "" )
-- PROTO: Make grenade/melee/firearm logic way way better. -- PROTO: Make grenade/melee/firearm logic way way better.
if class.Features == "firearm" then if class.Features == "firearm" then
self:DSetClip( hand, 0 ) self:D_SetClip( hand, 0 )
end end
end end

View File

@ -102,7 +102,7 @@ function SWEP:B_Ammo( alt, value )
end end
function SWEP:B_Firemode( alt ) function SWEP:B_Firemode( alt )
return self:BClass( alt ).Firemodes[ self:DGetFiremode( alt ) ] return self:BClass( alt ).Firemodes[ self:D_GetFiremode( alt ) ]
end end
function SWEP:B_FiremodeName( alt ) function SWEP:B_FiremodeName( alt )
@ -127,22 +127,22 @@ function SWEP:Reload()
if self:BClass( hand ).Reload then if self:BClass( hand ).Reload then
if self:BClass( hand ).Reload( self, self:BTable( hand ) ) then return end if self:BClass( hand ).Reload( self, self:BTable( hand ) ) then return end
end end
if self:DGetDelay( hand ) > CurTime() then if self:D_GetDelay( hand ) > CurTime() then
return false return false
end end
if self:DGetWepClip( hand ) != 0 then if self:D_GetMagID( hand ) != 0 then
B_Sound( self, self:BClass( hand ).Sound_MagOut ) B_Sound( self, self:BClass( hand ).Sound_MagOut )
self:DSetClip( hand, 0 ) self:D_SetClip( hand, 0 )
self:DSetWepClip( hand, 0 ) self:D_SetMagID( hand, 0 )
self:BTable( hand ).Loaded = 0 self:BTable( hand ).Loaded = 0
else else
local maglist = { self:BTable( hand ).Ammo1, self:BTable( hand ).Ammo2, self:BTable( hand ).Ammo3 } local maglist = { self:BTable( hand ).Ammo1, self:BTable( hand ).Ammo2, self:BTable( hand ).Ammo3 }
for i, v in SortedPairsByValue( maglist, true ) do for i, v in SortedPairsByValue( maglist, true ) do
if v == 0 then B_Sound( self, "Common.NoAmmo" ) return end if v == 0 then B_Sound( self, "Common.NoAmmo" ) return end
self:BTable( hand ).Loaded = i self:BTable( hand ).Loaded = i
self:DSetClip( hand, v ) self:D_SetClip( hand, v )
self:DSetWepClip( hand, i ) self:D_SetMagID( hand, i )
break break
end end
B_Sound( self, self:BClass( hand ).Sound_MagIn ) B_Sound( self, self:BClass( hand ).Sound_MagIn )