Hide base weapons and add more rifles

This commit is contained in:
Fesiug 2024-01-09 16:36:31 -05:00
parent 6b24abe5ae
commit 1e7548e93a
2 changed files with 139 additions and 9 deletions

View File

@ -246,7 +246,7 @@ function OpenSMenu()
if IsValid( smenu ) then smenu:Remove() return end if IsValid( smenu ) then smenu:Remove() return end
local active = GetConVar("benny_hud_tempactive"):GetString() local active = GetConVar("benny_hud_tempactive"):GetString()
smenu = vgui.Create("BFrame") smenu = vgui.Create("BFrame")
smenu:SetSize( ss(440), ss(360) ) smenu:SetSize( ss(350), ss(360) )
smenu:SetTitle("Developer Spawnmenu") smenu:SetTitle("Developer Spawnmenu")
smenu:MakePopup() smenu:MakePopup()
smenu:SetKeyboardInputEnabled( false ) smenu:SetKeyboardInputEnabled( false )
@ -256,8 +256,10 @@ function OpenSMenu()
itemlist:Dock( FILL ) itemlist:Dock( FILL )
smenu:Center() smenu:Center()
itemlist:GetVBar():SetWide( 0 )
local statlist = smenu:Add("DPanel") local statlist = smenu:Add("DPanel")
statlist:SetWide( ss(440/2) ) statlist:SetWide( ss(220) )
statlist:Dock( RIGHT ) statlist:Dock( RIGHT )
statlist:DockMargin( ss(2), 0, 0, 0 ) statlist:DockMargin( ss(2), 0, 0, 0 )
statlist:DockPadding( ss(2), ss(2), ss(2), ss(2) ) statlist:DockPadding( ss(2), ss(2), ss(2), ss(2) )
@ -430,6 +432,7 @@ function OpenSMenu()
local createlist = {} local createlist = {}
for ClassName, Class in pairs( WEAPONS ) do for ClassName, Class in pairs( WEAPONS ) do
if rawget(Class, "Hide") then continue end
if !createlist[Class.Category] then if !createlist[Class.Category] then
createlist[Class.Category] = {} createlist[Class.Category] = {}
end end
@ -446,8 +449,8 @@ function OpenSMenu()
Collapse:DockPadding( ss(2), ss(2), ss(2), ss(2) ) Collapse:DockPadding( ss(2), ss(2), ss(2), ss(2) )
for Mew, New in ipairs( v ) do for Mew, New in ipairs( v ) do
local button = Collapse:Add( "DButton" ) local button = Collapse:Add( "DButton" )
button:SetSize( ss(96), ss(20) ) button:SetSize( 0, ss(10) )
button:DockMargin( 0, 0, 0, ss(2) ) button:DockMargin( 0, 0, 0, ss(0) )
button.Text_Name = New.Class.Name button.Text_Name = New.Class.Name
button.Text_Desc = New.Class.Description button.Text_Desc = New.Class.Description
@ -474,11 +477,46 @@ function OpenSMenu()
end end
function button:Paint( w, h ) function button:Paint( w, h )
surface.SetDrawColor( schema("fg") )
surface.DrawOutlinedRect( 0, 0, w, h, ss(1) ) local z = 0.5
if self:IsHovered() then
draw.SimpleText( self.Text_Name, "Benny_14", w/2, ss(2), schema_c("fg"), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP )
draw.SimpleText( self.Text_Desc, "Benny_8", w/2, ss(2+8), schema_c("fg"), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP ) local nx, ny = 0, 0
for i=1, 9 do
-- PROTO: ...
if i==1 then
nx, ny = -1, -1
elseif i==2 then
nx, ny = 0, -1
elseif i==3 then
nx, ny = 1, -1
elseif i==4 then
nx, ny = -1, 0
elseif i==5 then
continue
elseif i==6 then
nx, ny = 1, 0
elseif i==7 then
nx, ny = -1, 1
elseif i==8 then
nx, ny = 0, 1
elseif i==9 then
nx, ny = 1, 1
end
nx, ny = ss(nx), ss(ny)
draw.SimpleText( self.Text_Name, "Benny_14", ss(2)+nx, ss(-1)+ny, schema_c("fg") )
end
draw.SimpleText( self.Text_Name, "Benny_14", ss(2), ss(-1), schema_c("bg") )
else
draw.SimpleText( self.Text_Name, "Benny_14", ss(2), ss(-1), schema_c("fg") )
end
--surface.SetDrawColor( schema("fg") )
--surface.DrawOutlinedRect( 0, 0, surface.GetTextSize(self.Text_Name)+ss(2+2), h )
--surface.SetDrawColor( schema("fg") )
--surface.DrawRect( ss(2), h-ss(1), surface.GetTextSize(self.Text_Name), ss(0.5) )
--draw.SimpleText( self.Text_Desc, "Benny_8", w/2, ss(2+8), schema_c("fg"), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP )
return true return true
end end
end end

View File

@ -222,6 +222,7 @@ do -- Bases
Category = "base", Category = "base",
Type = "base", Type = "base",
Description = "Base of everything", Description = "Base of everything",
Hide = true,
WModel = "models/weapons/w_357.mdl", WModel = "models/weapons/w_357.mdl",
@ -257,6 +258,7 @@ do -- Bases
Base = "base", Base = "base",
Description = "Base for firearms", Description = "Base for firearms",
Features = "firearm", Features = "firearm",
Hide = true,
WModel = "models/weapons/w_pistol.mdl", WModel = "models/weapons/w_pistol.mdl",
HoldType = "pistol", HoldType = "pistol",
@ -391,6 +393,7 @@ do -- Bases
Base = "base", Base = "base",
Description = "Base for melee weapons", Description = "Base for melee weapons",
Features = "melee", Features = "melee",
Hide = true,
WModel = "models/weapons/w_crowbar.mdl", WModel = "models/weapons/w_crowbar.mdl",
HoldType = "melee", HoldType = "melee",
@ -468,6 +471,7 @@ do -- Bases
Base = "base", Base = "base",
Description = "Base for grenades", Description = "Base for grenades",
Features = "grenade", Features = "grenade",
Hide = true,
WModel = "models/weapons/w_grenade.mdl", WModel = "models/weapons/w_grenade.mdl",
HoldType = "slam", HoldType = "slam",
@ -479,6 +483,7 @@ do -- Bases
Base = "base", Base = "base",
Description = "Base for magazines", Description = "Base for magazines",
Features = "magazine", Features = "magazine",
Hide = true,
WModel = "models/weapons/w_slam.mdl", WModel = "models/weapons/w_slam.mdl",
HoldType = "slam", HoldType = "slam",
@ -1159,6 +1164,93 @@ do -- Rifles
Speed_Firing = 0.95, Speed_Firing = 0.95,
}) })
ItemDef("qbz", {
Name = "QBZ-95",
Description = "Bullpup assault rifle. Low profile, great in close quarters.",
Base = "base_firearm",
Category = "rifle",
Icon = Material( "benny/weapons/fnc.png", "smooth" ),
WModel = "models/weapons/w_rif_bakm.mdl",
HoldType = "rpg",
GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.3 },
Sound_Fire = "QBBLSW.Fire",
Sound_DryFire = "Common.Dryfire.Rifle",
Sound_MagOut = "FNC.MagOut",
Sound_MagIn = "FNC.MagIn",
Sound_Cock = "FNC.Cock",
--
AmmoStd = 30,
AutoGenMag = true,
Delay = (60/800),
Firemodes = FIREMODE_AUTOSEMI,
Damage = 28,
Spread = 45/60,
SpreadAdd = 35/60,
SpreadAddMax = 10,
SpreadDecay_Start = 12,
SpreadDecay_End = 36,
SpreadDecay_RampTime = 0.6,
Reload_MagOut = 0.4,
Reload_MagIn = 1.5,
Reload_MagIn_Bonus1 = 0.8,
Reload_MagIn_Bonus2 = 0.8+0.1,
Speed_Move = 0.975,
Speed_Aiming = 0.975,
Speed_Reloading = 0.975,
Speed_Firing = 0.975,
})
ItemDef("m16a2", {
Name = "M16A2",
Description = "Burst-fire assault rifle. Precise and effective at range.",
Base = "base_firearm",
Category = "rifle",
Icon = Material( "benny/weapons/m16a2.png", "smooth" ),
WModel = "models/weapons/w_rif_m16a2.mdl",
HoldType = "rpg",
GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.3 },
Sound_Fire = "M16A2.Fire",
Sound_DryFire = "Common.Dryfire.Rifle",
Sound_MagOut = "M16A2.MagOut",
Sound_MagIn = "M16A2.MagIn",
Sound_Cock = "M16A2.Cock",
--
AmmoStd = 30,
AutoGenMag = true,
Delay = (60/700),
Firemodes = {
{ Mode = 3 },
{ Mode = 1 },
},
Damage = 32,
Spread = 22/60,
SpreadAdd = 11/60,
SpreadAddMax = 10,
SpreadDecay_Start = 0,
SpreadDecay_End = 12,
SpreadDecay_RampTime = 0.3,
Reload_MagOut = 0.3,
Reload_MagIn = 1.3,
Reload_MagIn_Bonus1 = 0.6,
Reload_MagIn_Bonus2 = 0.6+0.1,
Speed_Move = 0.95,
Speed_Aiming = 0.9,
Speed_Reloading = 0.95,
Speed_Firing = 0.9,
})
end end
for i, v in SortedPairs( WEAPONS ) do for i, v in SortedPairs( WEAPONS ) do