Benny/gamemodes/benny/gamemode/shared.lua

77 lines
1.8 KiB
Lua
Raw Normal View History

2023-09-03 09:31:16 -04:00
GM.Name = "Your Name Is Benny"
2024-03-07 20:34:16 -05:00
GM.Author = "Fesiug, Oranche, Alex"
2023-09-03 09:31:16 -04:00
GM.Email = "N/A"
GM.Website = "N/A"
2023-09-06 04:06:14 -04:00
BENNY = {}
2024-09-16 00:26:04 -04:00
function BENNY.SimpleAutoComplete( cmd, args, ... ) -- just stole it from the wiki
local possibleArgs = { ... }
local autoCompletes = {}
--TODO: Handle "test test" "test test" type arguments
args = args:upper()
local arg = string.Split( args:TrimLeft(), " " )
local lastItem = nil
for i, str in pairs( arg ) do
if ( str == "" && ( lastItem && lastItem == "" ) ) then table.remove( arg, i ) end
lastItem = str
end -- Remove empty entries. Can this be done better?
local numArgs = #arg
local lastArg = table.remove( arg, numArgs )
local prevArgs = table.concat( arg, " " )
if ( #prevArgs > 0 ) then prevArgs = " " .. prevArgs end
local possibilities = possibleArgs[ numArgs ] or { lastArg }
for _, acStr in pairs( possibilities ) do
if ( !acStr:StartsWith( lastArg ) ) then continue end
table.insert( autoCompletes, cmd .. prevArgs .. " " .. acStr )
end
return autoCompletes
end
2024-03-07 20:34:16 -05:00
local AC, IN = AddCSLuaFile, include
2023-09-03 09:31:16 -04:00
2024-03-08 20:10:47 -05:00
local CL = SERVER and AddCSLuaFile or include
2024-03-25 00:48:36 -04:00
function TSelShared( tbl, seed )
return tbl[math.Round( util.SharedRandom( seed, 1, #tbl ) )]
end
-- Language might want to be loaded first
-- Otherwise things will fail to call 'l8'
2024-03-07 22:34:29 -05:00
AC("language.lua")
IN("language.lua")
AC("convars.lua")
IN("convars.lua")
2024-03-07 20:34:16 -05:00
AC("camera.lua")
IN("camera.lua")
AC("items.lua")
2024-03-07 21:19:30 -05:00
IN("items.lua")
AC("player.lua")
IN("player.lua")
AC("player_class.lua")
IN("player_class.lua")
AC("inventory.lua")
IN("inventory.lua")
2024-09-06 22:53:01 -04:00
AC("gamestate.lua")
IN("gamestate.lua")
AC("teams.lua")
IN("teams.lua")
2024-09-21 16:53:57 -04:00
AC("pausemenu.lua")
IN("pausemenu.lua")
2024-03-07 21:19:30 -05:00
AC("richpresence_test.lua")
if CLIENT then
IN("richpresence_test.lua")
end
2024-03-08 20:10:47 -05:00
AC("debugmenu.lua")
IN("debugmenu.lua")
CL("hud.lua")