Whole rewrite of game code

This commit is contained in:
Fesiug 2024-03-07 20:34:16 -05:00
parent b1d6191469
commit 40a6931f51
Signed by: Fesiug
GPG Key ID: 374BFF45E1EEF243
30 changed files with 24 additions and 4481 deletions

View File

@ -0,0 +1,14 @@
---------------------
-- Your Name is Benny
---------------------
function GM:CalcView( ply, pos, ang, fov )
local view = {
origin = pos + (ang:Forward() * -64),
angles = angles,
fov = fov,
drawviewer = true
}
return view
end

View File

@ -1,4 +1,2 @@
-- Thing
include( "shared.lua" )

View File

@ -1,6 +1,4 @@
-- Thing
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )

View File

@ -1,4 +1,8 @@
---------------------
-- Your Name is Benny
---------------------
ITEMS = {}
local itemmeta = {}

View File

@ -1,42 +0,0 @@
-- Benny quirk system
PERKS = {}
CAT_MENTAL = 1
CAT_PHYSICAL = 2
CAT_TRAINING = 3
CAT_OPERATIONAL = 4
PERKS[CAT_MENTAL] = {}
PERKS[CAT_PHYSICAL] = {}
PERKS[CAT_TRAINING] = {}
PERKS[CAT_OPERATIONAL] = {}
PERKS[CAT_MENTAL]["overprepared"] = 1 -- Magazines & grenades take less inventory space
PERKS[CAT_MENTAL]["resilience"] = 1 -- Near immunity to fall damage
PERKS[CAT_MENTAL]["paranoid"] = 2 -- Indicator when being targeted from outside your FoV.
PERKS[CAT_MENTAL]["stoic"] = 2 -- Flinch less from damage.
PERKS[CAT_MENTAL]["bloodthirsty"] = 2 -- Instantly regenerate health from melee and thrown kills
PERKS[CAT_MENTAL]["relentless"] = 3 -- Faster melee swings on a hit.
PERKS[CAT_PHYSICAL]["sling"] = 1 -- Hipfire accuracy increase
PERKS[CAT_PHYSICAL]["armpadding"] = 2 -- No health damage when blocking blunt melee, but stamina damage still applies
PERKS[CAT_PHYSICAL]["stabkevlar"] = 2 -- Half health damage when blocking sharp melee, but stamina damage still applies
PERKS[CAT_PHYSICAL]["tacticalgloves"] = 2 -- Switch weapons faster
PERKS[CAT_PHYSICAL]["platecarrier"] = 3 -- More inventory slots (+2?)
PERKS[CAT_PHYSICAL]["lightweight"] = 3 -- Aim down sights faster.
PERKS[CAT_TRAINING]["freerunner"] = 1 -- Faster movement, shorter cooldowns, quicker movement actions.
PERKS[CAT_TRAINING]["legday"] = 1 -- Higher vaulting & jumping.
PERKS[CAT_TRAINING]["readyup"] = 1 -- Weapon is ready faster after sprinting
PERKS[CAT_TRAINING]["hitman"] = 2 -- Take down enemies without revealing their location
PERKS[CAT_TRAINING]["athletic"] = 2 -- Infinite sprint
PERKS[CAT_TRAINING]["counters"] = 3 -- Perfect blocks on melee damage stuns enemies.
PERKS[CAT_OPERATIONAL]["blindeye"] = 1 -- Enemy electronics take much longer to spot you.
PERKS[CAT_OPERATIONAL]["scavenger"] = 1 -- Replenish ammo from enemy corpses.
PERKS[CAT_OPERATIONAL]["deadsilence"] = 2 -- Move almost quietly.
PERKS[CAT_OPERATIONAL]["blastresponse"] = 2 -- Enemies damaged by explosions show up on radar.
PERKS[CAT_OPERATIONAL]["offthegrid"] = 3 -- Don't show up on radar
PERKS[CAT_OPERATIONAL]["wiretap"] = 3 -- Hack into enemy equipment

View File

@ -1,78 +0,0 @@
-- Audio & caption system
CAPTIONS = {}
CAPTIONS["en-us"] = {}
function RegisterCaption( Name, Subject, Color, Text, TypeTime, LifeTime, Bold, Italic )
CAPTIONS["en-us"][Name] = {
Name = Subject,
Color = Color,
Text = Text,
TypeTime = TypeTime,
LifeTime = LifeTime,
Bold = Bold,
Italic = Italic,
}
end
RegisterCaption("1911.Fire", "Cobra .45", color_white, "[fire]", 0.1, 0.5, false, true )
RegisterCaption("1911.Reload", "Cobra .45", color_white, "[reload]", 0.1, 0.5, false, true )
RegisterCaption("Bizon.Fire", "Bizon", color_white, "[fire]", 0.1, 0.5, false, true )
RegisterCaption("Bizon.Reload", "Bizon", color_white, "[reload]", 0.1, 0.5, false, true )
RegisterCaption("TMP.Fire", "TMP", color_white, "[fire]", 0.1, 0.5, false, true )
RegisterCaption("TMP.Reload", "TMP", color_white, "[reload]", 0.1, 0.5, false, true )
RegisterCaption("USP.Fire", "USP", color_white, "[fire]", 0.1, 0.5, false, true )
RegisterCaption("USP.Reload", "USP", color_white, "[reload]", 0.1, 0.5, false, true )
RegisterCaption("Glock.Fire", "Glock", color_white, "[fire]", 0.1, 0.5, false, true )
RegisterCaption("Glock.Reload", "Glock", color_white, "[reload]", 0.1, 0.5, false, true )
RegisterCaption("MP5K.Fire", "MP5K", color_white, "[fire]", 0.1, 0.5, false, true )
RegisterCaption("MP5K.Reload", "MP5K", color_white, "[reload]", 0.1, 0.5, false, true )
RegisterCaption("MAC11.Fire", "MAC11", color_white, "[fire]", 0.1, 0.5, false, true )
RegisterCaption("MAC11.Reload", "MAC11", color_white, "[reload]", 0.1, 0.5, false, true )
RegisterCaption("MP7.Fire", "MP7", color_white, "[fire]", 0.1, 0.5, false, true )
RegisterCaption("MP7.Reload", "MP7", color_white, "[reload]", 0.1, 0.5, false, true )
RegisterCaption("Anaconda.Fire", "Anaconda", color_white, "[fire]", 0.1, 0.5, false, true )
RegisterCaption("Anaconda.Reload", "Anaconda", color_white, "[reload]", 0.1, 0.5, false, true )
RegisterCaption("Nambu.Fire", "Nambu", color_white, "[fire]", 0.1, 0.5, false, true )
RegisterCaption("Nambu.Reload", "Nambu", color_white, "[reload]", 0.1, 0.5, false, true )
SOUNDS = {}
function AddSound( name, path, sndlevel, pitch, volume, channel )
SOUNDS[name] = {
path = path,
sndlevel = sndlevel or 70,
pitch = pitch or 100,
volume = volume or 1,
channel = channel or CHAN_STATIC,
}
end
local screwup = SERVER and Color(150, 255, 255) or Color(255, 200, 150)
function B_Sound( ent, tag )
if !tag then return end
local tagt = SOUNDS[tag]
if !tagt then MsgC( screwup, "Invalid sound " .. tag .. "\n" ) return end
local path, sndlevel, pitch, volume, channel = tagt.path, tagt.sndlevel, tagt.pitch, tagt.volume, tagt.channel
if istable( path ) then
path = path[math.Round(util.SharedRandom( "B_Sound", 1, #path ))]
end
ent:EmitSound( path, sndlevel, pitch, volume, channel )
if CLIENT and IsFirstTimePredicted() then
if CAPTIONS[tag] then
local capt = CAPTIONS[tag]
AddCaption( capt.Name, capt.Color, capt.Text, capt.TypeTime, capt.LifeTime )
else
MsgC( screwup, "No caption defined for " .. tag .. "\n" )
end
end
end
RegisterCaption("Common.Deploy", "DEBUG", color_white, "[deploy]", 0.1, 0.5, false, true )
RegisterCaption("Common.Holster", "DEBUG", color_white, "[holster]", 0.1, 0.5, false, true )
RegisterCaption("Common.ReloadFail", "DEBUG", color_white, "[fail]", 0.1, 0.5, false, true )
CAPTIONS = CAPTIONS["en-us"]

View File

@ -1,10 +0,0 @@
local UUID_chars = "0123456789ABCDEF"
function UUID_generate()
local str = ""
for i=1, 8 do
str = str .. UUID_chars[ math.random( 1, #UUID_chars ) ]
end
return str
end

View File

@ -1,95 +0,0 @@
-- Meanings: Default, Min, Max, Replicated, Archived, Hint
-- Replicated is Userinfo in Client.
CONVARS_SV = {}
CONVARS_SV["cam_override"] = { "", nil, nil, true, false, "X Y Z P Y R FOV" }
CONVARS_SV["cam_unlock"] = { 0, 0, 1, true, false, "First person (sort of)" }
CONVARS_SV["net_easyway"] = { 0, 0, 1, true, false, "Use a disgusting way of networking inventories for minimal desync." }
CONVARS_SV["cheat_infiniteammo"] = { 0, 0, 1, true, false, "Cheat: Don't expend ammo." }
CONVARS_SV["tempchar"] = { "benny", nil, nil, true, false, "Temporary character." }
CONVARS_SV_GEN = {}
for i, v in pairs( CONVARS_SV ) do
CONVARS_SV_GEN[i] = CreateConVar( "benny_" .. i, v[1], (v[4] and FCVAR_REPLICATED or 0) + (v[5] and FCVAR_ARCHIVE or 0), v[6], v[2], v[3] )
end
function ConVarSV( name )
return CONVARS_SV_GEN[name]
end
function ConVarSV_Bool( name )
return ConVarSV( name ):GetBool()
end
function ConVarSV_String( name )
return ConVarSV( name ):GetString()
end
function ConVarSV_Int( name )
return ConVarSV( name ):GetInt()
end
function ConVarSV_Float( name )
return ConVarSV( name ):GetFloat()
end
if CLIENT then -- CL CL CL
CONVARS_CL = {}
CONVARS_CL["lang"] = { "en-us", nil, nil, false, true, "Active language" }
CONVARS_CL["hud_scale"] = { 2, 1, 4, false, true, "HUD integer scaling" }
CONVARS_CL["hud_tempactive"] = { "benny", nil, nil, false, true, "HUD color scheme temporary" }
CONVARS_CL["hud_enable_health"] = { 1, nil, nil, false, true, "Draw Health panel" }
CONVARS_CL["hud_enable_hotbar"] = { 1, nil, nil, false, true, "Draw Hotbar panel" }
CONVARS_CL["hud_enable_active"] = { 1, nil, nil, false, true, "Draw Active Weapons panel" }
CONVARS_CL["hud_enable_hints"] = { 1, nil, nil, false, true, "Draw Hints panel" }
CONVARS_CL["wep_toggleaim"] = { 1, 0, 1, true, true, "Hold or toggle to aim weapon." }
CONVARS_CL["wep_ao_firearms"] = { 1, 0, 1, true, true, "Whether offhand firearms overrides primary attack." }
CONVARS_CL["wep_ao_grenades"] = { 0, 0, 1, true, true, "Whether offhand grenades overrides primary attack." }
CONVARS_CL["wep_ao_junk"] = { 0, 0, 1, true, true, "Whether offhand junk overrides primary attack." }
CONVARS_CL["wep_toolgun"] = { "", nil, nil, true, true, "Toolgun tool." }
CONVARS_CL["cam_override"] = { "", nil, nil, false, true, "Override camera" }
CONVARS_CL["cam_unlock"] = { 0, 0, 1, false, false, "Unlock camera" }
CONVARS_CL["bind2_reload"] = { KEY_R, nil, nil, true, true, "Bind for Reload" }
CONVARS_CL["bind2_reloada"] = { KEY_T, nil, nil, true, true, "Bind for ReloadAlt" }
CONVARS_CL_GEN = {}
for i, v in pairs( CONVARS_CL ) do
CONVARS_CL_GEN[i] = CreateConVar( "benny_" .. i, v[1], (v[4] and FCVAR_USERINFO or 0) + (v[5] and FCVAR_ARCHIVE or 0), v[6], v[2], v[3] )
end
function ConVarCL( name )
return CONVARS_CL_GEN[name]
end
function ConVarCL_Bool( name )
return ConVarCL( name ):GetBool()
end
function ConVarCL_String( name )
return ConVarCL( name ):GetString()
end
function ConVarCL_Int( name )
return ConVarCL( name ):GetInt()
end
function ConVarCL_Float( name )
return ConVarCL( name ):GetFloat()
end
end -- CL end CL end CL end

View File

@ -1,416 +0,0 @@
-- Deadeye Choreographer
local function QUICKDIRT( self, w, h, no_bg )
if !no_bg then
local r, g, b = schemes["benny"]["bg"]:Unpack()
surface.SetDrawColor( r, g, b, 200 )
surface.DrawRect( 0, 0, w, h )
end
surface.SetDrawColor( schemes["benny"]["fg"] )
surface.DrawOutlinedRect( 0, 0, w, h, 1 )
end
local function QUICKEARTH( self, w, h )
local r, g, b = schemes["benny"]["fg"]:Unpack()
surface.SetDrawColor( r, g, b, 200 )
surface.DrawRect( 0, 0, w, h )
end
local function QUICKNIL( self, w, h )
end
local FIRST = {
"left_lowerer",
"left_outer_raiser",
"left_inner_raiser",
"left_cheek_puffer",
"left_cheek_raiser",
"left_lid_closer",
"left_lid_droop",
"left_lid_raiser",
"left_lid_tightener",
"left_mouth_drop",
"left_upper_raiser",
"left_dimpler",
"left_funneler",
"left_part",
"left_puckerer",
"left_stretcher",
"left_corner_depressor",
"left_corner_puller",
}
local SECOND = {
"jaw_clencher",
"jaw_drop",
"jaw_sideways",
"lip_bite",
"lower_lip",
"presser",
"tightener",
"wrinkler",
"dilator",
"bite",
"blink",
"half_closed",
"chin_raiser",
"mouth_sideways",
"sneer_left",
"body_rightleft",
"chest_rightleft",
"eyes_rightleft",
"eyes_updown",
"gesture_rightleft",
"gesture_updown",
"head_forwardback",
"head_rightleft",
"head_tilt",
"head_updown",
}
local SIDE_L = {
["left_cheek_puffer"] = "right_cheek_puffer",
["left_cheek_raiser"] = "right_cheek_raiser",
["left_corner_depressor"] = "right_corner_depressor",
["left_corner_puller"] = "right_corner_puller",
["left_lid_closer"] = "right_lid_closer",
["left_lid_droop"] = "right_lid_droop",
["left_lid_raiser"] = "right_lid_raiser",
["left_lid_tightener"] = "right_lid_tightener",
["left_upper_raiser"] = "right_upper_raiser",
["left_outer_raiser"] = "right_outer_raiser",
["left_inner_raiser"] = "right_inner_raiser",
["left_mouth_drop"] = "right_mouth_drop",
["left_dimpler"] = "right_dimpler",
["left_funneler"] = "right_funneler",
["left_part"] = "right_part",
["left_puckerer"] = "right_puckerer",
["left_stretcher"] = "right_stretcher",
["left_lowerer"] = "right_lowerer",
}
local SIDE_R = {
["right_cheek_puffer"] = "left_cheek_puffer",
["right_cheek_raiser"] = "left_cheek_raiser",
["right_corner_depressor"] = "left_corner_depressor",
["right_corner_puller"] = "left_corner_puller",
["right_lid_closer"] = "left_lid_closer",
["right_lid_droop"] = "left_lid_droop",
["right_lid_raiser"] = "left_lid_raiser",
["right_lid_tightener"] = "left_lid_tightener",
["right_upper_raiser"] = "left_upper_raiser",
["right_outer_raiser"] = "left_outer_raiser",
["right_inner_raiser"] = "left_inner_raiser",
["right_mouth_drop"] = "left_mouth_drop",
["right_dimpler"] = "left_dimpler",
["right_funneler"] = "left_funneler",
["right_part"] = "left_part",
["right_puckerer"] = "left_puckerer",
["right_stretcher"] = "left_stretcher",
["right_lowerer"] = "left_lowerer",
}
local PRETTY = {
["left_outer_raiser"] = "Brow Outer Raiser",
["left_inner_raiser"] = "Brow Inner Raiser",
["left_lowerer"] = "Brow Lowerer",
["left_cheek_puffer"] = "Cheek Puffer",
["left_cheek_raiser"] = "Cheek Raiser",
["left_lid_closer"] = "Lid Closer",
["left_lid_droop"] = "Lid Droop",
["left_lid_raiser"] = "Lid Raiser",
["left_lid_tightener"] = "Lid Tightener",
["left_mouth_drop"] = "Mouth Drop",
["left_upper_raiser"] = "Lip Upper Raiser",
["left_dimpler"] = "Lip Dimpler",
["left_funneler"] = "Lip Funneler",
["left_part"] = "Lip Part",
["left_puckerer"] = "Lip Puckerer",
["left_stretcher"] = "Lip Stretcher",
["left_corner_depressor"] = "Lip Corner Depr.",
["left_corner_puller"] = "Lip Corner Puller",
["right_outer_raiser"] = "Brow Outer Raiser",
["right_inner_raiser"] = "Brow Inner Raiser",
["right_lowerer"] = "Brow Lowerer",
["right_cheek_puffer"] = "Cheek Puffer",
["right_cheek_raiser"] = "Cheek Raiser",
["right_lid_closer"] = "Lid Closer",
["right_lid_droop"] = "Lid Droop",
["right_lid_raiser"] = "Lid Raiser",
["right_lid_tightener"] = "Lid Tightener",
["right_mouth_drop"] = "Mouth Drop",
["right_upper_raiser"] = "Lip Upper Raiser",
["right_dimpler"] = "Lip Dimpler",
["right_funneler"] = "Lip Funneler",
["right_part"] = "Lip Part",
["right_puckerer"] = "Lip Puckerer",
["right_stretcher"] = "Lip Stretcher",
["right_corner_depressor"] = "Lip Corner Depr.",
["right_corner_puller"] = "Lip Corner Puller",
["jaw_clencher"] = "Jaw Clencher",
["jaw_drop"] = "Jaw Drop",
["jaw_sideways"] = "Jaw Sideways",
["lip_bite"] = "Lip Bite",
["lower_lip"] = "Lip Lower Depr.",
["presser"] = "Lip Presser",
["tightener"] = "Lip Tightener",
["wrinkler"] = "Nose Wrinkler",
["dilator"] = "Nose Dilator",
["bite"] = "Bite",
["blink"] = "Blink",
["half_closed"] = "Half Closed",
["chin_raiser"] = "Chin Raiser",
["mouth_sideways"] = "Mouth Sideways",
["sneer_left"] = "Sneer Left",
["body_rightleft"] = "Body Rightleft",
["chest_rightleft"] = "Chest Rightleft",
["eyes_rightleft"] = "Eyes Rightleft",
["eyes_updown"] = "Eyes Updown",
["gesture_rightleft"] = "Gesture Rightleft",
["gesture_updown"] = "Gesture Updown",
["head_forwardback"] = "Head Forwardback",
["head_rightleft"] = "Head Rightleft",
["head_tilt"] = "Head Tilt",
["head_updown"] = "Head Updown",
}
local function makeme( id, parent, ent, no_dock )
local SLIDER = parent:Add( "DNumSlider" )
SLIDER:SetText( PRETTY[ ent:GetFlexName( id ) ] or ent:GetFlexName( id ) )
local min, max = ent:GetFlexBounds( id )
SLIDER:SetMin( min )
SLIDER:SetMax( max )
SLIDER:SetDecimals( 2 )
SLIDER:SetTall( 18 )
if !no_dock then
SLIDER:Dock( TOP )
SLIDER:DockMargin( 10, 0, 10, 0 )
end
SLIDER.Label:SetWide( 90 )
function SLIDER:PerformLayout() return end
function SLIDER:OnValueChanged( val )
if !DEADEYE_MEM.Flex then DEADEYE_MEM.Flex = {} end
DEADEYE_MEM.Flex[ ent:GetFlexName( id ) ] = val
end
function SLIDER:Think()
if DEADEYE_MEM.Flex then
self:SetValue( DEADEYE_MEM.Flex[ ent:GetFlexName( id ) ] )
end
end
return SLIDER
end
DEADEYE_MEM = DEADEYE_MEM or {}
function OpenDeadeye()
if IsValid( GOD ) then GOD:Remove() end
GOD = vgui.Create( "DFrame" )
GOD:SetTitle( "Deadeye Choreographer" )
GOD:SetSize( ScrW()*0.9, ScrH()*0.9 )
GOD:Center()
GOD:MakePopup()
GOD:SetSizable( true )
GOD.Paint = QUICKDIRT
do -- Menubar
local MENUBAR = GOD:Add( "DMenuBar" )
MENUBAR:Dock( TOP )
MENUBAR:DockMargin( -5, -5, -5, 8 )
MENUBAR.Paint = QUICKDIRT
local MENU_FILE = MENUBAR:AddMenu( "File" )
MENU_FILE:AddOption( "New", function() table.Empty( DEADEYE_MEM ) OpenDeadeye() end )
MENU_FILE:AddOption( "Open", function() end )
local MENU_EDIT = MENUBAR:AddMenu( "Edit" )
local MENU_ABOUT = MENUBAR:AddMenu( "About" )
end
local NAME = {
"X",
"Y",
"Z",
"P",
"Y",
"R",
}
do -- Main
local MAIN = GOD:Add( "DPanel" )
MAIN:Dock( FILL )
MAIN.Paint = QUICKNIL
local SIDE_MODEL = MAIN:Add( "DPanel" )
SIDE_MODEL.Paint = QUICKNIL
local SIDE_CHOREO = MAIN:Add( "DPanel" )
SIDE_CHOREO.Paint = QUICKDIRT
local SIDEDIV = MAIN:Add( "DVerticalDivider" )
SIDEDIV:Dock( FILL )
SIDEDIV:SetTop( SIDE_MODEL )
SIDEDIV:SetBottom( SIDE_CHOREO )
SIDEDIV:SetDividerHeight( 8 )
SIDEDIV:SetTopMin( 20 )
SIDEDIV:SetBottomMin( 240 )
SIDEDIV:SetTopHeight( 500 )
do -- Model side (top)
local MODEL = SIDE_MODEL:Add( "DAdjustableModelPanel" )
MODEL:SetFOV( 30 )
MODEL:SetModel( "models/alyx.mdl" )
MODEL:SetLookAng( Angle( 0, 180, 0 ) )
MODEL:SetCamPos( Vector( 64, 0, 64 ) )
function MODEL:LayoutEntity( Entity )
if DEADEYE_MEM.Flex then
for i=0, Entity:GetFlexNum()-1 do
if !DEADEYE_MEM.Flex[ Entity:GetFlexName( i ) ] then continue end
Entity:SetFlexWeight( i, DEADEYE_MEM.Flex[ Entity:GetFlexName( i ) ] )
end
else
DEADEYE_MEM.Flex = {}
for i=0, Entity:GetFlexNum()-1 do
DEADEYE_MEM.Flex[ Entity:GetFlexName( i ) ] = 0--Entity:GetFlexWeight( i )
end
end
self.Entity:SetEyeTarget( self:GetCamPos() )
return
end
function MODEL:PaintOver( w, h )
QUICKDIRT( self, w, h, true )
local fuckp, fucka = MODEL:GetCamPos(), MODEL:GetLookAng()
local PX, PY, PZ, AP, AY, AR = fuckp.x, fuckp.y, fuckp.z, fucka.p, fucka.y, fucka.r
PX, PY, PZ, AP, AY, AR = math.Round( PX ), math.Round( PY ), math.Round( PZ ), math.Round( AP ), math.Round( AY ), math.Round( AR )
draw.SimpleText( "pos: " .. PX .. " " .. PY .. " " .. PZ, "Trebuchet24", 8, 4, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
draw.SimpleText( "ang: " .. AP .. " " .. AY .. " " .. AR, "Trebuchet24", 8, 4+24, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
draw.SimpleText( "fov: " .. math.Round( MODEL:GetFOV() ), "Trebuchet24", 8, 4+48, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
end
local MODELPSHEET = SIDE_MODEL:Add( "DPropertySheet" )
MODELPSHEET.Paint = QUICKDIRT
local MODELSETTINGS = SIDE_MODEL:Add( "DScrollPanel" )
MODELSETTINGS.Paint = QUICKDIRT
MODELPSHEET:AddSheet( "Actor Alyx", MODELSETTINGS )
local flexlist = {}
for i=0, MODEL.Entity:GetFlexNum()-1 do -- Model settings
flexlist[MODEL.Entity:GetFlexName( i )] = true
end
local madelist = {}
local MARKF = MODELSETTINGS:Add( "DHorizontalDivider" )
MARKF:Dock( TOP )
MARKF:DockMargin( 130, 0, -140, 0 )
MARKF:SetDividerWidth( 0 )
local LABELR = MODELSETTINGS:Add("DLabel")
LABELR:SetText( "Right" )
local LABELL = MODELSETTINGS:Add("DLabel")
LABELL:SetText( "Left" )
MARKF:SetLeft( LABELR )
MARKF:SetRight( LABELL )
local old = MARKF.PerformLayout
function MARKF:PerformLayout( w, h )
self:SetLeftWidth( w / 2 )
old( self, w, h )
end
for v, i in ipairs( FIRST ) do
local MARK = MODELSETTINGS:Add( "DHorizontalDivider" )
MARK:Dock( TOP )
MARK:DockMargin( 10, -4, 10, -4 )
MARK:SetDividerWidth( 0 )
local SLIDERA = makeme( MODEL.Entity:GetFlexIDByName( SIDE_L[i] ), MODELSETTINGS, MODEL.Entity, true )
local SLIDERB = makeme( MODEL.Entity:GetFlexIDByName( i ), MODELSETTINGS, MODEL.Entity, true )
madelist[SIDE_L[i]] = true
madelist[i] = true
MARK:SetLeft( SLIDERA )
MARK:SetRight( SLIDERB )
local old = MARK.PerformLayout
function MARK:PerformLayout( w, h )
self:SetLeftWidth( w / 2 )
old( self, w, h )
end
end
for v, i in SortedPairs( SECOND ) do
if !madelist[i] then
local id = MODEL.Entity:GetFlexIDByName( i )
makeme( id, MODELSETTINGS, MODEL.Entity )
madelist[i] = true
end
end
for i, v in SortedPairs( flexlist ) do
if !madelist[i] then
local id = MODEL.Entity:GetFlexIDByName( i )
makeme( id, MODELSETTINGS, MODEL.Entity )
madelist[i] = true
end
end
local DIVIDER = SIDE_MODEL:Add( "DHorizontalDivider" )
DIVIDER:Dock( FILL )
DIVIDER:SetLeft( MODEL )
DIVIDER:SetRight( MODELPSHEET )
DIVIDER:SetDividerWidth( 8 )
DIVIDER:SetLeftMin( 20 )
DIVIDER:SetRightMin( 240 )
DIVIDER:SetLeftWidth( 800 )
end
do -- Choreo side (bottom)
local PLAY = SIDE_CHOREO:Add( "DButton" )
PLAY:SetPos( 4, 4 )
PLAY:SetSize( 80, 20 )
PLAY:SetText( "Play/Pause" )
PLAY.Paint = QUICKDIRT
local SPEED = SIDE_CHOREO:Add( "DNumSlider" )
SPEED:SetPos( 4+4+80, 4 )
SPEED:SetSize( 180, 20 )
SPEED:SetText( "Speed" )
SPEED.Label:SetWide( 0 )
function SPEED:PerformLayout()
return true
end
SPEED:SetMin( 0 )
SPEED:SetMax( 100 )
SPEED:SetValue( 100 )
SPEED:SetDecimals( 0 )
SPEED.Paint = QUICKDIRT
do
local BLINKY = SIDE_CHOREO:Add( "DPanel" )
BLINKY:SetPos( 4, 4+4+20 )
BLINKY.Paint = QUICKDIRT
function BLINKY:PerformLayout( w, h )
local par = SIDE_CHOREO
BLINKY:SetSize( par:GetWide() - 8, par:GetTall() - 20 - 12 )
end
end
end
end
end
if IsValid( GOD ) then OpenDeadeye() end
concommand.Add("benny_ui_deadeye", function()
OpenDeadeye()
end)

View File

@ -1,189 +0,0 @@
-- Dev inventory
local function regen_items( itemlist )
local ply = LocalPlayer()
local inv = ply:INV_Get()
local active = GetConVar("benny_hud_tempactive"):GetString()
itemlist:Clear()
local maidlist = {}
local catesmade = {}
for i, v in pairs( ply:INV_ListFromBuckets() ) do
local class = inv[v].Class
local Class = ITEMS[class]
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.Category
function cate:Paint( w, h )
surface.SetDrawColor( schemes[active]["bg"] )
surface.DrawRect( 0, 0, w, h )
surface.SetDrawColor( schemes[active]["fg"] )
surface.DrawOutlinedRect( 0, 0, w, h, ss(0.5) )
surface.SetTextColor( schemes[active]["fg"] )
surface.SetFont( "Benny_10" )
surface.SetTextPos( ss(2), ss(2) )
surface.DrawText( self.Text_Name )
return true
end
end
local button = vgui.Create( "DButton" )
itemlist:AddItem( button )
button:SetSize( 1, ss(24) )
button:Dock( TOP )
button:DockMargin( 0, 0, 0, ss(2) )
button.ID = v
local mag = false
if class:Left( 4 ) == "mag_" then
mag = true
button:SetTall( ss(11) )
end
if !maidlist[class] then
maidlist[class] = table.Flip( ply:INV_Find( class ) )
end
local ml = maidlist[class]
button.Text_Name = Class.Name
button.Text_Desc = Class.Description
button.Text_ID = "[" .. ml[v] .. "] " .. button.ID
-- PROTO: These functions don't need to be remade over and over like this.
function button:DoClick()
do return end
local Menu = DermaMenu()
local opt1 = Menu:AddOption( "Equip Right", function()
RunConsoleCommand( "benny_inv_equip", button.ID, "false" )
end)
opt1:SetIcon( "icon16/resultset_last.png" )
local opt3 = Menu:AddOption( "Equip Right, Move Left", function()
RunConsoleCommand( "benny_inv_equip", button.ID, "false", "true" )
end)
opt3:SetIcon( "icon16/resultset_next.png" )
Menu:AddSpacer()
local opt2 = Menu:AddOption( "Equip Left", function()
RunConsoleCommand( "benny_inv_equip", button.ID, "true" )
end)
opt2:SetIcon( "icon16/resultset_first.png" )
local opt4 = Menu:AddOption( "Equip Left, Move Right", function()
RunConsoleCommand( "benny_inv_equip", button.ID, "true", "true" )
end)
opt4:SetIcon( "icon16/resultset_previous.png" )
Menu:AddSpacer()
local opt5 = Menu:AddOption( "Holster", function()
RunConsoleCommand( "benny_inv_holster", button.ID )
end)
opt5:SetIcon( "icon16/control_pause_blue.png" )
local opt6 = Menu:AddOption( "Discard", function()
RunConsoleCommand("benny_inv_discard", button.ID)
self:Remove()
end)
opt6:SetIcon( "icon16/bin.png" )
Menu:Open()
-- timer.Simple( 0.1, function() if IsValid( itemlist ) then regen_items( itemlist ) end end )
end
button.DoRightClick = function( self )
do return end
RunConsoleCommand("benny_inv_discard", button.ID)
self:Remove()
end
function button:Paint( w, h )
surface.SetDrawColor( schemes[active]["fg"] )
surface.DrawRect( 0, 0, w, h )
surface.SetTextColor( schemes[active]["bg"] )
surface.SetFont( !mag and "Benny_16" or "Benny_10" )
surface.SetTextPos( ss(2), ss(2) )
surface.DrawText( self.Text_Name )
if !mag then
surface.SetFont( "Benny_12" )
surface.SetTextPos( ss(2), ss(2 + 11) )
surface.DrawText( self.Text_Desc )
end
local wep = ply:BennyCheck()
if wep then
local handed_r = wep:bGetInvID( false ) == v
local handed_l = wep:bGetInvID( true ) == v
if handed_r or handed_l then
draw.SimpleText( handed_l and "LEFT" or "RIGHT", "Benny_18", w/2, h/2 + ss(1), schema_c("bg"), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
end
end
surface.SetFont( "Benny_10" )
local tx = surface.GetTextSize( self.Text_ID )
surface.SetTextPos( w - ss(2) - tx, ss(2) )
surface.DrawText( self.Text_ID )
return true
end
button.B = button:Add("DButton")
button.B:Dock( RIGHT )
function button.B:DoClick()
button:Remove()
return RunConsoleCommand( "benny_inv_discard", button.ID )
end
function button.B:Paint( w, h )
surface.SetDrawColor( schema( "fg" ) )
surface.DrawRect( 0, 0, w, h )
surface.SetDrawColor( schema( "bg" ) )
surface.DrawOutlinedRect( 0, 0, w, h, ss(1) )
draw.SimpleText( "DISCARD", "Benny_10", w/2, h/2 + ss(1), schema_c("bg"), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
return true
end
button.B:DockMargin( ss(2), ss(2), ss(2), ss(2) )
button.B:SetSize( ss(36), ss(24) )
function button:Think()
local visible = self.B:IsHovered() or self:IsHovered()
self.B:SetVisible( visible )
end
end
end
function OpenDebugInv()
if IsValid( base ) then base:Remove() return end
base = vgui.Create("BFrame")
base:SetSize( ss(400), ss(400) )
base:SetTitle("Developer Inventory")
base:MakePopup()
base:SetKeyboardInputEnabled( false )
base:Center()
local itemlist = base:Add("DScrollPanel")
itemlist:Dock( FILL )
regen_items( itemlist )
end
concommand.Add("benny_ui_inv", function()
OpenDebugInv()
end)

View File

@ -1,2 +0,0 @@
-- Final inventory customizer for MP

View File

@ -1,97 +0,0 @@
-- Main menu
local meow = {
"RESUME",
"",
"START GAME",
"LOAD GAME",
"",
"JOIN SERVER",
"START SERVER",
"",
"OPTIONS",
"QUIT",
}
local function unimplemented()
if mb and mb:IsValid() then mb:Remove() end
mb = vgui.Create( "BFrame" )
mb:SetSize( ss(160), ss(50) )
mb:Center()
mb:MakePopup()
mb:SetTitle( "Woops!" )
local oldpaint = mb.Paint
function mb:Paint( w, h )
oldpaint( self, w, h )
surface.SetDrawColor( schema("fg") )
surface.DrawOutlinedRect( 0, 0, w, h, ss(1) )
draw.SimpleText( "That isn't implemented yet.", "Benny_12", w/2, ss(18), schema_c("fg"), TEXT_ALIGN_CENTER )
end
local okbutton = mb:Add("DButton")
okbutton:SetText("")
okbutton:SetSize( ss(30), ss(12) )
okbutton:SetPos( mb:GetWide()/2 - okbutton:GetWide()/2, mb:GetTall() - okbutton:GetTall() - ss(6) )
function okbutton:Paint( w, h )
surface.SetDrawColor( schema("bg") )
surface.DrawRect( 0, 0, w, h )
surface.SetDrawColor( schema("fg") )
surface.DrawOutlinedRect( 0, 0, w, h, ss(1) )
draw.SimpleText( "OK", "Benny_10", w/2, ss(2), schema_c("fg"), TEXT_ALIGN_CENTER )
end
function okbutton:DoClick()
mb:Remove()
end
end
function CreateMainMenu()
if mm and mm:IsValid() then mm:Remove() end
mm = vgui.Create( "BFrame" )
mm:SetSize( ScrW(), ScrH() )
mm:Center()
mm:MakePopup()
mm:SetPopupStayAtBack( true )
mm:SetTitle("Main Menu")
local oldpaint = mm.Paint
function mm:Paint( w, h )
oldpaint( self, w, h )
draw.SimpleText( "YOUR", "Benny_48", ss(34), self:GetTall()/2 - ss(54 + (28*3)), schema_c("fg") )
draw.SimpleText( "NAME", "Benny_48", ss(34), self:GetTall()/2 - ss(54 + (28*2)), schema_c("fg") )
draw.SimpleText( "IS", "Benny_48", ss(34), self:GetTall()/2 - ss(54 + (28*1)), schema_c("fg") )
draw.SimpleText( "BENNY", "Benny_72", ss(32), self:GetTall()/2 - ss(58 + (28*0)), schema_c("fg") )
end
local bump = -ss(32)
for i=#meow, 1, -1 do
local label = meow[i]
local spacer = label == ""
local button = mm:Add("DButton")
button:SetText("")
button:SetSize( ss(256), ss(spacer and 0 or 16) )
button:SetPos( ss(32), mm:GetTall() + ss(bump) )
function button:Paint( w, h )
if !spacer then
surface.SetDrawColor( schema("bg") )
surface.DrawRect( 0, 0, w, h )
surface.SetDrawColor( schema("fg") )
surface.DrawOutlinedRect( 0, 0, w, h, ss(0.5) )
draw.SimpleText( label, "Benny_16", ss(4+16), ss(2), schema_c("fg") )
end
end
button.DoClick = unimplemented
bump = bump - (spacer and 12 or (16+4))
end
end
concommand.Add("benny_ui_mainmenu", function()
CreateMainMenu()
end)

View File

@ -1,142 +0,0 @@
-- Settings panel
-- 0 = checkbox, 1 = slider, 2 = string, 3 = binder
local conf = {
[1] = {
{ 0, "benny_hud_enable_health", "Health", },
{ 0, "benny_hud_enable_active", "Active Weapon", },
{ 0, "benny_hud_enable_hints", "Hints", },
{ 0, "benny_hud_enable_hotbar", "Hotbar", },
{ 1, "benny_hud_scale", "Scale", 1, 4, 0 },
},
[2] = {
{ 0, "benny_wep_ao_firearms", "Firearms Override Primary Attack" },
{ 2, "Like traditional akimbo, pressing Left Mouse will shoot an offhand firearm." },
{ 0, "benny_wep_ao_grenades", "Grenades Override Primary Attack" },
{ 2, "Pressing Left Mouse will throw an offhand grenade." },
{ 0, "benny_wep_ao_junk", "Junk Overrides Primary Attack" },
{ 2, "Pressing Left Mouse will throw offhand junk." },
{ 3, "benny_bind_reload", "Reload" },
{ 3, "benny_bind_reloada", "Reload Alt" },
},
[3] = {
{ 4, function( Scroll )
local Butt = Scroll:Add("DLabel")
Butt:Dock(TOP)
Butt:DockMargin( ss(24+4), 0, 0, 0 )
Butt:SetText( "Character Appearance" )
local Down = Scroll:Add("DComboBox")
Down:Dock( TOP )
Down:DockMargin( ss(24), 0, ss(24), ss(2) )
Down:SetValue( ConVarSV_String("tempchar") )
Down:AddChoice( "Benny", "benny" )
Down:AddChoice( "Nikki", "nikki" )
Down:AddChoice( "Igor", "igor" )
Down:AddChoice( "Yang-Hao", "yanghao" )
Down:AddChoice( "z: CIA", "mp_cia" )
Down:AddChoice( "z: PLASOF", "mp_plasof" )
Down:AddChoice( "z: MILITIA", "mp_militia" )
Down:AddChoice( "z: ARNG", "mp_natguard" )
Down:AddChoice( "z: VIPER", "mp_viper" )
Down:AddChoice( "z: HALO", "mp_halo" )
function Down:OnSelect( index, value, data )
RunConsoleCommand( "benny_tempchar", data )
RunConsoleCommand( "benny_hud_tempactive", data )
end
end },
},
}
local function genpan( Base, Sect, Conf )
local Scroll = Base:Add("DPanel")
Scroll:DockPadding( 10, 5, 10, 5 )
Scroll.Paint = function() end
Sect:SetContents( Scroll )
for i, v in ipairs( Conf ) do
if v[1] == 0 then
local Butt = Scroll:Add("DCheckBoxLabel")
Butt:Dock(TOP)
Butt:DockMargin( 0, ss(2), 0, ss(2) )
Butt:SetText( v[3] )
Butt:SetConVar( v[2] )
elseif v[1] == 1 then
local Butt = Scroll:Add("DNumSlider")
Butt:Dock(TOP)
Butt:DockMargin( 0, ss(2), 0, ss(2) )
Butt:SetText( v[3] )
Butt:SetConVar( v[2] )
Butt:SetMin( v[4] )
Butt:SetMax( v[5] )
Butt:SetDecimals( v[6] )
elseif v[1] == 2 then
local Butt = Scroll:Add("DLabel")
Butt:Dock(TOP)
Butt:DockMargin( ss(12), ss(-4), 0, 0 )
Butt:SetText( v[2] )
elseif v[1] == 3 then
local Butt = Scroll:Add("DLabel")
Butt:Dock(TOP)
Butt:DockMargin( ss(24+4), 0, 0, 0 )
Butt:SetText( v[3] )
local Butt = Scroll:Add("DBinder")
Butt:Dock(TOP)
Butt:DockMargin( ss(24), 0, ss(24), ss(2) )
Butt:SetText( v[2] )
function Butt:OnChange( num )
RunConsoleCommand( v[2], num )
end
elseif v[1] == 4 then
v[2]( Scroll )
end
end
end
function OpenSettingsMenu()
if IsValid( SettingsMenu ) then SettingsMenu:Remove() return end
local Base = vgui.Create("BFrame")
SettingsMenu = Base
Base:SetTitle("Settings")
Base:SetSize( ss(300), ss(300) )
Base:Center()
Base:MakePopup()
Base:SetKeyboardInputEnabled( false )
do -- Sect 1
local Sect = Base:Add("BCollapsibleCategory")
Sect:Dock(TOP)
Sect:DockMargin( 0, 0, 0, ss(2) )
Sect:SetLabel("HUD")
genpan( Base, Sect, conf[1] )
end
do -- Sect 2
local Sect = Base:Add("BCollapsibleCategory")
Sect:Dock(TOP)
Sect:DockMargin( 0, 0, 0, ss(2) )
Sect:SetLabel("Controls")
genpan( Base, Sect, conf[2] )
end
do -- Sect 3
local Sect = Base:Add("BCollapsibleCategory")
Sect:Dock(TOP)
Sect:DockMargin( 0, 0, 0, ss(2) )
Sect:SetLabel("Preferences")
genpan( Base, Sect, conf[3] )
end
end
concommand.Add("benny_ui_settings", function()
OpenSettingsMenu()
end)

View File

@ -1,530 +0,0 @@
-- Dev spawnmenu
function GM:OnSpawnMenuOpen()
end
function GM:OnSpawnMenuClose()
end
local function yea()
return true
end
local function rmt1( val, min, max )
return math.Remap( val, min, max, 0, 1 )
end
local function rmt1c( val, min, max )
return math.Clamp( rmt1( val, min, max, 0, 1 ), 0, 1 )
end
local mewer = {
{
Func = function( class )
return class.PrintName
end,
Size = 18,
SizeMultiline = 18,
Font = "Benny_18",
},
{
Func = function( class )
return class.Description
end,
Size = 14,
SizeMultiline = 12,
Font = "Benny_12",
-- "How easily and quickly the weapon can take out a single target.\nDoes not consider armor penetration.\nAffected by Damage and RPM."
},
{
Name = "Lethality",
Size = 12,
Font = "Benny_10",
Stat = function( class )
local bwep = math.Clamp( math.Remap( BENNY_GetStat( class, "Damage" ) * ( BENNY_GetStat( class, "Pellets" ) or 1 ), 14, 80, 0, 1 ), 0, 1 )
local meowzor = math.ease.OutQuart( bwep )
return meowzor
end,
-- "How much the weapon's point of aim will move around.\nAffected by various Sway stats."
},
{
Name = "Suppression",
Size = 12,
Font = "Benny_10",
Stat = function( class )
local weight_1, weight_2 = 1, 3
local totalscore = (weight_1 + weight_2)
weight_1, weight_2 = weight_1/totalscore, weight_2/totalscore
local score_1, score_2 = 1, 1
local truedelay = ( 1 / BENNY_GetStat( class, "Delay" ) )
if BENNY_GetStat( class, "Firemodes" )[1].Mode == 1 then
truedelay = math.min( truedelay, 60/300 )
end
score_1 = rmt1c( BENNY_GetStat( class, "Damage" ) * truedelay, 100, 350 )
score_1 = score_1 * weight_1
score_2 = rmt1c( BENNY_GetStat( class, "AmmoStd" ), 16, 42 )
score_2 = score_2 * weight_2
return score_1 + score_2
end,
-- "How much damage the weapon can output over a long period of time.\nDoes not consider armor penetration.\nAffected by Damage, RPM, Capacity and Reload Time."
},
--
-- Name = "Range",
-- Size = 12,
-- Font = "Benny_10",
-- Stat = function( class )
-- return 0
-- end,
-- -- "How well the weapon gains or loses damage over long distances.\nAffected by Minimum Range, Maximum Range, and damage falloff."
-- },
{
Name = "Precision",
Size = 12,
Font = "Benny_10",
Stat = function( class )
return math.Clamp( math.Remap( BENNY_GetStat( class, "Spread" ), 1/60, 2, 1, 0 ), 0, 1 )
end,
-- "How accurate the weapon is when firing single shots or short bursts.\nAffected by Spread and various Recoil stats."
},
{
Name = "Control",
Size = 12,
Font = "Benny_10",
Stat = function( class )
return math.Clamp( math.Remap( BENNY_GetStat( class, "SpreadAdd" ) * ( 1 / BENNY_GetStat( class, "Delay" ) ), 1, 13, 1, 0 ), 0, 1 )
end,
-- "How managable the weapon's recoil and spread is under sustained fire.\nAffected by RPM and various Recoil stats."
},
-- {
-- Name = "Handling",
-- Size = 12,
-- Font = "Benny_10",
-- Stat = function( class )
-- return 0
-- end,
-- -- "How quickly this weapon readies from sprinting, aiming and deploying.\nAffected by Aim Down Sights Time, Sprint To Fire Time, and Deploy Time."
-- },
--{
-- Name = "Maneuvering",
-- Size = 12,
-- Font = "Benny_10",
-- Stat = function( class )
-- return 0
-- end,
-- -- "How accurate the weapon is while not aiming.\nAffected by Hipfire Spread, Mid-air Spread, Sway, and Free Aim Angle."
--},
{
Name = "Mobility",
Size = 12,
Font = "Benny_10",
Stat = function( class )
local weight_moving, weight_aiming, weight_reloading, weight_firing = 5, 5, 2, 1
local totalscore = (weight_moving + weight_aiming + weight_reloading + weight_firing)
weight_moving, weight_aiming, weight_reloading, weight_firing = weight_moving/totalscore, weight_aiming/totalscore, weight_reloading/totalscore, weight_firing/totalscore
local score_moving, score_aiming, score_reloading, score_firing = 1, 1, 1, 1
score_moving = rmt1c( BENNY_GetStat( class, "Speed_Move" ), 0.8, 1 )
score_moving = score_moving * weight_moving
score_aiming = rmt1c( BENNY_GetStat( class, "Speed_Aiming" ), 0.8, .98 )
score_aiming = score_aiming * weight_aiming
score_reloading = rmt1c( BENNY_GetStat( class, "Speed_Reloading" ), 0.75, 0.95 )
score_reloading = score_reloading * weight_reloading
score_firing = rmt1c( BENNY_GetStat( class, "Speed_Firing" ), 0.75, 0.95 )
score_firing = score_firing * weight_firing
return score_moving + score_aiming + score_reloading + score_firing
end,
-- "How fast the user can move while using this weapon.\nAffected by various Speed stats."
},
-- {
-- Name = "Stability",
-- Size = 12,
-- Font = "Benny_10",
-- Stat = function( class )
-- return 0
-- end,
-- "How much the weapon's point of aim will move around.\nAffected by various Sway stats."- },
}
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 h_F, s_F, v_F = 224, 0.00, 0.40
local h_D, s_D, v_D = 180, 0.40, 0.40
local h_C, s_C, v_C = 140, 0.40, 0.50
local h_B, s_B, v_B = 40, 0.60, 0.90
local h_A, s_A, v_A = 24, 0.70, 0.90
local h_S, s_S, v_S = 0, 0.75, 0.90
local function rank( perc )
local letter
local color
if perc <= 1/10 then
letter = "F"
color = HSVToColor(
h_F,
s_F,
v_F
)
elseif perc <= 3/10 then
letter = "D"
color = HSVToColor(
h_D,
s_D,
v_D
)
elseif perc <= 5/10 then
letter = "C"
color = HSVToColor(
h_C,
s_C,
v_C
)
elseif perc <= 7/10 then
letter = "B"
color = HSVToColor(
h_B,
s_B,
v_B
)
elseif perc <= 9/10 then
letter = "A"
color = HSVToColor(
h_A,
s_A,
v_A
)
elseif perc <= 1 then
letter = "S"
color = HSVToColor(
h_S,
s_S,
v_S
)
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(350), ss(360) )
smenu:SetTitle("Developer Spawnmenu")
smenu:MakePopup()
smenu:SetKeyboardInputEnabled( false )
smenu:Center()
local itemlist = smenu:Add("DScrollPanel")
itemlist:Dock( FILL )
smenu:Center()
itemlist:GetVBar():SetWide( 0 )
local statlist = smenu:Add("DPanel")
statlist:SetWide( ss(220) )
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
-- PROTO: Do regen stats.
do
local BAR_NAME = statlist:Add( "DLabel" )
BAR_NAME:SetTall( ss(18) )
BAR_NAME:Dock( TOP )
BAR_NAME:DockMargin( 0, 0, 0, ss(2) )
function BAR_NAME:Paint( w, h )
surface.SetDrawColor( schema("fg") )
surface.DrawRect( 0, 0, w, h )
if pan_active then
local rang = ITEMS[ pan_active ]
draw.SimpleText( l8(rang.PrintName), "Benny_18", ss(2), ss(2), schema_c("bg") )
end
return true
end
end
do
local BAR_DESC = statlist:Add( "DLabel" )
BAR_DESC:SetTall( ss(18) )
BAR_DESC:Dock( TOP )
BAR_DESC:DockMargin( 0, 0, 0, ss(2) )
local lastheight = 0
function BAR_DESC:Paint( w, h )
surface.SetDrawColor( schema("fg") )
surface.DrawRect( 0, 0, w, h )
if pan_active then
local rang = ITEMS[ pan_active ]
local multiline = multlinetext( l8(rang.Description) or "No description", w-ss(2), "Benny_12" )
for i, v in ipairs( multiline ) do
local line = i-1
local height = ss( 14 + (#multiline-1)*12 )
if lastheight != height then
BAR_DESC:SetTall( height )
lastheight = height
end
draw.SimpleText( v, "Benny_12", ss(2), ss(2+12*line), schema_c("bg") )
end
end
return true
end
end
for i, us in ipairs( mewer ) do
do continue end
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 = ITEMS[ pan_active ]
if rang then
if us.SizeMultiline then
local multiline = multlinetext( l8( us.Func and us.Func( rang ) or us.PrintName ), 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( l8( us.Func and us.Func( rang ) or us.PrintName ), 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 = (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), col )
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, ss(3), math.max( ss(1), width*perc ), h-ss(6) )
--surface.SetDrawColor( schema("bg") )
--surface.DrawOutlinedRect( ss(60+1)+h, ss(0.5), width, h-ss(1), ss(2) )
for i=1, 10 do
if i==1 then continue end
surface.SetDrawColor( schema("fg", i%2==1 and 0.008 or 0.12) )
surface.DrawRect( ss(60)+h + width*(i-1)/10, 0, ss(1), h )
end
end
end
return true
end
end
do
local fucker = statlist:Add( "DLabel" )
fucker:SetTall( ss(14) )
fucker:Dock( TOP )
fucker:DockMargin( 0, 0, 0, ss(2) )
function fucker:Paint( w, h )
do return true end
if pan_active then
local hm = ITEMS[ pan_active ]
surface.SetDrawColor( schema("fg") )
surface.DrawRect( 0, 0, w, h )
draw.SimpleText( BENNY_GetStat( hm, "AmmoStd" ) .. " rounds", "Benny_12", ss(2), ss(2), schema_c("bg") )
end
return true
end
end
do
local fucker = statlist:Add( "DLabel" )
fucker:SetTall( ss(14) )
fucker:Dock( TOP )
fucker:DockMargin( 0, 0, 0, ss(2) )
function fucker:Paint( w, h )
do return true end
if pan_active then
local hm = ITEMS[ pan_active ]
surface.SetDrawColor( schema("fg") )
surface.DrawRect( 0, 0, w, h )
local fm = BENNY_GetStat( hm, "Firemodes" )
local fms = ""
for i,v in ipairs( fm) do
local m =v.Mode
if m == math.huge then
fms = fms .. "AUTO"
elseif m == 1 then
fms = fms .. "SEMI"
else
fms = fms .. m .. "-BURST"
end
if i != #fm then
fms = fms .. " / "
end
end
draw.SimpleText( fms, "Benny_12", ss(2), ss(2), schema_c("bg") )
end
return true
end
end
local createlist = {}
for ClassName, Class in pairs( ITEMS ) do
if rawget(Class, "Hide") then continue end
local category = Class.Category or "No category"
if !createlist[category] then
createlist[category] = {}
end
table.insert( createlist[category], { ClassName = ClassName, Class = Class } )
end
for i, v in SortedPairs( createlist ) do
local Collapse = itemlist:Add( "BCollapsibleCategory" )
Collapse:Dock( TOP )
Collapse:SetLabel( i )
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 = Collapse:Add( "DButton" )
button:SetSize( 0, ss(10) )
button:DockMargin( 0, 0, 0, ss(0) )
button.Text_Name = l8( New.Class.PrintName )
button.Text_Desc = l8( New.Class.Description )
-- PROTO: These functions don't need to be remade over and over like this.
function button:DoClick()
RunConsoleCommand( "benny_debug_give", New.ClassName )
chat.AddText( "Gave " .. New.Class.PrintName )
end
function button:DoRightClick()
if ItemDef("mag_"..New.ClassName) then
RunConsoleCommand( "benny_debug_give", "mag_" .. New.ClassName )
chat.AddText( "Gave " .. ItemDef("mag_"..New.ClassName).PrintName )
else
chat.AddText( "That item doesn't exist. " .. "mag_"..New.ClassName )
end
end
function button:Think()
if self:IsHovered() then
pan_active = New.ClassName
end
end
function button:Paint( w, h )
local z = 0.5
if self:IsHovered() then
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
end
end
end
end
concommand.Add("benny_ui_spawnmenu", function()
OpenSMenu()
end)

View File

@ -1,10 +0,0 @@
-- Singleplayer score panel
function OpenScorePanel()
end
concommand.Add("benny_ui_score", function()
OpenScorePanel()
end)

View File

@ -1,7 +0,0 @@
local L = {}
Languages["en-us"] = L
L["Name"] = "English (United States)"
L["#Item.mk23.Name"] = "MK.23"
L["#Item.mk23.Description"] = "Special forces sidearm"

View File

@ -1,10 +0,0 @@
Languages = {}
function l8( inp )
return Languages[ConVarCL_String("lang")][inp] or Languages["en-us"][inp] or inp
end
local AD, IN = AddCSLuaFile, include
AD("en-us.lua")
IN("en-us.lua")

View File

@ -1,143 +0,0 @@
BENNY_ACTIVECAMERA = nil
local fixer = Angle( 0, -90, 90 )
local fixer2 = Angle( 0, -90, 90 )
local cscam = {
Special = function( self, ply )
local pos = Vector()
local ang = Angle()
local fov = 90
cuts:SetupBones()
local mat = cuts:GetBoneMatrix( cuts:LookupBone( "camera" ) )
local matf = cuts:GetBoneMatrix( cuts:LookupBone( "camera.fov" ) )
pos:Set( mat:GetTranslation() )
ang:Set( mat:GetAngles() )
ang:Sub( fixer )
local fix, fixa = matf:GetTranslation(), matf:GetAngles()
fix:Sub( cuts:GetPos() )
fov = fix.z
do
local x, y, z = pos.x, pos.y, pos.z
end
do
local p, y, r = ang.p, ang.y, ang.r
ang.p = -r
ang.r = 0
end
fov = Convert( fov, (4/3) ) -- Convert to vertical FOV.. somehow
fov = Convert( fov, (ScrH()/ScrW())/(3/4) ) -- Shut up default Source FOV widescreen magic
return pos, ang, fov
end
}
local function decide_active()
local csent = ents.FindByClass( "benny_cutscene" )[1]
if IsValid( csent ) then
BENNY_ACTIVECAMERA = cscam
cuts = csent
return true
end
return false
end
function bennyfp( origin, angles, fov )
local ply = LocalPlayer()
if !IsValid( ply:GetActiveWeapon() ) then return origin, angles, fov end
local pos, ang = ply:CamSpot( TPSOverride )
return pos, ang, 90
end
hook.Add( "CalcView", "Benny_CalcView", function( ply, pos, ang, fov )
if ConVarCL_Bool("cam_unlock") then return end
if ply:NoclippingAndNotVaulting() then return end
decide_active()
local camera = BENNY_ACTIVECAMERA
local view = {}
view.origin = pos
view.angles = ang
view.fov = 90
if false and camera then
view.origin = camera.Pos
view.angles = camera.Ang
view.fov = camera.FOV or 60
if camera.Special then
view.origin, view.angles, view.fov = camera.Special( camera, ply )
end
end
local wep = ply:BennyCheck()
if wep then -- and ply:GetActiveWeapon():GetAim() > 0 then
--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 )
--end
if !halt then
view.drawviewer = true
view.origin, view.angles, view.fov = bennyfp( view.origin, view.angles, view.fov )
end
end
local st = ConVarCL_String("cam_override")
if st != "" then
local st = string.Explode( " ", st )
view.origin.x = tonumber(st[1])
view.origin.y = tonumber(st[2])
view.origin.z = tonumber(st[3])
view.angles.x = tonumber(st[4])
view.angles.y = tonumber(st[5])
view.angles.z = tonumber(st[6])
view.fov = tonumber(st[7])
end
if globhit then
globhit:Set( view.origin )
globang:Set( view.angles )
end
view.fov = Convert( view.fov, (ScrH()/ScrW())/(3/4) )
return view
end )
function Convert( fovDegrees, ratio )
local halfAngleRadians = fovDegrees * ( 0.5 * math.pi / 180 )
local t = math.tan( halfAngleRadians )
t = t * ratio
local retDegrees = ( 180 / math.pi ) * math.atan( t )
return retDegrees * 2
end
concommand.Add( "benny_dev_eyetrace", function( ply )
local tr = ply:GetEyeTrace()
print( string.format("Vector( %i, %i, %i )", math.Round( tr.HitPos.x ), math.Round( tr.HitPos.y ), math.Round( tr.HitPos.z ) ) )
print( tr.Entity )
end)
if game.GetMap():Left( 13 ) == "bennysurvive_" then
local ourMat = Material( "color" )
hook.Add("PostDraw2DSkyBox", "ExampleHook", function()
local r, g, b = render.GetFogColor()
r=(r+1)/255
g=(g+1)/255
b=(b+1)/255
local v = Vector( r, g, b )
render.OverrideDepthEnable( true, false ) -- ignore Z to prevent drawing over 3D skybox
ourMat:SetVector( "$color", v )
render.SetMaterial( ourMat )
render.DrawScreenQuadEx( 0, 0, ScrW(), ScrH() )
render.OverrideDepthEnable( false, false )
end)
end

File diff suppressed because it is too large Load Diff

View File

@ -1,131 +0,0 @@
if SERVER then
util.AddNetworkString( "benny_sendinvitem" )
util.AddNetworkString( "benny_discardinvitem" )
end
function BENNY.CreateItem( classname )
local class = ItemDef(classname)
assert( class, "Invalid Class " .. tostring(classname) )
local item = {
Class = classname,
Acquisition = CurTime(),
}
class.Init_Item( class, item )
--if class.Features == "firearm" then
-- item.Loaded = ""
--elseif class.Features == "magazine" then
-- item.Ammo = class.Ammo
--end
--
return item
end
concommand.Add("benny_debug_give", function(ply, cmd, args)
assert(SERVER, "not server")
local inv = ply:INV_Get()
local str = UUID_generate()
local newitem = BENNY.CreateItem( args[1] )
inv[str] = newitem
-- PROTO: WriteTable.
net.Start( "benny_sendinvitem" )
net.WriteString( str )
net.WriteTable( newitem )
net.Send( ply )
end,
function(cmd, args)
args = string.Trim(args:lower())
local meow = {}
for i, v in SortedPairs( ITEMS ) do
if string.lower(i):find(args) then
table.insert( meow, cmd .. " " .. i )
end
end
return meow
end, "arg 1: classname")
if CLIENT then
net.Receive( "benny_sendinvitem", function()
LocalPlayer():INV_Get()[net.ReadString()] = net.ReadTable()
end)
net.Receive( "benny_discardinvitem", function()
LocalPlayer():INV_Get()[net.ReadString()] = nil
end)
end
function InvDiscard( ply, ID )
local inv = ply:INV_Get()
local wep = ply:GetActiveWeapon()
local item = inv[ID]
-- PROTO: Check that this is the correct 'benny' weapon.
assert( item, "That item doesn't exist. " .. tostring(item) )
inv[ID] = nil
net.Start( "benny_discardinvitem" )
net.WriteString( ID )
net.Send( ply )
if wep:bGetInvID( false ) == ID then
print( "Disequipped " .. ID .. " for " .. tostring(wep) )
wep:SetWep1( "" )
wep:SetWep1_Clip( "" )
wep:SetClip1( 0 )
end
if wep:bGetInvID( true ) == ID then
print( "Disequipped " .. ID .. " for " .. tostring(wep) )
wep:SetWep2( "" )
wep:SetWep2_Clip( "" )
wep:SetClip2( 0 )
end
if wep:bGetMagInvID( false ) == ID then
print( "Unloaded " .. ID .. " for " .. tostring(wep) )
inv[wep:bGetInvID( false )].Loaded = ""
wep:SetWep1_Clip( "" )
wep:SetClip1( 0 )
end
if wep:bGetMagInvID( true ) == ID then
print( "Unloaded " .. ID .. " for " .. tostring(wep) )
inv[wep:bGetInvID( true )].Loaded = ""
wep:SetWep2_Clip( "" )
wep:SetClip2( 0 )
end
end
concommand.Add("benny_inv_discard", function( ply, cmd, args )
InvDiscard( ply, args[1] )
end)
hook.Add( "PlayerDeathSound", "Benny_PlayerDeathSound", function( ply )
return true -- we don't want the default sound!
end )
if CLIENT then
hook.Add( "PlayerButtonDown", "Benny_PlayerButtonDown_Dev", function( ply, button )
local wep = ply:BennyCheck()
if IsFirstTimePredicted() then
if button == KEY_F1 then
OpenSettingsMenu()
elseif button == KEY_F2 then
OpenDebugInv()
elseif button == KEY_F3 then
OpenSMenu()
elseif button == KEY_F4 then
-- OpenDeadeye()
elseif button == KEY_F5 then
elseif button == KEY_F6 then
elseif button == KEY_F7 then
elseif button == KEY_F8 then
elseif button == KEY_F9 then
elseif button == KEY_F11 then
elseif button == KEY_F12 then
end
end
end)
end

View File

@ -1,182 +0,0 @@
local easywaycvar = CreateConVar( "benny_net_easyway", 0, FCVAR_ARCHIVE + FCVAR_REPLICATED, "Use a disgusting way of networking inventories for maximum duplication." )
local easyway = easywaycvar:GetBool()
local UINTBITS = 8
if easyway then
if SERVER then
gameevent.Listen( "player_activate" )
hook.Add( "player_activate", "Benny_Activate", function( data )
Player(data.userid).CheckerReady = true
end )
local checkerinterval = 1
util.AddNetworkString( "Benny_Checker" )
hook.Add( "PlayerTick", "Benny_Checker", function( ply )
if ply.CheckerReady then
if (ply.CheckerLast or 0) + checkerinterval <= CurTime() then
local inv = ply:INV_Get()
net.Start( "Benny_Checker" )
net.WriteUInt( table.Count(inv), UINTBITS )
for i, v in pairs( inv ) do
net.WriteString( i )
net.WriteTable( v )
end
print( ply, net.BytesWritten() )
net.Send( ply )
ply.CheckerLast = CurTime()
end
end
end)
else -- client begin
net.Receive( "Benny_Checker", function( len, ply )
local ply = LocalPlayer()
local inv = ply:INV_Get()
local amt = net.ReadUInt( UINTBITS )
for i=1, amt do
local id = net.ReadString()
inv[id] = net.ReadTable()
end
end)
end -- client end
else -- hardway
if SERVER then
gameevent.Listen( "player_activate" )
hook.Add( "player_activate", "Benny_Activate", function( data )
Player(data.userid).CheckerReady = true
end )
local checkerinterval = 1
util.AddNetworkString( "Benny_Checker" )
util.AddNetworkString( "Benny_Checker_CL_Request" )
hook.Add( "PlayerTick", "Benny_Checker", function( ply )
if ply.CheckerReady then
if (ply.CheckerLast or 0) + checkerinterval <= CurTime() then
local inv = ply:INV_Get()
net.Start( "Benny_Checker" )
net.WriteUInt( table.Count(inv), UINTBITS )
for i, v in pairs( inv ) do
net.WriteString( i )
net.WriteBool( v.Loaded )
if v.Loaded then net.WriteString( v.Loaded ) end
end
net.Send( ply )
ply.CheckerLast = CurTime()
end
end
end)
net.Receive("Benny_Checker_CL_Request", function( len, ply )
if (ply.CheckerRequestBan or 0) <= CurTime() then
local amt = net.ReadUInt( UINTBITS )
local inv = ply:INV_Get()
local regenlist = {}
-- Make sure they all exist first
for i=1, amt do
local id = net.ReadString()
if inv[id] then
table.insert( regenlist, id )
else
-- Punish
print( ply, "The item the client requested, '" .. tostring(id) .."' didn't exist. Malicious?") -- Matters in public servers!! -- Not supporting for 5 seconds." )
-- ply.CheckerRequestBan = CurTime() + 5
-- return
end
end
net.Start("Benny_Checker_CL_Request")
net.WriteUInt( #regenlist, UINTBITS )
for i, id in ipairs( regenlist ) do
if inv[id] then
print( "Doing " .. id )
net.WriteString( id )
net.WriteTable( inv[id] )
end
end
net.Send( ply )
end
end)
else
net.Receive( "Benny_Checker", function( len, ply )
local ply = LocalPlayer()
-- Get started
local amt = net.ReadUInt( UINTBITS )
local evallist = {}
for i=1, amt do
local id = net.ReadString()
local loaded_exists = net.ReadBool()
local loaded = nil
if loaded_exists then
loaded = net.ReadString()
end
evallist[id] = loaded or true
end
local inv = ply:INV_Get()
-- Check which items DO NOT exist
local missinglist = {}
for i, v in pairs( evallist ) do
if inv[i] then
-- Success
if isstring(v) then
inv[i].Loaded = v
end
else
missinglist[i] = true
end
end
-- Check any ghost items we have
local ghostlist = {}
for i, v in pairs( inv ) do
if evallist[i] then
-- Success
else
ghostlist[i] = true
end
end
-- Regenerate missing items
if table.Count(missinglist) > 0 then
local concat = ""
for i, v in pairs( missinglist ) do
concat = concat .. "'" .. i .. "' "
end
print( "[".. string.FormattedTime( CurTime(), "%02i:%02i") .. "] [Checker]: You are missing items " .. concat )
net.Start( "Benny_Checker_CL_Request" )
net.WriteUInt( table.Count( missinglist ), UINTBITS )
for i, v in pairs( missinglist ) do
net.WriteString( i )
end
net.SendToServer()
end
-- Remove ghost items
for i, v in pairs( ghostlist ) do
inv[i] = nil
print( "[".. string.FormattedTime( CurTime(), "%02i:%02i") .. "] [Checker]: Removed a ghost item with ID '" .. i .. "'" )
end
end )
net.Receive( "Benny_Checker_CL_Request", function( len, ply )
local ply = LocalPlayer()
local inv = ply:INV_Get()
local amt = net.ReadUInt( UINTBITS )
for i=1, amt do
local id = net.ReadString()
print( "[".. string.FormattedTime( CurTime(), "%02i:%02i") .. "] [Checker]: Restoring " .. id )
inv[id] = net.ReadTable()
end
end)
end
end -- hardway

View File

@ -1,74 +0,0 @@
-- Predicted weapon switching
local dads = {
[KEY_1] = 1,
[KEY_2] = 2,
[KEY_3] = 3,
[KEY_4] = 4,
[KEY_5] = 5,
[KEY_6] = 6,
[KEY_7] = 7,
[KEY_8] = 8,
[KEY_9] = 9,
[KEY_0] = 0,
}
local function beatup( ply, num )
local weighted = ply:INV_Weight()
local inv = ply:INV_Get()
local wep = ply:BennyCheck()
local iflip = table.Flip( inv )
local hand = ply:KeyDown(IN_ZOOM)
local invid = 0
if CLIENT and !IsFirstTimePredicted() then return end
for _, item in pairs( weighted ) do
local class = ITEMS[item.Class]
local id = iflip[item]
if class.Equipable or class.Features == "firearm" or class.Features == "grenade" or class.Features == "melee" then
invid = invid + 1
if num == 0 then num = 10 end
if num == invid then
if id == wep:bGetReqInvID( hand ) then
-- If we are selected our currently equipped weapon, holster it.
return wep:bSetReqInvID( hand, "" )
else
if wep:bGetReqInvID( hand ) != "" then
-- Something is in this hand
if wep:bGetReqInvID( !hand ) != "" then
-- Something in the other hand
wep:bSetReqInvID( !hand, wep:bGetReqInvID( hand ) )
wep:bSetReqInvID( hand, id )
return
else
-- Nothing in the other hand
wep:bSetReqInvID( !hand, "" )
wep:bSetReqInvID( hand, id )
return
end
else
-- Nothing in this hand.
if wep:bGetReqInvID( !hand ) == id then
-- Weapon we want is in the other hand.
wep:bSetReqInvID( !hand, "" )
wep:bSetReqInvID( hand, id )
return
end
end
return wep:bSetReqInvID( hand, id )
end
end
end
end
return wep:bSetReqInvID( hand, "" )
end
hook.Add( "PlayerButtonDown", "Benny_PlayerButtonDown_Inv", function( ply, button )
local wep = ply:BennyCheck()
if dads[button] then
beatup( ply, dads[button] )
end
end)

View File

@ -1,155 +0,0 @@
-- Movement
local blop = Angle()
if CLIENT then
lastmoveangle = lastmoveangle or 0
lastmoveangle_lerp = lastmoveangle_lerp or nil
TPSOverride = TPSOverride or Angle()
end
hook.Add( "PlayerNoClip", "Benny_PlayerNoClip", function( ply, desiredNoClipState )
if CLIENT then
if desiredNoClipState then
ply:SetEyeAngles( TPSOverride )
else
TPSOverride:Set( LocalPlayer():EyeAngles() )
lastmoveangle = LocalPlayer():EyeAngles().y
lastmoveangle_lerp = LocalPlayer():EyeAngles().y
end
end
end)
hook.Add( "InputMouseApply", "Benny_InputMouseApply", function( cmd, x, y, ang )
local p = LocalPlayer()
local w = p:BennyCheck()
local cdis = false
if false and w and w:bWepClass( false ) and w:bWepClass( false ).Custom_DisableSpecialMovement and w:bWepClass( false ).Custom_DisableSpecialMovement( w ) then cdis = true end
if false and 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 and (y!=0 or x!=0) then
TPSOverride:Add( Angle( y*0.022, -x*0.022, 0 ) )
return true
end
end)
hook.Add( "CreateMove", "Benny_CreateMove", function( cmd )
if false and BENNY_ACTIVECAMERA and !LocalPlayer():NoclippingAndNotVaulting() then
local x, y = cmd:GetForwardMove(), cmd:GetSideMove()
local lx=input.GetAnalogValue(ANALOG_JOY_X) // Left X Axis: left -, right +
local ly=input.GetAnalogValue(ANALOG_JOY_Y) // Left Y Axis: up -, bottom +
local lr=input.GetAnalogValue(ANALOG_JOY_R) // Right X Axis: left -, right +
local lu=input.GetAnalogValue(ANALOG_JOY_U) // Right Y Axis: up -, bottom +
lx=lx/32768; ly=ly/32768; lr=lr/32768; lu=lu/32768; // Conversion to floats -1.0 - 1.0
if lx != 0 or ly != 0 then
x, y = ly * -320, lx * 320
end
local ad = Vector( x, y, 0 )
local an = Angle()
an:Set( RenderAngles() )
an.p = 0
local am = Angle()
am:Set( cmd:GetViewAngles() )
am.p = 0
ad:Rotate( am )
ad:Rotate( -an )
-- ad:Normalize()
-- ad:Mul(320)
--cmd:ClearMovement()
cmd:SetForwardMove( ad.x )
cmd:SetSideMove( ad.y )
if x != 0 or y != 0 then
local thing = Vector( x, -y, 0 ):Angle()
thing.y = thing.y + an.y
blop.y = math.ApproachAngle( blop.y, thing.y, FrameTime() * 360 )
end
cmd:SetViewAngles( blop )
end
local p = LocalPlayer()
local w = p:BennyCheck()
local cdis = false
--if w then
-- 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
if w and !cdis then -- FPS cam
local aimed = false--w:GetUserAim()
local opos, ang = p:CamSpot( TPSOverride )
local lx=input.GetAnalogValue(ANALOG_JOY_X) // Left X Axis: left -, right +
local ly=input.GetAnalogValue(ANALOG_JOY_Y) // Left Y Axis: up -, bottom +
local lr=input.GetAnalogValue(ANALOG_JOY_R) // Right X Axis: left -, right +
local lu=input.GetAnalogValue(ANALOG_JOY_U) // Right Y Axis: up -, bottom +
lx=lx/32768; ly=ly/32768; lr=lr/32768; lu=lu/32768; // Conversion to floats -1.0 - 1.0
local moveintent
if lx != 0 or ly != 0 then
moveintent = Vector( ly * -320, lx * 320, 0 )
else
moveintent = Vector( cmd:GetForwardMove(), cmd:GetSideMove(), 0 )
end
local dir_p, dir_y = lr>0, lu>0
dir_p = dir_p and 1 or -1
dir_y = dir_y and -1 or 1
local look_p, look_y = dir_p * math.ease.InCirc( math.abs(lr) ), dir_y * math.ease.InCirc( math.abs(lu) )
-- ang:Add( Angle( cmd:GetMouseY()*0.022, -cmd:GetMouseX()*0.022, 0 ) )
ang:Add( Angle( look_p * 180 * 0.5 * FrameTime(), look_y * 180 * FrameTime(), 0 ) )
ang.p = math.Clamp( ang.p, -89.9, 89.9 )
ang:Normalize()
if aimed then
local tr = util.TraceLine( {
start = opos,
endpos = opos+(ang:Forward()*(2^16)),
filter = p,
mask = MASK_SHOT,
} )
local planner = (tr.HitPos-p:EyePos()):Angle()
planner:Normalize()
cmd:SetViewAngles( planner )
lastmoveangle = planner.y
end
if !aimed then
if !moveintent:IsEqualTol( vector_origin, 1 ) then
lastmoveangle = ang.y - moveintent:Angle().y
end
lastmoveangle_lerp = math.ApproachAngle( lastmoveangle_lerp or lastmoveangle, lastmoveangle, FrameTime() * 360 )
cmd:SetViewAngles( Angle( ang.p, lastmoveangle_lerp, 0 ) )
else
lastmoveangle_lerp = lastmoveangle
end
local fixang = Angle()
fixang.y = cmd:GetViewAngles().y - ang.y
moveintent:Rotate( fixang )
-- cmd:ClearMovement()
cmd:SetForwardMove( moveintent.x )
cmd:SetSideMove( moveintent.y )
end
end)
function GM:PlayerNoClip()
return true
end

View File

@ -1,207 +0,0 @@
local small = Vector( 1, 1, 1 )
local smale = -small
local moe = Vector( 0, 0, 1/16 )
local dmaxs = Vector( 1, 1, 1 )
local dmins = -dmaxs
local dcol = Color( 255, 0, 255, 0 )
local dW = Color( 255, 255, 255, 0 )
local dB = Color( 0, 0, 0, 0 )
local dS = Color( 255, 0, 0, 0 )
local dC = Color( 0, 0, 255, 0 )
hook.Add( "PlayerTick", "Benny_PlayerTick", function( ply, mv )
if ply:GetVaultTransition() == 0 then
ply:SetVaultDebuff( math.Approach( ply:GetVaultDebuff(), 0, FrameTime()/0.25 ) )
end
end)
hook.Add( "SetupMove", "Benny_SetupMove", function( ply, mv, cmd )
if !ply:OnGround() and mv:KeyDown( IN_DUCK ) then
local newbuttons = bit.band(mv:GetButtons(), bit.bnot(IN_DUCK))
mv:SetButtons(newbuttons)
end
end)
local function Vault_GetAngle( ply, pos, ang, vel )
return true
end
local VAULTCHECKDIST = 8
local VAULTMOVEDIST = 32
local MAXVAULTHEIGHT = 64
local MAXVAULTHEIGHT_FUCKERY = MAXVAULTHEIGHT+1
local MAXVAULTHEIGHT_V = Vector( 0, 0, MAXVAULTHEIGHT_FUCKERY )
if CLIENT then
hook.Add( "CreateMove", "Benny_ADV_CreateMove", function( cmd )
local ply = LocalPlayer()
if ply:KeyDown( IN_SPEED ) then
cmd:AddKey( IN_ALT1 )
end
end)
end
hook.Add( "StartCommand", "Benny_StartCommand", function( ply, cmd )
end)
hook.Add( "Move", "Benny_Move", function( ply, mv )
local ang = mv:GetMoveAngles()
local pos = mv:GetOrigin()
local vel = mv:GetVelocity()
local speed = mv:GetMaxSpeed() * (1-ply:GetVaultDebuff())
mv:SetMaxSpeed( speed )
mv:SetMaxClientSpeed( speed )
local forw, side = mv:GetForwardSpeed(), mv:GetSideSpeed()
local ba, bb = ply:GetHull()
if ply:Crouching() then ba, bb = ply:GetHullDuck() end
local WishDir = Vector( forw, -side, 0 ):GetNormalized()
WishDir:Rotate( Angle( 0, ang.y, 0 ) )
local Target = Vector( pos )
local TargetNor = Vector()
if !WishDir:IsZero() then
TargetNor:Set( WishDir )
elseif vel:Length2D() > 100 then
local NoZ = Vector( vel )
NoZ.z = 0
NoZ:Normalize()
TargetNor:Set( NoZ )
else
local NoUp = Angle( ang )
NoUp.p = 0
TargetNor = NoUp:Forward()
end
local CR = HSVToColor( math.Rand( 0, 360 ), 1, 1 )
CR.a = 8
--debugoverlay.Box( Target, ba, bb, 0, CR )
local Checker = Target + TargetNor*VAULTCHECKDIST
local Desire = Target + TargetNor*VAULTMOVEDIST
local T1 = util.TraceHull( {
start = Target,
endpos = Checker,
mins = ba,
maxs = bb,
filter = ply,
} )
if CLIENT then vaultsave = false end
if ply:GetVaultDebuff() == 0 and !ply:NoclippingAndNotVaulting() and T1.Hit then -- A challenger approaches
-- How tall is it, basically? We still need to do a ledge check
local T2 = util.TraceHull( {
start = Desire + MAXVAULTHEIGHT_V,
endpos = Desire,
mins = ba,
maxs = bb,
filter = ply,
} )
-- debugoverlay.Box( T2.HitPos, ba, bb, 0, CR )
-- Let's check our vertical clearance
local Clearance = Vector( Target.x, Target.y, T2.HitPos.z )
local T3 = util.TraceHull( {
start = Target,
endpos = Clearance,
mins = ba,
maxs = bb,
filter = ply,
} )
-- debugoverlay.SweptBox( T3.StartPos, T3.HitPos, ba, bb, angle_zero, 0, CR )
local VertClearance = T3.HitPos.z - T3.StartPos.z
-- If we try to go so high and it's TOO high then give up
if VertClearance > ply:GetStepSize() and VertClearance <= MAXVAULTHEIGHT then
-- Trace from clearance to final
local T4 = util.TraceHull( {
start = T3.HitPos,
endpos = T2.HitPos,
mins = ba,
maxs = bb,
filter = ply,
} )
-- debugoverlay.SweptBox( T4.StartPos, T4.HitPos, ba, bb, angle_zero, 0, CR )
local Compare1, Compare2 = Vector( Target.x, Target.y, 0 ), Vector( T4.HitPos.x, T4.HitPos.y, 0 )
if !Compare1:IsEqualTol( Compare2, 1/16 ) then
if CLIENT then vaultsave = true end
if mv:KeyDown( IN_JUMP ) then
ply:SetVaultPos1( ply:GetPos() )
ply:SetVaultPos2( T4.HitPos )
ply:SetVaultTransition( 1 )
ply:SetVaultDebuff( 1 )
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_JUMP, ply:SelectWeightedSequence( ACT_GMOD_GESTURE_BOW ), 0.75, true )
--mv:SetOrigin( T4.HitPos )
return true
end
end
end
end
if ply:GetVaultTransition() != 0 then
ply:SetVaultTransition( math.Approach( ply:GetVaultTransition(), 0, FrameTime()/0.25 ) )
local t, vp1, vp2 = ply:GetVaultTransition(), ply:GetVaultPos1(), ply:GetVaultPos2()
local Meow = Vector( Lerp( (1-t), vp1.x, vp2.x ), Lerp( (1-t), vp1.y, vp2.y ), Lerp( math.ease.OutQuint(1-t), vp1.z, vp2.z ) )
mv:SetOrigin( Meow )
mv:SetVelocity( Vector( 0, 0, 0 ) )
ply:SetVaultDebuff( 1 )
ply:SetMoveType( (ply:GetVaultTransition() == 0) and MOVETYPE_WALK or MOVETYPE_NOCLIP )
return true
end
local w = ply:BennyCheck()
local hand = false
if false and w and w:bWepClass( hand ) then
local targetspeed = mv:GetMaxSpeed()
targetspeed = targetspeed * w:GetStat( hand, "Speed_Move" )
targetspeed = targetspeed * Lerp( w:GetAim(), 1, w:GetStat( hand, "Speed_Aiming" ) )
local st = w:bGetShotTime( hand )
targetspeed = targetspeed * (st+w:GetStat( hand, "Speed_FiringTime" ) > CurTime() and w:GetStat( hand, "Speed_Firing" ) or 1)
targetspeed = targetspeed * (w:bGetReloadTime( hand ) > 0 and w:GetStat( hand, "Speed_Reloading" ) or 1)
mv:SetMaxSpeed( targetspeed )
mv:SetMaxClientSpeed( targetspeed )
end
if ply:GetJumpBoost() == 0 then
if mv:KeyDown( IN_ALT1 ) then
local dig = Vector( mv:GetForwardSpeed()+0.01, mv:GetSideSpeed(), 0 ):GetNormalized()
local dug = Angle( 0, ply:EyeAngles().y, 0 )
local upspeed = 180
local movespeed = 250
dig:Mul( movespeed )
if !ply:OnGround() then upspeed = mv:GetVelocity().z end
ply:SetGroundEntity( NULL )
mv:SetVelocity( dug:Forward()*dig.x + dug:Right()*dig.y + (vector_up*upspeed) )
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_JUMP, ply:SelectWeightedSequence( ACT_GMOD_GESTURE_RANGE_ZOMBIE_SPECIAL ), 0.6, true )
ply:SetJumpBoost( 1 )
if CLIENT and IsFirstTimePredicted() then
ply:EmitSound( "weapons/slam/throw.wav", 70, 200, 0.5 )
end
end
elseif ply:OnGround() then
if mv:KeyDown( IN_ALT1 ) then
ply:SetJumpBoost( -1 )
else
ply:SetJumpBoost( 0 )
end
end
--debugoverlay.Box( Target+(TargetNor*16), ba, bb, 0, CR )
end)

View File

@ -1,356 +0,0 @@
function GM:PlayerSpawn( ply )
player_manager.SetPlayerClass( ply, "player_benny" )
ply:SetViewOffset( Vector( 0, 0, 64 ) )
ply:SetViewOffsetDucked( Vector( 0, 0, 50 ) )
ply:Give( "itemhandler" )
ply:SetStamina( 1 )
ply:SetCrouchedWalkSpeed( 0.3 )
ply:SetDuckSpeed( 0.1 )
ply:SetUnDuckSpeed( 0.1 )
ply:SetSlowWalkSpeed( 100 )
ply:SetWalkSpeed( 200 )
ply:SetRunSpeed( 200 )
ply:SetStepSize( 16 )
ply:SetCanZoom( false )
ply:MakeCharacter()
end
local PT = FindMetaTable( "Player" )
local bgl = {
["benny"] = {
[0] = Vector( 0.275, 0.7, 0.7 ),
[1] = 17,
[2] = 7,
[3] = 2,
[4] = 11,
[5] = 3,
[6] = 0,
[7] = 0,
[8] = 3,
[9] = 0,
[10] = 0,
[11] = 0,
[12] = 3,
[13] = 0,
},
["nikki"] = {
[0] = Vector( 0.9, 0.3, 0.9 ),
[1] = 17,
[2] = 7,
[3] = 2,
[4] = 11,
[5] = 3,
[6] = 0,
[7] = 0,
[8] = 2,
[9] = 1,
[10] = 5,
[11] = 0,
[12] = 3,
[13] = 0,
},
["igor"] = {
[0] = Vector( 0.776, 0.929, 0.89 ),
[1] = 4,
[2] = 6,
[3] = 2,
[4] = 3,
[5] = 1,
[6] = 0,
[7] = 2,
[8] = 3,
[9] = 3,
[10] = 6,
[11] = 2,
[12] = 1,
[13] = 0,
},
["yanghao"] = {
[0] = Vector( 0.627, 0.21, 0.186 ),
[1] = 13,
[2] = 2,
[3] = 0,
[4] = 3,
[5] = 0,
[6] = 1,
[7] = 3,
[8] = 0,
[9] = 3,
[10] = 4,
[11] = 0,
[12] = 0,
[13] = 0,
},
["mp_cia"] = {
[0] = Vector( 1, 1, 1 )
},
["mp_plasof"] = {
[0] = Vector( 1, 1, 1 )
},
["mp_militia"] = {
[0] = Vector( 1, 1, 1 )
},
["mp_natguard"] = {
[0] = Vector( 1, 1, 1 )
},
["mp_viper"] = {
[0] = Vector( 1, 1, 1 )
},
["mp_halo"] = {
[0] = Vector( 1, 1, 1 )
},
}
function PT:MakeCharacter()
local char = ConVarSV_String("tempchar")
self:SetModel( "models/player/infoplayerrealism.mdl" )
self:SetPlayerColor( bgl[char][0] )
self:SetBodygroup( 0, 0 )
self:SetSkin( 3 )
for i, v in ipairs( bgl[char] ) do
self:SetBodygroup( i, v )
end
end
function PT:BennyCheck()
local wep = self:GetActiveWeapon()
return ( wep:IsValid() and wep:GetClass() == "itemhandler" and wep.GetActiveR ) and wep or false
end
function PT:CamSpot( ang )
local w = self:GetActiveWeapon()
if !IsValid( w ) then w = false end
--local aim = w and w:GetAim() or 0
--if w then aim = w:GetUserAim() and math.ease.OutCubic( aim ) or math.ease.InCubic( aim ) end
local aim = 0
local pos = self:GetPos()
local perc = math.TimeFraction( self:GetViewOffset().z, self:GetViewOffsetDucked().z, self:GetCurrentViewOffset().z )
pos.z = pos.z + Lerp( perc, 64, 52 )
pos:Add( Lerp( aim, 16, 16 ) * ang:Right() )
pos:Add( Lerp( aim, -64, -32 ) * ang:Forward() )
pos:Add( 0 * ang:Up() )
pos:Add( Lerp( aim, 16, 16 ) * ang:Up() * (ang.p/90) )
local tr = util.TraceHull( {
start = self:GetPos() + Vector( 0, 0, Lerp( perc, 64, 52 ) ),
endpos = pos,
mins = -Vector( 4, 4, 4 ),
maxs = Vector( 4, 4, 4 ),
filter = self
})
return tr.HitPos, ang, 90
end
function PT:NoclippingAndNotVaulting()
return (self:GetMoveType() == MOVETYPE_NOCLIP and self:GetVaultTransition() == 0)
end
function PT:INV_Get()
if !self.INV then
print( "Inventory created for " .. tostring(self) )
self.INV = {}
end
return self.INV
end
function PT:INV_Discard( id )
if self:INV_Get()[ id ] then
self:INV_Get()[ id ] = nil
end
end
SORTS = {
["Acquisition"] = function( a, b ) return inv[b]["Acquisition"] > inv[a]["Acquisition"] end,
}
function PT:INV_Find( class, exclude )
local inv = self:INV_Get()
local results = {}
for i, v in pairs( inv ) do
if v.Class == class and i != (exclude or "") then
table.insert( results, i )
end
end
-- PROTO: HOLY SHIT THIS SUCKS, MAKES A FUNCTION AND MIGHT RUN EVERY FRAME!!!
table.sort( results, function( a, b ) return inv[b]["Acquisition"] > inv[a]["Acquisition"] end )
-- table.sort( results, SORTS["Acquisition"] )
return results
end
local T_WEIGHT = {
["sniper"] = 45,
["machinegun"] = 40,
["rifle"] = 35,
["shotgun"] = 30,
["smg"] = 25,
["pistol"] = 20,
["melee"] = 15,
["special"] = 10,
["utility"] = 05,
["equipment"] = 00,
["grenade"] = -10,
["magazine"] = -100,
["base"] = -1000,
}
function PT:INV_Weight()
local inv = self:INV_Get()
local results = {}
for i, v in pairs( inv ) do
if ITEMS[v.Class].Features != "magazine" then
table.insert( results, { inv[i], ITEMS[v.Class] } )
end
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]["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
table.insert( finale, v[1] )
end
return finale
end
function PT:INV_FindMag( class, exclude )
local inv = self:INV_Get()
local results = {}
for i, v in pairs( inv ) do
-- PROTO: STANAG mags and such should share, and this'll need to be changed.
if v.Class == ("mag_" .. class) and (exclude and !exclude[i] or !exclude and true) then
table.insert( results, i )
end
end
-- PROTO: HOLY SHIT THIS SUCKS, MAKES A FUNCTION AND MIGHT RUN EVERY FRAME!!!
table.sort( results, function( a, b ) return (inv[b]["Ammo"] - (inv[b]["Acquisition"]*(1e-5))) < (inv[a]["Ammo"] - (inv[a]["Acquisition"]*(1e-5))) end )
return results
end
function PT:INV_FindMagSmart( class, loader )
local inv = self:INV_Get()
local loadm = inv[loader]
local addexc = {}
for i, v in pairs( inv ) do
if v.Loaded and v.Loaded != "" then
addexc[v.Loaded] = true
end
end
local findmag = self:INV_FindMag( class, addexc )
local f_maginv = {}
if addexc[loadm.Loaded] or loadm.Loaded != "" then table.insert( f_maginv, loadm.Loaded ) end
for i, v in ipairs( findmag ) do
table.insert( f_maginv, v )
end
return f_maginv
end
do
local translat = {
["melee"] = { 1, 1 },
["special"] = { 1, 2 },
["pistol"] = { 2, 1 },
["smg"] = { 3, 1 },
["shotgun"] = { 4, 1 },
["sniper"] = { 5, 1 },
["rifle"] = { 5, 2 },
["machinegun"] = { 5, 3 },
["grenade"] = { 6, 1 },
["utility"] = { 6, 2 },
["equipment"] = { 7, 1 },
["magazine"] = { 8, 1 },
["base"] = { 8, 2 },
}
-- PROTO: Cache this!
function PT:INV_Buckets()
local inventorylist = {
[1] = {},
[2] = {},
[3] = {},
[4] = {},
[5] = {},
[6] = {},
[7] = {},
[8] = {},
}
-- PROTO: HOLY SHIT THIS SUCKS, MAKES A FUNCTION EVERY FRAME, AND RUNS EVERY FRAME!!!
local inv = self:INV_Get()
local function BucketSorter(a, b)
return (inv[b[1]]["Acquisition"] + (b[2]*10000)) > (inv[a[1]]["Acquisition"] + (a[2]*10000))
end
for i, bucket in ipairs( inventorylist ) do
local temp = {}
for id, data in pairs( inv ) do
local idata = ITEMS[data.Class]
local translated = translat[idata.Category]
if i == translated[1] then
table.insert( temp, { id, translated[2] } )
end
end
table.sort( temp, BucketSorter )
for i, v in ipairs( temp ) do
table.insert( bucket, v[1] )
end
end
return inventorylist
end
function PT:INV_ListFromBuckets()
local buckets = self:INV_Buckets()
local complete = {}
for n, bucket in ipairs( buckets ) do
for i, v in ipairs( bucket ) do
table.insert( complete, v )
end
end
return complete
end
end
-- weapon select
hook.Add("StartCommand", "Benny_INV_StartCommand", function( ply, cmd )
-- local wep = ply:BennyCheck()
-- if wep then
-- local hand = wep:GetTempHandedness()
-- local inv = ply:INV_Get()
-- local inv_bucketlist = ply:INV_ListFromBuckets()
-- local inv_bucketlist_flipped = table.Flip( inv_bucketlist )
-- if CLIENT and ply.CLIENTDESIRE and inv[ply.CLIENTDESIRE ] and inv_bucketlist_flipped[ ply.CLIENTDESIRE ] then
-- cmd:SetUpMove( inv_bucketlist_flipped[ ply.CLIENTDESIRE ] )
-- end
-- if CLIENT and (wep:bGetInvID( hand ) == ply.CLIENTDESIRE) then
-- ply.CLIENTDESIRE = 0
-- print("Fixed")
-- end
-- local id = cmd:GetUpMove()
-- if id > 0 and inv_bucketlist[id] and inv[inv_bucketlist[id]] then
-- wep:BDeploy( hand, inv_bucketlist[ id ] )
-- end
-- end
end)
-- cmd:KeyDown( IN_WEAPON1 )
-- cmd:KeyDown( IN_WEAPON2 )
-- cmd:KeyDown( IN_BULLRUSH )
-- cmd:KeyDown( IN_GRENADE1 )
-- cmd:KeyDown( IN_GRENADE2 )

View File

@ -1,45 +0,0 @@
AddCSLuaFile()
local PLAYER = {}
PLAYER.DisplayName = "Benny Player Class"
PLAYER.SlowWalkSpeed = 200
PLAYER.WalkSpeed = 250
PLAYER.RunSpeed = 280
PLAYER.CrouchedWalkSpeed = 0.3
PLAYER.DuckSpeed = 0.3
PLAYER.UnDuckSpeed = 0.3
PLAYER.JumpPower = 200
PLAYER.CanUseFlashlight = false
PLAYER.MaxHealth = 100
PLAYER.MaxArmor = 100
PLAYER.StartHealth = 100
PLAYER.StartArmor = 0
PLAYER.DropWeaponOnDie = false
PLAYER.TeammateNoCollide = true
PLAYER.AvoidPlayers = true
PLAYER.UseVMHands = true
function PLAYER:Init()
self.Player:AddEFlags( EFL_NO_DAMAGE_FORCES )
end
function PLAYER:SetupDataTables()
self.Player:NetworkVar( "Bool", 0, "Shoulder" )
self.Player:NetworkVar( "Int", 0, "JumpBoost" )
self.Player:NetworkVar( "Float", 0, "VaultDebuff" )
self.Player:NetworkVar( "Float", 1, "VaultTransition" )
self.Player:NetworkVar( "Float", 2, "Stamina" )
self.Player:NetworkVar( "Vector", 0, "VaultPos1")
self.Player:NetworkVar( "Vector", 1, "VaultPos2")
self.Player:NetworkVar( "String", 0, "ReqID1")
self.Player:NetworkVar( "String", 1, "ReqID2")
end
player_manager.RegisterClass( "player_benny", PLAYER, "player_default" )

View File

@ -1,318 +0,0 @@
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" )

View File

@ -1,202 +0,0 @@
local tall = 12
local PANEL = {}
AccessorFunc( PANEL, "m_bIsMenuComponent", "IsMenu", FORCE_BOOL )
AccessorFunc( PANEL, "m_bDraggable", "Draggable", FORCE_BOOL )
AccessorFunc( PANEL, "m_bSizable", "Sizable", FORCE_BOOL )
AccessorFunc( PANEL, "m_bScreenLock", "ScreenLock", FORCE_BOOL )
AccessorFunc( PANEL, "m_bDeleteOnClose", "DeleteOnClose", FORCE_BOOL )
AccessorFunc( PANEL, "m_bPaintShadow", "PaintShadow", FORCE_BOOL )
AccessorFunc( PANEL, "m_iMinWidth", "MinWidth", FORCE_NUMBER )
AccessorFunc( PANEL, "m_iMinHeight", "MinHeight", FORCE_NUMBER )
AccessorFunc( PANEL, "m_bBackgroundBlur", "BackgroundBlur", FORCE_BOOL )
PANEL.Title = "No title"
function PANEL:Init()
self:SetFocusTopLevel( true )
self:SetPaintShadow( true )
self.btnClose = vgui.Create( "DButton", self )
self.btnClose:SetText( "" )
self.btnClose.DoClick = function ( button ) self:Close() end
self.btnClose.Paint = function( panel, w, h )
surface.SetDrawColor( schema( "fg" ) )
surface.DrawRect( 0, 0, w, h )
draw.SimpleText( "X", "Benny_10", ss(3.3), ss(0), schema_c( "bg" ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
return true
end
self:SetDraggable( true )
self:SetSizable( false )
self:SetScreenLock( false )
self:SetDeleteOnClose( true )
self:SetTitle( "Window" )
self:SetMinWidth( ss(50) )
self:SetMinHeight( ss(50) )
-- This turns off the engine drawing
self:SetPaintBackgroundEnabled( false )
self:SetPaintBorderEnabled( false )
self.m_fCreateTime = SysTime()
self:DockPadding( ss(2), ss(2+tall), ss(2), ss(2) )
end
function PANEL:ShowCloseButton( bShow )
self.btnClose:SetVisible( bShow )
end
function PANEL:GetTitle()
return self.Title
end
function PANEL:SetTitle( strTitle )
self.Title = strTitle
end
function PANEL:Close()
self:SetVisible( false )
if ( self:GetDeleteOnClose() ) then
self:Remove()
end
self:OnClose()
end
function PANEL:OnClose()
end
function PANEL:Center()
self:InvalidateLayout( true )
self:CenterVertical()
self:CenterHorizontal()
end
function PANEL:IsActive()
if ( self:HasFocus() ) then return true end
if ( vgui.FocusedHasParent( self ) ) then return true end
return false
end
function PANEL:Think()
local mousex = math.Clamp( gui.MouseX(), 1, ScrW() - 1 )
local mousey = math.Clamp( gui.MouseY(), 1, ScrH() - 1 )
if ( self.Dragging ) then
local x = mousex - self.Dragging[1]
local y = mousey - self.Dragging[2]
-- Lock to screen bounds if screenlock is enabled
if ( self:GetScreenLock() ) then
x = math.Clamp( x, 0, ScrW() - self:GetWide() )
y = math.Clamp( y, 0, ScrH() - self:GetTall() )
end
self:SetPos( x, y )
end
if ( self.Sizing ) then
local x = mousex - self.Sizing[1]
local y = mousey - self.Sizing[2]
local px, py = self:GetPos()
if ( x < self.m_iMinWidth ) then x = self.m_iMinWidth elseif ( x > ScrW() - px && self:GetScreenLock() ) then x = ScrW() - px end
if ( y < self.m_iMinHeight ) then y = self.m_iMinHeight elseif ( y > ScrH() - py && self:GetScreenLock() ) then y = ScrH() - py end
self:SetSize( x, y )
self:SetCursor( "sizenwse" )
return
end
local screenX, screenY = self:LocalToScreen( 0, 0 )
if ( self.Hovered && self.m_bSizable && mousex > ( screenX + self:GetWide() - 20 ) && mousey > ( screenY + self:GetTall() - 20 ) ) then
self:SetCursor( "sizenwse" )
return
end
if ( self.Hovered && self:GetDraggable() && mousey < ( screenY + ss(tall) ) ) then
self:SetCursor( "sizeall" )
return
end
self:SetCursor( "arrow" )
-- Don't allow the frame to go higher than 0
if ( self.y < 0 ) then
self:SetPos( self.x, 0 )
end
end
function PANEL:Paint( w, h )
surface.SetDrawColor( schema( "bg" ) )
surface.DrawRect( 0, 0, w, h )
surface.SetDrawColor( schema( "fg" ) )
surface.DrawOutlinedRect( 0, 0, w, ss(tall), ss(0.5) )
draw.SimpleText( self.Title, "Benny_12", ss(2), ss(1), schema_c( "fg" ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
return true
end
function PANEL:OnMousePressed()
local screenX, screenY = self:LocalToScreen( 0, 0 )
if ( self.m_bSizable && gui.MouseX() > ( screenX + self:GetWide() - 20 ) && gui.MouseY() > ( screenY + self:GetTall() - 20 ) ) then
self.Sizing = { gui.MouseX() - self:GetWide(), gui.MouseY() - self:GetTall() }
self:MouseCapture( true )
return
end
if ( self:GetDraggable() && gui.MouseY() < ( screenY + ss(tall) ) ) then
self.Dragging = { gui.MouseX() - self.x, gui.MouseY() - self.y }
self:MouseCapture( true )
return
end
end
function PANEL:OnMouseReleased()
self.Dragging = nil
self.Sizing = nil
self:MouseCapture( false )
end
function PANEL:PerformLayout()
self.btnClose:SetPos( self:GetWide() - ss(12+2), ss(2) )
self.btnClose:SetSize( ss(12), ss(tall-4) )
end
derma.DefineControl( "BFrame", "A simple window", PANEL, "EditablePanel" )

View File

@ -1,39 +1,14 @@
-- Thing
GM.Name = "Your Name Is Benny"
GM.Author = "Fesiug, Oranche"
GM.Author = "Fesiug, Oranche, Alex"
GM.Email = "N/A"
GM.Website = "N/A"
BENNY = {}
-- Load modules
local path = GM.FolderName .. "/gamemode/modules/"
local modules, folders = file.Find(path .. "*", "LUA")
local AC, IN = AddCSLuaFile, include
for _, folder in SortedPairs(folders, false) do
if folder == "." or folder == ".." then continue end
-- Shared modules
for _, f in SortedPairs(file.Find(path .. folder .. "/sh_*.lua", "LUA"), false) do
AddCSLuaFile(path .. folder .. "/" .. f)
include(path .. folder .. "/" .. f)
end
-- Server modules
if SERVER then
for _, f in SortedPairs(file.Find(path .. folder .. "/sv_*.lua", "LUA"), false) do
include(path .. folder .. "/" .. f)
end
end
-- Client modules
for _, f in SortedPairs(file.Find(path .. folder .. "/cl_*.lua", "LUA"), false) do
AddCSLuaFile(path .. folder .. "/" .. f)
if CLIENT then
include(path .. folder .. "/" .. f)
end
end
end
AC("camera.lua")
IN("camera.lua")
AC("items.lua")
IN("items.lua")