New spawnmenu. More derma things. Weapon stats.
This commit is contained in:
parent
76d6f63350
commit
8ebf6099ef
|
@ -6,11 +6,184 @@ end
|
|||
function GM:OnSpawnMenuClose()
|
||||
end
|
||||
|
||||
local function yea()
|
||||
return true
|
||||
end
|
||||
|
||||
local mewer = {
|
||||
{
|
||||
Func = function( class )
|
||||
return class.Name
|
||||
end,
|
||||
Size = 18,
|
||||
SizeMultiline = 18,
|
||||
Font = "Benny_18",
|
||||
},
|
||||
{
|
||||
Func = function( class )
|
||||
return class.Description
|
||||
end,
|
||||
Size = 14,
|
||||
SizeMultiline = 12,
|
||||
Font = "Benny_12",
|
||||
},
|
||||
{
|
||||
Name = "Lethality",
|
||||
Size = 12,
|
||||
Font = "Benny_10",
|
||||
Stat = function( class )
|
||||
return math.Clamp( math.Remap( class.Damage * (class.Pellets or 1), 12, 50, 0, 1 ), 0, 1 )
|
||||
end,
|
||||
},
|
||||
{
|
||||
Name = "Suppression",
|
||||
Size = 12,
|
||||
Font = "Benny_10",
|
||||
Stat = function( class )
|
||||
local dps = class.Damage * (1/class.Delay)
|
||||
return math.Clamp( math.Remap( dps, 50, 550, 0, 1 ), 0, 1 )
|
||||
end,
|
||||
},
|
||||
{
|
||||
Name = "Range",
|
||||
Size = 12,
|
||||
Font = "Benny_10",
|
||||
Stat = function( class )
|
||||
return 0
|
||||
end,
|
||||
},
|
||||
{
|
||||
Name = "Precision",
|
||||
Size = 12,
|
||||
Font = "Benny_10",
|
||||
Stat = function( class )
|
||||
return math.Clamp( math.Remap( class.Spread, 1/60, 2, 1, 0 ), 0, 1 )
|
||||
end,
|
||||
},
|
||||
{
|
||||
Name = "Control",
|
||||
Size = 12,
|
||||
Font = "Benny_10",
|
||||
Stat = function( class )
|
||||
return math.Clamp( math.Remap( class.SpreadAdd * (1/class.Delay), 1, 13, 1, 0 ), 0, 1 )
|
||||
end,
|
||||
},
|
||||
{
|
||||
Name = "Handling",
|
||||
Size = 12,
|
||||
Font = "Benny_10",
|
||||
Stat = function( class )
|
||||
return 0
|
||||
end,
|
||||
},
|
||||
{
|
||||
Name = "Maneuvering",
|
||||
Size = 12,
|
||||
Font = "Benny_10",
|
||||
Stat = function( class )
|
||||
return 0
|
||||
end,
|
||||
},
|
||||
{
|
||||
Name = "Mobility",
|
||||
Size = 12,
|
||||
Font = "Benny_10",
|
||||
Stat = function( class )
|
||||
return 0
|
||||
end,
|
||||
},
|
||||
{
|
||||
Name = "Stability",
|
||||
Size = 12,
|
||||
Font = "Benny_10",
|
||||
Stat = function( class )
|
||||
return 0
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
local function multlinetext(text, maxw, font)
|
||||
local content = {}
|
||||
local tline = ""
|
||||
local x = 0
|
||||
surface.SetFont(font)
|
||||
|
||||
local newlined = string.Split(text, "\n")
|
||||
|
||||
for _, line in pairs(newlined) do
|
||||
local words = string.Split(line, " ")
|
||||
|
||||
for _, word in pairs(words) do
|
||||
local tx = surface.GetTextSize(word)
|
||||
|
||||
if x + tx >= maxw then
|
||||
table.insert(content, tline)
|
||||
tline = ""
|
||||
x = surface.GetTextSize(word)
|
||||
end
|
||||
|
||||
tline = tline .. word .. " "
|
||||
|
||||
x = x + surface.GetTextSize(word .. " ")
|
||||
end
|
||||
|
||||
table.insert(content, tline)
|
||||
tline = ""
|
||||
x = 0
|
||||
end
|
||||
|
||||
return content
|
||||
end
|
||||
|
||||
local c_F = 184
|
||||
local c_D = 184
|
||||
local c_C = 90
|
||||
local c_B = 60
|
||||
local c_A = 12
|
||||
local c_S = 0
|
||||
|
||||
local function rank( perc )
|
||||
local letter
|
||||
local color
|
||||
if perc <= 1/10 then
|
||||
letter = "F"
|
||||
|
||||
local ler = math.Remap( perc, 0, 1/10, 0, 1 )
|
||||
color = HSVToColor( c_F, 0, .4 )
|
||||
elseif perc <= 3/10 then
|
||||
letter = "D"
|
||||
|
||||
local ler = math.Remap( perc, 1/10, 3/10, 0, 1 )
|
||||
color = HSVToColor( Lerp( ler, c_F, c_D ), Lerp( ler, 0.0, 0.5 ), .4 )
|
||||
elseif perc <= 5/10 then
|
||||
letter = "C"
|
||||
|
||||
local ler = math.Remap( perc, 3/10, 5/10, 0, 1 )
|
||||
color = HSVToColor( Lerp( ler, c_D, c_C ), Lerp( ler, 0.5, 0.5 ), Lerp( ler, 0.4, 0.6 ) )
|
||||
elseif perc <= 7/10 then
|
||||
letter = "B"
|
||||
|
||||
local ler = math.Remap( perc, 5/10, 7/10, 0, 1 )
|
||||
color = HSVToColor( Lerp( ler, c_C, c_B ), Lerp( ler, 0.5, 0.7 ), Lerp( ler, 0.6, 0.8 ) )
|
||||
elseif perc <= 9/10 then
|
||||
letter = "A"
|
||||
|
||||
local ler = math.Remap( perc, 7/10, 9/10, 0, 1 )
|
||||
color = HSVToColor( Lerp( ler, c_B, c_A ), Lerp( ler, 0.7, 0.75 ), .80 )
|
||||
elseif perc <= 1 then
|
||||
letter = "S"
|
||||
|
||||
local ler = math.Remap( perc, 9/10, 1, 0, 1 )
|
||||
color = HSVToColor( Lerp( ler, c_A, c_S ), Lerp( ler, 0.75, 0.75 ), .80 )
|
||||
end
|
||||
return letter, color
|
||||
end
|
||||
|
||||
function OpenSMenu()
|
||||
if IsValid( smenu ) then smenu:Remove() return end
|
||||
local active = GetConVar("benny_hud_tempactive"):GetString()
|
||||
smenu = vgui.Create("BFrame")
|
||||
smenu:SetSize( ss(1+(96+2)*4), ss(360) )
|
||||
smenu:SetSize( ss(640), ss(360) )
|
||||
smenu:SetTitle("Developer Spawnmenu")
|
||||
smenu:MakePopup()
|
||||
smenu:SetKeyboardInputEnabled( false )
|
||||
|
@ -18,6 +191,78 @@ function OpenSMenu()
|
|||
|
||||
local itemlist = smenu:Add("DScrollPanel")
|
||||
itemlist:Dock( FILL )
|
||||
smenu:Center()
|
||||
|
||||
local statlist = smenu:Add("DPanel")
|
||||
statlist:SetWide( ss(320) )
|
||||
statlist:Dock( RIGHT )
|
||||
statlist:DockMargin( ss(2), 0, 0, 0 )
|
||||
statlist:DockPadding( ss(2), ss(2), ss(2), ss(2) )
|
||||
function statlist:Paint( w, h )
|
||||
surface.SetDrawColor( schema("fg") )
|
||||
surface.DrawOutlinedRect( 0, 0, w, h, ss(0.5) )
|
||||
end
|
||||
|
||||
for i, us in ipairs( mewer ) do
|
||||
local fucker = statlist:Add( "DLabel" )
|
||||
fucker:SetTall( ss(us.Size) )
|
||||
fucker:Dock( TOP )
|
||||
fucker:DockMargin( 0, 0, 0, ss(2) )
|
||||
local lastheight = 0
|
||||
function fucker:Paint( w, h )
|
||||
|
||||
if us.Stat then
|
||||
surface.SetDrawColor( schema("fg") )
|
||||
surface.DrawOutlinedRect( 0, 0, w, h, ss(0.5) )
|
||||
else
|
||||
surface.SetDrawColor( schema("fg") )
|
||||
surface.DrawRect( 0, 0, w, h )
|
||||
end
|
||||
|
||||
local rang = WeaponGet( pan_active )
|
||||
if rang then
|
||||
if us.SizeMultiline then
|
||||
local multiline = multlinetext( us.Func and us.Func( rang ) or us.Name, w-ss(2), us.Font )
|
||||
for i, v in ipairs( multiline ) do
|
||||
local line = i-1
|
||||
local height = ss( us.Size + ((#multiline-1)*us.SizeMultiline) )
|
||||
if lastheight != height then
|
||||
fucker:SetTall( height )
|
||||
lastheight = height
|
||||
end
|
||||
draw.SimpleText( v, us.Font, ss(2), ss(2)+ss(us.SizeMultiline*line), schema_c(us.Stat and "fg" or "bg") )
|
||||
end
|
||||
else
|
||||
draw.SimpleText( us.Func and us.Func( rang ) or us.Name, us.Font, ss(2), ss(2), schema_c(us.Stat and "fg" or "bg") )
|
||||
end
|
||||
if us.Stat then
|
||||
local perc = us.Stat( rang )
|
||||
--perc = math.abs(math.sin(CurTime()*math.pi/(i^2)*10))
|
||||
--perc = (CurTime()*0.2+i/4) % 2
|
||||
--if perc > 1 then
|
||||
-- perc = 2-perc
|
||||
--end
|
||||
--perc = math.Remap( perc, 0, 1, 0.3, 0.8)
|
||||
local rank, col = rank( perc )
|
||||
surface.SetDrawColor( schema("fg") )
|
||||
surface.DrawRect( ss(60), 0, ss(1), h )
|
||||
draw.SimpleText( rank, us.Font, ss(60+4), ss(2), schema_c("fg") )
|
||||
surface.DrawRect( ss(60)+h, 0, ss(1), h )
|
||||
|
||||
surface.SetDrawColor( col )
|
||||
local width = w-(ss(60+1.5)+h)
|
||||
surface.DrawRect( ss(60+1)+h, h*.125, math.max( ss(1), width*perc ), h*.75 )
|
||||
for i=1, 10 do
|
||||
if i==1 then continue end
|
||||
surface.SetDrawColor( schema("fg", i%2==1 and 0.01 or 1) )
|
||||
surface.DrawRect( ss(60)+h + width*(i-1)/10, 0, ss(1), h )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local createlist = {}
|
||||
|
||||
|
@ -30,20 +275,16 @@ function OpenSMenu()
|
|||
end
|
||||
|
||||
for i, v in SortedPairs( createlist ) do
|
||||
local Collapse = itemlist:Add( "DCollapsibleCategory" )
|
||||
local Collapse = itemlist:Add( "BCollapsibleCategory" )
|
||||
Collapse:Dock( TOP )
|
||||
Collapse:SetLabel( i )
|
||||
local Lays = itemlist:Add( "DIconLayout" )
|
||||
Collapse:SetContents( Lays )
|
||||
Collapse:SetExpanded( i!="magazine" )
|
||||
Lays:Dock( FILL )
|
||||
Lays:SetSpaceX( ss(1) )
|
||||
Lays:SetSpaceY( ss(1) )
|
||||
Collapse:SetExpanded( false )
|
||||
Collapse:DockMargin( 0, 0, 0, ss(2) )
|
||||
Collapse:DockPadding( ss(2), ss(2), ss(2), ss(2) )
|
||||
for Mew, New in ipairs( v ) do
|
||||
local button = Lays:Add( "DButton" )
|
||||
button:SetSize( ss(95), ss(14) )
|
||||
--button:Dock( TOP )
|
||||
button:DockMargin( 0, 0, 0, ss(4) )
|
||||
local button = Collapse:Add( "DButton" )
|
||||
button:SetSize( ss(96), ss(20) )
|
||||
button:DockMargin( 0, 0, 0, ss(2) )
|
||||
|
||||
button.Text_Name = New.Class.Name
|
||||
button.Text_Desc = New.Class.Description
|
||||
|
@ -59,19 +300,18 @@ function OpenSMenu()
|
|||
chat.AddText( "Gave " .. WeaponGet("mag_"..New.ClassName).Name )
|
||||
end
|
||||
|
||||
function button:Think()
|
||||
if self:IsHovered() then
|
||||
pan_active = New.ClassName
|
||||
end
|
||||
end
|
||||
|
||||
function button:Paint( w, h )
|
||||
surface.SetDrawColor( schemes[active]["fg"] )
|
||||
surface.DrawRect( 0, 0, w, h )
|
||||
surface.SetDrawColor( schema("fg") )
|
||||
surface.DrawOutlinedRect( 0, 0, w, h, ss(1) )
|
||||
|
||||
surface.SetTextColor( schemes[active]["bg"] )
|
||||
|
||||
surface.SetFont( "Benny_12" )
|
||||
surface.SetTextPos( ss(2), ss(2) )
|
||||
surface.DrawText( self.Text_Name )
|
||||
|
||||
-- surface.SetFont( "Benny_10" )
|
||||
-- surface.SetTextPos( ss(4), ss(4 + 12) )
|
||||
-- surface.DrawText( self.Text_Desc )
|
||||
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 )
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,318 @@
|
|||
|
||||
local PANEL = {
|
||||
Init = function( self )
|
||||
end,
|
||||
|
||||
DoClick = function( self )
|
||||
self:GetParent():Toggle()
|
||||
end,
|
||||
|
||||
UpdateColours = function( self, skin )
|
||||
end,
|
||||
|
||||
Paint = function( self )
|
||||
return true
|
||||
end,
|
||||
|
||||
GenerateExample = function()
|
||||
end
|
||||
}
|
||||
|
||||
derma.DefineControl( "BCategoryHeader", "Category Header", PANEL, "DButton" )
|
||||
|
||||
local PANEL = {}
|
||||
|
||||
AccessorFunc( PANEL, "m_bSizeExpanded", "Expanded", FORCE_BOOL )
|
||||
AccessorFunc( PANEL, "m_iContentHeight", "StartHeight" )
|
||||
AccessorFunc( PANEL, "m_fAnimTime", "AnimTime" )
|
||||
AccessorFunc( PANEL, "m_bDrawBackground", "PaintBackground", FORCE_BOOL )
|
||||
AccessorFunc( PANEL, "m_bDrawBackground", "DrawBackground", FORCE_BOOL ) -- deprecated
|
||||
AccessorFunc( PANEL, "m_iPadding", "Padding" )
|
||||
AccessorFunc( PANEL, "m_pList", "List" )
|
||||
|
||||
function PANEL:Init()
|
||||
|
||||
self.Header = vgui.Create( "BCategoryHeader", self )
|
||||
self.Header:Dock( TOP )
|
||||
self.Header:SetSize( ss(12), ss(12) )
|
||||
|
||||
self:SetSize( ss(8), ss(8) )
|
||||
self:SetExpanded( true )
|
||||
self:SetMouseInputEnabled( true )
|
||||
|
||||
self:SetAnimTime( 0.2 )
|
||||
self.animSlide = Derma_Anim( "Anim", self, self.AnimSlide )
|
||||
|
||||
self:SetPaintBackground( true )
|
||||
end
|
||||
|
||||
function PANEL:Add( strName )
|
||||
|
||||
local button = vgui.Create( "DButton", self )
|
||||
button.Paint = function( panel, w, h ) end
|
||||
button.UpdateColours = function( button, skin )
|
||||
|
||||
if ( button.AltLine ) then
|
||||
|
||||
if ( button.Depressed || button.m_bSelected ) then return button:SetTextStyleColor( skin.Colours.Category.LineAlt.Text_Selected ) end
|
||||
if ( button.Hovered ) then return button:SetTextStyleColor( skin.Colours.Category.LineAlt.Text_Hover ) end
|
||||
return button:SetTextStyleColor( skin.Colours.Category.LineAlt.Text )
|
||||
|
||||
end
|
||||
|
||||
if ( button.Depressed || button.m_bSelected ) then return button:SetTextStyleColor( skin.Colours.Category.Line.Text_Selected ) end
|
||||
if ( button.Hovered ) then return button:SetTextStyleColor( skin.Colours.Category.Line.Text_Hover ) end
|
||||
return button:SetTextStyleColor( skin.Colours.Category.Line.Text )
|
||||
|
||||
end
|
||||
|
||||
button:SetHeight( ss(8) )
|
||||
button.DoClickInternal = function()
|
||||
|
||||
if ( self:GetList() ) then
|
||||
self:GetList():UnselectAll()
|
||||
else
|
||||
self:UnselectAll()
|
||||
end
|
||||
|
||||
button:SetSelected( true )
|
||||
|
||||
end
|
||||
|
||||
button:Dock( TOP )
|
||||
|
||||
self:InvalidateLayout( true )
|
||||
self:UpdateAltLines()
|
||||
|
||||
return button
|
||||
|
||||
end
|
||||
|
||||
function PANEL:UnselectAll()
|
||||
|
||||
for k, v in ipairs( self:GetChildren() ) do
|
||||
|
||||
if ( v.SetSelected ) then
|
||||
v:SetSelected( false )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function PANEL:UpdateAltLines()
|
||||
|
||||
for k, v in ipairs( self:GetChildren() ) do
|
||||
v.AltLine = k % 2 != 1
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
|
||||
self.animSlide:Run()
|
||||
|
||||
end
|
||||
|
||||
function PANEL:SetLabel( strLabel )
|
||||
|
||||
self.Header:SetText( strLabel )
|
||||
|
||||
end
|
||||
|
||||
function PANEL:SetHeaderHeight( height )
|
||||
|
||||
self.Header:SetTall( height )
|
||||
|
||||
end
|
||||
|
||||
function PANEL:GetHeaderHeight()
|
||||
|
||||
return self.Header:GetTall()
|
||||
|
||||
end
|
||||
|
||||
function PANEL:Paint( w, h )
|
||||
local h1 = self:GetHeaderHeight()
|
||||
local ex = self:GetExpanded()
|
||||
if ex then
|
||||
surface.SetDrawColor( schema( "fg" ) )
|
||||
surface.DrawRect( 0, 0, w, h1, ss(0.5) )
|
||||
else
|
||||
surface.SetDrawColor( schema( "fg" ) )
|
||||
surface.DrawOutlinedRect( 0, 0, w, h1, ss(0.5) )
|
||||
end
|
||||
|
||||
surface.SetDrawColor( schema( "fg" ) )
|
||||
surface.DrawOutlinedRect( 0, h1, w, h-h1, ss(0.5) )
|
||||
draw.SimpleText( (ex and "- " or "> "), "Benny_12", ss(3), ss(0.5), schema_c(ex and "bg" or "fg"), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
|
||||
draw.SimpleText( self.Header:GetText(), "Benny_12", ss(3+8), ss(1), schema_c(ex and "bg" or "fg"), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
|
||||
|
||||
return false
|
||||
|
||||
end
|
||||
|
||||
function PANEL:SetContents( pContents )
|
||||
|
||||
self.Contents = pContents
|
||||
self.Contents:SetParent( self )
|
||||
self.Contents:Dock( FILL )
|
||||
|
||||
if ( !self:GetExpanded() ) then
|
||||
|
||||
self.OldHeight = self:GetTall()
|
||||
|
||||
elseif ( self:GetExpanded() && IsValid( self.Contents ) && self.Contents:GetTall() < 1 ) then
|
||||
|
||||
self.Contents:SizeToChildren( false, true )
|
||||
self.OldHeight = self.Contents:GetTall()
|
||||
self:SetTall( self.OldHeight )
|
||||
|
||||
end
|
||||
|
||||
self:InvalidateLayout( true )
|
||||
|
||||
end
|
||||
|
||||
function PANEL:SetExpanded( expanded )
|
||||
|
||||
self.m_bSizeExpanded = tobool( expanded )
|
||||
|
||||
if ( !self:GetExpanded() ) then
|
||||
if ( !self.animSlide.Finished && self.OldHeight ) then return end
|
||||
self.OldHeight = self:GetTall()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function PANEL:Toggle()
|
||||
|
||||
self:SetExpanded( !self:GetExpanded() )
|
||||
|
||||
self.animSlide:Start( self:GetAnimTime(), { From = self:GetTall() } )
|
||||
|
||||
self:InvalidateLayout( true )
|
||||
self:GetParent():InvalidateLayout()
|
||||
self:GetParent():GetParent():InvalidateLayout()
|
||||
|
||||
local open = "1"
|
||||
if ( !self:GetExpanded() ) then open = "0" end
|
||||
self:SetCookie( "Open", open )
|
||||
|
||||
self:OnToggle( self:GetExpanded() )
|
||||
|
||||
end
|
||||
|
||||
function PANEL:OnToggle( expanded )
|
||||
|
||||
-- Do nothing / For developers to overwrite
|
||||
|
||||
end
|
||||
|
||||
function PANEL:DoExpansion( b )
|
||||
|
||||
if ( self:GetExpanded() == b ) then return end
|
||||
self:Toggle()
|
||||
|
||||
end
|
||||
|
||||
function PANEL:PerformLayout()
|
||||
|
||||
if ( IsValid( self.Contents ) ) then
|
||||
|
||||
if ( self:GetExpanded() ) then
|
||||
self.Contents:InvalidateLayout( true )
|
||||
self.Contents:SetVisible( true )
|
||||
else
|
||||
self.Contents:SetVisible( false )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if ( self:GetExpanded() ) then
|
||||
|
||||
if ( IsValid( self.Contents ) && #self.Contents:GetChildren() > 0 ) then self.Contents:SizeToChildren( false, true ) end
|
||||
self:SizeToChildren( false, true )
|
||||
|
||||
else
|
||||
|
||||
if ( IsValid( self.Contents ) && !self.OldHeight ) then self.OldHeight = self.Contents:GetTall() end
|
||||
self:SetTall( self:GetHeaderHeight() )
|
||||
|
||||
end
|
||||
|
||||
-- Make sure the color of header text is set
|
||||
self.Header:ApplySchemeSettings()
|
||||
|
||||
self.animSlide:Run()
|
||||
self:UpdateAltLines()
|
||||
|
||||
end
|
||||
|
||||
function PANEL:OnMousePressed( mcode )
|
||||
|
||||
if ( !self:GetParent().OnMousePressed ) then return end
|
||||
|
||||
return self:GetParent():OnMousePressed( mcode )
|
||||
|
||||
end
|
||||
|
||||
function PANEL:AnimSlide( anim, delta, data )
|
||||
|
||||
self:InvalidateLayout()
|
||||
self:InvalidateParent()
|
||||
|
||||
if ( anim.Started ) then
|
||||
if ( !IsValid( self.Contents ) && ( self.OldHeight || 0 ) < self.Header:GetTall() ) then
|
||||
-- We are not using self.Contents and our designated height is less
|
||||
-- than the header size, something is clearly wrong, try to rectify
|
||||
self.OldHeight = 0
|
||||
for id, pnl in ipairs( self:GetChildren() ) do
|
||||
self.OldHeight = self.OldHeight + pnl:GetTall()
|
||||
end
|
||||
end
|
||||
|
||||
if ( self:GetExpanded() ) then
|
||||
data.To = math.max( self.OldHeight, self:GetTall() )
|
||||
else
|
||||
data.To = self:GetTall()
|
||||
end
|
||||
end
|
||||
|
||||
if ( IsValid( self.Contents ) ) then self.Contents:SetVisible( true ) end
|
||||
|
||||
self:SetTall( Lerp( delta, data.From, data.To ) )
|
||||
|
||||
end
|
||||
|
||||
function PANEL:LoadCookies()
|
||||
|
||||
local Open = self:GetCookieNumber( "Open", 1 ) == 1
|
||||
|
||||
self:SetExpanded( Open )
|
||||
self:InvalidateLayout( true )
|
||||
self:GetParent():InvalidateLayout()
|
||||
self:GetParent():GetParent():InvalidateLayout()
|
||||
|
||||
end
|
||||
|
||||
function PANEL:GenerateExample( ClassName, PropertySheet, Width, Height )
|
||||
|
||||
local ctrl = vgui.Create( ClassName )
|
||||
ctrl:SetLabel( "Category List Test Category" )
|
||||
ctrl:SetSize( 300, 300 )
|
||||
ctrl:SetPadding( 10 )
|
||||
ctrl:SetHeaderHeight( 32 )
|
||||
|
||||
-- The contents can be any panel, even a DPanelList
|
||||
local Contents = vgui.Create( "DButton" )
|
||||
Contents:SetText( "This is the content of the control" )
|
||||
ctrl:SetContents( Contents )
|
||||
|
||||
ctrl:InvalidateLayout( true )
|
||||
|
||||
PropertySheet:AddSheet( ClassName, ctrl, nil, true, true )
|
||||
|
||||
end
|
||||
|
||||
derma.DefineControl( "BCollapsibleCategory", "Collapsable Category Panel", PANEL, "Panel" )
|
|
@ -15,6 +15,8 @@ function WeaponGet( classname )
|
|||
return WEAPONS[ classname ]
|
||||
end
|
||||
|
||||
do -- Sound definitions
|
||||
|
||||
AddSound( "1911.Fire", {
|
||||
"benny/weapons/1911/01.ogg",
|
||||
"benny/weapons/1911/02.ogg",
|
||||
|
@ -148,6 +150,8 @@ AddSound( "Common.Dryfire.Pistol", "benny/weapons/common/06-13.ogg", 70, 100, 0.
|
|||
AddSound( "Common.Dryfire.Rifle", "benny/weapons/common/06-12.ogg", 70, 100, 0.5, CHAN_STATIC )
|
||||
AddSound( "Common.NoAmmo", "benny/weapons/noammo.ogg", 70, 100, 0.5, CHAN_STATIC )
|
||||
|
||||
end
|
||||
|
||||
do -- Toolgun
|
||||
|
||||
local ToolGunTools = {
|
||||
|
@ -421,7 +425,7 @@ do -- Handguns
|
|||
Ammo = 12,
|
||||
Damage = 30,
|
||||
Spread = 15/60,
|
||||
SpreadAdd = 0.5,
|
||||
SpreadAdd = 0.4,
|
||||
SpreadAddMax = 15,
|
||||
|
||||
SpreadDecay_Start = 3,
|
||||
|
@ -447,7 +451,7 @@ do -- Handguns
|
|||
Sound_MagOut = "Glock.MagOut",
|
||||
Sound_MagIn = "Glock.MagIn",
|
||||
|
||||
Delay = (60/800),
|
||||
Delay = (60/900),
|
||||
Firemodes = FIREMODE_AUTOSEMI,
|
||||
Ammo = 17,
|
||||
Damage = 18,
|
||||
|
@ -482,7 +486,7 @@ do -- Handguns
|
|||
Delay = (60/180),
|
||||
Firemodes = FIREMODE_SEMI,
|
||||
Ammo = 6,
|
||||
Damage = 26,
|
||||
Damage = 36,
|
||||
Spread = 30/60,
|
||||
SpreadAdd = 1.5,
|
||||
SpreadAddMax = 15,
|
||||
|
@ -513,7 +517,7 @@ do -- Handguns
|
|||
Delay = (60/180),
|
||||
Firemodes = FIREMODE_SEMI,
|
||||
Ammo = 6,
|
||||
Damage = 49,
|
||||
Damage = 55,
|
||||
Spread = 30/60,
|
||||
SpreadAdd = 6,
|
||||
SpreadAddMax = 15,
|
||||
|
@ -544,7 +548,7 @@ do -- Handguns
|
|||
Delay = (60/180),
|
||||
Firemodes = FIREMODE_SEMI,
|
||||
Ammo = 7,
|
||||
Damage = 40,
|
||||
Damage = 47,
|
||||
Spread = 30/60,
|
||||
SpreadAdd = 4,
|
||||
SpreadAddMax = 15,
|
||||
|
@ -746,7 +750,7 @@ do -- Shotguns
|
|||
|
||||
WEAPONS["spas12"] = {
|
||||
Name = "SPAS-12",
|
||||
Description = "meow",
|
||||
Description = "Heavy metal pump-action shotgun.",
|
||||
Type = "shotgun",
|
||||
|
||||
WModel = "models/weapons/w_shotgun.mdl",
|
||||
|
@ -776,7 +780,7 @@ do -- Shotguns
|
|||
|
||||
WEAPONS["doublebarrel"] = {
|
||||
Name = "D/B",
|
||||
Description = "meow",
|
||||
Description = "Pocket-sized double-barrelled rocket of fun!",
|
||||
Type = "shotgun",
|
||||
|
||||
WModel = "models/weapons/w_shot_shorty.mdl",
|
||||
|
@ -806,7 +810,7 @@ do -- Shotguns
|
|||
|
||||
WEAPONS["aa12"] = {
|
||||
Name = "AA-12",
|
||||
Description = "meow",
|
||||
Description = "Magazine fed powerhouse.",
|
||||
Type = "shotgun",
|
||||
|
||||
WModel = "models/weapons/w_shot_br99.mdl",
|
||||
|
@ -840,7 +844,7 @@ do -- Rifles
|
|||
|
||||
WEAPONS["fnc"] = {
|
||||
Name = "FNC PARA",
|
||||
Description = "meow",
|
||||
Description = "Run of the mill automatic assault rifle.",
|
||||
Type = "rifle",
|
||||
|
||||
Icon = Material( "benny/weapons/fnc.png", "smooth" ),
|
||||
|
@ -856,7 +860,7 @@ do -- Rifles
|
|||
Delay = (60/600),
|
||||
Firemodes = FIREMODE_AUTOSEMI,
|
||||
Ammo = 30,
|
||||
Damage = 10,
|
||||
Damage = 30,
|
||||
Spread = 30/60,
|
||||
SpreadAdd = 22/60,
|
||||
SpreadAddMax = 10,
|
||||
|
@ -870,7 +874,7 @@ do -- Rifles
|
|||
|
||||
WEAPONS["qbz"] = {
|
||||
Name = "QBZ-95",
|
||||
Description = "Bullpup assault rifle.",
|
||||
Description = "Bullpup assault rifle. Low profile, great in close quarters.",
|
||||
Type = "rifle",
|
||||
|
||||
Icon = Material( "benny/weapons/fnc.png", "smooth" ),
|
||||
|
@ -886,7 +890,7 @@ do -- Rifles
|
|||
Delay = (60/800),
|
||||
Firemodes = FIREMODE_AUTOSEMI,
|
||||
Ammo = 30,
|
||||
Damage = 10,
|
||||
Damage = 30,
|
||||
Spread = 45/60,
|
||||
SpreadAdd = 35/60,
|
||||
SpreadAddMax = 10,
|
||||
|
@ -900,7 +904,7 @@ do -- Rifles
|
|||
|
||||
WEAPONS["m16a2"] = {
|
||||
Name = "M16A2",
|
||||
Description = "meow",
|
||||
Description = "Burst-fire assault rifle. Precise and effective at range.",
|
||||
Type = "rifle",
|
||||
|
||||
Icon = Material( "benny/weapons/m16a2.png", "smooth" ),
|
||||
|
@ -919,7 +923,7 @@ do -- Rifles
|
|||
{ Mode = 1 },
|
||||
},
|
||||
Ammo = 30,
|
||||
Damage = 10,
|
||||
Damage = 30,
|
||||
Spread = 22/60,
|
||||
SpreadAdd = 11/60,
|
||||
SpreadAddMax = 10,
|
||||
|
|
Loading…
Reference in New Issue