More weapon system tweaks

This commit is contained in:
Fesiug 2024-01-01 17:05:24 -05:00
parent 17d21e13ae
commit 15464b9af7
18 changed files with 162 additions and 92 deletions

View File

@ -17,7 +17,7 @@ end
function ENT:Use( activator )
if ( activator:IsPlayer() ) then
local wep = activator:GetActiveWeapon()
local bt, bc = wep:BTable(), wep:BClass()
local bt, bc = wep:bWepTable(), wep:bWepClass()
for i=1, 3 do
-- if bt["Ammo" .. i] and bt.Loaded != i then
-- bt["Ammo" .. i] = bc.Ammo

View File

@ -2,7 +2,7 @@ function SWEP:DrawWorldModel()
local p = self:GetOwner()
do
local wm = self.CWM
local class = self:BClass( false )
local class = self:bWepClass( false )
if class then
if !IsValid(wm) then
wm = ClientsideModel( class.WModel )
@ -19,7 +19,7 @@ function SWEP:DrawWorldModel()
end
do
local wm = self.CWM_Left
local class = self:BClass( true )
local class = self:bWepClass( true )
if class then
if !IsValid(wm) then
wm = ClientsideModel( class.WModel )

View File

@ -21,10 +21,10 @@ function SWEP:SecondaryAttack()
end
function SWEP:BFire( hand )
if self:BTable( hand ) and self:GetAim() == 1 then
if self:bWepTable( hand ) and self:GetAim() == 1 then
local p = self:GetOwner()
local wep_table = self:BTable( hand )
local wep_class = self:BClass( hand )
local wep_table = self:bWepTable( hand )
local wep_class = self:bWepClass( hand )
if wep_class.Custom_Fire then
if wep_class.Custom_Fire( self, wep_table, wep_class, hand ) then return end
@ -78,7 +78,7 @@ end
local bc = { effects = true, damage = true }
function SWEP:CallFire( hand )
local p = self:GetOwner()
local class = self:BClass( hand )
local class = self:bWepClass( hand )
local spread = self:BSpread( hand )
for i=1, self:GetStat( hand, "Pellets" ) do
local dir = self:GetOwner():EyeAngles()

View File

@ -114,7 +114,7 @@ SWEP.GestureDraw = { ACT_GMOD_GESTURE_MELEE_SHOVE_1HAND, 0.75 }
SWEP.GestureHolster = { ACT_GMOD_GESTURE_MELEE_SHOVE_1HAND, 0.65 }
function SWEP:TPFire( hand )
if CLIENT and !IsFirstTimePredicted() then return end
local target = self:BClass( hand ) and self:BClass( hand ).GestureFire
local target = self:bWepClass( hand ) and self:bWepClass( hand ).GestureFire
if !target then
target = self.GestureFire
end
@ -122,7 +122,7 @@ function SWEP:TPFire( hand )
end
function SWEP:TPReload( hand )
if CLIENT and !IsFirstTimePredicted() then return end
local target = self:BClass( hand ) and self:BClass( hand ).GestureReload
local target = self:bWepClass( hand ) and self:bWepClass( hand ).GestureReload
if !target then
target = self.GestureReload
end
@ -130,7 +130,7 @@ function SWEP:TPReload( hand )
end
function SWEP:TPDraw( hand )
if CLIENT and !IsFirstTimePredicted() then return end
local target = self:BClass( hand ) and self:BClass( hand ).GestureDraw
local target = self:bWepClass( hand ) and self:bWepClass( hand ).GestureDraw
if !target then
target = self.GestureDraw
end
@ -138,7 +138,7 @@ function SWEP:TPDraw( hand )
end
function SWEP:TPHolster( hand )
if CLIENT and !IsFirstTimePredicted() then return end
local target = self:BClass( hand ) and self:BClass( hand ).GestureHolster
local target = self:bWepClass( hand ) and self:bWepClass( hand ).GestureHolster
if !target then
target = self.GestureHolster
end

View File

@ -1,22 +1,22 @@
function SWEP:GetStat( hand, stat )
local Hand = ((hand==true and "Left Hand") or (hand==false and "Right Hand"))
assert( self:BClass( hand ), "No weapon in " .. Hand .. " (Trying to get stat " .. stat .. ")" )
local thereturn = (self:BClass( hand ) and self:BClass( hand )[stat])
assert( self:bWepClass( hand ), "No weapon in " .. Hand .. " (Trying to get stat " .. stat .. ")" )
local thereturn = (self:bWepClass( hand ) and self:bWepClass( hand )[stat])
assert( thereturn, "No stat for " .. stat .. " ( " .. Hand .. " )" )
return thereturn
end
function BENNY_GetStat( class, stat )
assert( class, "No class" )
local thereturn = (class[stat] or fallbackstat[stat])
local thereturn = class[stat]
assert( thereturn, "No stat for " .. stat )
return thereturn
end
function SWEP:C_DualCheck()
local p = self:GetOwner()
local lt = self:BClass( true )
local lt = self:bWepClass( true )
if lt then
if lt.Features == "firearm" then
return p:GetInfoNum( "benny_wep_ao_firearms", 1 )==1
@ -77,7 +77,7 @@ function SWEP:BHolster( hand )
local p = self:GetOwner()
--B_Sound( self, "Common.Holster" )
local item = self:BTable( hand )
local item = self:bWepTable( hand )
if item then
local class = WeaponGet(item.Class)
if class.Custom_Holster then class.Custom_Holster( self, item, class, hand ) end
@ -89,6 +89,6 @@ function SWEP:BHolster( hand )
end
function SWEP:BSpread( hand )
return self:BClass( hand ).Spread + self:bGetSpread( hand )
return self:bWepClass( hand ).Spread + self:bGetSpread( hand )
end

View File

@ -5,8 +5,8 @@ function SWEP:Reload( hand )
if hand == nil then return end -- Needs to be called from the custom ones
local p = self:GetOwner()
local inv = p:INV_Get()
local wep_table = self:BTable( hand )
local wep_class = self:BClass( hand )
local wep_table = self:bWepTable( hand )
local wep_class = self:bWepClass( hand )
if wep_table then
if wep_class.Custom_Reload then
if wep_class.Custom_Reload( self, wep_table ) then return end
@ -53,8 +53,8 @@ end
function SWEP:Reload_MagOut( hand, curmag, optinv, optwep_table, optwep_class )
local p = self:GetOwner()
local inv = optinv or p:INV_Get()
local wep_table = optwep_table or self:BTable( hand )
local wep_class = optwep_class or self:BClass( hand )
local wep_table = optwep_table or self:bWepTable( hand )
local wep_class = optwep_class or self:bWepClass( hand )
if !inv[curmag] then
-- PROTO: This happens sometimes. I'm commenting it so it doesn't look like anything broke, because it didn't.
@ -76,7 +76,7 @@ end
function SWEP:GetLoadableMagazines( hand, class, optinv, optwep_table )
local p = self:GetOwner()
local inv = optinv or p:INV_Get()
local wep_table = optwep_table or self:BTable( hand )
local wep_table = optwep_table or self:bWepTable( hand )
local maglist = p:INV_FindMag( wep_table.Class )
local usedlist = {}
@ -92,7 +92,7 @@ end
function SWEP:GetBestLoadableMagazine( hand, class, optinv, optwep_table )
local p = self:GetOwner()
local inv = optinv or p:INV_Get()
local wep_table = optwep_table or self:BTable( hand )
local wep_table = optwep_table or self:bWepTable( hand )
local maglist = p:INV_FindMag( wep_table.Class )
local mag = false
@ -117,8 +117,8 @@ end
function SWEP:Reload_MagIn( hand, curmag, optinv, optwep_table, optwep_class )
local p = self:GetOwner()
local inv = optinv or p:INV_Get()
local wep_table = optwep_table or self:BTable( hand )
local wep_class = optwep_class or self:BClass( hand )
local wep_table = optwep_table or self:bWepTable( hand )
local wep_class = optwep_class or self:bWepClass( hand )
local mag = self:GetBestLoadableMagazine( hand, wep_table.Class )
if mag then

View File

@ -1,6 +1,32 @@
-- Stat2
function SWEP:bWepTable( alt )
return self:GetOwner():INV_Get()[ ((alt==true) and self:GetWep2()) or ((alt==false) and self:GetWep1()) ]
end
function SWEP:bWepClass( alt )
local ta = self:bWepTable( alt )
if ta then
return WeaponGet( ta.Class )
else
return false
end
end
function SWEP:bMagTable( alt )
return self:GetOwner():INV_Get()[ ((alt==true) and self:GetWep2_Clip()) or ((alt==false) and self:GetWep1_Clip()) ]
end
function SWEP:bMagClass( alt )
local ta = self:bMagTable( alt )
if ta then
return WeaponGet( ta.Class )
else
return false
end
end
-- Weapon ID
function SWEP:bGetInvID( hand )
assert( hand!=nil, "Missing hand argument" )

View File

@ -28,7 +28,7 @@ else
else
data = net.ReadDouble()
end
LocalPlayer():GetActiveWeapon():BTable()[stat] = data
LocalPlayer():GetActiveWeapon():bWepTable()[stat] = data
end
end)
end

View File

@ -73,20 +73,6 @@ function SWEP:SetupDataTables()
self:SetWep2_Reloading( -1 )
end
-- BENNY shit
function SWEP:BTable( alt )
return self:GetOwner():INV_Get()[ alt and self:GetWep2() or self:GetWep1() ]
end
function SWEP:BClass( alt )
local ta = self:BTable( alt )
if ta then
return WeaponGet( ta.Class )
else
return false
end
end
function SWEP:B_Ammo( hand, value )
local p = self:GetOwner()
local inv = p:INV_Get()
@ -96,7 +82,7 @@ function SWEP:B_Ammo( hand, value )
end
function SWEP:B_Firemode( alt )
return self:BClass( alt ).Firemodes[ self:bGetFiremode( alt ) ]
return self:bWepClass( alt ).Firemodes[ self:bGetFiremode( alt ) ]
end
function SWEP:B_FiremodeName( alt )
@ -175,10 +161,10 @@ function SWEP:Think()
local p = self:GetOwner()
local inv = p:INV_Get()
local wep1 = self:BTable( false )
local wep1c = self:BClass( false )
local wep2 = self:BTable( true )
local wep2c = self:BClass( true )
local wep1 = self:bWepTable( false )
local wep1c = self:bWepClass( false )
local wep2 = self:bWepTable( true )
local wep2c = self:bWepClass( true )
if self:bGetReqInvID( false ) != "" and self:bGetReqInvID( true ) != "" and self:bGetReqInvID( false ) == self:bGetReqInvID( true ) then
self:bSetReqInvID( false, "" )
@ -199,7 +185,7 @@ function SWEP:Think()
-- Just know, this feels bad.
if self:bGetReloadTime( hand ) > 0 then
-- hold
elseif self:BClass( hand ) and self:bGetShotTime( hand ) + self:GetStat( hand, "ShootHolsterTime" ) > CurTime() then
elseif self:bWepClass( hand ) and self:bGetShotTime( hand ) + self:GetStat( hand, "ShootHolsterTime" ) > CurTime() then
-- hold
else
if curr != "" then
@ -252,7 +238,7 @@ function SWEP:Think()
for i=1, 2 do
local hand = i==2
local wep, wepc = self:BTable( hand ), self:BClass( hand )
local wep, wepc = self:bWepTable( hand ), self:bWepClass( hand )
if wepc and wepc.Features == "firearm" and self:bGetIntDelay( hand ) < CurTime()-0.01 then
local mweh = math.Remap( CurTime(), self:bGetShotTime( hand ), self:bGetShotTime( hand ) + self:GetStat( hand, "SpreadDecay_RampTime" ), 0, 1 )
mweh = math.Clamp( mweh, 0, 1 )
@ -262,10 +248,10 @@ function SWEP:Think()
end
local ht = "normal"
if self:BClass( false ) and self:bGetHolsterTime( false ) < 0 then
if self:bWepClass( false ) and self:bGetHolsterTime( false ) < 0 then
ht = "passive"
if self:GetUserAim() then
if self:BClass( true ) then
if self:bWepClass( true ) then
ht = "duel"
else
ht = self:GetStat( false, "HoldType" )
@ -281,9 +267,9 @@ function SWEP:Think()
for i=1, 2 do
local hand = i==2
if self:BClass( hand ) then
if self:BClass( hand ).Custom_Think then
self:BClass( hand ).Custom_Think( self, self:BTable( hand ), self:BClass( hand ), hand )
if self:bWepClass( hand ) then
if self:bWepClass( hand ).Custom_Think then
self:bWepClass( hand ).Custom_Think( self, self:bWepTable( hand ), self:bWepClass( hand ), hand )
end
end
end

View File

@ -14,15 +14,15 @@ local function regen_items( itemlist )
local class = inv[v].Class
local Class = WeaponGet(class)
if !catesmade[Class.Type] then
catesmade[Class.Type] = true
if !catesmade[Class.Category] then
catesmade[Class.Category] = true
local cate = vgui.Create( "DButton" )
itemlist:AddItem( cate )
cate:SetSize( 1, ss(12) )
cate:Dock( TOP )
cate:DockMargin( 0, 0, 0, ss(2) )
cate.Text_Name = Class.Type
cate.Text_Name = Class.Category
function cate:Paint( w, h )
surface.SetDrawColor( schemes[active]["bg"] )

View File

@ -64,7 +64,7 @@ local mewer = {
score_1 = rmt1c( BENNY_GetStat( class, "Damage" ) * truedelay, 100, 350 )
score_1 = score_1 * weight_1
score_2 = rmt1c( BENNY_GetStat( class, "Ammo" ), 16, 42 )
score_2 = rmt1c( BENNY_GetStat( class, "AmmoStd" ), 16, 42 )
score_2 = score_2 * weight_2
return score_1 + score_2
@ -339,7 +339,7 @@ function OpenSMenu()
surface.SetDrawColor( schema("fg") )
surface.DrawRect( 0, 0, w, h )
draw.SimpleText( BENNY_GetStat( hm, "Ammo" ) .. " rounds", "Benny_12", ss(2), ss(2), schema_c("bg") )
draw.SimpleText( BENNY_GetStat( hm, "AmmoStd" ) .. " rounds", "Benny_12", ss(2), ss(2), schema_c("bg") )
end
return true
end
@ -381,11 +381,12 @@ function OpenSMenu()
local createlist = {}
for ClassName, Class in pairs( WEAPONS ) do
if !createlist[Class.Type] then
createlist[Class.Type] = {}
if !createlist[Class.Category] then
print(Class, Class.Category)
createlist[Class.Category] = {}
end
table.insert( createlist[Class.Type], { ClassName = ClassName, Class = Class } )
table.insert( createlist[Class.Category], { ClassName = ClassName, Class = Class } )
end
for i, v in SortedPairs( createlist ) do

View File

@ -291,7 +291,7 @@ hook.Add( "CalcView", "Benny_CalcView", function( ply, pos, ang, fov )
local wep = ply:BennyCheck()
if wep then -- and ply:GetActiveWeapon():GetAim() > 0 then
local cv = wep:BClass( true ) and wep:BClass( true ).Custom_CalcView or wep:BClass( false ) and wep:BClass( false ).Custom_CalcView
local cv = wep:bWepClass( true ) and wep:bWepClass( true ).Custom_CalcView or wep:bWepClass( false ) and wep:bWepClass( false ).Custom_CalcView
local halt = false
if cv then
halt = cv( wep, view, view.origin, view.angles, view.fov )

View File

@ -487,16 +487,16 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
if wep and ConVarCL_Bool("hud_enable_active") then -- Weapon
local inv = p:INV_Get()
local wep1 = wep:BTable( false )
local wep1c = wep:BClass( false )
local wep2 = wep:BTable( true )
local wep2c = wep:BClass( true )
local wep1 = wep:bWepTable( false )
local wep1c = wep:bWepClass( false )
local wep2 = wep:bWepTable( true )
local wep2c = wep:bWepClass( true )
for i=1, 2 do
local hand = i==2
if wep:BTable( hand ) then -- New Weapon HUD
local wep_table = wep:BTable( hand )
local wep_class = wep:BClass( hand )
if wep:bWepTable( hand ) then -- New Weapon HUD
local wep_table = wep:bWepTable( hand )
local wep_class = wep:bWepClass( hand )
local p_w, p_h = ss(156), ss(64)
local p_x, p_y = sw - p_w - Wb, Hb
@ -514,7 +514,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
draw.SimpleText( wep_class.Name, "Benny_16", p_x+ss(6), p_y+ss(5), scheme["bg"], TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
local identicallist = p:INV_Find( wep:BTable( hand ).Class )
local identicallist = p:INV_Find( wep:bWepTable( hand ).Class )
identicallist = table.Flip( identicallist )
local numba = identicallist[ wep:bGetInvID( hand ) ]
draw.SimpleText( "#" .. tostring(numba) .. ", " .. wep:bGetInvID( hand ), "Benny_10", p_x+p_w-pb2, p_y+ss(7), scheme["bg"], TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP )
@ -649,11 +649,11 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
for hhhh=1, 2 do
local hand = hhhh==2
if wep:GetUserAim() and wep:BClass( hand ) then -- Crosshair
if wep:GetUserAim() and wep:bWepClass( hand ) then -- Crosshair
local s, w, h = ss, ScrW(), ScrH()
local gap = gap
if wep:BClass( hand ).Spread then
if wep:bWepClass( hand ).Spread then
gap = gap * wep:BSpread( hand )
end
@ -665,7 +665,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
local mat1 = i == 1 and mat_long_s or mat_long
local mat2 = i == 1 and mat_dot_s or mat_dot
surface.SetDrawColor( cooler )
local typ = wep:BClass( hand ).Type
local typ = wep:bWepClass( hand ).Category
if typ == "rifle" or typ == "sniper" then
surface.SetMaterial( mat1 )
surface.DrawTexturedRectRotated( poosx - s(spacer_long) - gap, poosy, s(16), s(16), 0 )
@ -742,12 +742,10 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
local boxsize = ss(b_w)
surface.SetDrawColor( scheme[active and "fg" or "bg"] )
surface.DrawRect( b_x + bump, b_y, boxsize, ss(b_h) )
--draw.SimpleText( class.Type, "Benny_8", b_x + bump + boxsize/2, b_y + ss(3), scheme["fg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP )
draw.SimpleText( class.Name, "Benny_8", b_x + bump + boxsize/2, b_y + ss(4), scheme[active and "bg" or "fg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP )
if active then
draw.SimpleText( active_r and "RIGHT" or active_l and "LEFT", "Benny_10", b_x + bump + boxsize/2, b_y + ss(10), scheme["bg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP )
end
--draw.SimpleText( "", "Benny_8", b_x + bump + boxsize/2, b_y + ss(17), scheme["fg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP )
if class.Features == "firearm" or class.Features == "grenade" then
invid = invid + 1
surface.SetDrawColor( scheme[active and "bg" or "fg"] )
@ -906,7 +904,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
local bx, by = sw/2, sh*(0.75)
local mx = 50
local wep1_table, wep1_class = wep:BTable( false ), wep:BClass( false )
local wep1_table, wep1_class = wep:bWepTable( false ), wep:bWepClass( false )
if wep1_table then
draw.SimpleText( wep1_class.Name, "Benny_14", bx-mx, by+ss(8)*-1, color_white, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP )
draw.SimpleText( "Clip1: " .. wep:Clip1(), "Benny_14", bx-mx, by+ss(8)*0, color_white, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP )
@ -917,7 +915,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
end
end
local wep2_table, wep2_class = wep:BTable( true ), wep:BClass( true )
local wep2_table, wep2_class = wep:bWepTable( true ), wep:bWepClass( true )
if wep2_table then
draw.SimpleText( wep2_class.Name, "Benny_14", bx+mx, by+ss(8)*-1, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
draw.SimpleText( "Clip2: " .. wep:Clip2(), "Benny_14", bx+mx, by+ss(8)*0, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )

View File

@ -24,8 +24,8 @@ hook.Add( "InputMouseApply", "Benny_InputMouseApply", function( cmd, x, y, ang )
local p = LocalPlayer()
local w = p:BennyCheck()
local cdis = false
if w and w:BClass( false ) and w:BClass( false ).Custom_DisableSpecialMovement and w:BClass( false ).Custom_DisableSpecialMovement( w ) then cdis = true end
if w and w:BClass( true ) and w:BClass( true ).Custom_DisableSpecialMovement and w:BClass( true ).Custom_DisableSpecialMovement( w ) then cdis = true end
if w and w:bWepClass( false ) and w:bWepClass( false ).Custom_DisableSpecialMovement and w:bWepClass( false ).Custom_DisableSpecialMovement( w ) then cdis = true end
if w and w:bWepClass( true ) and w:bWepClass( true ).Custom_DisableSpecialMovement and w:bWepClass( true ).Custom_DisableSpecialMovement( w ) then cdis = true end
if GetConVar("benny_cam_override"):GetString() != "" then cdis = true end
if p:NoclippingAndNotVaulting() then cdis = true end
if w and !cdis then
@ -85,8 +85,8 @@ hook.Add( "CreateMove", "Benny_CreateMove", function( cmd )
local w = p:BennyCheck()
local cdis = false
if w then
if w:BClass( false ) and w:BClass( false ).Custom_DisableSpecialMovement and w:BClass( false ).Custom_DisableSpecialMovement( w ) then cdis = true end
if w:BClass( true ) and w:BClass( true ).Custom_DisableSpecialMovement and w:BClass( true ).Custom_DisableSpecialMovement( w ) then cdis = true end
if w:bWepClass( false ) and w:bWepClass( false ).Custom_DisableSpecialMovement and w:bWepClass( false ).Custom_DisableSpecialMovement( w ) then cdis = true end
if w:bWepClass( true ) and w:bWepClass( true ).Custom_DisableSpecialMovement and w:bWepClass( true ).Custom_DisableSpecialMovement( w ) then cdis = true end
end
if GetConVar("benny_cam_override"):GetString() != "" then cdis = true end
if LocalPlayer():NoclippingAndNotVaulting() then cdis = true end

View File

@ -151,7 +151,7 @@ hook.Add( "Move", "Benny_Move", function( ply, mv )
local w = ply:BennyCheck()
local hand = false
if w and w:BClass( hand ) then
if w and w:bWepClass( hand ) then
local targetspeed = ply:GetMaxSpeed()
targetspeed = targetspeed * w:GetStat( hand, "Speed_Move" )

View File

@ -195,8 +195,8 @@ function PT:INV_Weight()
end
-- PROTO: HOLY SHIT THIS SUCKS, MAKES A FUNCTION AND MIGHT RUN EVERY FRAME!!!
table.sort( results, function( a, b )
return (T_WEIGHT[b[2]["Type"]] - b[1]["Acquisition"]*(1e-5))
< (T_WEIGHT[a[2]["Type"]] - a[1]["Acquisition"]*(1e-5))
return (T_WEIGHT[b[2]["Category"]] - b[1]["Acquisition"]*(1e-5))
< (T_WEIGHT[a[2]["Category"]] - a[1]["Acquisition"]*(1e-5))
end )
local finale = {}
for i, v in ipairs( results ) do
@ -278,7 +278,7 @@ do
local temp = {}
for id, data in pairs( inv ) do
local idata = WeaponGet(data.Class)
local translated = translat[idata.Type]
local translated = translat[idata.Category]
if i == translated[1] then
table.insert( temp, { id, translated[2] } )

View File

@ -1332,7 +1332,7 @@ do -- Grenades, nothing here is guaranteed.
-- TEMP: Do this right!
if !class.GrenadeCharge then self:SetGrenadeDownStart( CurTime() ) end
--
local hand = (self:BTable( true ) and self:BTable( true ).Class == data.Class) or false
local hand = (self:bWepTable( true ) and self:bWepTable( true ).Class == data.Class) or false
self:TPFire( hand )
if SERVER then GrenadeCreate( self, data ) end
local id = self:bGetInvID( hand )

View File

@ -24,6 +24,7 @@ end
ItemDef("base", {
Name = "Base Item",
Category = "base",
Type = "base",
Description = "Base of everything",
@ -56,8 +57,8 @@ ItemDef("base", {
})
ItemDef("base_firearm", {
--Name = "Base Firearm",
Type = "base",
Name = "Base Firearm",
Category = "base",
Base = "base",
Description = "Base for firearms",
Features = "firearm",
@ -72,6 +73,45 @@ ItemDef("base_firearm", {
},
},
Damage = 0,
AmmoStd = 1,
Pellets = 1,
Delay = 60/600,
Spread = 0,
SpreadAdd = 0,
SpreadAddMax = 1,
SpreadDecay_Start = 1,
SpreadDecay_End = 2,
SpreadDecay_RampTime = 1,
Reload_MagOut = 0.2,
Reload_MagIn = 0.8,
Reload_MagIn_Bonus1 = 0.56,
Reload_MagIn_Bonus2 = 0.56+0.1,
Func_Attack = function( self, hand )
end,
})
ItemDef("base_melee", {
Name = "Base Melee",
Category = "base",
Base = "base",
Description = "Base for melee weapons",
Features = "firearm",
WModel = "models/weapons/w_pistol.mdl",
HoldType = "pistol",
-- Firearm specific
Firemodes = {
{
Mode = 1,
},
},
Damage = 0,
Delay = 60/600,
@ -89,7 +129,7 @@ ItemDef("base_firearm", {
ItemDef("base_grenade", {
Name = "Base Grenade",
Type = "grenade",
Category = "grenade",
Base = "base",
Description = "Base for grenades",
Features = "grenade",
@ -100,7 +140,7 @@ ItemDef("base_grenade", {
ItemDef("base_magazine", {
Name = "Base Magazine",
Type = "magazine",
Category = "magazine",
Base = "base",
Description = "Base for magazines",
Features = "magazine",
@ -110,10 +150,10 @@ ItemDef("base_magazine", {
})
ItemDef("deagle", {
--Name = "DEAGLE",
Name = "DEAGLE",
Description = "Autoloading .50 caliber pistol.",
Base = "base_firearm",
Type = "pistol",
Category = "pistol",
WModel = "models/weapons/w_pist_deagle.mdl",
HoldType = "revolver",
@ -123,13 +163,32 @@ ItemDef("deagle", {
Sound_MagOut = "Anaconda.MagOut",
Sound_MagIn = "Anaconda.MagIn",
Sound_Cock = "Deagle.Cock",
--
AmmoStd = 7,
Delay = (60/180),
Firemodes = FIREMODE_SEMI,
Damage = 47,
Spread = 30/60,
SpreadAdd = 4,
SpreadAddMax = 15,
SpreadDecay_Start = 8,
SpreadDecay_End = 25,
SpreadDecay_RampTime = 0.5,
Speed_Move = 0.95,
Speed_Aiming = 0.95,
Speed_Reloading = 0.95,
Speed_Firing = 0.95,
Speed_FiringTime = 0.5,
})
ItemDef("mag_deagle", {
Name = "MAG: DEAGLE 7-rnd",
Base = "base_magazine",
Ammo = 7,
Ammo = 14,
})
--[[
ItemDef("deagle", {