[
{"function":{"name":"BRANCH","parent":"Global","type":"libraryfield","description":{"text":"A variable containing a string indicating which (Beta) Branch of the game you are using.\n\n\t\tWhile this variable is always available in the Client & Menu realms, it is only defined in the Server  realm on local servers.\n\n\t\tFor more information on beta branches, see this page.\n \n\n\n\t\tBranch List :\n* unknown **(No beta program)**\n* dev\n* prerelease\n* x86-64\n* network_test","note":"The Branch \"network_test\" might be one or more major live updates behind, as it is not merged from the other branches (e.g. prerelease) on regularly bases. This can also be true especially if the version number ([VERSION](https://wiki.facepunch.com/gmod/Global_Variables#version)) appears to be a newer date."},"realm":"Shared and Menu","rets":{"ret":{"text":"The current branch.","name":"","type":"string"}}},"example":{"code":"if BRANCH == \"dev\" then\n\tprint(\"You are using the development branch!\")\nend"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"AccessorFunc","parent":"Global","type":"libraryfunc","description":"Adds simple Get/Set accessor functions on the specified table.\nCan also force the value to be set to a number, bool or string.","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"212-L254"},"args":{"arg":[{"text":"The table to add the accessor functions to.","name":"tab","type":"table"},{"text":"The key of the table to be get/set.","name":"key","type":"any"},{"text":"The name of the functions (will be prefixed with Get and Set).","name":"name","type":"string"},{"text":"The type the setter should force to (uses Enums/FORCE).","name":"force","type":"number{FORCE}","default":"nil"}]}},"example":{"description":"Adds the GetFooBar and SetFooBar functions to the Player metatable and then uses them.","code":"local meta = FindMetaTable( \"Player\" )\nAccessorFunc( meta, \"foo_bar\", \"FooBar\", FORCE_BOOL )\n\nmeta:SetFooBar(true)\n\nprint(meta:GetFooBar())","output":"true"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Add_NPC_Class","parent":"Global","type":"libraryfunc","description":"Defines a global entity class variable with an automatic value. In order to prevent collisions with other Enums/CLASS. You should prefix your variable with CLASS_ for consistency.","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"441-L450"},"args":{"arg":{"text":"The name of the new enum/global variable.","name":"name","type":"string"}}},"example":{"description":"Creates a global variable named CLASS_TESTER and prints its value.","code":"Add_NPC_Class( \"CLASS_TESTER\" )\nprint( CLASS_TESTER )","output":"36 (one greater than the current highest value of the Enums/CLASS)"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"AddBackgroundImage","parent":"Global","type":"libraryfunc","description":"Adds the specified image path to the main menu background pool. Image can be png or jpeg.","realm":"Menu","file":{"text":"lua/menu/background.lua","line":"101-L105"},"args":{"arg":{"text":"Path to the image.","name":"path","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"AddConsoleCommand","parent":"Global","type":"libraryfunc","description":{"text":"Tells the engine to register a console command. If the command was ran, the engine calls concommand.Run.","internal":"Use concommand.Add instead."},"realm":"Shared and Menu","args":{"arg":[{"text":"The name of the console command to add.","name":"name","type":"string"},{"text":"The help text.","name":"helpText","type":"string"},{"text":"Concommand flags using Enums/FCVAR.","name":"flags","type":"number{FCVAR}"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"AddCSLuaFile","parent":"Global","type":"libraryfunc","description":{"text":"Marks a Lua file to be sent to clients when they join the server. Doesn't do anything on the client - this means you can use it in a shared file without problems.","warning":"If the file trying to be added is empty, an error will occur, and the file will not be sent to the client.\n\t\t\n\t\tThe string cannot have whitespace.","note":"This function is not needed for scripts located in these paths because they are automatically sent to clients:   \n\t\t\t**lua/matproxy/**  \n\t\t\t**lua/postprocess/**  \n\t\t\t**lua/vgui/**  \n\t\t\t**lua/skins/**  \n\t\t\t**lua/autorun/**  \n\t\t\t**lua/autorun/client/**  \n\t\t\t\n\t\t\tYou can add up to **8192** files. Each file can be up to **64KB** compressed (LZMA)."},"realm":"Shared","args":{"arg":{"text":"The name/path to the Lua file that should be sent, **relative to the garrysmod/lua folder**. If no parameter is specified, it sends the current file.\n\nThe file path can be relative to the script it's ran from. For example, if your script is in `lua/myfolder/stuff.lua`, calling Global.AddCSLuaFile(\"otherstuff.lua\") and Global.AddCSLuaFile(\"myfolder/otherstuff.lua\") is the same thing.","name":"file","type":"string","default":"current file","note":"Please make sure your file names are unique, the filesystem is shared across all addons, so a file named `lua/config.lua` in your addon may be overwritten by the same file in another addon."}}},"example":[{"description":"Adds the cl_init.lua file in the `lua` folder to be downloaded by connecting clients. This is required, and is normally done in init.lua.","code":"AddCSLuaFile( \"cl_init.lua\" )"},{"description":"Adds the current file to the list of files to be downloaded by clients. This is usually done at the top of a shared file.","code":"AddCSLuaFile()"},{"description":"Allows to send a clientside script when a user joins the server. This kind of code can be found in some addons which load scripts to a custom folder to prevent conflicts between others files.","code":"if SERVER then\n\t-- The server doesn't need to run this script through include() because it is intended only for the client unless your using it for a shared file.\n\tAddCSLuaFile( \"client_script.lua\" )\nend\n\nif CLIENT then\n\t-- The client must have received the file, let's run it!\n\tinclude( \"client_script.lua\" )\nend"},{"description":"Specify a base folder and recursively include cl, sh and sv files without having to specify them.","code":"local function AddFile(File, dir)\n    local fileSide = string.lower(string.Left(File, 3))\n    if SERVER and fileSide == \"sv_\" then\n        include(dir..File)\n        print(\"[AUTOLOAD] SV INCLUDE: \" .. File)\n    elseif fileSide == \"sh_\" then\n        if SERVER then \n            AddCSLuaFile(dir..File)\n            print(\"[AUTOLOAD] SH ADDCS: \" .. File)\n        end\n        include(dir..File)\n        print(\"[AUTOLOAD] SH INCLUDE: \" .. File)\n    elseif fileSide == \"cl_\" then\n        if SERVER then \n            AddCSLuaFile(dir..File)\n            print(\"[AUTOLOAD] CL ADDCS: \" .. File)\n        else\n            include(dir..File)\n            print(\"[AUTOLOAD] CL INCLUDE: \" .. File)\n        end\n    end\nend\n\nlocal function IncludeDir(dir)\n    dir = dir .. \"/\"\n    local File, Directory = file.Find(dir..\"*\", \"LUA\")\n\n    for k, v in ipairs(File) do\n        if string.EndsWith(v, \".lua\") then\n            AddFile(v, dir)\n        end\n    end\n    \n    for k, v in ipairs(Directory) do\n        print(\"[AUTOLOAD] Directory: \" .. v)\n        IncludeDir(dir..v)\n    end\nend\n\nIncludeDir(\"folder_name\")"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddonMaterial","parent":"Global","type":"libraryfunc","description":{"text":"Loads the specified image from the `/cache` folder, used in combination with steamworks.Download. Most addons will provide a 512x512 png image.","note":"This works with any image file with the `.cache` file extension, even outside of the `/cache` folder."},"realm":"Client and Menu","args":{"arg":{"text":"The name of the file.","name":"name","type":"string"}},"rets":{"ret":{"text":"The material, returns `nil` if the cached file is not an image.","name":"","type":"IMaterial"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddOriginToPVS","parent":"Global","type":"libraryfunc","description":"Adds the specified vector to the PVS which is currently building. This allows all objects in visleafs visible from that vector to be drawn.","realm":"Server","args":{"arg":{"text":"The origin to add.","name":"position","type":"Vector"}}},"example":{"description":"Adds an RTCamera's current position to all player's PVS, causing props near it to always render on an rtscreen.","code":"hook.Add( \"SetupPlayerVisibility\", \"AddRTCamera\", function( ply, viewEntity )\n\t-- Adds any view entity\n\t--\n\t-- We test if the PVS is already loaded, as in the past adding a loaded pvs could have crash the server which was fixed.\n\t-- (See https://github.com/Facepunch/garrysmod-issues/issues/3744)\n\tif viewEntity:IsValid() and !viewEntity:TestPVS( ply ) then\n\t\tAddOriginToPVS( viewEntity:GetPos() )\n\tend\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddPropsOfParent","parent":"Global","type":"libraryfunc","description":{"text":"This function creates a Custom Category in the Spawnlist. Use Global.GenerateSpawnlistFromPath if you want to create a category with the contents of a folder.","warning":"Using this function before SANDBOX:PopulateContent has been called will result in an error."},"realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenttypes/custom.lua","line":"139-L172"},"args":{"arg":[{"text":"The SMContentPanel of the Node.","name":"pnlContent","type":"Panel"},{"text":"The Node.","name":"node","type":"Panel"},{"text":"The ParentID to use.","name":"parentid","type":"number"},{"text":"The Table with the Contents of the new Category.","name":"customProps","type":"table"}]}},"example":{"description":"Creates an Example category with 5 Playermodels.","code":"hook.Add(\"SpawnMenuCreated\", \"Example\", function()\n\tlocal contents = {\n\t\t[1] = {\n\t\t\t[\"model\"] =\t\"models/player/alyx.mdl\",\n\t\t\t[\"type\"] = \"model\",\n\t\t},\n\t\t[2] = {\n\t\t\t[\"model\"] =\t\"models/player/arctic.mdl\",\n\t\t\t[\"type\"] = \"model\",\n\t\t},\n\t\t[3] = {\n\t\t\t[\"model\"] =\t\"models/player/barney.mdl\",\n\t\t\t[\"type\"] = \"model\",\n\t\t},\n\t\t[4] = {\n\t\t\t[\"model\"] =\t\"models/player/breen.mdl\",\n\t\t\t[\"type\"] = \"model\",\n\t\t},\n\t\t[5] = {\n\t\t\t[\"model\"] =\t\"models/player/charple.mdl\",\n\t\t\t[\"type\"] = \"model\",\n\t\t},\n\t}\n\n\tAddPropsOfParent(g_SpawnMenu.CustomizableSpawnlistNode.SMContentPanel, g_SpawnMenu.CustomizableSpawnlistNode, 0, {[\"models/player\"] = {\n\t\ticon = \"icon16/page.png\",\n\t\tid = 999,\n\t\tname = \"Example\",\n\t\tparentid = 0,\n\t\tneedsapp = nil,\n\t\tcontents = contents\n\t}})\nend)"},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddWorldTip","parent":"Global","type":"libraryfunc","description":{"text":"This function creates a World Tip, similar to the one shown when aiming at a Thruster where it shows you its force.\n\nThis function will make a World Tip that will only last 50 milliseconds (1/20th of a second), so you must call it continuously as long as you want the World Tip to be shown. It is common to call it inside a Think hook.\n\nContrary to what the function's name implies, it is impossible to create more than one World Tip at the same time. A new World Tip will overwrite the old one, so only use this function when you know nothing else will also be using it.\n\nSee SANDBOX:PaintWorldTips for more information.","note":"This function is only available in Sandbox and its derivatives."},"realm":"Client","args":{"arg":[{"text":"**This argument is no longer used**; it has no effect on anything. You can use nil in this argument.","name":"entindex","type":"number","default":"nil"},{"text":"The text for the world tip to display.","name":"text","type":"string"},{"text":"**This argument is no longer used**; when you add a World Tip it will always last only 0.05 seconds. You can use nil in this argument.","name":"dieTime","type":"number","default":"SysTime() + 0.05"},{"text":"Where in the world you want the World Tip to be drawn. If you add a valid Entity in the next argument, this argument will have no effect on the actual World Tip.","name":"pos","type":"Vector","default":"ent:GetPos()"},{"text":"Which entity you want to associate with the World Tip. This argument is optional. If set to a valid entity, this will override the position set in `pos` with the Entity's position.","name":"ent","type":"Entity","default":"nil"}]}},"example":{"description":"Creates a World Tip where the player is looking. If the player is looking at an entity, the World Tip is positioned on the entity.","code":"hook.Add( \"Think\", \"draw World Tip\", function()\n\tlocal ply = Entity( 1 )\n\tlocal tr = ply:GetEyeTrace()\n\t\n\tlocal pos = tr.HitPos -- will be unused if ent is valid\n\tlocal ent = tr.Entity\n\t\n\tAddWorldTip( nil, \"Hello world!\", nil, pos, ent )\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Angle","parent":"Global","type":"libraryfunc","description":{"text":"Creates an Angle object, representing a [Euler Angle](https://en.wikipedia.org/wiki/Euler_angles) made up of pitch, yaw, and roll components.","warning":"This function is relatively expensive, in terms of performance, in situations where it is being called multiple times every frame (Like a loop, for example.) This is due to the overhead associated with object creation and garbage collection.\n\t\t\tWhere possible, it is generally better to store an Angle in a variable and re-use that variable rather than re-creating it repeatedly.\n\t\t\tIn cases where an empty Angle is needed, the global variable `angle_zero` is the preferred solution instead of `Angle( 0, 0, 0 )`."},"realm":"Shared and Menu","args":[{"arg":[{"text":"The pitch value of the angle, in degrees.","name":"pitch","type":"number","default":"0"},{"text":"The yaw value of the angle, in degrees.","name":"yaw","type":"number","default":"0"},{"text":"The roll value of the angle, in degrees.","name":"roll","type":"number","default":"0"}]},{"name":"Angle Copy","arg":{"text":"Creates a new Angle that is a copy of the Angle passed in.","name":"angle","type":"Angle"}},{"name":"Parse String","arg":{"text":"Attempts to parse the input string from the Global.print format of an Angle.\n\n\t\t\tReturns an Angle with its pitch, yaw, and roll set to `0` if the string cannot be parsed.","name":"angleString","type":"string"}}],"rets":{"ret":{"text":"The newly created Angle.","name":"","type":"Angle"}}},"example":{"description":"Creates an angle and prints the value to the console.","code":"print( Angle( 1, 2, 3 ) )\nprint( Angle( \"4 5 6\" ) )\nlocal test = Angle( 7, 8, 9 )\nprint( Angle( test ) )\n\nprint( Angle( \"4 5 test\" ) )\nprint( Angle() )","output":"```\n1.00 2.00 3.00\n4.00 5.00 6.00\n7.00 8.00 9.00\n\n0.00 0.00 0.00\n0.00 0.00 0.00\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"AngleRand","parent":"Global","type":"libraryfunc","description":"Returns an angle with a randomized pitch, yaw, and roll between min(inclusive), max(exclusive).","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"139-L144"},"args":{"arg":[{"text":"Min bound inclusive.","name":"min","type":"number","default":"-90 for pitch, -180 for yaw and roll"},{"text":"Max bound exclusive.","name":"max","type":"number","default":"90 for pitch, 180 for yaw and roll"}]},"rets":{"ret":{"text":"The randomly generated angle.","name":"","type":"Angle"}}},"example":{"description":"Prints out a random angle.","code":"print( AngleRand() )","output":"-6.949 113.388 130.879"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"assert","parent":"Global","type":"libraryfunc","description":"If the result of the first argument is false or nil, an error is thrown with the second argument as the message.","realm":"Shared and Menu","args":{"arg":[{"text":"The expression to assert.","name":"expression","type":"any"},{"text":"The error message to throw when assertion fails. This is only type-checked if the assertion fails.","name":"errorMessage","type":"string","default":"assertion failed!"},{"text":"Any arguments past the error message will be returned by a successful assert.","name":"returns","type":"vararg","default":"nil"}]},"rets":{"ret":[{"text":"If successful, returns the first argument.","name":"","type":"any"},{"text":"If successful, returns the error message. This will be nil if the second argument wasn't specified.\n\nSince the second argument is only type-checked if the assertion fails, this doesn't have to be a string.","name":"","type":"any"},{"text":"Returns any arguments past the error message.","name":"","type":"vararg"}]}},"example":[{"description":"The assertion is successful, and the result of the first argument is returned.","code":"local ABC = assert(print)\nprint(ABC)","output":"function: builtin#25"},{"description":"Since the first argument evaluates to false, an error is thrown.","code":"assert(print == 1, \"print is not equal to 1!\")","output":"[ERROR] lua_run:1: print is not equal to 1!"},{"description":"Examples of return behaviour.","code":"print(assert(5))\nprint(assert(true, \"foo\", 2, {}))","output":"```\n5\ntrue\tfoo\t2\ttable: 0x36409278\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"BroadcastLua","parent":"Global","type":"libraryfunc","description":{"text":"Sends the specified Lua code to all connected clients and executes it.","note":"If you need to use this function more than once, consider using net library.\n\t\t\tSend net message and make the entire code you want to execute in net.Receive on client.  \n\n\t\t\tIf executed **clientside**, this function won't do anything."},"realm":"Shared","args":{"arg":{"text":"The code to be executed. Capped at length of 6000 characters.","name":"code","type":"string"}}},"example":{"description":"Print \"Hello World!\" in the clients' console.","code":"BroadcastLua( \"print( 'Hello World!' )\" )","output":"Hello World!"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"BuildNetworkedVarsTable","parent":"Global","type":"libraryfunc","description":"Dumps the networked variables of all entities into one table and returns it.","realm":"Shared","rets":{"ret":{"text":"Format:\n* key = Entity for NWVars or number (always 0) for global vars.\n* value = table formatted as:\n  * key = string var name.\n  * value = any type var value.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CanAddServerToFavorites","parent":"Global","type":"libraryfunc","description":{"text":"Used internally to check if the current server the player is on can be added to favorites or not. Does not check if the server is ALREADY in the favorites.","internal":""},"realm":"Menu","rets":{"ret":{"text":"Can add to favorites?","name":"","type":"boolean"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"CancelLoading","parent":"Global","type":"libraryfunc","description":"Aborts joining of the server you are currently joining.","realm":"Menu"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"ChangeBackground","parent":"Global","type":"libraryfunc","description":"Sets the active main menu background image to a random entry from the background images pool. Images are added with Global.AddBackgroundImage.","realm":"Menu","file":{"text":"lua/menu/background.lua","line":"109-L164"},"args":{"arg":{"text":"Apparently does nothing.","name":"currentgm","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"ChangeTooltip","parent":"Global","type":"libraryfunc","description":"Automatically called by the engine when a panel is hovered over with the mouse","realm":"Client and Menu","file":{"text":"lua/includes/util/tooltips.lua","line":"38-L64"},"args":{"arg":{"text":"Panel that has been hovered over","name":"panel","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ClearBackgroundImages","parent":"Global","type":"libraryfunc","description":"Empties the pool of main menu background images.","realm":"Menu","file":{"text":"lua/menu/background.lua","line":"95-L99"}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"ClearLuaErrorGroup","parent":"Global","type":"libraryfunc","description":"Clears all Lua Errors with the given group id.","realm":"Menu","file":{"text":"lua/menu/problems/problems.lua","line":"73-L86"},"args":{"arg":{"text":"group_id to remove. Will be \"[addon-name]-0\" or \"Other-\"","name":"group_id","type":"string"}}},"example":{"description":"Creating an Error and Removing it from the Problems menu.","code":"RunString(\"Error\") -- Errors not created by an addon count as Other-\nClearLuaErrorGroup(\"Other-\")"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"ClearProblem","parent":"Global","type":"libraryfunc","description":"Removes the given Problem from the Problems table and refreshes the Problems panel.","realm":"Menu","file":{"text":"lua/menu/problems/problems.lua","line":"88-L98"},"args":{"arg":{"text":"The Problem ID to remove","name":"id","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"ClientsideModel","parent":"Global","type":"libraryfunc","description":{"text":"Creates a non physical entity that only exists on the client. See also ents.CreateClientProp if physics is wanted.","bug":[{"text":"Parented clientside models will become detached if the parent entity leaves the PVS. A workaround is available on the issue tracker page linked below.","issue":"861"},{"text":"Clientside entities are not garbage-collected, thus you must store a reference to the object (in a variable) and call CSEnt:Remove manually when necessary.","issue":"1387"},{"text":"Clientside models will occasionally delete themselves during high server lag.","issue":"3184"}]},"realm":"Client","args":{"arg":[{"text":"The file path to the model.","name":"model","type":"string"},{"text":"The render group of the entity for the clientside leaf system, see Enums/RENDERGROUP.","name":"renderGroup","type":"number","default":"RENDERGROUP_OTHER"}]},"rets":{"ret":{"text":"Created client-side model (`C_BaseFlex`) or `nil` if creation of the entity failed for any reason.","name":"","type":"CSEnt|nil"}}},"example":{"description":"Creates a clientside entity where the player is looking.","code":"concommand.Add( \"test_csent\", function( ply )\n\n\tlocal trace = ply:GetEyeTrace()\n\n\tlocal entity = ClientsideModel( \"models/props_c17/oildrum001_explosive.mdl\" )\n\tentity:SetPos( trace.HitPos + trace.HitNormal * 24 )\n\tentity:Spawn()\n\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"ClientsideRagdoll","parent":"Global","type":"libraryfunc","description":{"text":"Creates a fully clientside ragdoll.","note":"The ragdoll initially starts as hidden and with shadows disabled, see the example for how to enable it.\n\nThere's no need to call Entity:Spawn on this entity.","bug":{"text":"Clientside entities are not garbage-collected, thus you must store a reference to the object and call CSEnt:Remove manually.","issue":"1387"}},"realm":"Client","args":{"arg":[{"text":"The file path to the model.","name":"model","type":"string"},{"text":"The Enums/RENDERGROUP to assign.","name":"renderGroup","type":"number","default":"RENDERGROUP_OPAQUE"}]},"rets":{"ret":{"text":"The newly created client-side only ragdoll. (`C_ClientRagdoll`)","name":"","type":"CSEnt"}}},"example":[{"description":"Creates a new ragdoll with the player model of breen and enables rendering and shadows.","code":"concommand.Add( \"test_csragdoll\", function( ply )\n\n\tlocal ragdoll = ClientsideRagdoll( \"models/player/breen.mdl\" )\n\tragdoll:SetNoDraw( false )\n\tragdoll:DrawShadow( true )\n\t--print( ragdoll )\n\nend )"},{"description":"Example of how to set the ragdoll's position.","code":"local csRag = FindMetaTable( \"CSEnt\" )\n-- csRag:SetPos() doesn't work for C_ClientRagdoll entities.\nfunction csRag:SetRagdollPos(pos)\n\t\n\tfor i = 0, self:GetPhysicsObjectCount() - 1 do \n\t\t-- Get the physics object (PhysBone)\n\t\tlocal phys = self:GetPhysicsObjectNum(i)\n\t\t-- Get the position of the physics object relative to the ragdoll's position\n\t\tlocal localPos = self:WorldToLocal( phys:GetPos() )\n\t\t-- Set the physics object's location to the new position using the relative position to it's previous position\n\t\tphys:SetPos( pos + localPos )\n\t\t\n\tend\n\t\nend\n\n-- Example usage\nconcommand.Add( \"player_csragdoll\", function( ply )\n\tlocal ragdoll = ClientsideRagdoll( ply:GetModel() )\t\t-- Create a ragdoll using the player's model\n\tragdoll:SetNoDraw( false )\n\tragdoll:DrawShadow( true )\n\tragdoll:SetRagdollPos( ply:GetPos() )\t\t-- Set the position of the ragdoll to the player's position\nend )"}],"realms":["Client"],"type":"Function"},
{"function":{"name":"ClientsideScene","parent":"Global","type":"libraryfunc","description":"Creates a scene entity based on the scene name and the entity.","realm":"Client","args":{"arg":[{"text":"The name of the scene.","name":"name","type":"string"},{"text":"The entity to play the scene on.","name":"targetEnt","type":"Entity"}]},"rets":{"ret":{"text":"C_SceneEntity","name":"","type":"CSEnt"}}},"example":{"description":"Plays \"I guess you should go with Alyx\" line from HL2.","code":"ClientsideScene( \"scenes/eli_lab/mo_gowithalyx01.vcd\", LocalPlayer() )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"CloseDermaMenus","parent":"Global","type":"libraryfunc","description":"Closes all Derma menus that have been passed to Global.RegisterDermaMenuForClose and calls GM:CloseDermaMenus","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"collectgarbage","parent":"Global","type":"libraryfunc","description":"Executes the specified action on the garbage collector.","realm":"Shared and Menu","args":{"arg":[{"text":"The action to run.\n\nValid actions are `collect`, `stop`, `restart`, `count`, `step`, `setpause`, `setstepmul` and `isrunning`.","name":"action","type":"string","default":"collect","note":"`isrunning` is only available on the x86-64 versions, because of the difference in the LuaJIT version. [See here](jit.version)"},{"text":"The argument of the specified action, only applicable for `step`, `setpause` and `setstepmul`.","name":"arg","type":"number"}]},"rets":{"ret":{"text":"If the action is count this is the number of kilobytes of memory used by Lua.\nIf the action is step this is true if a garbage collection cycle was finished.\n\nIf the action is setpause this is the previous value for the GC's pause.\nIf the action is setstepmul this is the previous value for the GC's step.","name":"","type":"any"}}},"example":{"description":"The current floored dynamic memory usage of Lua, in kilobytes.","code":"print( collectgarbage( \"count\" ) )"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Color","parent":"Global","type":"libraryfunc","description":{"text":"Creates a Color.\n\t\n\nHere is a list of colors already cached by the game \n\nVariable | Color (RGBA) |\n-----|------------|\n| color_white | Color(255, 255, 255, 255) |\n| color_black | Color(0, 0, 0, 255) |\n| color_transparent | Color(255, 255, 255, 0) |","warning":["This function is relatively expensive when used in rendering hooks or in operations requiring very frequent calls (like loops for example) due to object creation and garbage collection. It is better to store the color in a variable or to use the [default colors](https://wiki.facepunch.com/gmod/Global_Variables#misc) available.","Under no circumstances should these variables be modified (by a Lerp or value modification). Some addons that use these values (e.g. color_white) will be affected by this change."]},"realm":"Shared and Menu","file":{"text":"lua/includes/util/color.lua","line":"13-L22"},"args":{"arg":[{"text":"An integer from `0-255` describing the red value of the color.","name":"r","type":"number"},{"text":"An integer from `0-255` describing the green value of the color.","name":"g","type":"number"},{"text":"An integer from `0-255` describing the blue value of the color.","name":"b","type":"number"},{"text":"An integer from `0-255` describing the alpha (transparency) of the color.(default 255)","name":"a","type":"number","default":"255"}]},"rets":{"ret":{"text":"The created Color.","name":"","type":"Color"}}},"example":[{"description":"Creates a color and prints the components to the console.","code":"PrintTable( Color( 1, 2, 3, 4 ) )","output":"```\na\t=\t4\nb\t=\t3\ng\t=\t2\nr\t=\t1\n```"},{"description":"Color variables can have individual channels set using the arguments.","code":"local col = Color( 0, 255, 0 )\n\ncol.r = 255\n\nPrintTable( col )","output":"```\na\t=\t255\nb\t=\t0\ng\t=\t255\nr\t=\t255\n```"},{"description":"Transforms a color object to a string, then prints it.","code":"local str = tostring( Color( 255, 0, 0 ) )\nprint( str )","output":"```\n255 0 0\n```"},{"description":"Prints `equal` if both colors are equal, otherwise `unequal` will be printed.","code":"if Color( 255, 0, 0 ) == Color( 255, 0, 0 ) then\n\tprint( \"equal\" )\nelse\n\tprint( \"unequal\" )\nend","output":"```\nequal\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ColorAlpha","parent":"Global","type":"libraryfunc","description":"Returns a new Color with the RGB components of the given Color and the alpha value specified.","realm":"Shared and Menu","file":{"text":"lua/includes/util/color.lua","line":"27-L31"},"args":{"arg":[{"text":"The Color from which to take RGB values. This color will not be modified.","name":"color","type":"Color"},{"text":"The new alpha value, a number between 0 and 255. Values above 255 will be clamped.","name":"alpha","type":"number"}]},"rets":{"ret":{"text":"The new Color with the modified alpha value","name":"","type":"table"}}},"example":{"code":"local red = Color( 255, 0, 0, 255 )\nlocal red2 = ColorAlpha( red, 125 )\nprint( red.r, red.g, red.b, red.a )\nprint( red2.r, red2.g, red2.b, red2.a )","output":"```\n255\t0\t0\t255\n255\t0\t0\t125\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ColorRand","parent":"Global","type":"libraryfunc","description":"Creates a Color with randomized red, green, and blue components. If the alpha argument is true, alpha will also be randomized.","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"149-L155"},"args":{"arg":{"text":"Should alpha be randomized.","name":"a","type":"boolean","default":"false"}},"rets":{"ret":{"text":"The created Color.","name":"","type":"Color"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ColorToHSL","parent":"Global","type":"libraryfunc","description":"Converts a Color into HSL color space.","realm":"Shared and Menu","args":{"arg":{"text":"The Color.","name":"color","type":"Color"}},"rets":{"ret":[{"text":"The hue in degrees `[0, 360]`.","name":"","type":"number"},{"text":"The saturation in the range `[0, 1]`.","name":"","type":"number"},{"text":"The lightness in the range `[0, 1]`.","name":"","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ColorToHSV","parent":"Global","type":"libraryfunc","description":"Converts a Color into HSV color space.","realm":"Shared and Menu","args":{"arg":{"text":"The Color.","name":"color","type":"Color"}},"rets":{"ret":[{"text":"The hue in degrees `[0, 360]`.","name":"","type":"number"},{"text":"The saturation in the range `[0, 1]`.","name":"","type":"number"},{"text":"The value in the range `[0, 1]`.","name":"","type":"number"}]}},"example":{"description":"Creates a color and prints the HSV values to the console.","code":"print( ColorToHSV( Color( 255, 255, 0 ) ) )","output":"```\n60 1 1\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"CompileFile","parent":"Global","type":"libraryfunc","description":"Attempts to compile the given file. If successful, returns a function that can be called to perform the actual execution of the script.","realm":"Shared","args":{"arg":[{"text":"Path to the file, relative to the `garrysmod/lua/` directory.","name":"path","type":"string"},{"text":"Decides whether or not a non-halting error should be thrown on compile failure.","name":"showError","type":"boolean","default":"true","added":"2025.01.31"}]},"rets":{"ret":{"text":"The function which executes the script.","name":"","type":"function"}}},"example":{"description":"Assuming our file is named example.lua and located in the garrysmod/lua/ directory, the following code would execute the script.","code":"local example = CompileFile(\"example.lua\")\nexample()","output":"Hello!"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CompileString","parent":"Global","type":"libraryfunc","description":"This function will compile the code argument as lua code and return a function that will execute that code. \n\nPlease note that this function will not automatically execute the given code after compiling it.","realm":"Shared","args":{"arg":[{"text":"The code to compile.","name":"code","type":"string"},{"text":"An identifier in case an error is thrown. (The same identifier can be used multiple times)","name":"identifier","type":"string"},{"text":"If false this function will return an error string instead of throwing an error.","name":"handleError","type":"boolean","default":"true"}]},"rets":{"ret":{"text":"A function that, when called, will execute the given code.\n\nReturns the error string if there was a Lua error and third argument is false.","name":"","type":"function"}}},"example":[{"description":"Code that will not compile, with ErrorHandling set to false.","code":"local code = \"MsgN('Hi)\"\nlocal func = CompileString(code, \"TestCode\", false)\nMsgN(func)","output":"TestCode:1: unfinished string near '<eof>' (this is not a script error - it is a returned string)"},{"description":"Code that will compile.","code":"local code = \"MsgN('Hi')\"\nlocal func = CompileString(code, \"TestCode\")\n\nif func then -- Compile String returns nil if 3rd argument is true and code has errors.\n   func()\nend","output":"Hi"},{"description":"Compiled code with custom arguments; captured with the varargs identifier.","code":"local code = [[\n\tlocal args = { ... } \n\tprint( unpack( args ) )\n\tprint( args[ 2 ] + args[ 3 ])\n\tprint( args[ 4 ] .. args[ 5 ])\n\n\tlocal first, second = ...\n\tprint( first, second )\n]]\nlocal func = CompileString( code, \"VarargCodeTest\" )\nfunc( 1, 2, 3, \"A\", \"B\", \"C\" )","output":"```\n1\t2\t3\tA\tB\tC\n5\nAB\n1   2\n```"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ConVarExists","parent":"Global","type":"libraryfunc","description":"Returns whether a ConVar with the given name exists or not","realm":"Shared and Menu","args":{"arg":{"text":"Name of the ConVar.","name":"name","type":"string"}},"rets":{"ret":{"text":"True if the ConVar exists, false otherwise.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"CreateClientConVar","parent":"Global","type":"libraryfunc","description":{"text":"Makes a clientside-only console variable\n\n\n\nAlthough this function is shared, it should only be used clientside.","note":"This function is a wrapper of Global.CreateConVar, with the difference being that FCVAR_ARCHIVE and FCVAR_USERINFO are added automatically when **shouldsave** and **userinfo** are true, respectively."},"realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"488-L502"},"args":{"arg":[{"text":"Name of the ConVar to be created and able to be accessed.\n\nThis cannot be a name of existing console command or console variable. It will silently fail if it is.","name":"name","type":"string"},{"text":"Default value of the ConVar.","name":"default","type":"string","alttype":"number"},{"text":"Should the ConVar be saved across sessions in the cfg/client.vdf file.","name":"shouldsave","type":"boolean","default":"true"},{"text":"Should the ConVar and its containing data be sent to the server when it has changed. This makes the convar accessible from server using Player:GetInfoNum and similar functions.","name":"userinfo","type":"boolean","default":"false"},{"text":"Help text to display in the console.","name":"helptext","type":"string","default":""},{"text":"If set, the convar cannot be changed to a number lower than this value.","name":"min","type":"number","default":"nil"},{"text":"If set, the convar cannot be changed to a number higher than this value.","name":"max","type":"number","default":"nil"}]},"rets":{"ret":{"text":"Created convar.","name":"","type":"ConVar"}}},"example":{"description":"Creates a ConVar that does nothing and saves.","code":"CreateClientConVar(\"superspeed_enabled\", \"0\", true, false)"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"CreateContextMenu","parent":"Global","type":"libraryfunc","description":{"text":"Creates a ContextMenu.","internal":""},"realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/contextmenu.lua","line":"137-L230"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"CreateConVar","parent":"Global","type":"libraryfunc","description":{"text":"Creates a console variable (ConVar).\n\nGenerally these are used for settings, which can be stored automatically across sessions if desired. They are usually set via an accompanying user interface clientside, or listed somewhere for dedicated server usage, in which case they might be set via `server.cfg` on server start up.","warning":"Do not use the FCVAR_NEVER_AS_STRING and FCVAR_REPLICATED flags together, as this can cause the console variable to have strange values on the client."},"realm":"Shared and Menu","args":{"arg":[{"text":"Name of the ConVar.\n\nThis cannot be a name of an engine console command or console variable. It will throw an error if it is. If it is the same name as another lua ConVar, it will return that ConVar object.","name":"name","type":"string"},{"text":"Default value of the convar. Can also be a number.","name":"value","type":"string"},{"text":"Flags of the convar, see Enums/FCVAR, either as bitflag or as table.","name":"flags","type":"number{FCVAR}|table<number>","default":"FCVAR_NONE"},{"text":"The help text to show in the console.","name":"helptext","type":"string","default":""},{"text":"If set, the ConVar cannot be changed to a number lower than this value.","name":"min","type":"number","default":"nil"},{"text":"If set, the ConVar cannot be changed to a number higher than this value.","name":"max","type":"number","default":"nil"}]},"rets":{"ret":{"text":"The convar created, or `nil` if convar could not be created. (such as when there's a console command with the same name)\n\nIf a ConVar already exists (including engine ones), it will simply return the already existing ConVar without modifying it in any way.","name":"","type":"ConVar"}}},"example":{"description":"Code that will create a Convar and a chatprint with the content of the convar.","code":"local convar_example = CreateConVar(\"convar_example\", \"1\", {FCVAR_ARCHIVE, FCVAR_NOTIFY, FCVAR_REPLICATED}, \"This is a server-side convar.\")\n\nconcommand.Add(\"print_convar\", function(ply)\n  ply:ChatPrint(\"Server ConVar value: \" .. convar_example:GetString())\nend)","output":"Server ConVar value: 1"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"CreateMaterial","parent":"Global","type":"libraryfunc","description":{"text":"Creates a new material with the specified name and shader.\n\nMaterials created with this function can be used in Entity:SetMaterial and Entity:SetSubMaterial by prepending a `!` to their material name argument.\n\nThis will not create a new material if another material object with the same name already exists. All Materials created by this functions are cleaned up on map shutdown.","note":"This does not work with [patch materials](https://developer.valvesoftware.com/wiki/Patch).","bug":{"text":".pngs must be loaded with Global.Material before being used with this function.","issue":"1531"}},"realm":"Client and Menu","args":{"arg":[{"text":"The material name. Must be unique.","name":"name","type":"string"},{"text":"The shader name. See Shaders.","name":"shaderName","type":"string"},{"text":"Key-value table that contains shader parameters and proxies.\n\n* See: [List of Shader Parameters on Valve Developers Wiki](https://developer.valvesoftware.com/wiki/Category:List_of_Shader_Parameters) and each shader's page from .","name":"materialData","type":"table","note":"Unlike IMaterial:SetTexture, this table will not accept ITexture values. Instead, use the texture's name (see ITexture:GetName)."}]},"rets":{"ret":{"text":"Created material","name":"","type":"IMaterial"}}},"example":[{"description":"Alternative to render.SetColorMaterial, mainly for use with Entity:SetMaterial","code":"CreateMaterial( \"colortexshp\", \"VertexLitGeneric\", {\n  [\"$basetexture\"] = \"color/white\",\n  [\"$model\"] = 1,\n  [\"$translucent\"] = 1,\n  [\"$vertexalpha\"] = 1,\n  [\"$vertexcolor\"] = 1\n} )"},{"description":"Sample example of using material proxies. **Keep in mind that you can only have 1 instance of each proxy type! This is a limitation of how Lua tables work**","code":"local mat = CreateMaterial( \"combine_ball_animated\", \"UnlitGeneric\", {\n  [\"$basetexture\"] = \"effects/comball/comball\",\n  [\"Proxies\"] = {\n    [\"AnimatedOffsetTexture\"] = {\n      [\"animatedtexturevar\"] = \"$basetexture\",\n      [\"animatedtextureframenumvar\"] = \"$frame\",\n      [\"animatedtextureframerate\"] = 30\n    }\n  }\n} )\n\nhook.Add( \"HUDPaint\", \"HUDPaint_DrawATexturedBox\", function()\n\tsurface.SetMaterial( mat )\n\tsurface.SetDrawColor( 255, 255, 255, 255 )\n\tsurface.DrawTexturedRect( 50, 50, 128, 128 )\nend )"}],"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CreateNewAddonPreset","parent":"Global","type":"libraryfunc","description":"Creates a new Preset from the given JSON string.","realm":"Menu","file":{"text":"lua/menu/mainmenu.lua","line":"585-L592"},"args":{"arg":{"text":"A JSON string containing all necessary information.\n\t\t\tJSON structue should be Structures/Preset","name":"data","type":"string"}}},"example":{"description":"Creating a custom Preset.","code":"local preset = {\n\t[\"enabled\"] = {},\n\t[\"disabled\"] = {},\n\t[\"name\"] = \"Example\",\n\t[\"newAction\"] = \"\" -- do nothing with addons not in the preset.\n}\nCreateNewAddonPreset( util.TableToJSON( preset ) )"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"CreateParticleSystem","parent":"Global","type":"libraryfunc","description":{"text":"Creates a new particle system. See also Entity:CreateParticleEffect, Global.ParticleEffectAttach and Global.CreateParticleSystemNoEntity.","note":"The particle effect must be precached with Global.PrecacheParticleSystem and the file its from must be added via game.AddParticles before it can be used!"},"realm":"Client","args":{"arg":[{"text":"The entity to attach the control point to.","name":"ent","type":"Entity"},{"text":"The name of the effect to create. It must be precached via Global.PrecacheParticleSystem beforehand.","name":"effect","type":"string"},{"text":"See Enums/PATTACH.","name":"partAtt","type":"number"},{"text":"The attachment ID on the entity to attach the particle system to","name":"entAtt","type":"number","default":"0"},{"text":"The offset from the Entity:GetPos of the entity we are attaching this CP to.","name":"offset","type":"Vector","default":"Vector( 0, 0, 0 )"}]},"rets":{"ret":{"text":"The created particle system.","name":"","type":"CNewParticleEffect"}}},"example":{"description":"Creates a big explosion effect at the player's feet, and deletes it 0.1 seconds after starting.","code":"PrecacheParticleSystem( \"explosion_huge_g\" )\n\nconcommand.Add( \"test_particle\", function( ply, cmd, arg )\n\n\tlocal part = CreateParticleSystem( ply, \"explosion_huge_g\", PATTACH_POINT_FOLLOW )\n\ttimer.Simple( 0.1, function() part:StopEmission( false, true, false ) end )\n\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"CreateParticleSystemNoEntity","parent":"Global","type":"libraryfunc","description":{"text":"Creates a new particle system, and sets control points 0 and 1 to given position, as well as optionally orientation of CP0 to the given angles. See also Global.CreateParticleSystem","note":"The particle effect must be precached with Global.PrecacheParticleSystem and the file its from must be added via game.AddParticles before it can be used!"},"added":"2023.06.28","realm":"Client","args":{"arg":[{"text":"The name of the effect to create. It must be precached via Global.PrecacheParticleSystem beforehand.","name":"effect","type":"string"},{"text":"The position for the particle system.","name":"pos","type":"Vector"},{"text":"The orientation of the particle system.","name":"ang","type":"Angle","default":"Angle( 0, 0, 0 )"}]},"rets":{"ret":{"text":"The created particle system.","name":"","type":"CNewParticleEffect"}}},"example":{"description":"Creates a big explosion effect at the place the player is looking at.","code":"PrecacheParticleSystem( \"explosion_huge_g\" )\n\nconcommand.Add( \"test_particle\", function( ply, cmd, arg )\n\n\tlocal pos = ply:GetEyeTrace().HitPos\n\tCreateParticleSystemNoEntity( \"explosion_huge_g\", pos )\n\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"CreatePhysCollideBox","parent":"Global","type":"libraryfunc","description":{"text":"Creates a new PhysCollide from the given bounds.","bug":{"text":"This fails to create planes or points - no components of the mins or maxs can be the same.","issue":"3568"}},"realm":"Shared","args":{"arg":[{"text":"Min corner of the box. This is not automatically ordered with the maxs and must contain the smallest vector components. See Global.OrderVectors.","name":"mins","type":"Vector"},{"text":"Max corner of the box. This is not automatically ordered with the mins and must contain the largest vector components.","name":"maxs","type":"Vector"}]},"rets":{"ret":{"text":"The new PhysCollide. This will be a NULL PhysCollide (PhysCollide:IsValid returns false) if given bad vectors or no more PhysCollides can be created in the physics engine.","name":"","type":"PhysCollide"}}},"example":{"description":"A box that interacts correctly with VPhysics objects and player movement.","code":"AddCSLuaFile()\n\nDEFINE_BASECLASS( \"base_anim\" )\n\nENT.PrintName = \"Cube\"\nENT.Spawnable = true\n\nENT.Mins = Vector( -16, -16, -16 )\nENT.Maxs = Vector(  16,  16,  16 )\n\nfunction ENT:Initialize()\n    self.PhysCollide = CreatePhysCollideBox( self.Mins, self.Maxs )\n    self:SetCollisionBounds( self.Mins, self.Maxs )\n\n    if SERVER then\n        self:PhysicsInitBox( self.Mins, self.Maxs )\n        self:SetSolid( SOLID_VPHYSICS )\n        self:PhysWake()\n    end\n\n    if CLIENT then\n        self:SetRenderBounds( self.Mins, self.Maxs )\n    end\n\n    self:EnableCustomCollisions( true )\n    self:DrawShadow( false )\nend\n\n-- Handles collisions against traces. This includes player movement.\nfunction ENT:TestCollision( startpos, delta, isbox, extents )\n    if not IsValid( self.PhysCollide ) then\n        return\n    end\n\n    -- TraceBox expects the trace to begin at the center of the box, but TestCollision is bad\n    local max = extents\n    local min = -extents\n    max.z = max.z - min.z\n    min.z = 0\n\n    local hit, norm, frac = self.PhysCollide:TraceBox( self:GetPos(), self:GetAngles(), startpos, startpos + delta, min, max )\n\n    if not hit then\n        return\n    end\n\n    return { \n        HitPos = hit,\n        Normal  = norm,\n        Fraction = frac,\n    }\nend\n\nfunction ENT:Draw()\n    render.DrawWireframeBox( self:GetPos(), self:GetAngles(), self.Mins, self.Maxs, Color( 255, 0, 0 ), true )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CreatePhysCollidesFromModel","parent":"Global","type":"libraryfunc","description":"Creates PhysCollide objects for every physics object the model has. The model must be precached with util.PrecacheModel before being used with this function.","realm":"Shared","args":{"arg":{"text":"Model path to get the collision objects of.","name":"modelName","type":"string"}},"rets":{"ret":{"text":"Table of PhysCollide objects. The number of entries will match the model's physics object count. See also Entity:GetPhysicsObjectCount. Returns no value if the model doesn't exist, or has not been precached.","name":"","type":"table<PhysCollide>"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CreateSound","parent":"Global","type":"libraryfunc","description":{"text":"Returns a sound parented to the specified entity.","note":["You can only create one CSoundPatch per audio file, per entity at the same time.","Valid sample rates: **11025 Hz, 22050 Hz and 44100 Hz**, otherwise you may see this kind of message:\n\n`Unsupported 32-bit wave file your_sound.wav` and \n`Invalid sample rate (48000) for sound 'your_sound.wav'`"]},"realm":"Shared","args":{"arg":[{"text":"The target entity.","name":"targetEnt","type":"Entity"},{"text":"The sound to play. (Sound path or a soundscript) [Soundscript Characters](https://developer.valvesoftware.com/wiki/Soundscripts/en#Sound_Characters) are supported.","name":"soundName","type":"string"},{"text":"A CRecipientFilter of the players that will have this sound networked to them.\n\nIf not set, the default is a [CPASAttenuationFilter](https://developer.valvesoftware.com/wiki/CRecipientFilter#Derived_classes).","name":"filter","type":"CRecipientFilter","default":"nil","note":"This argument only works serverside."}]},"rets":{"ret":{"text":"The sound object. You should keep a reference to this object for as long as you wish the sound to play!","name":"","type":"CSoundPatch"}}},"example":{"description":"Play a sound everywhere, similar to surface.PlaySound but available clientside and serverside.","code":"local LoadedSounds\nif CLIENT then\n\tLoadedSounds = {} -- this table caches existing CSoundPatches\nend\n\nlocal function ReadSound( FileName )\n\tlocal sound\n\tlocal filter\n\tif SERVER then\n\t\tfilter = RecipientFilter()\n\t\tfilter:AddAllPlayers()\n\tend\n\tif SERVER or !LoadedSounds[FileName] then\n\t\t-- The sound is always re-created serverside because of the RecipientFilter.\n\t\tsound = CreateSound( game.GetWorld(), FileName, filter ) -- create the new sound, parented to the worldspawn (which always exists)\n\t\tif sound then\n\t\t\tsound:SetSoundLevel( 0 ) -- play everywhere\n\t\t\tif CLIENT then\n\t\t\t\tLoadedSounds[FileName] = { sound, filter } -- cache the CSoundPatch\n\t\t\tend\n\t\tend\n\telse\n\t\tsound = LoadedSounds[FileName][1]\n\t\tfilter = LoadedSounds[FileName][2]\n\tend\n\tif sound then\n\t\tif CLIENT then\n\t\t\tsound:Stop() -- it won't play again otherwise\n\t\tend\n\t\tsound:Play()\n\tend\n\treturn sound -- useful if you want to stop the sound yourself\nend\n\n-- When we are ready, we play the sound:\nReadSound( \"phx/hmetal1.wav\" )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CreateSprite","parent":"Global","type":"libraryfunc","description":"Creates and returns a new DSprite element with the supplied material.","realm":"Client","args":{"arg":{"text":"Material the sprite should draw.","name":"material","type":"IMaterial"}},"rets":{"ret":{"text":"The new DSprite element.","name":"","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"CurTime","parent":"Global","type":"libraryfunc","description":"Returns the uptime of the server in seconds (to at least 4 decimal places)\n\nThis is a synchronised value and affected by various factors such as host_timescale (or game.GetTimeScale) and the server being paused - either by `sv_pausable` or all players disconnecting.\n\nYou should use this function for timing in-game events but not for real-world events.\n\nSee also: Global.RealTime, Global.SysTime","realm":"Shared and Menu","rets":{"ret":{"text":"Time synced with the game server.","name":"","type":"number"}}},"example":{"description":"Simple delay timer.","code":{"text":"local delay = 0\n\nhook.Add( \"Think\", \"CurTimeDelay\", function()\n\tif CurTime()","delay":{"then":"","return":"","end":"","print":"","this":"","message":"","will":"","repeat":"","every":"","seconds.":"","delay":"CurTime()","ode":"ode","output":"This message will repeat every 5 seconds."}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"DamageInfo","parent":"Global","type":"libraryfunc","description":{"text":"Returns an CTakeDamageInfo object.","bug":{"text":"This does not create a unique object, but instead returns a shared reference. That means you cannot use two or more of these objects at once.","issue":"2771"}},"realm":"Shared","rets":{"ret":{"text":"The CTakeDamageInfo object.","name":"","type":"CTakeDamageInfo"}}},"example":{"description":"Example usage","code":"function TakeDamage( victim, damage, attacker, inflictor )\n\tlocal dmg = DamageInfo() -- Create a server-side damage information class\n\tdmg:SetDamage( damage )\n\tdmg:SetAttacker( attacker )\n\tdmg:SetInflictor( inflictor )\n\tdmg:SetDamageType( DMG_ENERGYBEAM )\n\tvictim:TakeDamageInfo( dmg )\nend\n\nconcommand.Add( \"kill_this_entity\", function( ply, cmd, args )\n\tlocal target = ply:GetEyeTrace().Entity\n\tif ( target:IsVehicle() ) then\n\t\ttarget = target:GetDriver() -- Convert this to damage the plater inside\n\tend\n\n\t-- When target is a player in a vehicle will not get damaged\n\tTakeDamage( target, target:Health(), ply, ply:GetActiveWeapon() )\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DebugInfo","parent":"Global","type":"libraryfunc","description":"Writes text to the right hand side of the screen, like the old error system. Messages disappear after a couple of seconds.","realm":"Shared and Menu","args":{"arg":[{"text":"The location on the right hand screen to write the debug info to. Starts at 0, no upper limit","name":"slot","type":"number"},{"text":"The debugging information to be written to the screen","name":"info","type":"string"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"DEFINE_BASECLASS","parent":"Global","type":"libraryfunc","description":{"text":"Generates and provides a local variable `BaseClass` that can be used to call the original version of a class functions after modifying it.\n\n\t\tThis is a preprocessor keyword that is directly replaced with the following text:\n```lua\nlocal BaseClass = baseclass.Get\n```\n\nBecause this is a simple preprocessor keyword and not a function, it will cause problems if not used properly\n\nSee baseclass.Get for more information.\n\t\n\nFor more information, including usage examples, see the BaseClasses reference page.","warning":"The preprocessor is not smart enough to know when substitution doesn't make sense, such as: table keys and strings.  \n\nRunning `print(\"DEFINE_BASECLASS\")` is the same as `print(\"local BaseClass = baseclass.Get\")`"},"realm":"Shared and Menu","args":{"arg":{"text":"Baseclass name","name":"value","type":"string"}}},"example":{"description":"Showcase Demonstration from the sandbox gamemode code","code":"DEFINE_BASECLASS( \"gamemode_base\" )\t\t--Establish the var BaseClass to hold the original base gamemode functions\n\nfunction GM:PlayerSpawn( pl, transiton )\t--overriding the original function with our own\n\n\tplayer_manager.SetPlayerClass( pl, \"player_sandbox\" )\t--Adding our extended functionality\n\n\tBaseClass.PlayerSpawn( self, pl, transiton )\t-- Calling the original GM:PlayerSpawn so still get original functionality\n\nend","output":"Original Spawning Mechanics with the addition that players now spawn with `player_sandbox` class"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"DeleteAddonPreset","parent":"Global","type":"libraryfunc","description":"Deletes the given Preset.","realm":"Menu","file":{"text":"lua/menu/mainmenu.lua","line":"611-L620"},"args":{"arg":{"text":"The name of the Preset to delete.","name":"name","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"DeriveGamemode","parent":"Global","type":"libraryfunc","description":"Loads and registers the specified gamemode, setting the GM table's DerivedFrom field to the value provided, if the table exists. The DerivedFrom field is used post-gamemode-load as the \"derived\" parameter for gamemode.Register. See  Gamemode_Creation#derivinggamemodes for more information about deriving gamemodes.","realm":"Shared","args":{"arg":{"text":"Gamemode name to derive from.","name":"base","type":"string"}}},"example":{"name":"Example","description":"Retrieves data from sandbox.","code":"DeriveGamemode(\"sandbox\")"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Derma_Anim","parent":"Global","type":"libraryfunc","description":"Creates a new derma animation.","realm":"Client and Menu","file":{"text":"lua/derma/derma_animation.lua","line":"59-L70"},"args":{"arg":[{"text":"Name of the animation to create","name":"name","type":"string"},{"text":"Panel to run the animation on","name":"panel","type":"Panel"},{"text":"Function to call to process the animation","name":"func","type":"function","callback":{"arg":[{"text":"the panel passed to Derma_Anim","type":"Panel","name":"pnl"},{"text":"the anim table","type":"table","name":"anim"},{"text":"the fraction of the progress through the animation","type":"number","name":"delta"},{"text":"optional data passed to the run metatable method","type":"any","name":"data"}]}}]},"rets":{"ret":{"text":"A lua metatable containing four methods:\n* Run() - Should be called each frame you want the animation to be ran.\n* Active() - Returns if the animation is currently active (has not finished and stop has not been called)\n* Stop() - Halts the animation at its current progress.\n* Start( Length, Data ) - Prepares the animation to be ran for Length seconds. Must be called once before calling Run(). The data parameter will be passed to the func function.","name":"","type":"table"}}},"example":{"description":"Applies an [easeInQuad](http://easings.net/#easeInQuad) easing to the panel to make it glide naturally across the screen.","code":"local function inQuad(fraction, beginning, change)\n\treturn change * (fraction ^ 2) + beginning\nend\n\nlocal main = vgui.Create(\"DFrame\")\nmain:SetTitle(\"Derma_Anim Example\")\nmain:SetSize(250, 200)\nmain:SetPos(200)\nmain:MakePopup()\nlocal anim = Derma_Anim(\"EaseInQuad\", main, function(pnl, anim, delta, data)\n\tpnl:SetPos(inQuad(delta, 200, 600), 300) -- Change the X coordinate from 200 to 200+600\nend)\nanim:Start(2) -- Animate for two seconds\nmain.Think = function(self)\n\tif anim:Active() then\n\t\tanim:Run()\n\tend\nend","output":"Panel naturally glides across the screen from 200 x to 800 x"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Derma_DrawBackgroundBlur","parent":"Global","type":"libraryfunc","description":{"text":"Draws background blur around the given panel.","note":"Calling this on the same Panel multiple times makes the blur darker."},"realm":"Client and Menu","file":{"text":"lua/derma/derma_utils.lua","line":"7-L37"},"args":{"arg":[{"text":"Panel to draw the background blur around","name":"panel","type":"Panel"},{"text":"Time that the blur began being painted","name":"startTime","type":"number"}]}},"example":{"description":"Blur being drawn around a panel","code":"function PANEL:Init()\n\tself.startTime = SysTime()\nend\n\nfunction PANEL:Paint()\n\tDerma_DrawBackgroundBlur(self, self.startTime)\nend","output":"Background blur is drawn around the panel"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Derma_Hook","parent":"Global","type":"libraryfunc","description":"Creates panel method that calls the supplied Derma skin hook via derma.SkinHook","realm":"Client and Menu","file":{"text":"lua/derma/init.lua","line":"54-L60"},"args":{"arg":[{"text":"Panel to add the hook to","name":"panel","type":"Panel"},{"text":"Name of panel function to create","name":"functionName","type":"string"},{"text":"Name of Derma skin hook to call within the function","name":"hookName","type":"string"},{"text":"Type of element to call Derma skin hook for","name":"typeName","type":"string"}]}},"example":{"description":"Creates PANEL.Paint function to call Derma skin hook 'Paint' with type 'Panel'","code":"Derma_Hook( PANEL, \"Paint\", \"Paint\", \"Panel\" )","output":"The provided panels paint function becomes the skins `SKIN:PaintPanel` function"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Derma_Install_Convar_Functions","parent":"Global","type":"libraryfunc","description":"Makes the panel (usually an input of sorts) respond to changes in console variables by adding next functions to the panel:\n* Panel:SetConVar\n* Panel:ConVarChanged\n* Panel:ConVarStringThink\n* Panel:ConVarNumberThink\n\nThe console variable value is saved in the `m_strConVar` property of the panel.\n\nThe panel should call\nPanel:ConVarStringThink or \nPanel:ConVarNumberThink \nin its PANEL:Think hook and should call Panel:ConVarChanged when the panel's value has changed.","realm":"Client and Menu","file":{"text":"lua/derma/init.lua","line":"80-L121"},"args":{"arg":{"text":"The panel the functions should be added to.","name":"target","type":"Panel"}}},"example":{"description":"Adds the functions to a panel (snippet of vgui/dcheckbox.lua)","code":"local PANEL = {}\n\nDerma_Install_Convar_Functions( PANEL )\n\nfunction PANEL:Init()\n\t-- Init function here\nend\nfunction PANEL:Think()\n\tself:ConVarStringThink()\nend","output":"The `PANEL` table now contains the functions `SetConVar`, `ConVarChanged`, `ConVarStringThink` and `ConVarNumberThink` (and an `Init` function and a `Think` function)"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Derma_Message","parent":"Global","type":"libraryfunc","description":"Creates a derma window to display information","realm":"Client and Menu","file":{"text":"lua/derma/derma_utils.lua","line":"45-L93"},"args":{"arg":[{"text":"The text within the created panel.","name":"Text","type":"string"},{"text":"The title of the created panel.","name":"Title","type":"string"},{"text":"The text of the button to close the panel.","name":"Button","type":"string"}]},"rets":{"ret":{"text":"The created DFrame","name":"","type":"Panel"}}},"example":{"description":"Creates a popup informing the player that they are dead.","code":"Derma_Message(\"You are currently dead\", \"Death Notice\", \"OK\")","output":{"image":{"src":"Derma_Message.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Derma_Query","parent":"Global","type":"libraryfunc","description":"Shows a message box in the middle of the screen, with up to 4 buttons they can press.","realm":"Client and Menu","file":{"text":"lua/derma/derma_utils.lua","line":"105-L180"},"args":{"arg":[{"text":"The message to display.","name":"text","type":"string","default":"Message Text (Second Parameter)"},{"text":"The title to give the message box.","name":"title","type":"string","default":"Message Title (First Parameter)"},{"text":"The text to display on the first button.","name":"btn1text","type":"string"},{"text":"The function to run if the user clicks the first button.","name":"btn1func","type":"function","default":"nil"},{"text":"The text to display on the second button.","name":"btn2text","type":"string","default":"nil"},{"text":"The function to run if the user clicks the second button.","name":"btn2func","type":"function","default":"nil"},{"text":"The text to display on the third button","name":"btn3text","type":"string","default":"nil"},{"text":"The function to run if the user clicks the third button.","name":"btn3func","type":"function","default":"nil"},{"text":"The text to display on the fourth button","name":"btn4text","type":"string","default":"nil"},{"text":"The function to run if the user clicks the fourth button.","name":"btn4func","type":"function","default":"nil"}]},"rets":{"ret":{"text":"The Panel object of the created window.","name":"","type":"Panel"}}},"example":{"description":"Creates a popup box with buttons that print messages to the console when clicked.","code":"Derma_Query(\n    \"Are you sure about that?\",\n    \"Confirmation:\",\n    \"Yes\",\n    function() print(\"They clicked the yes button.\") end,\n\t\"No\",\n\tfunction() print(\"They clicked the no button.\") end\n)"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Derma_StringRequest","parent":"Global","type":"libraryfunc","description":"Creates a derma window asking players to input a string.","realm":"Client and Menu","file":{"text":"lua/derma/derma_utils.lua","line":"195-L264"},"args":{"arg":[{"text":"The title of the created panel.","name":"title","type":"string"},{"text":"The text above the input box.","name":"subtitle","type":"string"},{"text":"The default text for the input box.","name":"default","type":"string"},{"text":"The function to be called once the user has confirmed their input.","name":"confirm","type":"function","callback":{"arg":{"text":"The text the player entered.","name":"text","type":"string"}}},{"text":"The function to be called once the user has cancelled their input.","name":"cancel","type":"function","default":"nil","callback":{"arg":{"text":"The text the player entered.","name":"text","type":"string"}}},{"text":"Allows you to override text of the \"OK\" button","name":"confirmText","type":"string","default":"OK"},{"text":"Allows you to override text of the \"Cancel\" button","name":"cancelText","type":"string","default":"Cancel"}]},"rets":{"ret":{"text":"The created DFrame","name":"","type":"Panel"}}},"example":{"description":"Asks the user to input a string which is then printed to their console","code":"Derma_StringRequest(\n\t\"Console Print\", \n\t\"Input the string to print to console\",\n\t\"\",\n\tfunction(text) print(text) end,\n\tfunction(text) print(\"Cancelled input\") end\n)","output":{"image":{"src":"Derma_StringRequest.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DermaMenu","parent":"Global","type":"libraryfunc","description":"Creates a DMenu and closes any current menus.","realm":"Client and Menu","file":{"text":"lua/derma/derma_menus.lua","line":"10-L18"},"args":{"arg":[{"text":"If we should keep other DMenus open (`true`) or not (`false`).","name":"keepOpen","type":"boolean","default":"false"},{"text":"The panel to parent the created menu to.","name":"parent","type":"Panel","default":"nil"}]},"rets":{"ret":{"text":"The created DMenu.","name":"menu","type":"Panel"}}},"example":{"description":"Creates a DMenu with buttons to commit suicide or close it.","code":"local menu = DermaMenu() \nmenu:AddOption( \"Die\", function() RunConsoleCommand( \"kill\" ) end )\nmenu:AddOption( \"Close\", function() print( \"Close pressed\" ) end ) -- The menu will remove itself, we don't have to do anything.\nmenu:Open()","output":{"image":{"src":"DermaMenu.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DisableClipping","parent":"Global","type":"libraryfunc","description":"Sets whether rendering should be limited to being inside a panel or not. Needs to be used inside one of the 2d rendering hooks\n\nSee also Panel:NoClipping.","realm":"Client and Menu","args":{"arg":{"text":"Whether or not clipping should be disabled","name":"disable","type":"boolean"}},"rets":{"ret":{"text":"Whether the clipping was enabled or not before this function call","name":"oldState","type":"boolean","added":"2020.03.17"}}},"example":{"description":"Renders a white box outside of the panel","code":"function PANEL:Paint()\n\tlocal old = DisableClipping( true )\n\tdraw.RoundedBox( 0, -50, -50, 25, 25, color_white )\n\tDisableClipping( old )\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DOF_Kill","parent":"Global","type":"libraryfunc","description":"Cancels current DOF post-process effect started with Global.DOF_Start","realm":"Client","file":{"text":"lua/postprocess/dof.lua","line":"14-L30"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"DOF_Start","parent":"Global","type":"libraryfunc","description":"Cancels any existing DOF post-process effects.\nBegins the DOF post-process effect.","realm":"Client","file":{"text":"lua/postprocess/dof.lua","line":"32-L46"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"DOFModeHack","parent":"Global","type":"libraryfunc","description":{"text":"A hacky method used to fix some bugs regarding DoF. What this basically does it force all `C_BaseAnimating` entities to have the translucent rendergroup, even if they use opaque or two-pass models.\n\nThis is specifically to do with GM:NeedsDepthPass","internal":""},"realm":"Client","args":{"arg":{"text":"Enables or disables depth-of-field mode","name":"enable","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"DoStopServers","parent":"Global","type":"libraryfunc","description":"Stops searching for new servers in the given category","realm":"Menu","file":{"text":"lua/menu/mainmenu.lua","line":"447-L451"},"args":{"arg":{"text":"The category to stop searching in. **Working Values: internet, favorite, history, lan**","name":"category","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"DrawBackground","parent":"Global","type":"libraryfunc","description":{"text":"Draws the currently active main menu background image and handles transitioning between background images.\n\nThis is called by default in the menu panel's Paint hook.","internal":""},"realm":"Menu","file":{"text":"lua/menu/background.lua","line":"73-L93"}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"DrawBloom","parent":"Global","type":"libraryfunc","description":"Draws the bloom shader, which creates a glowing effect from bright objects.","realm":"Client","file":{"text":"lua/postprocess/bloom.lua","line":"25-L56"},"args":{"arg":[{"text":"Determines how much to darken the effect. A lower number will make the glow come from lower light levels. A value of `1` will make the bloom effect unnoticeable. Negative values will make even pitch black areas glow.","name":"Darken","type":"number"},{"text":"Will affect how bright the glowing spots are. A value of `0` will make the bloom effect unnoticeable.","name":"Multiply","type":"number"},{"text":"The size of the bloom effect along the horizontal axis.","name":"SizeX","type":"number"},{"text":"The size of the bloom effect along the vertical axis.","name":"SizeY","type":"number"},{"text":"Determines how much to exaggerate the effect.","name":"Passes","type":"number"},{"text":"Will multiply the colors of the glowing spots, making them more vivid.","name":"ColorMultiply","type":"number"},{"text":"How much red to multiply with the glowing color. Should be between `0` and `1`.","name":"Red","type":"number"},{"text":"How much green to multiply with the glowing color. Should be between `0` and `1`.","name":"Green","type":"number"},{"text":"How much blue to multiply with the glowing color. Should be between `0` and `1`.","name":"Blue","type":"number"}]}},"example":{"description":"Draws bloom effect with default settings.","code":"hook.Add( \"RenderScreenspaceEffects\", \"BloomEffect\", function()\n\n\tDrawBloom( 0.65, 2, 9, 9, 1, 1, 1, 1, 1 )\n\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawBokehDOF","parent":"Global","type":"libraryfunc","description":"Draws the Bokeh Depth Of Field effect .","realm":"Client","added":"2021.06.09","args":{"arg":[{"text":"Intensity of the effect.","name":"intensity","type":"number"},{"text":"**Not worldspace distance**. Value range is from `0` to `1`.","name":"distance","type":"number"},{"text":"Focus. Recommended values are from 0 to 12.","name":"focus","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawColorModify","parent":"Global","type":"libraryfunc","description":"Draws the Color Modify shader, which can be used to adjust colors on screen.","realm":"Client","file":{"text":"lua/postprocess/color_modify.lua","line":"20-L33"},"args":{"arg":{"text":"Color modification parameters. See Shaders/g_colourmodify and the example below. Note that if you leave out a field, it will retain its last value which may have changed if another caller uses this function.","name":"modifyParameters","type":"table"}}},"example":{"description":"Draws color modify with bright yellow and green colors.","code":"local tab = {\n\t[ \"$pp_colour_addr\" ] = 0.02,\n\t[ \"$pp_colour_addg\" ] = 0.02,\n\t[ \"$pp_colour_addb\" ] = 0,\n\t[ \"$pp_colour_brightness\" ] = 0,\n\t[ \"$pp_colour_contrast\" ] = 1,\n\t[ \"$pp_colour_colour\" ] = 3,\n\t[ \"$pp_colour_mulr\" ] = 0,\n\t[ \"$pp_colour_mulg\" ] = 0.02,\n\t[ \"$pp_colour_mulb\" ] = 0\n}\n\nhook.Add( \"RenderScreenspaceEffects\", \"color_modify_example\", function()\n\n\tDrawColorModify( tab )\n\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawMaterialOverlay","parent":"Global","type":"libraryfunc","description":"Draws a material overlay on the screen.","realm":"Client","file":{"text":"lua/postprocess/overlay.lua","line":"11-L31"},"args":{"arg":[{"text":"This will be the material that is drawn onto the screen.","name":"Material","type":"string"},{"text":"This will adjust how much the material will refract your screen.","name":"RefractAmount","type":"number"}]}},"example":{"description":"Creates a fisheye effect on your screen.","code":"hook.Add( \"RenderScreenspaceEffects\", \"FishEyeEffect\", function()\n\n\tDrawMaterialOverlay( \"models/props_c17/fisheyelens\", -0.06 )\n\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawMotionBlur","parent":"Global","type":"libraryfunc","description":"Creates a motion blur effect by drawing your screen multiple times.","realm":"Client","file":{"text":"lua/postprocess/motion_blur.lua","line":"17-L57"},"args":{"arg":[{"text":"How much alpha to change per frame.","name":"AddAlpha","type":"number"},{"text":"How much alpha the frames will have. A value of 0 will not render the motion blur effect.","name":"DrawAlpha","type":"number"},{"text":"Determines the amount of time between frames to capture.","name":"Delay","type":"number"}]}},"example":{"description":"Creates a motion blur effect.","code":"hook.Add( \"RenderScreenspaceEffects\", \"MotionBlurEffect\", function()\n\n\tDrawMotionBlur( 0.4, 0.8, 0.01 )\n\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawSharpen","parent":"Global","type":"libraryfunc","description":"Draws the sharpen shader, which creates more contrast.","realm":"Client","file":{"text":"lua/postprocess/sharpen.lua","line":"12-L22"},"args":{"arg":[{"text":"How much contrast to create.","name":"Contrast","type":"number"},{"text":"How large the contrast effect will be.","name":"Distance","type":"number"}]}},"example":{"description":"Draws the sharpen shader.","code":"hook.Add( \"RenderScreenspaceEffects\", \"SharpenShader\", function()\n\n\tDrawSharpen( 1.2, 1.2 )\n\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawSobel","parent":"Global","type":"libraryfunc","description":"Draws the sobel shader, which detects edges and draws a black border.","realm":"Client","file":{"text":"lua/postprocess/sobel.lua","line":"8-L18"},"args":{"arg":{"text":"Determines the threshold of edges. A value of `0` will make your screen completely black.","name":"Threshold","type":"number"}}},"example":{"description":"Draws the sobel shader.","code":"hook.Add( \"RenderScreenspaceEffects\", \"SobelShader\", function()\n\n\tDrawSobel( 0.5 )\n\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawSunbeams","parent":"Global","type":"libraryfunc","description":"Renders the post-processing effect of beams of light originating from the map's sun. Utilises the `pp/sunbeams` material.","realm":"Client","file":{"text":"lua/postprocess/sunbeams.lua","line":"14-L29"},"args":{"arg":[{"text":"`$darken` property for sunbeams material.","name":"darken","type":"number"},{"text":"`$multiply` property for sunbeams material.","name":"multiplier","type":"number"},{"text":"`$sunsize` property for sunbeams material.","name":"sunSize","type":"number"},{"text":"`$sunx` property for sunbeams material.","name":"sunX","type":"number"},{"text":"`$suny` property for sunbeams material.","name":"sunY","type":"number"}]}},"example":[{"code":"DrawSunbeams( 0.3, 0.12, 1, 1.2, 1.2 )"},{"description":"Smaller sunbeams (more realistic)","code":"DrawSunbeams( 0.1, 0.013, 0.14, 0.2, 0.6 )"}],"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawTexturize","parent":"Global","type":"libraryfunc","description":"Draws the texturize shader, which replaces each pixel on your screen with a different part of the texture depending on its brightness. See g_texturize for information on making the texture.","realm":"Client","file":{"text":"lua/postprocess/texturize.lua","line":"8-L19"},"args":{"arg":[{"text":"Scale of the texture. A smaller number creates a larger texture.","name":"Scale","type":"number"},{"text":"This will be the texture to use in the effect. Make sure you use Global.Material to get the texture number.","name":"BaseTexture","type":"number"}]}},"example":{"description":"Draws the texturize shader with a pattern texture.","code":"local pattern = Material(\"pp/texturize/pattern1.png\")\n\nhook.Add( \"RenderScreenspaceEffects\", \"TexturizeShader\", function()\n\n\tDrawTexturize( 1, pattern )\n\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawToyTown","parent":"Global","type":"libraryfunc","description":"Draws the toy town shader, which blurs the top and bottom of your screen. This can make very large objects look like toys, hence the name.","realm":"Client","file":{"text":"lua/postprocess/toytown.lua","line":"12-L28"},"args":{"arg":[{"text":"An integer determining how many times to draw the effect. A higher number creates more blur.","name":"Passes","type":"number"},{"text":"The amount of screen which should be blurred on the top and bottom.","name":"Height","type":"number"}]}},"example":{"description":"Draws toy town effect.","code":"hook.Add( \"RenderScreenspaceEffects\", \"ToytownEffect\", function()\n\n\tDrawToyTown(2, ScrH() / 2)\n\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DropEntityIfHeld","parent":"Global","type":"libraryfunc","description":{"text":"Drops the specified entity if it is being held by any player with Gravity Gun, Physics Gun or `+use` pickup.\n\nSee also Player:DropObject and Entity:ForcePlayerDrop.","deprecated":"You really should be using Entity:ForcePlayerDrop, which does the same thing."},"realm":"Server","args":{"arg":{"text":"The entity to drop.","name":"ent","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"DTVar_ReceiveProxyGL","parent":"Global","type":"libraryfunc","description":"Calls all NetworkVarNotify functions of the given entity with the given new value, but doesn't change the real value.  \ninternally uses Entity:CallDTVarProxies","realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"211-L215"},"args":{"arg":[{"text":"The Entity to run the NetworkVarNotify functions from.","name":"entity","type":"Entity"},{"text":"The NetworkVar Type.\n* `String`\n* `Bool`\n* `Float`\n* `Int` (32-bit signed integer)\n* `Vector`\n* `Angle`\n* `Entity`","name":"Type","type":"string"},{"text":"The NetworkVar index.","name":"index","type":"number"},{"text":"The new value.","name":"new value","type":"any"}]}},"example":{"description":"Calls the NetworkVarNotify function with the given new value but doesn't changes the real value.","code":"Entity(1):NetworkVar(\"String\", 0, \"Example\")\nEntity(1):SetExample(\"hello\")\nEntity(1):NetworkVarNotify(\"Example\", function(ent, var, old, new) print(ent, var, old, new) end)\nDTVar_ReceiveProxyGL(Entity(1), \"String\", 0, \"world\")\nprint(\"Value:\" .. Entity(1):GetExample())","output":"Player [1][Raphael]\tExample\thello\tworld  \nValue: hello"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DynamicLight","parent":"Global","type":"libraryfunc","description":{"text":"Creates or replaces a dynamic light with the given id.","note":"Only 32 dlights and 64 elights can be active at once.","warning":"It is not safe to hold a reference to this object after creation since its data can be replaced by another dlight at any time.","bug":{"text":"Dynamic lights affect the world (brushwork, static props) and entities (dynamic props, etc.) differently.","issue":"4649"}},"realm":"Client","args":{"arg":[{"text":"An unsigned Integer. Usually an entity index is used here.","name":"index","type":"number"},{"text":"Allocates an elight instead of a dlight. Elights have a higher light limit and do not light the world (making the \"noworld\" parameter have no effect).","name":"elight","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"A DynamicLight structured table. See Structures/DynamicLight","name":"","type":"table"}}},"example":{"description":"Emits a bright white light from local players eyes.","code":"hook.Add( \"Think\", \"Think_Lights!\", function()\n\tlocal dlight = DynamicLight( LocalPlayer():EntIndex() )\n\tif ( dlight ) then\n\t\tdlight.pos = LocalPlayer():GetShootPos()\n\t\tdlight.r = 255\n\t\tdlight.g = 255\n\t\tdlight.b = 255\n\t\tdlight.brightness = 2\n\t\tdlight.decay = 1000\n\t\tdlight.size = 256\n\t\tdlight.dietime = CurTime() + 1\n\tend\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DynamicMaterial","parent":"Global","type":"libraryfunc","description":{"text":"Creates a dynamic Material from the given materialPath","warning":"This function should never be used in a Rendering Hook because it creates a new dynamic material every time and can fill up your vram."},"realm":"Menu","args":{"arg":[{"text":"The material with path. The path is relative to the `materials/` folder.","name":"materialPath","type":"string"},{"text":"Flags, same as Global.Material.","name":"flags","type":"string","default":"nil"}]},"rets":{"ret":{"text":"Generated material.","name":"","type":"IMaterial"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"EffectData","parent":"Global","type":"libraryfunc","description":{"text":"Returns a CEffectData object to be used with util.Effect.","bug":{"text":"This does not create a unique object, but instead returns a shared reference. That means you cannot use two or more of these objects at once.\n\nAs a result any values previously set (Origin, Magnitude, Scale etc) will carry over to all future calls of this function, and may unexpectedly affect effects created via util.Effect.","issue":"2771"}},"realm":"Shared","rets":{"ret":{"text":"The CEffectData object.","name":"","type":"CEffectData"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Either","parent":"Global","type":"libraryfunc","description":"An [eagerly evaluated](https://en.wikipedia.org/wiki/Eager_evaluation) [ternary operator](https://en.wikipedia.org/wiki/%3F:), or, in layman's terms, a compact \"if then else\" statement.\n\nIn most cases, you should just use Lua's [\"pseudo\" ternary operator](https://en.wikipedia.org/wiki/%3F:#Lua), like this:\n\n```\nlocal myCondition = true\nlocal consequent = \"myCondition is true\"\nlocal alternative = \"myCondition is false\"\n\nprint(myCondition and consequent or alternative)\n```\n\nIn the above example, due to [short-circuit evaluation](https://en.wikipedia.org/wiki/Short-circuit_evaluation), `consequent` would be \"skipped\" and ignored (not evaluated) by Lua due to `myCondition` being `true`, and only `alternative` would be evaluated. However, when using `Either`, both `consequent` and `alternative` would be evaluated. A practical example of this can be found at the bottom of the page.\n\n# Falsey values\n\nIf `consequent` is \"falsey\" (Lua considers both `false` and `nil` as false), this will not work. For example:\n\n```\nlocal X = true\nlocal Y = false\nlocal Z = \"myCondition is false\"\n\nprint(X and Y or Z)\n```\n\nThis will actually print the value of `Z`.\n\nIn the above case, and other very rare cases, you may find `Either` useful.","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"436-L439"},"args":{"arg":[{"text":"The condition to check if true or false.","name":"condition","type":"any"},{"text":"If the condition isn't nil/false, returns this value.","name":"truevar","type":"any"},{"text":"If the condition is nil/false, returns this value.","name":"falsevar","type":"any"}]},"rets":{"ret":{"text":"The result.","name":"","type":"any"}}},"example":[{"description":"The following two `print` statements have identical results.","code":"local ply = Entity( 1 )\nprint( \"Player \" .. Either( ply:IsAdmin(), \"is\", \"is not\" ) .. \" an admin\" )\n\nprint( \"Player \" .. ( ply:IsAdmin() and \"is\" or \"is not\" ) .. \" an admin\" )","output":"If Player 1 is admin, it will print \"Player is an admin\"."},{"description":"A practical example of the behavior of this function in comparison to Lua's [\"pseudo\" ternary operator](https://en.wikipedia.org/wiki/%3F:#Lua), demonstrating [short-circuit evaluation](https://en.wikipedia.org/wiki/Short-circuit_evaluation), and the lack of it when using `Either`.","code":"local function printHello()\n\tprint( \"Hello, world!\" )\n\treturn \"printHello called\"\nend\n\nlocal myCondition = true\nprint( myCondition and \"printHello not called\" or printHello() )\nprint( Either( myCondition, \"myCondition is true, but printHello was still called\", printHello() ) )","output":"```\nprintHello not called\nHello, world!\nmyCondition is true, but printHello was still called\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"EmitSentence","parent":"Global","type":"libraryfunc","description":"Plays a sentence from `scripts/sentences.txt`","realm":"Shared","args":{"arg":[{"text":"The sound to play","name":"soundName","type":"string"},{"text":"The position to play at","name":"position","type":"Vector"},{"text":"The entity to emit the sound from. Must be Entity:EntIndex","name":"entity","type":"number"},{"text":"The sound channel, see Enums/CHAN.","name":"channel","type":"number","default":"CHAN_AUTO"},{"text":"The volume of the sound, from 0 to 1","name":"volume","type":"number","default":"1"},{"text":"The sound level of the sound, see Enums/SNDLVL","name":"soundLevel","type":"number","default":"75"},{"text":"The flags of the sound, see Enums/SND","name":"soundFlags","type":"number","default":"0"},{"text":"The pitch of the sound, 0-255","name":"pitch","type":"number","default":"100"},{"text":"Digital Sound Processor for this sound. DSP Presets","name":"DSP","type":"number","default":"0"}]}},"example":{"description":"Plays random combine death sound on first player.","code":"EmitSentence( \"COMBINE_DIE\" .. math.random( 0, 2 ), Entity( 1 ):GetPos(), 1, CHAN_AUTO, 1, 75, 0, 100 )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EmitSound","parent":"Global","type":"libraryfunc","description":{"text":"Emits the specified sound at the specified position. See also Entity:EmitSound if you wish to play sounds on a specific entity.","note":"Valid 16 bit sample rates: **11025 Hz, 22050 Hz and 44100 Hz**, otherwise you may see this kind of message:\n\n`Unsupported 32-bit wave file your_sound.wav` and \n`Invalid sample rate (48000) for sound 'your_sound.wav'`"},"realm":"Shared","args":{"arg":[{"text":"The sound to play\n\nThis should either be a sound script name (sound.Add) or a file path relative to the `sound/` folder. (Make note that it's not sound**s**)","name":"soundName","type":"string"},{"text":"The position where the sound is meant to play, which is also used for a network filter (`CPASAttenuationFilter`) to decide which players will hear the sound.","name":"position","type":"Vector"},{"text":"The entity to emit the sound from. Can be an Entity:EntIndex or one of the following:\n* `0` - Plays sound on the world\n* `-1` - Plays sound on the local player (on server acts as `0`)\n* `-2` - Plays UI sound (position set to `0,0,0`, no spatial sound, on server acts as `0`)","name":"entity","type":"number","default":"0"},{"text":"The sound channel, see Enums/CHAN.","name":"channel","type":"number{CHAN}","default":"CHAN_AUTO"},{"text":"The volume of the sound, from 0 to 1","name":"volume","type":"number","default":"1"},{"text":"The sound level of the sound, see Enums/SNDLVL","name":"soundLevel","type":"number{SNDLVL}","default":"75"},{"text":"The flags of the sound, see Enums/SND","name":"soundFlags","type":"number{SND}","default":"0"},{"text":"The pitch of the sound, 0-255","name":"pitch","type":"number","default":"100"},{"text":"The DSP preset for this sound. DSP Presets","name":"dsp","type":"number","default":"1"},{"text":"If set serverside, the sound will only be networked to the clients in the filter.","name":"filter","type":"CRecipientFilter","default":"nil","added":"2023.10.25"}]}},"example":{"description":"Plays magical sound on first player.","code":"-- Plays the sound attached to the given entity (by its entity index)\nEmitSound( \"garrysmod/save_load1.wav\", Entity(1):GetPos(), 1, CHAN_AUTO, 1, 75, 0, 100 )\n\n-- Plays the sound in any custom position\nEmitSound( \"Weapon_AR2.Single\", Entity(1):GetPos() )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EndTooltip","parent":"Global","type":"libraryfunc","description":"Removes the currently active tool tip from the screen.","realm":"Client and Menu","file":{"text":"lua/includes/util/tooltips.lua","line":"66-L80"},"args":{"arg":{"text":"This is the panel that has a tool tip.","name":"panel","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Entity","parent":"Global","type":"libraryfunc","description":{"text":"Returns the entity with the matching Entity:EntIndex.\n\nIndices `1` through game.MaxPlayers() are always reserved for players.","note":"In examples on this wiki, `Entity( 1 )` is used when a player entity is needed (see ). In singleplayer and listen servers, `Entity( 1 )` will always be the first player. In dedicated servers, however, `Entity( 1 )` won't always be a valid player if there is no one currently on the server."},"realm":"Shared","args":{"arg":{"text":"The entity index.","name":"entityIndex","type":"number"}},"rets":{"ret":{"text":"The entity if it exists, or `NULL` if it doesn't.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"ambig":{"text":"You might be looking for the \"Error\" function, which has the same name as this function.","page":"Global.Error"},"function":{"name":"error","parent":"Global","type":"libraryfunc","description":"Throws a Lua error and breaks out of the current call stack.","realm":"Shared and Menu","args":{"arg":[{"text":"The error message to throw.","name":"message","type":"string"},{"text":"The level to throw the error at.","name":"errorLevel","type":"number","default":"1"}]}},"example":[{"description":"Throwing an custom error that doesn't normally happen.","code":"error(\"Because I wanted!\")","output":"```\n[my_addon] addons/my_addon/lua/autorun/my_code.lua:1: Because I wanted!\n  1. error - [C]:-1\n   2. unknown - addons/my_addon/lua/autorun/my_code.lua:1\n```"},{"description":"Shows what a different level errors look like.","code":"timer.Simple( 0, function() -- A timer so that both errors are displayed. This is for demonstration purposes only.\n\terror( \"I'M VERY IMPORTANT!!!\" ) -- Normal error (level 1)\nend )\nerror( \"It isn't important\", 0 ) -- Notice the missing file path","output":"```\n[my_addon] It isn't important\n  1. error - [C]:-1\n   2. unknown - addons/my_addon/lua/autorun/my_code.lua:1\n\n[my_addon] addons/my_addon/lua/autorun/my_code.lua:1: I'M VERY IMPORTANT!!!\n  1. error - [C]:-1\n   2. unknown - addons/my_addon/lua/autorun/my_code.lua:1\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ErrorNoHalt","parent":"Global","type":"libraryfunc","description":"Throws a Lua error but does not break out of the current call stack.\nThis function will not print a stack trace like a normal error would.\nEssentially similar if not equivalent to Global.Msg.","realm":"Shared and Menu","args":{"arg":{"text":"Converts all arguments to strings and prints them with no spacing.","name":"arguments","type":"vararg"}}},"example":{"description":"An example of the use of this function","code":"local num = 11\nif ( num <= 10 and num >= 0 ) then\n\tprint( \"The number is\", num )\nelse\n\tErrorNoHalt( \"Number out of range!\\n\" )\n\tprint(\"This line will be printed\")\nend","output":"```\nNumber out of range!\nThis line will be printed\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ErrorNoHaltWithStack","parent":"Global","type":"libraryfunc","description":"Throws a Lua error but does not break out of the current call stack.\n\nThis function will print a stack trace like a normal error would.","realm":"Shared and Menu","added":"2021.01.27","args":{"arg":{"text":"Converts all arguments to strings and prints them with no spacing.","name":"arguments","type":"vararg"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"EyeAngles","parent":"Global","type":"libraryfunc","description":{"text":"Returns the angles of the current render context as calculated by GM:CalcView.","bug":{"text":"This function is only reliable inside rendering hooks.","issue":"2516"}},"realm":"Client","rets":{"ret":{"text":"The angle of the currently rendered scene.","name":"","type":"Angle"}}},"example":{"description":"Identical to Global.EyeVector.","code":"print( EyeAngles():Forward() )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"EyePos","parent":"Global","type":"libraryfunc","description":{"text":"Returns the origin of the current render context as calculated by GM:CalcView.","bug":{"text":"This function is only reliable inside rendering hooks.","issue":"2516"}},"realm":"Client","rets":{"ret":{"text":"Camera position.","name":"","type":"Vector"}}},"example":{"description":"Ensuring `EyePos` returns the correct value outside of render hooks.","code":"local mins, maxs = Vector( -5, -5, -5 ), Vector( 5, 5, 5 )\n\nhook.Add( \"PreDrawTranslucentRenderables\", \"FixEyePos\", function()\n\tEyePos()\nend )\n\nhook.Add( \"Think\", \"Use Eyepos outside of render function\", function()\n\tlocal start = EyePos()\n\tlocal dir = gui.ScreenToVector( gui.MousePos() )\n\tlocal trace = util.TraceLine({\n\t\tstart = start,\n\t\tendpos = start + ( dir * 10000 ),\n\t\tfilter = { ply }\n\t})\n\n\tdebugoverlay.Box( trace.HitPos, mins, maxs )\nend )","output":"Draws a white box in the world where you point the mouse to. Requires the **developer** convar to be set to `1`."},"realms":["Client"],"type":"Function"},
{"function":{"name":"EyeVector","parent":"Global","type":"libraryfunc","description":{"text":"Returns the normal vector of the current render context as calculated by GM:CalcView, similar to Global.EyeAngles.","bug":{"text":"This function is only reliable inside rendering hooks.","issue":"2516"}},"realm":"Client","rets":{"ret":{"text":"View direction of the currently rendered scene.","name":"","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"FindMetaTable","parent":"Global","type":"libraryfunc","description":"Returns the meta table for the class with the matching name.\n\nYou can learn more about meta tables on the Meta Tables page.\n\nYou can find a list of meta tables that can be retrieved with this function on Enums/TYPE. The name in the description is the string to use with this function.\n\nCustom meta tables should be registered via Global.RegisterMetaTable.","realm":"Shared and Menu","args":{"arg":{"text":"The object type to retrieve the meta table of.","name":"metaName","type":"string"}},"rets":{"ret":{"text":"The corresponding meta table or `nil` if it doesn't exist.","name":"","type":"table|nil"}}},"example":{"description":"Adds a very simple function for checking if a player is sick to the player metatable.","code":"local meta = FindMetaTable(\"Player\")\n\nfunction meta:IsSick()\n\treturn true\nend\n\n-- Sometime later...\nlocal ply = Entity(1)\nif ( ply:IsSick() ) then\n\tply:ChatPrint( \"Get well soon, \" .. ply:Nick() .. \"!\" )\n\tply:ChatPrint( \"I just don't understand how you're always sick...\" )\nend","output":"```\nGet well soon, Player1!\nI just don't understand how you're always sick...\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"FindTooltip","parent":"Global","type":"libraryfunc","description":"Returns the tool-tip text and tool-tip-panel (if any) of the given panel as well as itself","realm":"Client and Menu","file":{"text":"lua/includes/util/tooltips.lua","line":"20-L36"},"args":{"arg":{"text":"Panel to find tool-tip of","name":"panel","type":"Panel"}},"rets":{"ret":[{"text":"tool-tip text","name":"","type":"string"},{"text":"tool-tip panel","name":"","type":"Panel"},{"text":"panel that the function was called with","name":"","type":"Panel"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"FireAddonConflicts","parent":"Global","type":"libraryfunc","description":"Refreshes all Addon Conflicts and Fires a Problem. Internally uses Global.FireProblem","realm":"Menu","file":{"text":"lua/menu/problems/problems.lua","line":"321-L342"}},"realms":["Menu"],"type":"Function"},
{"text":"---","function":{"name":"FireProblem","parent":"Global","type":"libraryfunc","realm":"Menu","file":{"text":"lua/menu/problems/problems.lua","line":"100-L111"},"description":{"text":"Creates a problem from the given definition.","note":"Existing problems with the same Id will be replaced / overridden."},"args":{"arg":{"text":"The problem's definition.","name":"problem","type":"table{Problem}"}}},"example":[{"name":"Unfixable Problem","description":"Creating a problem that the user cannot fix.","code":"local problem = {\n    text = 'There is a problem!' ,\n    type = 'addons' ,\n    id = 'my-problem-1234'\n}\n\nFireProblem(problem)","output":{"image":{"src":"https://files.facepunch.com/wiki/files/b5608/8dc5c1882fa7c97.webp"}}},{"name":"Fixable Problem","description":"Creating a problem that can be fixed by the user.","code":"local function fixProblem ()\n    ClearProblem('my-problem-1234')\nend\n\nlocal problem = {\n    text = 'There is a problem!' ,\n    type = 'addons' ,\n    fix = fixProblem ,\n    id = 'my-problem-1234'\n}\n\nFireProblem(problem)","output":{"image":{"src":"https://files.facepunch.com/wiki/files/b5608/8dc5c18b01414c6.webp"}}}],"realms":["Menu"],"type":"Function"},
{"function":{"name":"FireProblemFromEngine","parent":"Global","type":"libraryfunc","description":{"text":"This function is called from the engine to notify the player about a problem in a more user friendly way compared to a console message.","internal":"Internally uses Global.FireProblem to create / fire the Problem."},"realm":"Menu","file":{"text":"lua/menu/problems/problems.lua","line":"188-L203"},"args":{"arg":[{"text":"The Problem ID.","name":"id","type":"string"},{"text":"The Problem severity.","name":"severity","type":"number"},{"text":"Additional Parameters.","name":"params","type":"string"}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"Format","parent":"Global","type":"libraryfunc","description":"Formats the specified values into the string given. Same as string.format.","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"29"},"args":{"arg":[{"text":"The string to be formatted.\nFollows this format: http://www.cplusplus.com/reference/cstdio/printf/","name":"format","type":"string"},{"text":"Values to be formatted into the string.","name":"formatParameters","type":"vararg"}]},"rets":{"ret":{"text":"The formatted string","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"FrameNumber","parent":"Global","type":"libraryfunc","description":"Returns the number of frames rendered since the game was launched.","realm":"Shared","rets":{"ret":{"text":"frame count","name":"","type":"number"}}},"example":{"description":"Prints the frame count to the console.","code":"print(FrameNumber())"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"FrameTime","parent":"Global","type":"libraryfunc","description":"Returns the Global.CurTime-based time in seconds it took to render the last frame.\n\nThis should be used for frame/tick based timing, such as movement prediction or animations.\n\nFor real-time-based frame time that isn't affected by `host_timescale`, use Global.RealFrameTime. RealFrameTime is more suited for things like GUIs or HUDs.","realm":"Shared and Menu","rets":{"ret":{"text":"time (in seconds)","name":"","type":"number"}}},"example":[{"description":"Print the frame time","code":"print( FrameTime() )","output":"0.014999999664724"},{"description":"Get the servers/clients tickrate/fps","code":"print( \"Tick: \" .. ( 1 / FrameTime() ) )","output":"Tick: 66.666668156783"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GameDetails","parent":"Global","type":"libraryfunc","description":"Callback function for when the client has joined a server. This function shows the server's loading URL by default.","realm":"Menu","file":{"text":"lua/menu/loading.lua","line":"249-L274"},"args":{"arg":[{"text":"Server's name.","name":"servername","type":"string"},{"text":"Server's loading screen URL, or \"\" if the URL is not set.","name":"serverurl","type":"string"},{"text":"Server's current map's name.","name":"mapname","type":"string"},{"text":"Max player count of server.","name":"maxplayers","type":"number"},{"text":"The local player's Player:SteamID64.","name":"steamid","type":"string"},{"text":"Server's current gamemode's folder name.","name":"gamemode","type":"string"}]}},"example":{"description":"Prints GameDetails of the server you join to console, and preserves default behavior.","code":"local OldGameDetails = GameDetails\nfunction GameDetails( servername, serverurl, mapname, maxplayers, steamid, gamemode )\n\tprint( 1, servername )\n\tprint( 2, serverurl )\n\tprint( 3, mapname )\n\tprint( 4, maxplayers )\n\tprint( 5, steamid )\n\tprint( 6, gamemode )\n\tOldGameDetails( servername, serverurl, mapname, maxplayers, steamid, gamemode )\nend","output":"```\n1\tZerfTestServer\n2\t\n3\tgm_construct\n4\t8\n5\t76561198052589582\n6\tsandbox\n```"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"gcinfo","parent":"Global","type":"libraryfunc","description":{"text":"Returns the current floored dynamic memory usage of Lua in kilobytes.","deprecated":"This function was deprecated in Lua 5.1 and is removed in Lua 5.2. Use Global.collectgarbage( \"count\" ) instead."},"realm":"Shared and Menu","rets":{"ret":{"text":"The current floored dynamic memory usage of Lua, in kilobytes.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetAddonStatus","parent":"Global","type":"libraryfunc","description":"Returns if the game was started with either -noaddons or -noworkshop","realm":"Menu","rets":{"ret":[{"text":"true if the game was started with -noaddons. (see Command_Line_Parameters)","name":"noaddons","type":"boolean"},{"text":"true if the game was started with -noworkshop. (see Command_Line_Parameters)","name":"noworkshop","type":"boolean"}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"GetAPIManifest","parent":"Global","type":"libraryfunc","description":{"text":"Gets miscellaneous information from Facepunches API.","internal":""},"realm":"Menu","args":{"arg":{"text":"Callback to be called when the API request is done.\n\n  \n\n\n\nFormatted output:  \n```js\n{\n\t\"ManifestVersion\": \tnumber - Version of the manifest\n\t\"Date\": \t\t\tstring - Date the data was retrieved\n\n\t// Contains all the blog posts, the things in the top right of the menu\n\t\"News\": {\n\t\t\"Blogs\": [\n\n\t\t\t// Structure of blog posts\n\t\t\t{ \n\t\t\t\t\"Date\": \t\tstring - Date the post was created\n\t\t\t\t\"ShortName\": \tstring - Short name of the post, identifier of it on the blog website\n\t\t\t\t\"Title\": \t\tstring - Title of the post\n\t\t\t\t\"HeaderImage\": \tstring - Main image of the post, showed in the top right\n\t\t\t\t\"SummaryHtml\": \tstring - Summary of the blogpost, text thats shown to the user\n\t\t\t\t\"Url\": \t\t\tstring - URL to the post on the blog\n\t\t\t\t\"Tags\": \t\tstring - String of the posts tag\n\t\t\t}\n\t\t]\n\t}\n\t\n\t// Array of Facepunches Mods, Admins and Developers\n\t\"Administrators\": [\n\t\t{\n\t\t\t\"UserId\": \t\tstring - SteamID64 of the person\n\t\t\t\"Level\": \t\tstring - Level of the user (Administrator, Developer or Moderator)\n\t\t}\n\t]\n\n\t// Unused and contains nothing useful\n\t\"Heroes\": {}\n\n\t\"SentryUrl\": \t\tstring - Nothing\n\t\"DatabaseUrl\" \t\tstring - URL to the Facepunch API (/database/{action}/)\n\t\"FeedbackUrl\" \t\tstring - URL to the Facepunch API (/feedback/add/)\n\t\"ReportUrl\" \t\tstring - URL to the Facepunch API (/feedback/report/)\n\t\"LeaderboardUrl\" \tstring - URL to the Facepunch API (/leaderboard/{action}/)\n\t\"BenchmarkUrl\" \t\tstring - URL to the Facepunch API (/benchmark/add/)\n\t\"AccountUrl\" \t\tstring - URL to the Facepunch API (/account/{action}/)\n\n\t\"Servers\": {\n\t\t\"Official\": [] // Nothing\n\t\t\n\t\t// List of blacklisted servers\n\t\t\"Banned\": [\n\t\t\tstring \t- IP of the blacklisted server\n\t\t]\n\t}\n}\n```","name":"callback","type":"function","callback":{"arg":{"text":"JSON encoded data, see util.JSONToTable.","type":"string","name":"data"}}}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"GetConVar","parent":"Global","type":"libraryfunc","description":{"text":"Gets the ConVar with the specified name.","note":"This function uses Global.GetConVar_Internal internally, but caches the result in Lua for quicker lookups."},"realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"510-L522"},"args":{"arg":{"text":"Name of the ConVar to get","name":"name","type":"string"}},"rets":{"ret":{"text":"The ConVar object, or nil if no such ConVar was found.","name":"","type":"ConVar"}}},"example":{"description":"Makes a ConVar and utilizes GetConVar to print the value of the ConVar.","code":"CreateClientConVar(\"exampleConvar\", \"hi\")\n\nconcommand.Add(\"exampleConvar2\", function()\n\tMsgN(\"ConVar Value: \" .. GetConVar(\"exampleConvar\"):GetString())\nend)","output":"```\nConVar Value: hi\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetConVar_Internal","parent":"Global","type":"libraryfunc","description":{"text":"Gets the ConVar with the specified name. This function doesn't cache the convar.","internal":"","warning":"This function is very slow and not recommended. See Global.GetConVar for an example on how to properly store the return of what you're using so you can avoid using this function as much as possible."},"realm":"Shared and Menu","args":{"arg":{"text":"Name of the ConVar to get","name":"name","type":"string"}},"rets":{"ret":{"text":"The ConVar object","name":"","type":"ConVar"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetConVarNumber","parent":"Global","type":"libraryfunc","description":"Returns the numeric value ConVar (converted from the ConVar's string value) with the specified name.\n\nThis function will return `0` if the ConVar does not exist. Use cvars.Number to specify your own default.\n\nWill return the value of game.MaxPlayers if `maxplayers` is specified as the ConVar name, even though `maxplayers` is not a ConVar. (it is a console **command**) You should be using aforementioned Lua function instead for that case.\n\nIn performance intensive places such as think and rendering callbacks/hooks, it is advised to use ConVar:GetFloat on a ConVar object directly, which be retrieved via Global.GetConVar, or from existing Global.CreateConVar call.","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"524-L528"},"args":{"arg":{"text":"Name of the ConVar to get the value of.","name":"name","type":"string"}},"rets":{"ret":{"text":"The ConVar's value.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetConVarString","parent":"Global","type":"libraryfunc","description":"Returns the string value ConVar with the specified name.\n\nThis function will return an empty string if the ConVar does not exist. Use cvars.String to specify your own default.\n\nWill return the value of game.MaxPlayers (as a string) if `maxplayers` is specified as the ConVar name, even though `maxplayers` is not a ConVar. (it is a console **command**) You should be using aforementioned Lua function instead for that case.\n\nIn performance intensive places such as think and rendering callbacks/hooks, it is advised to use ConVar:GetString on a ConVar object directly, which be retrieved via Global.GetConVar, or from existing Global.CreateConVar call.","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"530-L534"},"args":{"arg":{"text":"Name of the ConVar to get the value of.","name":"name","type":"string"}},"rets":{"ret":{"text":"The ConVar's value.","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetDefaultLoadingHTML","parent":"Global","type":"libraryfunc","description":"Returns the default loading screen URL (asset://garrysmod/html/loading.html)","realm":"Menu","rets":{"ret":{"text":"Default loading url (asset://garrysmod/html/loading.html)","name":"","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"GetDemoFileDetails","parent":"Global","type":"libraryfunc","description":"Retrieves data about the demo with the specified filename. Similar to Global.GetSaveFileDetails.","realm":"Menu","args":{"arg":{"text":"The file name of the demo.","name":"filename","type":"string"}},"rets":{"ret":{"text":"Demo data.","name":"","type":"table"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"GetDownloadables","parent":"Global","type":"libraryfunc","description":"Returns a table with the names of files needed from the server you are currently joining.","realm":"Menu","rets":{"ret":{"text":"table of file names","name":"","type":"table<string>"}}},"example":{"description":"Returns a table with the file names.","code":"PrintTable( GetDownloadables() )","output":"```\n1\t=\tmaps\\gm_flatgrass.bsp\n2\t=\tmaps\\graphs\\gm_flatgrass.ain\n3\t=\tmaps\\gm_flatgrass.nav\n```"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"getfenv","parent":"Global","type":"libraryfunc","description":"Returns the environment table of either the stack level or the function specified.","realm":"Shared and Menu","args":{"arg":{"text":"The object to get the enviroment from. Can also be a number that specifies the function at that stack level: Level 1 is the function calling getfenv. Level 0 is the base Garry's Mod environment (_G).","name":"location","type":"function","default":"1","alttype":"number"}},"rets":{"ret":{"text":"The environment.","name":"","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetGlobal2Angle","parent":"Global","type":"libraryfunc","description":"Returns an angle that is shared between the server and all clients.","realm":"Shared","args":{"arg":[{"text":"The unique index to identify the global value with.","name":"index","type":"string"},{"text":"The value to return if the global value is not set.","name":"default","type":"Angle","default":"Angle( 0, 0, 0 )"}]},"rets":{"ret":{"text":"The global value, or default if the global is not set.","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGlobal2Bool","parent":"Global","type":"libraryfunc","description":"Returns a boolean that is shared between the server and all clients.","realm":"Shared","args":{"arg":[{"text":"The unique index to identify the global value with.","name":"index","type":"string"},{"text":"The value to return if the global value is not set.","name":"default","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"The global value, or the default if the global value is not set.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGlobal2Entity","parent":"Global","type":"libraryfunc","description":"Returns an entity that is shared between the server and all clients.","realm":"Shared","args":{"arg":[{"text":"The unique index to identify the global value with.","name":"index","type":"string"},{"text":"The value to return if the global value is not set.","name":"default","type":"Entity","default":"NULL"}]},"rets":{"ret":{"text":"The global value, or the default if the global value is not set.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGlobal2Float","parent":"Global","type":"libraryfunc","description":"Returns a float that is shared between the server and all clients.","realm":"Shared","args":{"arg":[{"text":"The unique index to identify the global value with.","name":"index","type":"string"},{"text":"The value to return if the global value is not set.","name":"default","type":"number","default":"0"}]},"rets":{"ret":{"text":"The global value, or the default if the global value is not set.","name":"","type":"number"}}},"example":{"description":"SetGlobal2Float error example","code":"SetGlobal2Float(\"Example\", 3.3)\nprint(GetGlobal2Float(\"Example\"))","output":"3.2999999523163"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGlobal2Int","parent":"Global","type":"libraryfunc","description":{"text":"Returns an integer that is shared between the server and all clients.","warning":"The integer has a 32 bit limit. Use Global.GetGlobalInt for a higher limit"},"realm":"Shared","args":{"arg":[{"text":"The unique index to identify the global value with.","name":"index","type":"string"},{"text":"The value to return if the global value is not set.","name":"default","type":"number","default":"0"}]},"rets":{"ret":{"text":"The global value, or the default if the global value is not set.","name":"","type":"number"}}},"example":{"description":"Prints the current round number if set, otherwise 0.","code":"print(GetGlobalInt(\"RoundNumber\", 0))"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGlobal2String","parent":"Global","type":"libraryfunc","description":"Returns a string that is shared between the server and all clients.","realm":"Shared","args":{"arg":[{"text":"The unique index to identify the global value with.","name":"index","type":"string"},{"text":"The value to return if the global value is not set.","name":"default","type":"string","default":""}]},"rets":{"ret":{"text":"The global value, or the default if the global value is not set.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGlobal2Var","parent":"Global","type":"libraryfunc","description":"Returns a value that is shared between the server and all clients.","realm":"Shared","args":{"arg":[{"text":"The unique index to identify the global value with.","name":"index","type":"string"},{"text":"The value to return if the global value is not set.","name":"default","type":"any","default":"nil"}]},"rets":{"ret":{"text":"The global value, or the default if the global value is not set.","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGlobal2Vector","parent":"Global","type":"libraryfunc","description":"Returns a vector that is shared between the server and all clients.","realm":"Shared","args":{"arg":[{"text":"The unique index to identify the global value with.","name":"Index","type":"string"},{"text":"The value to return if the global value is not set.","name":"Default","type":"Vector"}]},"rets":{"ret":{"text":"The global value, or the default if the global value is not set.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGlobalAngle","parent":"Global","type":"libraryfunc","description":"Returns an angle that is shared between the server and all clients.","realm":"Shared","args":{"arg":[{"text":"The unique index to identify the global value with.","name":"index","type":"string"},{"text":"The value to return if the global value is not set.","name":"default","type":"Angle"}]},"rets":{"ret":{"text":"The global value, or default if the global is not set.","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGlobalBool","parent":"Global","type":"libraryfunc","description":"Returns a boolean that is shared between the server and all clients.","realm":"Shared","args":{"arg":[{"text":"The unique index to identify the global value with.","name":"index","type":"string"},{"text":"The value to return if the global value is not set.","name":"default","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"The global value, or the default if the global value is not set.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGlobalEntity","parent":"Global","type":"libraryfunc","description":"Returns an entity that is shared between the server and all clients.","realm":"Shared","args":{"arg":[{"text":"The unique index to identify the global value with.","name":"index","type":"string"},{"text":"The value to return if the global value is not set.","name":"default","type":"Entity","default":"NULL"}]},"rets":{"ret":{"text":"The global value, or the default if the global value is not set.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGlobalFloat","parent":"Global","type":"libraryfunc","description":"Returns a float that is shared between the server and all clients.","realm":"Shared","args":{"arg":[{"text":"The unique index to identify the global value with.","name":"index","type":"string"},{"text":"The value to return if the global value is not set.","name":"default","type":"number","default":"0"}]},"rets":{"ret":{"text":"The global value, or the default if the global value is not set.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGlobalInt","parent":"Global","type":"libraryfunc","description":{"text":"Returns an integer that is shared between the server and all clients.","bug":{"text":"This function will not round decimal values as it actually networks a float internally.","issue":"3374"}},"realm":"Shared","args":{"arg":[{"text":"The unique index to identify the global value with.","name":"index","type":"string"},{"text":"The value to return if the global value is not set.","name":"default","type":"number","default":"0"}]},"rets":{"ret":{"text":"The global value, or the default if the global value is not set.","name":"","type":"number"}}},"example":{"description":"Prints the current round number if set, otherwise 0.","code":"print(GetGlobalInt(\"RoundNumber\", 0))"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGlobalString","parent":"Global","type":"libraryfunc","description":"Returns a string that is shared between the server and all clients.","realm":"Shared","args":{"arg":[{"text":"The unique index to identify the global value with.","name":"index","type":"string"},{"text":"The value to return if the global value is not set.","name":"default","type":"string","default":""}]},"rets":{"ret":{"text":"The global value, or the default if the global value is not set.","name":"","type":"string"}}},"example":{"description":"Prints the current server name if set, otherwise \"Garry's Mod 13\".","code":"print( GetGlobalString(\"ServerName\", \"Garry's Mod 13\") )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGlobalVar","parent":"Global","type":"libraryfunc","description":"Returns a value that is shared between the server and all clients.","realm":"Shared","args":{"arg":[{"text":"The unique index to identify the global value with.","name":"index","type":"string"},{"text":"The value to return if the global value is not set.","name":"default","type":"any","default":"nil"}]},"rets":{"ret":{"text":"The global value, or the default if the global value is not set.","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGlobalVector","parent":"Global","type":"libraryfunc","description":"Returns a vector that is shared between the server and all clients.","realm":"Shared","args":{"arg":[{"text":"The unique index to identify the global value with.","name":"Index","type":"string"},{"text":"The value to return if the global value is not set.","name":"Default","type":"Vector"}]},"rets":{"ret":{"text":"The global value, or the default if the global value is not set.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetHostName","parent":"Global","type":"libraryfunc","description":{"text":"Returns the name of the current server.","note":"GetHostName returns information from ConVar hostname"},"realm":"Shared","rets":{"ret":{"text":"The name of the server.","name":"","type":"string"}}},"example":{"description":"Print the current hostname.","code":"MsgN( GetHostName( ) ) -- Loopback server, expected output: Garry's Mod.","output":"```\nGarry's Mod\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetHUDPanel","parent":"Global","type":"libraryfunc","description":"Returns the panel that is used as a wrapper for the HUD. If you want your panel to be hidden when the main menu is opened, parent it to this. Child panels will also have their controls disabled.\n\nSee also vgui.GetWorldPanel","realm":"Client","rets":{"ret":{"text":"The HUD panel","name":"","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetLoadPanel","parent":"Global","type":"libraryfunc","description":"Returns the loading screen panel and creates it if it doesn't exist.","realm":"Menu","file":{"text":"lua/menu/loading.lua","line":"228-L236"},"rets":{"ret":{"text":"The loading screen panel","name":"","type":"Panel"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"GetLoadStatus","parent":"Global","type":"libraryfunc","description":"Returns the current status of the server join progress.","realm":"Menu","rets":{"ret":{"text":"The current status","name":"","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"GetMapList","parent":"Global","type":"libraryfunc","description":"Returns a table with the names of all maps and categories that you have on your client.","realm":"Menu","file":{"text":"lua/menu/getmaps.lua","line":"419-L421"},"rets":{"ret":{"text":"Table of map names and categories.","name":"","type":"table"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"getmetatable","parent":"Global","type":"libraryfunc","description":"Returns the metatable of an object. This function obeys the metatable's __metatable field, and will return that field if the metatable has it set.\n\nUse debug.getmetatable if you want the true metatable of the object.\n\nIf you want to modify the metatable, check out Global.FindMetaTable","realm":"Shared and Menu","args":{"arg":{"text":"The value to return the metatable of.","name":"object","type":"any"}},"rets":{"ret":{"text":"The metatable of the value. This is not always a table.","name":"","type":"any"}}},"example":{"description":"Use a table's metatable and alter it.","code":"print(getmetatable(Pupil).__index.GetName(Pupil))\n-- getmetatable(Pupil) will return Pupil_meta.\n-- Same as print(Pupil:GetName())\n-- This is what the Lua interpreter basically does. (When __index is a table.)\n\ngetmetatable(Pupil).SetName = function(self, newName)\n self.name = newName\nend\n-- We're adding a new method to Pupil's metatable\n\nprint(getmetatable(Pupil).GetName(Pupil))\n-- Still the same, because Pupil_meta.__index is Pupil_meta.","output":"\"John Doe\""},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetOverlayPanel","parent":"Global","type":"libraryfunc","description":"Returns the menu overlay panel, a container for panels like the error panel created in GM:OnLuaError.","realm":"Menu","rets":{"ret":{"text":"The overlay panel","name":"","type":"Panel"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"GetPlayerList","parent":"Global","type":"libraryfunc","description":{"text":"Updates the PlayerList for the Currently Viewed Server. Internally uses serverlist.PlayerList to retrieve the PlayerList.","internal":""},"realm":"Menu","file":{"text":"lua/menu/mainmenu.lua","line":"257-L266"},"args":{"arg":{"text":"The ServerIP to retrieve the PlayerList from.","name":"serverip","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"GetPredictionPlayer","parent":"Global","type":"libraryfunc","added":"2020.04.29","description":"Returns the player whose movement commands are currently being processed. The player this returns can safely have Player:GetCurrentCommand() called on them. See Prediction.","realm":"Shared","rets":{"ret":{"text":"The player currently being predicted, or NULL if no command processing is currently being done.","name":"","type":"Player"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetRenderTarget","parent":"Global","type":"libraryfunc","description":{"text":"Creates or gets the rendertarget with the given name.\n\nSee Global.GetRenderTargetEx for an advanced version of this function with more options.","bug":{"text":"This crashes when used on a cubemap texture.","issue":"2885"},"warning":["Rendertargets are not garbage-collected, which means they will remain in memory until you disconnect. So make sure to avoid creating new ones unecessarily and re-use as many of your existing rendertargets as possible to avoid filling up all your memory.","Drawing rendertargets on themself can produce odd and unexpected results."],"note":"Calling this function is equivalent to\n```lua\nGetRenderTargetEx(name,\n\twidth, height,\n\tRT_SIZE_NO_CHANGE,\n\tMATERIAL_RT_DEPTH_SEPARATE,\n\tbit.bor(2, 256),\n\t0,\n\tIMAGE_FORMAT_BGRA8888\n)\n```"},"realm":"Client","args":{"arg":[{"text":"The internal name of the render target.","name":"name","type":"string"},{"text":"The width of the render target, must be power of 2. If not set to PO2, the size will be automatically converted to the nearest PO2 size.","name":"width","type":"number"},{"text":"The height of the render target, must be power of 2. If not set to PO2, the size will be automatically converted to the nearest PO2 size.","name":"height","type":"number"}]},"rets":{"ret":{"text":"The render target","name":"","type":"ITexture"}}},"example":[{"description":"Example usage of a render target","code":"-- Give the RT a size\nlocal TEX_SIZE = 512\n\n-- Create the RT\nlocal tex = GetRenderTarget( \"ExampleRT\", TEX_SIZE, TEX_SIZE )\n\n-- Write something to the RT\n-- Note how this is not in a render hook, in this case we only write to the render target once\nlocal txBackground = surface.GetTextureID( \"models/weapons/v_toolgun/screen_bg\" )\nrender.PushRenderTarget( tex )\ncam.Start2D()\n\n\tsurface.SetDrawColor( color_white )\n\tsurface.SetTexture( txBackground )\n\tsurface.DrawTexturedRect( 0, 0, TEX_SIZE, TEX_SIZE )\n\ncam.End2D()\nrender.PopRenderTarget()\n\n-- Create a render-able material for our render target\nlocal myMat = CreateMaterial( \"ExampleRTMat\", \"UnlitGeneric\", {\n\t[\"$basetexture\"] = tex:GetName() -- Make the material use our render target texture\n} )\n\n-- Draw it on screen\nhook.Add( \"HUDPaint\", \"DrawExampleMat\", function()\n\tsurface.SetDrawColor( color_white )\n\tsurface.SetMaterial( myMat )\n\tsurface.DrawTexturedRect( 25, 25, TEX_SIZE, TEX_SIZE )\nend )"},{"description":"Example usage of a render target with transparency/alpha channel","code":"local textureRT = GetRenderTarget( \"ExampleRTwithAlpha\", 512, 512 )\n\nlocal mat = CreateMaterial( \"ExampleRTwithAlpha_Mat\", \"UnlitGeneric\", {\n\t['$basetexture'] = textureRT:GetName(),\n\t[\"$translucent\"] = \"1\" -- This is necessary to render the RT with alpha channel\n} );\n\nhook.Add( \"HUDPaint\", \"ExampleRTwithAlpha_Render\", function()\n\trender.PushRenderTarget( textureRT )\n\tcam.Start2D()\n\n\t\t-- Clear the RT\n\t\trender.Clear( 0, 0, 0, 0 )\n\n\t\t-- Draw some basic animated stuff on it\n\t\tdraw.RoundedBox( 0, 20, 100 + math.sin( CurTime() ) * 50, 50, 50, color_white )\n\n\t\t-- Draw with transparency\n\t\tdraw.RoundedBox( 0, 120, 100 + math.sin( CurTime() ) * 50, 50, 50, Color( 255, 0, 0, 100 ) )\n\n\tcam.End2D()\n\trender.PopRenderTarget()\n\n\t-- Draw our render target on screen so we can see our result\n\tsurface.SetDrawColor( color_white )\n\tsurface.SetMaterial( mat )\n\tsurface.DrawTexturedRect( 50, 50, 512, 512 )\nend )"}],"realms":["Client"],"type":"Function"},
{"function":{"name":"GetRenderTargetEx","parent":"Global","type":"libraryfunc","description":"Gets (or creates if it does not exist) the rendertarget with the given name, this function allows to adjust the creation of a rendertarget more than Global.GetRenderTarget.\n\nSee also render.PushRenderTarget and render.SetRenderTarget.","realm":"Client","args":{"arg":[{"text":"The internal name of the render target.","name":"name","type":"string","warning":"The name is treated like a path and gets its extension discarded.\n\"name.1\" and \"name.2\" are considered the same name and will result in the same render target being reused."},{"text":"The width of the render target, must be power of 2.","name":"width","type":"number"},{"text":"The height of the render target, must be power of 2.","name":"height","type":"number"},{"text":"Bitflag that influences the sizing of the render target, see Enums/RT_SIZE.","name":"sizeMode","type":"number{RT_SIZE}"},{"text":"Bitflag that determines the depth buffer usage of the render target Enums/MATERIAL_RT_DEPTH.","name":"depthMode","type":"number{MATERIAL_RT_DEPTH}","warning":"PNG's may not render to non MATERIAL_RT_DEPTH_NONE RenderTargets"},{"text":"Bitflag that configures the texture, see Enums/TEXTUREFLAGS.\n\nList of flags can also be found on the Valve's Developer Wiki:\nhttps://developer.valvesoftware.com/wiki/Valve_Texture_Format","name":"textureFlags","type":"number{TEXTUREFLAGS}"},{"text":"Flags that control the HDR behaviour of the render target, see Enums/CREATERENDERTARGETFLAGS.","name":"rtFlags","type":"number{CREATERENDERTARGETFLAGS}"},{"text":"Image format, see Enums/IMAGE_FORMAT.","name":"imageFormat","type":"number","note":"Some additional image formats are accepted, but don't have enums. See [VTF Enumerations.](https://developer.valvesoftware.com/wiki/Valve_Texture_Format#VTF_enumerations)"}]},"rets":{"ret":{"text":"The new render target.","name":"","type":"ITexture"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetSaveFileDetails","parent":"Global","type":"libraryfunc","description":"Retrieves data about the save with the specified filename. Similar to Global.GetDemoFileDetails.","realm":"Menu","args":{"arg":{"text":"The file name of the save.","name":"filename","type":"string"}},"rets":{"ret":{"text":"Save data.","name":"","type":"table"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"GetServers","parent":"Global","type":"libraryfunc","description":{"text":"Starts Searching for Servers in the given Category. Can be stopped with Global.DoStopServers.  \n\t\tInternally uses serverlist.Query to search for Servers.","internal":""},"realm":"Menu","file":{"text":"lua/menu/mainmenu.lua","line":"387-L445"},"args":{"arg":[{"text":"The Category to start searching the Servers in. **Working Values: internet, favorite, history, lan**","name":"category","type":"string"},{"text":"Some ID. can be a random number?","name":"id","type":"number"}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"GetTimeoutInfo","parent":"Global","type":"libraryfunc","description":"Returns if the client is timing out, and time since last ping from the server. Similar to the server side Player:IsTimingOut.","realm":"Client","added":"2021.01.27","rets":{"ret":[{"text":"Is timing out?","name":"","type":"boolean"},{"text":"Get time since last pinged received.","name":"","type":"number"}]}},"example":{"description":"","code":"print( GetTimeoutInfo() )","output":"```\nfalse\n0.011438442269421\n```"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetViewEntity","parent":"Global","type":"libraryfunc","description":"Returns the entity the client is using to see from (such as the player itself, the camera, or another entity).","realm":"Client","rets":{"ret":{"text":"The view entity.","name":"","type":"Entity"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GMOD_OpenURLNoOverlay","parent":"Global","type":"libraryfunc","description":{"text":"Opens the given URL in a HTML panel.","internal":""},"realm":"Menu","file":{"text":"lua/menu/openurl.lua","line":"34-L43"},"args":{"arg":{"text":"The url to open.","name":"url","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"HexToColor","parent":"Global","type":"libraryfunc","description":"Converts a hexadecimal representation of a color to Color object.","realm":"Shared and Menu","added":"2025.07.12","file":{"text":"lua/includes/util/color.lua","line":"119-L161"},"args":{"arg":{"text":"A hex formatted color. Accepted formats are:\n* `#RRGGBB`\n* `#RRGGBBAA` (Web color standard variation)\n* `#RGB`\n* `#RGBA`\n\n`#` can be omitted.","name":"hue","type":"string"}},"rets":{"ret":{"text":"The Color created from the hexadecimal color code.","name":"","type":"Color"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"HSLToColor","parent":"Global","type":"libraryfunc","file":{"text":"lua/includes/util/color.lua","line":"76-L105"},"description":"Converts a color from [HSL color space](https://en.wikipedia.org/wiki/HSL_and_HSV) into RGB color space and returns a Color.","realm":"Shared and Menu","args":{"arg":[{"text":"The hue in degrees from 0-360.","name":"hue","type":"number"},{"text":"The saturation from 0-1.","name":"saturation","type":"number"},{"text":"The lightness from 0-1.","name":"lightness","type":"number"}]},"rets":{"ret":{"text":"The Color created from the HSL color space.","name":"","type":"Color"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"HSVToColor","parent":"Global","type":"libraryfunc","file":{"text":"lua/includes/util/color.lua","line":"45-L74"},"description":"Converts a color from [HSV color space](https://en.wikipedia.org/wiki/HSL_and_HSV) into RGB color space and returns a Color.","realm":"Shared and Menu","args":{"arg":[{"text":"The hue in degrees from 0-360.","name":"hue","type":"number"},{"text":"The saturation from 0-1.","name":"saturation","type":"number"},{"text":"The value from 0-1.","name":"value","type":"number"}]},"rets":{"ret":{"text":"The Color created from the HSV color space.","name":"","type":"Color"}}},"example":[{"description":"A helper function for drawing rainbow text.","code":"local function DrawRainbowText( frequency, str, font, x, y )\n\n\tsurface.SetFont( font )\n\tsurface.SetTextPos( x, y )\n\n\tfor i = 1, #str do\n\t\tlocal col = HSVToColor( i * frequency % 360, 1, 1 ) -- Providing 3 numbers to surface.SetTextColor rather\n\t\tsurface.SetTextColor( col.r, col.g, col.b )\t\t\t-- than a single color is faster\n\t\tsurface.DrawText( string.sub( str, i, i ) )\n\tend\n\nend\n\n-- Solid color rainbow, faster than example above\nlocal function DrawSimpleRainbowText( speed, str, font, x, y )\n\n\tsurface.SetFont( font )\n\tsurface.SetTextColor( HSVToColor(  ( CurTime() * speed ) % 360, 1, 1 ) )\n\tsurface.SetTextPos( x, y )\n\n\tsurface.DrawText( str )\n\nend\n\nhook.Add( \"HUDPaint\", \"RainbowPuke\", function()\n\tDrawRainbowText( 10, \"Hello world! This is rainbow text.\", \"CloseCaption_Bold\", 5, 5 )\n\tDrawSimpleRainbowText( 100, \"Hello world! This is rainbow text.\", \"CloseCaption_Bold\", 5, 55 )\nend )","output":{"image":{"src":"DrawRainbowText.png","alt":"300px"}}},{"description":"A helper function for printing rainbow text in the chat.","code":"local function PrintRainbowText( frequency, str )\n\n\tlocal text = {}\n\tlocal len = #text\n\n\tfor i = 1, #str do\n\t\ttext[len + 1] = HSVToColor( i * frequency % 360, 1, 1 )\n\t\ttext[len + 2] = string.sub( str, i, i )\n\t\tlen = len + 2\n\tend\n\n\t-- Print to chat, also prints to console\n\tchat.AddText( unpack( text ) )\n\n\t-- Uncomment this to print to console only, works serverside too\n\t-- MsgC( unpack( text ) )\n\nend\n\n-- The higher the number, the quicker the color will change between each character\nPrintRainbowText( 10, \"Hello world!\" )","output":{"image":[{"src":"ChatPrintRainbow.png","alt":"300px"},{"src":"ConsolePrintRainbow.png","alt":"300px"}]}}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"HTTP","parent":"Global","type":"libraryfunc","description":{"text":"Launches an asynchronous http request with the given parameters.","bug":{"text":"This cannot send or receive multiple headers with the same name.","issue":"2232"},"note":["HTTP-requests that respond with a large body may return an `unsuccessful` error. Try using the [Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range) header to download the file in chunks.","HTTP-requests to destinations on private networks (such as `192.168.0.1`, or `127.0.0.1`) won't work.\n\t\n\n\tTo enable HTTP-requests to destinations on private networks use Command Line Parameters `-allowlocalhttp`. (Dedicated servers only)"]},"realm":"Shared and Menu","args":{"arg":{"text":"The request parameters. See Structures/HTTPRequest.","name":"parameters","type":"table{HTTPRequest}"}},"rets":{"ret":{"text":"`true` if a request is queued, `false` if a request could not be queued. (i.e. When not giving a `table` or the game is ran with `-disablehttp`)","name":"","type":"boolean"}}},"example":{"code":"HTTP( {\n\tfailed = function( reason )\n\t\tprint( \"HTTP request failed\", reason )\n\tend,\n\tsuccess = function( code, body, headers )\n\t\tprint( \"HTTP request succeeded\", code, body, headers )\n\tend,\n\tmethod = \"GET\",\n\turl = \"https://google.com/\"\n} )"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"HWBToColor","parent":"Global","type":"libraryfunc","file":{"text":"lua/includes/util/color.lua","line":"107-L117"},"description":"Converts a color from [HWB color space](https://en.wikipedia.org/wiki/HWB_color_model) (Hue-Whiteness-Blackness) into RGB color space and returns a Color.","realm":"Shared and Menu","added":"2025.01.23","args":{"arg":[{"text":"The hue of the color in degrees from 0-360.","name":"hue","type":"number"},{"text":"The whiteness of the color from 0-1.","name":"whiteness","type":"number"},{"text":"The blackness of the color from 0-1.","name":"blackness","type":"number"}]},"rets":{"ret":{"text":"The Color created from the HWB color space.","name":"","type":"Color"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"include","parent":"Global","type":"libraryfunc","description":{"text":"Executes a Lua script.\n\nThis function will try to load local client file if `sv_allowcslua` is **1**.","warning":"The file you are attempting to include **MUST NOT** be empty or the include will fail. Files over a certain size (64KB compressed) may fail clientside as well.\n\nIf the file you are including is clientside or shared, it **must** be Global.AddCSLuaFile'd or this function will error saying the file doesn't exist."},"realm":"Shared and Menu","args":{"arg":{"text":"The name of the script to be executed. The path must be either relative to the current file, or be an absolute path (relative to and excluding the **lua/** folder).\n\nAddon files (.gma files) and dedicated servers clientside do not support relative parent folders (`..` notation).\n\nAbsolute paths for gamemode files must include `","name":"fileName","type":"string","gamemode_folder_name":{"text":"/gamemode/`.","note":"Please make sure your file names are unique, the filesystem is shared across all addons, so a file named `lua/config.lua` in your addon may be overwritten by the same file in another addon."}}},"rets":{"ret":{"text":"Anything that the executed Lua script returns.","name":"","type":"vararg"}}},"example":[{"description":"Demonstrates correct and incorrect usage.","code":"-- Correct usage:\n-- Will look for \"lua/myLuaFolder/myLuaFile.lua\" in all addons and then the base game **lua/** folder.\ninclude( \"myLuaFolder/myLuaFile.lua\" )\n\n-- This is incorrect, and will NOT work.\ninclude( \t\t\t\t\"lua/myLuaFolder/myLuaFile.lua\" )\ninclude( \t\t \"addons/lua/myLuaFolder/myLuaFile.lua\" )\ninclude( \"addons/MyAddon/lua/myLuaFolder/myLuaFile.lua\" )\ninclude( \t\t\"MyAddon/lua/myLuaFolder/myLuaFile.lua\" )"},{"description":"Specify a base folder and recursively include client, shared and server files without having to specify them.","code":"local rootDirectory = \"you_directory\"\n\nlocal function AddFile( File, directory )\n\tlocal prefix = string.lower( string.Left( File, 3 ) )\n\n\tif SERVER and prefix == \"sv_\" then\n\t\tinclude( directory .. File )\n\t\tprint( \"[AUTOLOAD] SERVER INCLUDE: \" .. File )\n\telseif prefix == \"sh_\" then\n\t\tif SERVER then\n\t\t\tAddCSLuaFile( directory .. File )\n\t\t\tprint( \"[AUTOLOAD] SHARED ADDCS: \" .. File )\n\t\tend\n\t\tinclude( directory .. File )\n\t\tprint( \"[AUTOLOAD] SHARED INCLUDE: \" .. File )\n\telseif prefix == \"cl_\" then\n\t\tif SERVER then\n\t\t\tAddCSLuaFile( directory .. File )\n\t\t\tprint( \"[AUTOLOAD] CLIENT ADDCS: \" .. File )\n\t\telseif CLIENT then\n\t\t\tinclude( directory .. File )\n\t\t\tprint( \"[AUTOLOAD] CLIENT INCLUDE: \" .. File )\n\t\tend\n\tend\nend\n\nlocal function IncludeDir( directory )\n\tdirectory = directory .. \"/\"\n\n\tlocal files, directories = file.Find( directory .. \"*\", \"LUA\" )\n\n\tfor _, v in ipairs( files ) do\n\t\tif string.EndsWith( v, \".lua\" ) then\n\t\t\tAddFile( v, directory )\n\t\tend\n\tend\n\n\tfor _, v in ipairs( directories ) do\n\t\tprint( \"[AUTOLOAD] Directory: \" .. v )\n\t\tIncludeDir( directory .. v )\n\tend\nend\n\nIncludeDir( rootDirectory )"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IncludeCS","parent":"Global","type":"libraryfunc","description":{"text":"This function works exactly the same as Global.include both clientside and serverside.\n\nThe only difference is that on the serverside it also calls Global.AddCSLuaFile on the filename, so that it gets sent to the client.","deprecated":"To send the target file to the client simply call AddCSLuaFile() in the target file itself."},"realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"196-L202"},"args":{"arg":{"text":"The filename of the Lua file you want to include.","name":"filename","type":"string"}},"rets":{"ret":{"text":"Anything that the executed Lua script returns.","name":"","type":"vararg"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"InvalidateInternalEntityCache","parent":"Global","type":"libraryfunc","description":{"text":"Called by the engine before GM:OnEntityCreated and after GM:EntityRemoved hooks are called.\nInternally used to clear the player.Iterator or ents.Iterator cache","internal":""},"realm":"Shared","added":"2025.06.12","file":{"text":"lua/includes/extensions/entity_iter.lua","line":"22-L28"},"args":{"arg":{"text":"Reset the player.Iterator cache","name":"isPly","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ipairs","parent":"Global","type":"libraryfunc","description":"Returns a [Stateless Iterator](https://www.lua.org/pil/7.3.html) for a [Generic For Loops](https://www.lua.org/pil/4.3.5.html), to return ordered key-value pairs from a table.\n\nThis will only iterate through **numerical** keys, and these must also be **sequential**; starting at 1 with no gaps.\n\nFor unordered pairs, see Global.pairs.\n\nFor pairs sorted by key in alphabetical order, see Global.SortedPairs.","realm":"Shared and Menu","args":{"arg":{"text":"The table to iterate over.","name":"tab","type":"table"}},"rets":{"ret":[{"text":"The iterator function.","name":"","type":"function"},{"text":"The table being iterated over.","name":"","type":"table"},{"text":"The origin index **=0**.","name":"","type":"number"}]}},"example":[{"description":"Demonstrates how this differs from Global.pairs.","code":"local tbl = { two = 2, one = 1, \"alpha\", \"bravo\", [3] = \"charlie\", [5] = \"echo\", [6] = \"foxtrot\" }\n\nprint( \"pairs:\" )\nfor k, v in pairs( tbl ) do\n\tprint( k, v )\nend\n\nprint( \"\\nipairs:\" )\nfor k, v in ipairs( tbl ) do\n\tprint( k, v )\nend","output":"```\npairs:\n1\talpha\n2\tbravo\n3\tcharlie\n5\techo\n6\tfoxtrot\none\t1\ntwo\t2\n\nipairs:\n1\talpha\n2\tbravo\n3\tcharlie\n```"},{"description":"From `UpdateUI` in [undo.lua](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/lua/includes/modules/undo.lua#L40-L50), this adds the first 100 undo entries to the `Undo` panel in the spawnmenu.","code":"local Limit = 100\nlocal Count = 0\nfor k, v in ipairs( ClientUndos ) do\n\n\tlocal Item = ComboBox:AddItem( tostring( v.Name ) )\n\tItem.DoClick = function() RunConsoleCommand( \"gmod_undonum\", tostring( v.Key ) ) end\n\n\tCount = Count + 1\n\tif ( Count > Limit ) then break end\n\nend"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"isangle","parent":"Global","type":"libraryfunc","description":"Returns if the passed object is an Angle.","realm":"Shared and Menu","args":{"arg":{"text":"The variable to perform the type check for.","name":"variable","type":"any"}},"rets":{"ret":{"text":"True if the variable is an Angle.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"isbool","parent":"Global","type":"libraryfunc","description":"Returns if the passed object is a boolean.","realm":"Shared and Menu","args":{"arg":{"text":"The variable to perform the type check for.","name":"variable","type":"any"}},"rets":{"ret":{"text":"True if the variable is a boolean.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsColor","parent":"Global","type":"libraryfunc","description":"Returns whether the given object does or doesn't have a `metatable` of a color.","realm":"Shared and Menu","file":{"text":"lua/includes/util/color.lua","line":"36-L40"},"args":{"arg":{"text":"The object to be tested","name":"Object","type":"any"}},"rets":{"ret":{"text":"Whether the given object is a color or not","name":"","type":"boolean"}}},"example":{"description":"How work 'isColor' function ?","code":"local color = Color(255, 255, 255)\n\nprint(IsColor(color) or \"This variable is not a colour\")","output":"```\ntrue\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsConCommandBlocked","parent":"Global","type":"libraryfunc","description":{"text":"Determines whether or not the provided console command will be blocked if it's ran through Lua functions, such as Global.RunConsoleCommand or Player:ConCommand.\n\n\t\tFor more info on blocked console commands, check out Blocked ConCommands.","internal":""},"realm":"Shared and Menu","added":"2021.07.01","args":{"arg":{"text":"The console command to test.","name":"name","type":"string"}},"rets":{"ret":{"text":"Whether the command will be blocked.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsEnemyEntityName","parent":"Global","type":"libraryfunc","description":"Returns if the given NPC class name is an enemy. Returns `true` if the entity name is one of the following:\n* `monster_alien_grunt`\n* `monster_nihilanth`\n* `monster_tentacle`\n* `monster_alien_slave`\n* `monster_bigmomma`\n* `monster_bullchicken`\n* `monster_gargantua`\n* `monster_human_assassin`\n* `monster_babycrab`\n* `monster_human_grunt`\n* `monster_cockroach`\n* `monster_houndeye`\n* `monster_zombie`\n* `monster_headcrab`\n* `monster_alien_controller`\n* `monster_turret`\n* `monster_miniturret`\n* `monster_sentry`\n* `npc_antlion`\n* `npc_antlionguard`\n* `npc_antlionguardian`\n* `npc_barnacle`\n* `npc_breen`\n* `npc_clawscanner`\n* `npc_combine_s`\n* `npc_cscanner`\n* `npc_fastzombie`\n* `npc_fastzombie_torso`\n* `npc_headcrab`\n* `npc_headcrab_fast`\n* `npc_headcrab_poison`\n* `npc_hunter`\n* `npc_metropolice`\n* `npc_manhack`\n* `npc_poisonzombie`\n* `npc_strider`\n* `npc_stalker`\n* `npc_zombie`\n* `npc_zombie_torso`\n* `npc_zombine`\n* `npc_combine_camera`\n* `npc_turret_ceiling`\n* `npc_combinedropship`\n* `npc_combinegunship`\n* `npc_helicopter`\n* `npc_turret_floor`\n* `npc_antlion_worker`\n* `npc_headcrab_black`","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"386-L388"},"args":{"arg":{"text":"Class name of the entity to check.","name":"className","type":"string"}},"rets":{"ret":{"text":"Is an enemy?","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"ambig":{"text":"You might be looking for Global.isentity, which has the same name, but is lowercase and not deprecated.","page":"Global.IsEntity"},"function":{"name":"IsEntity","parent":"Global","type":"libraryfunc","description":{"text":"Identical to Global.isentity. Returns if the passed object is an Entity.","deprecated":"Use the function Global.isentity instead."},"realm":"Shared and Menu","args":{"arg":{"text":"The variable to check.","name":"variable","type":"any"}},"rets":{"ret":{"text":"True if the variable is an Entity.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsFirstTimePredicted","parent":"Global","type":"libraryfunc","description":{"text":"Returns if this is the first time this hook was predicted.\n\nThis is useful for one-time logic in your SWEPs PrimaryAttack, SecondaryAttack and Reload and other  (to prevent those hooks from being called rapidly in succession). It's also useful in a Move hook for when the client predicts movement.\n\nVisit Prediction for more information about this behavior.","note":"This is already used internally for Entity:EmitSound, Weapon:SendWeaponAnim and Entity:FireBullets, but NOT in  util.Effect."},"realm":"Shared","rets":{"ret":{"text":"Whether or not this is the first time being predicted.","name":"","type":"boolean"}}},"example":{"description":"An override for GM:KeyPress, to work around the hook being called multiple times.","code":"-- Note that for some reason KeyPress and KeyRelease are called multiple times\n-- for the same key event in multiplayer.\nfunction GM:KeyPress(ply, key)\n   if key != IN_SPEED then return end\n   if not IsFirstTimePredicted() then return end\n   if not IsValid(ply) or ply != LocalPlayer() then return end\n\n   timer.Simple(0.05, function() RunConsoleCommand(\"+voicerecord\") end)\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsFriendEntityName","parent":"Global","type":"libraryfunc","description":"Returns if the given NPC class name is a friend. Returns `true` if the entity name is one of the following:\n* `monster_scientist`\n* `monster_barney`\n* `npc_alyx`\n* `npc_barney`\n* `npc_citizen`\n* `npc_dog`\n* `npc_eli`\n* `npc_fisherman`\n* `npc_gman`\n* `npc_kleiner`\n* `npc_magnusson`\n* `npc_monk`\n* `npc_mossman`\n* `npc_odessa`\n* `npc_vortigaunt`","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"403-L405"},"args":{"arg":{"text":"Class name of the entity to check","name":"className","type":"string"}},"rets":{"ret":{"text":"Is a friend","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"isfunction","parent":"Global","type":"libraryfunc","description":"Returns if the passed object is a function.","realm":"Shared and Menu","args":{"arg":{"text":"The variable to perform the type check for.","name":"variable","type":"any"}},"rets":{"ret":{"text":"True if the variable is a function.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsInGame","parent":"Global","type":"libraryfunc","description":"Returns true if the client is currently playing either a singleplayer or multiplayer game.","realm":"Menu","rets":{"ret":{"text":"True if we are in a game.","name":"","type":"boolean"}}},"realms":["Menu"],"type":"Function"},
{"cat":"global","function":{"name":"IsInLoading","parent":"Global","type":"libraryfunc","description":"Returns true when the loading panel is active.","realm":"Menu","file":{"text":"lua/menu/loading.lua","line":"239-L247"},"rets":{"ret":{"text":"True if loading panel is active.","name":"","type":"boolean"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"ismatrix","parent":"Global","type":"libraryfunc","description":"Returns whether the passed object is a VMatrix.","realm":"Shared and Menu","args":{"arg":{"text":"The variable to perform the type check for.","name":"variable","type":"any"}},"rets":{"ret":{"text":"True if the variable is a VMatrix.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsMounted","parent":"Global","type":"libraryfunc","description":"Checks whether or not a game is currently mounted. Uses data given by engine.GetGames.","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"407-L431"},"args":{"arg":{"text":"The game string/app ID to check.","name":"game","type":"string"}},"rets":{"ret":{"text":"True if the game is mounted.","name":"","type":"boolean"}}},"example":{"description":"Check if Counter-Strike: Source is mounted.","code":"IsMounted('cstrike')"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"isnumber","parent":"Global","type":"libraryfunc","description":"Returns if the passed object is a number.","realm":"Shared and Menu","args":{"arg":{"text":"The variable to perform the type check for.","name":"variable","type":"any"}},"rets":{"ret":{"text":"True if the variable is a number.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ispanel","parent":"Global","type":"libraryfunc","description":"Returns if the passed object is a Panel.","realm":"Shared and Menu","args":{"arg":{"text":"The variable to perform the type check for.","name":"variable","type":"any"}},"rets":{"ret":{"text":"True if the variable is a Panel.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsServerBlacklisted","parent":"Global","type":"libraryfunc","description":"Checks if the given server data is blacklisted or not.","realm":"Menu","file":{"text":"lua/menu/mainmenu.lua","line":"313-L362"},"args":{"arg":[{"text":"Server ip. can end with *","name":"address","type":"string"},{"text":"Server name","name":"hostname","type":"string"},{"text":"description to check","name":"description","type":"string"},{"text":"Gamemode name","name":"gm","type":"string"},{"text":"Map name","name":"map","type":"string"}]},"rets":{"ret":{"text":"Returns the reason why the server is blacklisted or nil if the server is not blacklisted.","name":"result","type":"string"}}},"example":{"description":"Example of a blacklisted hostname.","code":"print(IsServerBlacklisted(\"127.0.0.1\", \"reconnect\", \"\", \"\", \"\"))","output":"```lua\nhost: reconnect\n```"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"isstring","parent":"Global","type":"libraryfunc","description":"Returns if the passed object is a string.","realm":"Shared and Menu","args":{"arg":{"text":"The variable to perform the type check for.","name":"variable","type":"any"}},"rets":{"ret":{"text":"True if the variable is a string.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"istable","parent":"Global","type":"libraryfunc","description":{"text":"Returns if the passed object is a table.","note":"Will return `true` if the argument has a metatable. It will return `true` for variables of type Color as well."},"realm":"Shared and Menu","args":{"arg":{"text":"The variable to perform the type check for.","name":"variable","type":"any"}},"rets":{"ret":{"text":"True if the variable is a table.","name":"","type":"boolean"}}},"example":{"description":"Second object has a string conversion but it is still a table","code":"local mt1 = {}\nfunction new1()\n  self = {}; setmetatable(self, mt1)\n  mt1.__index = mt1\n  return self\nend\n\nlocal mt2 = {}\nfunction new2()\n  self = {}; setmetatable(self, mt2)\n  mt2.__index = mt2\n  mt2.__tostring = function(o) return \"TEST\" end\n  return self\nend","output":"```\ntable: 0x01c98390\ttrue\tTEST\ttrue\ttable: 0x019f29f8\ttrue\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsTableOfEntitiesValid","parent":"Global","type":"libraryfunc","description":"Returns whether or not every element within a table is a valid entity","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"67-L80"},"args":{"arg":{"text":"Table containing entities to check","name":"table","type":"table"}},"rets":{"ret":{"text":"All entities valid","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsUselessModel","parent":"Global","type":"libraryfunc","description":"Returns whether or not a model is useless by checking that the file path is that of a proper model.\n\nIf the string \".mdl\" is not found in the model name, the function will return true.\n\nThe function will also return true if any of the following strings are found in the given model name:\n* \"_gesture\"\n* \"_anim\"\n* \"_gst\"\n* \"_pst\"\n* \"_shd\"\n* \"_ss\"\n* \"_posture\"\n* \"_anm\"\n* \"ghostanim\"\n* \"_paths\"\n* \"_shared\"\n* \"anim_\"\n* \"gestures_\"\n* \"shared_ragdoll_\"","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"312-L334"},"args":{"arg":{"text":"The model name to be checked","name":"modelName","type":"string"}},"rets":{"ret":{"text":"Whether or not the model is useless","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsValid","parent":"Global","type":"libraryfunc","description":{"text":"Returns whether an object is valid or not. (Such as entities, Panels, custom table objects and more).\n\nChecks that an object is not nil, has an `IsValid` method and if this method returns `true`. If the object has no `IsValid` method, it will return `false`.","note":["If you are sure that the object you are about to check is not `nil` and has the `IsValid` method, it would be faster to call it directly rather than using `IsValid`.","Due to vehicles being technically valid the moment they're spawned, also use Vehicle:IsValidVehicle to make sure they're fully initialized."],"warning":"Putting a number in the argument will cause an error."},"realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"256-L268"},"args":{"arg":{"text":"The table or object to be validated.","name":"toBeValidated","type":"any"}},"rets":{"ret":{"text":"True if the object is valid.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"isvector","parent":"Global","type":"libraryfunc","description":"Returns if the passed object is a Vector.","realm":"Shared and Menu","args":{"arg":{"text":"The variable to perform the type check for.","name":"variable","type":"any"}},"rets":{"ret":{"text":"True if the variable is a Vector.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"JoinServer","parent":"Global","type":"libraryfunc","description":"Joins the server with the specified IP.","realm":"Menu","args":{"arg":{"text":"The IP of the server to join","name":"IP","type":"string"}}},"example":{"description":"Joins the server running on your machine.","code":"JoinServer(\"localhost\")"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"JS_Language","parent":"Global","type":"libraryfunc","description":"Adds JavaScript function 'language.Update' to an HTML panel as a method to call Lua's language.GetPhrase function.","realm":"Client and Menu","file":{"text":"lua/includes/util/javascript_util.lua","line":"2-L9"},"args":{"arg":{"text":"Panel to add JavaScript function 'language.Update' to.","name":"htmlPanel","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"JS_Utility","parent":"Global","type":"libraryfunc","description":"Adds JavaScript function 'util.MotionSensorAvailable' to an HTML panel as a method to call Lua's motionsensor.IsAvailable function.","realm":"Client and Menu","file":{"text":"lua/includes/util/javascript_util.lua","line":"11-L17"},"args":{"arg":{"text":"Panel to add JavaScript function 'util.MotionSensorAvailable' to.","name":"htmlPanel","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"JS_Workshop","parent":"Global","type":"libraryfunc","description":"Adds workshop related JavaScript functions to an HTML panel, used by the \"Dupes\" and \"Saves\" tabs in the spawnmenu.","realm":"Client and Menu","file":{"text":"lua/includes/util/javascript_util.lua","line":"19-L40"},"args":{"arg":{"text":"Panel to add JavaScript functions to.","name":"htmlPanel","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Label","parent":"Global","type":"libraryfunc","description":"Convenience function that creates a DLabel, sets the text, and returns it","realm":"Client and Menu","file":{"text":"lua/vgui/dlabel.lua","line":"307-L314"},"args":{"arg":[{"text":"The string to set the label's text to","name":"text","type":"string"},{"text":"Optional. The panel to parent the DLabel to","name":"parent","type":"Panel","default":"nil"}]},"rets":{"ret":{"text":"The created DLabel","name":"","type":"Panel"}}},"example":[{"description":"Create a label","code":"local lbl = Label( \"The quick brown fox\" )"},{"description":"Create a label and parents it to a DPanel","code":"local pnl = vgui.Create(\"DPanel\")\nlocal lbl = Label( \"The quick brown fox\", pnl )"}],"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"LanguageChanged","parent":"Global","type":"libraryfunc","description":"Callback function for when the client's language changes. Called by the engine.","realm":"Menu","file":{"text":"lua/menu/mainmenu.lua","line":"534-L544"},"args":{"arg":{"text":"The new language code.","name":"lang","type":"string"}}},"example":{"description":"Prints the new language code whenever the language changes.","code":"local OldLanguageChanged = LanguageChanged\nfunction LanguageChanged( lang )\n\tprint( \"New language: \" .. lang )\n\tOldLanguageChanged( lang )\nend","output":"New language: en"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"Lerp","parent":"Global","type":"libraryfunc","description":{"text":"Performs a linear interpolation from the start number to the end number.\n\nThis function provides a very efficient and easy way to smooth out movements.\n\nSee also math.ease for functions that allow to have non linear animations using linear interpolation.","note":"This function is not meant to be used with constant value in the first argument if you're dealing with animation! Use a value that changes over time. See example for **proper** usage of Lerp for animations."},"realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"292-L302"},"args":{"arg":[{"text":"The fraction for finding the result. This number is clamped between 0 and 1. Shouldn't be a constant.","name":"t","type":"number"},{"text":"The starting number. The result will be equal to this if delta is 0.","name":"from","type":"number"},{"text":"The ending number. The result will be equal to this if delta is 1.","name":"to","type":"number"}]},"rets":{"ret":{"text":"The result of the linear interpolation, `from + (to - from) * t`.","name":"","type":"number"}}},"example":[{"description":"Example of simple Lerp usage for animations.","code":"-- A variable to store the animation's start time is needed if you\n-- want to use the \"Lerp\" function to make timed animations.\nlocal animation_start, animation_duration = CurTime(), 2\n\nhook.Add( \"HUDPaint\", \"LerpAnimation\", function()\n\tlocal animation_progress = ( CurTime() - animation_start ) / animation_duration\n\n\t-- The \"Lerp\" function is then called using the fraction as the first argument with\n\t-- the second being the value you want to start at (\"from\") when the fraction is \"0\" and\n\t-- the third being the final value (\"to\") when the fraction is \"1\".\n\n\t-- If the \"from\" value is going to be \"0\" consider using the formula \"to * animation_progress\".\n\t-- If the \"to\" value is \"0\" you could use the formula \"from * ( 1 - animation_progress )\".\n\t-- These methods are slightly faster and will achieve the same result as if you were to use \"Lerp\".\n\n\t-- For example a different way of writing this line would be:\n\t-- \t\"local animated_value = 255 * ( 1 - animated_progress )\"\n\n\t-- If you wanted to reverse the animation the line could be:\n\t-- \t\"local animated_value = Lerp( animation_progress, 0, 255 )\"\n\t-- \t\tor\n\t-- \t\"local animated_value = 255 * animation_progress\"\n\tlocal animated_value = Lerp( animation_progress, 255, 0 )\n\n\t-- In this case the \"Lerp\" function is being used to make a rect fade out.\n\tsurface.SetDrawColor( 255, 255, 255, animated_value )\n\tsurface.DrawRect( 50, 50, 300, 300 )\n\n\t-- If you add the start time and duration together you'll have the total\n\t-- animation time, and if you compare it to the current time you can check\n\t-- if the animation has completed.\n\n\t-- A slightly more accurate and optimised way of checking if the animation has completed is by\n\t-- checking if the \"animation_progress\" is equal to \"1\" or if \"animated_value\" is equal to the\n\t-- third argument used when \"Lerp\" was called.\n\tif ( animation_start + animation_duration <= CurTime() ) then\n\t\t-- In this example we're just resetting the start time when the animation completes.\n\t\tanimation_start = CurTime()\n\tend\nend )"},{"description":"Advanced example of Lerp animation: A health bar that will smooth the health change over 0.5 seconds to reach new health value from the previous value.","code":"local start, oldhp, newhp = 0, -1, -1\nlocal barW = 200\nlocal animationTime = 0.5 -- seconds\n\nhook.Add( \"HUDPaint\", \"LerpAnimation\", function()\n\t-- Local player still loading, do nothing\n\tif ( !IsValid( LocalPlayer() ) ) then return end\n\n\tlocal hp = LocalPlayer():Health()\n\tlocal maxhp = LocalPlayer():GetMaxHealth()\n\n\t-- The values are not initialized yet, do so right now\n\tif ( oldhp == -1 and newhp == -1 ) then\n\t\toldhp = hp\n\t\tnewhp = hp\n\tend\n\n\t-- You can use a different smoothing function here\n\tlocal smoothHP = Lerp( ( SysTime() - start ) / animationTime, oldhp, newhp )\n\n\t-- Health was changed, initialize the animation\n\tif newhp ~= hp then\n\t\t-- Old animation is still in progress, adjust\n\t\tif ( smoothHP ~= hp ) then\n\t\t\t-- Pretend our current \"smooth\" position was the target so the animation will\n\t\t\t-- not jump to the old target and start to the new target from there\n\t\t\tnewhp = smoothHP\n\t\tend\n\n\t\toldhp = newhp\n\t\tstart = SysTime()\n\t\tnewhp = hp\n\tend\n\n\tdraw.RoundedBox( 4, 100, 200, barW, 100, color_black )\n\tdraw.RoundedBox( 4, 100, 200, math.max( 0, smoothHP ) / maxhp * barW, 100, color_white )\nend )"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"LerpAngle","parent":"Global","type":"libraryfunc","description":{"text":"Returns point between first and second angle using given fraction and linear interpolation","note":"This function is not meant to be used with constant value in the first argument, if you're dealing with animation! Use a value that changes over time"},"realm":"Shared and Menu","args":{"arg":[{"text":"Ratio of progress through values","name":"ratio","type":"number"},{"text":"Angle to begin from","name":"angleStart","type":"Angle"},{"text":"Angle to end at","name":"angleEnd","type":"Angle"}]},"rets":{"ret":{"text":"angle","name":"","type":"Angle"}}},"example":{"description":"Turns an entity 180 degrees linearly over ten seconds","code":"local startAngle = Angle(0, 0, 0)\nlocal endAngle = Angle(0, 180, 0)\nlocal ratio = 0\n\ntimer.Create(\"Turn\", 0.1, 10, function()\n    ratio = ratio + 0.1\n    entity:SetAngles(LerpAngle(ratio, startAngle, endAngle))\nend)"},"realms":["Server","Client","Menu"],"type":"Function"},
{"text":"If you do it each frame to smooth positions, you should couple it with FrameTime()","function":{"name":"LerpVector","parent":"Global","type":"libraryfunc","description":{"text":"Linear interpolation between two vectors. It is commonly used to smooth movement between two vectors","note":"This function is not meant to be used with constant value in the first argument, if you're dealing with animation! Use a value that changes over time"},"realm":"Shared and Menu","args":{"arg":[{"text":"Fraction ranging from 0 to 1","name":"fraction","type":"number"},{"text":"The initial Vector","name":"from","type":"Vector"},{"text":"The desired Vector","name":"to","type":"Vector"}]},"rets":{"ret":{"text":"The lerped vector.","name":"","type":"Vector"}}},"example":{"description":"Get the middle point (50%) between two vectors.","code":"local output = LerpVector( 0.5, Vector( 0, 0, 100 ), Vector( 0, 0, 200 ) )","output":"Vector( 0, 0, 150 )"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ListAddonPresets","parent":"Global","type":"libraryfunc","description":{"text":"Loads all Addon Presets and updates the Preset list.","internal":""},"realm":"Menu","file":{"text":"lua/menu/mainmenu.lua","line":"621-L625"}},"realms":["Menu"],"type":"Function"},
{"cat":"global","function":{"name":"LoadAddonPresets","parent":"Global","type":"libraryfunc","description":"Returns the contents of `addonpresets.txt` located in the `garrysmod/settings` folder. By default, this file stores your addon presets as JSON.\n\nYou can use Global.SaveAddonPresets to modify this file.","realm":"Menu","rets":{"ret":{"text":"The contents of the file.","name":"JSON","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"LoadLastMap","parent":"Global","type":"libraryfunc","description":{"text":"This function is used to get the last map and category to which the map belongs from the cookie saved with Global.SaveLastMap.","internal":""},"realm":"Menu","file":{"text":"lua/menu/getmaps.lua","line":"451-L464"}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"LoadNewsList","parent":"Global","type":"libraryfunc","description":{"text":"Updates the News List","internal":""},"realm":"Menu","file":{"text":"lua/menu/mainmenu.lua","line":"300-L307"}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"LoadPresets","parent":"Global","type":"libraryfunc","description":{"text":"Loads all preset settings for the presets and returns them in a table","internal":""},"realm":"Client","rets":{"ret":{"text":"Preset data","name":"","type":"table"}}},"example":{"description":"Prints all of the presets in to the console","code":"PrintTable(LoadPresets())"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Localize","parent":"Global","type":"libraryfunc","description":{"text":"Returns a localization for the given token, if none is found it will return the default (second) parameter.","deprecated":"Use language.GetPhrase instead."},"realm":"Client and Menu","args":{"arg":[{"text":"The token to find a translation for.","name":"localizationToken","type":"string"},{"text":"The default value to be returned if no translation was found.","name":"default","type":"string"}]},"rets":{"ret":{"text":"The localized string, 128 char limit.","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"LocalPlayer","parent":"Global","type":"libraryfunc","description":{"text":"Returns the player object of the current client.","note":"LocalPlayer() will return NULL until all entities have been initialized. See GM:InitPostEntity."},"realm":"Client","rets":{"ret":{"text":"The player object representing the client.","name":"","type":"Player"}}},"example":{"description":"Demonstrates the use of this function.","code":"print( LocalPlayer() )","output":"Player [1][Player1]"},"realms":["Client"],"type":"Function"},
{"function":{"name":"LocalToWorld","parent":"Global","type":"libraryfunc","description":"Translates a vector and angle from a local coordinate system into a global coordinate system.\n\nFor the reverse of this function see Global.WorldToLocal.\n\nFor working with an entity's local space vectors/angles you might consider using Entity:LocalToWorld/Entity:LocalToWorldAngles instead.","realm":"Shared","args":{"arg":[{"text":"A vector from a local coordinate system.","name":"localPos","type":"Vector"},{"text":"An angle from a local coordinate system.\n\nPass a zero angle if you don't need to translate an angle.","name":"localAng","type":"Angle"},{"text":"The origin of a global coordinate system, in worldspace coordinates.","name":"originPos","type":"Vector"},{"text":"The angles of a global coordinate system, as a worldspace angle.","name":"originAngle","type":"Angle"}]},"rets":{"ret":[{"text":"The corresponding worldspace vector to `localPos`.","name":"","type":"Vector"},{"text":"The corresponding worldspace angle to `localAng`.","name":"","type":"Angle"}]}},"example":{"description":"A matrix math that shows how this is calculated internally.","code":"local localTransform = Matrix()\nlocalTransform:SetTranslation( localPos )\nlocalTransform:SetAngles( localAng )\n\nlocal worldTransform = Matrix()\nworldTransform:SetTranslation( originPos )\nworldTransform:SetAngles( originAngle )\n\n-- Transform the local coordinates using the world transform as a transformation matrix\nlocal localToWorld = worldTransform * localTransform\n\nprint( localToWorld:GetTranslation(), localToWorld:GetAngles() )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"MainEyeAngles","parent":"Global","type":"libraryfunc","description":"Returns the main view angles, as they were at the start of the latest main view render.\n\nThis is a good alternative to Global.EyeAngles which is affected by other rendering operations, including render.RenderView.","added":"2025.10.02","realm":"Client","rets":{"ret":{"text":"The angles of the main view.","name":"","type":"Angle"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"MainEyePos","parent":"Global","type":"libraryfunc","description":"Returns the origin of the main view, as it was at the start of the latest main view render.\n\nThis is a good alternative to Global.EyePos which is affected by other rendering operations, including render.RenderView.","added":"2025.10.02","realm":"Client","rets":{"ret":{"text":"Main camera position.","name":"","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"MakeBalloon","parent":"Global","type":"libraryfunc","description":{"text":"This function makes a balloon appear, similar to the one from the Toolgun.","internal":"","warning":"This function doesn't make the rope attached to the balloon appear."},"realm":"Server","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/stools/balloon.lua","line":"L135-L174"},"args":{"arg":[{"text":"The player who spawns the balloon. This argument can be nil","name":"ply","type":"player"},{"text":"Balloon color (red)","name":"r","type":"number","default":"255"},{"text":"Balloon color (green)","name":"g","type":"number","default":"255"},{"text":"Balloon color (blue).","name":"b","type":"number","default":"255"},{"text":"The lift force applied to the balloon.","name":"force","type":"number","default":"0"},{"text":"Data applied to the balloon. This data is required for correctly spawning the balloon.\nFor more information, please see: Structures/BalloonData","name":"data","type":"table{BalloonData}"}]},"rets":{"ret":{"text":"Returns the created balloon entity.","name":"balloon","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Material","parent":"Global","type":"libraryfunc","description":{"text":"Either returns the material with the given name, or loads the material interpreting the first argument as the path.\n\n## .png, .jpg and other image formats\n\nThis function is capable to loading `.png` or `.jpg` images, generating a texture and material for them on the fly.\n\nPNG, JPEG, GIF, and TGA files will work, but only if they have the `.png` or `.jpg` file extensions (even if the actual image format doesn't match the file extension)\n\nUse Global.AddonMaterial for image files with the `.cache` file extension. (from steamworks.Download)\n\nWhile images are no longer scaled to Power of 2 (sizes of 8, 16, 32, 64, 128, etc.) sizes since February 2019, it is still a good practice for things like icons, etc.","warning":["Server-side, this function can consistently return an invalid material (with '__error') depending on the file type loaded.","This function is very expensive when used in rendering hooks or in operations requiring very frequent calls. It is a good idea to cache the material in a variable (like in the examples)."]},"realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"34-L49"},"args":{"arg":[{"text":"The material name or path relative to the `materials/` folder.  \nPaths outside the `materials/` folder like `data/MyImage.jpg` or `maps/thumb/gm_construct.png` will also work for when generating materials.\n\nTo retrieve a Lua material created with Global.CreateMaterial, just prepend a `!` to the material name.","name":"materialName","type":"string"},{"text":"A string containing space separated keywords which will be used to add material parameters.\n\nSee Material Parameters for more information.","name":"pngParameters","type":"string","default":"nil","note":"This feature only works when importing `.png` or `.jpg` image files."}]},"rets":{"ret":[{"text":"Generated material.","name":"","type":"IMaterial"},{"text":"How long it took for the function to run.","name":"","type":"number"}]}},"example":[{"description":"Creates a PNG material with noclamp and smooth parameters set and then draws on screen.\n\nIn this example the .png file is located in `materials/vgui/wave.png`.","code":"local wave = Material( \"vgui/wave.png\", \"noclamp smooth\" )\n\nhook.Add( \"HUDPaint\", \"HUDPaint_DrawATexturedBox\", function()\n\tsurface.SetMaterial( wave )\n\tsurface.SetDrawColor( 255, 255, 255, 255 )\n\tsurface.DrawTexturedRect( 50, 50, 128, 128 )\nend )"},{"description":"Acquires and uses one of the Post-Processing Materials to make the screen darker and more saturated.","code":"local mat_color = Material( \"pp/colour\" ) -- used outside of the hook for performance\n\nhook.Add(\"RenderScreenspaceEffects\", \"ColorExample\", function()\n\trender.UpdateScreenEffectTexture()\n\n\tmat_color:SetTexture( \"$fbtexture\", render.GetScreenEffectTexture() )\n\n\tmat_color:SetFloat( \"$pp_colour_addr\", 0 )\n\tmat_color:SetFloat( \"$pp_colour_addg\", 0 )\n\tmat_color:SetFloat( \"$pp_colour_addb\", 0 )\n\tmat_color:SetFloat( \"$pp_colour_mulr\", 0 )\n\tmat_color:SetFloat( \"$pp_colour_mulg\", 0 )\n\tmat_color:SetFloat( \"$pp_colour_mulb\", 0 )\n\tmat_color:SetFloat( \"$pp_colour_brightness\", 0 )\n\tmat_color:SetFloat( \"$pp_colour_contrast\", 0.5 )\n\tmat_color:SetFloat( \"$pp_colour_colour\", 5 )\n\n\trender.SetMaterial( mat_color )\n\trender.DrawScreenQuad()\nend )"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Matrix","parent":"Global","type":"libraryfunc","description":"Returns a VMatrix object, a 4x4 matrix.","realm":"Shared","args":{"arg":{"text":"Initial data to initialize the matrix with. Leave empty to initialize an identity matrix. See examples for usage.\n\nCan be a VMatrix to copy its data.","name":"data","type":"table","default":"{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}}"}},"rets":{"ret":{"text":"New matrix.","name":"","type":"VMatrix"}}},"example":{"description":"Initializes a matrix, translates it by Vector( 4, 5, 6 ) and then scales it by Vector( 1, 2, 3 ).","code":"local M = Matrix()\nM:Translate( Vector( 4, 5, 6 ) )\nM:Scale( Vector( 1, 2, 3 ) )\n\n-- This matrix is equivalent:\nlocal M2 = Matrix( {\n\t{ 1, 0, 0, 4 },\n\t{ 0, 2, 0, 5 },\n\t{ 0, 0, 3, 6 },\n\t{ 0, 0, 0, 1 }\n} )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"MenuGetAddonData","parent":"Global","type":"libraryfunc","description":{"text":"This function retrieves the Addon data and passes it onto JS(JavaScript)","internal":"Internally uses steamworks.FileInfo to fetch the data."},"realm":"Menu","file":{"text":"lua/menu/mainmenu.lua","line":"572-L577"},"args":{"arg":{"text":"The ID of Steam Workshop item.","name":"workshopItemID","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"Mesh","parent":"Global","type":"libraryfunc","description":"Returns a new static mesh object.","realm":"Client","args":{"arg":[{"text":"The material the mesh is intended to be rendered with. It's merely a hint that tells that mesh what vertex format it should use.","name":"mat","type":"IMaterial","default":"nil"},{"text":"Number of bone weights per vertex. This value can be set to 2 to enable skinning and rendering via IMesh:DrawSkinned. This was recently added and is only available on the Dev Branch right now.","name":"boneWeights","type":"number","default":"0"}]},"rets":{"ret":{"text":"The created object.","name":"","type":"IMesh"}}},"note":"This function does not work with \"WorldVertexTransition\" materials, UnlitGeneric works, however VertexLitGeneric suffers shading issues as well.","example":{"description":"Draws a triangle near Vector( 0, 0, 0 ) in the map.","code":"local mat = Material( \"editor/wireframe\" ) -- The material (a wireframe)\nlocal obj = Mesh() -- Create the IMesh object\n\nlocal verts = { -- A table of 3 vertices that form a triangle\n\t{ pos = Vector( 0,  0,  0 ), u = 0, v = 0 }, -- Vertex 1\n\t{ pos = Vector( 10, 0,  0 ), u = 1, v = 0 }, -- Vertex 2\n\t{ pos = Vector( 10, 10, 0 ), u = 1, v = 1 }, -- Vertex 3\n}\n\nobj:BuildFromTriangles( verts ) -- Load the vertices into the IMesh object\n\nhook.Add( \"PostDrawOpaqueRenderables\", \"IMeshTest\", function()\n\n\trender.SetMaterial( mat ) -- Apply the material\n\tobj:Draw() -- Draw the mesh\n\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Model","parent":"Global","type":"libraryfunc","description":"Runs util.PrecacheModel and returns the string.","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"166-L172"},"args":{"arg":{"text":"The model to precache.","name":"model","type":"string"}},"rets":{"ret":{"text":"The same string entered as an argument.","name":"","type":"string"}}},"example":{"description":"From [entities/gmod_cameraprop.lua](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/gamemodes/sandbox/entities/entities/gmod_cameraprop.lua).","code":"local CAMERA_MODEL = Model( \"models/dav0r/camera.mdl\" )\nfunction ENT:Initialize()\n\tself:SetModel( CAMERA_MODEL )\nend"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"module","parent":"Global","type":"libraryfunc","description":"Creates a table with the specified module name and sets the function environment for said table.\n\nAny passed loaders are called with the table as an argument. An example of this is package.seeall.","realm":"Shared and Menu","args":{"arg":[{"text":"The name of the module. This will be used to access the module table in the runtime environment.","name":"name","type":"string"},{"text":"Calls each function passed with the new table as an argument.","name":"loaders","type":"vararg"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Msg","parent":"Global","type":"libraryfunc","description":{"text":"Writes every given argument to the console. Limitations of Global.print apply.\n\nAutomatically attempts to convert each argument to a string. (See Global.tostring)\n\nUnlike Global.print, arguments are not separated by anything. They are simply concatenated.\n\nAdditionally, a newline isn't added automatically to the end, so subsequent Msg or print operations will continue the same line of text in the console. See Global.MsgN for a version that does add a newline.\n\nThe text is blue on the server, orange on the client, and green on the menu:","image":{"src":"msg_server_client_colors.png"}},"realm":"Shared and Menu","args":{"arg":{"text":"List of values to print.","name":"args","type":"vararg"}}},"example":{"description":"Prints \"Hello World!\" to the console.","code":"Msg(\"Hello\", \" World!\")","output":"Hello World!"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"MsgAll","parent":"Global","type":"libraryfunc","description":"Works exactly like Global.Msg except that, if called on the server, will print to all players consoles plus the server console. Limitations of Global.print apply.","realm":"Shared","args":{"arg":{"text":"List of values to print.","name":"args","type":"vararg"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"MsgC","parent":"Global","type":"libraryfunc","description":"Just like Global.Msg, except it can also print colored text, just like chat.AddText.","realm":"Shared and Menu","args":{"arg":{"text":"Values to print. If you put in a color, all text after that color will be printed in that color.","name":"args","type":"vararg"}}},"example":[{"description":"Prints `Hello World!` in red to the console.","code":"MsgC( Color( 255, 0, 0 ), \"Hello World!\" )","output":{"image":{"src":"msgc_red_hello_world_2.png"}}},{"description":"Displays the built-in colors for the three realms (client, server and menu).","code":"MsgC( Color( 156, 241, 255, 200 ), \"Server message color\\n\" )\nMsgC( Color( 136, 221, 255, 255 ), \"Server error color\\n\" )\n\nMsgC( Color( 255, 241, 122, 200 ), \"Client message color\\n\" )\nMsgC( Color( 255, 221, 102, 255 ), \"Client error color\\n\" )\n\nMsgC( Color( 100, 220, 100, 200 ), \"Menu message color\\n\" )\nMsgC( Color( 120, 220, 100, 255 ), \"Menu error color\\n\" )","output":{"upload":{"src":"22674/8d99eb0bc22d743.png","size":"2005","name":"image.png"}}}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"MsgN","parent":"Global","type":"libraryfunc","description":"Same as Global.print, except it concatinates the arguments without inserting any whitespace in between them.\n\nSee also Global.Msg, which doesn't add a newline (`\"\\n\"`) at the end.","realm":"Shared and Menu","args":{"arg":{"text":"List of values to print. They can be of any type and will be converted to strings with Global.tostring.","name":"args","type":"vararg"}}},"example":{"description":"Prints \"Hello, World!\" in two lines to the console.","code":"MsgN(\"Hello,\")\nMsgN(\"World!\")","output":"```\nHello,\nWorld!\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"NamedColor","parent":"Global","type":"libraryfunc","description":"Returns named color defined in `resource/ClientScheme.res`.","realm":"Client","args":{"arg":{"text":"Name of color","name":"name","type":"string"}},"rets":{"ret":{"text":"A Color or nil","name":"","type":"Color"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"newproxy","parent":"Global","type":"libraryfunc","description":{"text":"Creates a new userdata object.","bug":{"text":"Fails under certain conditions when called in coroutines","issue":"5299"}},"realm":"Shared and Menu","args":[{"arg":{"text":"If true, the created userdata will be given its own metatable.","name":"addMetatable","type":"boolean","default":"false"}},{"name":"Userdata Copy","arg":{"text":"Creates a new userdata with the same metatable the userdata passed in had. The userdata passed in **must be** a userdata that has a metatable that was created from this function.","name":"userData","type":"userdata"}}],"rets":{"ret":{"text":"The newly created userdata.","name":"","type":"userdata"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"next","parent":"Global","type":"libraryfunc","description":{"text":"Returns the next key and value pair in a table.","note":"Table keys in Lua have no specific order, and will be returned in whatever order they exist in memory. This may not always be in ascending order or alphabetical order. If you need to iterate over an array in order, use Global.ipairs."},"realm":"Shared and Menu","args":{"arg":[{"text":"The table","name":"tab","type":"table"},{"text":"The previous key in the table.","name":"prevKey","type":"any","default":"nil"}]},"rets":{"ret":[{"text":"The next key for the table. If the previous key was nil, this will be the first key in the table. If the previous key was the last key in the table, this will be nil.","name":"","type":"any"},{"text":"The value associated with that key. If the previous key was the last key in the table, this will be nil.","name":"","type":"any"}]}},"example":{"description":"Returns whether the table is empty or not","code":"local function IsEmptyTable( t )\n\treturn next( t ) == nil\nend\n\nlocal mytable = {}\nprint( \"mytable is empty:\", IsEmptyTable( mytable ) )\nmytable[\"hello\"]=true\nprint( \"mytable is empty:\", IsEmptyTable( mytable ) )","output":"```\nmytable is empty: true\nmytable is empty: false\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"NumDownloadables","parent":"Global","type":"libraryfunc","description":"Returns the number of files needed from the server you are currently joining.","realm":"Menu","rets":{"ret":{"text":"The number of downloadables","name":"","type":"number"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"NumModelSkins","parent":"Global","type":"libraryfunc","description":"Returns the amount of skins the specified model has.\n\nSee also Entity:SkinCount if you have an entity.","realm":"Client","file":{"text":"lua/includes/util/model_database.lua","line":"80-L93"},"args":{"arg":{"text":"Model to return amount of skins of","name":"modelName","type":"string"}},"rets":{"ret":{"text":"Amount of skins","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnModelLoaded","parent":"Global","type":"libraryfunc","description":{"text":"Called by the engine when a model has been loaded. Caches model information with the sql.","internal":""},"realm":"Client","file":{"text":"lua/includes/util/model_database.lua","line":"23-L78"},"args":{"arg":[{"text":"Name of the model.","name":"modelName","type":"string"},{"text":"Number of pose parameters the model has.","name":"numPostParams","type":"number"},{"text":"Number of sequences the model has.","name":"numSeq","type":"number"},{"text":"Number of attachments the model has.","name":"numAttachments","type":"number"},{"text":"Number of bone controllers the model has.","name":"numBoneControllers","type":"number"},{"text":"Number of skins that the model has.","name":"numSkins","type":"number"},{"text":"Size of the model.","name":"size","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OpenFolder","parent":"Global","type":"libraryfunc","description":{"text":"Opens a folder with the given name in the garrysmod folder using the operating system's file browser.","bug":{"text":"This does not work on OSX or Linux.","issue":"1532"}},"realm":"Menu","args":{"arg":{"text":"The subdirectory to open in the garrysmod folder.","name":"folder","type":"string"}}},"example":{"description":"Opens the \"saves\" folder.","code":"OpenFolder( \"saves\" )"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"OpenProblemsPanel","parent":"Global","type":"libraryfunc","description":"Opens the Problems Panel.","realm":"Menu","file":{"text":"lua/menu/problems/problems.lua","line":"165-L185"}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"OrderVectors","parent":"Global","type":"libraryfunc","description":{"text":"Modifies the given vectors so that all of vector2's axis are larger than vector1's by switching them around. Also known as ordering vectors.","note":"This function will irreversibly modify the given vectors"},"realm":"Shared and Menu","args":{"arg":[{"text":"Bounding box min resultant","name":"vector1","type":"Vector"},{"text":"Bounding box max resultant","name":"vector2","type":"Vector"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"pairs","parent":"Global","type":"libraryfunc","description":"Returns an iterator function(Global.next) for a for loop that will return the values of the specified table in an arbitrary order.\n\n* For alphabetical **key** order use Global.SortedPairs.\n* For alphabetical **value** order use Global.SortedPairsByValue.","realm":"Shared and Menu","args":{"arg":{"text":"The table to iterate over.","name":"tab","type":"table"}},"rets":{"ret":[{"text":"The iterator (Global.next).","name":"","type":"function"},{"text":"The table being iterated over.","name":"","type":"table"},{"text":"**nil** (for the constructor).","name":"","type":"any"}]}},"example":{"description":"Iterates through all PlayerInitialSpawn hooks on the server and prints their unique identifiers and called function.","code":"for k, v in pairs( hook.GetTable().PlayerInitialSpawn ) do\n\n\t-- The custom name given in the second argument of the hook.Add function.\n\t-- Example : \"myCustomSpawnFunc\".\n\tprint( \"Unique identifier:\", k )\n\n\t-- The hook function.\n\t-- Example : \"function: 0x3a3f2c80\".\n\tprint( \"Called function:\", v )\n\nend","output":"A list of all hooks."},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Particle","parent":"Global","type":"libraryfunc","description":"Calls game.AddParticles and returns given string.","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"174-L182"},"args":{"arg":{"text":"The particle file.","name":"file","type":"string"}},"rets":{"ret":{"text":"The particle file.","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ParticleEffect","parent":"Global","type":"libraryfunc","description":{"text":"Creates a particle effect. See also Global.CreateParticleSystem.","note":"The particle effect must be precached **serverside** with Global.PrecacheParticleSystem and the file its from must be added via game.AddParticles before it can be used!"},"realm":"Shared","args":{"arg":[{"text":"The name of the particle effect.","name":"particleName","type":"string"},{"text":"The start position of Control Point 0 for the particle system.","name":"position","type":"Vector"},{"text":"The orientation of Control Point 0 for the particle system.\n\nYou must provide the entity argument for the angles to take effect.","name":"angles","type":"Angle"},{"text":"If set, the particle will be parented to the entity.","name":"parent","type":"Entity","default":"NULL"}]}},"example":{"description":"Example usage of the function. Precaches `ExplosionCore_wall` particle from `particles/explosion.pcf`, a Team Fortress 2 particle file.\n\nYou can then test the particle by using the `particleitup` console command.\n\nYou can find a list of particles inside a .pcf file using the [Particle Editor Tool](https://developer.valvesoftware.com/wiki/Particle_Editor)","code":"game.AddParticles( \"particles/explosion.pcf\" )\nPrecacheParticleSystem( \"ExplosionCore_wall\" )\n\nif ( SERVER ) then\n\t-- A test console command to see if the particle works, spawns the particle where the player is looking at. \n\tconcommand.Add( \"particleitup\", function( ply, cmd, args )\n\t\tParticleEffect( \"ExplosionCore_wall\", ply:GetEyeTrace().HitPos, Angle( 0, 0, 0 ) )\n\tend )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ParticleEffectAttach","parent":"Global","type":"libraryfunc","description":{"text":"Creates a particle effect with specialized parameters. See also Entity:CreateParticleEffect and Global.CreateParticleSystem.","note":"The particle effect must be precached **serverside** with Global.PrecacheParticleSystem and the file its from must be added via game.AddParticles before it can be used!"},"realm":"Shared","args":{"arg":[{"text":"The name of the particle effect.","name":"particleName","type":"string"},{"text":"Attachment type using Enums/PATTACH.","name":"attachType","type":"number"},{"text":"The entity to be used in the way specified by the attachType.","name":"entity","type":"Entity"},{"text":"The id of the attachment to be used in the way specified by the attachType.","name":"attachmentID","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ParticleEmitter","parent":"Global","type":"libraryfunc","description":{"text":"Creates a new CLuaEmitter.","note":"Do not forget to delete the emitter with CLuaEmitter:Finish once you are done with it","warning":"There is a limit of 4097 emitters that can be active at once, exceeding this limit will throw a non-halting error in console!"},"realm":"Client","args":{"arg":[{"text":"The start position of the emitter.\n\nThis is only used to determine particle drawing order for translucent particles.","name":"position","type":"Vector"},{"text":"Whenever to render the particles in 2D or 3D mode. Supplying \"true\" will enable 3D (non-billboarded), otherwise it will default to 2D.","name":"use3D","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"The new particle emitter.","name":"","type":"CLuaEmitter"}}},"example":{"description":"Creates a simple spark particle effect 100 units above where the local player is looking at.","code":"local tr =  LocalPlayer():GetEyeTrace()\nlocal pos = tr.HitPos + tr.HitNormal * 100 -- The origin position of the effect\n\nlocal emitter = ParticleEmitter( pos ) -- Particle emitter in this position\n\nfor i = 1, 100 do -- Do 100 particles\n\tlocal part = emitter:Add( \"effects/spark\", pos ) -- Create a new particle at pos\n\tif ( part ) then\n\t\tpart:SetDieTime( 1 ) -- How long the particle should \"live\"\n\n\t\tpart:SetStartAlpha( 255 ) -- Starting alpha of the particle\n\t\tpart:SetEndAlpha( 0 ) -- Particle size at the end if its lifetime\n\n\t\tpart:SetStartSize( 5 ) -- Starting size\n\t\tpart:SetEndSize( 0 ) -- Size when removed\n\n\t\tpart:SetGravity( Vector( 0, 0, -250 ) ) -- Gravity of the particle\n\t\tpart:SetVelocity( VectorRand() * 50 ) -- Initial velocity of the particle\n\tend\nend\n\nemitter:Finish()"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Path","parent":"Global","type":"libraryfunc","description":"Creates a path for the bot to follow using one of two types (`Follow` or `Chase`)\n\n`Follow` is a general purpose path. Best used for static or infrequently updated locations. The path will only be updated once PathFollower:Update is called. This needs to be done manually (typically inside the bots `BehaveThread` coroutine.\n\n`Chase` is a specifically optimized for chasing a moving entity. Paths of this type will use PathFollower:Chase","realm":"Server","args":{"arg":{"text":"The type of the path to create, must be `\"Follow\"` or `\"Chase\"`","name":"type","type":"string"}},"rets":{"ret":{"text":"The path","name":"","type":"PathFollower"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"pcall","parent":"Global","type":"libraryfunc","description":{"text":"Calls a function and catches an error that can be thrown while the execution of the call.","bug":[{"text":"This cannot stop errors from hooks called from the engine.","issue":"2036"},{"text":"This does not stop Global.Error and Global.ErrorNoHalt from sending error messages to the server (if called clientside) or calling the GM:OnLuaError hook. The success boolean returned will always return true and thus you will not get the error message returned. Global.error does not exhibit these behaviours.","issue":"2498"}]},"realm":"Shared and Menu","args":{"arg":[{"text":"Function to be executed and of which the errors should be caught of","name":"func","type":"function"},{"text":"Arguments to call the function with.","name":"arguments","type":"vararg"}]},"rets":{"ret":[{"text":"If the function had no errors occur within it.","name":"","type":"boolean"},{"text":"If an error occurred, this will be a string containing the error message. Otherwise, this will be the return values of the function passed in.","name":"","type":"vararg"}]}},"example":{"description":"Catch an error.","code":"local succ, err = pcall(function() aisj() end)\nprint(succ, err)","output":"false attempt to call global 'aisj' (a nil value)"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Player","parent":"Global","type":"libraryfunc","description":"Returns the player with the matching Player:UserID.\n\nFor a function that returns a player based on their Entity:EntIndex, see Global.Entity.\n\n\nFor a function that returns a player based on their connection ID, see player.GetByID.","realm":"Shared","args":{"arg":{"text":"The player index.","name":"playerIndex","type":"number"}},"rets":{"ret":{"text":"The retrieved player.","name":"","type":"Player"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PositionSpawnIcon","parent":"Global","type":"libraryfunc","description":"Moves the given model to the given position and calculates appropriate camera parameters for rendering the model to an icon.\n\nThe output table interacts nicely with Panel:RebuildSpawnIconEx with a few key renames.","realm":"Client","file":{"text":"lua/includes/util/client.lua","line":"208-L249"},"args":{"arg":[{"text":"Model that is being rendered to the spawn icon","name":"model","type":"Entity"},{"text":"Position that the model is being rendered at","name":"position","type":"Vector"},{"text":"If true the function won't reset the angles to 0 for the model.","name":"noAngles","type":"boolean"}]},"rets":{"ret":{"text":"Table of information of the view which can be used for rendering","name":"","type":"table"}}},"example":{"description":"Creates a clientside model and then PositionSpawnIcon is used to figure out the appropriate camera parameters for rendering this model.","code":"local ent = ClientsideModel(\"models/props_wasteland/cafeteria_table001a.mdl\", RENDERGROUP_BOTH)\nlocal tab = PositionSpawnIcon(ent, vector_origin)\nent:Remove()\n\nPrintTable(tab)","output":"```\nangles\t=\t25.000 220.000 0.000\nfov\t=\t8.4436927451273\norigin\t=\t1156.924316 970.773010 704.184265\nzfar\t=\t1888.5692536466\nznear\t=\t1\n```"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PrecacheParticleSystem","parent":"Global","type":"libraryfunc","description":{"text":"Precaches a particle system with the specified name. The particle system must come from a file that is loaded with game.AddParticles beforehand.\n\nWhen used on the server, it automatically precaches the particle on client.","warning":"There is a limit of 4096 precached particles on the server. So only precache particles that are actually going to be used."},"realm":"Shared","args":{"arg":{"text":"The name of the particle system.","name":"particleSystemName","type":"string"}}},"example":{"description":"Example usage of the function. Precaches `ExplosionCore_wall` particle from `particles/explosion.pcf`, a Team Fortress 2 particle file.\n\nYou can find a list of particles inside a .pcf file using the [Particle Editor Tool](https://developer.valvesoftware.com/wiki/Particle_Editor)","code":"game.AddParticles( \"particles/explosion.pcf\" )\n\nif ( SERVER ) then\n\t-- A test console command to see if the particle works, spawns the particle where the player is looking at. \n\tconcommand.Add( \"particleitup\", function( ply, cmd, args )\n\t\tPrecacheParticleSystem( \"ExplosionCore_wall\" )\n\t\tParticleEffect( \"ExplosionCore_wall\", ply:GetEyeTrace().HitPos, Angle( 0, 0, 0 ) )\n\tend )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PrecacheScene","parent":"Global","type":"libraryfunc","description":"Precaches a scene file.","realm":"Server","args":{"arg":{"text":"Path to the scene file to precache.","name":"scene","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PrecacheSentenceFile","parent":"Global","type":"libraryfunc","description":"Load and precache a custom sentence file.","realm":"Shared","args":{"arg":{"text":"The path to the custom sentences.txt.","name":"filename","type":"string"}}},"example":{"description":"Precache a file named \"customsentences.txt\" in the data directory.","code":"PrecacheSentenceFile( \"data/customsentences.txt\" )","output":"Loads and precaches the sentences."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PrecacheSentenceGroup","parent":"Global","type":"libraryfunc","description":"Precache a sentence group in a sentences.txt definition file.","realm":"Server","args":{"arg":{"text":"The group to precache.","name":"group","type":"string"}}},"example":{"description":"Precache all metropolice sentences.","code":"PrecacheSentenceGroup( \"METROPOLICE\" )","output":"Precaches sounds used in all sentences starting with \"METROPOLICE\"."},"realms":["Server"],"type":"Function"},
{"function":{"name":"print","parent":"Global","type":"libraryfunc","description":"Writes every given argument to the console.\nAutomatically attempts to convert each argument to a string. (See Global.tostring)\n\nSeparates lines with a line break (`\"\\n\"`)\n\nSeparates arguments with a tab character (`\"\\t\"`).\n\nCan only print up to `4096` characters at a time, and will stop at NULL character. (`\"\\0\"`)\n\nSee Global.Msg for alternative that doesn't force add a new line, and Global.MsgC for adding colored text to the console.","realm":"Shared and Menu","args":{"arg":{"text":"List of values to print.","name":"args","type":"vararg"}}},"example":{"description":"Prints \"Hello World! Yay!\" to the console.","code":"print(\"Hello World!\", \"Yay!\")","output":"```\nHello World! Yay!\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"PrintMessage","parent":"Global","type":"libraryfunc","description":"Displays a message in the chat, console, or center of screen of every player.\n\nThis uses the archaic user message system (umsg) and hence is limited to 255 characters.","realm":"Server","args":{"arg":[{"text":"Which type of message should be sent to the players (see Enums/HUD)","name":"type","type":"number"},{"text":"Message to be sent to the players","name":"message","type":"string"}]}},"example":{"description":"Prints into every player's chat: \"I'm new here.\"","code":"PrintMessage(HUD_PRINTTALK, \"I'm new here.\")","output":"I'm new here."},"realms":["Server"],"type":"Function"},
{"function":{"name":"PrintTable","parent":"Global","type":"libraryfunc","description":"Recursively prints the contents of a table to the console.\n\nThe table keys will be sorted alphabetically or numerically when printed to the console.","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"90-L128"},"args":{"arg":[{"text":"The table to be printed","name":"tableToPrint","type":"table"},{"text":"Number of tabs to start indenting at. Increases by 2 when entering another table.","name":"indent","type":"number","default":"0"},{"text":"Internal argument, you shouldn't normally change this. Used to check if a nested table has already been printed so it doesn't get caught in a loop.","name":"done","type":"table","default":"{}"}]}},"example":{"description":"Prints the table we created.","code":"local tbl = {\n \"test\",\n 3829.4,\n {\"foo\", \"baah\", 20/5},\n true\n}\nPrintTable(tbl)","output":"```\n1 = test\n2 = 3829.4\n3:\n\t1 = foo\n\t2 = baah\n\t3 = 4\n4 = true\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ProjectedTexture","parent":"Global","type":"libraryfunc","description":"Creates a new ProjectedTexture.","realm":"Client","rets":{"ret":{"text":"Newly created projected texture.","name":"","type":"ProjectedTexture"}}},"example":{"description":"Creates a simple ProjectedTexture attached to a Scripted Entity.\n\nNote that this code must be ran on clientside only, not shared.","code":"function ENT:OnRemove()\n\tif ( IsValid( self.lamp ) ) then\n\t\tself.lamp:Remove()\n\tend\nend\n\nfunction ENT:Think()\n\t-- Keep updating the light so it's attached to our entity\n\t-- you might want to call other functions here, you can do animations here as well\n\tlocal pos = self:GetPos()\n\tlocal angles = self:GetAngles()\n\n\tif ( IsValid( self.lamp ) ) then\n\t\tself.lamp:SetPos( pos )\n\t\tself.lamp:SetAngles( angles )\n\t\tself.lamp:Update()\n\telse\n\t\tlocal lamp = ProjectedTexture() -- Create a projected texture\n\t\tself.lamp = lamp -- Assign it to the entity table so it may be accessed later\n\n\t\t-- Set it all up\n\t\tlamp:SetTexture( \"effects/flashlight001\" )\n\t\tlamp:SetFarZ( 500 ) -- How far the light should shine\n\n\t\tlamp:SetPos( pos ) -- Initial position and angles\n\t\tlamp:SetAngles( angles )\n\t\tlamp:Update()\n\tend\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"ProtectedCall","parent":"Global","type":"libraryfunc","description":"Runs a function without stopping the whole script on error.\n\nThis function is similar to Global.pcall and Global.xpcall except the errors are still printed and sent to the error handler (i.e. sent to server console if clientside and GM:OnLuaError called).","realm":"Shared","args":{"arg":[{"text":"Function to run","name":"func","type":"function"},{"text":"Arguments to call the function with.","name":"arguments","type":"vararg"}]},"rets":{"ret":{"text":"Whether the function executed successfully or not","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RandomPairs","parent":"Global","type":"libraryfunc","description":"Returns an iterator function that can be used to loop through a table in random order","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"614-L634"},"args":{"arg":[{"text":"Table to create iterator for","name":"table","type":"table"},{"text":"Whether the iterator should iterate descending or not","name":"descending","type":"boolean","default":"nil"}]},"rets":{"ret":{"text":"Iterator function","name":"","type":"function"}}},"example":{"description":"Creates a table and prints its contents in random order","code":"local tab = {\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"}\n\nfor k, v in RandomPairs(tab) do\n    print(v)\nend","output":"b\nd\nf\nc\na\ne"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"rawequal","parent":"Global","type":"libraryfunc","description":"Compares the two values without calling their __eq operator.","realm":"Shared and Menu","args":{"arg":[{"text":"The first value to compare.","name":"value1","type":"any"},{"text":"The second value to compare.","name":"value2","type":"any"}]},"rets":{"ret":{"text":"Whether or not the two values are equal.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"rawget","parent":"Global","type":"libraryfunc","description":"Gets the value with the specified key from the table without calling the __index method.","realm":"Shared and Menu","args":{"arg":[{"text":"Table to get the value from.","name":"table","type":"table"},{"text":"The index to get the value from.","name":"index","type":"any"}]},"rets":{"ret":{"text":"The value.","name":"","type":"any"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"rawset","parent":"Global","type":"libraryfunc","description":"Sets the value with the specified key from the table without calling the __newindex method.","realm":"Shared and Menu","args":{"arg":[{"text":"Table to get the value from.","name":"table","type":"table"},{"text":"The index to get the value from.","name":"index","type":"any"},{"text":"The value to set for the specified key.","name":"value","type":"any"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"RealFrameTime","parent":"Global","type":"libraryfunc","description":{"text":"Returns the real frame-time which is unaffected by host_timescale. To be used for GUI effects (for example)","note":"The returned number is clamped between `0` and `0.1`."},"realm":"Client","file":{"text":"lua/includes/util/client.lua","line":"10-L19"},"rets":{"ret":{"text":"Real frame time","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"RealTime","parent":"Global","type":"libraryfunc","description":{"text":"Returns the uptime of the game/server in seconds (to at least **4** decimal places). This value updates itself once every time the realm thinks. For servers, this is the server tickrate. For clients, this is once per frame.\n\n\n\nYou should use this function (or Global.SysTime) for timing real-world events such as user interaction, but not for timing game events such as animations.\n\nSee also: Global.CurTime, Global.SysTime","note":"This is **not** synchronised or affected by the game.\n\nThis will be affected by precision loss if the uptime is more than 30+(?) days, and effectively cease to be functional after 50+(?) days.\n\nChanging the map will **not** fix it like it does with Global.CurTime. A server restart is necessary."},"realm":"Shared","rets":{"ret":{"text":"Uptime of the game/server.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RecipientFilter","parent":"Global","type":"libraryfunc","description":"Creates a new CRecipientFilter.","realm":"Server","args":{"arg":{"text":"If set to true, makes the filter unreliable. \n\nThis means, when sending over the network in cases like Global.CreateSound (and its subsequent updates), the message is not guaranteed to reach all clients.","name":"unreliable","type":"boolean","default":"false","added":"2020.08.12"}},"rets":{"ret":{"text":"The new created recipient filter.","name":"","type":"CRecipientFilter"}}},"example":{"description":"Example usage of the function","code":"local rf = RecipientFilter()\nrf:AddAllPlayers()\nprint( rf:GetCount() )\nPrintTable( rf:GetPlayers() )","output":"```\n2\n1\t=\tPlayer [1][Player #1]\n2\t=\tPlayer [2][Player #2]\n```"},"realms":["Server"],"type":"Function"},
{"function":{"name":"RecordDemoFrame","parent":"Global","type":"libraryfunc","description":{"text":"Adds a frame to the currently recording demo.","internal":""},"realm":"Menu","file":{"text":"lua/menu/demo_to_video.lua","line":"312"}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"RefreshAddonConflicts","parent":"Global","type":"libraryfunc","description":"Refreshes all Addon Conflicts after 1 Second. Internally uses Global.FireAddonConflicts","realm":"Menu","file":{"text":"lua/menu/problems/problems.lua","line":"317-L319"}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"RegisterDermaMenuForClose","parent":"Global","type":"libraryfunc","description":"Registers a Derma element to be closed the next time Global.CloseDermaMenus is called","realm":"Client and Menu","args":{"arg":{"text":"Menu to be registered for closure","name":"menu","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"RegisterMetaTable","parent":"Global","type":"libraryfunc","description":"Registers a given table as a metatable. It can then be accessed by other code/addons via Global.FindMetaTable.","realm":"Shared and Menu","added":"2024.06.04","args":{"arg":[{"text":"The new metatable name. Cannot override existing types.","name":"metaName","type":"string"},{"text":"The new metatable table. It will be given a `MetaID` and `MetaName` fields.","name":"metaTable","type":"table"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"RememberCursorPosition","parent":"Global","type":"libraryfunc","description":"Saves position of your cursor on screen. You can restore it by using Global.RestoreCursorPosition. This is used internally by the spawn menu/context menu","realm":"Client and Menu","file":{"text":"lua/includes/util.lua","line":"454-L474"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"RemoveTooltip","parent":"Global","type":"libraryfunc","description":"Does the removing of the tooltip panel. Called by Global.EndTooltip.","realm":"Client and Menu","file":{"text":"lua/includes/util/tooltips.lua","line":"5-L18"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"RenderAngles","parent":"Global","type":"libraryfunc","description":"Returns the angle that the clients view is being rendered at. Returns `angles` from the return value of render.GetViewSetup.\n\nSee also Global.EyeAngles.","realm":"Client","rets":{"ret":{"text":"Render Angles","name":"","type":"Angle"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"RenderDoF","parent":"Global","type":"libraryfunc","description":"Renders a Depth of Field effect","realm":"Client","file":{"text":"lua/postprocess/super_dof.lua","line":"174-L279"},"args":{"arg":[{"text":"Origin to render the effect at","name":"origin","type":"Vector"},{"text":"Angle to render the effect at","name":"angle","type":"Angle"},{"text":"Point to focus the effect at","name":"usableFocusPoint","type":"Vector"},{"text":"Angle size of the effect","name":"angleSize","type":"number"},{"text":"Amount of radial steps to render the effect with","name":"radialSteps","type":"number"},{"text":"Amount of render passes","name":"passes","type":"number"},{"text":"Whether to cycle the frame or not","name":"spin","type":"boolean"},{"text":"Table of view data","name":"inView","type":"table"},{"text":"FOV to render the effect with","name":"fov","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"RenderStereoscopy","parent":"Global","type":"libraryfunc","description":"Renders the stereoscopic post-process effect","realm":"Client","file":{"text":"lua/postprocess/stereoscopy.lua","line":"11-L37"},"args":{"arg":[{"text":"Origin to render the effect at","name":"viewOrigin","type":"Vector"},{"text":"Angles to render the effect at","name":"viewAngles","type":"Angle"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"RenderSuperDoF","parent":"Global","type":"libraryfunc","description":"Renders the Super Depth of Field post-process effect","realm":"Client","file":{"text":"lua/postprocess/super_dof.lua","line":"281-L329"},"args":{"arg":[{"text":"Origin to render the effect at","name":"viewOrigin","type":"Vector"},{"text":"Angles to render the effect at","name":"viewAngles","type":"Angle"},{"text":"Field of View to render the effect at","name":"viewFOV","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"RequestConnectToServer","parent":"Global","type":"libraryfunc","description":{"text":"If the server has the permission \"connect\" granted, it will instantly connect you to the server.  \nIf the permission is not granted it will, it opens a confirmation window to connect to the server.","internal":"Called by permissions.AskToConnect","upload":{"src":"ab571/8dc3890a88522bb.png","size":"16390","name":"connect_dialog.png"}},"realm":"Menu","file":{"text":"lua/menu/openurl.lua","line":"292-L300"},"args":{"arg":{"text":"The server ip to connect to","name":"serverip","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"RequestOpenURL","parent":"Global","type":"libraryfunc","description":{"text":"Opens a confirmation window to open the url.","internal":"","upload":{"src":"ab571/8dc3890ccb8cfd4.png","size":"14654","name":"confirm_dialog.png"}},"realm":"Menu","file":{"text":"lua/menu/openurl.lua","line":"286-L291"},"args":{"arg":{"text":"The Website URL to open.","name":"url","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"RequestPermission","parent":"Global","type":"libraryfunc","description":{"text":"Opens a confirmation window to grant the requested permission.","internal":"","upload":{"src":"ab571/8dc3890f84fb468.png","size":"17108","name":"permission_request.png"}},"realm":"Menu","file":{"text":"lua/menu/openurl.lua","line":"301-L305"},"args":{"arg":{"text":"The permission to ask","name":"permission","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"require","parent":"Global","type":"libraryfunc","description":{"text":"First tries to load a binary module with the given name, if unsuccessful, it tries to load a Lua module with the given name.","bug":{"text":"Running this function with Global.pcall or Global.xpcall will still print an error that counts towards sv_kickerrornum.","issue":"2498","request":"813"},"note":["This function will try to load local client file if `sv_allowcslua` is set to `1`","Binary modules can't be installed as part of an addon and have to be put directly into ``garrysmod/lua/bin/`` to be detected.\n\tThis is a safety measure, because modules can be malicious and harm the system."]},"realm":"Shared and Menu","args":{"arg":{"text":"The name of the module to be loaded.","name":"name","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"RestoreCursorPosition","parent":"Global","type":"libraryfunc","description":"Restores position of your cursor on screen. You can save it by using Global.RememberCursorPosition.","realm":"Client and Menu","file":{"text":"lua/includes/util.lua","line":"476-L481"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"RunConsoleCommand","parent":"Global","type":"libraryfunc","description":{"text":"Executes the given console command with the parameters.","note":"Some commands/convars are blocked from being ran/changed using this function, usually to prevent harm/annoyance to clients. For a list of blocked commands, see Blocked ConCommands."},"realm":"Shared and Menu","args":{"arg":[{"text":"The command to be executed.","name":"command","type":"string"},{"text":"The arguments. Note, that unlike Player:ConCommand, you must pass each argument as a new string, not separating them with a space.","name":"arguments","type":"vararg"}]}},"example":{"description":"Changes the gravity to 400 (default 600).","code":"RunConsoleCommand(\"sv_gravity\", \"400\")"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"RunGameUICommand","parent":"Global","type":"libraryfunc","description":{"text":"Runs a menu command. Equivalent to Global.RunConsoleCommand`( \"gamemenucommand\", command )` unless the command starts with the `\"engine\"` keyword in which case it is equivalent to Global.RunConsoleCommand`( command )`.","warning":"Invoking engine commands no longer works, prints out `Not running engine cmd 'concommand'`"},"realm":"Menu","args":{"arg":{"text":"The menu command to run\n\nShould be one of the following:\n* `Disconnect` - Disconnects from the current server.\n* `OpenBenchmarkDialog` - Opens the \"Video Hardware Stress Test\" dialog.\n* `OpenChangeGameDialog` - Does not work in GMod.\n* `OpenCreateMultiplayerGameDialog` - Opens the Source dialog for creating a listen server.\n* `OpenCustomMapsDialog` - Does nothing.\n* `OpenFriendsDialog` - Does nothing.\n* `OpenGameMenu` - Does not work in GMod.\n* `OpenLoadCommentaryDialog` - Opens the \"Developer Commentary\" selection dialog. Useless in GMod.\n* `OpenLoadDemoDialog` - Does nothing.\n* `OpenLoadGameDialog` - Opens the Source \"Load Game\" dialog.\n* `OpenNewGameDialog` - Opens the \"New Game\" dialog. Useless in GMod.\n* `OpenOptionsDialog` - Opens the options dialog.\n* `OpenPlayerListDialog` - Opens the \"Mute Players\" dialog that shows all players connected to the server and allows to mute them.\n* `OpenSaveGameDialog` - Opens the Source \"Save Game\" dialog.\n* `OpenServerBrowser` - Opens the legacy server browser.\n* `Quit` - Quits the game **without** confirmation (unlike other Source games).\n* `QuitNoConfirm` - Quits the game without confirmation (like other Source games).\n* `ResumeGame` - Closes the menu and returns to the game.\n* `engine 'concommand'` - Runs a console command. Unlike Global.RunConsoleCommand It will ignore Blocked ConCommands","name":"command","type":"string"}}},"example":[{"description":"Opens the options dialog.","code":"RunGameUICommand( \"OpenOptionsDialog\" )"},{"description":"Hides the game UI (menu). Equivalent to Global.RunConsoleCommand( \"gameui_hide\" )","code":"RunGameUICommand( \"engine gameui_hide\" )"}],"realms":["Menu"],"type":"Function"},
{"function":{"name":"RunString","parent":"Global","type":"libraryfunc","description":{"text":"Evaluates and executes the given code, will throw an error on failure.","note":"Local variables are not passed to the given code."},"realm":"Shared and Menu","args":{"arg":[{"text":"The code to execute.","name":"code","type":"string"},{"text":"The name that should appear in any error messages caused by this code.","name":"identifier","type":"string","default":"RunString"},{"text":"If false, this function will return a string containing any error messages instead of throwing an error.","name":"handleError","type":"boolean","default":"true"}]},"rets":{"ret":{"text":"If handleError is false, the error message (if any).","name":"","type":"string"}}},"example":{"description":"Compiles and runs `print(\"test\")`.","code":"RunString([[print(\"test\")]])","output":"test"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"RunStringEx","parent":"Global","type":"libraryfunc","description":{"text":"Alias of Global.RunString.","deprecated":"Use Global.RunString instead."},"realm":"Shared and Menu","args":{"arg":[{"text":"The code to execute.","name":"code","type":"string"},{"text":"The name that should appear in any error messages caused by this code.","name":"identifier","type":"string","default":"RunString"},{"text":"If false, this function will return a string containing any error messages instead of throwing an error.","name":"handleError","type":"boolean","default":"true"}]},"rets":{"ret":{"text":"If handleError is false, the error message (if any).","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SafeRemoveEntity","parent":"Global","type":"libraryfunc","description":"Removes the given entity unless it is a player or the world entity.","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"270-L279"},"args":{"arg":{"text":"Entity to safely remove.","name":"ent","type":"Entity"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SafeRemoveEntityDelayed","parent":"Global","type":"libraryfunc","description":"Removes entity after delay using Global.SafeRemoveEntity.","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"281-L290"},"args":{"arg":[{"text":"Entity to be removed.","name":"entity","type":"Entity"},{"text":"Delay for entity removal in seconds.","name":"delay","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"cat":"global","function":{"name":"SaveAddonPresets","parent":"Global","type":"libraryfunc","description":"Sets the content of `addonpresets.txt` located in the `garrysmod/settings` folder. By default, this file stores your addon presets as JSON.\n\nYou can use Global.LoadAddonPresets to retrieve the data in this file.","realm":"Menu","args":{"arg":{"text":"The new contents of the file.","name":"JSON","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"SaveHideNews","parent":"Global","type":"libraryfunc","description":{"text":"Hides the News List when set to true.","internal":"","note":"If you call this don't forget to call Global.LoadNewsList to update the News List."},"realm":"Menu","file":{"text":"lua/menu/mainmenu.lua","line":"309-L311"},"args":{"arg":{"text":"true if it should hide the News.","name":"hide","type":"boolean"}}},"example":{"description":"Manually Hides the News List.","code":"cookie.Set( \"hide_newslist\", \"true\" )"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"SaveLastMap","parent":"Global","type":"libraryfunc","description":{"text":"This function is used to save the last map and category to which the map belongs as a .","internal":""},"realm":"Menu","file":{"text":"lua/menu/getmaps.lua","line":"441-L449"},"args":{"arg":[{"text":"The name of the map.","name":"map","type":"string"},{"text":"The name of the category to which this map belongs.","name":"category","type":"string"}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"SavePresets","parent":"Global","type":"libraryfunc","description":{"text":"Overwrites all presets with the supplied table. Used by the presets for preset saving","internal":""},"realm":"Client","args":{"arg":{"text":"Presets to be saved","name":"presets","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ScreenScale","parent":"Global","type":"libraryfunc","description":"Returns a number based on the `size` argument and the players' screen width. This is used to scale user interface (UI) elements to be consistently sized and positioned across all screen resolutions.\n\nThe width is scaled in relation to `640x480` resolution, and does **not** take into account non the aspect ratio. See example below for how to adjust for that.\n\nThis function can also be used for scaling font sizes.\n\nSee Global.ScreenScaleH for a function that scales from height.","realm":"Client","file":{"text":"lua/includes/extensions/client/globals.lua","line":"6-L8"},"args":{"arg":{"text":"The position or size you want to scale within 640 pixel wide screen.","name":"size","type":"number"}},"rets":{"ret":{"text":"The scaled number based on the player's screen width.","name":"","type":"number"}}},"example":[{"description":"Prints a scaled number based on the number 96, 400 and 640.","code":"print( ScreenScale( 96 ) )\nprint( ScreenScale( 400 ) )\nprint( ScreenScale( 640 ) )","output":"252, 1050, 1680 (this will differ depending on your screen width. Here the screen width is 1680.)"},{"description":"Adjust for non 4:3 aspect ratios.","code":"print( ScreenScale( 96 ) / ( ScrW() / ScrH() ) )"}],"realms":["Client"],"type":"Function"},
{"function":{"name":"ScreenScaleH","parent":"Global","type":"libraryfunc","file":{"text":"lua/includes/extensions/client/globals.lua","line":"10-L12"},"description":"Returns a number based on the `size` argument and players' screen height. The height is scaled in relation to `640x480` resolution.  This function is primarily used for scaling font sizes.\n\nSee Global.ScreenScale for a function that scales from width.","realm":"Client","added":"2023.08.08","args":{"arg":{"text":"The number you want to scale.","name":"size","type":"number"}},"rets":{"ret":{"text":"The scaled number based on your screen's height.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ScrH","parent":"Global","type":"libraryfunc","description":{"text":"Gets the height of the game's window (in pixels).","note":"ScrH() returns the height from the current viewport, this can be changed via render.SetViewPort, inside Render Targets and cam.Start contexts."},"realm":"Client and Menu","rets":{"ret":{"text":"The height of the game's window in pixels","name":"","type":"number"}}},"example":[{"description":"Prints the Height of the window.","code":"print( ScrH() )","output":"1080 (depends on your screen)."},{"description":"Draws a white box on the top left corner of your screen.","code":"hook.Add( \"HUDPaint\", \"WhiteBox\", function()\n    surface.SetDrawColor( 255, 255, 255, 255 )\n    surface.DrawRect( 0, 0, ScrW() / 2, ScrH() / 2 )\nend )","output":"A white box on the top left corner of your screen."}],"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ScrW","parent":"Global","type":"libraryfunc","description":{"text":"Gets the width of the game's window (in pixels).","note":"ScrW() returns the width from the current viewport, this can be changed via render.SetViewPort, inside Render Targets and cam.Start contexts."},"realm":"Client and Menu","rets":{"ret":{"text":"The width of the game's window in pixels","name":"","type":"number"}}},"example":{"description":"Prints the width of the screen","code":"print( ScrW() )","output":"1920 (depends on your resolution)"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"select","parent":"Global","type":"libraryfunc","description":"Used to select single values from a vararg or get the count of values in it.","realm":"Shared and Menu","args":{"arg":[{"text":"Can be a number or string.\n* If it's a string and starts with \"#\", the function will return the amount of values in the vararg (ignoring the rest of the string).\n* If it's a positive number, the function will return all values starting from the given index.\n* If the number is negative, it will return the amount specified from the end instead of the beginning. This mode will not be compiled by LuaJIT.","name":"parameter","type":"any"},{"text":"The vararg. These are the values from which you want to select.","name":"vararg","type":"vararg"}]},"rets":{"ret":{"text":"Returns a number or vararg, depending on the select method.","name":"","type":"any"}}},"example":[{"description":"This code shows how it works with the \"#\" modifier:","code":"print( select( '#', 'a', true, false, {}, 1 ) )","output":"\"5\", which is the count of parameters passed excluding the modifier (the \"#\")"},{"description":"This prints from the 2nd vararg passed to the last","code":"print( select( 2, 1, 2, 3, 4, 5 ) )","output":"\"2 3 4 5\" in the console"},{"description":"This prints the last 2 arguments passed","code":"print( select( -2, 1, 2, 3, 4, 5 ) )","output":"\"4 5\" in the console"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SendUserMessage","parent":"Global","type":"libraryfunc","description":{"text":"Send a usermessage","deprecated":"This uses the umsg internally, which has been deprecated. Use the net instead.","note":"This does nothing clientside."},"realm":"Shared","file":{"text":"lua/includes/modules/usermessage.lua","line":"11-L39"},"args":{"arg":[{"text":"The name of the usermessage","name":"name","type":"string"},{"text":"Can be a CRecipientFilter, table or Player object.","name":"recipients","type":"any"},{"text":"Data to send in the usermessage","name":"args","type":"vararg"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SentenceDuration","parent":"Global","type":"libraryfunc","description":"Returns approximate duration of a sentence by name. See Global.EmitSentence.","realm":"Shared","added":"2020.04.29","args":{"arg":{"text":"The sentence name.","name":"name","type":"string"}},"rets":{"ret":{"text":"The approximate duration.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ServerLog","parent":"Global","type":"libraryfunc","description":"Prints `ServerLog: PARAM` without a newline, to the server log and console.\n\nAs of June 2022, if `sv_logecho` is set to `0` (defaults to `1`) the message will not print to console and will only be written to the server's log file.","realm":"Server","args":{"arg":{"text":"The value to be printed to console.","name":"parameter","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetClipboardText","parent":"Global","type":"libraryfunc","description":"Adds the given string to the computers clipboard, which can then be pasted in or outside of GMod with Ctrl + V.","realm":"Client and Menu","args":{"arg":{"text":"The text to add to the clipboard.","name":"text","type":"string"}}},"example":{"description":"Sets the clipboards text to \"Hello!\".","code":"SetClipboardText( \"Hello!\" )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"setfenv","parent":"Global","type":"libraryfunc","description":"Sets the environment for a function or a stack level. Can be used to sandbox code.","realm":"Shared and Menu","args":{"arg":[{"text":"The function to set the environment for, or a number representing stack level.","name":"location","type":"function"},{"text":"Table to be used as the the environment.","name":"environment","type":"table"}]},"rets":{"ret":{"text":"The function passed, otherwise nil.","name":"","type":"function"}}},"example":{"description":"Use setfenv to create a sandbox","code":"local sandbox = {}\n\n-- Define a print function in the sandbox\nsandbox.print = function(s)\n\treturn print(\"[Sandbox] \" .. s)\t\nend\n\nlocal sandboxedCode = function()\n\tprint(\"Hello\")\n\tstring.format(\"%s\", \"error please\")\nend\n\n-- change environment for sandboxedCode to the sandbox table\nsetfenv(sandboxedCode, sandbox)\n\nsandboxedCode()","output":"```\n[Sandbox] Hello\n\nScript:11: attempt to index global 'string' (a nil value)\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetGlobal2Angle","parent":"Global","type":"libraryfunc","description":{"text":"Defines an angle to be automatically networked to clients","note":"Running this function clientside will only set it clientside for the client it is called on!"},"realm":"Shared","args":{"arg":[{"text":"Index to identify the global angle with","name":"index","type":"any"},{"text":"Angle to be networked","name":"angle","type":"Angle"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetGlobal2Bool","parent":"Global","type":"libraryfunc","description":{"text":"Defined a boolean to be automatically networked to clients","note":"Running this function clientside will only set it clientside for the client it is called on!"},"realm":"Shared","args":{"arg":[{"text":"Index to identify the global boolean with","name":"index","type":"any"},{"text":"Boolean to be networked","name":"bool","type":"boolean"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetGlobal2Entity","parent":"Global","type":"libraryfunc","description":{"text":"Defines an entity to be automatically networked to clients","note":"Running this function clientside will only set it clientside for the client it is called on!"},"realm":"Shared","args":{"arg":[{"text":"Index to identify the global entity with","name":"index","type":"any"},{"text":"Entity to be networked","name":"ent","type":"Entity"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetGlobal2Float","parent":"Global","type":"libraryfunc","description":{"text":"Defines a floating point number to be automatically networked to clients","warning":"This function has a floating point precision error. Use Global.SetGlobalFloat instead","note":"Running this function clientside will only set it clientside for the client it is called on!"},"realm":"Shared","args":{"arg":[{"text":"Index to identify the global float with","name":"index","type":"any"},{"text":"Float to be networked","name":"float","type":"number"}]}},"example":{"code":"SetGlobal2Float(\"Example\", 3.3)\nprint(GetGlobal2Float(\"Example\"))","output":"3.2999999523163"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetGlobal2Int","parent":"Global","type":"libraryfunc","description":{"text":"Sets an integer that is shared between the server and all clients.","warning":"The integer has a 32 bit limit. Use Global.SetGlobalInt instead","note":"Running this function clientside will only set it clientside for the client it is called on!"},"realm":"Shared","args":{"arg":[{"text":"The unique index to identify the global value with.","name":"index","type":"string"},{"text":"The value to set the global value to","name":"value","type":"number"}]}},"example":{"description":"Sets the current number.","code":"SetGlobal2Int(\"Number\", 4)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetGlobal2String","parent":"Global","type":"libraryfunc","description":{"text":"Defines a string with a maximum of 511 characters to be automatically networked to clients","note":"Running this function clientside will only set it clientside for the client it is called on!"},"realm":"Shared","args":{"arg":[{"text":"Index to identify the global string with","name":"index","type":"any"},{"text":"String to be networked","name":"string","type":"string"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetGlobal2Var","parent":"Global","type":"libraryfunc","description":{"text":"Defines a variable to be automatically networked to clients\n\n\n| Allowed Types   |  \n| --------------- |  \n| Angle           |  \n| Boolean         |  \n| Entity          |  \n| Float           |  \n| Int             |  \n| String          |  \n| Vector          |","warning":"Trying to network a type that is not listed above will result in a nil value!","note":"Running this function clientside will only set it clientside for the client it is called on!"},"realm":"Shared","args":{"arg":[{"text":"Index to identify the global vector with","name":"index","type":"any"},{"text":"Value to be networked","name":"value","type":"any"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetGlobal2Vector","parent":"Global","type":"libraryfunc","description":{"text":"Defines a vector to be automatically networked to clients","note":"Running this function clientside will only set it clientside for the client it is called on!"},"realm":"Shared","args":{"arg":[{"text":"Index to identify the global vector with","name":"index","type":"any"},{"text":"Vector to be networked","name":"vec","type":"Vector"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetGlobalAngle","parent":"Global","type":"libraryfunc","description":{"text":"Defines an angle to be automatically networked to clients","warning":"There's a 4095 slots Network limit. If you need more, consider using the net library or Global.SetGlobal2Angle. You should also consider the fact that you have way too many variables. You can learn more about this limit here: Networking_Usage","note":"Running this function clientside will only set it clientside for the client it is called on!"},"realm":"Shared","args":{"arg":[{"text":"Index to identify the global angle with","name":"index","type":"any"},{"text":"Angle to be networked","name":"angle","type":"Angle"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetGlobalBool","parent":"Global","type":"libraryfunc","description":{"text":"Defined a boolean to be automatically networked to clients","warning":"There's a 4095 slots Network limit. If you need more, consider using the net library or Global.SetGlobal2Bool. You should also consider the fact that you have way too many variables. You can learn more about this limit here: Networking_Usage","note":"Running this function clientside will only set it clientside for the client it is called on!"},"realm":"Shared","args":{"arg":[{"text":"Index to identify the global boolean with","name":"index","type":"any"},{"text":"Boolean to be networked","name":"bool","type":"boolean"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetGlobalEntity","parent":"Global","type":"libraryfunc","description":{"text":"Defines an entity to be automatically networked to clients","warning":"There's a 4095 slots Network limit. If you need more, consider using the net library or Global.SetGlobal2Entity. You should also consider the fact that you have way too many variables. You can learn more about this limit here: Networking_Usage","note":"Running this function clientside will only set it clientside for the client it is called on!"},"realm":"Shared","args":{"arg":[{"text":"Index to identify the global entity with","name":"index","type":"any"},{"text":"Entity to be networked","name":"ent","type":"Entity"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetGlobalFloat","parent":"Global","type":"libraryfunc","description":{"text":"Defines a floating point number to be automatically networked to clients","warning":"There's a 4095 slots Network limit. If you need more, consider using the net library or Global.SetGlobal2Float. You should also consider the fact that you have way too many variables. You can learn more about this limit here: Networking_Usage","note":"Running this function clientside will only set it clientside for the client it is called on!"},"realm":"Shared","args":{"arg":[{"text":"Index to identify the global float with","name":"index","type":"any"},{"text":"Float to be networked","name":"float","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetGlobalInt","parent":"Global","type":"libraryfunc","description":{"text":"Sets an integer that is shared between the server and all clients.","warning":"There's a 4095 slots Network limit. If you need more, consider using the net library or Global.SetGlobal2Int. You should also consider the fact that you have way too many variables. You can learn more about this limit here: Networking_Usage","note":"Running this function clientside will only set it clientside for the client it is called on!","bug":{"text":"This function will not round decimal values as it actually networks a 64 bit float internally.","issue":"3374"}},"realm":"Shared","args":{"arg":[{"text":"The unique index to identify the global value with.","name":"index","type":"string"},{"text":"The value to set the global value to","name":"value","type":"number"}]}},"example":{"description":"Sets the current round number.","code":"SetGlobalInt(\"RoundNumber\", 4)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetGlobalString","parent":"Global","type":"libraryfunc","description":{"text":"Defines a string with a maximum of 199 characters to be automatically networked to clients","warning":"There's a 4095 slots Network limit. If you need more, consider using the net library or Global.SetGlobal2String. You should also consider the fact that you have way too many variables. You can learn more about this limit here: Networking_Usage","note":["If you want to have a higher characters limit use Global.SetGlobal2String","Running this function clientside will only set it clientside for the client it is called on!"]},"realm":"Shared","args":{"arg":[{"text":"Index to identify the global string with","name":"index","type":"any"},{"text":"String to be networked","name":"string","type":"string"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetGlobalVar","parent":"Global","type":"libraryfunc","description":{"text":"Defines a variable to be automatically networked to clients\n\n\n| Allowed Types   |  \n| --------------- |  \n| Angle           |  \n| Boolean         |  \n| Entity          |  \n| Float           |  \n| Int             |  \n| String          |  \n| Vector          |","warning":"Trying to network a type that is not listed above will result in an error!  \nThere's a 4095 slots Network limit. If you need more, consider using the net library or Global.SetGlobal2Var. You should also consider the fact that you have way too many variables. You can learn more about this limit here: Networking_Usage","note":"Running this function clientside will only set it clientside for the client it is called on!"},"realm":"Shared","args":{"arg":[{"text":"Index to identify the global vector with","name":"index","type":"any"},{"text":"Value to be networked","name":"value","type":"any"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetGlobalVector","parent":"Global","type":"libraryfunc","description":{"text":"Defines a vector to be automatically networked to clients","warning":"There's a 4095 slots Network limit. If you need more, consider using the net library or Global.SetGlobal2Vector. You should also consider the fact that you have way too many variables. You can learn more about this limit here: Networking_Usage","note":"Running this function clientside will only set it clientside for the client it is called on!"},"realm":"Shared","args":{"arg":[{"text":"Index to identify the global vector with","name":"index","type":"any"},{"text":"Vector to be networked","name":"vec","type":"Vector"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"setmetatable","parent":"Global","type":"libraryfunc","description":"Sets, changes or removes a table's metatable. Returns Tab (the first argument).","realm":"Shared and Menu","args":{"arg":[{"text":"The table who's metatable to change.","name":"Tab","type":"table"},{"text":"The metatable to assign. \n If it's nil, the metatable will be removed.","name":"Metatable","type":"table"}]},"rets":{"ret":{"text":"The first argument.","name":"","type":"table"}}},"example":{"description":"Creates a metatable and assigns it to a table.","code":"local Pupil_meta = {\n\tGetName = function(self)\n\t\treturn self.name\n\tend\n}\nPupil_meta.__index = Pupil_meta\n-- If a key cannot be found in an object, it will look in it's metatable's __index metamethod.\n\nlocal Pupil = {\n\tname = \"John Doe\"\n}\n\nsetmetatable(Pupil, Pupil_meta)\n\nprint( Pupil:GetName() )\n-- This will look for the \"GetName\" key in Pupil, but it doesn't have one. So it will look in it's metatable (Pupil_meta) __index key instead.","output":"\"John Doe\""},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetPhysConstraintSystem","parent":"Global","type":"libraryfunc","description":"Called by the engine to set which [constraint system](https://developer.valvesoftware.com/wiki/Phys_constraintsystem) the next created constraints should use.","realm":"Shared","args":{"arg":{"text":"Constraint system to use","name":"constraintSystem","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SortedPairs","parent":"Global","type":"libraryfunc","description":"This function can be used in a for loop instead of Global.pairs. It sorts all **keys** alphabetically.\n\nFor sorting by specific **value member**, use Global.SortedPairsByMemberValue.\n\n\nFor sorting by **value**, use Global.SortedPairsByValue.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"552-L576"},"args":{"arg":[{"text":"The table to sort","name":"table","type":"table"},{"text":"Reverse the sorting order","name":"desc","type":"boolean","default":"false"}]},"rets":{"ret":[{"text":"Iterator function","name":"","type":"function"},{"text":"The table being iterated over","name":"","type":"table"}]}},"example":{"description":"Example of usage.","code":"for id, text in SortedPairs({\"e\", \"b\", \"d\", \"c\", \"a\"}) do\n    print(id, text)\nend\n\nprint(\"---\")\n\nfor id, text in SortedPairs({\n    e = 1,\n    b = 2,\n    d = 3,\n    c = 4,\n    a = 5\n}) do\n    print(id, text)\nend","output":"```\n1 e\n2 b\n3 d\n4 c\n5 a\n---\na 5\nb 2\nc 4\nd 3\ne 1\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SortedPairsByMemberValue","parent":"Global","type":"libraryfunc","description":"Returns an iterator function that can be used to loop through a table in order of member values, when the values of the table are also tables and contain that member.\n\nTo sort by **value**, use Global.SortedPairsByValue.\n\n\nTo sort by **keys**, use Global.SortedPairs.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"578-L612"},"args":{"arg":[{"text":"Table to create iterator for.","name":"table","type":"table"},{"text":"Key of the value member to sort by.","name":"memberKey","type":"any"},{"text":"Whether the iterator should iterate in descending order or not.","name":"descending","type":"boolean","default":"false"}]},"rets":{"ret":[{"text":"Iterator function","name":"","type":"function"},{"text":"The table the iterator was created for.","name":"","type":"table"}]}},"example":{"description":"Creates a table and prints its contents in order of the age member descending","code":"local tab = {\n\t{\n\t\tName = \"Adam\",\n\t\tAge = 16\n\t},\n\t{\n\t\tName = \"Charles\",\n\t\tAge = 18\n\t}\n}\n\nfor k, v in SortedPairsByMemberValue(tab, \"Age\", true) do\n\tprint(v.Name)\nend","output":"```\nCharles\nAdam\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SortedPairsByValue","parent":"Global","type":"libraryfunc","description":"Returns an iterator function that can be used to loop through a table in order of its **values**.\n\nTo sort by specific **value member**, use Global.SortedPairsByMemberValue.\n\n\nTo sort by **keys**, use Global.SortedPairs.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"578-L594"},"args":{"arg":[{"text":"Table to create iterator for","name":"table","type":"table"},{"text":"Whether the iterator should iterate in descending order or not","name":"descending","type":"boolean","default":"false"}]},"rets":{"ret":[{"text":"Iterator function","name":"","type":"function"},{"text":"The table which will be iterated over","name":"","type":"table"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Sound","parent":"Global","type":"libraryfunc","description":{"text":"Runs util.PrecacheSound and returns the string.","bug":"util.PrecacheSound does nothing and therefore so does this function."},"realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"158-L164"},"args":{"arg":{"text":"The soundpath to precache.","name":"soundPath","type":"string"}},"rets":{"ret":{"text":"The string passed as the first argument.","name":"","type":"string"}}},"example":{"description":"From [entities/sent_ball.lua](https://github.com/Facepunch/garrysmod/blob/c4a74bebe3113b01aee85501c297530fb8fdfa81/garrysmod/lua/entities/sent_ball.lua#L98-L121).","code":"local BounceSound = Sound( \"garrysmod/balloon_pop_cute.wav\" )\n\nfunction ENT:PhysicsCollide( data, physobj )\n\n\t-- Play sound on bounce\n\tif ( data.Speed > 60 && data.DeltaTime > 0.2 ) then\n\n\t\tlocal pitch = 32 + 128 - math.Clamp( self:GetBallSize(), self.MinSize, self.MaxSize )\n\t\tsound.Play( BounceSound, self:GetPos(), 75, math.random( pitch - 10, pitch + 10 ), math.Clamp( data.Speed / 150, 0, 1 ) )\n\n\tend\n\nend"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SoundDuration","parent":"Global","type":"libraryfunc","description":{"text":"Returns the approximate duration of the specified sound in seconds, for `.wav` and `.mp3` sounds.","bug":"This function only works on mp3 files if the file is encoded with constant bitrate.","note":"This function will not work with sound files prepended with a [sound character](https://developer.valvesoftware.com/wiki/Soundscripts#Sound_Characters)."},"realm":"Shared","args":{"arg":{"text":"The sound file path.","name":"soundName","type":"string"}},"rets":{"ret":{"text":"Sound duration in seconds.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SQLStr","parent":"Global","type":"libraryfunc","description":{"text":"Returns the input value in an escaped form so that it can safely be used inside of queries. The returned value is surrounded by quotes unless `noQuotes` is true. Alias of sql.SQLStr.","warning":"Do not use this function with external database engines such as `MySQL`. `MySQL` and `SQLite` use different escape sequences that are incompatible with each other! Escaping strings with inadequate functions is dangerous and will lead to SQL injection vulnerabilities."},"realm":"Shared and Menu","file":{"text":"lua/includes/util/sql.lua","line":"27-L27"},"args":{"arg":[{"text":"String to be escaped","name":"input","type":"string"},{"text":"Set this as `true`, and the function will not wrap the input string in apostrophes.","name":"noQuotes","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"Escaped input","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SScale","parent":"Global","type":"libraryfunc","description":{"text":"Returns a number based on the Size argument and your screen's width. Alias of Global.ScreenScale.","deprecated":"You should be using Global.ScreenScale instead."},"file":{"text":"lua/includes/extensions/client/globals.lua","line":"14"},"realm":"Client","args":{"arg":{"text":"The number you want to scale.","name":"Size","type":"number"}}},"example":{"description":"Prints a scaled number based on the number 40.","code":"print( SScale( 40 ) )","output":"105 (this will differ depending on your screen size)"},"realms":["Client"],"type":"Function"},
{"function":{"name":"STNDRD","parent":"Global","type":"libraryfunc","description":"Returns the ordinal suffix of a given number.","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"338-L349"},"args":{"arg":{"text":"The number to find the ordinal suffix of.","name":"number","type":"number"}},"rets":{"ret":{"text":"suffix","name":"","type":"string"}}},"example":{"description":"Returns the ordinal suffix of 72.","code":"print( 72 .. STNDRD(72) )","output":"72nd"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SuppressHostEvents","parent":"Global","type":"libraryfunc","description":"Suppress any networking from the server to the specified player. Set this to NULL to stop suppressing network events.\n\nThis is automatically called by the engine before/after a player fires their weapon, reloads, or causes any other similar shared-predicted event to occur.","realm":"Server","args":{"arg":{"text":"The player to suppress any networking to.","name":"suppressPlayer","type":"Player"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SysTime","parent":"Global","type":"libraryfunc","description":"Returns a highly accurate time in seconds since the start up, ideal for benchmarking. Unlike Global.RealTime, this value will be updated any time the function is called, allowing for sub-think precision.","realm":"Shared and Menu","rets":{"ret":{"text":"Uptime of the server.","name":"","type":"number"}}},"example":[{"description":"Prints the runtime.","code":"print(SysTime())","output":"1654.4422888037"},{"description":"Typical usage of this function for benchmarking.","code":"local SysTime = SysTime\nlocal Distance = FindMetaTable(\"Vector\").Distance\n\nlocal vec1 = Vector(1, 2, 3)\nlocal vec2 = Vector(13, 26, -10)\n\nlocal count = 10000\n\nlocal StartTime = SysTime()\n\nfor i = 1, count do\n\t-- Repeat an action 10,000 times to check how long it takes on average\n\t-- Example action:\n\tDistance(vec1 , vec2)\nend\n\nlocal EndTime = SysTime()\nlocal TotalTime = EndTime - StartTime\nlocal AverageTime = TotalTime / count\n\nprint(\"Total: \" .. TotalTime .. \" seconds. Average: \" .. AverageTime .. \" seconds.\")","output":"```\nTotal: 0.0099969995115998 seconds. Average: 9.9969995115998e-07 seconds.\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"TauntCamera","parent":"Global","type":"libraryfunc","description":"Returns a TauntCamera object","realm":"Shared","file":{"text":"gamemodes/base/gamemode/player_class/taunt_camera.lua","line":"14-L126"},"rets":{"ret":{"text":"TauntCamera","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"TextEntryLoseFocus","parent":"Global","type":"libraryfunc","file":{"text":"lua/vgui/dtextentry.lua","line":"415-L437"},"description":"Clears focus from any text entries player may have focused.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"TimedCos","parent":"Global","type":"libraryfunc","description":"Returns a cosine value that fluctuates based on the current time","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"358-L363"},"args":{"arg":[{"text":"The frequency of fluctuation","name":"frequency","type":"number"},{"text":"Minimum value","name":"min","type":"number"},{"text":"Maximum value","name":"max","type":"number"},{"text":"Offset variable that doesn't affect the rate of change, but causes the returned value to be offset by time","name":"offset","type":"number"}]},"rets":{"ret":{"text":"Cosine value","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"TimedSin","parent":"Global","type":"libraryfunc","description":{"text":"Returns a sine value that fluctuates based on Global.CurTime. The value returned will be between the start value plus/minus the range value.","bug":"The range arguments don't work as intended. The existing (bugged) behavior is documented below."},"realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"351-L356"},"args":{"arg":[{"text":"The frequency of fluctuation, in","name":"frequency","type":"number"},{"text":"The center value of the sine wave.","name":"origin","type":"number"},{"text":"This argument's distance from origin defines the size of the full range of the sine wave. For example, if origin is 3 and max is 5, then the full range of the sine wave is 5-3 = 2. 3 is the center point of the sine wave, so the sine wave will range between 2 and 4.","name":"max","type":"number"},{"text":"Offset variable that doesn't affect the rate of change, but causes the returned value to be offset by time","name":"offset","type":"number"}]},"rets":{"ret":{"text":"Sine value","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"tobool","parent":"Global","type":"libraryfunc","description":"Attempts to return an appropriate boolean for the given value","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"304-L310"},"args":{"arg":{"text":"The object to be converted to a boolean","name":"input","type":"any"}},"rets":{"ret":{"text":"* `false` for the boolean `false`.\n* `false` for `\"false\"`.\n* `false` for `\"0\"`.\n* `false` for numeric `0`.\n* `false` for `nil`.\n* `true` otherwise.","name":"","type":"boolean"}}},"example":{"description":"Demonstrate the output of this function with various values.","code":"print(\"boolean true:\", tobool(true))\nprint(\"boolean false:\", tobool(false))\nprint(\"string true:\", tobool(\"true\"))\nprint(\"string false:\", tobool(\"false\"))\nprint(\"numeric 0:\", tobool(0))\nprint(\"string 0:\", tobool(\"0\"))\nprint(\"string 1:\", tobool(\"1\"))\nprint(\"nil:\", tobool(nil))\nprint(\"text string:\", tobool(\"not a boolean\"))\nprint(\"empty string:\", tobool(\"\"))\nprint(\"table:\", tobool({\"stuff\"}))\nprint(\"empty table:\", tobool({}))","output":"```\nboolean true: true\nboolean false: false\nstring true: true\nstring false: false\nnumeric 0: false\nstring 0: false\nstring 1: true\nnil: false\ntext string: true\nempty string: true\ntable: true\nempty table: true\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ToggleFavourite","parent":"Global","type":"libraryfunc","description":"Toggles whether or not the named map is favorited in the new game list.","realm":"Menu","file":{"text":"lua/menu/getmaps.lua","line":"423-439"},"args":{"arg":{"text":"Map to toggle favorite.","name":"map","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"tonumber","parent":"Global","type":"libraryfunc","description":"Converts strings containing numbers into actual numbers.  \n\nCan also convert numbers from other [numerical bases](https://www.mathsisfun.com/numbers/bases.html) to base 10.","realm":"Shared and Menu","args":{"arg":[{"text":"The value to be converted.  \n\nThis string can contain digits from `0` to `9` (inclusive) for numerical bases from `2` to `10` (inclusive), and from `0` to `z` for bases greater than `10`.\n\nThe maximum value depends on the specific base value provided, for example for base 3 `0, 1, 2` are permitted. For base 11, `0-9` and `a` are permitted.","name":"value","type":"string"},{"text":"The numerical base of the digits in the input value.  \n\t\t\tMust be an integer between `2` and `36` (inclusive)","name":"base","type":"number","default":"10"}]},"rets":{"ret":{"text":"The base `10` number representation of the input value, or `nil` if the conversion failed.","name":"","type":"number|nil"}}},"example":[{"name":"String to number","description":"Converts a string into a number","code":"print( tonumber( \"123\" ) )","output":"`123`"},{"name":"Number base conversions","description":"Converts a hexadecimal (base `16`) and a binary (base `2`) string into a base `10` number.","code":"print( tonumber( \"2CA88D\", 16 ) ) -- 2926733\nprint( tonumber( \"10010110\", 2 ) ) -- 150","output":"```\n2926733\n150\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"tostring","parent":"Global","type":"libraryfunc","description":"Attempts to convert the value to a string. If the value is an object and its metatable has defined the __tostring metamethod, this will call that function.\n\nGlobal.print also uses this functionality.","realm":"Shared and Menu","args":{"arg":{"text":"The object to be converted to a string.","name":"value","type":"any"}},"rets":{"ret":{"text":"The string representation of the value.","name":"","type":"string"}}},"example":{"description":"Convert a number to a string.","code":"print(tostring(0x16))","output":"22"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"TranslateDownloadableName","parent":"Global","type":"libraryfunc","description":{"text":"Returns \"Lua Cache File\" if the given file name is in a certain string table, nothing otherwise.","deprecated":"","internal":""},"realm":"Menu","args":{"arg":{"text":"File name to test","name":"filename","type":"string"}},"rets":{"ret":{"text":"\"Lua Cache File\" if the given file name is in a certain string table, nothing otherwise.","name":"","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"type","parent":"Global","type":"libraryfunc","file":{"text":"lua/includes/util.lua","line":"51-L65"},"description":{"text":"Returns a string representing the name of the type of the passed object.","warning":"This will return `table` if the input is Global.Color, consider using Global.IsColor in that case."},"realm":"Shared and Menu","args":{"arg":{"text":"The object to get the type of.","name":"var","type":"any"}},"rets":{"ret":{"text":"The name of the object's type.","name":"","type":"string"}}},"example":[{"description":"Print the name of a few types.","code":"print( type( 2 ) )\nprint( type( \"hai\" ) )\nprint( type( {} ) )\nprint( type( Color( 1, 1, 1 ) ) )","output":"```\nnumber\nstring\ntable\ntable\n```"},{"description":"Returns `no value` if called with 0 arguments/parameters.","code":"print( type() )","output":"no value"},{"description":"A list of code showing how you can use the type function in replacement with any of the `is*` functions. (example being Global.istable, Global.isentity, etc.)","code":"print( type( LocalPlayer() ) )\nprint( type( Vector() ) )\nprint( type( Angle() ) )\nprint( type( Entity( num ) ) ) -- num is the EntIndex for the entity\nprint( type( vgui.Create( \"DFrame\" ) ) )","output":"```\nPlayer\nVector\nAngle\nEntity\nPanel\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"TypeID","parent":"Global","type":"libraryfunc","description":{"text":"Gets the associated type ID of the variable. Unlike Global.type, this does not work with no value - an argument must be provided.","warning":"This will return `TYPE_TABLE` for Color objects.\n\nAll subclasses of Entity will return `TYPE_ENTITY`.","bug":[{"text":"This returns garbage for _LOADLIB objects.","request":"1120"},{"text":"This returns `TYPE_NIL` for protos.","request":"1459"}]},"realm":"Shared","args":{"arg":{"text":"The variable to get the type ID of.","name":"variable","type":"any"}},"rets":{"ret":{"text":"The type ID of the variable. See the Enums/TYPE.","name":"","type":"number"}}},"example":[{"description":"Check the variable return on a few types.","code":"MsgN( TypeID( \"Hello\" ) )\nMsgN( TypeID( function( ) end ) )\nMsgN( TypeID( { } ) )\nMsgN( TypeID( 80 ) )\nMsgN( TypeID( false ) )","output":"```\n4 (TYPE_STRING)\n6 (TYPE_FUNCTION)\n5 (TYPE_TABLE)\n3 (TYPE_NUMBER)\n1 (TYPE_BOOL)\n```"},{"description":"Show output of a vararg.","code":"-- This should output whatever you put in the first argument.\nlocal function Example( ... )\n\tMsgN( TypeID( ... ) )\nend\n\nExample( 1, \"Hello\" ) -- TYPE_NUMBER\nExample( \"Hello\", 1 ) -- TYPE_STRING\n\n-- This should output the table of data in a vararg.\nlocal function Example2( ... )\n\tfor k,v in pairs( { ... } ) do \n\t\tMsgN( TypeID( v ) )\n\tend \nend\n\nExample2( \"Hello\", 1, { } ) -- TYPE_STRING, TYPE_NUMBER, TYPE_TABLE","output":"```\n3 (TYPE_NUMBER)\n4 (TYPE_STRING)\n\n4 (TYPE_STRING)\n3 (TYPE_NUMBER)\n5 (TYPE_TABLE)\n```"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"unpack","parent":"Global","type":"libraryfunc","description":"This function takes a numeric indexed table and return all the members as a vararg. If specified, it will start at the given index and end at end index.","realm":"Shared and Menu","args":{"arg":[{"text":"The table to generate the vararg from.","name":"tbl","type":"table"},{"text":"Which index to start from. Optional.","name":"startIndex","type":"number","default":"1"},{"text":"Which index to end at. Optional, even if you set StartIndex.","name":"endIndex","type":"number","default":"#tbl"}]},"rets":{"ret":{"text":"Output values","name":"","type":"vararg"}}},"example":{"description":"Prints a vararg","code":"print( unpack({\"a\", \"b\", \"c\"}) )","output":"```\n a b c\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"UnPredictedCurTime","parent":"Global","type":"libraryfunc","description":"Returns the current asynchronous in-game time. This will not be synced with the players current clock allowing you to get Global.CurTime without interference from Prediction.","realm":"Shared and Menu","rets":{"ret":{"text":"The asynchronous in-game time.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateAddonDisabledState","parent":"Global","type":"libraryfunc","description":{"text":"This function retrieves the values from Global.GetAddonStatus and passes them to JS(JavaScript).","internal":""},"realm":"Menu","file":{"text":"lua/menu/mainmenu.lua","line":"567-L570"}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"UpdateAddonMapList","parent":"Global","type":"libraryfunc","description":{"text":"This function is called by Global.UpdateMapList to pass the AddonMaps to JS to be used for the Search.","internal":""},"realm":"Menu","file":{"text":"lua/menu/getmaps.lua","line":"271-L278"}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"UpdateGames","parent":"Global","type":"libraryfunc","description":{"text":"Updates the Gamelist.","internal":""},"realm":"Menu","file":{"text":"lua/menu/mainmenu.lua","line":"546-L553"}},"example":{"description":"Manually updating the Game list. This will Visually make all games available, but you won't be able to mount them.","code":"function UpdateGames()\n\tlocal games = engine.GetGames()\n\tfor k, v in ipairs( games ) do\n\t\tv.installed = true\n\t\tv.owned = true\n\tend\n\n\tpnlMainMenu:Call( \"UpdateGames( \" .. util.TableToJSON( games ) .. \")\" )\nend","output":{"image":{"src":"ab571/8dc3893d902f3ff.png","alt":"Mounted game settings"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"UpdateLanguages","parent":"Global","type":"libraryfunc","description":{"text":"This function searches for all available languages and passes them to JS(JavaScript). JS then updates the Language list with the given languages.","internal":""},"realm":"Menu","file":{"text":"lua/menu/mainmenu.lua","line":"523-L532"}},"example":{"description":"This manually changes the Language list to only German.","code":"local languages = {\"de.png\"}\npnlMainMenu:Call( \"UpdateLanguages(\" .. util.TableToJSON( languages ) .. \")\" )","output":{"image":{"src":"ab571/8dc3893c19af903.png","name":"language_settings.png"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"UpdateLoadPanel","parent":"Global","type":"libraryfunc","description":"Runs JavaScript on the loading screen panel (Global.GetLoadPanel).","realm":"Menu","args":{"arg":{"text":"JavaScript to run on the loading panel.","name":"javascript","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"UpdateMapList","parent":"Global","type":"libraryfunc","description":{"text":"This function updates the Map List","internal":"Called from JS when starting a new game"},"realm":"Menu","file":{"text":"lua/menu/getmaps.lua","line":"280-L293"}},"example":[{"description":"Manually updating the Map List with one Category.","code":"--\nlocal mapList = {\n\t[\"Example\"] = {\"gm_flatgrass\", \"gm_construct\"}\n}\n\npnlMainMenu:Call( \"UpdateMaps(\" .. util.TableToJSON(mapList) .. \")\" )","output":{"image":{"src":"ab571/8dc38911e504d0d.png","size":"87584","name":"maplist_example_1.png"}}},{"description":"Manually updating the Map List with an extra Category.","code":"--\nlocal mapList = GetMapList()\nmapList[\"Example\"] = {\"gm_flatgrass\", \"gm_construct\"}\n\npnlMainMenu:Call( \"UpdateMaps(\" .. util.TableToJSON(mapList) .. \")\" )","output":{"image":{"src":"ab571/8dc389128e53d0f.png","size":"91048","name":"maplist_example_2.png"}}}],"realms":["Menu"],"type":"Function"},
{"function":{"name":"UpdateServerSettings","parent":"Global","type":"libraryfunc","description":{"text":"Updates the Server Settings when called.","internal":"Called from JS when starting a new game"},"realm":"Menu","file":{"text":"lua/menu/mainmenu.lua","line":"216-L252"}},"example":{"description":"Updating the Server Setting manually","code":"if !pnlMainMenu then return end -- pnlMainMenu is the Main Menu panel. (https://github.com/Facepunch/garrysmod/blob/master/garrysmod/lua/menu//garrysmod/lua/menu/mainmenu.lua#L468)\n\nlocal settings = {\n\thostname = \"Example\",\n\tsv_lan = 0,\n\tp2p_enabled = 1,\n}\n\npnlMainMenu:Call( \"UpdateServerSettings(\" .. util.TableToJSON( settings ) .. \")\" )","output":{"image":{"src":"ab571/8dc3893a1de4e62.png","name":"start_new_game_settings.png"},"note":"Only the given settings will be displayed and the gamemode settings will be hidden!"}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"UpdateSubscribedAddons","parent":"Global","type":"libraryfunc","description":{"text":"Updates the Addons list.","internal":""},"realm":"Menu","file":{"text":"lua/menu/mainmenu.lua","line":"555-L565"}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"UTIL_IsUselessModel","parent":"Global","type":"libraryfunc","description":{"text":"This function is an alias of Global.IsUselessModel.\n\nReturns whether or not a model is useless by checking that the file path is that of a proper model.\n\nIf the string \".mdl\" is not found in the model name, the function will return true.\n\nThe function will also return true if any of the following strings are found in the given model name:\n* \"_gesture\"\n* \"_anim\"\n* \"_gst\"\n* \"_pst\"\n* \"_shd\"\n* \"_ss\"\n* \"_posture\"\n* \"_anm\"\n* \"ghostanim\"\n* \"_paths\"\n* \"_shared\"\n* \"anim_\"\n* \"gestures_\"\n* \"shared_ragdoll_\"","deprecated":"You should use Global.IsUselessModel instead."},"realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"336"},"args":{"arg":{"text":"The model name to be checked","name":"modelName","type":"string"}},"rets":{"ret":{"text":"Whether or not the model is useless","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ValidPanel","parent":"Global","type":"libraryfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"465-L471"},"description":{"text":"Returns if a panel is safe to use.","deprecated":"You should use Global.IsValid instead"},"realm":"Client and Menu","args":{"arg":{"text":"The panel to validate.","name":"panel","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Vector","parent":"Global","type":"libraryfunc","description":{"text":"Creates a Vector object.","warning":"Creating Vectors is relatively expensive when used in often running hooks or in operations requiring very frequent calls (like loops for example) due to object creation and garbage collection. It is better to store the vector in a variable or to use the [default vectors](https://wiki.facepunch.com/gmod/Global_Variables#misc) available. See Vector:Add."},"realm":"Shared and Menu","args":[{"arg":[{"text":"The x component of the vector.","name":"x","type":"number","default":"0"},{"text":"The y component of the vector.","name":"y","type":"number","default":"0"},{"text":"The z component of the vector.","name":"z","type":"number","default":"0"}]},{"name":"Vector Copy","arg":{"text":"Creates a new Vector that is a copy of the given Vector.","name":"vector","type":"Vector"}},{"name":"Parse String","arg":{"text":"Attempts to parse the input string from the Global.print format of an Vector.\n\n\t\t\tReturns a Vector with its `x`, `y`, and `z` set to `0` if the string cannot be parsed.","name":"vectorString","type":"string"}}],"rets":{"ret":{"text":"The created vector object.","name":"","type":"Vector"}}},"example":{"description":"Creates a vector and prints the value to the console.","code":"print( Vector( 1, 2, 3 ) )\nprint( Vector( \"4 5 6\" ) )\nlocal test = Vector( 7, 8, 9 )\nprint( Vector( test ) )\n\nprint( Vector( \"4 5 test\" ) )\nprint( Vector() )","output":"```\n1.000000 2.000000 3.000000\n4.000000 5.000000 6.000000\n7.000000 8.000000 9.000000\n\n0.000000 0.000000 0.000000\n0.000000 0.000000 0.000000\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"VectorRand","parent":"Global","type":"libraryfunc","description":"Returns a random vector whose components are each between min(inclusive), max(exclusive).","realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"130-L137"},"args":{"arg":[{"text":"Min bound inclusive.","name":"min","type":"number","default":"-1"},{"text":"Max bound exclusive.","name":"max","type":"number","default":"1"}]},"rets":{"ret":{"text":"The random direction vector.","name":"","type":"Vector"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"VGUIFrameTime","parent":"Global","type":"libraryfunc","description":{"text":"Identical to Global.SysTime. On Windows, will be the previous value of Global.SysTime.","deprecated":"Use the function Global.SysTime instead."},"realm":"Shared and Menu"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"VGUIRect","parent":"Global","type":"libraryfunc","description":"Creates and returns a DShape rectangle GUI element with the given dimensions.","realm":"Client","file":{"text":"lua/vgui/dshape.lua","line":"34-L41"},"args":{"arg":[{"text":"X position of the created element","name":"x","type":"number"},{"text":"Y position of the created element","name":"y","type":"number"},{"text":"Width of the created element","name":"w","type":"number"},{"text":"Height of the created element","name":"h","type":"number"}]},"rets":{"ret":{"text":"DShape element","name":"","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"VisualizeLayout","parent":"Global","type":"libraryfunc","description":{"text":"Briefly displays layout details of the given panel on-screen","internal":"Used by the **vgui_visualizelayout** convar"},"realm":"Client and Menu","file":{"text":"lua/includes/util/vgui_showlayout.lua","line":"33-L41"},"args":{"arg":{"text":"Panel to display layout details of","name":"panel","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"WorkshopFileBase","parent":"Global","type":"libraryfunc","description":{"text":"Returns a new WorkshopFileBase element","internal":""},"realm":"Client and Menu","file":{"text":"lua/includes/util/workshop_files.lua","line":"6-L282"},"args":{"arg":[{"text":"Namespace for the file base","name":"namespace","type":"string"},{"text":"Tags required for a Workshop submission to be interacted with by the filebase","name":"requiredTags","type":"table"}]},"rets":{"ret":{"text":"WorkshopFileBase element","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"WorldToLocal","parent":"Global","type":"libraryfunc","description":"Translates a worldspace vector and angle into a specific coordinate system.","realm":"Shared","args":{"arg":[{"text":"A worldspace vector.","name":"position","type":"Vector"},{"text":"A worldspace angle.","name":"angle","type":"Angle"},{"text":"The origin of the new coordinate system.","name":"newSystemOrigin","type":"Vector"},{"text":"The angles of the new coordinate system.","name":"newSystemAngles","type":"Angle"}]},"rets":{"ret":[{"text":"The corresponding local space `position`","name":"","type":"Vector"},{"text":"The corresponding local space `angle`","name":"","type":"Angle"}]}},"example":{"description":"A matrix math that shows how this is calculated internally.","code":"local worldTransform = Matrix()\nworldTransform:SetTranslation( position )\nworldTransform:SetAngles( angle )\n\nlocal objectTransform = Matrix()\nobjectTransform:SetTranslation( newSystemOrigin )\nobjectTransform:SetAngles( newSystemAngles )\n\n-- Transform the world coordinates using the object transform as an inverted transformation matrix\nlocal worldToLocal = objectTransform:GetInverse() * worldTransform\n\nprint( worldToLocal:GetTranslation(), worldToLocal:GetAngles() )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"xpcall","parent":"Global","type":"libraryfunc","description":{"text":"Attempts to call the first function. If the execution succeeds, this returns `true` followed by the returns of the function. If execution fails, this returns `false` and the second function is called with the error message. \n\nUnlike in Global.pcall, the stack is not unwound and can therefore be used for stack analyses with the debug.","bug":[{"text":"This cannot stop errors from hooks called from the engine.","issue":"2036"},{"text":"This does not stop Global.Error and Global.ErrorNoHalt (As well as Global.include) from sending error messages to the server (if called clientside) or calling the GM:OnLuaError hook. The success boolean returned will always return true and thus you will not get the error message returned. Global.error does not exhibit these behaviours.","issue":"2498"}]},"realm":"Shared and Menu","args":{"arg":[{"text":"The function to call initially.","name":"func","type":"function"},{"text":"The function to be called if execution of the first fails; the error message is passed as a string.\n\nYou cannot throw an Global.error() from this callback: it will have no effect (not even stopping the callback).","name":"errorCallback","type":"function"},{"text":"Arguments to pass to the initial function.","name":"arguments","type":"vararg"}]},"rets":{"ret":[{"text":"Status of the execution; `true` for success, `false` for failure.","name":"","type":"boolean"},{"text":"The returns of the first function if execution succeeded, otherwise the **first** return value of the error callback.","name":"","type":"vararg"}]}},"example":{"description":"Using xpcall to catch an error.","code":"local function test()\n\taisj()\nend\n\nlocal function catch( err )\n\tprint( \"ERROR: \", err )\nend\n\nprint( \"Output: \", xpcall( test, catch ) )","output":"```\nERROR: \tlua/wiki/xpcall_example.lua:2: attempt to call global 'aisj' (a nil value)\nOutput:\tfalse \tnil\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Add","parent":"Angle","type":"classfunc","description":"Adds the values of the argument angle to the orignal angle. \n\nThis functions the same as angle1 + angle2 without creating a new angle object, skipping object construction and garbage collection.","realm":"Shared and Menu","args":{"arg":{"text":"The angle to add.","name":"angle","type":"Angle"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Div","parent":"Angle","type":"classfunc","description":"Divides all values of the original angle by a scalar. This functions the same as angle1 / num without creating a new angle object, skipping object construction and garbage collection.","realm":"Shared and Menu","args":{"arg":{"text":"The number to divide by.","name":"scalar","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Forward","parent":"Angle","type":"classfunc","description":"Returns a normal vector facing in the direction that the angle points.","realm":"Shared and Menu","rets":{"ret":{"text":"The forward direction of the angle","name":"","type":"Vector"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsEqualTol","parent":"Angle","type":"classfunc","description":"Returns if the angle is equal to another angle with the given tolerance.","realm":"Shared and Menu","added":"2023.08.30","args":{"arg":[{"text":"The angle to compare to.","name":"compare","type":"Angle"},{"text":"The tolerance range for each component.","name":"tolerance","type":"number"}]},"rets":{"ret":{"text":"Are each of the the angle components equal or not within given tolerance.","name":"eq","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsZero","parent":"Angle","type":"classfunc","description":"Returns whether the pitch, yaw and roll are 0 or not.","realm":"Shared and Menu","rets":{"ret":{"text":"Whether the pitch, yaw and roll are 0 or not.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Mul","parent":"Angle","type":"classfunc","description":"Multiplies a scalar to all the values of the orignal angle. This functions the same as num * angle without creating a new angle object, skipping object construction and garbage collection.","realm":"Shared and Menu","args":{"arg":{"text":"The number to multiply.","name":"scalar","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Normalize","parent":"Angle","type":"classfunc","description":"Normalizes the angles by applying a modulo with 360 to pitch, yaw and roll.","realm":"Shared and Menu"},"example":{"description":"Example usage of the function.","code":"local a = Angle( 0, 181, 1 )\na:Normalize()\nprint( a )","output":"0.000 -179.000 1.000"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Random","parent":"Angle","type":"classfunc","description":"Randomizes each element of this Angle object.","realm":"Shared and Menu","added":"2021.12.15","args":{"arg":[{"text":"The minimum value for each component.","name":"min","type":"number","default":"-360"},{"text":"The maximum value for each component.","name":"max","type":"number","default":"360"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Right","parent":"Angle","type":"classfunc","description":"Returns a normal vector facing in the direction that points right relative to the angle's direction.","realm":"Shared and Menu","rets":{"ret":{"text":"The right direction of the angle","name":"","type":"Vector"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"RotateAroundAxis","parent":"Angle","type":"classfunc","description":"Rotates the angle around the specified axis by the specified degrees.","realm":"Shared and Menu","args":{"arg":[{"text":"The axis to rotate around as a normalized unit vector. When argument is not a unit vector, you will experience numerical offset errors in the rotated angle.","name":"axis","type":"Vector"},{"text":"The degrees to rotate around the specified axis.","name":"rotation","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Set","parent":"Angle","type":"classfunc","description":"Copies pitch, yaw and roll from the second angle to the first.","realm":"Shared and Menu","args":{"arg":{"text":"The angle to copy the values from.","name":"originalAngle","type":"Angle"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetUnpacked","parent":"Angle","type":"classfunc","description":"Sets the p, y, and r of the angle.","realm":"Shared and Menu","args":{"arg":[{"text":"The pitch component of the Angle","name":"p","type":"number"},{"text":"The yaw component of the Angle","name":"y","type":"number"},{"text":"The roll component of the Angle","name":"r","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SnapTo","parent":"Angle","type":"classfunc","description":{"text":"Snaps the angle to nearest interval of degrees.","note":"This will modify the original angle too!"},"realm":"Shared","file":{"text":"lua/includes/extensions/angle.lua","line":"5-L18"},"args":{"arg":[{"text":"The component/axis to snap. Can be either `p`/`pitch`, `y`/`yaw` or `r`/`roll`.","name":"axis","type":"string"},{"text":"The target angle snap interval","name":"target","type":"number"}]},"rets":{"ret":{"text":"The snapped angle.","name":"","type":"Angle"}}},"example":{"description":"Example usage","code":"print( Angle( 0, 92, 0 ):SnapTo( \"y\", 90 ) )\nprint( Angle( 0, 115, 0 ):SnapTo( \"y\", 45 ) )\nprint( Angle( 12, 98, 167 ):SnapTo( \"p\", 30 ):SnapTo( \"y\", 45 ):SnapTo( \"r\", 45 ) )","output":"```\nAngle( 0, 90, 0 )\nAngle( 0, 135, 0 )\nAngle( 0, 90, -180 )\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Sub","parent":"Angle","type":"classfunc","description":"Subtracts the values of the argument angle to the orignal angle. This functions the same as angle1 - angle2 without creating a new angle object, skipping object construction and garbage collection.","realm":"Shared and Menu","args":{"arg":{"text":"The angle to subtract.","name":"angle","type":"Angle"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ToTable","parent":"Angle","type":"classfunc","description":"Returns the angle as a table with three elements.","realm":"Shared and Menu","rets":{"ret":{"text":"The table with elements 1 = p, 2 = y, 3 = r.","name":"","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Unpack","parent":"Angle","type":"classfunc","description":"Returns the pitch, yaw, and roll components of the angle.","realm":"Shared and Menu","rets":{"ret":[{"text":"p, pitch, x, or Angle[1].","name":"","type":"number"},{"text":"y, yaw, or Angle[2].","name":"","type":"number"},{"text":"r, roll, r, or Angle[3].","name":"","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Up","parent":"Angle","type":"classfunc","description":"Returns a normal vector facing in the direction that points up relative to the angle's direction.","realm":"Shared and Menu","rets":{"ret":{"text":"The up direction of the angle.","name":"","type":"Vector"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Zero","parent":"Angle","type":"classfunc","description":"Sets pitch, yaw and roll to 0.\nThis function is faster than doing it manually.","realm":"Shared and Menu"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ReadAngle","parent":"bf_read","type":"classfunc","description":"Reads and returns an angle object from the bitstream.","realm":"Client","rets":{"ret":{"text":"The read angle","name":"","type":"Angle"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ReadBool","parent":"bf_read","type":"classfunc","description":"Reads 1 bit and returns a bool representing the bit.","realm":"Client","rets":{"ret":{"text":"bit","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ReadChar","parent":"bf_read","type":"classfunc","description":"Reads a signed char and returns a number from -127 to 127 representing the ascii value of that char.","realm":"Client","rets":{"ret":{"text":"asciiVal","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ReadEntity","parent":"bf_read","type":"classfunc","description":"Reads a short representing an entity index and returns the matching entity handle.","realm":"Client","rets":{"ret":{"text":"ent","name":"","type":"Entity"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ReadFloat","parent":"bf_read","type":"classfunc","description":"Reads a 4 byte float from the bitstream and returns it.","realm":"Client","rets":{"ret":{"text":"float","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ReadLong","parent":"bf_read","type":"classfunc","description":"Reads a 4 byte long from the bitstream and returns it.","realm":"Client","rets":{"ret":{"text":"int","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ReadShort","parent":"bf_read","type":"classfunc","description":"Reads a 2 byte short from the bitstream and returns it.","realm":"Client","rets":{"ret":{"text":"short","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ReadString","parent":"bf_read","type":"classfunc","description":"Reads a null terminated string from the bitstream.","realm":"Client","rets":{"ret":{"text":"str","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ReadVector","parent":"bf_read","type":"classfunc","description":"Reads a special encoded vector from the bitstream and returns it, this function is not suitable to send normals.","realm":"Client","rets":{"ret":{"text":"vec","name":"","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ReadVectorNormal","parent":"bf_read","type":"classfunc","description":"Reads a special encoded vector normal from the bitstream and returns it, this function is not suitable to send vectors that represent a position.","realm":"Client","rets":{"ret":{"text":"normal","name":"","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Reset","parent":"bf_read","type":"classfunc","description":"Rewinds the bitstream so it can be read again.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetAngles","parent":"CEffectData","type":"classfunc","description":"Returns the angles of the effect.","realm":"Shared","rets":{"ret":{"text":"The angles of the effect","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAttachment","parent":"CEffectData","type":"classfunc","description":"Returns the attachment ID for the effect.","realm":"Shared","rets":{"ret":{"text":"The attachment ID of the effect.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetColor","parent":"CEffectData","type":"classfunc","description":"Returns byte which represents the color of the effect.","realm":"Shared","rets":{"ret":{"text":"The color of the effect","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDamageType","parent":"CEffectData","type":"classfunc","description":"Returns the damage type of the effect","realm":"Shared","rets":{"ret":{"text":"Damage type of the effect, see Enums/DMG","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetEntIndex","parent":"CEffectData","type":"classfunc","description":"Returns the entity index of the entity set for the effect.","realm":"Server","rets":{"ret":{"text":"The entity index of the entity set for the effect.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetEntity","parent":"CEffectData","type":"classfunc","description":"Returns the entity assigned to the effect.","realm":"Shared","rets":{"ret":{"text":"The entity assigned to the effect","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetFlags","parent":"CEffectData","type":"classfunc","description":"Returns the flags of the effect.","realm":"Shared","rets":{"ret":{"text":"The flags of the effect.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetHitBox","parent":"CEffectData","type":"classfunc","description":"Returns the hit box ID of the effect.","realm":"Shared","rets":{"ret":{"text":"The hit box ID of the effect.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMagnitude","parent":"CEffectData","type":"classfunc","description":"Returns the magnitude of the effect.","realm":"Shared","rets":{"ret":{"text":"The magnitude of the effect.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMaterialIndex","parent":"CEffectData","type":"classfunc","description":"Returns the material ID of the effect.","realm":"Shared","rets":{"ret":{"text":"The material ID of the effect.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNormal","parent":"CEffectData","type":"classfunc","description":"Returns the normalized direction vector of the effect.","realm":"Shared","rets":{"ret":{"text":"The normalized direction vector of the effect.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetOrigin","parent":"CEffectData","type":"classfunc","description":"Returns the origin position of the effect.","realm":"Shared","rets":{"ret":{"text":"The origin position of the effect.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetRadius","parent":"CEffectData","type":"classfunc","description":"Returns the radius of the effect.","realm":"Shared","rets":{"ret":{"text":"The radius of the effect.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetScale","parent":"CEffectData","type":"classfunc","description":"Returns the scale of the effect.","realm":"Shared","rets":{"ret":{"text":"The scale of the effect","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetStart","parent":"CEffectData","type":"classfunc","description":"Returns the start position of the effect.","realm":"Shared","rets":{"ret":{"text":"The start position of the effect","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSurfaceProp","parent":"CEffectData","type":"classfunc","description":"Returns the surface property index of the effect. See util.GetSurfaceData for more details about what they are.\n\nSee CEffectData:SetSurfaceProp for details about limitations of this function.","realm":"Shared","rets":{"ret":{"text":"The surface property index of the effect.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetAngles","parent":"CEffectData","type":"classfunc","description":"Sets the angles of the effect.","realm":"Shared","args":{"arg":{"text":"The new angles to be set.","name":"ang","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetAttachment","parent":"CEffectData","type":"classfunc","description":{"text":"Sets the attachment id of the effect to be created with this effect data.","note":"This is internally stored as an integer, but only the first 5 bits will be networked, effectively limiting this function to 0-31 range."},"realm":"Shared","args":{"arg":{"text":"New attachment ID of the effect.","name":"attachment","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetColor","parent":"CEffectData","type":"classfunc","description":{"text":"Sets the \"color\" of the effect.\n\nAll this does is provide an addition 8 bits of data for the effect to use. What this will actually do will vary from effect to effect, depending on how a specific effect uses this given data, if at all.","note":"Internally stored as an integer, but only first 8 bits are networked, effectively limiting this function to 0-255 range."},"realm":"Shared","args":{"arg":{"text":"Color represented by a byte.","name":"color","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDamageType","parent":"CEffectData","type":"classfunc","description":"Sets the damage type of the effect to be created with this effect data.","realm":"Shared","args":{"arg":{"text":"Damage type, see Enums/DMG.","name":"damageType","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetEntIndex","parent":"CEffectData","type":"classfunc","description":"Sets the entity of the effect via its index.","realm":"Server","args":{"arg":{"text":"The entity index to be set.","name":"entIndex","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetEntity","parent":"CEffectData","type":"classfunc","description":"Sets the entity of the effect to be created with this effect data.","realm":"Shared","args":{"arg":{"text":"Entity of the effect, mostly used for parenting.","name":"entity","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetFlags","parent":"CEffectData","type":"classfunc","description":{"text":"Sets the flags for the effect. What flags do depends entirely on the effect. See Default Effects.","note":"Internally stored as an integer, but only first 8 bits are networked, effectively limiting this function to `0-255` range."},"realm":"Shared","args":{"arg":{"text":"The flags of the effect. Each effect has their own flags.","name":"flags","type":"number"}}},"example":{"code":"local ef = EffectData()\n      ef:SetEntity( self )\n      ef:SetAttachment( 1 ) -- self:LookupAttachment( \"muzzle\" )\n      ef:SetFlags( 5 ) -- Sets the Combine AR2 Muzzle flash\n\nutil.Effect( \"MuzzleFlash\", ef )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetHitBox","parent":"CEffectData","type":"classfunc","description":{"text":"Sets the hit box index of the effect. Used by various effects for various purposes.","note":"Internally stored as an integer, but only first 11 bits are networked, effectively limiting this function to 0-2047 range."},"realm":"Shared","args":{"arg":{"text":"The hit box index of the effect, for example from Structures/TraceResult#HitBox","name":"hitBoxIndex","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetMagnitude","parent":"CEffectData","type":"classfunc","description":{"text":"Sets the magnitude of the effect.","note":"Internally stored as a float with 12 bit precision for networking purposes, limited to range of 0-1023."},"realm":"Shared","args":{"arg":{"text":"The magnitude of the effect.","name":"magnitude","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetMaterialIndex","parent":"CEffectData","type":"classfunc","description":{"text":"Sets the material index of the effect.","note":"Internally stored as an integer, but only first 12 bits are networked, effectively limiting this function to 0-4095 range."},"realm":"Shared","args":{"arg":{"text":"The material index of the effect.","name":"materialIndex","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNormal","parent":"CEffectData","type":"classfunc","description":"Sets the normalized (length=1) direction vector of the effect to be created with this effect data. This **must** be a normalized vector for networking purposes.","realm":"Shared","args":{"arg":{"text":"The normalized direction vector of the effect.","name":"normal","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetOrigin","parent":"CEffectData","type":"classfunc","description":{"text":"Sets the origin of the effect to be created with this effect data.","note":"Limited to world bounds (+-16386 on every axis) and has horrible networking precision. (17 bit float per component)"},"realm":"Shared","args":{"arg":{"text":"Origin of the effect.","name":"origin","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetRadius","parent":"CEffectData","type":"classfunc","description":{"text":"Sets the radius of the effect to be created with this effect data.","note":"Internally stored as a float, but networked as a 10bit float, and is clamped to 0-1023 range."},"realm":"Shared","args":{"arg":{"text":"Radius of the effect.","name":"radius","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetScale","parent":"CEffectData","type":"classfunc","description":"Sets the scale of the effect to be created with this effect data.","realm":"Shared","args":{"arg":{"text":"Scale of the effect.","name":"scale","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetStart","parent":"CEffectData","type":"classfunc","description":{"text":"Sets the start of the effect to be created with this effect data.","note":"Limited to world bounds (+-16386 on every axis) and has horrible networking precision. (17 bit float per component)"},"realm":"Shared","args":{"arg":{"text":"Start of the effect.","name":"start","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetSurfaceProp","parent":"CEffectData","type":"classfunc","description":{"text":"Sets the surface property index of the effect. See util.GetSurfaceData for more details about what they are.","note":"Internally stored as an integer, but only first 8 bits are networked, effectively limiting this function to `-1`-`254` range. (Yes, that's not a mistake, `-1` signifying an invalid value.)"},"realm":"Shared","args":{"arg":{"text":"The surface property index of the effect.","name":"surfaceProperties","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Add","parent":"CLuaEmitter","type":"classfunc","description":"Creates a new CLuaParticle with the given material and position.","realm":"Client","args":{"arg":[{"text":"The particles material. Can also be an IMaterial.","name":"material","type":"string"},{"text":"The position to spawn the particle on.","name":"position","type":"Vector"}]},"rets":{"ret":{"text":"The created particle, if any.","name":"","type":"CLuaParticle"}}},"example":{"description":"Creates a simple spark particle effect 100 units above where the local player is looking at.","code":"local tr =  LocalPlayer():GetEyeTrace()\nlocal pos = tr.HitPos + tr.HitNormal * 100 -- The origin position of the effect\n\nlocal emitter = ParticleEmitter( pos ) -- Particle emitter in this position\n\nfor i = 0, 100 do -- Do 100 particles\n\tlocal part = emitter:Add( \"effects/spark\", pos ) -- Create a new particle at pos\n\tif ( part ) then\n\t\tpart:SetDieTime( 1 ) -- How long the particle should \"live\"\n\n\t\tpart:SetStartAlpha( 255 ) -- Starting alpha of the particle\n\t\tpart:SetEndAlpha( 0 ) -- Particle size at the end if its lifetime\n\n\t\tpart:SetStartSize( 5 ) -- Starting size\n\t\tpart:SetEndSize( 0 ) -- Size when removed\n\n\t\tpart:SetGravity( Vector( 0, 0, -250 ) ) -- Gravity of the particle\n\t\tpart:SetVelocity( VectorRand() * 50 ) -- Initial velocity of the particle\n\tend\nend\n\nemitter:Finish()"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Draw","parent":"CLuaEmitter","type":"classfunc","description":"Manually renders all particles the emitter has created.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Finish","parent":"CLuaEmitter","type":"classfunc","description":"Removes the emitter, making it no longer usable from Lua. If particles remain, the emitter will be removed when all particles die.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetNumActiveParticles","parent":"CLuaEmitter","type":"classfunc","description":"Returns the amount of active particles of this emitter.","realm":"Client","rets":{"ret":{"text":"The amount of active particles of this emitter","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetPos","parent":"CLuaEmitter","type":"classfunc","description":"Returns the position of this emitter. This is set when creating the emitter with Global.ParticleEmitter.","realm":"Client","rets":{"ret":{"text":"Position of this particle emitter.","name":"","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Is3D","parent":"CLuaEmitter","type":"classfunc","description":"Returns whether this emitter is 3D or not. This is set when creating the emitter with Global.ParticleEmitter.","realm":"Client","rets":{"ret":{"text":"Whether this emitter is 3D or not.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsValid","parent":"CLuaEmitter","type":"classfunc","description":"Returns whether this CLuaEmitter is valid or not.","realm":"Client","rets":{"ret":{"text":"Whether this CLuaEmitter is valid or not.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetBBox","parent":"CLuaEmitter","type":"classfunc","description":"Sets the bounding box for this emitter.\n\nUsually the bounding box is automatically determined by the particles, but this function overrides it.","realm":"Client","args":{"arg":[{"text":"The minimum position of the box","name":"mins","type":"Vector"},{"text":"The maximum position of the box","name":"maxs","type":"Vector"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetNearClip","parent":"CLuaEmitter","type":"classfunc","description":"This function sets the the distance between the render camera and the emitter at which the particles should start fading and at which distance fade ends ( alpha becomes 0 ).","realm":"Client","args":{"arg":[{"text":"Min distance where the alpha becomes 0.","name":"distanceMin","type":"number"},{"text":"Max distance where the alpha starts fading.","name":"distanceMax","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetNoDraw","parent":"CLuaEmitter","type":"classfunc","description":"Prevents all particles of the emitter from automatically drawing.","realm":"Client","args":{"arg":{"text":"Whether we should draw the particles ( false ) or not ( true )","name":"noDraw","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetParticleCullRadius","parent":"CLuaEmitter","type":"classfunc","description":"The function name has not much in common with its actual function, it applies a radius to every particles that affects the building of the bounding box, as it, usually is constructed by the particle that has the lowest x, y and z and the highest x, y and z, this function just adds/subtracts the radius and inflates the bounding box.","realm":"Client","args":{"arg":{"text":"Particle radius.","name":"radius","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetPos","parent":"CLuaEmitter","type":"classfunc","description":"Sets the position of the particle emitter.","realm":"Client","args":{"arg":{"text":"New position.","name":"position","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Approach","parent":"CLuaLocomotion","type":"classfunc","description":"Moves the NextBot incrementally closer to the provided goal location.\n\nEach time this function is called, the NextBot moves towards the goal position passed as an argument by the amount previously set by CLuaLocomotion:SetDesiredSpeed.\n\nTo achieve smooth movement, this function must be called frequently.  \nThis is commonly accomplished by calling it in the ENTITY:Think hook.","realm":"Server","args":{"arg":[{"text":"The vector we want to get to.","name":"goal","type":"Vector"},{"text":"How influential the movement should be, in case of this function being called multiple times in between physical movements of the entity.\n\nIf unsure then set this to `1`.","name":"goalWeight","type":"number"}]}},"example":{"description":"A NextBot follows `Player 1` & shoots `Player 2` (if applicable). The NextBot doesn't require a Navigation Mesh.\n\nNotice that `Approach` is in the Think hook while functions for controlling the bot's animation & orientation are in the RunBehavior hook.","code":"AddCSLuaFile()\n\nENT.Type = \"nextbot\"\nENT.Base = \"base_nextbot\"\n\nif CLIENT then\n\treturn\nend\n\nutil.PrecacheModel( \"models/police.mdl\" )\nutil.PrecacheModel( \"models/combine_soldier.mdl\" )\n\nfunction ENT:Initialize()\n\tself.BotTeam = math.random( 1, 2 )\n\tself:SetCollisionGroup( COLLISION_GROUP_WORLD )\n\tself:SetHealth( 100 )\n\tself:AddFlags( FL_OBJECT )\n\tself:SetNWInt( \"BotTeam\", self.BotTeam )\n\t\n\tif self.BotTeam == 1 then\n\t\tself:SetModel( \"models/police.mdl\" )\n\telse\n\t\tself:SetModel( \"models/combine_soldier.mdl\" )\n\tend\n\n\tself.WeaponMount = self:LookupAttachment( \"anim_attachment_RH\" ) -- The bot's weapon will mount to the bot's hand.\n\tself.WeaponPosition = self:GetAttachment( self.WeaponMount ) -- Before parenting; the bot's weapon will be set to the orientation & position of the bot's hand.\n\n\tself.Weapon = ents.Create( \"prop_dynamic\" ) -- The bot will hold a weapon-looking entity that'll fire bullets on its behalf.\n\tself.Weapon:SetPos( self.WeaponPosition.Pos )\n\tself.Weapon:SetAngles( self.WeaponPosition.Ang )\n\tself.Weapon:SetModel( \"models/weapons/w_smg1.mdl\" )\n\tself.Weapon:Spawn()\n\tself.Weapon:SetParent( self, self.WeaponMount )\n\n\tself:StartActivity( ACT_IDLE_SMG1 )\n\n\tself.head = self:LookupBone( \"ValveBiped.Bip01_Head1\" ) -- The bot's head will be used to simulate vision.\n\tself.Active = true -- Used for breaking loops when the bot dies.\n\n\tself.loco:SetDesiredSpeed( 100 )\nend\n\nfunction ENT:Think()\n\tself.targetLocation = Entity( 1 ) -- Temporary; a different block of code shall determine the bot's target location.\n\tself.targetEnemy = Entity( 2 ) -- Temporary; a different block of code shall determine the bot's enemy in the future.\n\n\tif self.targetLocation then -- If the bot has a target location (i.e., an ally), go for it.\n\t\tself.loco:Approach( self.targetLocation:GetPos(), 1 )\n\tend\n\n\tif IsValid( self.targetEnemy ) then -- If the bot is shooting an enemy while following an ally, its pose parameters must be updated so it animates appropriately.\n\t\tself.faceDir = self:GetForward() -- Where is the bot facing @ this instant?\n\t\tself.moveDir = self:WorldToLocal( self.targetEnemy:GetBonePosition( self.head ) ) -- Where is the bot headed @ this instant? (The bot may be walking sideways as it shoots the enemy while following the ally.)\n\t\tself.yaw = self.moveDir:AngleEx( self.faceDir ) -- What is the difference ≬ these directions?\n\t\t\n\t\tself:SetPoseParameter( \"move_yaw\", self.yaw.yaw )\n\t\tself:SetPoseParameter( \"aim_pitch\", self.yaw.pitch )\n\t\tself:SetPoseParameter( \"aim_yaw\", self.yaw.yaw )\n\t\t\n\t\tself.Weapon:FireBullets( {\n\t\t\tAttacker = self,\n\t\t\tCallback = DisplayTurretDamageInfo,\n\t\t\tDamage = 5,\n\t\t\tForce = 1,\n\t\t\tDistance = 2400,\n\t\t\tHullSize = 1,\n\t\t\tNum = 2,\n\t\t\tTracer = 4,\n\t\t\tAmmoType = \"smg1\",\n\t\t\tTracerName = \"MuzzleEffect\",\n\t\t\tDir = self.Weapon:GetForward(),\n\t\t\tSpread = vector_origin,\n\t\t\tSrc = self.Weapon:GetPos(),\n\t\t\tIgnoreEntity = self\n\t\t}, true )\n\telse -- If the bot is just following an ally, it'll face the ally. Pose parameters will be used to insure that the bot's animation is always consistant with where it's facing vs. where it's moving.\n\t\tself.faceDir = self:GetForward() -- Where is the bot facing @ this instant?\n\t\tself.moveDir = self:WorldToLocal( self.targetLocation:GetPos() ) -- Where is the bot headed @ this instant? (The bot may take a few frames to be fully facing its ally.)\n\t\tself.yaw = self.moveDir:AngleEx( self.faceDir ) -- What is the difference ≬ these directions?\n\t\t\n\t\tself:SetPoseParameter( \"move_yaw\", self.yaw.yaw )\n\tend\nend\n\nfunction ENT:RunBehaviour()\n\trepeat\n\t\t-- Now updating the nextbot's animation...\n\t\tif self.targetLocation && self:GetActivity() != ACT_RUN_RIFLE then -- If the bot is chasing something (it has a target) & the bot isn't appropriately animated already...\n\t\t\tself:StartActivity( ACT_RUN_RIFLE ) -- ...set its animation.\n\t\telseif !self.targetLocation && self:GetActivity() != ACT_IDLE_SMG1 then -- Evidentely, the bot isn't chasing anything. If its animation isn't set already...\n\t\t\tself:StartActivity( ACT_IDLE_SMG1 ) -- ...do so now.\n\t\tend\n\n\t\t-- Now updating the nextbot's bearings...\n\t\tif IsValid( self.targetEnemy ) then\n\t\t\tself.loco:FaceTowards( self.targetEnemy:GetPos() ) -- Face the enemy.\n\t\telse\n\t\t\tself.loco:FaceTowards( self.targetLocation:GetPos() ) -- Face the ally.\n\t\tend\n\n\t\tcoroutine.wait( 0.1 )\n\tuntil ( !self.Active )\nend\n\nfunction ENT:OnKilled()\n\tself:StartActivity( ACT_DIERAGDOLL )\n\t\n\tlocal drop = ents.Create( \"weapon_smg1\" )\n\tdrop:SetPos( self.Weapon:GetPos() )\n\tdrop:Spawn()\n\n\tself.Active = false -- The NEXTBOT:RunBehaviour() will now terminate.\n\tself:AddFlags( FL_KILLME )\n\n\tself.Weapon:Remove()\n\tself:Remove()\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"ClearStuck","parent":"CLuaLocomotion","type":"classfunc","description":"Removes the stuck status from the bot","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"FaceTowards","parent":"CLuaLocomotion","type":"classfunc","description":"Sets the direction we want to face","realm":"Server","args":{"arg":{"text":"The vector we want to face","name":"goal","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetAcceleration","parent":"CLuaLocomotion","type":"classfunc","description":"Returns the acceleration speed","realm":"Server","rets":{"ret":{"text":"Current acceleration speed","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetAvoidAllowed","parent":"CLuaLocomotion","type":"classfunc","description":"Returns whether the Nextbot is allowed to avoid obstacles or not.","realm":"Server","added":"2021.12.15","rets":{"ret":{"text":"Whether this bot is allowed to try to avoid obstacles.","name":"allowed","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetClimbAllowed","parent":"CLuaLocomotion","type":"classfunc","description":"Returns whether the Nextbot is allowed to climb or not.","realm":"Server","added":"2021.12.15","rets":{"ret":{"text":"Whether this bot is allowed to climb.","name":"allowed","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetCurrentAcceleration","parent":"CLuaLocomotion","type":"classfunc","description":"Returns the current acceleration as a vector","realm":"Server","rets":{"ret":{"text":"Current acceleration","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetDeathDropHeight","parent":"CLuaLocomotion","type":"classfunc","description":"Gets the height the bot is scared to fall from","realm":"Server","rets":{"ret":{"text":"Current death drop height","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetDeceleration","parent":"CLuaLocomotion","type":"classfunc","description":"Gets the deceleration speed","realm":"Server","rets":{"ret":{"text":"Current deceleration speed","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetDesiredSpeed","parent":"CLuaLocomotion","type":"classfunc","description":"Returns the desired movement speed set by CLuaLocomotion:SetDesiredSpeed","added":"2022.06.08","realm":"Server","rets":{"ret":{"text":"The desired movement speed.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetGravity","parent":"CLuaLocomotion","type":"classfunc","description":"Returns the locomotion's gravity.","realm":"Server","rets":{"ret":{"text":"The gravity.","name":"gravity","type":"number","default":"1000"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetGroundMotionVector","parent":"CLuaLocomotion","type":"classfunc","description":"Return unit vector in XY plane describing our direction of motion - even if we are currently not moving","realm":"Server","rets":{"ret":{"text":"A vector representing the X and Y movement","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetGroundNormal","parent":"CLuaLocomotion","type":"classfunc","description":"Returns the current ground normal.","added":"2022.06.08","realm":"Server","rets":{"ret":{"text":"The current ground normal.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetJumpGapsAllowed","parent":"CLuaLocomotion","type":"classfunc","description":"Returns whether the Nextbot is allowed to jump gaps or not.","realm":"Server","added":"2021.12.15","rets":{"ret":{"text":"Whether this bot is allowed to jump gaps.","name":"allowed","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetJumpHeight","parent":"CLuaLocomotion","type":"classfunc","description":"Gets the height of the bot's jump","realm":"Server","rets":{"ret":{"text":"Current jump height","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetMaxJumpHeight","parent":"CLuaLocomotion","type":"classfunc","description":"Returns maximum jump height of this CLuaLocomotion.","realm":"Server","rets":{"ret":{"text":"The maximum jump height.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetMaxYawRate","parent":"CLuaLocomotion","type":"classfunc","description":"Returns the max rate at which the NextBot can visually rotate.","realm":"Server","rets":{"ret":{"text":"Maximum yaw rate","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetNextBot","parent":"CLuaLocomotion","type":"classfunc","description":"Returns the NextBot this locomotion is associated with.","realm":"Server","rets":{"ret":{"text":"The nextbot","name":"","type":"NextBot"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetStepHeight","parent":"CLuaLocomotion","type":"classfunc","description":"Gets the max height the bot can step up","realm":"Server","rets":{"ret":{"text":"Current step height","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetVelocity","parent":"CLuaLocomotion","type":"classfunc","description":"Returns the current movement velocity as a vector","realm":"Server","rets":{"ret":{"text":"Current velocity","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsAreaTraversable","parent":"CLuaLocomotion","type":"classfunc","description":"Returns whether this CLuaLocomotion can reach and/or traverse/move in given CNavArea.","realm":"Server","args":{"arg":{"text":"The area to test","name":"area","type":"CNavArea"}},"rets":{"ret":{"text":"Whether this CLuaLocomotion can traverse given CNavArea.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsAttemptingToMove","parent":"CLuaLocomotion","type":"classfunc","description":"Returns true if we're trying to move.","realm":"Server","rets":{"ret":{"text":"Whether we're trying to move or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsClimbingOrJumping","parent":"CLuaLocomotion","type":"classfunc","description":"Returns true of the locomotion engine is jumping or climbing","realm":"Server","rets":{"ret":{"text":"Whether we're climbing or jumping or not","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsOnGround","parent":"CLuaLocomotion","type":"classfunc","description":"Returns whether the nextbot this locomotion is attached to is on ground or not.","realm":"Server","rets":{"ret":{"text":"Whether the nextbot is on ground or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsStuck","parent":"CLuaLocomotion","type":"classfunc","description":"Returns true if we're stuck","realm":"Server","rets":{"ret":{"text":"Whether we're stuck or not","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsUsingLadder","parent":"CLuaLocomotion","type":"classfunc","description":"Returns whether or not the target in question is on a ladder or not.","realm":"Server","rets":{"ret":{"text":"If the target is on a ladder or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Jump","parent":"CLuaLocomotion","type":"classfunc","description":"Makes the bot jump. It must be on ground (Entity:IsOnGround) and its model must have `ACT_JUMP` activity.","realm":"Server","args":{"arg":{"text":"The activity to use as the jumping animation.","type":"number","name":"act","default":"ACT_JUMP"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"JumpAcrossGap","parent":"CLuaLocomotion","type":"classfunc","realm":"Server","description":"Makes the bot jump across a gap. The bot must be on ground (Entity:IsOnGround) and its model must have `ACT_JUMP` activity.","args":{"arg":[{"name":"landingGoal","type":"Vector"},{"name":"landingForward","type":"Vector"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetAcceleration","parent":"CLuaLocomotion","type":"classfunc","description":"Sets the acceleration speed","realm":"Server","args":{"arg":{"text":"Speed acceleration","name":"speed","type":"number","default":"400"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetAvoidAllowed","parent":"CLuaLocomotion","type":"classfunc","description":"Sets whether the Nextbot is allowed try to to avoid obstacles or not. This is used during path generation. Works similarly to `nb_allow_avoiding` convar. By default bots are allowed to try to avoid obstacles.","realm":"Server","added":"2021.12.15","args":{"arg":{"text":"Whether this bot should be allowed to try to avoid obstacles.","name":"allowed","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetClimbAllowed","parent":"CLuaLocomotion","type":"classfunc","description":"Sets whether the Nextbot is allowed to climb or not. This is used during path generation. Works similarly to `nb_allow_climbing` convar. By default bots are allowed to climb.","realm":"Server","added":"2021.12.15","args":{"arg":{"text":"Whether this bot should be allowed to climb.","name":"allowed","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetDeathDropHeight","parent":"CLuaLocomotion","type":"classfunc","description":"Sets the height the bot is scared to fall from.","realm":"Server","args":{"arg":{"text":"Height","name":"height","type":"number","default":"200"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetDeceleration","parent":"CLuaLocomotion","type":"classfunc","description":"Sets the deceleration speed.","realm":"Server","args":{"arg":{"text":"New deceleration speed.","name":"deceleration","type":"number","default":"400"}}},"realms":["Server"],"type":"Function"},
{"function":{"text":".","name":"SetDesiredSpeed","parent":"CLuaLocomotion","type":"classfunc","description":"Sets how far the NextBot will need to move each time CLuaLocomotion:Approach is called to move at given speed.\n\nThe default amount is 0. This means the bot will not move if this value has not been set.","realm":"Server","args":{"arg":{"text":"The new desired speed","name":"speed","type":"number","default":"0"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetGravity","parent":"CLuaLocomotion","type":"classfunc","description":{"text":"Sets the locomotion's gravity.","note":"With values 0 or below, or even lower positive values, the nextbot will start to drift sideways, use CLuaLocomotion:SetVelocity to counteract this."},"realm":"Server","args":{"arg":{"text":"New gravity to set.","name":"gravity","type":"number","default":"1000"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetJumpGapsAllowed","parent":"CLuaLocomotion","type":"classfunc","description":"Sets whether the Nextbot is allowed to jump gaps or not. This is used during path generation. Works similarly to `nb_allow_gap_jumping` convar. By default bots are allowed to jump gaps.","realm":"Server","added":"2021.12.15","args":{"arg":{"text":"Whether this bot should be allowed to jump gaps.","name":"allowed","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetJumpHeight","parent":"CLuaLocomotion","type":"classfunc","description":"Sets the height of the bot's jump","realm":"Server","args":{"arg":{"text":"Height","name":"height","type":"number","default":"58"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetMaxYawRate","parent":"CLuaLocomotion","type":"classfunc","description":"Sets the max rate at which the NextBot can visually rotate. This will not affect moving or pathing.","realm":"Server","args":{"arg":{"text":"Desired new maximum yaw rate","name":"yawRate","type":"number","default":"250"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetStepHeight","parent":"CLuaLocomotion","type":"classfunc","description":"Sets the max height the bot can step up","realm":"Server","args":{"arg":{"text":"Height","name":"height","type":"number","default":"18"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetVelocity","parent":"CLuaLocomotion","type":"classfunc","description":"Sets the current movement velocity","realm":"Server","args":{"arg":{"name":"velocity","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetAirResistance","parent":"CLuaParticle","type":"classfunc","description":"Returns the air resistance of the particle.","realm":"Client","rets":{"ret":{"text":"The air resistance of the particle","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetAngles","parent":"CLuaParticle","type":"classfunc","description":"Returns the current orientation of the particle.","realm":"Client","rets":{"ret":{"text":"The angles of the particle","name":"","type":"Angle"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetAngleVelocity","parent":"CLuaParticle","type":"classfunc","description":"Returns the angular velocity of the particle","realm":"Client","rets":{"ret":{"text":"The angular velocity of the particle","name":"","type":"Angle"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetBounce","parent":"CLuaParticle","type":"classfunc","description":"Returns the 'bounciness' of the particle.","realm":"Client","rets":{"ret":{"text":"The 'bounciness' of the particle\n\n2 means it will gain 100% of its previous velocity,\n\n\n1 means it will not lose velocity,\n\n\n0.5 means it will lose half of its velocity with each bounce.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetColor","parent":"CLuaParticle","type":"classfunc","description":"Returns the color of the particle.","realm":"Client","rets":{"ret":[{"text":"Red part of the color","name":"","type":"number"},{"text":"Green part of the color","name":"","type":"number"},{"text":"Blue part of the color","name":"","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetDieTime","parent":"CLuaParticle","type":"classfunc","description":"Returns the amount of time in seconds after which the particle will be destroyed.","realm":"Client","rets":{"ret":{"text":"The amount of time in seconds after which the particle will be destroyed","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetEndAlpha","parent":"CLuaParticle","type":"classfunc","description":"Returns the alpha value that the particle will reach on its death.","realm":"Client","rets":{"ret":{"text":"The alpha value the particle will fade to","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetEndLength","parent":"CLuaParticle","type":"classfunc","description":"Returns the length that the particle will reach on its death.","realm":"Client","rets":{"ret":{"text":"The length the particle will reach","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetEndSize","parent":"CLuaParticle","type":"classfunc","description":"Returns the size that the particle will reach on its death.","realm":"Client","rets":{"ret":{"text":"The size the particle will reach","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetGravity","parent":"CLuaParticle","type":"classfunc","description":"Returns the gravity of the particle.","realm":"Client","rets":{"ret":{"text":"The gravity of the particle.","name":"","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetLifeTime","parent":"CLuaParticle","type":"classfunc","description":"Returns the 'life time' of the particle, how long the particle existed since its creation.\n\nThis value will always be between 0 and CLuaParticle:GetDieTime.\n\n\nIt changes automatically as time goes.\n\nIt can be manipulated using CLuaParticle:SetLifeTime.\n\n\nIf the life time of the particle will be more than CLuaParticle:GetDieTime, it will be removed.","realm":"Client","rets":{"ret":{"text":"How long the particle existed, in seconds.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetMaterial","parent":"CLuaParticle","type":"classfunc","description":"Returns the current material of the particle.","realm":"Client","added":"2020.03.17","rets":{"ret":{"text":"The material.","name":"mat","type":"IMaterial"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetPos","parent":"CLuaParticle","type":"classfunc","description":"Returns the absolute position of the particle.","realm":"Client","rets":{"ret":{"text":"The absolute position of the particle.","name":"","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetRoll","parent":"CLuaParticle","type":"classfunc","description":"Returns the current rotation of the particle in radians, this should only be used for 2D particles.","realm":"Client","rets":{"ret":{"text":"The current rotation of the particle in radians","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetRollDelta","parent":"CLuaParticle","type":"classfunc","description":"Returns the current rotation speed of the particle in radians, this should only be used for 2D particles.","realm":"Client","rets":{"ret":{"text":"The current rotation speed of the particle in radians","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetStartAlpha","parent":"CLuaParticle","type":"classfunc","description":"Returns the alpha value which the particle has when it's created.","realm":"Client","rets":{"ret":{"text":"The alpha value which the particle has when it's created.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetStartLength","parent":"CLuaParticle","type":"classfunc","description":"Returns the length which the particle has when it's created.","realm":"Client","rets":{"ret":{"text":"The length which the particle has when it's created.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetStartSize","parent":"CLuaParticle","type":"classfunc","description":"Returns the size which the particle has when it's created.","realm":"Client","rets":{"ret":{"text":"The size which the particle has when it's created.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetVelocity","parent":"CLuaParticle","type":"classfunc","description":"Returns the current velocity of the particle.","realm":"Client","rets":{"ret":{"text":"The current velocity of the particle.","name":"","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetAirResistance","parent":"CLuaParticle","type":"classfunc","description":"Sets the air resistance of the the particle.","realm":"Client","args":{"arg":{"text":"New air resistance.","name":"airResistance","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetAngles","parent":"CLuaParticle","type":"classfunc","description":"Sets the angles of the particle.","realm":"Client","args":{"arg":{"text":"New angle.","name":"ang","type":"Angle"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetAngleVelocity","parent":"CLuaParticle","type":"classfunc","description":"Sets the angular velocity of the the particle.","realm":"Client","args":{"arg":{"text":"New angular velocity.","name":"angVel","type":"Angle"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetBounce","parent":"CLuaParticle","type":"classfunc","description":"Sets the 'bounciness' of the the particle.","realm":"Client","args":{"arg":{"text":"New 'bounciness' of the particle\n\n2 means it will gain 100% of its previous velocity,\n\n\n1 means it will not lose velocity,\n\n\n0.5 means it will lose half of its velocity with each bounce.","name":"bounce","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetCollide","parent":"CLuaParticle","type":"classfunc","description":"Sets the whether the particle should collide with the world or not.","realm":"Client","args":{"arg":{"text":"Whether the particle should collide with the world or not","name":"shouldCollide","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetCollideCallback","parent":"CLuaParticle","type":"classfunc","description":"Sets the function that gets called whenever the particle collides with the world.","realm":"Client","args":{"arg":{"text":"The collision callback.","name":"collideFunc","type":"function","callback":{"arg":[{"text":"The particle itself","type":"CLuaParticle","name":"particle"},{"text":"Position of the collision","type":"Vector","name":"hitPos"},{"text":"Direction of the collision, perpendicular to the hit surface","type":"Vector","name":"hitNormal"}]}}}},"example":{"description":"Creates an explosion every time an particle collides with something.","code":"MyParticle:SetCollideCallback( function( part, hitpos, hitnormal ) --This is an in-line function\n    local efdata = EffectData() --Grab base EffectData table\n    efdata:SetOrigin( hitpos ) --Sets the origin of it to the hitpos of the particle\n    util.Effect( \"Explosion\", efdata ) --Create the effect\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetColor","parent":"CLuaParticle","type":"classfunc","description":"Sets the color of the particle.","realm":"Client","args":{"arg":[{"text":"The red component.","name":"r","type":"number"},{"text":"The green component.","name":"g","type":"number"},{"text":"The blue component.","name":"b","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetDieTime","parent":"CLuaParticle","type":"classfunc","description":"Sets the time where the particle will be removed.","realm":"Client","args":{"arg":{"text":"The new die time.","name":"dieTime","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetEndAlpha","parent":"CLuaParticle","type":"classfunc","description":"Sets the alpha value of the particle that it will reach when it dies.","realm":"Client","args":{"arg":{"text":"The new alpha value of the particle that it will reach when it dies.","name":"endAlpha","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetEndLength","parent":"CLuaParticle","type":"classfunc","description":"Sets the length of the particle that it will reach when it dies.","realm":"Client","args":{"arg":{"text":"The new length of the particle that it will reach when it dies.","name":"endLength","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetEndSize","parent":"CLuaParticle","type":"classfunc","description":"Sets the size of the particle that it will reach when it dies.","realm":"Client","args":{"arg":{"text":"The new size of the particle that it will reach when it dies.","name":"endSize","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetGravity","parent":"CLuaParticle","type":"classfunc","description":"Sets the directional gravity aka. acceleration of the particle.","realm":"Client","args":{"arg":{"text":"The directional gravity.","name":"gravity","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetLifeTime","parent":"CLuaParticle","type":"classfunc","description":"Sets the 'life time' of the particle, how long the particle existed since its creation.\n\nThis value should always be between 0 and CLuaParticle:GetDieTime.\n\n\nIt changes automatically as time goes.\n\n\nIf the life time of the particle will be more than CLuaParticle:GetDieTime, it will be removed.","realm":"Client","args":{"arg":{"text":"The new life time of the particle.","name":"lifeTime","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetLighting","parent":"CLuaParticle","type":"classfunc","description":"Sets whether the particle should be affected by lighting.","realm":"Client","args":{"arg":{"text":"Whether the particle should be affected by lighting.","name":"useLighting","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetMaterial","parent":"CLuaParticle","type":"classfunc","description":"Sets the material of the particle.","realm":"Client","added":"2020.03.17","args":{"arg":{"text":"The new material to set. Can also be a string.","name":"mat","type":"IMaterial"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetNextThink","parent":"CLuaParticle","type":"classfunc","description":"Sets when the particles think function should be called next, this uses the synchronized server time returned by Global.CurTime.","realm":"Client","args":{"arg":{"text":"Next think time.","name":"nextThink","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetPos","parent":"CLuaParticle","type":"classfunc","description":"Sets the absolute position of the particle.","realm":"Client","args":{"arg":{"text":"The new particle position.","name":"pos","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetRoll","parent":"CLuaParticle","type":"classfunc","description":"Sets the roll of the particle in radians. This should only be used for 2D particles.","realm":"Client","args":{"arg":{"text":"The new rotation of the particle in radians.","name":"roll","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetRollDelta","parent":"CLuaParticle","type":"classfunc","description":"Sets the rotation speed of the particle in radians. This should only be used for 2D particles.","realm":"Client","args":{"arg":{"text":"The new rotation speed of the particle in radians.","name":"rollDelta","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetStartAlpha","parent":"CLuaParticle","type":"classfunc","description":"Sets the initial alpha value of the particle.","realm":"Client","args":{"arg":{"text":"Initial alpha.","name":"startAlpha","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetStartLength","parent":"CLuaParticle","type":"classfunc","description":"Sets the initial length value of the particle.","realm":"Client","args":{"arg":{"text":"Initial length.","name":"startLength","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetStartSize","parent":"CLuaParticle","type":"classfunc","description":"Sets the initial size value of the particle.","realm":"Client","args":{"arg":{"text":"Initial size.","name":"startSize","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetThinkFunction","parent":"CLuaParticle","type":"classfunc","description":"Sets the think function of the particle.","realm":"Client","args":{"arg":{"text":"Think function.","name":"thinkFunc","type":"function","callback":{"arg":{"text":"The particle the think hook is set on","type":"CLuaParticle","name":"particle"}}}}},"example":{"description":"Example on how to use a think function, randomizes the colors of a particle","code":"p:SetNextThink( CurTime() ) -- Makes sure the think hook is used on all particles of the particle emitter\np:SetThinkFunction( function( pa )\n\tpa:SetColor( math.random( 0, 255 ), math.random( 0, 255 ), math.random( 0, 255 ) ) -- Randomize it\n\tpa:SetNextThink( CurTime() ) -- Makes sure the think hook is actually ran.\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetVelocity","parent":"CLuaParticle","type":"classfunc","description":"Sets the velocity of the particle.","realm":"Client","args":{"arg":{"text":"The new velocity of the particle.","name":"vel","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetVelocityScale","parent":"CLuaParticle","type":"classfunc","description":"Automatically scales the length of the particle based on the particle speed, multiplied with CLuaParticle:SetStartLength and CLuaParticle:SetEndLength. Width remains the same as CLuaParticle:SetStartSize and CLuaParticle:SetEndSize.","realm":"Client","args":{"arg":{"text":"Use velocity scaling.","name":"doScale","type":"boolean","default":"false"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddKey","parent":"CMoveData","type":"classfunc","description":"Adds keys to the move data, as if player pressed them.","realm":"Shared","args":{"arg":{"text":"Keys to add, see Enums/IN","name":"keys","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAbsMoveAngles","parent":"CMoveData","type":"classfunc","description":"Gets the aim angle. Seems to be same as CMoveData:GetAngles.","realm":"Shared","rets":{"ret":{"text":"Aiming angle","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAngles","parent":"CMoveData","type":"classfunc","description":"Gets the aim angle. On client is the same as Entity:GetAngles.","realm":"Shared","rets":{"ret":{"text":"Aiming angle","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetButtons","parent":"CMoveData","type":"classfunc","description":"Gets which buttons are down","realm":"Shared","rets":{"ret":{"text":"An integer representing which buttons are down, see Enums/IN","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetConstraintCenter","parent":"CMoveData","type":"classfunc","description":"Returns the center of the player movement constraint. See CMoveData:SetConstraintCenter.","added":"2021.06.09","realm":"Shared","rets":{"ret":{"text":"The constraint origin.","name":"pos","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetConstraintRadius","parent":"CMoveData","type":"classfunc","description":"Returns the radius that constrains the players movement. See CMoveData:SetConstraintRadius.","realm":"Shared","rets":{"ret":{"text":"The constraint radius","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetConstraintSpeedScale","parent":"CMoveData","type":"classfunc","description":"Returns the player movement constraint speed scale. See CMoveData:SetConstraintSpeedScale.","added":"2021.06.09","realm":"Shared","rets":{"ret":{"text":"The constraint speed scale","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetConstraintWidth","parent":"CMoveData","type":"classfunc","description":"Returns the width (distance from the edge of the radius, inward) where the actual movement constraint functions.","added":"2021.06.09","realm":"Shared","rets":{"ret":{"text":"The constraint width","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetFinalIdealVelocity","parent":"CMoveData","type":"classfunc","description":"Returns an internal player movement variable `m_outWishVel`.","added":"2021.06.09","realm":"Shared","rets":{"ret":{"name":"idealVel","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetFinalJumpVelocity","parent":"CMoveData","type":"classfunc","description":"Returns an internal player movement variable `m_outJumpVel`.","added":"2021.06.09","realm":"Shared","rets":{"ret":{"name":"jumpVel","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetFinalStepHeight","parent":"CMoveData","type":"classfunc","description":"Returns an internal player movement variable `m_outStepHeight`.","added":"2021.06.09","realm":"Shared","rets":{"ret":{"name":"stepHeight","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetForwardSpeed","parent":"CMoveData","type":"classfunc","description":"Returns the players forward speed.","realm":"Shared","rets":{"ret":{"text":"speed","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetImpulseCommand","parent":"CMoveData","type":"classfunc","description":"Gets the number passed to \"impulse\" console command","realm":"Shared","rets":{"ret":{"text":"The impulse","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMaxClientSpeed","parent":"CMoveData","type":"classfunc","description":"Returns the maximum client speed of the player","realm":"Shared","rets":{"ret":{"text":"The maximum client speed","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMaxSpeed","parent":"CMoveData","type":"classfunc","description":"Returns the maximum speed of the player.","realm":"Shared","rets":{"ret":{"text":"The maximum speed","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMoveAngles","parent":"CMoveData","type":"classfunc","description":"Returns the angle the player is moving at. For more info, see CMoveData:SetMoveAngles.","realm":"Shared","rets":{"ret":{"text":"The move direction","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetOldAngles","parent":"CMoveData","type":"classfunc","description":"Gets the aim angle. Only works clientside, server returns same as CMoveData:GetAngles.","realm":"Shared","rets":{"ret":{"text":"The aim angle","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetOldButtons","parent":"CMoveData","type":"classfunc","description":"Get which buttons were down last frame","realm":"Shared","rets":{"ret":{"text":"An integer representing which buttons were down, see Enums/IN","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetOrigin","parent":"CMoveData","type":"classfunc","description":"Gets the player's position.","realm":"Shared","rets":{"ret":{"text":"The player's position.","name":"","type":"Vector"}}},"example":{"description":"Print's the players position.","code":"function GM:SetupMove( ply, movedata )\n    print( movedata:GetOrigin() )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSideSpeed","parent":"CMoveData","type":"classfunc","description":"Returns the strafe speed of the player.","realm":"Shared","rets":{"ret":{"text":"speed","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetUpSpeed","parent":"CMoveData","type":"classfunc","description":"Returns the vertical speed of the player. ( Z axis of CMoveData:GetVelocity )","realm":"Shared","rets":{"ret":{"text":"Vertical speed","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetVelocity","parent":"CMoveData","type":"classfunc","description":{"text":"Gets the players velocity.","bug":{"text":"This will return Vector(0,0,0) sometimes when walking on props.","issue":"3413"}},"realm":"Shared","rets":{"ret":{"text":"The players velocity","name":"","type":"Vector"}}},"example":{"description":"Prints the player's velocity.","code":"function GM:Move( ply, movedata )\n    print( movedata:GetVelocity() )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"KeyDown","parent":"CMoveData","type":"classfunc","description":"Returns whether the key is down or not","realm":"Shared","args":{"arg":{"text":"The key to test, see Enums/IN","name":"key","type":"number"}},"rets":{"ret":{"text":"Is the key down or not","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"KeyPressed","parent":"CMoveData","type":"classfunc","description":"Returns whether the key was pressed. If you want to check if the key is held down, try CMoveData:KeyDown","realm":"Shared","args":{"arg":{"text":"The key to test, see Enums/IN","name":"key","type":"number"}},"rets":{"ret":{"text":"Was the key pressed or not.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"KeyReleased","parent":"CMoveData","type":"classfunc","description":"Returns whether the key was released","realm":"Shared","args":{"arg":{"text":"A key to test, see Enums/IN","name":"key","type":"number"}},"rets":{"ret":{"text":"Was the key released or not.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"KeyWasDown","parent":"CMoveData","type":"classfunc","description":"Returns whether the key was down or not.\n\n\n\n\nUnlike CMoveData:KeyDown, it will return false if CMoveData:KeyPressed is true and it will return true if CMoveData:KeyReleased is true.","realm":"Shared","args":{"arg":{"text":"The key to test, see Enums/IN","name":"key","type":"number"}},"rets":{"ret":{"text":"Was the key down or not","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetAbsMoveAngles","parent":"CMoveData","type":"classfunc","description":"Sets absolute move angles.( ? ) Doesn't seem to do anything.","realm":"Shared","args":{"arg":{"text":"New absolute move angles","name":"ang","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetAngles","parent":"CMoveData","type":"classfunc","description":{"text":"Sets angles.","bug":{"text":"This function does nothing.","issue":"2382"}},"realm":"Shared","args":{"arg":{"text":"The angles.","name":"ang","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetButtons","parent":"CMoveData","type":"classfunc","description":"Sets the pressed buttons on the move data","realm":"Shared","args":{"arg":{"text":"A number representing which buttons are down, see Enums/IN","name":"buttons","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetConstraintCenter","parent":"CMoveData","type":"classfunc","description":"Sets the center of the player movement constraint. See CMoveData:SetConstraintRadius.","added":"2021.06.09","realm":"Shared","args":{"arg":{"text":"The constraint origin.","name":"pos","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetConstraintRadius","parent":"CMoveData","type":"classfunc","description":"Sets the radius that constrains the players movement.\n\nWorks with conjunction of:\n* CMoveData:SetConstraintWidth\n* CMoveData:SetConstraintSpeedScale\n* CMoveData:SetConstraintCenter","realm":"Shared","args":{"arg":{"text":"The new constraint radius","name":"radius","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetConstraintSpeedScale","parent":"CMoveData","type":"classfunc","description":"Sets the player movement constraint speed scale. This will be applied to the player within the constraint radius when approaching its edge.","added":"2021.06.09","realm":"Shared","args":{"arg":{"text":"The constraint speed scale","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetConstraintWidth","parent":"CMoveData","type":"classfunc","description":"Sets  the width (distance from the edge of the radius, inward) where the actual movement constraint functions.","added":"2021.06.09","realm":"Shared","args":{"arg":{"text":"The constraint width","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetFinalIdealVelocity","parent":"CMoveData","type":"classfunc","description":"Sets an internal player movement variable `m_outWishVel`.","added":"2021.06.09","realm":"Shared","args":{"arg":{"name":"idealVel","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetFinalJumpVelocity","parent":"CMoveData","type":"classfunc","description":"Sets an internal player movement variable `m_outJumpVel`.","added":"2021.06.09","realm":"Shared","args":{"arg":{"name":"jumpVel","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetFinalStepHeight","parent":"CMoveData","type":"classfunc","description":"Sets an internal player movement variable `m_outStepHeight`.","added":"2021.06.09","realm":"Shared","args":{"arg":{"name":"stepHeight","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetForwardSpeed","parent":"CMoveData","type":"classfunc","description":"Sets players forward speed.","realm":"Shared","args":{"arg":{"text":"New forward speed","name":"speed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetImpulseCommand","parent":"CMoveData","type":"classfunc","description":"Sets the impulse command. This isn't actually utilised in the engine anywhere.","realm":"Shared","args":{"arg":{"text":"The impulse to set","name":"impulse","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetMaxClientSpeed","parent":"CMoveData","type":"classfunc","description":{"text":"Sets the maximum player speed. Player won't be able to run or sprint faster then this value.\n\n\nThis also automatically sets CMoveData:SetMaxSpeed when used in the GM:SetupMove hook. You must set it manually in the GM:Move hook.\n\n\nThis must be called on both client and server to avoid prediction errors.\n\n\nThis will **not** reduce speed in air.","note":"Setting this to 0 will not make the player stationary. It won't do anything."},"realm":"Shared","args":{"arg":{"text":"The new maximum speed","name":"maxSpeed","type":"number"}}},"example":[{"description":"Doesn't let the player to run or sprint faster than 100 units per second.","code":"hook.Add(\"SetupMove\",\"MySpeed\", function( ply, mv )\n    mv:SetMaxClientSpeed( 100 )\nend )"},{"description":"Doubles the players speed properly.","code":"hook.Add( \"Move\", \"testestst\", function( ply, mv, usrcmd )\n\tlocal speed = mv:GetMaxSpeed() * 2\n\tmv:SetMaxSpeed( speed )\n\tmv:SetMaxClientSpeed( speed )\nend )"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetMaxSpeed","parent":"CMoveData","type":"classfunc","description":"Sets the maximum speed of the player. This must match with CMoveData:SetMaxClientSpeed both, on server and client.\n\n\nDoesn't seem to be doing anything on it's own, use CMoveData:SetMaxClientSpeed instead.","realm":"Shared","args":{"arg":{"text":"The new maximum speed","name":"maxSpeed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetMoveAngles","parent":"CMoveData","type":"classfunc","description":"Sets the serverside move angles, making the movement keys act as if player was facing that direction.\n\nThis function is predicted, and should be called shared with matching data on client and server.","realm":"Shared","args":{"arg":{"text":"The aim direction.","name":"dir","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetOldAngles","parent":"CMoveData","type":"classfunc","description":"Sets old aim angles. ( ? ) Doesn't seem to be doing anything.","realm":"Shared","args":{"arg":{"text":"The old angles","name":"aimAng","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetOldButtons","parent":"CMoveData","type":"classfunc","description":"Sets the 'old' pressed buttons on the move data. These buttons are used to work out which buttons have been released, which have just been pressed and which are being held down.","realm":"Shared","args":{"arg":{"text":"A number representing which buttons were down, see Enums/IN","name":"buttons","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetOrigin","parent":"CMoveData","type":"classfunc","description":"Sets the players position.","realm":"Shared","args":{"arg":{"text":"The position","name":"pos","type":"Vector"}}},"example":{"description":"Make the player freeze at the origin of the map.","code":"function GM:SetupMove( ply, movedata )\n    movedata:SetOrigin( vector_origin )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetSideSpeed","parent":"CMoveData","type":"classfunc","description":"Sets players strafe speed.","realm":"Shared","args":{"arg":{"text":"Strafe speed","name":"speed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetUpSpeed","parent":"CMoveData","type":"classfunc","description":"Sets vertical speed of the player. ( Z axis of CMoveData:SetVelocity )","realm":"Shared","args":{"arg":{"text":"Vertical speed to set","name":"speed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetVelocity","parent":"CMoveData","type":"classfunc","description":"Sets the player's velocity","realm":"Shared","args":{"arg":{"text":"The velocity to set","name":"velocity","type":"Vector"}}},"example":{"description":"Make the player shake to hell and back.","code":"function GM:SetupMove( ply, movedata )\n    movedata:SetVelocity( VectorRand() * 800 )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddAttributes","parent":"CNavArea","type":"classfunc","description":"Adds given attributes to given CNavArea. See CNavArea:HasAttributes and CNavArea:SetAttributes.","realm":"Server","added":"2023.10.05","args":{"arg":{"text":"The attributes to add, as a bitflag. See Enums/NAV_MESH.","name":"attribs","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddHidingSpot","parent":"CNavArea","type":"classfunc","description":"Adds a hiding spot onto this nav area.\n\nThere's a limit of 255 hiding spots per area.","realm":"Server","args":{"arg":[{"text":"The position on the nav area","name":"pos","type":"Vector"},{"text":"Flags describing what kind of hiding spot this is.\n* 0 = None (Not recommended)\n* 1 = In Cover/basically a hiding spot, in a corner with good hard cover nearby\n* 2 = good sniper spot, had at least one decent sniping corridor\n* 4 = perfect sniper spot, can see either very far, or a large area, or both\n* 8 = exposed, spot in the open, usually on a ledge or cliff\n\nValues over 255 will be clamped.","name":"flags","type":"number","default":"7"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddToClosedList","parent":"CNavArea","type":"classfunc","description":"Adds this CNavArea to the closed list, a list of areas that have been checked by A* pathfinding algorithm.\n\nUsed in pathfinding via the [A* algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm).\n\n\nMore information can be found on the Simple Pathfinding page.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddToOpenList","parent":"CNavArea","type":"classfunc","description":"Adds this CNavArea to the Open List.\n\nUsed in pathfinding via the [A* algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm).\n\n\nMore information can be found on the Simple Pathfinding page.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"ClearSearchLists","parent":"CNavArea","type":"classfunc","description":"Clears the open and closed lists for a new search.\n\nUsed in pathfinding via the [A* algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm).\n\n\nMore information can be found on the Simple Pathfinding page.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"ComputeAdjacentConnectionHeightChange","parent":"CNavArea","type":"classfunc","description":"Returns the height difference between the edges of two connected navareas.","realm":"Server","args":{"arg":{"name":"navarea","type":"CNavArea"}},"rets":{"ret":{"text":"The height change","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ComputeDirection","parent":"CNavArea","type":"classfunc","description":"Returns the Enums/NavDir direction that the given vector faces on this CNavArea.","realm":"Server","args":{"arg":{"text":"The position to compute direction towards.","name":"pos","type":"Vector"}},"rets":{"ret":{"text":"The direction the vector is in relation to this CNavArea. See Enums/NavDir.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ComputeGroundHeightChange","parent":"CNavArea","type":"classfunc","description":"Returns the height difference on the Z axis of the two CNavAreas. This is calculated from the center most point on both CNavAreas.","realm":"Server","args":{"arg":{"text":"The nav area to test against.","name":"navArea","type":"CNavArea"}},"rets":{"ret":{"text":"The ground height change.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ConnectTo","parent":"CNavArea","type":"classfunc","description":"Connects this CNavArea to another CNavArea or CNavLadder with a one way connection. ( From this area to the target )\n\nSee CNavLadder:ConnectTo for making the connection from ladder to area.","realm":"Server","args":{"arg":{"text":"The CNavArea or CNavLadder this area leads to.","name":"area","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Contains","parent":"CNavArea","type":"classfunc","description":"Returns true if this CNavArea contains the given vector.","realm":"Server","args":{"arg":{"text":"The position to test.","name":"pos","type":"Vector"}},"rets":{"ret":{"text":"True if the vector was inside and false otherwise.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Disconnect","parent":"CNavArea","type":"classfunc","description":"Disconnects this nav area from given area or ladder. (Only disconnects one way)","realm":"Server","args":{"arg":{"text":"The CNavArea or CNavLadder this to disconnect from.","name":"area","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Draw","parent":"CNavArea","type":"classfunc","description":"Draws this navarea on debug overlay. (So limitations of debugoverlay library apply)","realm":"Server"},"example":{"description":"Draws every navarea on debug overlay. Careful, this will get laggy fast.","code":"if ( SERVER ) then\nlocal LastDraw = 0\nhook.Add( \"Think\", \"DrawAllNavAreas\", function()\n\tif ( CurTime() - LastDraw < 0.100 ) then return end\n\tLastDraw = CurTime()\n\n\tfor id, area in pairs( navmesh.GetAllNavAreas() ) do\n\t\tarea:Draw()\n\tend\nend )\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"DrawSpots","parent":"CNavArea","type":"classfunc","description":"Draws the hiding spots on debug overlay. This includes sniper/exposed spots too!","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetAdjacentAreaDistances","parent":"CNavArea","type":"classfunc","description":"Returns a list of all the CNavAreas that have a (one and two way) connection **from** this CNavArea and their pre-computed distances.\n\nIf an area has a one-way incoming connection to this CNavArea, then it will **not** be returned from this function, use CNavArea:GetIncomingConnectionDistances to get all one-way incoming connections.","added":"2023.10.18","realm":"Server","args":{"arg":{"text":"If set, will only return areas in the specified direction. See Enums/NavDir.","name":"dir","type":"number","default":"nil"}},"rets":{"ret":{"text":"A list of tables in the following format:\n* CNavArea **area** - the area that is connected to this area.\n* number **dist** - Distance from the area to this area.\n* number **dir** - Direction in which the area is in relative to this area.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetAdjacentAreas","parent":"CNavArea","type":"classfunc","description":"Returns a list of all the CNavAreas that have a  (one and two way) connection **from** this CNavArea.\n\nIf an area has a one-way incoming connection to this CNavArea, then it will **not** be returned from this function, use CNavArea:GetIncomingConnections to get all one-way incoming connections.\n\nSee CNavArea:GetAdjacentAreasAtSide for a function that only returns areas from one side/direction.","realm":"Server","rets":{"ret":{"text":"A list of all CNavArea that have a (one and two way) connection **from** this CNavArea. \n\nReturns an empty table if this area has no outgoing connections to any other areas.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetAdjacentAreasAtSide","parent":"CNavArea","type":"classfunc","description":"Returns a table of all the CNavAreas that have a ( one and two way ) connection **from** this CNavArea in given direction.\n\nIf an area has a one-way incoming connection to this CNavArea, then it will **not** be returned from this function, use CNavArea:GetIncomingConnections to get all incoming connections.\n\nSee CNavArea:GetAdjacentAreas for a function that returns all areas from all sides/directions.","realm":"Server","args":{"arg":{"text":"The direction, in which to look for CNavAreas, see Enums/NavDir.","name":"navDir","type":"number"}},"rets":{"ret":{"text":"A table of all CNavArea that have a ( one and two way ) connection **from** this CNavArea in given direction.\n\nReturns an empty table if this area has no outgoing connections to any other areas in given direction.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetAdjacentCount","parent":"CNavArea","type":"classfunc","description":"Returns the amount of CNavAreas that have a connection ( one and two way ) **from** this CNavArea.\n\nSee CNavArea:GetAdjacentCountAtSide for a function that only returns area count from one side/direction.","realm":"Server","rets":{"ret":{"text":"The amount of CNavAreas that have a connection ( one and two way ) **from** this CNavArea.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetAdjacentCountAtSide","parent":"CNavArea","type":"classfunc","description":"Returns the amount of CNavAreas that have a connection ( one or two way ) **from** this CNavArea in given direction.\n\nSee CNavArea:GetAdjacentCount for a function that returns CNavArea count from/in all sides/directions.","realm":"Server","args":{"arg":{"text":"The direction, in which to look for CNavAreas, see Enums/NavDir.","name":"navDir","type":"number"}},"rets":{"ret":{"text":"The amount of CNavAreas that have a connection ( one or two way ) **from** this CNavArea in given direction.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetAttributes","parent":"CNavArea","type":"classfunc","description":"Returns the attribute mask for the given CNavArea.","realm":"Server","rets":{"ret":{"text":"Attribute mask for this CNavArea, see Enums/NAV_MESH for the specific flags.","name":"","type":"number","note":"A navmesh that was generated with nav_quicksave set to 1 will have all CNavAreas attribute masks set to 0"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetCenter","parent":"CNavArea","type":"classfunc","description":"Returns the center most vector point for the given CNavArea.","realm":"Server","rets":{"ret":{"text":"The center vector.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetClosestPointOnArea","parent":"CNavArea","type":"classfunc","description":"Returns the closest point of this Nav Area from the given position.","realm":"Server","args":{"arg":{"text":"The given position, can be outside of the Nav Area bounds.","name":"pos","type":"Vector"}},"rets":{"ret":{"text":"The closest position on this Nav Area.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetCorner","parent":"CNavArea","type":"classfunc","description":"Returns the vector position of the corner for the given CNavArea.","realm":"Server","args":{"arg":{"text":"The target corner to get the position of, takes Enums/NavCorner.","name":"cornerid","type":"number"}},"rets":{"ret":{"text":"The corner position.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetCostSoFar","parent":"CNavArea","type":"classfunc","description":"Returns the cost from starting area this area when pathfinding. Set by CNavArea:SetCostSoFar.\n\nUsed in pathfinding via the [A* algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm).\n\n\nMore information can be found on the Simple Pathfinding page.","realm":"Server","rets":{"ret":{"text":"The cost so far.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetExposedSpots","parent":"CNavArea","type":"classfunc","description":"Returns a table of very bad hiding spots in this area.\n\nSee also CNavArea:GetHidingSpots.","realm":"Server","rets":{"ret":{"text":"A table of Vectors","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetExtentInfo","parent":"CNavArea","type":"classfunc","description":"Returns size info about the nav area.","realm":"Server","rets":{"ret":{"text":"Returns a table containing the following keys:\n* Vector hi - \"Maxs\" of the nav area in world space\n* Vector lo - \"Mins\" of the nav area in world space\n* number SizeX - Size on the X axis\n* number SizeY - Size on the Y axis\n* number SizeZ - Size of the Z axis","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetHidingSpots","parent":"CNavArea","type":"classfunc","description":"Returns a table of good hiding spots in this area.\n\nSee also CNavArea:GetExposedSpots.","realm":"Server","args":{"arg":{"text":"The type of spots to include.\n\n* 0 = None (Not recommended)\n* 1 = In Cover/basically a hiding spot, in a corner with good hard cover nearby\n* 2 = good sniper spot, had at least one decent sniping corridor\n* 4 = perfect sniper spot, can see either very far, or a large area, or both\n* 8 = exposed, spot in the open, usually on a ledge or cliff, same as GetExposedSpots\n* Values over 255 and below 0 will be clamped.","name":"type","type":"number","default":"1"}},"rets":{"ret":{"text":"A table of Vectors","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetID","parent":"CNavArea","type":"classfunc","description":"Returns this CNavAreas unique ID.","realm":"Server","rets":{"ret":{"text":"The unique ID.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetIncomingConnectionDistances","parent":"CNavArea","type":"classfunc","description":"Returns a table of all the CNavAreas that have a one-way connection **to** this CNavArea and their pre-computed distances.\n\nIf a CNavArea has a two-way connection **to or from** this CNavArea then it will not be returned from this function, use CNavArea:GetAdjacentAreaDistances to get outgoing (one and two way) connections.","added":"2023.10.18","realm":"Server","args":{"arg":{"text":"If set, will only return areas in the specified direction. See Enums/NavDir.","name":"dir","type":"number","default":"nil"}},"rets":{"ret":{"text":"A list of tables in the following format:\n* CNavArea **area** - the area that is connected to this area.\n* number **dist** - Distance from the area to this area.\n* number **dir** - Direction in which the area is in relative to this area.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetIncomingConnections","parent":"CNavArea","type":"classfunc","description":"Returns a table of all the CNavAreas that have a one-way connection **to** this CNavArea.\n\nIf a CNavArea has a two-way connection **to or from** this CNavArea then it will not be returned from this function, use CNavArea:GetAdjacentAreas to get outgoing ( one and two way ) connections.\n\nSee CNavArea:GetIncomingConnectionsAtSide for a function that returns one-way incoming connections from  only one side/direction.","realm":"Server","rets":{"ret":{"text":"A table of all CNavAreas with one-way connection **to** this CNavArea.\n\nReturns an empty table if there are no one-way incoming connections **to** this CNavArea.","name":"","type":"table<CNavArea>"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetIncomingConnectionsAtSide","parent":"CNavArea","type":"classfunc","description":"Returns a table of all the CNavAreas that have a one-way connection **to** this CNavArea from given direction.\n\nIf a CNavArea has a two-way connection **to or from** this CNavArea then it will not be returned from this function, use CNavArea:GetAdjacentAreas to get outgoing ( one and two way ) connections.\n\nSee CNavArea:GetIncomingConnections for a function that returns one-way incoming connections from  all sides/directions.","realm":"Server","args":{"arg":{"text":"The direction, from which to look for CNavAreas, see Enums/NavDir.","name":"navDir","type":"number"}},"rets":{"ret":{"text":"A table of all CNavAreas with one-way connection **to** this CNavArea from given direction.\n\nReturns an empty table if there are no one-way incoming connections **to** this CNavArea from given direction.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetLadders","parent":"CNavArea","type":"classfunc","description":"Returns all CNavLadders that have a ( one or two way ) connection **from** this CNavArea.\n\nSee CNavArea:GetLaddersAtSide for a function that only returns CNavLadders in given direction.","realm":"Server","rets":{"ret":{"text":"The CNavLadders that have a ( one or two way ) connection **from** this CNavArea.","name":"","type":"table<CNavLadder>"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetLaddersAtSide","parent":"CNavArea","type":"classfunc","description":"Returns all CNavLadders that have a ( one or two way ) connection **from** ( one and two way ) this CNavArea in given direction.\n\nSee CNavArea:GetLadders for a function that returns CNavLadder from/in all sides/directions.","realm":"Server","args":{"arg":{"text":"The direction, in which to look for CNavLadders.\n\n0 = Up ( LadderDirectionType::LADDER_UP )\n1 = Down ( LadderDirectionType::LADDER_DOWN )","name":"navDir","type":"number"}},"rets":{"ret":{"text":"The CNavLadders that have a ( one or two way ) connection **from** this CNavArea in given direction.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetParent","parent":"CNavArea","type":"classfunc","description":"Returns the parent CNavArea","realm":"Server","rets":{"ret":{"text":"The parent CNavArea","name":"","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetParentHow","parent":"CNavArea","type":"classfunc","description":"Returns how this CNavArea is connected to its parent.","realm":"Server","rets":{"ret":{"text":"See Enums/NavTraverseType","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetPlace","parent":"CNavArea","type":"classfunc","description":"Returns the Place of the nav area.","realm":"Server","rets":{"ret":{"text":"The place of the nav area, or no value if it doesn't have a place set.","name":"","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetRandomAdjacentAreaAtSide","parent":"CNavArea","type":"classfunc","description":"Returns a random CNavArea that has an outgoing ( one or two way ) connection **from** this CNavArea in given direction.","realm":"Server","args":{"arg":{"text":"The direction, in which to look for CNavAreas, see Enums/NavDir.","name":"navDir","type":"number"}},"rets":{"ret":{"text":"The random CNavArea that has an outgoing ( one or two way ) connection **from** this CNavArea in given direction, if any.","name":"","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetRandomPoint","parent":"CNavArea","type":"classfunc","description":"Returns a random point on the nav area.","realm":"Server","rets":{"ret":{"text":"The random point on the nav area.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetSizeX","parent":"CNavArea","type":"classfunc","description":"Returns the width this Nav Area.","realm":"Server","rets":{"ret":{"name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetSizeY","parent":"CNavArea","type":"classfunc","description":"Returns the height of this Nav Area.","realm":"Server","rets":{"ret":{"name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetSpotEncounters","parent":"CNavArea","type":"classfunc","description":"Returns all possible path segments through a CNavArea, and the dangerous spots to look at as we traverse that path segment.","added":"2023.06.28","realm":"Server","rets":{"ret":{"text":"A sequential list of spot encounters in the following format:\n* CNavArea **from** - What CNavArea the path segment is coming from\n* Vector **from_pos** - Origin position of the path segment\n* number **from_dir** - Source Enums/NavDir direction of the path segment\n* CNavArea **to** - What CNavArea the path segment is going towards\n* Vector **to_pos** - Target position of the path segment\n* number **to_dir** - Target Enums/NavDir direction of the path segment\n* table **spots** - List of spots to look at, a sequential list of the following structures:\n  * Vector **pos** - Position of the spot\n  * table **flags** - Type of spot this is\n  * CNavArea **area** - The nav area the spot belongs to","name":"encounters","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetTotalCost","parent":"CNavArea","type":"classfunc","description":"Returns the total cost when passing from starting area to the goal area through this node. Set by CNavArea:SetTotalCost.\n\nUsed in pathfinding via the [A* algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm).\n\n\nMore information can be found on the Simple Pathfinding page.","realm":"Server","rets":{"ret":{"text":"The total cost","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetVisibleAreas","parent":"CNavArea","type":"classfunc","description":"Returns all CNavAreas that are visible from this CNavArea.","added":"2023.06.28","realm":"Server","rets":{"ret":{"text":"A sequential table containing all CNavAreas that are visible from this CNavArea.","name":"areas","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetZ","parent":"CNavArea","type":"classfunc","description":"Returns the elevation of this Nav Area at the given position.","realm":"Server","args":{"arg":{"text":"The position to get the elevation from, the z value from this position is ignored and only the X and Y values are used to this task.","name":"pos","type":"Vector"}},"rets":{"ret":{"text":"The elevation.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"HasAttributes","parent":"CNavArea","type":"classfunc","description":"Returns true if the given CNavArea has this attribute flag set.","realm":"Server","args":{"arg":{"text":"Attribute mask to check for, see Enums/NAV_MESH","name":"attribs","type":"number"}},"rets":{"ret":{"text":"True if the CNavArea matches the given mask. False otherwise.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsBlocked","parent":"CNavArea","type":"classfunc","description":"Returns whether the nav area is blocked or not, i.e. whether it can be walked through or not.","realm":"Server","args":{"arg":[{"text":"The team ID to test, -2 = any team.\n\nOnly 2 actual teams are available, 0 and 1.","name":"teamID","type":"number","default":"-2"},{"text":"Whether to ignore [func_nav_blocker](https://developer.valvesoftware.com/wiki/Func_nav_blocker) entities.","name":"ignoreNavBlockers","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"Whether the area is blocked or not","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsClosed","parent":"CNavArea","type":"classfunc","description":"Returns whether this node is in the Closed List.\n\nUsed in pathfinding via the [A* algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm).\n\n\nMore information can be found on the Simple Pathfinding page.","realm":"Server","rets":{"ret":{"text":"Whether this node is in the Closed List.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsCompletelyVisible","parent":"CNavArea","type":"classfunc","description":"Returns whether this CNavArea can completely (i.e. all corners of this area can see all corners of the given area) see the given CNavArea.","realm":"Server","added":"2020.08.12","args":{"arg":{"text":"The CNavArea to test.","name":"area","type":"CNavArea"}},"rets":{"ret":{"text":"Whether the given area is visible from this area","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsConnected","parent":"CNavArea","type":"classfunc","description":"Returns whether this CNavArea has an outgoing ( one or two way ) connection **to** given CNavArea.\n\nSee CNavArea:IsConnectedAtSide for a function that only checks for outgoing connections in one direction.","realm":"Server","args":{"arg":{"text":"The CNavArea to test against.","name":"navArea","type":"CNavArea"}},"rets":{"ret":{"text":"Whether this CNavArea has an outgoing ( one or two way ) connection **to** given CNavArea.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsConnectedAtSide","parent":"CNavArea","type":"classfunc","description":"Returns whether this CNavArea has an outgoing ( one or two way ) connection **to** given CNavArea in given direction.\n\nSee CNavArea:IsConnected for a function that checks all sides.","realm":"Server","args":{"arg":[{"text":"The CNavArea to test against.","name":"navArea","type":"CNavArea"},{"text":"The direction, in which to look for the connection. See Enums/NavDir","name":"navDirType","type":"number"}]},"rets":{"ret":{"text":"Whether this CNavArea has an outgoing ( one or two way ) connection **to** given CNavArea in given direction.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsCoplanar","parent":"CNavArea","type":"classfunc","description":"Returns whether this Nav Area is in the same plane as the given one.","realm":"Server","args":{"arg":{"text":"The Nav Area to test.","name":"navArea","type":"CNavArea"}},"rets":{"ret":{"text":"Whether we're coplanar or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsDamaging","parent":"CNavArea","type":"classfunc","description":"Returns whether the CNavArea would damage if traversed, as set by CNavArea:MarkAsDamaging.","realm":"Server","added":"2023.09.06","rets":{"ret":{"text":"Whether the area is damaging or not","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsFlat","parent":"CNavArea","type":"classfunc","description":"Returns whether this Nav Area is flat within the tolerance of the **nav_coplanar_slope_limit_displacement** and **nav_coplanar_slope_limit** convars.","realm":"Server","rets":{"ret":{"text":"Whether this CNavArea is mostly flat.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsOpen","parent":"CNavArea","type":"classfunc","description":"Returns whether this area is in the Open List.\n\nUsed in pathfinding via the [A* algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm).\n\n\nMore information can be found on the Simple Pathfinding page.","realm":"Server","rets":{"ret":{"text":"Whether this area is in the Open List.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsOpenListEmpty","parent":"CNavArea","type":"classfunc","description":"Returns whether the Open List is empty or not.\n\nUsed in pathfinding via the [A* algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm).\n\n\nMore information can be found on the Simple Pathfinding page.","realm":"Server","rets":{"ret":{"text":"Whether the Open List is empty or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsOverlapping","parent":"CNavArea","type":"classfunc","description":"Returns if this position overlaps the Nav Area within the given tolerance.","realm":"Server","args":{"arg":[{"text":"The overlapping position to test.","name":"pos","type":"Vector"},{"text":"The tolerance of the overlapping, set to 0 for no tolerance.","name":"tolerance","type":"number","default":"0"}]},"rets":{"ret":{"text":"Whether the given position overlaps the Nav Area or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsOverlappingArea","parent":"CNavArea","type":"classfunc","description":"Returns true if this CNavArea is overlapping the given CNavArea.","realm":"Server","args":{"arg":{"text":"The CNavArea to test against.","name":"navArea","type":"CNavArea"}},"rets":{"ret":{"text":"True if the given CNavArea overlaps this CNavArea at any point.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsPartiallyVisible","parent":"CNavArea","type":"classfunc","description":"Returns whether this CNavArea can see given position.","realm":"Server","added":"2020.08.12","args":{"arg":[{"text":"The position to test.","name":"pos","type":"Vector"},{"text":"If set, the given entity will be ignored when doing LOS tests","name":"ignoreEnt","type":"Entity","default":"NULL"}]},"rets":{"ret":{"text":"Whether the given position is visible from this area","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsPotentiallyVisible","parent":"CNavArea","type":"classfunc","description":"Returns whether this CNavArea can potentially see the given CNavArea.","realm":"Server","added":"2020.08.12","args":{"arg":{"text":"The CNavArea to test.","name":"area","type":"CNavArea"}},"rets":{"ret":{"text":"Whether the given area is visible from this area","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsRoughlySquare","parent":"CNavArea","type":"classfunc","description":"Returns if we're shaped like a square.","realm":"Server","rets":{"ret":{"text":"If we're a square or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsUnderwater","parent":"CNavArea","type":"classfunc","description":"Whether this Nav Area is placed underwater.","realm":"Server","rets":{"ret":{"text":"Whether we're underwater or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsValid","parent":"CNavArea","type":"classfunc","description":"Returns whether this CNavArea is valid or not.","realm":"Server","rets":{"ret":{"text":"Whether this CNavArea is valid or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsVisible","parent":"CNavArea","type":"classfunc","description":"Returns whether we can be seen from the given position.","realm":"Server","args":{"arg":{"text":"The position to check.","name":"pos","type":"Vector"}},"rets":{"ret":[{"text":"Whether we can be seen or not.","name":"","type":"boolean"},{"text":"If we can be seen, this is returned with either the center or one of the corners of the Nav Area.","name":"","type":"Vector"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"MarkAsBlocked","parent":"CNavArea","type":"classfunc","description":"Marks the area as blocked and unable to be traversed. See CNavArea:IsBlocked and CNavArea:MarkAsUnblocked.","realm":"Server","added":"2023.10.05","args":{"arg":{"text":"TeamID to mark the area as blocked for. `-2` means all teams. Only 2 valid teamIDs are supported: `0` and `1`.","name":"teamID","type":"number","default":"-2"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"MarkAsDamaging","parent":"CNavArea","type":"classfunc","description":"Marks the area as damaging if traversed, for example when, for example having poisonous or no atmosphere, or a temporary fire present. See CNavArea:IsDamaging.","realm":"Server","added":"2023.09.06","args":{"arg":{"text":"For how long the area should stay marked as damaging. Multiple calls will overwrite the previous value.","name":"duration","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"MarkAsUnblocked","parent":"CNavArea","type":"classfunc","description":"Unblocked this area if it was previously blocked by CNavArea:MarkAsBlocked.","realm":"Server","added":"2023.10.05","args":{"arg":{"text":"TeamID to unblock the area for. `-2` means all teams. Only 2 valid teamIDs are supported: `0` and `1`.","name":"teamID","type":"number","default":"-2"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlaceOnGround","parent":"CNavArea","type":"classfunc","description":"Drops a corner or all corners of a CNavArea to the ground below it.","realm":"Server","args":{"arg":{"text":"The corner(s) to drop, uses Enums/NavCorner","name":"corner","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PopOpenList","parent":"CNavArea","type":"classfunc","description":"Removes a CNavArea from the Open List with the lowest cost to traverse to from the starting node, and returns it.\n\nUsed in pathfinding via the [A* algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm).\n\n\nMore information can be found on the Simple Pathfinding page.","realm":"Server","rets":{"ret":{"text":"The CNavArea from the Open List with the lowest cost to traverse to from the starting node.","name":"","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Remove","parent":"CNavArea","type":"classfunc","description":"Removes the given nav area.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"RemoveAttributes","parent":"CNavArea","type":"classfunc","description":"Removes given attributes from given CNavArea. See also CNavArea:SetAttributes.","realm":"Server","added":"2023.10.05","args":{"arg":{"text":"The attributes to remove, as a bitflag. See Enums/NAV_MESH.","name":"attribs","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"RemoveFromClosedList","parent":"CNavArea","type":"classfunc","description":{"text":"Removes this node from the Closed List.\n\nUsed in pathfinding via the [A* algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm).\n\n\nMore information can be found on the Simple Pathfinding page.","deprecated":"Does nothing"},"realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetAttributes","parent":"CNavArea","type":"classfunc","description":"Sets the attributes for given CNavArea. See CNavArea:HasAttributes.","realm":"Server","args":{"arg":{"text":"The attributes to set, as a bitflag. See Enums/NAV_MESH.","name":"attribs","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetCorner","parent":"CNavArea","type":"classfunc","description":"Sets the position of a corner of a nav area.","realm":"Server","args":{"arg":[{"text":"The corner to set, uses Enums/NavCorner","name":"corner","type":"number"},{"text":"The new position to set.","name":"position","type":"Vector"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetCostSoFar","parent":"CNavArea","type":"classfunc","description":"Sets the cost from starting area this area when pathfinding.\n\nUsed in pathfinding via the [A* algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm).\n\n\nMore information can be found on the Simple Pathfinding page.","realm":"Server","args":{"arg":{"text":"The cost so far","name":"cost","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetParent","parent":"CNavArea","type":"classfunc","description":"Sets the new parent of this CNavArea.","realm":"Server","args":{"arg":[{"text":"The new parent to set","name":"parent","type":"CNavArea"},{"text":"How we get from parent to us using Enums/NavTraverseType","name":"how","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetPlace","parent":"CNavArea","type":"classfunc","description":"Sets the Place of the nav area.\n\nThere is a limit of 256 unique places per `.nav` file.","realm":"Server","args":{"arg":{"text":"Set to `\"\"` to remove place from the nav area. There's a limit of 255 characters.","name":"place","type":"string"}},"rets":{"ret":{"text":"Returns true of operation succeeded, false otherwise.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetTotalCost","parent":"CNavArea","type":"classfunc","description":"Sets the total cost when passing from starting area to the goal area through this node.\n\nUsed in pathfinding via the [A* algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm).\n\n\nMore information can be found on the Simple Pathfinding page.","realm":"Server","args":{"arg":{"text":"The total cost of the path to set.\n\nMust be above or equal 0.","name":"cost","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"UpdateOnOpenList","parent":"CNavArea","type":"classfunc","description":"Moves this open list to appropriate position based on its CNavArea:GetTotalCost compared to the total cost of other areas in the open list.\n\nUsed in pathfinding via the [A* algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm).\n\n\nMore information can be found on the Simple Pathfinding page.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"ConnectTo","parent":"CNavLadder","type":"classfunc","description":"Connects this ladder to a CNavArea with a one way connection. ( From this ladder to the target area ).\n\nSee CNavArea:ConnectTo for making the connection from area to ladder.","realm":"Server","args":{"arg":{"text":"The area this ladder leads to.","name":"area","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Disconnect","parent":"CNavLadder","type":"classfunc","description":"Disconnects this ladder from given area in a single direction.","realm":"Server","args":{"arg":{"text":"The CNavArea this to disconnect from.","name":"area","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetBottom","parent":"CNavLadder","type":"classfunc","description":"Returns the bottom most position of the ladder.","realm":"Server","rets":{"ret":{"text":"The bottom most position of the ladder.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetBottomArea","parent":"CNavLadder","type":"classfunc","description":"Returns the bottom area of the CNavLadder.","realm":"Server","rets":{"ret":{"name":"","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetID","parent":"CNavLadder","type":"classfunc","description":"Returns this CNavLadders unique ID.","realm":"Server","rets":{"ret":{"text":"The unique ID.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetLength","parent":"CNavLadder","type":"classfunc","description":"Returns the length of the ladder.","realm":"Server","rets":{"ret":{"text":"The length of the ladder.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetNormal","parent":"CNavLadder","type":"classfunc","description":"Returns the direction of this CNavLadder. ( The direction in which players back will be facing if they are looking directly at the ladder )","realm":"Server","rets":{"ret":{"text":"The direction of this CNavLadder.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetPosAtHeight","parent":"CNavLadder","type":"classfunc","description":"Returns the world position based on given height relative to the ladder.","realm":"Server","args":{"arg":{"text":"The Z position in world space coordinates.","name":"height","type":"number"}},"rets":{"ret":{"text":"The closest point on the ladder to that height.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetTop","parent":"CNavLadder","type":"classfunc","description":"Returns the topmost position of the ladder.","realm":"Server","rets":{"ret":{"text":"The topmost position of the ladder.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetTopBehindArea","parent":"CNavLadder","type":"classfunc","description":"Returns the top behind CNavArea of the CNavLadder.","realm":"Server","rets":{"ret":{"text":"The top behind CNavArea of the CNavLadder.","name":"","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetTopForwardArea","parent":"CNavLadder","type":"classfunc","description":"Returns the top forward CNavArea of the CNavLadder.","realm":"Server","rets":{"ret":{"text":"The top forward CNavArea of the CNavLadder.","name":"","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetTopLeftArea","parent":"CNavLadder","type":"classfunc","description":"Returns the top left CNavArea of the CNavLadder.","realm":"Server","rets":{"ret":{"text":"The top left CNavArea of the CNavLadder.","name":"","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetTopRightArea","parent":"CNavLadder","type":"classfunc","description":"Returns the top right CNavArea of the CNavLadder.","realm":"Server","rets":{"ret":{"text":"The top right CNavArea of the CNavLadder.","name":"","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetWidth","parent":"CNavLadder","type":"classfunc","description":"Returns the width of the ladder in Hammer Units.","realm":"Server","rets":{"ret":{"text":"The width of the ladder in Hammer Units.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsConnectedAtSide","parent":"CNavLadder","type":"classfunc","description":"Returns whether this CNavLadder has an outgoing ( one or two way ) connection **to** given CNavArea in given direction.","realm":"Server","args":{"arg":[{"text":"The CNavArea to test against.","name":"navArea","type":"CNavArea"},{"text":"The direction, in which to look for the connection. See Enums/NavDir","name":"navDirType","type":"number"}]},"rets":{"ret":{"text":"Whether this CNavLadder has an outgoing ( one or two way ) connection **to** given CNavArea in given direction.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsValid","parent":"CNavLadder","type":"classfunc","description":"Returns whether this CNavLadder is valid or not.","realm":"Server","rets":{"ret":{"text":"Whether this CNavLadder is valid or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Remove","parent":"CNavLadder","type":"classfunc","description":"Removes the given nav ladder.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetBottomArea","parent":"CNavLadder","type":"classfunc","description":"Sets the bottom area of the CNavLadder.","realm":"Server","args":{"arg":{"name":"area","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetTopBehindArea","parent":"CNavLadder","type":"classfunc","description":"Sets the top behind area of the CNavLadder.","realm":"Server","args":{"arg":{"name":"area","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetTopForwardArea","parent":"CNavLadder","type":"classfunc","description":"Sets the top forward area of the CNavLadder.","realm":"Server","args":{"arg":{"name":"area","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetTopLeftArea","parent":"CNavLadder","type":"classfunc","description":"Sets the top left area of the CNavLadder.","realm":"Server","args":{"arg":{"name":"area","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetTopRightArea","parent":"CNavLadder","type":"classfunc","description":"Sets the top right area of the CNavLadder.","realm":"Server","args":{"arg":{"name":"area","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddControlPoint","parent":"CNewParticleEffect","type":"classfunc","description":{"text":"Adds a control point to the particle system.","note":"This function will not work if the CNewParticleEffect:GetOwner entity is not valid"},"realm":"Client","args":{"arg":[{"text":"The control point ID, 0 to 63.","name":"cpID","type":"number"},{"text":"The entity to attach the control point to.","name":"ent","type":"Entity"},{"text":"See Enums/PATTACH.","name":"partAttachment","type":"number"},{"text":"The attachment name on the entity to attach the particle system to","name":"entAttachment","type":"string","default":"nil"},{"text":"The offset from the Entity:GetPos of the entity we are attaching this CP to.","name":"offset","type":"Vector","default":"Vector( 0, 0, 0 )"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetAutoUpdateBBox","parent":"CNewParticleEffect","type":"classfunc","realm":"Client","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetEffectName","parent":"CNewParticleEffect","type":"classfunc","description":"Returns the name of the particle effect this system is set to emit.","realm":"Client","rets":{"ret":{"text":"The name of the particle effect.","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetHighestControlPoint","parent":"CNewParticleEffect","type":"classfunc","description":"Returns the highest control point number for given particle system.","realm":"Client","rets":{"ret":{"text":"The highest control point number for given particle system, 0 to 63.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetOwner","parent":"CNewParticleEffect","type":"classfunc","description":"Returns the owner of the particle system, the entity the particle system is attached to.","realm":"Client","rets":{"ret":{"text":"The owner of the particle system.","name":"","type":"Entity"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetRenderBounds","parent":"CNewParticleEffect","type":"classfunc","description":"Returns the bounding box of the particle effect, including all the particles it emitted.","realm":"Client","added":"2024.05.20","rets":{"ret":[{"text":"Mins of the bounding box.","name":"","type":"Vector"},{"text":"Maxs of the bounding box.","name":"","type":"Vector"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetShouldSimulate","parent":"CNewParticleEffect","type":"classfunc","description":"Returns whether the particle system simulation was paused by CNewParticleEffect:SetShouldSimulate.","realm":"Client","added":"2025.11.26","rets":{"ret":{"text":"Whether the simulation is running (`true`) or not (`false`).","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsFinished","parent":"CNewParticleEffect","type":"classfunc","description":"Returns whether the particle system has finished emitting particles or not.","realm":"Client","rets":{"ret":{"text":"Whether the particle system has finished emitting particles or not.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsValid","parent":"CNewParticleEffect","type":"classfunc","description":"Returns whether the particle system is valid or not.","realm":"Client","rets":{"ret":{"text":"Whether the particle system is valid or not.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsViewModelEffect","parent":"CNewParticleEffect","type":"classfunc","description":"Returns whether the particle system is intended to be used on a view model?","realm":"Client","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Render","parent":"CNewParticleEffect","type":"classfunc","description":"Forces the particle system to render using current rendering context.\n\nCan be used to render the particle system in vgui panels, etc.\n\nUsed in conjunction with CNewParticleEffect:SetShouldDraw.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Restart","parent":"CNewParticleEffect","type":"classfunc","description":"Forces the particle system to restart emitting particles.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetControlPoint","parent":"CNewParticleEffect","type":"classfunc","description":"Sets a value for given control point.","realm":"Client","args":{"arg":[{"text":"The control point ID, 0 to 63.","name":"cpID","type":"number"},{"text":"The value to set for given control point.","name":"value","type":"Vector"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetControlPointEntity","parent":"CNewParticleEffect","type":"classfunc","description":"Sets an entity to given control point for particle to use.","realm":"Client","args":{"arg":[{"text":"The control point ID, 0 to 63.","name":"cpID","type":"number"},{"text":"The entity to set.","name":"parent","type":"Entity"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetControlPointForwardVector","parent":"CNewParticleEffect","type":"classfunc","description":"Sets the forward direction for given control point.","realm":"Client","args":{"arg":[{"text":"The control point ID, 0 to 63.","name":"cpID","type":"number"},{"text":"The forward direction for given control point","name":"forward","type":"Vector"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetControlPointOrientation","parent":"CNewParticleEffect","type":"classfunc","description":"Sets the orientation for given control point.","realm":"Client","args":{"arg":[{"text":"The control point ID, 0 to 63.","name":"cpID","type":"number"},{"text":"The forward direction for given control point.\n\nThis can also be an Angle, in which case the other 2 arguments are not used.","name":"forward","type":"Vector"},{"text":"The right direction for given control point","name":"right","type":"Vector"},{"text":"The up direction for given control point","name":"up","type":"Vector"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetControlPointParent","parent":"CNewParticleEffect","type":"classfunc","description":"Essentially makes child control point follow the parent control point.","realm":"Client","args":{"arg":[{"text":"The child control point ID, 0 to 63.","name":"childID","type":"number"},{"text":"The parent control point ID, 0 to 63.","name":"parentID","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetControlPointRightVector","parent":"CNewParticleEffect","type":"classfunc","description":"Sets the right direction for given control point.","realm":"Client","args":{"arg":[{"text":"The control point ID, 0 to 63.","name":"cpID","type":"number"},{"text":"The right direction for given control point.","name":"right","type":"Vector"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetControlPointUpVector","parent":"CNewParticleEffect","type":"classfunc","description":"Sets the upward direction for given control point.","realm":"Client","args":{"arg":[{"text":"The control point ID, 0 to 63.","name":"cpID","type":"number"},{"text":"The upward direction for given control point","name":"upward","type":"Vector"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetIsViewModelEffect","parent":"CNewParticleEffect","type":"classfunc","description":"Set whether this particle effect is a view model effect or not. This will have an effect on attachment positioning and other things.","realm":"Client","args":{"arg":{"text":"Whether this particle effect is a view model effect or not.","name":"isViewModel","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetShouldDraw","parent":"CNewParticleEffect","type":"classfunc","description":"Forces the particle system to stop automatically rendering.\n\nUsed in conjunction with CNewParticleEffect:Render.","realm":"Client","args":{"arg":{"text":"Whether to automatically draw the particle effect or not.","name":"should","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetShouldSimulate","parent":"CNewParticleEffect","type":"classfunc","description":"Sets whether the particle system should continue simulation or not. If simulation is paused, all currently active particles will be frozen in place.","realm":"Client","added":"2025.11.26","args":{"arg":{"text":"Whether the simulation should run (`true`) or not (`false`).","name":"simulate","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetSortOrigin","parent":"CNewParticleEffect","type":"classfunc","description":"Sets the sort origin for given particle system. This is used as a helper to determine which particles are in front of which.","realm":"Client","args":{"arg":{"text":"The new sort origin.","name":"origin","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"StartEmission","parent":"CNewParticleEffect","type":"classfunc","description":"Starts the particle emission.","realm":"Client","args":{"arg":{"name":"infiniteOnly","type":"boolean","default":"false"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"StopEmission","parent":"CNewParticleEffect","type":"classfunc","description":"Stops the particle emission.","realm":"Client","args":{"arg":[{"name":"infiniteOnly","type":"boolean","default":"false"},{"name":"removeAllParticles","type":"boolean","default":"false"},{"name":"wakeOnStop","type":"boolean","default":"false"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"StopEmissionAndDestroyImmediately","parent":"CNewParticleEffect","type":"classfunc","description":{"text":"Stops particle emission and destroys all particles instantly. Also detaches the particle effect from the entity it was attached to.\n\n\n\nConsider using CNewParticleEffect:StopEmission( false, true ) instead, which has same effect, but doesn't require owner entity, and does't detach the particle system from its entity.","note":"This function will work identically to CNewParticleEffect:StopEmission( false, true ) if  CNewParticleEffect:GetOwner entity is not valid."},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddBlackness","parent":"Color","type":"classfunc","description":"Converts a Color into [HWB color space](https://en.wikipedia.org/wiki/HWB_color_model), adds given value to the \"blackness\" and converts it back into an RGB color.\n\nA slightly more efficient combination of COLOR:GetBlackness & COLOR:SetBlackness","realm":"Shared and Menu","added":"2025.01.23","args":{"arg":{"text":"The \"blackness\" value to add in range [0, 1]","name":"blackness","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"AddBrightness","parent":"Color","type":"classfunc","description":"Converts a Color into [HSV color space](https://en.wikipedia.org/wiki/HSL_and_HSV), adds given value to the [brightness also known as \"value\"](https://en.wikipedia.org/wiki/Brightness) and converts it back into an RGB color.\n\nA slightly more efficient combination of COLOR:GetBrightness & COLOR:SetBrightness\n\nThis is useful to quickly change the saturation of the color without changing hue or luminance, allowing for things like easy theming.","realm":"Shared and Menu","added":"2025.01.23","args":{"arg":{"text":"The brightness value to add in range [0, 1]","name":"saturation","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"AddHue","parent":"Color","type":"classfunc","description":"Converts a Color into [HSV color space](https://en.wikipedia.org/wiki/HSL_and_HSV), adds given value to the [hue](https://en.wikipedia.org/wiki/Hue) and converts it back into an RGB color.\n\nA slightly more efficient combination of COLOR:GetHue & COLOR:SetHue\n\nThis is useful to quickly change the hue of the color without changing saturation or luminance, allowing for things like easy theming.","realm":"Shared and Menu","added":"2025.01.23","args":{"arg":{"text":"The hue value to add in degrees [0, 360).","name":"hue","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"AddLightness","parent":"Color","type":"classfunc","description":"Converts a Color into [HSL color space](https://en.wikipedia.org/wiki/HSL_and_HSV), adds given value to the [\"lightness\"](https://en.wikipedia.org/wiki/Lightness) and converts it back into an RGB color.\n\nA slightly more efficient combination of COLOR:GetLightness & COLOR:SetLightness\n\nThis is useful to quickly change the lightness of the color without changing hue or saturation, allowing for things like easy theming.","realm":"Shared and Menu","added":"2025.01.23","args":{"arg":{"text":"The lightness value to add in range [0, 1]","name":"lightness","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"AddSaturation","parent":"Color","type":"classfunc","description":"Converts a Color into [HSV color space](https://en.wikipedia.org/wiki/HSL_and_HSV), adds given value to the [saturation](https://en.wikipedia.org/wiki/Colorfulness) and converts it back into an RGB color.\n\nA slightly more efficient combination of COLOR:GetSaturation & COLOR:SetSaturation\n\nThis is useful to quickly change the saturation of the color without changing hue or luminance, allowing for things like easy theming.","realm":"Shared and Menu","added":"2025.01.23","args":{"arg":{"text":"The saturation value to add in range [0, 1]","name":"saturation","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"AddWhiteness","parent":"Color","type":"classfunc","description":"Converts a Color into [HWB color space](https://en.wikipedia.org/wiki/HWB_color_model), adds given value to the \"whiteness\" and converts it back into an RGB color.\n\nA slightly more efficient combination of COLOR:GetWhiteness & COLOR:SetWhiteness","realm":"Shared and Menu","added":"2025.01.23","args":{"arg":{"text":"The \"whiteness\" value to add in range [0, 1]","name":"whiteness","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Copy","parent":"Color","type":"classfunc","realm":"Shared and Menu","file":{"text":"lua/includes/util/color.lua","line":"183-L187"},"description":"Returns a copy of this color, usually so it can be safely modified later without affecting the original color.","added":"2025.05.30","rets":{"ret":{"text":"The copy of the given color, safe to modify.","name":"","type":"Color"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetBlackness","parent":"Color","type":"classfunc","description":"Converts a Color into [HWB color space](https://en.wikipedia.org/wiki/HWB_color_model) and returns the \"blackness\" of the color.\n\nSee COLOR:ToHWB if you want to get all 3 components.","file":{"text":"lua/includes/util/color.lua","line":"349-L354"},"realm":"Shared and Menu","added":"2025.01.23","rets":{"ret":{"text":"Blackness of the color in range [0, 1]","name":"blackness","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetBrightness","parent":"Color","type":"classfunc","description":"Converts a Color into [HSV color space](https://en.wikipedia.org/wiki/HSL_and_HSV) and returns the [brightness also known as \"value\"](https://en.wikipedia.org/wiki/Brightness).\n\nSee COLOR:ToHSV if you want to get all 3 components.","file":{"text":"lua/includes/util/color.lua","line":"277-L282"},"realm":"Shared and Menu","added":"2025.01.23","rets":{"ret":{"text":"Brightness in range [0, 1]","name":"brightness","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetHue","parent":"Color","type":"classfunc","description":"Converts a Color into [HSV color space](https://en.wikipedia.org/wiki/HSL_and_HSV) and returns the [hue](https://en.wikipedia.org/wiki/Hue).\n\nSee COLOR:ToHSV if you want to get all 3 components.","realm":"Shared and Menu","added":"2025.01.23","rets":{"ret":{"text":"The hue in degrees [0, 360).","name":"hue","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetLightness","parent":"Color","type":"classfunc","description":"Converts a Color into [HSL color space](https://en.wikipedia.org/wiki/HSL_and_HSV) and returns the [\"lightness\"](https://en.wikipedia.org/wiki/Lightness) of the color.\n\nSee COLOR:ToHSL if you want to get all 3 components.","realm":"Shared and Menu","added":"2025.01.23","rets":{"ret":{"text":"Lightness in range [0, 1]","name":"lightness","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetSaturation","parent":"Color","type":"classfunc","description":"Converts a Color into [HSV color space](https://en.wikipedia.org/wiki/HSL_and_HSV) and returns the [saturation](https://en.wikipedia.org/wiki/Colorfulness).\n\nSee COLOR:ToHSV if you want to get all 3 components.","realm":"Shared and Menu","added":"2025.01.23","rets":{"ret":{"text":"Saturation in range [0, 1]","name":"saturation","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetWhiteness","parent":"Color","type":"classfunc","description":"Converts a Color into [HWB color space](https://en.wikipedia.org/wiki/HWB_color_model) and returns the \"whiteness\" of the color.\n\nSee COLOR:ToHWB if you want to get all 3 components.","realm":"Shared and Menu","added":"2025.01.23","rets":{"ret":{"text":"Whiteness of the color in range [0, 1]","name":"whiteness","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Lerp","parent":"Color","type":"classfunc","realm":"Shared and Menu","file":{"text":"lua/includes/util/color.lua","line":"183-L192"},"description":"Performs linear interpolation between this and given colors.","args":{"arg":[{"text":"The target color to interpolate towards.","name":"target","type":"Color"},{"text":"The interpolation fraction. `0` means fully original color, `0.5` means in the middle between the 2 colors, `1` means fully target color, etc.","name":"fraction","type":"number"}]},"rets":{"ret":{"text":"The result of linear interpolation.","name":"","type":"Color"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetBlackness","parent":"Color","type":"classfunc","description":"Converts a Color into [HWB color space](https://en.wikipedia.org/wiki/HWB_color_model), sets the \"blackness\" and converts it back into an RGB color.","realm":"Shared and Menu","added":"2025.01.23","args":{"arg":{"text":"The new \"blackness\" value in range [0, 1]","name":"blackness","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetBrightness","parent":"Color","type":"classfunc","description":"Converts a Color into [HSV color space](https://en.wikipedia.org/wiki/HSL_and_HSV), sets the [brightness also known as \"value\"](https://en.wikipedia.org/wiki/Brightness) and converts it back into an RGB color.\n\nThis is useful to quickly change the brightness of the color without changing hue or saturation, allowing for things like easy theming.","realm":"Shared and Menu","added":"2025.01.23","args":{"arg":{"text":"The new brightness value in range [0, 1]","name":"saturation","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetHue","parent":"Color","type":"classfunc","description":"Converts a Color into [HSV color space](https://en.wikipedia.org/wiki/HSL_and_HSV), sets the [hue](https://en.wikipedia.org/wiki/Hue) and converts it back into an RGB color.\n\nThis is useful to quickly change the hue of the color without changing saturation or luminance, allowing for things like easy theming.","realm":"Shared and Menu","added":"2025.01.23","args":{"arg":{"text":"The new hue value in degrees [0, 360).","name":"hue","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetLightness","parent":"Color","type":"classfunc","description":"Converts a Color into [HSL color space](https://en.wikipedia.org/wiki/HSL_and_HSV), sets the [\"lightness\"](https://en.wikipedia.org/wiki/Lightness) and converts it back into an RGB color.\n\nThis is useful to quickly change the lightness of the color without changing hue or saturation, allowing for things like easy theming.","realm":"Shared and Menu","added":"2025.01.23","args":{"arg":{"text":"The new lightness value in range [0, 1]","name":"lightness","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetSaturation","parent":"Color","type":"classfunc","description":"Converts a Color into [HSV color space](https://en.wikipedia.org/wiki/HSL_and_HSV), sets the [saturation](https://en.wikipedia.org/wiki/Colorfulness) and converts it back into an RGB color.\n\nThis is useful to quickly change the saturation of the color without changing hue or luminance, allowing for things like easy theming.","realm":"Shared and Menu","added":"2025.01.23","args":{"arg":{"text":"The new saturation value in range [0, 1]","name":"saturation","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetUnpacked","parent":"Color","type":"classfunc","description":"Sets the red, green, blue, and alpha of the color.","realm":"Shared","file":{"text":"lua/includes/util/color.lua","line":"94-L101"},"args":{"arg":[{"text":"The red component","name":"r","type":"number"},{"text":"The green component","name":"g","type":"number"},{"text":"The blue component","name":"b","type":"number"},{"text":"The alpha component","name":"a","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetWhiteness","parent":"Color","type":"classfunc","description":"Converts a Color into [HWB color space](https://en.wikipedia.org/wiki/HWB_color_model), sets the \"whiteness\" and converts it back into an RGB color.","realm":"Shared and Menu","added":"2025.01.23","args":{"arg":{"text":"The new \"whiteness\" value in range [0, 1]","name":"whiteness","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ToHex","parent":"Color","type":"classfunc","description":"Converts a Color to its hexadecimal representation.","realm":"Shared and Menu","added":"2025.07.15","args":{"arg":{"text":"Whether to forcibly omit the alpha channel from the output.","name":"","type":"boolean","default":"false"}},"rets":{"ret":{"text":"The hexadecimal representation of the color. (`#RRGGBBAA`)\n\nIf the alpha channel is `255`, it will be omitted from the output (`#RRGGBB`)","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ToHSL","parent":"Color","type":"classfunc","description":"Converts a Color into [HSL color space](https://en.wikipedia.org/wiki/HSL_and_HSV) .\n\nThis calls Global.ColorToHSL internally.","realm":"Shared and Menu","file":{"text":"lua/includes/util/color.lua","line":"140-L144"},"rets":{"ret":[{"text":"The hue in degrees [0, 360).","name":"","type":"number"},{"text":"The saturation in the range [0, 1].","name":"","type":"number"},{"text":"The lightness in the range [0, 1].","name":"","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ToHSV","parent":"Color","type":"classfunc","file":{"text":"lua/includes/util/color.lua","line":"149-L153"},"realm":"Shared and Menu","description":"Encodes a RGB Color into the [HSV color space](https://en.wikipedia.org/wiki/HSL_and_HSV).\n\n\t\tThis function uses Global.ColorToHSV internally.","rets":{"ret":[{"text":"Hue in degrees in range [0, 360)","name":"hue","type":"number"},{"text":"Saturation in range [0, 1]","name":"saturation","type":"number"},{"text":"Brightness in range [0, 1]","name":"brightness","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ToHWB","parent":"Color","type":"classfunc","file":{"text":"lua/includes/util/color.lua","line":"158-L163"},"description":"Converts a Color into [HWB color space](https://en.wikipedia.org/wiki/HWB_color_model). See Global.HWBToColor for more info.","realm":"Shared and Menu","added":"2025.01.23","rets":{"ret":[{"text":"The hue in degrees [0, 360).","name":"hue","type":"number"},{"text":"The whiteness in the range [0, 1].","name":"whiteness","type":"number"},{"text":"The blacknessin the range [0, 1].","name":"blackness","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ToTable","parent":"Color","type":"classfunc","description":"Returns the color as a table (an array or a list) with four elements.","realm":"Shared","file":{"text":"lua/includes/util/color.lua","line":"103-L107"},"rets":{"ret":{"text":"The table with elements 1 = r, 2 = g, 3 = b, 4 = a,( `{ r, g, b, a }` )","name":"","type":"table<number>"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ToVector","parent":"Color","type":"classfunc","description":"Translates the Color into a Vector, losing the alpha channel.\nThis will also range the values from 0 - 255 to 0 - 1\n\nr / 255 -> x\n\ng / 255 -> y\n\nb / 255 -> z\n\nThis is the opposite of Vector:ToColor","realm":"Shared","file":{"text":"lua/includes/util/color.lua","line":"168-L172"},"rets":{"ret":{"text":"The created Vector","name":"","type":"Vector"}}},"example":{"description":"Useful when setting player colors, since the function requires a vector as argument.","code":"Entity( 1 ):SetPlayerColor( Color( 220, 20, 60 ):ToVector() )","output":"Sets the player color for Player1 (only works if they are using a colorable player model)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Unpack","parent":"Color","type":"classfunc","description":"Returns the red, green, blue, and alpha of the color.","realm":"Shared","file":{"text":"lua/includes/util/color.lua","line":"177-L181"},"rets":{"ret":[{"text":"Red","name":"","type":"number"},{"text":"Green","name":"","type":"number"},{"text":"Blue","name":"","type":"number"},{"text":"Alpha","name":"","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBool","parent":"ConVar","type":"classfunc","description":"Tries to convert the current string value of a ConVar to a boolean.","realm":"Shared and Menu","rets":{"ret":{"text":"The boolean value of the console variable. If the variable is numeric and not 0, the result will be `true`. Otherwise the result will be `false`.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetDefault","parent":"ConVar","type":"classfunc","description":"Returns the default value of the ConVar","realm":"Shared and Menu","rets":{"ret":{"text":"The default value of the console variable.","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetFlags","parent":"ConVar","type":"classfunc","description":"Returns the Enums/FCVAR flags of the ConVar","realm":"Shared and Menu","rets":{"ret":{"text":"The bitflag. See Enums/FCVAR","name":"flag","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetFloat","parent":"ConVar","type":"classfunc","description":"Attempts to convert the ConVar value to a float","realm":"Shared and Menu","rets":{"ret":{"text":"The float value of the console variable.\n\n\nIf the value cannot be converted to a float, it will return 0.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetHelpText","parent":"ConVar","type":"classfunc","description":"Returns the help text assigned to that convar.","realm":"Shared and Menu","rets":{"ret":{"text":"The help text","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetInt","parent":"ConVar","type":"classfunc","description":"Attempts to convert the ConVar value to a integer.","realm":"Shared and Menu","rets":{"ret":{"text":"The integer value of the console variable.\n\n\nIf it fails to convert to an integer, it will return 0.\n\n\nAll float/decimal values will be rounded down. ( With math.floor )","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetMax","parent":"ConVar","type":"classfunc","description":"Returns the maximum value of the ConVar","realm":"Shared and Menu","rets":{"ret":{"text":"The maximum value of the ConVar","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetMin","parent":"ConVar","type":"classfunc","description":"Returns the minimum value of the ConVar","realm":"Shared and Menu","rets":{"ret":{"text":"The minimum value of the ConVar","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetName","parent":"ConVar","type":"classfunc","description":"Returns the name of the ConVar.","realm":"Shared and Menu","rets":{"ret":{"text":"The name of the console variable.","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetString","parent":"ConVar","type":"classfunc","description":"Returns the current ConVar value as a string.","realm":"Shared and Menu","rets":{"ret":{"text":"The current console variable value as a string.","name":"","type":"string"}}},"example":{"description":"Will check if the gamemode is sandbox (Consider using engine.ActiveGamemode)","code":"if GetConVar(\"gamemode\"):GetString() == \"sandbox\" then\n    print(\"Gamemode is sandbox\")\nend","output":"Gamemode is sandbox"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsFlagSet","parent":"ConVar","type":"classfunc","description":"Returns whether the specified flag is set on the ConVar","realm":"Shared and Menu","args":{"arg":{"text":"The Enums/FCVAR flag to test","name":"flag","type":"number"}},"rets":{"ret":{"text":"Whether the flag is set or not","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Revert","parent":"ConVar","type":"classfunc","description":{"text":"Reverts ConVar to its default value","note":"This can only be ran on ConVars created from within Lua."},"realm":"Shared and Menu"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetBool","parent":"ConVar","type":"classfunc","description":"Sets a ConVar's value to 1 or 0 based on the input boolean. This can only be ran on ConVars created from within Lua.","realm":"Shared and Menu","args":{"arg":{"text":"Value to set the ConVar to.","name":"value","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetFloat","parent":"ConVar","type":"classfunc","description":{"text":"Sets a ConVar's value to the input number.","note":"This can only be ran on ConVars created from within Lua."},"realm":"Shared and Menu","args":{"arg":{"text":"Value to set the ConVar to.","name":"value","type":"number"}}},"example":{"description":"Demonstrates the use of this function.","code":"local example = GetConVar( \"CVAR_EXAMPLE\" )\nexample:SetFloat( 13.37 )"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetInt","parent":"ConVar","type":"classfunc","description":{"text":"Sets a ConVar's value to the input number after converting it to an integer.","note":"This can only be ran on ConVars created from within Lua."},"realm":"Shared and Menu","args":{"arg":{"text":"Value to set the ConVar to.","name":"value","type":"number"}}},"example":{"description":"Demonstrates the use of this function.","code":"local example = GetConVar( \"CVAR_EXAMPLE\" )\nexample:SetInt( 1337 )"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetString","parent":"ConVar","type":"classfunc","description":"Sets a ConVar's value to the input string. This can only be ran on ConVars created from within Lua.","realm":"Shared and Menu","args":{"arg":{"text":"Value to set the ConVar to.","name":"value","type":"string"}}},"example":{"description":"Demonstrates the use of this function.","code":"local example = GetConVar( \"CVAR_EXAMPLE\" )\nexample:SetString( \"1337\" )"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"AddAllPlayers","parent":"CRecipientFilter","type":"classfunc","description":"Adds all players to the recipient filter.","realm":"Server"},"example":{"description":"Adds all players to a recipient filter, then uses the recipient filter in a usermessage.","code":"function SendMessage()\n\tlocal filter = RecipientFilter()\n\tfilter:AddAllPlayers()\n\tumsg.Start(\"message\",filter)\n\tumsg.End()\nend","output":"Sends a usermessage to every player."},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddPAS","parent":"CRecipientFilter","type":"classfunc","description":"Adds all players that are in the same [PAS (Potentially Audible Set)](https://developer.valvesoftware.com/wiki/PAS \"PAS - Valve Developer Community\") as this position.","realm":"Server","args":{"arg":{"text":"A position that players may be able to hear, usually the position of an entity the sound is playing played from.","name":"pos","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddPlayer","parent":"CRecipientFilter","type":"classfunc","description":"Adds a player to the recipient filter","realm":"Server","args":{"arg":{"text":"Player to add to the recipient filter.","name":"Player","type":"Player"}}},"example":{"description":"Adds the first player object to the recipient filter, then sends him a message.","code":"function SendMessage()\n\tlocal filter = RecipientFilter()\n\tfilter:AddPlayer( Entity( 1 ) )\n\tnet.Start( \"message\" )\n\tnet.Send( filter )\nend","output":"Sends a netmessage to the first player object, if it exists."},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddPlayers","parent":"CRecipientFilter","type":"classfunc","description":"Adds players to the recipient filter from a given table or another recipient filter.","realm":"Server","added":"2023.11.02","args":{"arg":{"text":"The filter to add players from. This can also be a sequential table of players. Non player entities or duplicate players will be ignored.","type":"CRecipientFilter|table<Player>","name":"input"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddPVS","parent":"CRecipientFilter","type":"classfunc","description":"Adds all players that are in the same [PVS (Potential Visibility Set)](https://developer.valvesoftware.com/wiki/PVS \"PVS - Valve Developer Community\") as this position.","realm":"Server","args":{"arg":{"text":"PVS position that players may be able to see.","name":"Position","type":"Vector"}}},"example":{"description":"Adds players that are visible from the origin of the map to a recipient filter, then sends them a message.","code":"function SendMessage()\n\tlocal filter = RecipientFilter()\n\tfilter:AddPVS( Vector( 0, 0, 0 ) )\n\n\tnet.Start( \"message\" )\n\tnet.Send( filter )\nend","output":"Sends a net message to every player visible from 0,0,0"},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddRecipientsByTeam","parent":"CRecipientFilter","type":"classfunc","description":"Adds all players that are on the given team to the filter.","realm":"Server","args":{"arg":{"text":"Team index to add players from.","name":"teamid","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetCount","parent":"CRecipientFilter","type":"classfunc","description":"Returns the number of valid players in the recipient filter.","realm":"Server","rets":{"ret":{"text":"Number of valid players in the recipient filter.","name":"","type":"number"}}},"example":{"description":"Example usage of the function","code":"local rf = RecipientFilter()\nrf:AddAllPlayers()\nprint( rf:GetCount() )\nPrintTable( rf:GetPlayers() )","output":"```\n2\n1\t=\tPlayer [1][Player #1]\n2\t=\tPlayer [2][Player #2]\n```"},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetPlayers","parent":"CRecipientFilter","type":"classfunc","description":"Returns a table of all valid players currently in the recipient filter.","realm":"Server","rets":{"ret":{"text":"A table of all valid players currently in the recipient filter.","name":"","type":"table<Player>"}}},"example":{"description":"Example usage of the function","code":"local rf = RecipientFilter()\nrf:AddAllPlayers()\nprint( rf:GetCount() )\nPrintTable( rf:GetPlayers() )","output":"```\n2\n1\t=\tPlayer [1][Player #1]\n2\t=\tPlayer [2][Player #2]\n```"},"realms":["Server"],"type":"Function"},
{"function":{"name":"RemoveAllPlayers","parent":"CRecipientFilter","type":"classfunc","description":"Removes all players from the recipient filter.","realm":"Server"},"example":{"description":"Adds all players that can see the origin of the map, removes all players, then adds the first player object to the recipient filter, and sends them a message.","code":"function SendMessage()\n local filter = RecipientFilter()\n filter:AddPVS(Vector(0,0,0))\n filter:RemoveAllPlayers()\n filter:AddPlayer(Entity(1))\n umsg.Start(\"message\",filter)\n umsg.End()\nend","output":"Sends a usermessage to the first player object, if it exists."},"realms":["Server"],"type":"Function"},
{"function":{"name":"RemoveMismatchedPlayers","parent":"CRecipientFilter","type":"classfunc","description":"Remove players from this recipient filter that are **NOT** present in a given table or recipient filter.","realm":"Server","added":"2023.11.02","args":{"arg":{"text":"The filter that contains a list of players to test against. Players **NOT** in the given filter will be removed from this filter.\n\nThis can also be a sequential table of players. Non player entities will be ignored.","type":"CRecipientFilter","name":"input"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"RemovePAS","parent":"CRecipientFilter","type":"classfunc","description":"Removes all players from the filter that are in [PAS (Potentially Audible Set)](https://developer.valvesoftware.com/wiki/PAS \"PAS - Valve Developer Community\") for given position.","realm":"Server","args":{"arg":{"text":"The position to test","name":"position","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"RemovePlayer","parent":"CRecipientFilter","type":"classfunc","description":"Removes the player from the recipient filter.","realm":"Server","args":{"arg":{"text":"The player that should be in the recipient filter if you call this function.","name":"Player","type":"Player"}}},"example":{"description":"Adds all players to the recipient filter, then removes the first player and sends a message to the rest.","code":"util.AddNetworkString(\"message\")\nfunction SendMessage()\n\tlocal filter = RecipientFilter()\n\tfilter:AddAllPlayers()\n\tfilter:RemovePlayer(Entity(1))\n\tnet.Start(\"message\")\n\tnet.Send(filter)\nend","output":"Sends a net message to every player except the first."},"realms":["Server"],"type":"Function"},
{"function":{"name":"RemovePlayers","parent":"CRecipientFilter","type":"classfunc","description":"Remove players from this recipient filter that are present in a given table or recipient filter.","realm":"Server","added":"2023.11.02","args":{"arg":{"text":"The filter that contains a list of players to remove. This can also be a sequential table of players. Non player entities will be ignored. If a player in the given table/filter is not present in this filter, it is ignored.","type":"CRecipientFilter","name":"input"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"RemovePVS","parent":"CRecipientFilter","type":"classfunc","description":"Removes all players that can see this [PVS (Potential Visibility Set)](https://developer.valvesoftware.com/wiki/PVS \"PVS - Valve Developer Community\") from the recipient filter.","realm":"Server","args":{"arg":{"text":"Position that players may be able to see.","name":"pos","type":"Vector"}}},"example":{"description":"Adds the first player object to the recipient filter, then sends him a message.","code":"function SendMessage()\n\tlocal filter = RecipientFilter()\n\tfilter:AddPVS( Vector( 0,0,0 ) )\n\tfilter:RemovePVS( Vector( 0,10,0 ) )\n\tumsg.Start( \"message\", filter )\n\tumsg.End()\nend","output":"Adds all players that can see the map's origin to the recipient filter, then removes all players who can see 10 units to the left of the origin, and sends the rest a message."},"realms":["Server"],"type":"Function"},
{"function":{"name":"RemoveRecipientsByTeam","parent":"CRecipientFilter","type":"classfunc","description":"Removes all players that are on the given team from the filter.","realm":"Server","args":{"arg":{"text":"Team index to remove players from.","name":"teamid","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"RemoveRecipientsNotOnTeam","parent":"CRecipientFilter","type":"classfunc","description":"Removes all players that are not on the given team from the filter.","realm":"Server","args":{"arg":{"text":"Team index.","name":"teamid","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Remove","parent":"CSEnt","type":"classfunc","description":"Removes the clientside entity","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"ChangePitch","parent":"CSoundPatch","type":"classfunc","description":"Adjust the pitch, also known as the speed at which the sound is being played.\n\nAppears to only work while the sound is being played. See also CSoundPatch:PlayEx.\n\nThis invokes GM:EntityEmitSound.","realm":"Shared","args":{"arg":[{"text":"The pitch can range from 0-255. Where 100 is the original pitch.","name":"pitch","type":"number"},{"text":"The time to fade from previous to the new pitch.","name":"deltaTime","type":"number","default":"0"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ChangeVolume","parent":"CSoundPatch","type":"classfunc","description":"Adjusts the volume of the sound played.\n\nAppears to only work while the sound is being played. See also CSoundPatch:PlayEx.","realm":"Shared","args":{"arg":[{"text":"The volume ranges from 0 to 1.","name":"volume","type":"number"},{"text":"Time to fade the volume from previous to new value from.","name":"deltaTime","type":"number","default":"0"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"FadeOut","parent":"CSoundPatch","type":"classfunc","description":"Fades out the volume of the sound from the current volume to 0 in the given amount of seconds.","realm":"Shared","args":{"arg":{"text":"Fade time.","name":"seconds","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDSP","parent":"CSoundPatch","type":"classfunc","description":"Returns the DSP (Digital Signal Processor) effect ID for the sound.","realm":"Shared","rets":{"ret":{"text":"The numerical ID for the DSP effect currently enabled on the sound.\n\n\t\t\tFor a list of the available IDs and their meaning, see DSP Presets.","name":"dspEffectId","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPitch","parent":"CSoundPatch","type":"classfunc","description":"Returns the current pitch.","realm":"Shared","rets":{"ret":{"text":"The current pitch, can range from 0-255.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSoundLevel","parent":"CSoundPatch","type":"classfunc","description":"Returns the current sound level.","realm":"Shared","rets":{"ret":{"text":"The current sound level, see Enums/SNDLVL.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSoundName","parent":"CSoundPatch","type":"classfunc","description":"Returns the sound name of this sound patch. This may be name of a sound script (sound.Add) or a file path.","realm":"Shared","added":"2026.06.19","rets":{"ret":{"text":"The sound name.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetVolume","parent":"CSoundPatch","type":"classfunc","description":"Returns the current volume.","realm":"Shared","rets":{"ret":{"text":"The current volume, ranging from 0 to 1.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsPlaying","parent":"CSoundPatch","type":"classfunc","description":"Returns whenever the sound is being played.","realm":"Shared","rets":{"ret":{"text":"Is playing or not","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Play","parent":"CSoundPatch","type":"classfunc","description":"Starts to play the sound. This will reset the sound's volume and pitch to their default values. See CSoundPatch:PlayEx","realm":"Shared"},"example":{"description":"Example usage","code":"local mysound = CreateSound( \"test.wav\" )\nmysound:Play()"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayEx","parent":"CSoundPatch","type":"classfunc","description":"Same as CSoundPatch:Play but with 2 extra arguments allowing to set volume and pitch directly.","realm":"Shared","args":{"arg":[{"text":"The volume ranges from 0 to 1.","name":"volume","type":"number"},{"text":"The pitch can range from 0-255.","name":"pitch","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDSP","parent":"CSoundPatch","type":"classfunc","description":"Sets the DSP (Digital Signal Processor) effect for the sound.\n\nSimilar to Player:SetDSP but for individual sounds.","realm":"Shared","args":{"arg":{"text":"The numerical ID for the DSP effect to be enabled on the sound.  \n\t\t\t\n\t\t\tFor a list of the available IDs and their meaning, see DSP Presets.","name":"dspEffectId","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetSoundLevel","parent":"CSoundPatch","type":"classfunc","description":"Sets the sound level in decibel.","realm":"Shared","args":{"arg":{"text":"The sound level in decibel. See Enums/SNDLVL","name":"level","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Stop","parent":"CSoundPatch","type":"classfunc","description":{"text":"Stops the sound from being played.","bug":{"text":"This will not work if the entity attached to this sound patch (specified by Global.CreateSound) is invalid.","issue":"3260"}},"realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddDamage","parent":"CTakeDamageInfo","type":"classfunc","description":"Increases the damage by damageIncrease.","realm":"Shared","args":{"arg":{"text":"The damage to add.","name":"damageIncrease","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAmmoType","parent":"CTakeDamageInfo","type":"classfunc","description":"Returns the ammo type used by the weapon that inflicted the damage.","realm":"Shared","rets":{"ret":{"text":"Ammo type ID","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAttacker","parent":"CTakeDamageInfo","type":"classfunc","description":"Returns the attacker ( character who originated the attack ), for example a player or an NPC that shot the weapon.","realm":"Shared","rets":{"ret":{"text":"The attacker","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBaseDamage","parent":"CTakeDamageInfo","type":"classfunc","description":"Returns the initial unmodified by skill level ( game.GetSkillLevel ) damage.","realm":"Shared","rets":{"ret":{"text":"baseDamage","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDamage","parent":"CTakeDamageInfo","type":"classfunc","description":"Returns the total damage.","realm":"Shared","rets":{"ret":{"text":"damage","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDamageBonus","parent":"CTakeDamageInfo","type":"classfunc","description":"Gets the current bonus damage.","realm":"Shared","rets":{"ret":{"text":"Bonus damage","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDamageCustom","parent":"CTakeDamageInfo","type":"classfunc","description":"Gets the custom damage type. This is used by Day of Defeat: Source and Team Fortress 2 for extended damage info, but isn't used in Garry's Mod by default.","realm":"Shared","rets":{"ret":{"text":"The custom damage type","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDamageForce","parent":"CTakeDamageInfo","type":"classfunc","description":"Returns a vector representing the damage force.\n\nCan be set with CTakeDamageInfo:SetDamageForce.","realm":"Shared","rets":{"ret":{"text":"The damage force","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDamagePosition","parent":"CTakeDamageInfo","type":"classfunc","description":"Returns the position where the damage was or is going to be applied to.\n\nCan be set using CTakeDamageInfo:SetDamagePosition.","realm":"Shared","rets":{"ret":{"text":"The damage position","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDamageType","parent":"CTakeDamageInfo","type":"classfunc","description":"Returns a bitflag which indicates the damage type(s) of the damage.\n\nConsider using CTakeDamageInfo:IsDamageType instead. Value returned by this function can contain multiple damage types.","realm":"Shared","rets":{"ret":{"text":"Damage type(s), a combination of Enums/DMG","name":"","type":"number{DMG}"}}},"example":{"description":"All of these expressions are equivalent to each other, evaluating to `true` if the damageinfo contains bullet, explosive, or club damage:\n```lua\nbit.band(dmginfo:GetDamageType(), bit.bor(DMG_BULLET, DMG_BLAST, DMG_CLUB)) ~= 0\n```\n```lua\ndmginfo:IsDamageType(DMG_BULLET + DMG_BLAST + DMG_CLUB)\n```\n```lua\ndmginfo:IsBulletDamage() or dmginfo:IsExplosionDamage() or dmginfo:IsDamageType(DMG_CLUB)\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetInflictor","parent":"CTakeDamageInfo","type":"classfunc","description":"Returns the inflictor of the damage. This is not necessarily a weapon.\n\nFor hitscan weapons this is the weapon.\n\nFor projectile weapons this is the projectile.\n\nFor a more reliable method of getting the weapon that damaged an entity, use CTakeDamageInfo:GetWeapon or GetAttacker with GetActiveWeapon.","realm":"Shared","rets":{"ret":{"text":"The inflictor entity.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMaxDamage","parent":"CTakeDamageInfo","type":"classfunc","description":"Returns the maximum damage. See CTakeDamageInfo:SetMaxDamage.\n\nThis is only set by \"multi damage\" instances in the engine, and is only checked by the strider NPC when receiving explosive damage.","realm":"Shared","rets":{"ret":{"text":"The maximum amount of damage in the \"multi damage\" instance.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetReportedPosition","parent":"CTakeDamageInfo","type":"classfunc","description":"Returns the initial, unmodified position where the damage occured.","realm":"Shared","rets":{"ret":{"text":"position","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetWeapon","parent":"CTakeDamageInfo","type":"classfunc","description":"Returns the inflicting weapon of the damage event, if there is any.\n\nThis is not necessarily a Weapon entity, but it is very likely to be one.\n\nSee CTakeDamageInfo:GetInflictor for the actual entity that did the damage.","added":"2025.01.15","realm":"Shared","rets":{"ret":{"text":"The damage-inflicting weapon or NULL.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsBulletDamage","parent":"CTakeDamageInfo","type":"classfunc","description":"Returns true if the damage was caused by a bullet.","realm":"Shared","rets":{"ret":{"text":"isBulletDmg","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsDamageType","parent":"CTakeDamageInfo","type":"classfunc","description":"Returns whenever the damageinfo contains the damage type specified.","realm":"Shared","args":{"arg":{"text":"Damage type to test. See Enums/DMG.","name":"dmgType","type":"number{DMG}"}},"rets":{"ret":{"text":"Whether this damage contains specified damage type or not","name":"","type":"boolean"}}},"example":{"description":"All of these expressions are equivalent to each other, evaluating to `true` if the damageinfo contains bullet, explosive, or club damage:\n```lua\ndmginfo:IsBulletDamage() or dmginfo:IsExplosionDamage() or dmginfo:IsDamageType(DMG_CLUB)\n```\n```lua\ndmginfo:IsDamageType(DMG_BULLET + DMG_BLAST + DMG_CLUB)\n```\n```lua\nbit.band(dmginfo:GetDamageType(), bit.bor(DMG_BULLET, DMG_BLAST, DMG_CLUB)) ~= 0\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsExplosionDamage","parent":"CTakeDamageInfo","type":"classfunc","description":"Returns whenever the damageinfo contains explosion damage.","realm":"Shared","rets":{"ret":{"text":"isExplDamage","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsFallDamage","parent":"CTakeDamageInfo","type":"classfunc","description":"Returns whenever the damageinfo contains fall damage.","realm":"Shared","rets":{"ret":{"text":"isFallDmg","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ScaleDamage","parent":"CTakeDamageInfo","type":"classfunc","description":"Scales the damage by the given value.","realm":"Shared","args":{"arg":{"text":"Value to scale the damage with.","name":"scale","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetAmmoType","parent":"CTakeDamageInfo","type":"classfunc","description":"Changes the ammo type used by the weapon that inflicted the damage.","realm":"Shared","args":{"arg":{"text":"Ammo type ID","name":"ammoType","type":"number"}}},"example":{"description":"Creates a new DamageInfo object and sets the ammo that caused the damage to AR2 ammo","code":"local dmginfo = DamageInfo()\n\ndmginfo:SetAmmoType( game.GetAmmoID( 'AR2' ) )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetAttacker","parent":"CTakeDamageInfo","type":"classfunc","description":"Sets the attacker ( character who originated the attack ) of the damage, for example a player or an NPC.","realm":"Shared","args":{"arg":{"text":"The entity to be set as the attacker.","name":"ent","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetBaseDamage","parent":"CTakeDamageInfo","type":"classfunc","description":"Sets the initial damage, unmodified by the current skill level (game.GetSkillLevel). This is usually set automatically by the game when dealing damage.\n\nThis function will not modify the real damage that will be dealt (CTakeDamageInfo:GetDamage).\n\nUse this only if you know what you are doing. Otherwise use CTakeDamageInfo:SetDamage.","realm":"Shared","added":"2020.10.14","args":{"arg":{"text":"The base damage.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDamage","parent":"CTakeDamageInfo","type":"classfunc","description":"Sets the amount of damage.","realm":"Shared","args":{"arg":{"text":"The value to set the absolute damage to.","name":"damage","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDamageBonus","parent":"CTakeDamageInfo","type":"classfunc","description":"Sets the bonus damage. Bonus damage isn't automatically applied, so this will have no outer effect by default.","realm":"Shared","args":{"arg":{"text":"The extra damage to be added.","name":"damage","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDamageCustom","parent":"CTakeDamageInfo","type":"classfunc","description":"Sets the custom damage type. This is used by Day of Defeat: Source and Team Fortress 2 for extended damage info, but isn't used in Garry's Mod by default.","realm":"Shared","args":{"arg":{"text":"Any integer - can be based on your own custom enums.","name":"DamageType","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDamageForce","parent":"CTakeDamageInfo","type":"classfunc","description":{"text":"Sets the directional force of the damage.","note":"This function only affects entities using the VPHYSICS movetype. This means players and most NPCs won't receive the force vector you provide as knockback. \n\nIf the entity taking damage is using the WALK or STEP movetypes, the damage force is instead automatically calculated. It will push the entity away from the inflictor's Entity:WorldSpaceCenter, scaling the push by a calculated value involving the total amount of damage and the size of the entity. [Source](https://github.com/ValveSoftware/source-sdk-2013/blob/0565403b153dfcde602f6f58d8f4d13483696a13/src/game/server/baseentity.cpp#L1525)\n\nTo disable knockback entirely, see [EFL_NO_DAMAGE_FORCES](https://wiki.facepunch.com/gmod/Enums/EFL#EFL_NO_DAMAGE_FORCES) or use the workaround example below."},"realm":"Shared","args":{"arg":{"text":"The vector to set the force to.","name":"force","type":"Vector"}}},"example":{"description":"Workaround for player knockback quenching.","code":"local ent = Entity(1)\nlocal oldvel = ent:GetVelocity()\n\n-- Damage taking example\nlocal dmgi = DamageInfo()\n    dmgi:SetDamageType( DMG_RADIATION )\n    dmgi:SetDamage( 5 )\n    dmgi:SetAttacker( Entity(0) )\n    dmgi:SetInflictor( Entity(0) )\nent:TakeDamageInfo( dmgi )\n\nlocal newvel = ent:GetVelocity()\nent:SetVelocity( oldvel - newvel )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDamagePosition","parent":"CTakeDamageInfo","type":"classfunc","description":"Sets the position of where the damage gets applied to.","realm":"Shared","args":{"arg":{"text":"The position where the damage will be applied.","name":"pos","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDamageType","parent":"CTakeDamageInfo","type":"classfunc","description":"Sets the damage type.","realm":"Shared","args":{"arg":{"text":"The damage type, see Enums/DMG.","name":"type","type":"number{DMG}"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetInflictor","parent":"CTakeDamageInfo","type":"classfunc","description":"Sets the inflictor of the damage for example a weapon.\n\nFor hitscan/bullet weapons this should the weapon.\n\nFor projectile (rocket launchers, grenades, etc) weapons this should be the projectile and CTakeDamageInfo:SetWeapon should be the weapon.","realm":"Shared","args":{"arg":{"text":"The new inflictor.","name":"inflictor","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetMaxDamage","parent":"CTakeDamageInfo","type":"classfunc","description":"Sets the \"maximum damage\" for this damage event. See CTakeDamageInfo:GetMaxDamage for details.","realm":"Shared","args":{"arg":{"text":"Maximum damage value.","name":"maxDamage","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetReportedPosition","parent":"CTakeDamageInfo","type":"classfunc","description":"Sets the origin of the damage.","realm":"Shared","args":{"arg":{"text":"The location of where the damage is originating","name":"pos","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetWeapon","parent":"CTakeDamageInfo","type":"classfunc","description":"Sets the damage-inflicting weapon of the damage event.\n\nThis should be a Weapon entity, not a projectile. See also CTakeDamageInfo:SetInflictor.","added":"2025.01.15","realm":"Shared","args":{"arg":{"text":"The damage-inflicting weapon or NULL.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SubtractDamage","parent":"CTakeDamageInfo","type":"classfunc","description":"Subtracts the specified amount from the damage.","realm":"Shared","args":{"arg":{"text":"Value to subtract.","name":"damage","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddKey","parent":"CUserCmd","type":"classfunc","description":"Adds a single key to the active buttons bitflag. See also CUserCmd:SetButtons.","added":"2021.12.15","realm":"Shared","args":{"arg":{"text":"Key to add, see Enums/IN.","name":"key","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ClearButtons","parent":"CUserCmd","type":"classfunc","description":{"text":"Removes all keys from the command.","note":"If you are looking to affect player movement, you may need to use CUserCmd:ClearMovement instead of clearing the buttons."},"realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ClearMovement","parent":"CUserCmd","type":"classfunc","description":"Clears the movement from the command.\n\nSee also CUserCmd:SetForwardMove, CUserCmd:SetSideMove and  CUserCmd:SetUpMove.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CommandNumber","parent":"CUserCmd","type":"classfunc","description":{"text":"Returns an increasing number representing the index of the user cmd.","warning":"The value returned is occasionally 0 inside GM:CreateMove and GM:StartCommand. It is advised to check for a non-zero value if you wish to get the correct number."},"realm":"Shared","rets":{"ret":{"text":"The command number","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetButtons","parent":"CUserCmd","type":"classfunc","description":"Returns a bitflag indicating which buttons are pressed.","realm":"Shared","rets":{"ret":{"text":"Pressed buttons, see Enums/IN","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetForwardMove","parent":"CUserCmd","type":"classfunc","description":"The speed the client wishes to move forward with, negative if the clients wants to move backwards.","realm":"Shared","rets":{"ret":{"text":"The desired speed","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetImpulse","parent":"CUserCmd","type":"classfunc","description":"Gets the current impulse from the client, usually 0. [See impulses list](https://developer.valvesoftware.com/wiki/Impulse) and some GMod specific impulses.","realm":"Shared","rets":{"ret":{"text":"The impulse","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMouseWheel","parent":"CUserCmd","type":"classfunc","description":"Returns the scroll delta as whole number.","realm":"Shared","rets":{"ret":{"text":"Scroll delta","name":"","type":"number"}}},"example":{"code":"hook.Add( \"StartCommand\", \"StartCommandExample\", function( ply, cmd )\n\tif ( cmd:GetMouseWheel() != 0 ) then print( ply, \" scrolled \", cmd:GetMouseWheel()) end\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMouseX","parent":"CUserCmd","type":"classfunc","description":"Returns the delta of the angular horizontal mouse movement of the player.","realm":"Shared","rets":{"ret":{"text":"xDelta","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMouseY","parent":"CUserCmd","type":"classfunc","description":"Returns the delta of the angular vertical mouse movement of the player.","realm":"Shared","rets":{"ret":{"text":"yDelta","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSideMove","parent":"CUserCmd","type":"classfunc","description":"The speed the client wishes to move sideways with, positive if it wants to move right, negative if it wants to move left.","realm":"Shared","rets":{"ret":{"text":"requestSpeed","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetUpMove","parent":"CUserCmd","type":"classfunc","description":"The speed the client wishes to move up with, negative if the clients wants to move down.","realm":"Shared","rets":{"ret":{"text":"requestSpeed","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetViewAngles","parent":"CUserCmd","type":"classfunc","description":"Gets the direction the player is looking in.","realm":"Shared","rets":{"ret":{"text":"The direction the player is looking in.","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsForced","parent":"CUserCmd","type":"classfunc","description":"When players are not sending usercommands to the server (often due to lag), their last usercommand will be executed multiple times as a backup. This function returns true if that is happening.\n\nThis will never return true clientside.","realm":"Shared","rets":{"ret":{"text":"isForced","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"KeyDown","parent":"CUserCmd","type":"classfunc","description":"Returns true if the specified button(s) is pressed.","realm":"Shared","args":{"arg":{"text":"Bitflag representing which button to check, see Enums/IN.","name":"key","type":"number"}},"rets":{"ret":{"text":"Is key down or not","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RemoveKey","parent":"CUserCmd","type":"classfunc","description":"Removes a key bit from the current key bitflag.\n\nFor movement you will want to use CUserCmd:SetForwardMove, CUserCmd:SetUpMove and CUserCmd:SetSideMove.","realm":"Shared","args":{"arg":{"text":"Bitflag to be removed from the key bitflag, see Enums/IN.","name":"button","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SelectWeapon","parent":"CUserCmd","type":"classfunc","description":{"text":"Forces the associated player to select a weapon. This is used internally in the default HL2 weapon selection HUD.\n\nThis may not work immediately if the current command is in prediction. Use input.SelectWeapon to switch the weapon from the client when the next available command can do so.","note":"This is the ideal function to use to create a custom weapon selection HUD, as it allows prediction to run properly for WEAPON:Deploy and GM:PlayerSwitchWeapon"},"realm":"Shared","args":{"arg":{"text":"The weapon entity to select.","name":"weapon","type":"Weapon"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetButtons","parent":"CUserCmd","type":"classfunc","description":{"text":"Sets the buttons as a bitflag. See also CUserCmd:GetButtons.","note":"If you are looking to affect player movement, you may need to use CUserCmd:SetForwardMove instead of setting the keys."},"realm":"Shared","args":{"arg":{"text":"Bitflag representing which buttons are \"down\", see Enums/IN.","name":"buttons","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetForwardMove","parent":"CUserCmd","type":"classfunc","description":"Sets speed the client wishes to move forward with, negative if the clients wants to move backwards.\n\nSee also CUserCmd:ClearMovement, CUserCmd:SetSideMove and CUserCmd:SetUpMove.","realm":"Shared","args":{"arg":{"text":"The new speed to request. The client will not be able to move faster than their set walk/sprint speed.","name":"speed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetImpulse","parent":"CUserCmd","type":"classfunc","description":"Sets the impulse command to be sent to the server.\n\nHere are a few examples of impulse numbers:\n- `100` toggles their flashlight\n- `101` gives the player all Half-Life 2 weapons with `sv_cheats` set to `1`\n- `200` toggles holstering / restoring the current weapon  \n  When holstered, the `EF_NODRAW` flag is set on the active weapon.\n- `154` toggles noclip\n\n[See full list](https://developer.valvesoftware.com/wiki/Impulse)","realm":"Shared","args":{"arg":{"text":"The impulse to send.","name":"impulse","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetMouseWheel","parent":"CUserCmd","type":"classfunc","description":"Sets the scroll delta.","realm":"Shared","args":{"arg":{"text":"The scroll delta.","name":"speed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetMouseX","parent":"CUserCmd","type":"classfunc","description":"Sets the delta of the angular horizontal mouse movement of the player.\n\nSee also CUserCmd:SetMouseY.","realm":"Shared","args":{"arg":{"text":"Angular horizontal move delta.","name":"speed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetMouseY","parent":"CUserCmd","type":"classfunc","description":"Sets the delta of the angular vertical mouse movement of the player.\n\nSee also CUserCmd:SetMouseX.","realm":"Shared","args":{"arg":{"text":"Angular vertical move delta.","name":"speed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetSideMove","parent":"CUserCmd","type":"classfunc","description":"Sets speed the client wishes to move sidewards with, positive to move right, negative to move left.\n\nSee also CUserCmd:SetForwardMove and  CUserCmd:SetUpMove.","realm":"Shared","args":{"arg":{"text":"The new speed to request.","name":"speed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetUpMove","parent":"CUserCmd","type":"classfunc","description":{"text":"Sets speed the client wishes to move upwards with, negative to move down.\n\nSee also CUserCmd:SetSideMove and  CUserCmd:SetForwardMove.","note":"This function does **not** move the client up/down ladders. To force ladder movement, consider CUserCMD:SetButtons and use IN_FORWARD from Enums/IN."},"realm":"Shared","args":{"arg":{"text":"The new speed to request.","name":"speed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetViewAngles","parent":"CUserCmd","type":"classfunc","description":{"text":"Sets the direction the client wants to move in.","note":["For human players, the pitch (vertical) angle should be clamped to +/- 89° to prevent the player's view from glitching.","For fake clients (those created with player.CreateNextBot), this functionally dictates the 'move angles' of the bot. This typically functions separately from the colloquial view angles. This can be utilized by CUserCmd:SetForwardMove and its related functions."]},"realm":"Shared","args":{"arg":{"text":"New view angles.","name":"viewAngle","type":"Angle"}}},"example":{"description":"Locks the player's view to only vertical movement.","code":"hook.Add(\"InputMouseApply\", \"LockToPitchOnly\", function( ccmd, x, y, angle )\n\t-- By leaving angle.roll and angle.yaw alone, we effectively lock them\n\tangle.pitch = math.Clamp( angle.pitch + y / 50, -89, 89 )\n\tccmd:SetViewAngles( angle )\n\treturn true\nend)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"TickCount","parent":"CUserCmd","type":"classfunc","description":{"text":"Returns tick count since joining the server.","note":["This will always return 0 for bots.","Returns 0 clientside during prediction calls. If you are trying to use CUserCmd:Set*() on the client in a movement or command hook, keep doing so till TickCount returns a non-zero number to maintain prediction."]},"realm":"Shared","rets":{"ret":{"text":"The amount of ticks passed since joining the server.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Activate","parent":"Entity","type":"classfunc","description":{"text":"Activates the entity. This needs to be used on some entities (like constraints) after being spawned.","note":"For some entity types when this function is used after Entity:SetModelScale, the physics object will be recreated with the new scale. [Source-sdk-2013](https://github.com/ValveSoftware/source-sdk-2013/blob/55ed12f8d1eb6887d348be03aee5573d44177ffb/mp/src/game/server/baseanimating.cpp#L321-L327).\n\nCalling this method after Entity:SetModelScale will recreate a new scaled `SOLID_VPHYSICS` PhysObj on scripted entities. This can be a problem if you made a properly scaled PhysObj of another kind (using Entity:PhysicsInitSphere for instance) or if you edited the PhysObj's properties. This is especially the behavior of the Sandbox spawn menu."},"realm":"Shared"},"example":{"description":"Spawns a `sent_ball` on the player.","code":"function ENT:SpawnMe(ply)\n\tlocal ent = ents.Create(\"sent_ball\")\n\tent:SetPos( ply:GetPos() ) \n\tent:Spawn()\n\tent:Activate()\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddCallback","parent":"Entity","type":"classfunc","description":{"text":"Add a callback function to a specific event. This is used instead of hooks to avoid calling empty functions unnecessarily.\n\nThis also allows you to use certain hooks in engine entities (non-scripted entities).","warning":"This method does not check if the function has already been added to this object before, so if you add the same callback twice, it will be run twice! Make sure to add your callback only once."},"realm":"Shared","args":{"arg":[{"text":"The hook name to hook onto. See Entity Callbacks","name":"hook","type":"string"},{"text":"The function to call. It's arguments and return values will depend on the hook specified in the first argument.","name":"func","type":"function"}]},"rets":{"ret":{"text":"The callback ID that was just added, which can later be used in Entity:RemoveCallback.\n\nReturns nothing if the passed callback function was invalid or when asking for a non-existent hook.","name":"","type":"number"}}},"example":[{"description":"Adds a callback to an entity which is called every time the entity angles change.","code":"myentity:AddCallback( \"OnAngleChange\", function( entity, newangle )\n\t-- Do stuff\nend )"},{"description":"Creates watermelon prop which creates sparks on collision point whenever touches something.","code":"local melon = ents.Create( \"prop_physics\" ) -- Spawn prop\nif ( !IsValid( melon ) ) then return end -- Safety first\nmelon:SetModel( \"models/props_junk/watermelon01.mdl\" ) -- Set watermelon model\nmelon:SetPos( Entity(1):GetEyeTrace().HitPos ) -- Set pos where is player looking\nmelon:Spawn() -- Instantiate prop\n\nlocal function PhysCallback( ent, data ) -- Function that will be called whenever collision happends\n\tlocal effect = EffectData() -- Create effect data\n\teffect:SetOrigin( data.HitPos ) -- Set origin where collision point is\n\tutil.Effect( \"cball_bounce\", effect ) -- Spawn small sparky effect\nend\nmelon:AddCallback( \"PhysicsCollide\", PhysCallback ) -- Add Callback"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddEffects","parent":"Entity","type":"classfunc","description":"Applies an engine effect to an entity.\n\nSee also Entity:IsEffectActive and  Entity:RemoveEffects.","realm":"Shared","args":{"arg":{"text":"The effect to apply, see Enums/EF.","name":"effect","type":"number{EF}"}}},"example":{"description":"Adds a blinking effect to an entity.","code":"Entity:AddEffects( EF_ITEM_BLINK )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddEFlags","parent":"Entity","type":"classfunc","description":"Adds engine flags.","realm":"Shared","args":{"arg":{"text":"Engine flag to add, see Enums/EFL","name":"flag","type":"number{EFL}"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddFlags","parent":"Entity","type":"classfunc","description":"Adds flags to the entity.","realm":"Shared","args":{"arg":{"text":"Flag to add, see Enums/FL","name":"flag","type":"number{FL}"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddGesture","parent":"Entity","type":"classfunc","description":{"text":"Adds a gesture animation to the entity and plays it.\n\n\nSee Entity:AddGestureSequence and Entity:AddLayeredSequence for functions that takes sequences instead of Enums/ACT.","note":"This function only works on BaseAnimatingOverlay entites!"},"realm":"Server","args":{"arg":[{"text":"The activity to play as the gesture. See Enums/ACT.","name":"activity","type":"number"},{"text":"Automatically remove the gesture when it fully plays (Entity:GetLayerCycle reaches 1).","name":"autokill","type":"boolean","default":"true"}]},"rets":{"ret":{"text":"Layer ID of the started gesture, used to manipulate the played gesture by other functions.","name":"","type":"number","note":"If a layer has already been allocated for supplied Enums/ACT, it will return existing layer ID instead of allocating a new layer."}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddGestureSequence","parent":"Entity","type":"classfunc","description":{"text":"Adds a gesture animation to the entity and plays it.\n\n\nSee Entity:AddGesture for a function that takes Enums/ACT.\n\n\nSee also Entity:AddLayeredSequence.","note":"This function only works on BaseAnimatingOverlay entites!"},"realm":"Server","args":{"arg":[{"text":"The sequence ID to play as the gesture. See Entity:LookupSequence.","name":"sequence","type":"number"},{"text":"Automatically remove the gesture when it fully plays (Entity:GetLayerCycle reaches 1).","name":"autokill","type":"boolean","default":"true"}]},"rets":{"ret":{"text":"Layer ID of the started gesture, used to manipulate the played gesture by other functions.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddLayeredSequence","parent":"Entity","type":"classfunc","description":{"text":"Adds a gesture animation to the entity and plays it.\n\n\nSee Entity:AddGestureSequence for a function that doesn't take priority.\n\n\nSee Entity:AddGesture for a function that takes Enums/ACT.","note":"This function only works on BaseAnimatingOverlay entites!"},"realm":"Server","args":{"arg":[{"text":"The sequence ID to play as the gesture. See Entity:LookupSequence.","name":"sequence","type":"number"},{"name":"priority","type":"number"}]},"rets":{"ret":{"text":"Layer ID of created layer","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddSolidFlags","parent":"Entity","type":"classfunc","description":"Adds solid flag(s) to the entity.","realm":"Shared","args":{"arg":{"text":"The flag(s) to apply, see Enums/FSOLID.","name":"flags","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddSpawnFlags","parent":"Entity","type":"classfunc","description":{"text":"Adds onto the current SpawnFlags of an Entity.\n\nSpawnFlags can easily be found on https://developer.valvesoftware.com/wiki/.","note":"See also Entity:RemoveSpawnFlags, Entity:SetSpawnFlags\n\n\tUsing SF Enumerations won't work, if this function is ran clientside due to the enumerations being defined only Serverside. Use the actual SpawnFlag number."},"added":"2024.12.04","realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"11-L13"},"args":{"arg":{"text":"The SpawnFlag to add to the Entity","name":"flag","type":"number"}}},"example":[{"description":"When a turret Entity is created, it adds the `Out of Ammo` SpawnFlag, therefore it doesn't have ammo.","code":"hook.Add( \"OnEntityCreated\", \"AddSpawnFlagsExample\", function( ent )\n\ttimer.Simple( 0.1, function()\n\t\tif ( !IsValid(ent) or ent:GetClass() != \"npc_turret_floor\" ) then return end\n\n\t\tent:AddSpawnFlags(256) -- https://developer.valvesoftware.com/wiki/Npc_turret_floor#Flags\n\tend )\nend )"},{"description":"When a turret Entity is created, it adds the `Out of Ammo` and `Fast Retire` SpawnFlag, therefore it doesn't have ammo and it goes into idle state faster.","code":"hook.Add( \"OnEntityCreated\", \"AddSpawnFlagsExample\", function( ent )\n\ttimer.Simple( 0.1, function()\n\t\tif ( !IsValid(ent) or ent:GetClass() != \"npc_turret_floor\" ) then return end\n\n\t\tent:AddSpawnFlags( bit.bor( ent:GetSpawnFlags(), 256, 128 ) ) -- https://developer.valvesoftware.com/wiki/Npc_turret_floor#Flags\n\tend )\nend )"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddToMotionController","parent":"Entity","type":"classfunc","description":{"text":"Adds a PhysObject to the entity's motion controller so that ENTITY:PhysicsSimulate will be called for given PhysObject as well.\n\nYou must first create a motion controller with Entity:StartMotionController.\n\nYou can remove added PhysObjects by using Entity:RemoveFromMotionController.","note":"Only works on a scripted Entity of anim type"},"realm":"Shared","args":{"arg":{"text":"The PhysObj to add to the motion controller.","name":"physObj","type":"PhysObj"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AlignAngles","parent":"Entity","type":"classfunc","description":{"text":"Returns an angle based on the ones inputted that you can use to align an object.","note":"This function doesn't change the angle of the entity on its own (see example)."},"realm":"Shared","args":{"arg":[{"text":"The angle you want to align from","name":"from","type":"Angle"},{"text":"The angle you want to align to","name":"to","type":"Angle"}]},"rets":{"ret":{"text":"The resulting aligned angle","name":"","type":"Angle"}}},"example":{"description":"This example will make ent1 face up from ent2.","code":"ent1:SetAngles(ent1:AlignAngles(ent1:GetForward():Angle(), ent2:GetUp():Angle()))","output":"Sets ent1's angle to one where ent1 faces up from ent2."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Alive","parent":"Entity","type":"classfunc","description":"Checks if the entity is considered alive.\n\nChecks entity's internal life state variable. Does not check health, but it is generally expected the health to be 0 or below at the point of an entity being considered dead. This internally looks up the save value `m_lifeState`","added":"2025.01.24","realm":"Shared","rets":{"ret":{"text":"Whether the entity is considered alive.","name":"","type":"boolean"}}},"example":{"description":"Sets the entity to return false for :Alive(), useful for npcs/nextbots that don't die at 0 health.","code":"-- 0 is alive, 1 is \"death animation\", 2 is dead.\nent:SetSaveValue(\"m_lifeState\", 2)\nprint(ent:Alive())"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"BecomeRagdollOnClient","parent":"Entity","type":"classfunc","description":"Spawns a clientside ragdoll for the entity, positioning it in place of the original entity, and makes the entity invisible. It doesn't preserve flex values (face posing) as CSRagdolls don't support flex.\n\nIt does not work on players. Use Player:CreateRagdoll instead.\n\nThe original entity is not removed, and neither are any ragdolls previously generated with this function.\n\nTo make the entity re-appear, run Entity:SetNoDraw( false )","realm":"Client","rets":{"ret":{"text":"The created ragdoll. (`class C_ClientRagdoll`)","name":"","type":"Entity"}}},"example":{"description":"Some examples:","code":"-- Example 1: Spawns a ragdoll for all NPCs.\n\nfor i, npc in ipairs( ents.FindByClass( \"npc_*\" ) ) do\n    npc.RagDoll = npc:BecomeRagdollOnClient()\nend\n\n\n-- Example 2: Apply force to a ragdoll.\n\nlocal npc = ents.FindByClass(\"npc_zombie\")[1]\nif npc then\n    local rag = npc:BecomeRagdollOnClient()\n    local phys = rag:GetPhysicsObject()\n    if IsValid(phys) then\n        phys:ApplyForceCenter(Vector(0,0,5000)) -- push upward\n    end\nend\n\n\n-- Example 3: Every time a player hits an NPC, it becomes a ragdoll on the client side.\n\nhook.Add(\"EntityTakeDamage\", \"ClientRagdollOnHit\", function(target, dmginfo)\n    if target:IsNPC() and dmginfo:GetAttacker():IsPlayer() then\n        local rag = target:BecomeRagdollOnClient()\n    end\nend)"},"realms":["Client"],"type":"Function"},
{"function":{"name":"BeingLookedAtByLocalPlayer","parent":"Entity","type":"classfunc","description":{"text":"Returns true if the entity is being looked at by the local player and is within 256 units of distance.","note":"This function is only available in entities that are based off of sandbox's base_gmodentity."},"realm":"Client","file":{"text":"gamemodes/sandbox/entities/entities/base_gmodentity.lua","line":"10-L35"},"rets":{"ret":{"text":"Is the entity being looked at by the local player and within 256 units.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Blocked","parent":"Entity","type":"classfunc","description":{"text":"Dispatches blocked events to this entity's blocked handler. This function is only useful when interacting with entities like func_movelinear.","internal":""},"realm":"Server","args":{"arg":{"text":"The entity that is blocking us","name":"entity","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"BodyTarget","parent":"Entity","type":"classfunc","description":{"text":"Returns a centered vector of this entity, NPCs use this internally to aim at their targets.","note":"This only works on players and NPCs."},"realm":"Server","args":{"arg":[{"text":"The vector of where the the attack comes from.","name":"origin","type":"Vector"},{"text":"Decides if it should return the centered vector with a random offset to it.","name":"noisy","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"The centered vector.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"BoneHasFlag","parent":"Entity","type":"classfunc","description":"Returns whether the entity's bone has the flag or not.","realm":"Shared","args":{"arg":[{"text":"Bone ID to test flag of.","name":"boneID","type":"number"},{"text":"The flag to test, see Enums/BONE","name":"flag","type":"number{BONE}"}]},"rets":{"ret":{"text":"Whether the bone has that flag or not","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"BoneLength","parent":"Entity","type":"classfunc","description":"Returns the length between given bone's position and the position of given bone's parent.","realm":"Shared","args":{"arg":{"text":"The ID of the bone you want the length of. You may want to get the length of the next bone ( boneID + 1 ) for decent results","name":"boneID","type":"number"}},"rets":{"ret":{"text":"The length of the bone","name":"","type":"number"}}},"example":{"description":"Returns first bones length of first player on the server","code":"print( Entity( 1 ):BoneLength( 1 ) )","output":"Returns 0"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"BoundingRadius","parent":"Entity","type":"classfunc","description":"Returns the distance between the center of the bounding box and the furthest bounding box corner.","realm":"Shared","rets":{"ret":{"text":"The radius of the bounding box.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CallDTVarProxies","parent":"Entity","type":"classfunc","description":"Calls all Entity:NetworkVarNotify functions with the given new value, but doesn't change the real value.","realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"345-L352"},"args":{"arg":[{"text":"The NetworkVar Type. Supported choices:\n\n* `String` (up to 511 characters)\n* `Bool`\n* `Float`\n* `Int` (32-bit signed integer)\n* `Vector`\n* `Angle`\n* `Entity`","name":"type","type":"string"},{"text":"The NetworkVar slot. See Entity:NetworkVar for more detailed explanation.","name":"slot","type":"number"},{"text":"The new value.","name":"newValue","type":"any"}]}},"example":{"description":"Calls the NetworkVarNotify function with the given new value but doesn't changes the real value.","code":"Entity(1):NetworkVar(\"String\", 0, \"Example\")\nEntity(1):SetExample(\"hello\")\nEntity(1):NetworkVarNotify(\"Example\", function(ent, var, old, new) print(ent, var, old, new) end)\nEntity(1):CallDTVarProxies(\"String\", 0, \"world\")\nprint(\"Value:\" .. Entity(1):GetExample())","output":"Player [1][Raphael]\tExample\thello\tworld  \nValue: hello"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CallOnRemove","parent":"Entity","type":"classfunc","description":{"text":"Causes a specified function to be run if the entity is removed by any means. This can later be undone by Entity:RemoveCallOnRemove if you need it to not run.","warning":["This hook is called clientside during full updates. See GM:EntityRemoved for more information.","An error being thrown inside `removeFunc` will stop other `EntityRemoved` hooks from executing."]},"realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"120-L132"},"args":{"arg":[{"text":"Identifier that can be optionally used with Entity:RemoveCallOnRemove to undo this call on remove.","name":"identifier","type":"any"},{"text":"Function to be called on remove.","name":"removeFunc","type":"function","callback":{"arg":[{"text":"The entity about to be removed.","type":"Entity","name":"ent"},{"text":"Data passed from the arguments to `CallOnRemove`.","type":"vararg","name":"data"}]}},{"text":"Optional arguments to pass to removeFunc. Do note that the first argument passed to the function will always be the entity being removed, and the arguments passed on here start after that.","name":"args","type":"vararg"}]}},"example":{"description":"Stops an engine sound when the entity is removed","code":"Entity:CallOnRemove( \"StopEngineSound\", function( ent ) ent:StopSound( \"enginenoise.wav\" ) end )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ClearAllOutputs","parent":"Entity","type":"classfunc","description":"Clears all registered events for map I/O outputs on this entity. If a string is given, will use the string as a wildcard to limit removed outputs by name matches.","realm":"Server","added":"2023.01.25","args":{"arg":{"text":"An optional string that will be used to limit removed outputs by name matches, supports wildcards.","name":"outputName","type":"string","default":"nil"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ClearPoseParameters","parent":"Entity","type":"classfunc","description":"Resets all pose parameters such as aim_yaw, aim_pitch and rotation.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CollisionRulesChanged","parent":"Entity","type":"classfunc","description":{"text":"Declares that the collision rules of the entity have changed, and subsequent calls for GM:ShouldCollide with this entity may return a different value than they did previously.","warning":["This function must **not** be called inside of GM:ShouldCollide. Instead, it must be called in advance when the condition is known to change.","Failure to use this function correctly will result in a crash of the physics engine."]},"realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CopyBoneMatrix","parent":"Entity","type":"classfunc","description":"Same as Entity:GetBoneMatrix, but instead of returning a new matrix object, it copies the data to a given matrix.\n\nThis is measurably faster when accessing bone matrices a lot.","realm":"Shared","added":"2025.12.18","args":{"arg":[{"text":"The bone ID to retrieve matrix of, starting at index 0.","name":"boneID","type":"number"},{"text":"The matrix to copy the bone matrix to.","name":"data","type":"VMatrix"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CreateBoneFollowers","parent":"Entity","type":"classfunc","description":{"text":"Creates bone followers based on the current entity model.\n\nBone followers are Entities whose Physics Objects follow a specific bone on another Entity's model.  \nThis is what is used by `prop_dynamic` for things like big combine doors with multiple physics objects which follow the visual mesh of the door when it animates.\n\nBe mindful that bone followers create a separate entity (`phys_bone_follower`) for each physics object.\n\nYou must call Entity:UpdateBoneFollowers every tick for bone followers to update their positions.","note":"This function only works on `anim`, `nextbot` and `ai` type entities."},"realm":"Server","added":"2021.01.27","args":{"arg":{"text":"If set, a whitelist of bone names to create bone followers for. If a models' bone name is not in this list, a bone follower entity will not be created for it.","name":"bone_whitelist","type":"table","default":"nil","added":"2024.05.14"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"CreatedByMap","parent":"Entity","type":"classfunc","description":"Returns whether the entity was created by map or not.","realm":"Shared","rets":{"ret":{"text":"Is created by map?","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CreateParticleEffect","parent":"Entity","type":"classfunc","description":{"text":"Creates a clientside particle system attached to the entity. See also Global.CreateParticleSystem","note":"The particle effect must be precached with Global.PrecacheParticleSystem and the file its from must be added via game.AddParticles before it can be used!"},"realm":"Client","args":{"arg":[{"text":"The particle name to create","name":"particle","type":"string"},{"text":"Attachment ID to attach the particle to","name":"attachment","type":"number"},{"text":"A table of tables ( IDs 1 to 64 ) having the following structure:\n* number attachtype - The particle attach type. See PATTACH. **Default:** PATTACH_ABSORIGIN\n* Entity entity - The parent entity? **Default:** NULL\n* Vector position - The offset position for given control point. **Default:**  nil\n\nThis only affects the control points of the particle effects and will do nothing if the effect doesn't use control points.","name":"options","type":"table","default":"nil"}]},"rets":{"ret":{"text":"The created particle system.","name":"","type":"CNewParticleEffect"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"CreateShadow","parent":"Entity","type":"classfunc","description":"Draws the shadow of an entity.","realm":"Client"},"example":{"code":"function ENT:Draw()\n\tself:DrawModel()\n\tself:CreateShadow()\nend","output":"Draws the shadow of an entity"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DeleteOnRemove","parent":"Entity","type":"classfunc","description":"Whenever the entity is removed, entityToRemove will be removed also.","realm":"Server","args":{"arg":{"text":"The entity to be removed","name":"entityToRemove","type":"Entity"}}},"example":{"description":"Creates a second chair in spawned jeeps that is removed when the jeep is removed","code":"hook.Add(\"PlayerSpawnedVehicle\", \"VehicleUpgrade\", function(ply,vehicle)\n\tif vehicle:GetClass() == \"prop_vehicle_jeep\" then\n\t\tlocal seat = ents.Create( 'prop_vehicle_prisoner_pod' )\n\t\tseat:SetModel( \"models/nova/jeep_seat.mdl\" )\n\t\tseat:SetPos( vehicle:LocalToWorld(Vector(21,-32,18)) )\n\t\tseat:SetAngles( vehicle:LocalToWorldAngles(Angle(0,-3.5,0)) )\n\t\tseat:Spawn()\n\t\tseat:SetKeyValue( \"limitview\", 0 )\n\t\ttable.Merge( seat, { HandleAnimation = function(_,ply) return ply:SelectWeightedSequence( ACT_HL2MP_SIT ) end } )\n\t\tgamemode.Call( \"PlayerSpawnedVehicle\", ply, seat )\n\t\tvehicle.PassengerSeat = seat\n\t\tvehicle:DeleteOnRemove(seat) //<--\n\t\tconstraint.Weld(seat, vehicle)\n\tend\nend)"},"realms":["Server"],"type":"Function"},
{"function":{"name":"DestroyBoneFollowers","parent":"Entity","type":"classfunc","description":{"text":"Destroys bone followers created by Entity:CreateBoneFollowers.","note":"This function only works on `anim` type entities."},"realm":"Server","added":"2021.01.27"},"realms":["Server"],"type":"Function"},
{"function":{"name":"DestroyShadow","parent":"Entity","type":"classfunc","description":{"text":"Removes the shadow for the entity.\n\nThe shadow will be recreated as soon as the entity wakes.","note":"Doesn't affect shadows from flashlight/lamps/env_projectedtexture."},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DisableMatrix","parent":"Entity","type":"classfunc","description":"Disables an active matrix. See Entity:EnableMatrix for more info about active matrixes.","realm":"Client","args":{"arg":{"text":"The name of the matrix type to disable.\n\nCurrently the only matrix type is `\"RenderMultiply\"`.","name":"matrixType","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"DispatchTraceAttack","parent":"Entity","type":"classfunc","description":{"text":"Performs a trace attack towards the entity this function is called on, as if an invisible bullet is shot towards it. Visually identical to Entity:TakeDamageInfo.","warning":"Calling this function on the victim entity in ENTITY:OnTakeDamage can cause infinite loops.","note":"This function correctly applies damage to [func_breakable_surf](https://developer.valvesoftware.com/wiki/Func_breakable_surf) entities, unlike Entity:TakeDamageInfo."},"realm":"Shared","args":{"arg":[{"text":"The damage to apply.","name":"damageInfo","type":"CTakeDamageInfo"},{"text":"Trace result to use to deal damage. See Structures/TraceResult","name":"traceRes","type":"table"},{"text":"Direction of the attack.","name":"dir","type":"Vector","default":"traceRes.HitNormal"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Dissolve","parent":"Entity","type":"classfunc","description":"Dissolves the entity.\n\nThis function creates an `env_entity_dissolver` entity internally, which is parented to the target entity and remains until the entity is fully dissolved. Calling this function on an entity that is already dissolving will not create another `env_entity_dissolver` entity.","realm":"Server","added":"2024.05.14","args":{"arg":[{"text":"Dissolve type. Should be one of the following values:\n\n| ID | Description |\n|||\n| 0 | ENTITY_DISSOLVE_NORMAL |\n| 1 | ELECTRICAL|\n| 2 | ELECTRICAL_LIGHT |\n| 3 | ENTITY_DISSOLVE_CORE |","name":"type","type":"number","default":"0"},{"text":"Magnitude of the dissolve effect, its effect depends on the dissolve type.","name":"magnitude","type":"number","default":"0"},{"text":"The origin for the dissolve effect, its effect depends on the dissolve type. Defaults to entity's origin.","name":"origin","type":"Vector","default":"nil"},{"text":"Delay until starting the dissolve, in seconds. There will be some particles produced during this time.","name":"delay","type":"number","default":"0","added":"2026.05.19"}]}},"example":{"description":"A console command that will dissolve whatever the played is looking at, with a 3 second delay.","code":"if ( SERVER ) then\n\tconcommand.Add( \"dissolve\", function( ply )\n\t\tlocal plyTr = ply:GetEyeTrace()\n\n\t\tif ( IsValid( plyTr.Entity ) ) then\n\t\t\tplyTr.Entity:Dissolve( 0, 0, nil, 3 )\n\t\tend\n\tend )\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"DontDeleteOnRemove","parent":"Entity","type":"classfunc","description":{"text":"This removes the argument entity from an ent's list of entities to 'delete on remove'","note":"Also see Entity:DeleteOnRemove"},"realm":"Server","args":{"arg":{"text":"The entity to be removed from the list of entities to delete","name":"entityToUnremove","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"DrawModel","parent":"Entity","type":"classfunc","description":{"text":"Draws the entity or model.\n\nIf called inside ENTITY:Draw or ENTITY:DrawTranslucent, it only draws the entity's model itself.\n\nIf called outside of those hooks, it will call both of said hooks depending on Entity:GetRenderGroup, drawing the entire entity again.\n\nWhen drawing an entity more than once per frame in different positions, you should call Entity:SetupBones before each draw; Otherwise, the entity will retain its first drawn position.","rendercontext":{"hook":"false","type":"3D"},"bug":[{"text":"Calling this on entities with EF_BONEMERGE and EF_NODRAW applied causes a crash.","issue":"1558"},{"text":"Using this with a map model (game.GetWorld():GetModel()) crashes the game.","issue":"2688"},{"text":"Calling this on a player during that player's GM:PrePlayerDraw hook call will cause infinite recursion and crash the game.","issue":"4116"}]},"args":{"arg":{"text":"The optional STUDIO_ flags, usually taken from ENTITY:Draw and similar hooks.","name":"flags","type":"number","default":"STUDIO_RENDER"}},"realm":"Client"},"example":{"description":"Manually draws a single Global.ClientsideModel on the specified bone, on the given offset for every player affected by this hook.\n\nThis is useful in case you want to reuse a single model without having to create one for each player.","code":"local modelexample = ClientsideModel( \"models/thrusters/jetpack.mdl\" )\nmodelexample:SetNoDraw( true )\n\nlocal offsetvec = Vector( 3, -5.6, 0 )\nlocal offsetang = Angle( 180, 90, -90 )\n\nhook.Add( \"PostPlayerDraw\" , \"manual_model_draw_example\" , function( ply )\n\tlocal boneid = ply:LookupBone( \"ValveBiped.Bip01_Spine2\" )\n\t\n\tif not boneid then\n\t\treturn\n\tend\n\t\n\tlocal matrix = ply:GetBoneMatrix( boneid )\n\t\n\tif not matrix then \n\t\treturn \n\tend\n\t\n\tlocal newpos, newang = LocalToWorld( offsetvec, offsetang, matrix:GetTranslation(), matrix:GetAngles() )\n\t\n\tmodelexample:SetPos( newpos )\n\tmodelexample:SetAngles( newang )\n\tmodelexample:SetupBones()\n\tmodelexample:DrawModel()\nend)","output":{"image":{"src":"entity_drawmodel_example.png"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawShadow","parent":"Entity","type":"classfunc","description":"Sets whether an entity's shadow should be drawn.","realm":"Shared","args":{"arg":{"text":"True to enable, false to disable shadow drawing.","name":"shouldDraw","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DropToFloor","parent":"Entity","type":"classfunc","description":"Move an entity down until it collides with something.","realm":"Server","args":{"arg":[{"text":"Trace mask.","name":"mask","type":"number","default":"MASK_SOLID","added":"2025.09.18"},{"text":"Trace ignore entity.","name":"ignoreEnt","type":"Entity","default":"nil","added":"2025.09.18"},{"text":"Max trace dist.","name":"maxDist","type":"number","default":"256","added":"2025.09.18"}]}},"example":[{"description":"Move all props on the server down until they collide with something.","code":"for _, ent in ipairs( ents.FindByClass( \"prop_physics\" ) ) do\n\tent:DropToFloor()\nend"},{"description":"Drops players to the ground when they spawn.","code":"hook.Add( \"PlayerSpawn\", \"DropGround\", function( ply )\n\tply:DropToFloor()\nend )"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"DTVar","parent":"Entity","type":"classfunc","description":{"text":"Sets up a self.dt.NAME alias for a Data Table variable.","internal":"You should use Entity:NetworkVar instead"},"realm":"Shared","args":[{"arg":[{"text":"The type of the DTVar being set up. Supported choices:\n\n* `String` (up to 511 characters)\n* `Bool`\n* `Float`\n* `Int` (32-bit signed integer)\n* `Vector`\n* `Angle`\n* `Entity`","name":"type","type":"string"},{"text":"The ID of the DTVar. Can be between `0` and `3` for strings, `0` and `31` for everything else.\n\nThis can be omitted entirely (arguments will shift) and it will use the next available slot.","name":"slot","type":"number"},{"text":"Name by which you will refer to DTVar. It must be a valid variable name. (No spaces!)","name":"name","type":"string"}]},{"name":"Slot argument is omitted","arg":[{"text":"The type of the DTVar being set up. Supported choices:\n\n* `String` (up to 511 characters)\n* `Bool`\n* `Float`\n* `Int` (32-bit signed integer)\n* `Vector`\n* `Angle`\n* `Entity`","name":"type","type":"string"},{"text":"Name by which you will refer to DTVar. It must be a valid variable name. (No spaces!)","name":"name","type":"string"}]}]},"example":{"description":"Sets up two float networked variables, **TargetZ** and **Speed**","code":"function ENT:SetupDataTables()\n\n\tself:DTVar( \"Float\", 0, \"TargetZ\" )\n\tself:DTVar( \"Float\", 1, \"Speed\" )\n\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EmitSound","parent":"Entity","type":"classfunc","description":{"text":"Plays a sound on an entity. See also Global.EmitSound if you wish to play sounds without an entity.\n\nIf run clientside, the sound will only be heard locally.  \nIf used on a player or NPC character with the mouth rigged, the character will \"lip-sync\" if the sound file contains lipsync data. See [this page](https://developer.valvesoftware.com/wiki/Choreography_creation/Lip_syncing) for more information.","note":"When using this function with weapons, use the Weapon itself as the entity, not its owner!","warning":"Due to engine quirks, [sound scripts](https://developer.valvesoftware.com/wiki/Soundscripts) can't have their soundlevel, pitch, volume, or channel changed when played from an entity—the sound script parameters will override whatever you pass to this function.\n\nYou can do one of these instead:\n* Use sound.GetProperties to select a sound from the script, and play the sound file directly.\n* For single-use sounds, you can pass the SND_CHANGE_VOL or SND_CHANGE_PITCH sound flags. However, this will change the volume or pitch of the sound if it's already playing, instead of starting the sound over or playing another instance.\n* Use Global.EmitSound with the entity parameter set to the Entity:EntIndex of the entity you want to play the sound on.","bug":{"text":"This does not respond to Global.SuppressHostEvents.","issue":"2651"}},"realm":"Shared","args":{"arg":[{"text":"The name of the sound to be played.\n\nThis should either be a sound script name (sound.Add) or a file path relative to the `sound/` folder. (so don't include `sound/`, and make note that it's not sound**s** when moving the sound file itself)","name":"soundName","type":"string","warning":"The string cannot have whitespace at the start or end. You can remove this with string.Trim."},{"text":"A modifier for the distance this sound will reach, acceptable range is 0 to 511. 100 means no adjustment to the level. See Enums/SNDLVL","name":"soundLevel","type":"number","default":"75"},{"text":"The pitch applied to the sound. The acceptable range is from 0 to 255. 100 means the pitch is not changed.","name":"pitchPercent","type":"number","default":"100"},{"text":"The volume, from 0 to 1.","name":"volume","type":"number","default":"1"},{"text":"The sound channel, see Enums/CHAN.","name":"channel","type":"number","default":"CHAN_AUTO, CHAN_WEAPON for weapons"},{"text":"The flags of the sound, see Enums/SND","name":"soundFlags","type":"number","default":"0"},{"text":"The DSP preset for this sound. DSP Presets","name":"dsp","type":"number","default":"1"},{"text":"If set serverside, the sound will only be networked to the clients in the filter.","name":"filter","type":"CRecipientFilter","default":"nil","added":"2023.10.25"}]}},"example":{"description":"Plays sound from the first player on the server.","code":"Entity(1):EmitSound( \"garrysmod/save_load1.wav\", 75, 100, 1, CHAN_AUTO ) -- Same as below\nEntity(1):EmitSound( \"garrysmod/save_load1.wav\" ) -- You can remove the arguments that have default values.\n\nEntity(1):EmitSound( \"Weapon_AR2.Single\" )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EmitStepSound","parent":"Entity","type":"classfunc","description":"Plays a sound of a step depending on the surface below the entity's foot.\n\nIt will use attachments `\"RightFoot\"` or `\"LeftFoot\"` to decide where to check the surface at. If the attachments do not exist, it will use regular Valve Biped skeleton bones. If they don't exist, it will fallback to the entity's origin.","realm":"Shared","added":"2026.07.01","args":{"arg":[{"text":"Determines whether the step is a right foot or a left foot.\n\nThis is used for certain NPCs such as Eli to determine what sound should be played. This also determines the position of the sound.","name":"isLeftFoot","type":"boolean"},{"text":"The volume, from 0 to 1.","name":"volume","type":"number","default":"1"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EnableConstraints","parent":"Entity","type":"classfunc","description":"Toggles the constraints of this ragdoll entity on and off.","realm":"Server","args":{"arg":{"text":"Set to true to enable the constraints and false to disable them.\n\nDisabling constraints will delete the constraints.","name":"toggleConstraints","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"EnableCustomCollisions","parent":"Entity","type":"classfunc","description":"Flags an entity as using custom lua defined collisions. Fixes entities having spongy player collisions or not hitting traces, such as after Entity:PhysicsFromMesh\n\nInternally identical to `Entity:AddSolidFlags( bit.bor( FSOLID_CUSTOMRAYTEST, FSOLID_CUSTOMBOXTEST ) )`\n\nDo not confuse this function with Entity:SetCustomCollisionCheck, they are not the same.","realm":"Shared"},"example":{"description":"Creates a mesh table, and assigns it as the entity's collisions","code":"function ENT:ProceduralPlatform()\n\tlocal VERTICES = {}\n\tfor x = 1, 32 do\n\t\tfor y = 1, 32 do\n\t\t\ttable.insert( VERTICES, { pos = ( self:GetPos() + Vector( 0, 0, 1 ) ) } )\n\t\t\ttable.insert( VERTICES, { pos = ( self:GetPos() + Vector( 0, y, 1 ) ) } )\n\t\t\ttable.insert( VERTICES, { pos = ( self:GetPos() + Vector( x, y, 1 ) ) } )\n\n\t\t\ttable.insert( VERTICES, { pos = ( self:GetPos() + Vector( 0, 0, 1 ) ) } )\n\t\t\ttable.insert( VERTICES, { pos = ( self:GetPos() + Vector( x, y, 1 ) ) } )\n\t\t\ttable.insert( VERTICES, { pos = ( self:GetPos() + Vector( x, 0, 1 ) ) } )\n\t\tend\n\tend\n\tself:PhysicsFromMesh( VERTICES )\n\tself:GetPhysicsObject():EnableMotion( false )\n\tself:EnableCustomCollisions()\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EnableMatrix","parent":"Entity","type":"classfunc","description":{"text":"Can be used to apply a custom VMatrix to the entity, mostly used for scaling the model by a Vector.\n\nTo disable it, use Entity:DisableMatrix.\n\nIf your old scales are wrong due to a recent update, use Entity:SetLegacyTransform as a quick fix.","note":"The matrix can also be modified to apply a custom rotation and offset via the VMatrix:SetAngles and VMatrix:SetTranslation functions.","bug":{"text":"This does not scale procedural bones, and disables inverse kinematics of the entity.","issue":"3502"}},"realm":"Client","args":{"arg":[{"text":"The name of the matrix type.  \nCurrently the only matrix type is `\"RenderMultiply\"`.","name":"matrixType","type":"string"},{"text":"The matrix to apply before drawing the entity.","name":"matrix","type":"VMatrix"}]}},"example":{"description":"To scale a prop's height by 4x","code":"local scale = Vector(1,1,4)\n\nlocal mat = Matrix()\nmat:Scale(scale)\nprop:EnableMatrix(\"RenderMultiply\", mat)"},"realms":["Client"],"type":"Function"},
{"function":{"name":"EntIndex","parent":"Entity","type":"classfunc","description":{"text":"Gets the unique entity index of an entity.","note":"Entity indices are marked as unused after deletion, and can be reused by newly-created entities"},"realm":"Shared","rets":{"ret":{"text":"The index of the entity.\n\n`-1` for clientside-only or `0` for serverside-only and NULL entities.","name":"","type":"number"}}},"example":{"description":"Demonstrates the use of this function.","code":"print( player.GetAll()[1]:EntIndex() )","output":"1"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Extinguish","parent":"Entity","type":"classfunc","description":"Extinguishes the entity if it is on fire.\n\nHas no effect if called inside GM:EntityTakeDamage (and the attacker is the flame that's hurting the entity)\n\nSee also Entity:Ignite.","realm":"Server"},"example":{"description":"Demonstrates the use of this function.","code":"Player(1):Extinguish()","output":"Extinguishes the first player if he is on fire."},"realms":["Server"],"type":"Function"},
{"function":{"name":"EyeAngles","parent":"Entity","type":"classfunc","description":{"text":"Returns the direction a player, npc or ragdoll is looking as a world-oriented angle.","bug":[{"text":"This can return an incorrect value in vehicles (like pods, buggy, ...). **This bug has been fixed in the past but was causing many addons being broken, so the fix has been removed but applied to Player:GetAimVector only**.","issue":"1150"},{"text":"This may return local angles in jeeps when used with Player:EnterVehicle. **A workaround is available in the second example.**","issue":"2620"}]},"realm":"Shared","rets":{"ret":{"text":"Player's eye angle.","name":"","type":"Angle"}}},"example":[{"description":"Print the local player's angles.","code":"print( LocalPlayer():EyeAngles() )","output":"When looking straight down, it might return `Angle(89, -175.38, 0)`."},{"description":"Fix the issue with vehicles when used with Player:EnterVehicle.","code":"print( LocalPlayer():GetVehicle():LocalToWorldAngles( LocalPlayer():EyeAngles() ) )"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EyePos","parent":"Entity","type":"classfunc","description":"Returns the position of an Player/NPC's view.","realm":"Shared","rets":{"ret":{"text":"View position of the entity.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"FindBodygroupByName","parent":"Entity","type":"classfunc","description":{"text":"Searches the Entity model for a Body Group with a given name.","note":"Weapons will return results from their viewmodels."},"realm":"Shared","args":{"arg":{"text":"The name to search for.","name":"name","type":"string"}},"rets":{"ret":{"text":"The Body Group or `-1` if no Body Group has the provided name.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"FindGestureLayer","parent":"Entity","type":"classfunc","description":{"text":"Searches the currently active layers for a layer playing animation with given activity.","note":"This function only works on BaseAnimatingOverlay entites!"},"added":"2025.07.31","realm":"Server","args":{"arg":{"text":"The activity to search for.","name":"activity","type":"number{ACT}"}},"rets":{"ret":{"text":"A layer ID for given activity, or `-1` if not found.","name":"layerID","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"FindGestureSequenceLayer","parent":"Entity","type":"classfunc","description":{"text":"Searches the currently active layers for a layer playing animation with given sequence.","note":"This function only works on BaseAnimatingOverlay entites!"},"added":"2025.07.31","realm":"Server","args":{"arg":{"text":"The sequence ID to search for. See Entity:LookupSequence.","name":"sequenceID","type":"number"}},"rets":{"ret":{"text":"A layer ID for given sequence, or `-1` if not found.","name":"layerID","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"FindTransitionSequence","parent":"Entity","type":"classfunc","description":"Returns a transition from the given start and end sequence.\n\nThis function was only used by HL1 entities and NPCs, before the advent of sequence blending and gestures.","realm":"Shared","args":{"arg":[{"text":"The currently playing sequence","name":"currentSequence","type":"number"},{"text":"The goal sequence.","name":"goalSequence","type":"number"}]},"rets":{"ret":{"text":"The transition sequence, -1 if not available.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Fire","parent":"Entity","type":"classfunc","description":"Fires an entity's input, conforming to the map IO event queue system. You can find inputs for most entities on the [Valve Developer Wiki](https://developer.valvesoftware.com/wiki/Output)\n\nSee also Entity:Input for a function that bypasses the event queue and GM:AcceptInput.","realm":"Server","args":{"arg":[{"text":"The name of the input to fire","name":"input","type":"string"},{"text":"The value to give to the input, can also be a number or a boolean.","name":"param","type":"string|number|boolean","default":"nil"},{"text":"Delay in seconds before firing","name":"delay","type":"number","default":"0"},{"text":"The entity that caused this input (i.e. the player who pushed a button)","name":"activator","type":"Entity","default":"nil"},{"text":"The entity that is triggering this input (i.e. the button that was pushed)","name":"caller","type":"Entity","default":"nil"}]}},"example":{"description":"If you are looking at a door, this will lock it","code":"// Entity(1) is considered a player in this example\nlocal tr = Entity( 1 ):GetEyeTrace()\nlocal ent = tr.Entity\nif IsValid( ent ) then\n\tent:Fire(\"Lock\")\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"FireBullets","parent":"Entity","type":"classfunc","description":"Fires a bullet.\n\nWhen used in a  hook such as WEAPON:Think or WEAPON:PrimaryAttack, it will use Player:LagCompensation internally.\n\nLag compensation will not work if this function is called in a timer, regardless if the timer was made in a predicted hook.\n\nDue to how `Entity:FireBullets` is set up internally, bullet tracers will always originate from the first attachment/index 1. This can be avoided by supplying your own tracer effect.\n\nWhen firing bullets from a Weapon, it is recommended to fire bullets from the weapon owner entity (Player or NPC), not the Weapon itself.","realm":"Shared","args":{"arg":[{"text":"The bullet data to be used. See the Structures/Bullet.","name":"bulletInfo","type":"table{Bullet}"},{"text":"Has the effect of encasing the FireBullets call in Global.SuppressHostEvents, only works in multiplayer.","name":"suppressHostEvents","type":"boolean","default":"false"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"FollowBone","parent":"Entity","type":"classfunc","description":{"text":"Makes an entity follow another entity's bone.\n\nInternally this function calls Entity:SetParent( parent, boneid ), Entity:AddEffects( EF_FOLLOWBONE \n ) and sets an internal flag to always rebuild all bones.","note":"If the entity vibrates or stops following the parent, you probably need to run Entity:SetPredictable( true ) clientside.","warning":"This function will not work if the target bone's parent bone is invalid or if the bone is not used by VERTEX LOD0"},"realm":"Shared","args":{"arg":[{"text":"The entity to follow the bone of. If unset, removes the FollowBone effect.","name":"parent","type":"Entity","default":"NULL"},{"text":"The bone to follow","name":"boneid","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ForcePlayerDrop","parent":"Entity","type":"classfunc","description":"Forces the entity to be dropped, if it is being held by a player's Gravity Gun, Physics Gun or `+use` pickup.\n\nSee also Player:DropObject.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"FrameAdvance","parent":"Entity","type":"classfunc","description":{"text":"Advances the cycle of an animated entity.\n\nAnimations that loop will automatically reset the cycle so you don't have to - ones that do not will stop animating once you reach the end of their sequence.","warning":"Do not call this function multiple times a frame, as it can cause unexpected results, such as animations playing at increased rate, etc.\n\nNextBot:BodyMoveXY calls this internally, so do not call this function before or after NextBot:BodyMoveXY."},"realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAbsVelocity","parent":"Entity","type":"classfunc","description":{"text":"Returns the entity's velocity.","note":"Actually binds to CBaseEntity::GetLocalVelocity() which retrieves the velocity of the entity due to its movement in the world from forces such as gravity. Does not include velocity from entity-on-entity collision."},"realm":"Shared","rets":{"ret":{"text":"The velocity of the entity.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAngles","parent":"Entity","type":"classfunc","description":{"text":"Gets the angles of given entity.","bug":[{"text":"This returns incorrect results for the local player clientside.","issue":"2764"},{"text":"This will return the local player's Global.EyeAngles in rendering hooks.","issue":"3106"},{"text":"This will return Global.Angle(0,0,0) in rendering hooks while paused in single-player.","issue":"3107"}]},"realm":"Shared","rets":{"ret":{"text":"The angles of the entity.","name":"","type":"Angle"}}},"example":{"description":"Prints the 1st player's angles.","code":"print( Entity( 1 ):GetAngles() )","output":"Something like \"0.000 34.529 0.000\" in console."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAnimCount","parent":"Entity","type":"classfunc","description":"Returns the amount of animations (not to be confused with sequences) the entity's model has. A sequence can consist of multiple animations.\n\nSee also Entity:GetAnimInfo","added":"2022.06.08","realm":"Shared","rets":{"ret":{"text":"The amount of animations the entity's model has.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAnimInfo","parent":"Entity","type":"classfunc","description":{"text":"Returns a table containing the number of frames, flags, name, and FPS of an entity's animation ID.","note":"Animation ID is not the same as sequence ID. See Entity:GetAnimCount"},"realm":"Shared","args":{"arg":{"text":"The animation ID to look up, starting at 0.","name":"animIndex","type":"number"}},"rets":{"ret":{"text":"Information about the animation, or `nil` if the index is out of bounds.\n\nA table with the following keys:\n* string label - Animation name\n* number fps - How many frames per second the animation should be played at\n* number flags - [STUDIO_](https://github.com/ZeqMacaw/Crowbar/blob/0d46f3b6a694b74453db407c72c12a9685d8eb1d/Crowbar/Core/GameModel/SourceCommon/SourceMdlFileData/SourceMdlAnimationDesc.vb#L181) flags, such as looping\n* number numframes - Number of frames the animation has","name":"","type":"table|nil"}}},"example":{"description":"A function that finds an entity sequence's corresponding animation and returns the animation info.","code":"function GetAnimInfoSequence( ent, seq )\n\n\tif( !IsValid( ent ) ) then return nil end\n\n\tlocal seqname = ent:GetSequenceName( seq )\n\tif( seqname == \"Unknown\" ) then return nil end\n\n\tfor i=0, ent:GetAnimCount() do\n\t\n\t\tlocal info = ent:GetAnimInfo(i)\n\t\t\n\t\tif ( string.find( info.label, \"@\" .. seqname, 0, true ) or string.find( info.label, \"a_\" .. seqname, 0, true ) ) then\n\t\t\treturn info\n\t\tend\n\n\tend\n\n\treturn nil\n\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAnimTime","parent":"Entity","type":"classfunc","description":"Returns the last time the entity had an animation update. Returns 0 if the entity doesn't animate.","realm":"Client","rets":{"ret":{"text":"The last time the entity had an animation update.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetAnimTimeInterval","parent":"Entity","type":"classfunc","description":"Returns the amount of time since last animation.\n\nWorks only on `CBaseAnimating` entities.","added":"2021.03.31","realm":"Shared","rets":{"ret":{"text":"The amount of time since last animation.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAttachment","parent":"Entity","type":"classfunc","description":{"text":"Gets the orientation and position of the attachment by its ID, returns nothing if the attachment does not exist.","note":"The update rate of this function is limited by the setting of ENT.AutomaticFrameAdvance for Scripted Entities!","bug":{"text":"This will return improper values for viewmodels if used in GM:CalcView.","issue":"1255"}},"realm":"Shared","args":{"arg":{"text":"The internal ID of the attachment.","name":"attachmentId","type":"number"}},"rets":{"ret":{"text":"The table with angle and position of the attachment or `nil` if does not exist. See the Structures/AngPos. Most notably, the table contains the keys `Ang` and `Pos` as well as `Bone`.","name":"","type":"table{AngPos}|nil"}}},"example":[{"description":"Grabs the muzzle position of a player's view model.","code":"local vm = ply:GetViewModel()\nlocal obj = vm:LookupAttachment( \"muzzle\" )\n\nif (obj > 0) then\n\tlocal muzzle = vm:GetAttachment( obj )\n\tprint( muzzle.Pos, muzzle.Ang )\nend"},{"description":"Draws a green cube at the player's view model muzzle if the model has a \"muzzle\" attachment. This properly translates the attachment into the view model projection space.","code":"local function FormatViewModelAttachment(vOrigin, bFrom --[[= false]])\n\n\tlocal view = render.GetViewSetup()\n\n\tlocal vEyePos = view.origin\n\tlocal aEyesRot = view.angles\n\tlocal vOffset = vOrigin - vEyePos\n\tlocal vForward = aEyesRot:Forward()\n\n\tlocal nViewX = math.tan( view.fovviewmodel_unscaled * math.pi / 360)\n\n\tif (nViewX == 0) then\n\t\tvForward:Mul(vForward:Dot(vOffset))\n\t\tvEyePos:Add(vForward)\n\n\t\treturn vEyePos\n\tend\n\n\tlocal nWorldX = math.tan( view.fov_unscaled * math.pi / 360)\n\n\tif (nWorldX == 0) then\n\t\tvForward:Mul(vForward:Dot(vOffset))\n\t\tvEyePos:Add(vForward)\n\n\t\treturn vEyePos\n\tend\n\n\tlocal vRight = aEyesRot:Right()\n\tlocal vUp = aEyesRot:Up()\n\n\tif (bFrom) then\n\t\tlocal nFactor = nWorldX / nViewX\n\t\tvRight:Mul(vRight:Dot(vOffset) * nFactor)\n\t\tvUp:Mul(vUp:Dot(vOffset) * nFactor)\n\telse\n\t\tlocal nFactor = nViewX / nWorldX\n\t\tvRight:Mul(vRight:Dot(vOffset) * nFactor)\n\t\tvUp:Mul(vUp:Dot(vOffset) * nFactor)\n\tend\n\n\tvForward:Mul(vForward:Dot(vOffset))\n\n\tvEyePos:Add(vRight)\n\tvEyePos:Add(vUp)\n\tvEyePos:Add(vForward)\n\n\treturn vEyePos\nend\n\nSWEP.BoxAttachment = \"muzzle\"\nSWEP.BoxMins = Vector(-2, -2, -2)\nSWEP.BoxMaxs = Vector(2, 2, 2)\nSWEP.BoxColor = Color(0, 255, 0)\n\nfunction SWEP:ViewModelDrawn()\n\tlocal pOwner = self:GetOwner()\n\tif (not pOwner:IsValid()) then return end\n\n\tlocal pViewModel = pOwner:GetViewModel()\n\tif (not pViewModel:IsValid()) then return end\n\n\tlocal uAttachment = pViewModel:LookupAttachment(self.BoxAttachment)\n\tif (uAttachment < 1) then return end\n\n\tlocal tAttachment = pViewModel:GetAttachment(uAttachment)\n\tif (tAttachment == nil) then return end\n\n\trender.DrawWireframeBox(FormatViewModelAttachment(tAttachment.Pos, false), tAttachment.Ang, self.BoxMins, self.BoxMaxs, self.BoxColor, true)\nend"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAttachments","parent":"Entity","type":"classfunc","description":{"text":"Returns a table containing all attachments of the given entity's model.","bug":{"text":"This can have inconsistent results in single-player.","issue":"3167"}},"realm":"Shared","rets":{"ret":{"text":"Attachment data. See Structures/AttachmentData.\n\nReturns an empty table in case its model has no attachments or there's a some kind of other issue.","name":"","type":"table"}}},"example":[{"description":"All the attachments present on the Kleiner player model","code":"PrintTable(LocalPlayer():GetAttachments())","output":"```\n1:\n\t\tid\t=\t1\n\t\tname\t=\teyes\n2:\n\t\tid\t=\t2\n\t\tname\t=\tlefteye\n3:\n\t\tid\t=\t3\n\t\tname\t=\trighteye\n4:\n\t\tid\t=\t4\n\t\tname\t=\tnose\n5:\n\t\tid\t=\t5\n\t\tname\t=\tmouth\n6:\n\t\tid\t=\t6\n\t\tname\t=\ttie\n7:\n\t\tid\t=\t7\n\t\tname\t=\tpen\n8:\n\t\tid\t=\t8\n\t\tname\t=\tchest\n9:\n\t\tid\t=\t9\n\t\tname\t=\thips\n10:\n\t\tid\t=\t10\n\t\tname\t=\tlefthand\n11:\n\t\tid\t=\t11\n\t\tname\t=\trighthand\n12:\n\t\tid\t=\t12\n\t\tname\t=\tforward\n13:\n\t\tid\t=\t13\n\t\tname\t=\tanim_attachment_RH\n14:\n\t\tid\t=\t14\n\t\tname\t=\tanim_attachment_LH\n15:\n\t\tid\t=\t15\n\t\tname\t=\tanim_attachment_head\n```"},{"description":"Displays all the attachment names for all players","code":"hook.Add( \"PostPlayerDraw\", \"DrawAttachments\", function( ply )\n    local attachments = ply:GetAttachments()\n    for _, att in pairs( attachments ) do\n        local attPos = ply:GetAttachment( att.id )\n        cam.Start2D()\n        local toScreen = attPos.Pos:ToScreen()\n        draw.DrawText( att.name, nil, toScreen.x, toScreen.y, nil, TEXT_ALIGN_CENTER )\n        cam.End2D()\n    end\nend )","output":{"upload":{"src":"b3c8c/8dd19076f415df3.png","size":"1438950","name":"image.png"}}}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBaseVelocity","parent":"Entity","type":"classfunc","description":"Returns the entity's base velocity which is their velocity due to forces applied by other entities. This includes entity-on-entity collision or riding a treadmill.","realm":"Shared","rets":{"ret":{"text":"The base velocity of the entity.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBloodColor","parent":"Entity","type":"classfunc","description":"Returns the blood color of this entity. This can be set with Entity:SetBloodColor.","realm":"Shared","rets":{"ret":{"text":"Color from Enums/BLOOD_COLOR or nil","name":"","type":"number{BLOOD_COLOR}"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBodygroup","parent":"Entity","type":"classfunc","description":{"text":"Returns the Sub Model ID for the currently active Sub Model of the Body Group corresponding to the given Body Group ID.","note":"Weapons will return results from their viewmodels."},"realm":"Shared","args":{"arg":{"text":"The Body Group ID to retrieve the active Sub Model ID for.  \n\t\t\tBody Group IDs start at `0`.","name":"bodyGroupId","type":"number"}},"rets":{"ret":{"text":"The currently active Sub Model ID.  \n\t\t\tSub Model IDs start at `0`.","name":"","type":"number"}}},"example":{"description":"Gets the value of bodygroup 2 of entity player 1 is aiming at.","code":"print( Entity(1):GetEyeTrace().Entity:GetBodygroup(2) )","output":"\"1\" in console, if player 1 is aiming at airboat."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBodygroupCount","parent":"Entity","type":"classfunc","description":{"text":"Returns the number of Sub Models in the Body Group corresponding to a given Body Group ID of the Entity model.","note":"Weapons will return results from their viewmodels."},"realm":"Shared","args":{"arg":{"text":"The Body Group ID to retrieve the Sub Model count of.  \n\t\t\tBody Group IDs start at `0`.","name":"bodyGroupId","type":"number"}},"rets":{"ret":{"text":"The number of Sub Models in the Body Group.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBodygroupName","parent":"Entity","type":"classfunc","description":{"text":"Retrieves the name of the Body Group corresponding to a given Body Group ID on the Entity model.","note":"Weapons will return results from their viewmodels."},"realm":"Shared","args":{"arg":{"text":"The Body Group ID to get the name of.","name":"bodyGroupId","type":"number"}},"rets":{"ret":{"text":"The name of the Body Group.","name":"","type":"string"}}},"example":{"description":"Demonstrates the use of this function.","code":"print( Entity( 1 ):GetEyeTrace().Entity:GetBodygroupName( 1 ) )","output":"\"Weapon\" in console, if player 1 is aiming at airboat."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBodyGroups","parent":"Entity","type":"classfunc","description":{"text":"Returns a list of information about each Body Group present on the Entity model.","note":"Weapons will return results from their viewmodels."},"realm":"Shared","rets":{"ret":{"text":"A table of Body Group information where each value is a Structures/BodyGroupData.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBoneContents","parent":"Entity","type":"classfunc","description":"Returns the contents of the specified bone.","realm":"Shared","args":{"arg":{"text":"The bone id, starting at index 0. See Entity:LookupBone.","name":"bone","type":"number"}},"rets":{"ret":{"text":"The contents as a Enums/CONTENTS or 0 on failure.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBoneController","parent":"Entity","type":"classfunc","description":{"text":"Returns the value of the bone controller with the specified ID.","note":"This is the precursor of pose parameters, and only works for Half Life 1: Source models supporting it."},"realm":"Shared","args":{"arg":{"text":"ID of the bone controller. Goes from 0 to 3.","name":"boneID","type":"number"}},"rets":{"ret":{"text":"The value set on the bone controller.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBoneCount","parent":"Entity","type":"classfunc","description":{"text":"Returns the amount of bones in the entity.","note":"Will return `0` for Global.ClientsideModel or undrawn entities until Entity:SetupBones is called on the entity."},"realm":"Shared","rets":{"ret":{"text":"The amount of bones in given entity, starting at index 0.","name":"","type":"number"}}},"example":{"description":"Prints amount of bones in player 1","code":"print( Entity(1):GetBoneCount() )","output":"The amount of bones in player 1, which normally would be 68."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBoneMatrix","parent":"Entity","type":"classfunc","description":{"text":"Returns the transformation matrix of a given bone on the entity's model. The matrix contains the transformation used to position the bone in the world. It is not relative to the parent bone.\n\nThis is equivalent to constructing a VMatrix using Entity:GetBonePosition.\n\nSee Entity:CopyBoneMatrix for a more performant version.","bug":[{"text":"This can return the server's matrix during server lag.","issue":"884"},{"text":"This can return garbage serverside or a 0,0,0 fourth column (represents position) for v49 models.","issue":"3285"}]},"realm":"Shared","args":{"arg":{"text":"The bone ID to retrieve matrix of, starting at index 0.\n* Bones clientside and serverside will differ","name":"boneID","type":"number"}},"rets":{"ret":{"text":"The matrix\n\n* Some entities don't update animation every frame such as prop_physics and won't have accurate bone matrix.","name":"","type":"VMatrix"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBoneName","parent":"Entity","type":"classfunc","description":"Returns name of given bone id.\n\n\tSee Entity:LookupBone for the inverse of this function.","realm":"Shared","args":{"arg":{"text":"ID of bone to lookup name of, starting at index 0.","name":"index","type":"number"}},"rets":{"ret":{"text":"The name of given bone.\n\n* `\"__INVALIDBONE__\"` in case the name cannot be read or the index is out of range, or we failed or entity doesn't have a model.","name":"","type":"string"}}},"example":[{"description":"Will print name of bone name with id 0 for first player.","code":"print( Entity( 1 ):GetBoneName( 0 ) )","output":"```\nValveBiped.Bip01_Pelvis\n```"},{"description":"Prints all the bones of an entity.","code":"function PrintBones( entity )\n    for i = 0, entity:GetBoneCount() - 1 do\n        print( i, entity:GetBoneName( i ) )\n    end\nend","output":"```\n0\tValveBiped.Bip01_Pelvis\n1\tValveBiped.Bip01_Spine\n2\tValveBiped.Bip01_Spine1\n3\tValveBiped.Bip01_Spine2\n4\tValveBiped.Bip01_Spine4\n5\tValveBiped.Bip01_Neck1\n6\tValveBiped.Bip01_Head1\n7\tValveBiped.forward\n8\tValveBiped.Bip01_R_Clavicle\n9\tValveBiped.Bip01_R_UpperArm\n10\tValveBiped.Bip01_R_Forearm\n11\tValveBiped.Bip01_R_Hand\n12\tValveBiped.Anim_Attachment_RH\n13\tValveBiped.Bip01_L_Clavicle\n14\tValveBiped.Bip01_L_UpperArm\n15\tValveBiped.Bip01_L_Forearm\n16\tValveBiped.Bip01_L_Hand\n17\tValveBiped.Anim_Attachment_LH\n18\tValveBiped.Bip01_R_Thigh\n19\tValveBiped.Bip01_R_Calf\n20\tValveBiped.Bip01_R_Foot\n21\tValveBiped.Bip01_R_Toe0\n22\tValveBiped.Bip01_L_Thigh\n23\tValveBiped.Bip01_L_Calf\n24\tValveBiped.Bip01_L_Foot\n25\tValveBiped.Bip01_L_Toe0\n26\tValveBiped.Bip01_L_Finger4\n27\tValveBiped.Bip01_L_Finger41\n28\tValveBiped.Bip01_L_Finger42\n29\tValveBiped.Bip01_L_Finger3\n30\tValveBiped.Bip01_L_Finger31\n31\tValveBiped.Bip01_L_Finger32\n32\tValveBiped.Bip01_L_Finger2\n33\tValveBiped.Bip01_L_Finger21\n34\tValveBiped.Bip01_L_Finger22\n35\tValveBiped.Bip01_L_Finger1\n36\tValveBiped.Bip01_L_Finger11\n37\tValveBiped.Bip01_L_Finger12\n38\tValveBiped.Bip01_L_Finger0\n39\tValveBiped.Bip01_L_Finger01\n40\tValveBiped.Bip01_L_Finger02\n41\tValveBiped.Bip01_R_Finger4\n42\tValveBiped.Bip01_R_Finger41\n43\tValveBiped.Bip01_R_Finger42\n44\tValveBiped.Bip01_R_Finger3\n45\tValveBiped.Bip01_R_Finger31\n46\tValveBiped.Bip01_R_Finger32\n47\tValveBiped.Bip01_R_Finger2\n48\tValveBiped.Bip01_R_Finger21\n49\tValveBiped.Bip01_R_Finger22\n50\tValveBiped.Bip01_R_Finger1\n51\tValveBiped.Bip01_R_Finger11\n52\tValveBiped.Bip01_R_Finger12\n53\tValveBiped.Bip01_R_Finger0\n54\tValveBiped.Bip01_R_Finger01\n55\tValveBiped.Bip01_R_Finger02\n56\tValveBiped.Bip01_L_Elbow\n57\tValveBiped.Bip01_L_Ulna\n58\tValveBiped.Bip01_R_Ulna\n59\tValveBiped.Bip01_R_Shoulder\n60\tValveBiped.Bip01_L_Shoulder\n61\tValveBiped.Bip01_R_Trapezius\n62\tValveBiped.Bip01_R_Wrist\n63\tValveBiped.Bip01_R_Bicep\n64\tValveBiped.Bip01_L_Bicep\n65\tValveBiped.Bip01_L_Trapezius\n66\tValveBiped.Bip01_L_Wrist\n67\tValveBiped.Bip01_R_Elbow\n```"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBoneParent","parent":"Entity","type":"classfunc","description":{"text":"Returns parent bone of given bone.","note":"Will return -1 for Global.ClientsideModel until Entity:SetupBones is called on the entity."},"realm":"Shared","args":{"arg":{"text":"The bone ID of the bone to get parent of, starting at index 0.","name":"bone","type":"number"}},"rets":{"ret":{"text":"Parent bone ID or -1 if we failed for some reason.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBonePosition","parent":"Entity","type":"classfunc","description":{"text":"Returns the position and angle of the given attachment, relative to the world.","warning":"This function can return entity's `GetPos()` instead if the entity doesn't have it's bone cache set up.\n\nTo ensure the bone position is correct use this:\n```lua\nlocal pos = ent:GetBonePosition(0)\nif pos == ent:GetPos() then\n\tpos = ent:GetBoneMatrix(0):GetTranslation()\nend\n```","note":"This function returns the bone position from the last tick, so if your framerate is higher than the server's tickrate it may appear to lag behind if used on a fast moving entity. You can fix this by using the bone's matrix instead:\n```lua\nlocal matrix = entity:GetBoneMatrix(0)\nlocal pos = matrix:GetTranslation()\nlocal ang = matrix:GetAngles()\n```","bug":[{"text":"This can return the server's position during server lag.","issue":"884"},{"text":"This can return garbage serverside or Global.Vector(0,0,0) for v49 models.","issue":"3285"},{"text":"This can return garbage if a trace passed through the target bone during bone matrix access.","issue":"3739"}]},"realm":"Shared","args":{"arg":{"text":"The bone index of the bone to get the position of, starting at index 0. See Entity:LookupBone.","name":"boneIndex","type":"number"}},"rets":{"ret":[{"text":"The bone's position relative to the world. It can return nothing if the requested bone is out of bounds, or the entity has no model.","name":"","type":"Vector"},{"text":"The bone's angle relative to the world.","name":"","type":"Angle"}]}},"example":{"description":"Prints positions of all bones on an entity","code":"-- Get the first NPC on map\nlocal ent = ents.FindByClass( \"npc_*\" )[ 1 ]\n\n-- If one is found\nif ( IsValid( ent ) ) then\n\t-- For each bone\n\tfor i = 0, ent:GetBoneCount() - 1 do\n\t\t-- Print the entity, bone ID and bone position\n\t\tprint( ent, i, ent:GetBonePosition( i ) )\n\tend\nend","output":""},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBoneSurfaceProp","parent":"Entity","type":"classfunc","description":"Returns the surface property of the specified bone. See util.GetSurfaceData for more details about what they are.","realm":"Shared","args":{"arg":{"text":"The bone id, starting at index 0. See Entity:LookupBone.","name":"bone","type":"number"}},"rets":{"ret":{"text":"The surface property of the bone to be used with util.GetSurfaceIndex or an empty string on failure.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBrushPlane","parent":"Entity","type":"classfunc","description":{"text":"Returns info about given plane of non-nodraw brush model surfaces of the entity's model. Works on worldspawn as well.","warning":"This only works on entities with brush models."},"realm":"Shared","args":{"arg":{"text":"The index of the plane to get info of. Starts from 0.","name":"id","type":"number"}},"rets":{"ret":[{"text":"The origin of the plane.\n\nThis will be either the first vertex's position (if available) or the plane's normal multiplied by the plane's distance.","name":"","type":"Vector"},{"text":"The normal of the plane.","name":"","type":"Vector"},{"text":"The \"distance\" of the plane.\n\nThe distance is the dot product of the plane's normal and the point it was initialized with.","name":"","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBrushPlaneCount","parent":"Entity","type":"classfunc","description":"Returns the amount of planes of non-nodraw brush model surfaces of the entity's model.","realm":"Shared","rets":{"ret":{"text":"The amount of brush model planes of the entity's model. This will be 0 for any non-brush model.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBrushSurfaces","parent":"Entity","type":"classfunc","description":"Returns a table of brushes surfaces for brush model entities.","realm":"Shared","rets":{"ret":{"text":"A list of SurfaceInfo elements if the entity has a brush model, or `nil` otherwise.","name":"","type":"table<SurfaceInfo>"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetCallbacks","parent":"Entity","type":"classfunc","description":"Returns the specified hook callbacks for this entity added with Entity:AddCallback\n\nThe callbacks can then be removed with Entity:RemoveCallback.","realm":"Shared","args":{"arg":{"text":"The hook to retrieve the callbacks from, see Entity Callbacks for the possible hooks.","name":"hook","type":"string"}},"rets":{"ret":{"text":"A table containing the callbackid and function of all the callbacks for the specified hook","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetChildBones","parent":"Entity","type":"classfunc","description":"Returns ids of child bones of given bone.","realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"196-L210"},"args":{"arg":{"text":"Bone id to lookup children of","name":"boneid","type":"number"}},"rets":{"ret":{"text":"A table of bone ids","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetChildren","parent":"Entity","type":"classfunc","description":{"text":"Gets the children of the entity - that is, every entity whose move parent is this entity.","note":"This function returns Entity:SetMoveParent children, **NOT** Entity:SetParent!\n\nEntity:SetParent however also calls Entity:SetMoveParent.\n\n\n\nThis means that some entities in the returned list might have a NULL Entity:GetParent.\n\nThis also means that using this function on players will return their weapons on the client but not the server."},"realm":"Shared","rets":{"ret":{"text":"A list of movement children entities","name":"","type":"table<Entity>"}}},"example":{"description":"Example usage and output","code":"-- ent is a prop_effect entity\nPrintTable( ent:GetChildren() )","output":"```\n1\t=\tEntity [184][prop_dynamic]\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetClass","parent":"Entity","type":"classfunc","description":"Returns the classname of a entity. This is often the name of the Lua file or folder containing the files for the entity","realm":"Shared","rets":{"ret":{"text":"The entity's classname","name":"","type":"string"}}},"example":{"description":"Prints the classname of the weapon that the player is holding.","code":"print( LocalPlayer( ):GetActiveWeapon( ):GetClass( ) )","output":"Prints the classname of the weapon that the player is holding. (ie weapon_crowbar)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetCollisionBounds","parent":"Entity","type":"classfunc","description":"Returns an entity's collision bounding box.\n\nIn most cases, this will return the same bounding box as Entity:GetModelBounds unless the entity does not have a physics mesh or it has a PhysObj different from the default.\n\nCollision bounds can be previewed in singleplayer via `ent_bbox` console command, while looking at a desired entity and with `developer 1`. (Will appear as an orange wireframe box)","realm":"Shared","rets":{"ret":[{"text":"The minimum vector of the collision bounds, basically Entity:OBBMins.","name":"","type":"Vector"},{"text":"The maximum vector of the collision bounds, basically Entity:OBBMaxs.","name":"","type":"Vector"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetCollisionGroup","parent":"Entity","type":"classfunc","description":"Returns the entity's collision group","realm":"Shared","rets":{"ret":{"text":"The collision group. See Enums/COLLISION_GROUP","name":"","type":"number{COLLISION_GROUP}"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetColor","parent":"Entity","type":"classfunc","description":"Returns the color the entity is set to.","realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"167-L176"},"rets":{"ret":{"text":"The color of the entity as a Color.","name":"","type":"Color"}}},"example":{"code":"for key, ply in ipairs( player.GetAll() ) do -- Loop through all players on the server\n\tlocal col = ply:GetColor() -- Gets the players color and assigns it to local variable col\n \n\tprint( \"Printing \" .. ply:Nick() .. \"'s color!\" ) -- Say we are printing the players name's color\n\tPrintTable( col ) -- Pass col into PrintTable to print to contents of col\nend","output":"Loop through all players, and print their color."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetColor4Part","parent":"Entity","type":"classfunc","description":{"text":"Returns the color the entity is set to without using a color object.","internal":"Internally used to implement Entity:GetColor."},"realm":"Shared","rets":{"ret":[{"name":"r","type":"number"},{"name":"g","type":"number"},{"name":"b","type":"number"},{"name":"a","type":"number"}]}},"example":{"code":"Entity(1):SetColor4Part(0, 0, 0, 0)\nprint(Entity(1):GetColor4Part())","output":"0 0 0 0"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetConstrainedEntities","parent":"Entity","type":"classfunc","description":"Returns the two entities involved in a constraint ent, or nil if the entity is not a constraint.","realm":"Server","rets":{"ret":[{"text":"ent1","name":"","type":"Entity"},{"text":"ent2","name":"","type":"Entity"}]}},"example":{"description":"From gmsave/constraints.lua","code":"function gmsave.ConstraintSave( ent )\n\tlocal t = {}\n\tt.EntOne, t.EntTwo = ent:GetConstrainedEntities()\n\tlocal PhysA, PhysB = ent:GetConstrainedPhysObjects()\n\n\tt.BoneOne = GetPhysicsObjectNum( t.EntOne, PhysA )\n\tt.BoneTwo = GetPhysicsObjectNum( t.EntTwo, PhysB )\n\tt.EntOne = gmsave.EntityEncode( t.EntOne )\n\tt.EntTwo = gmsave.EntityEncode( t.EntTwo )\n\treturn t\n\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetConstrainedPhysObjects","parent":"Entity","type":"classfunc","description":"Returns the two entities physobjects involved in a constraint ent, or no value if the entity is not a constraint.","realm":"Server","rets":{"ret":[{"text":"phys1","name":"","type":"PhysObj"},{"text":"phys2","name":"","type":"PhysObj"}]}},"example":{"description":"From gmsave/constraints.lua","code":"function gmsave.ConstraintSave( ent )\n\tlocal t = {}\n\tt.EntOne, t.EntTwo = ent:GetConstrainedEntities()\n\tlocal PhysA, PhysB = ent:GetConstrainedPhysObjects()\n\n\tt.BoneOne = GetPhysicsObjectNum( t.EntOne, PhysA )\n\tt.BoneTwo = GetPhysicsObjectNum( t.EntTwo, PhysB )\n\tt.EntOne = gmsave.EntityEncode( t.EntOne )\n\tt.EntTwo = gmsave.EntityEncode( t.EntTwo )\n\treturn t\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetCreationID","parent":"Entity","type":"classfunc","description":{"text":"Returns entity's creation ID. Unlike Entity:EntIndex or Entity:MapCreationID.\n\nIt will increase up until value of `10 000 000`, at which point it will reset back to `0`.","bug":"This returns `0` for clientside only entities, such as `class CLuaEffect`."},"realm":"Shared","rets":{"ret":{"text":"The creation ID","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetCreationTime","parent":"Entity","type":"classfunc","description":{"text":"Returns the time the entity was created on, relative to Global.CurTime.","bug":"This returns `0` for clientside only entities, such as `class CLuaEffect`."},"realm":"Shared","rets":{"ret":{"text":"The time the entity was created on.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetCreator","parent":"Entity","type":"classfunc","description":"Gets the creator of the SENT.","realm":"Server","file":{"text":"lua/includes/extensions/entity.lua","line":"81-L83"},"rets":{"ret":{"text":"The creator, NULL for no creator.","name":"","type":"Player"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetCustomCollisionCheck","parent":"Entity","type":"classfunc","description":"Returns whether this entity uses custom collision check set by Entity:SetCustomCollisionCheck.","realm":"Shared","rets":{"ret":{"text":"Whether this entity uses custom collision check or not","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetCycle","parent":"Entity","type":"classfunc","description":"Returns the frame of the currently played sequence. This will be a number between 0 and 1 as a representation of sequence progress.","realm":"Shared","rets":{"ret":{"text":"The frame of the currently played sequence","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDTAngle","parent":"Entity","type":"classfunc","description":{"text":"This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible.\n\nGet an angle stored in the datatable of the entity.","internal":""},"realm":"Shared","args":{"arg":{"text":"Goes from 0 to 31.\nSpecifies what key to grab from datatable.","name":"key","type":"number"}},"rets":{"ret":{"text":"Requested angle.","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDTBool","parent":"Entity","type":"classfunc","description":{"text":"This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible.\n\nGet a boolean stored in the datatable of the entity.","internal":""},"realm":"Shared","args":{"arg":{"text":"Goes from 0 to 31.\nSpecifies what key to grab from datatable.","name":"key","type":"number"}},"rets":{"ret":{"text":"Requested boolean.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDTEntity","parent":"Entity","type":"classfunc","description":{"text":"This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible.\n\nReturns an entity stored in the datatable of the entity.","internal":""},"realm":"Shared","args":{"arg":{"text":"Goes from 0 to 31.\nSpecifies what key to grab from datatable.","name":"key","type":"number"}},"rets":{"ret":{"text":"Requested entity.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDTFloat","parent":"Entity","type":"classfunc","description":{"text":"This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible.\n\nGet a float stored in the datatable of the entity.","internal":""},"realm":"Shared","args":{"arg":{"text":"Goes from 0 to 31.\nSpecifies what key to grab from datatable.","name":"key","type":"number"}},"rets":{"ret":{"text":"Requested float.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDTInt","parent":"Entity","type":"classfunc","description":{"text":"This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible.\n\nGet an integer stored in the datatable of the entity.","internal":""},"realm":"Shared","args":{"arg":{"text":"Goes from 0 to 31.\nSpecifies what key to grab from datatable.","name":"key","type":"number"}},"rets":{"ret":{"text":"32-bit signed integer","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDTString","parent":"Entity","type":"classfunc","description":{"text":"This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible.\n\nGet a string stored in the datatable of the entity.","internal":""},"realm":"Shared","args":{"arg":{"text":"Goes from 0 to 3.\nSpecifies what key to grab from datatable.","name":"key","type":"number"}},"rets":{"ret":{"text":"Requested string.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDTVector","parent":"Entity","type":"classfunc","description":{"text":"This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible.\n\nGet a vector stored in the datatable of the entity.","internal":""},"realm":"Shared","args":{"arg":{"text":"Goes from 0 to 31.\nSpecifies what key to grab from datatable.","name":"key","type":"number"}},"rets":{"ret":{"text":"Requested vector.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetEditingData","parent":"Entity","type":"classfunc","description":{"text":"Returns internal data about editable Entity:NetworkVars.\n\n\t\tThis is used internally by DEntityProperties and Editable Entities system.","note":"This function will only work on entities which had Entity:InstallDataTable called on them, which is done automatically for players and all Scripted Entities"},"realm":"Shared","rets":{"ret":{"text":"The internal data","name":"data","type":"table"}}},"example":{"description":"Example output, if used on a `edit_sun`.","code":"local ent = ents.FindByClass(\"edit_sun\")[ 1 ]\nPrintTable( ent:GetNetworkVars() )","output":"```\noverlaycolor:\n\t\torder\t=\t4\n\t\ttitle\t=\tOverlayColor\n\t\ttype\t=\tVectorColor\noverlaysize:\n\t\tmax\t=\t200\n\t\tmin\t=\t0\n\t\torder\t=\t2\n\t\ttitle\t=\tOverlaySize\n\t\ttype\t=\tFloat\nsuncolor:\n\t\torder\t=\t3\n\t\ttitle\t=\tSunColor\n\t\ttype\t=\tVectorColor\nsunsize:\n\t\tmax\t=\t100\n\t\tmin\t=\t0\n\t\torder\t=\t1\n\t\ttitle\t=\tSunSize\n\t\ttype\t=\tFloat\n\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetEffects","parent":"Entity","type":"classfunc","description":"Returns a bit flag of all engine effect flags of the entity.","realm":"Shared","rets":{"ret":{"text":"Engine effect flags, see Enums/EF","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetEFlags","parent":"Entity","type":"classfunc","description":"Returns a bit flag of all engine flags of the entity.","realm":"Shared","rets":{"ret":{"text":"Engine flags, see Enums/EFL","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetElasticity","parent":"Entity","type":"classfunc","description":"Returns the elasticity of this entity, used by some flying entities such as the Helicopter NPC to determine how much it should bounce around when colliding.","realm":"Shared","rets":{"ret":{"text":"elasticity","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetFlags","parent":"Entity","type":"classfunc","description":"Returns all flags of given entity.","realm":"Shared","rets":{"ret":{"text":"Flags of given entity as a bitflag, see Enums/FL","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetFlexBounds","parent":"Entity","type":"classfunc","description":"Returns acceptable value range for the flex controller, as defined by the model.\n\nUsed with Entity:SetFlexWeight.","realm":"Shared","args":{"arg":{"text":"The ID of the flex to look up bounds of","name":"flex","type":"number"}},"rets":{"ret":[{"text":"The minimum value for this flex","name":"","type":"number"},{"text":"The maximum value for this flex","name":"","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetFlexIDByName","parent":"Entity","type":"classfunc","description":"Returns the ID of the flex based on the beginning or the entire name.","realm":"Shared","args":{"arg":{"text":"The name of the flex to get the ID of. Case sensitive.","name":"name","type":"string"}},"rets":{"ret":{"text":"The ID of flex\n* `nil` if no flex with given name was found","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetFlexName","parent":"Entity","type":"classfunc","description":"Returns the flex controller name at given index.","realm":"Shared","args":{"arg":{"text":"The flex index to look up name of. The range is between `0` and Entity:GetFlexNum - 1.","name":"id","type":"number"}},"rets":{"ret":{"text":"The flex name, or no value if the requested ID is out of bounds.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetFlexNum","parent":"Entity","type":"classfunc","description":{"text":"Returns the number of flex controllers this entity's model has.","note":"Please note that while this function can return the real number of flex controllers, the game supports only a certain amount due to networking limitations. See Entity:SetFlexWeight."},"realm":"Shared","rets":{"ret":{"text":"The number of flexes.","name":"","type":"number"}}},"example":{"description":"Draws all flex controller names and their values of the local player on the screen.","code":"hook.Add( \"HUDPaint\", \"draw_all_flexes\", function()\n\tlocal p = LocalPlayer()\n\n\tfor i=0, p:GetFlexNum() - 1 do\n\t\tdraw.SimpleText( tostring( i ) .. \" - \" .. p:GetFlexName( i ) , \"Default\", 50, 50 + i * 10, color_white )\n\t\tdraw.SimpleText( (\"%0.3f\"):format( p:GetFlexWeight( i ) ), \"Default\", 250, 50 + i * 10, color_white )\n\tend\nend )","output":{"text":"For default player model with flexes:","upload":{"src":"70c/8dc9c4b98a52bf4.png","size":"409335","name":"image.png"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetFlexScale","parent":"Entity","type":"classfunc","description":"Returns the flex scale of the entity.","realm":"Shared","rets":{"ret":{"text":"The flex scale","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetFlexType","parent":"Entity","type":"classfunc","description":"Returns flex controller type or \"category\". Used internally by Faceposer to categorize flex controllers.","realm":"Shared","added":"2024.06.28","args":{"arg":{"text":"The flex index to look up type of. The range is between `0` and Entity:GetFlexNum - 1.","name":"id","type":"number"}},"rets":{"ret":{"text":"The flex type, or no value if the requested ID is out of bounds.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetFlexWeight","parent":"Entity","type":"classfunc","description":"Returns current weight ( value ) of given flex controller. Please see Entity:SetFlexWeight regarding limitations.","realm":"Shared","args":{"arg":{"text":"The ID of the flex to get weight of","name":"flex","type":"number"}},"rets":{"ret":{"text":"The current weight of the flex, or 0 if out of bounds.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetForward","parent":"Entity","type":"classfunc","description":"Returns the forward vector of the entity, as a normalized direction vector","realm":"Shared","rets":{"ret":{"text":"forwardDir","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetFriction","parent":"Entity","type":"classfunc","description":"Returns the friction modifier for this entity. Entities default to `1` (100%) and can be higher.","realm":"Shared","rets":{"ret":{"text":"friction","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGravity","parent":"Entity","type":"classfunc","description":"Gets the gravity multiplier of the entity.","realm":"Shared","rets":{"ret":{"text":"gravityMultiplier","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGroundEntity","parent":"Entity","type":"classfunc","description":"Returns the object the entity is standing on.","realm":"Shared","rets":{"ret":{"text":"The ground entity.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGroundSpeedVelocity","parent":"Entity","type":"classfunc","description":"Returns the entity's ground speed velocity, which is based on the entity's walk/run speed and/or the ground speed of their sequence ( Entity:GetSequenceGroundSpeed ). Will return an empty Vector if the entity isn't moving on the ground.","realm":"Server","rets":{"ret":{"text":"The ground speed velocity.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetHitBoxBone","parent":"Entity","type":"classfunc","description":"Gets the bone the hit box is attached to.","realm":"Shared","args":{"arg":[{"text":"The number of the hit box.","name":"hitbox","type":"number"},{"text":"The number of the hit box set. This should be 0 in most cases.\n\nNumbering for these sets start from 0. The total amount of sets can be found with Entity:GetHitBoxSetCount.","name":"hboxset","type":"number"}]},"rets":{"ret":{"text":"The number of the bone. Will be nil if the hit box index was out of range.","name":"","type":"number"}}},"example":{"code":"local ply = LocalPlayer()\nlocal numHitBoxSets = ply:GetHitboxSetCount()\n\nfor hboxset=0, numHitBoxSets - 1 do\n  local numHitBoxes = ply:GetHitBoxCount( hboxset )\n    \n  for hitbox=0, numHitBoxes - 1 do\n    local bone = ply:GetHitBoxBone(hitbox, hboxset )\n\n    print( \"Hit box set \" .. hboxset .. \", hitbox \" .. hitbox .. \" is attached to bone \" .. ply:GetBoneName(bone) )\n  end\nend","output":"Hit box set 0, hit box 0 is attached to bone ValveBiped.Bip01_Head1, etc."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetHitBoxBounds","parent":"Entity","type":"classfunc","description":"Gets the bounds (min and max corners) of a hit box.","realm":"Shared","args":{"arg":[{"text":"The number of the hit box.","name":"hitbox","type":"number"},{"text":"The hitbox set of the hit box. This should be 0 in most cases.","name":"set","type":"number"}]},"rets":{"ret":[{"text":"Hit box mins. Will be nil if the hit box index was out of range.","name":"","type":"Vector"},{"text":"Hit box maxs. Will be nil if the hit box index was out of range.","name":"","type":"Vector"}]}},"example":{"description":"Displays the mins and maxs for the client's first hitbox in the first group, which is generally the head.","code":"local mins, maxs = LocalPlayer():GetHitBoxBounds(0, 0)\nprint(mins, maxs)","output":"-1.250000 -6.500000 -3.190000\t8.250000 3.500000 3.310000"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetHitBoxCount","parent":"Entity","type":"classfunc","description":"Gets how many hit boxes are in a given hit box set.","realm":"Shared","args":{"arg":{"text":"The number of the hit box set.","name":"set","type":"number"}},"rets":{"ret":{"text":"The number of hit boxes.","name":"","type":"number"}}},"example":{"description":"Will print out how many hit boxes the client has in each of their hit box sets.","code":"local numHitSetGroups = LocalPlayer():GetHitboxSetCount()\n\nfor i = 0, numHitSetGroups - 1 do\n\tlocal numHitBoxes = LocalPlayer():GetHitBoxCount( i )\n\tprint( \"Hit box set \" .. i .. \" has \" .. numHitBoxes .. \" hit boxes!\" )\nend","output":"Hit box set 0 has 17 hit boxes!"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetHitBoxGroupCount","parent":"Entity","type":"classfunc","description":{"text":"Returns the number of hit box sets that an entity has. Functionally identical to Entity:GetHitboxSetCount","deprecated":"You should use Entity:GetHitboxSetCount instead."},"realm":"Shared","rets":{"ret":{"text":"number of hit box sets","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetHitBoxHitGroup","parent":"Entity","type":"classfunc","description":"Gets the hit group of a given hitbox in a given hitbox set.","realm":"Shared","added":"2020.03.17","args":{"arg":[{"text":"The number of the hit box.","name":"hitbox","type":"number"},{"text":"The number of the hit box set. This should be 0 in most cases.\n\nNumbering for these sets start from 0. The total group count can be found with Entity:GetHitBoxSetCount.","name":"hitboxset","type":"number"}]},"rets":{"ret":{"text":"The hitbox group of given hitbox. See Enums/HITGROUP","name":"group","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetHitboxSet","parent":"Entity","type":"classfunc","description":"Returns entity's current hit box set","realm":"Shared","rets":{"ret":[{"text":"The current hit box set id, or no value if the entity doesn't have hit boxes","name":"","type":"number"},{"text":"The current hit box set name, or no value if the entity doesn't have hit boxes","name":"","type":"string"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetHitboxSetCount","parent":"Entity","type":"classfunc","description":"Returns the amount of hitbox sets in the entity.","realm":"Shared","rets":{"ret":{"text":"The amount of hitbox sets in the entity.","name":"","type":"number"}}},"example":{"description":"Prints how many hit box sets the client has","code":"local numHitBoxGroups = LocalPlayer():GetHitboxSetCount()\nprint(numHitBoxGroups)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetInternalVariable","parent":"Entity","type":"classfunc","description":"An interface for accessing internal key values on entities.\n\nSee Entity:GetSaveTable for a more detailed explanation. See Entity:SetSaveValue for the opposite of this function.","realm":"Shared","args":{"arg":{"text":"Name of variable corresponding to an entity save value.","name":"variableName","type":"string"}},"rets":{"ret":{"text":"The internal variable value.","name":"","type":"any"}}},"example":[{"description":"Get how long it has been since the player was damaged.","code":"local meta = FindMetaTable( \"Player\" )\n\nfunction meta:GetLastDamageTime()\n\n\treturn self:GetInternalVariable( \"m_flLastDamageTime\" )\n\nend\n\nprint( Entity( 1 ):GetLastDamageTime() )","output":"```\n-31.965000152588\n```"},{"description":"Determine if a door is locked or not (**server side**).","code":"function IsDoorLocked( entity )\n\n\treturn ( entity:GetInternalVariable( \"m_bLocked\" ) )\n\nend","output":"Returns `true` if the door is locked."},{"description":"Determines whether the door is open or not (**server side**).","code":"function DoorIsOpen( door )\n\t\n\tlocal doorClass = door:GetClass()\n\n\tif ( doorClass == \"func_door\" or doorClass == \"func_door_rotating\" ) then\n\n\t\treturn door:GetInternalVariable( \"m_toggle_state\" ) == 0\n\n\telseif ( doorClass == \"prop_door_rotating\" ) then\n\n\t\treturn door:GetInternalVariable( \"m_eDoorState\" ) ~= 0\n\n\telse\n\n\t\treturn false\n\n\tend\n\nend","output":"Returns `true` if the door is open."}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetKeyValues","parent":"Entity","type":"classfunc","description":"Returns a table containing Hammer key values the entity has stored. **Not all key values will be accessible this way.** Use GM:EntityKeyValue or ENTITY:KeyValue to capture and store every key value.\n\nSingle key values can usually be retrieved with Entity:GetInternalVariable.\n\nHere's a list of keyvalues that will not appear in this list, as they are not stored/defined as actual keyvalues internally:\n* rendercolor - Entity:GetColor (Only RGB)\n* rendercolor32 - Entity:GetColor (RGBA)\n* renderamt - Entity:GetColor (Alpha)\n* disableshadows - EF_NOSHADOW\n* mins - Entity:GetCollisionBounds\n* maxs - Entity:GetCollisionBounds\n* disablereceiveshadows - EF_NORECEIVESHADOW\n* nodamageforces - EFL_NO_DAMAGE_FORCES\n* angle - Entity:GetAngles\n* angles - Entity:GetAngles\n* origin - Entity:GetPos\n* targetname - Entity:GetName","realm":"Server","rets":{"ret":{"text":"A table of key values.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetLayerCycle","parent":"Entity","type":"classfunc","description":{"text":"Returns the animation cycle/frame for given layer.","note":"This function only works on BaseAnimatingOverlay entities."},"realm":"Shared","args":{"arg":{"text":"The Layer ID","name":"layerID","type":"number"}},"rets":{"ret":{"text":"The animation cycle/frame for given layer.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetLayerDuration","parent":"Entity","type":"classfunc","description":{"text":"Returns the duration of given layer.","note":"This function only works on BaseAnimatingOverlay entities."},"realm":"Shared","args":{"arg":{"text":"The Layer ID","name":"layerID","type":"number"}},"rets":{"ret":{"text":"The duration of the layer","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetLayerPlaybackRate","parent":"Entity","type":"classfunc","description":{"text":"Returns the layer playback rate. See also Entity:GetLayerDuration.","note":"This function only works on BaseAnimatingOverlay entities."},"added":"2020.03.17","realm":"Shared","args":{"arg":{"text":"The Layer ID","name":"layerID","type":"number"}},"rets":{"ret":{"text":"The current playback rate.","name":"rate","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetLayerSequence","parent":"Entity","type":"classfunc","description":{"text":"Returns the sequence id of given layer.","note":"This function only works on BaseAnimatingOverlay entities."},"added":"2020.06.24","realm":"Shared","args":{"arg":{"text":"The Layer ID.","name":"layerID","type":"number"}},"rets":{"ret":{"text":"The sequenceID of the layer.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetLayerWeight","parent":"Entity","type":"classfunc","description":{"text":"Returns the current weight of the layer. See Entity:SetLayerWeight for more information.","note":"This function only works on BaseAnimatingOverlay entities."},"realm":"Shared","args":{"arg":{"text":"The Layer ID","name":"layerID","type":"number"}},"rets":{"ret":{"text":"The current weight of the layer","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetLightingOriginEntity","parent":"Entity","type":"classfunc","description":"Returns the entity that is being used as the light origin position for this entity.","realm":"Server","rets":{"ret":{"text":"The lighting entity. This will usually be NULL.","name":"","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetLocalAngles","parent":"Entity","type":"classfunc","description":"Returns the rotation of the entity relative to its parent entity.","realm":"Shared","rets":{"ret":{"text":"Relative angle","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetLocalAngularVelocity","parent":"Entity","type":"classfunc","description":"Returns the non-VPhysics angular velocity of the entity relative to its parent entity.","realm":"Shared","rets":{"ret":{"text":"The velocity","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetLocalPos","parent":"Entity","type":"classfunc","description":"Returns entity's position relative to it's Entity:GetParent.\n\nSee Entity:GetPos for the absolute position.","realm":"Shared","rets":{"ret":{"text":"Relative position","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetManipulateBoneAngles","parent":"Entity","type":"classfunc","description":"Gets the entity's angle manipulation of the given bone. This is relative to the default angle, so the angle is zero when unmodified.","realm":"Shared","args":{"arg":{"text":"The bone's ID","name":"boneID","type":"number"}},"rets":{"ret":{"text":"The entity's angle manipulation of the given bone.","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetManipulateBoneJiggle","parent":"Entity","type":"classfunc","description":"Returns the jiggle amount of the entity's bone.\n\nSee Entity:ManipulateBoneJiggle for more info.","realm":"Shared","args":{"arg":{"text":"The bone ID","name":"boneID","type":"number"}},"rets":{"ret":{"text":"The jiggle bone type, as set by Entity:ManipulateBoneJiggle.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetManipulateBonePosition","parent":"Entity","type":"classfunc","description":"Gets the entity's position manipulation of the given bone. This is relative to the default position, so it is zero when unmodified.","realm":"Shared","args":{"arg":{"text":"The bone's ID","name":"boneId","type":"number"}},"rets":{"ret":{"text":"The entity's position manipulation of the given bone.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetManipulateBoneScale","parent":"Entity","type":"classfunc","description":"Gets the entity's scale manipulation of the given bone. Normal scale is Vector( 1, 1, 1 )","realm":"Shared","args":{"arg":{"text":"The bone's ID","name":"boneID","type":"number"}},"rets":{"ret":{"text":"The entity's scale manipulation of the given bone","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMaterial","parent":"Entity","type":"classfunc","description":{"text":"Returns the material override for this entity. \n\nReturns an empty string if no material override exists. Use Entity:GetMaterials to list its default materials.","bug":{"text":"The server's value takes priority on the client.","issue":"3362"}},"realm":"Shared","rets":{"ret":{"text":"material","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMaterials","parent":"Entity","type":"classfunc","description":{"text":"Returns all materials of the entity's model.\n\nThis function is unaffected by Entity:SetSubMaterial as it returns the original materials.","bug":"The table returned by this function will not contain materials if they are missing from the disk/repository. This means that if you are attempting to find the ID of a material to replace with Entity:SetSubMaterial and there are missing materials on the model, all subsequent materials will be offset in the table, meaning that the ID you are trying to get will be incorrect."},"realm":"Shared","rets":{"ret":{"text":"A table containing full paths to the materials of the model.\n\nFor models, it's limited to `128` materials.","name":"","type":"table<string>"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMaterialType","parent":"Entity","type":"classfunc","description":"Returns the [surface material type](https://developer.valvesoftware.com/wiki/Material_Types) of this entity.\n\nThis can be approximated clientside via util.GetModelInfo.\n\nInternally, all this does is return `gamematerial` of the surface property on the first physics object of the entity. You can do this yourself using PhysObj:GetMaterial and util.GetSurfaceData.","realm":"Server","rets":{"ret":{"text":"Surface material type.","name":"","type":"number{MAT}"}}},"example":{"description":"Prints the MAT_ enum name for every prop on the map.","code":"local function BackwardsEnums( enumname ) -- Helper function to build our table of values.\n\tlocal backenums = {}\n\n\tfor k, v in pairs( _G ) do\n\t\tif isstring(k) and string.find( k, \"^\" .. enumname ) then\n\t\t\tbackenums[ v ] = k\n\t\tend\n\tend\n\n\treturn backenums\nend\n\nlocal MAT = BackwardsEnums( \"MAT_\" )\nlocal validClasses = { prop_physics = true, prop_physics_multiplayer = true, prop_dynamic = true }\n\nfor _, v in ipairs( ents.GetAll() ) do\n\tif validClasses[ v:GetClass() ] then\n\t\tprint( v:GetModel(), MAT[ v:GetMaterialType() ] or \"UNKNOWN\" )\n\tend\nend","output":"```\nmodels/props_interiors/furniture_couch01a.mdl\tMAT_DIRT\nmodels/props/cs_office/offinspd.mdl\tMAT_GLASS\nmodels/props/cs_office/offinspf.mdl\tMAT_GLASS\nmodels/props_wasteland/controlroom_desk001b.mdl\tMAT_METAL\nmodels/props_junk/wood_crate002a.mdl\tMAT_WOOD\nmodels/props_junk/wood_crate002a.mdl\tMAT_WOOD\nmodels/props_junk/wood_crate001a_damaged.mdl\tMAT_WOOD\nmodels/props_wasteland/controlroom_desk001a.mdl\tMAT_METAL\nmodels/props_wasteland/controlroom_chair001a.mdl\tMAT_METAL\nmodels/props_c17/tools_wrench01a.mdl\tMAT_METAL\nmodels/props/cs_office/radio.mdl\tMAT_COMPUTER\nmodels/props_junk/pushcart01a.mdl\tMAT_METAL\nmodels/props_wasteland/kitchen_shelf001a.mdl\tMAT_METAL\nmodels/props_wasteland/cafeteria_table001a.mdl\tMAT_WOOD\nmodels/props_c17/furniturecouch001a.mdl\tMAT_DIRT\nmodels/props_c17/furnituretable003a.mdl\tMAT_WOOD\nmodels/combine_gate_vehicle.mdl\tUNKNOWN\nmodels/props_junk/sawblade001a.mdl\tMAT_METAL\nmodels/props/cs_office/offinspf.mdl\tMAT_GLASS\nmodels/props_junk/wood_crate001a.mdl\tMAT_WOOD\n...\n```"},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetMaxHealth","parent":"Entity","type":"classfunc","description":"Returns the max health that the entity was given. It can be set via Entity:SetMaxHealth.","realm":"Shared","rets":{"ret":{"text":"Max health.","name":"","type":"number"}}},"example":{"description":"Prints the maximum health set for player 1.","code":"print( Entity( 1 ):GetMaxHealth() )","output":"By default, 100."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetModel","parent":"Entity","type":"classfunc","description":{"text":"Gets the model of given entity.","bug":"This does not necessarily return the model's path, as is the case for brush and virtual models. This is intentional behaviour, however, there is currently no way to retrieve the actual file path.\n\nThis also affects certain models that are edited by 3rd party programs after being compiled."},"realm":"Shared","rets":{"ret":{"text":"The entity's model. Will be a filesystem path for most models.\n\nThis is guaranteed to be lower case.\n\nThis will be nil for entities which cannot have models, such as point entities.","name":"","type":"string|nil"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetModelBounds","parent":"Entity","type":"classfunc","description":"Returns the entity's model bounds, not scaled by Entity:SetModelScale.\n\nThese bounds are affected by all the animations the model has at compile time, if they go outside of the models' render bounds at any point.  \nSee Entity:GetModelRenderBounds for just the render bounds of the model.\n\nThis is different than the collision bounds/hull, which are set via Entity:SetCollisionBounds.","realm":"Shared","rets":{"ret":[{"text":"The minimum vector of the bounds","name":"","type":"Vector"},{"text":"The maximum vector of the bounds","name":"","type":"Vector"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetModelContents","parent":"Entity","type":"classfunc","description":"Returns the contents of the entity's current model.","realm":"Shared","rets":{"ret":{"text":"The contents of the entity's model. See Enums/CONTENTS.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetModelPhysBoneCount","parent":"Entity","type":"classfunc","description":"Gets the physics bone count of the entity's model. This is only applicable to `anim` type Scripted Entities with ragdoll models.","realm":"Client","rets":{"ret":{"text":"How many physics bones exist on the model.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetModelRadius","parent":"Entity","type":"classfunc","description":"Gets the models radius.","realm":"Shared","rets":{"ret":{"text":"The radius of the model.","name":"","type":"number","warning":"This can return nil instead of a number in some cases."}}},"example":{"description":"Example usage of the function, tested on player.","code":"print( Entity(1):GetModelRadius() )","output":"72"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetModelRenderBounds","parent":"Entity","type":"classfunc","description":"Returns the entity's model render bounds. Unlike Entity:GetModelBounds, bounds returning by this function will not be affected by animations (at compile time).","realm":"Shared","rets":{"ret":[{"text":"The minimum vector of the bounds","name":"","type":"Vector"},{"text":"The maximum vector of the bounds","name":"","type":"Vector"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetModelScale","parent":"Entity","type":"classfunc","description":"Gets the selected entity's model scale.","realm":"Shared","rets":{"ret":{"text":"Scale of that entity's model.","name":"","type":"number"}}},"example":{"description":"This example shows how one can get the model scale of their self.","code":"print( Entity(1):GetModelScale() )","output":"```\n1\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMomentaryRotButtonPos","parent":"Entity","type":"classfunc","description":{"text":"Returns the amount a momentary_rot_button entity is turned based on the given angle. 0 meaning completely turned closed, 1 meaning completely turned open.","warning":"This only works on momentary_rot_button entities."},"realm":"Server","args":{"arg":{"text":"The angle of rotation to compare - usually should be Entity:GetAngles.","name":"turnAngle","type":"Angle"}},"rets":{"ret":{"text":"The amount the momentary_rot_button is turned, ranging from 0 to 1, or nil if the entity is not a momentary_rot_button.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetMoveCollide","parent":"Entity","type":"classfunc","description":"Returns the move collide type of the entity. The move collide is the way a physics object reacts to hitting an object - will it bounce, slide?","realm":"Shared","rets":{"ret":{"text":"The move collide type, see Enums/MOVECOLLIDE","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMoveParent","parent":"Entity","type":"classfunc","description":"Returns the movement parent of this entity.\n\nSee Entity:SetMoveParent for more info.","realm":"Shared","rets":{"ret":{"text":"The movement parent of this entity.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMoveType","parent":"Entity","type":"classfunc","description":"Returns the entity's movetype","realm":"Shared","rets":{"ret":{"text":"Move type. See Enums/MOVETYPE","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetName","parent":"Entity","type":"classfunc","description":{"text":"Returns the \"targetname\" of this entity, typically used in map making and scripting to uniquely identify and target (hence 'targetname') an entity or a group of entities.","warning":"For players, this function is overwritten by Player:GetName, which returns the player's nick name, not the target name."},"realm":"Server","rets":{"ret":{"text":"The name of the Entity","name":"","type":"string"}}},"example":{"description":"Prints the name of an entity in console.","code":"function PrintEntityName( ent )\n\tprint( ent:GetName() )\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetNetworkAngles","parent":"Entity","type":"classfunc","description":"Gets networked angles for entity.","realm":"Client","rets":{"ret":{"text":"angle","name":"","type":"Angle"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetNetworked2Angle","parent":"Entity","type":"classfunc","description":{"text":"Retrieves a networked angle value at specified index on the entity that is set by Entity:SetNetworked2Angle.","deprecated":"You should be using Entity:GetNW2Angle instead."},"realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":"Angle( 0, 0, 0 )"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworked2Bool","parent":"Entity","type":"classfunc","description":{"text":"Retrieves a networked boolean value at specified index on the entity that is set by Entity:SetNetworked2Bool.","deprecated":"You should be using Entity:GetNW2Bool instead."},"realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":"false"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworked2Entity","parent":"Entity","type":"classfunc","description":{"text":"Retrieves a networked entity value at specified index on the entity that is set by Entity:SetNetworked2Entity.","deprecated":"You should be using Entity:GetNW2Entity instead."},"realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":"NULL"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworked2Float","parent":"Entity","type":"classfunc","description":{"text":"Retrieves a networked float value at specified index on the entity that is set by Entity:SetNetworked2Float.","deprecated":"You should be using Entity:GetNW2Float instead."},"realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":"0"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworked2Int","parent":"Entity","type":"classfunc","description":{"text":"Retrieves a networked integer (whole number) value that was previously set by Entity:SetNetworked2Int.","deprecated":"You should be using Entity:GetNW2Int instead.","warning":"The integer has a 32 bit limit. Use Entity:SetNWInt and Entity:GetNWInt instead"},"realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value (If it isn't set).","name":"fallback","type":"any","default":"0"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworked2String","parent":"Entity","type":"classfunc","description":{"text":"Retrieves a networked string value at specified index on the entity that is set by Entity:SetNetworked2String.","deprecated":"You should be using Entity:GetNW2String instead."},"realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":""}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworked2Var","parent":"Entity","type":"classfunc","description":{"text":"Retrieves a networked value at specified index on the entity that is set by Entity:SetNetworked2Var.","deprecated":"You should be using Entity:GetNW2Var instead."},"realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":"nil"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworked2VarProxy","parent":"Entity","type":"classfunc","description":{"text":"Returns callback function for given NWVar of this entity. Alias of Entity:GetNW2VarProxy","deprecated":"You should be using Entity:GetNW2VarProxy instead."},"realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"613-L624"},"args":{"arg":{"text":"The key of the NWVar to get callback of.","name":"key","type":"any"}},"rets":{"ret":{"text":"The callback of given NWVar, or nil if not found.","name":"","type":"function"}}},"example":{"description":"Prints callback function of a NWVar called \"Key\" of Player 1.","code":"print( Entity(1):GetNetworked2VarProxy( \"Key\" ) )\nEntity(1):SetNetworked2VarProxy( \"Key\", print )\nprint( Entity(1):GetNetworked2VarProxy( \"Key\" ) )","output":"```\nnil\nfunction: builtin#25\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworked2VarTable","parent":"Entity","type":"classfunc","description":{"text":"Returns all the networked2 variables in an entity.","deprecated":"You should be using Entity:GetNW2VarTable instead."},"realm":"Shared","rets":{"ret":{"text":"Key-Value table of all networked2 variables.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworked2Vector","parent":"Entity","type":"classfunc","description":{"text":"Retrieves a networked vector value at specified index on the entity that is set by Entity:SetNetworked2Vector.","deprecated":"You should be using Entity:GetNW2Vector instead."},"realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":"Vector( 0, 0, 0 )"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworkedAngle","parent":"Entity","type":"classfunc","description":{"text":"Retrieves a networked angle value at specified index on the entity that is set by Entity:SetNetworkedAngle.","deprecated":"You should use Entity:GetNWAngle instead."},"realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. ( If it isn't set )","name":"fallback","type":"Angle","default":"Angle( 0, 0, 0 )"}]},"rets":{"ret":{"text":"The retrieved value","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworkedBool","parent":"Entity","type":"classfunc","description":{"text":"Retrieves a networked boolean value at specified index on the entity that is set by Entity:SetNetworkedBool.","deprecated":"You should use Entity:GetNWBool instead."},"realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. ( If it isn't set )","name":"fallback","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"The retrieved value","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworkedEntity","parent":"Entity","type":"classfunc","description":{"text":"Retrieves a networked float value at specified index on the entity that is set by Entity:SetNetworkedEntity.","deprecated":"You should use Entity:GetNWEntity instead."},"realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. ( If it isn't set )","name":"fallback","type":"Entity","default":"NULL"}]},"rets":{"ret":{"text":"The retrieved value","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworkedFloat","parent":"Entity","type":"classfunc","description":{"text":"Retrieves a networked float value at specified index on the entity that is set by Entity:SetNetworkedFloat.\n\nSeems to be the same as Entity:GetNetworkedInt.","deprecated":"You should use Entity:GetNWFloat instead."},"realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. ( If it isn't set )","name":"fallback","type":"number","default":"0"}]},"rets":{"ret":{"text":"The retrieved value","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworkedInt","parent":"Entity","type":"classfunc","description":{"text":"Retrieves a networked integer value at specified index on the entity that is set by Entity:SetNetworkedInt.","deprecated":"You should use Entity:GetNWInt instead."},"realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. ( If it isn't set )","name":"fallback","type":"number","default":"0"}]},"rets":{"ret":{"text":"The retrieved value","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworkedString","parent":"Entity","type":"classfunc","description":{"text":"Retrieves a networked string value at specified index on the entity that is set by Entity:SetNetworkedString.","deprecated":"You should use Entity:GetNWString instead."},"realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. ( If it isn't set )","name":"fallback","type":"string","default":""}]},"rets":{"ret":{"text":"The retrieved value","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworkedVar","parent":"Entity","type":"classfunc","description":{"text":"Retrieves a networked value at specified index on the entity that is set by Entity:SetNetworkedVar.","deprecated":""},"realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":"nil"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworkedVarProxy","parent":"Entity","type":"classfunc","description":{"text":"Returns callback function for given NWVar of this entity, previously set by Entity:SetNWVarProxy.","removed":"This function was superseded by Entity:GetNetworked2VarProxy. This page still exists an archive in case anybody ever stumbles across old code and needs to know what it is"},"realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"495-L506"},"args":{"arg":{"text":"The name of the NWVar to get callback of.","name":"name","type":"string"}},"rets":{"ret":{"text":"The callback of given NWVar, if any.","name":"","type":"function","callback":{"arg":[{"text":"The entity","type":"Entity","name":"ent"},{"text":"Name of the NWVar that has changed","type":"string","name":"name"},{"text":"The old value","type":"any","name":"oldval"},{"text":"The new value","type":"any","name":"newval"}]}}}},"example":{"description":"Prints callback function of a NWVar called \"Key\" of Player 1.","code":"print( Entity(1):GetNetworkedVarProxy( \"Key\" ) )\nEntity(1):SetNetworkedVarProxy( \"Key\", print )\nprint( Entity(1):GetNetworkedVarProxy( \"Key\" ) )","output":"```\nnil\nfunction: builtin#25\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworkedVarTable","parent":"Entity","type":"classfunc","description":{"text":"Returns all the networked variables in an entity.","deprecated":"You should be using Entity:GetNWVarTable instead."},"realm":"Shared","rets":{"ret":{"text":"Key-Value table of all networked variables.","name":"","type":"table<string,any>"}}},"example":{"description":"Prints all NWVars that exist for Player 1.","code":"PrintTable( Entity(1):GetNWVarTable() )","output":"```\nUserGroup\t=\towner\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworkedVector","parent":"Entity","type":"classfunc","description":{"text":"Retrieves a networked vector value at specified index on the entity that is set by Entity:SetNetworkedVector.","deprecated":"You should use Entity:GetNWVector instead."},"realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. ( If it isn't set )","name":"fallback","type":"Vector","default":"Vector( 0, 0, 0 )"}]},"rets":{"ret":{"text":"The retrieved value","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworkOrigin","parent":"Entity","type":"classfunc","description":{"text":"Gets networked origin for entity.","note":"On the Client, this seems to return the position relative to the parent (if it has one). On the server-side this will return what you expect even if it has a parent."},"realm":"Shared","rets":{"ret":{"text":"The last received origin of the entity.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNetworkVars","parent":"Entity","type":"classfunc","description":{"text":"Returns all network vars created by Entity:NetworkVar and Entity:NetworkVarElement and their current values.\n\n\t\tThis is used internally by the duplicator. `Entity` type Network vars will not be returned!\n\n\t\tFor NWVars see Entity:GetNWVarTable.","note":"This function will only work on entities which had Entity:InstallDataTable called on them, which is done automatically for players and all Scripted Entities"},"realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"491-L515"},"rets":{"ret":{"text":"The Key-Value formatted table of network var names and their current values","name":"data","type":"table"}}},"example":{"description":"Example output, if used on a `env_skypaint`.","code":"local ent = ents.FindByClass(\"env_skypaint\")[ 1 ]\nPrintTable( ent:GetNetworkVars() )","output":"```\nBottomColor\t=\t0.919000 0.929000 0.992000\nDrawStars\t=\ttrue\nDuskColor\t=\t1.000000 1.000000 1.000000\nDuskIntensity\t=\t2\nDuskScale\t=\t0.5\nFadeBias\t=\t0.10000000149012\nHDRScale\t=\t0.56000000238419\nStarFade\t=\t0.5\nStarLayers\t=\t1\nStarScale\t=\t2\nStarSpeed\t=\t0.029999999329448\nStarTexture\t=\tskybox/clouds\nSunColor\t=\t0.000000 0.000000 0.000000\nSunNormal\t=\t-0.377821 0.520026 0.766044\nSunSize\t=\t0\nTopColor\t=\t0.220000 0.510000 1.000000\n\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNoDraw","parent":"Entity","type":"classfunc","description":{"text":"Returns if the entity's rendering and transmitting has been disabled.","note":"This is equivalent to calling Entity:IsEffectActive( EF_NODRAW )"},"realm":"Shared","rets":{"ret":{"text":"Whether the entity's rendering and transmitting has been disabled.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNPCClass","parent":"ENTITY","type":"classfunc","file":{"text":"gamemodes/base/entities/entities/base_ai/init.lua","line":"14"},"description":{"text":"Gets the NPC classification. Internally gets the `m_iClass` variable which is polled by the engine. This will be equivalent to NPC:Classify.","note":"This is a helper function only available if your SENT is based on `base_ai`"},"realm":"Server","rets":{"ret":{"text":"See Enums/CLASS","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetNumBodyGroups","parent":"Entity","type":"classfunc","description":{"text":"Returns the number of Body Groups that the Entity model contains.","note":"Weapons will return results from their viewmodels."},"realm":"Shared","rets":{"ret":{"text":"The amount of Body Groups on the Entity's model.","name":"","type":"number"}}},"example":{"description":"Example usage. Console commands to randomize bodygroups, and print out all bodygroups.","code":"concommand.Add( \"print_bodygruops\", function( ent )\n\n\tprint(\"Here's all the bodygroups for \" .. ent:GetModel() )\n\tfor k = 0, ent:GetNumBodyGroups() do\n\t\tprint( ent:GetBodygroupName( k ), \" value \", ent:GetBodygroup( k ), \" max \", ent:GetBodygroupCount( k ) )\n\tend\n\nend )\n\nconcommand.Add( \"bodygroups_random\", function( ent )\n\n\tprint(\"Randomizing all the bodygroups for \" .. ent:GetModel() )\n\tfor k = 0, ent:GetNumBodyGroups() do\n\t\tent:SetBodygroup( k, math.random( 0, ent:GetBodygroupCount( k ) - 1 ) )\n\tend\n\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNumPoseParameters","parent":"Entity","type":"classfunc","description":"Returns the number of pose parameters this entity has.","realm":"Shared","rets":{"ret":{"text":"Amount of pose parameters the entity has","name":"","type":"number"}}},"example":{"description":"Prints all the entities poses.\n\nThe entity used to generate the output is a model of the combine helicopter.","code":"for i=0, ent:GetNumPoseParameters() - 1 do\n\tlocal min, max = ent:GetPoseParameterRange( i )\n\tprint( ent:GetPoseParameterName( i ) .. ' ' .. min .. \" / \" .. max )\nend","output":"```\nweapon_pitch -90 / 20\nweapon_yaw -40 / 40\nrudder -45 / 45\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNW2Angle","parent":"Entity","type":"classfunc","description":"Retrieves a networked angle value at specified index on the entity that is set by Entity:SetNW2Angle.","realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":"Angle( 0, 0, 0 )"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNW2Bool","parent":"Entity","type":"classfunc","description":"Retrieves a networked boolean value at specified index on the entity that is set by Entity:SetNW2Bool.","realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":"false"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNW2Entity","parent":"Entity","type":"classfunc","description":"Retrieves a networked entity value at specified index on the entity that is set by Entity:SetNW2Entity.","realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":"NULL"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNW2Float","parent":"Entity","type":"classfunc","description":"Retrieves a networked float value at specified index on the entity that is set by Entity:SetNW2Float.","realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":"0"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNW2Int","parent":"Entity","type":"classfunc","description":{"text":"Retrieves a networked integer (whole number) value that was previously set by Entity:SetNW2Int.","warning":"The integer has a 32 bit limit. Use Entity:SetNWInt and Entity:GetNWInt instead"},"realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value (If it isn't set).","name":"fallback","type":"any","default":"0"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNW2String","parent":"Entity","type":"classfunc","description":"Retrieves a networked string value at specified index on the entity that is set by Entity:SetNW2String.","realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":""}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNW2Var","parent":"Entity","type":"classfunc","description":"Retrieves a networked value at specified index on the entity that is set by Entity:SetNW2Var.","realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":"nil"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNW2VarProxy","parent":"Entity","type":"classfunc","description":"Returns callback function for given NWVar of this entity.","realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"627"},"args":{"arg":{"text":"The key of the NWVar to get callback of.","name":"key","type":"any"}},"rets":{"ret":{"text":"The callback of given NWVar, or nil if not found.","name":"","type":"function","callback":{"arg":[{"text":"The entity","type":"Entity","name":"ent"},{"text":"Name of the NW2Var that has changed","type":"string","name":"name"},{"text":"The old value","type":"any","name":"oldval"},{"text":"The new value","type":"any","name":"newval"}]}}}},"example":{"description":"Prints callback function of a NWVar called \"Key\" of Player 1.","code":"print( Entity(1):GetNW2VarProxy( \"Key\" ) )\nEntity(1):SetNW2VarProxy( \"Key\", print )\nprint( Entity(1):GetNW2VarProxy( \"Key\" ) )","output":"```\nnil\nfunction: builtin#25\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNW2VarTable","parent":"Entity","type":"classfunc","description":{"text":"Returns all the NW2 variables in an entity.","bug":{"text":"This function will return keys with empty tables if the NW2Var is nil.","issue":"5396"}},"realm":"Shared","rets":{"ret":{"text":"Key-Value table of all NW2 variables.","name":"","type":"table"}}},"example":{"description":"Structure of the returned table.","code":"Entity(1):SetNW2String(\"Example\", \"Example\")\nPrintTable(Entity(1):GetNW2VarTable())","output":"```\nExample:\n\t\ttype\t=\tString\n\t\tvalue\t=\tExample\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNW2Vector","parent":"Entity","type":"classfunc","description":"Retrieves a networked vector value at specified index on the entity that is set by Entity:SetNW2Vector.","realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":"Vector( 0, 0, 0 )"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNWAngle","parent":"Entity","type":"classfunc","description":"Retrieves a networked angle value at specified index on the entity that is set by Entity:SetNWAngle.","realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":"Angle( 0, 0, 0 )"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNWBool","parent":"Entity","type":"classfunc","description":"Retrieves a networked boolean value at specified index on the entity that is set by Entity:SetNWBool.","realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":"false"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNWEntity","parent":"Entity","type":"classfunc","description":"Retrieves a networked entity value at specified index on the entity that is set by Entity:SetNWEntity.","realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":"NULL"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNWFloat","parent":"Entity","type":"classfunc","description":"Retrieves a networked float value at specified index on the entity that is set by Entity:SetNWFloat.","realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":"0"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNWInt","parent":"Entity","type":"classfunc","description":{"text":"Retrieves a networked integer (whole number) value that was previously set by Entity:SetNWInt.","bug":{"text":"This function will not round decimal values as it actually networks a float internally.","issue":"3374"}},"realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value (If it isn't set).","name":"fallback","type":"any","default":"0"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNWString","parent":"Entity","type":"classfunc","description":"Retrieves a networked string value at specified index on the entity that is set by Entity:SetNWString.","realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":""}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"example":{"description":"Prints the player's rank","code":"print( Entity(1):GetNWString( \"usergroup\" ) )","output":"\"superadmin\" in single-player"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNWVarProxy","parent":"Entity","type":"classfunc","description":{"text":"Returns callback function for given NWVar of this entity, previously set by Entity:SetNWVarProxy.","removed":"This function was superseded by Entity:GetNW2VarProxy. This page still exists an archive in case anybody ever stumbles across old code and needs to know what it is"},"realm":"Shared","args":{"arg":{"text":"The key of the NWVar to get callback of.","name":"key","type":"string"}},"rets":{"ret":{"text":"The callback of given NWVar, or nil if not found.","name":"","type":"function","callback":{"arg":[{"text":"The entity","type":"Entity","name":"ent"},{"text":"Name of the NWVar that has changed","type":"string","name":"name"},{"text":"The old value","type":"any","name":"oldval"},{"text":"The new value","type":"any","name":"newval"}]}}}},"example":{"description":"Prints callback function of a NWVar called \"Key\" of Player 1.","code":"print( Entity(1):GetNWVarProxy( \"Key\" ) )\nEntity(1):SetNWVarProxy( \"Key\", print )\nprint( Entity(1):GetNWVarProxy( \"Key\" ) )","output":"```\nnil\nfunction: builtin#25\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNWVarTable","parent":"Entity","type":"classfunc","description":"Returns all the networked variables in an entity.","realm":"Shared","rets":{"ret":{"text":"Key-Value table of all networked variables.","name":"","type":"table<string,any>"}}},"example":{"description":"Prints all NWVars that exist for Player 1.","code":"PrintTable( Entity(1):GetNWVarTable() )","output":"```\nUserGroup\t=\towner\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNWVector","parent":"Entity","type":"classfunc","description":"Retrieves a networked vector value at specified index on the entity that is set by Entity:SetNWVector.","realm":"Shared","args":{"arg":[{"text":"The key that is associated with the value","name":"key","type":"string"},{"text":"The value to return if we failed to retrieve the value. (If it isn't set)","name":"fallback","type":"any","default":"Vector( 0, 0, 0 )"}]},"rets":{"ret":{"text":"The value associated with the key","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetOwner","parent":"Entity","type":"classfunc","description":{"text":"Returns the owner entity of this entity. See Entity:SetOwner for more info.","note":"This function is generally used to disable physics interactions on projectiles being fired by their owner, but can also be used for normal ownership in case physics interactions are not involved at all. The Gravity gun will be able to pick up the entity even if the owner can't collide with it, the Physics gun however will not."},"realm":"Shared","rets":{"ret":{"text":"The owner entity of this entity.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetParent","parent":"Entity","type":"classfunc","description":"Returns the parent entity of this entity.","realm":"Shared","rets":{"ret":{"text":"parentEntity","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetParentAttachment","parent":"Entity","type":"classfunc","description":"Returns the attachment/bone index of the entity's parent. Returns 0 if the entity is not parented to an attachment/bone or if it isn't parented at all.\n\nThis is set by second argument of Entity:SetParent or the **SetParentAttachment** input.","realm":"Shared","rets":{"ret":{"text":"The parented attachment/bone index","name":"","type":"number","note":"Will return bone index instead of attachment index if the **EF_FOLLOWBONE** effect is active on the entity. See Entity:IsEffectActive."}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetParentPhysNum","parent":"Entity","type":"classfunc","description":"If the entity is parented to an entity that has a model with multiple physics objects (like a ragdoll), this is used to retrieve what physics object number the entity is parented to on it's parent.","realm":"Shared","rets":{"ret":{"text":"The physics object id, or nil if the entity has no parent","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetParentWorldTransformMatrix","parent":"Entity","type":"classfunc","description":"Returns the position and angle of the entity's move parent as a 3x4 matrix (VMatrix is 4x4 so the fourth row goes unused). The first three columns store the angle as a [rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix), and the fourth column stores the position vector.","realm":"Shared","rets":{"ret":{"text":"The position and angle matrix.\n\nIf the entity has no move parent, an identity matrix will be returned.\nIf the entity is parented to attachment 0 or the parent isn't a BaseAnimating entity, the equivalent of Entity:GetMoveParent():GetWorldTransformMatrix() will be returned.","name":"","type":"VMatrix"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPersistent","parent":"Entity","type":"classfunc","description":"Returns whether the entity is persistent or not.\n\nSee Entity:SetPersistent for more information on persistence.","realm":"Shared","rets":{"ret":{"text":"True if the entity is set to be persistent.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPhysicsAttacker","parent":"Entity","type":"classfunc","description":"Returns player who is claiming kills of physics damage the entity deals.","realm":"Server","args":{"arg":{"text":"The time to check if the entity was still a proper physics attacker.","name":"timeLimit","type":"number","default":"1","note":"Some entities such as the Combine Ball disregard the time limit and always return the physics attacker."}},"rets":{"ret":{"text":"The player. If entity that was set is not a player, it will return NULL entity.","name":"","type":"Player"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetPhysicsObject","parent":"Entity","type":"classfunc","description":{"text":"Returns the entity's physics object, if the entity has physics. Same as `ent:GetPhysicsObjectNum( 0 )`","note":"Entities don't have clientside physics objects by default, so this will return `[NULL PHYSOBJ]` on the client in most cases."},"realm":"Shared","rets":{"ret":{"text":"The entity's physics object.","name":"","type":"PhysObj"}}},"example":{"description":"Gets the mass of an entity.","code":"local phys = ent:GetPhysicsObject()\n\nif ( IsValid( phys ) ) then -- Always check with IsValid! The ent might not have physics!\n\treturn phys:GetMass()\nelse\n\treturn 0\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPhysicsObjectCount","parent":"Entity","type":"classfunc","description":"Returns the number of physics objects an entity has (usually 1 for non-ragdolls)","realm":"Shared","rets":{"ret":{"text":"numObjects","name":"","type":"number"}}},"example":{"description":"Finds all the Physics Objects in a ragdoll and applies an upward force","code":"for i=0, ragdoll:GetPhysicsObjectCount() - 1 do -- \"ragdoll\" being a ragdoll entity\n \n\tlocal phys = ragdoll:GetPhysicsObjectNum(i)\n\tphys:ApplyForceCenter( Vector( 0, 0, 10000 ) )\n\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPhysicsObjectNum","parent":"Entity","type":"classfunc","description":"Returns a specific physics object from an entity with multiple PhysObjects (like ragdolls)\n\nSee also Entity:TranslateBoneToPhysBone.","realm":"Shared","args":{"arg":{"text":"The number corresponding to the PhysObj to grab. Starts at 0.","name":"physNum","type":"number"}},"rets":{"ret":{"text":"The physics object or nil if not found","name":"","type":"PhysObj"}}},"example":[{"description":"When run, if the player is dead it will throw their ragdoll up in the air by their head.","code":"if ( !LocalPlayer():Alive() && LocalPlayer():GetRagdollEntity() ) then\n\tlocal ent = LocalPlayer():GetRagdollEntity()\n\tlocal head = ent:GetPhysicsObjectNum( 10 ) // 10 is usually the bone number of the head.\n\thead:ApplyForceCenter( Vector( 0, 0, 6000 ) )\nend"},{"description":"Example function that applies force to all physics objects of given entity.","code":"function ApplySomeForce( ent )\n\tfor i = 0, ent:GetPhysicsObjectCount() - 1 do\n\t\tlocal phys = ent:GetPhysicsObjectNum( i )\n\t\tphys:ApplyForceCenter( Vector( 0, 0, 10000 ) )\n\tend\nend"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPlaybackRate","parent":"Entity","type":"classfunc","description":"Returns the playback rate of the main sequence on this entity, with 1.0 being the default speed.","realm":"Shared","rets":{"ret":{"text":"The playback rate.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPos","parent":"Entity","type":"classfunc","description":"Gets the position of given entity in the world.\n\nSee Entity:GetLocalPos for the position relative to the entity's Entity:GetParent.","realm":"Shared","rets":{"ret":{"text":"The position of the entity.","name":"","type":"Vector"}}},"example":{"description":"Utility command that would give you the position of the entity you are looking at.","code":"concommand.Add( \"entity_pos\", function( ply )\n\tlocal tr = ply:GetEyeTrace()\n\tif ( IsValid( tr.Entity ) ) then\n\t\tprint( \"Entity position:\", tr.Entity:GetPos() )\n\telse\n\t\tprint( \"Crosshair position:\", tr.HitPos )\n\tend\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPoseParameter","parent":"Entity","type":"classfunc","description":"Returns the pose parameter value","realm":"Shared","args":{"arg":{"text":"Pose parameter name to look up. Can also be a pose parameter ID.","name":"name","type":"string","alttype":"number"}},"rets":{"ret":{"text":"Value of given pose parameter.","name":"","type":"number","warning":"This value will be from 0 - 1 on the client and from minimum range to maximum range on the server! You'll have to remap this value clientside to Entity:GetPoseParameterRange's returns if you want get the actual pose parameter value. See Entity:SetPoseParameter's example."}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPoseParameterName","parent":"Entity","type":"classfunc","description":"Returns name of given pose parameter","realm":"Shared","args":{"arg":{"text":"Id of the pose paremeter","name":"id","type":"number"}},"rets":{"ret":{"text":"Name of given pose parameter","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPoseParameterRange","parent":"Entity","type":"classfunc","description":"Returns pose parameter range","realm":"Shared","args":{"arg":{"text":"Pose parameter ID to look up. Can also be a pose parameter name.","name":"id","type":"number","alttype":"string"}},"rets":{"ret":[{"text":"The minimum value","name":"","type":"number"},{"text":"The maximum value","name":"","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPredictable","parent":"Entity","type":"classfunc","description":"Returns whether this entity is predictable or not.\n\nSee Entity:SetPredictable for more information","realm":"Client","rets":{"ret":{"text":"Whether this entity is predictable or not.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetPreferredCarryAngles","parent":"Entity","type":"classfunc","description":{"text":"Called to override the preferred carry angles of this object.","note":"This callback is only called for `anim` and `ai` type entities. For rest use GM:GetPreferredCarryAngles."},"realm":"Server","added":"2021.01.27","args":{"arg":{"text":"The player who is holding the object.","name":"ply","type":"Player"}},"rets":{"ret":{"text":"Return an angle to override the carry angles.","name":"","type":"Angle"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetRagdollOwner","parent":"Entity","type":"classfunc","description":"Returns the entity which the ragdoll came from. The opposite of Player:GetRagdollEntity.","realm":"Shared","rets":{"ret":{"text":"The entity who owns the ragdoll.","name":"","type":"Entity"}}},"example":{"description":"Loop through all player ragdolls and print their owners.","code":"local strRagdoll = SERVER and \"hl2mp_ragdoll\" or \"class C_HL2MPRagdoll\" \nfor _, ent in ipairs( ents.FindByClass( strRagdoll ) ) do \n\tif ( IsValid( ent:GetRagdollOwner() ) ) then\n\t\tprint( ent:GetRagdollOwner() )\n\tend\nend","output":"While a player is dead and their ragdoll is spawned this returns: \n```\nPlayer [1][PlayerName]\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetRenderAngles","parent":"Entity","type":"classfunc","description":"Returns the entity's render angles, set by Entity:SetRenderAngles in a drawing hook.","realm":"Client","file":{"text":"lua/includes/extensions/client/entity.lua","line":"16"},"rets":{"ret":{"text":"The entitys render angles","name":"","type":"Angle"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetRenderBounds","parent":"Entity","type":"classfunc","description":"Returns render bounds of the entity as local vectors. Can be overridden by Entity:SetRenderBounds.\n\nIf the render bounds are not inside players view, the entity will not be drawn!","realm":"Client","rets":{"ret":[{"text":"The minimum vector of the bounds","name":"","type":"Vector"},{"text":"The maximum vector of the bounds.","name":"","type":"Vector"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetRenderFX","parent":"Entity","type":"classfunc","description":"Returns current render FX of the entity.","realm":"Shared","rets":{"ret":{"text":"The current render FX of the entity. See Enums/kRenderFx","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetRenderGroup","parent":"Entity","type":"classfunc","description":"Returns the render group of the entity.","realm":"Client","rets":{"ret":{"text":"The render group. See Enums/RENDERGROUP","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetRenderMode","parent":"Entity","type":"classfunc","description":"Returns the render mode of the entity.","realm":"Shared","rets":{"ret":{"text":"The render Mode. See Enums/RENDERMODE","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetRenderOrigin","parent":"Entity","type":"classfunc","description":"Returns the entity's render origin, set by Entity:SetRenderOrigin in a drawing hook.","realm":"Client","file":{"text":"lua/includes/extensions/client/entity.lua","line":"17"},"rets":{"ret":{"text":"The entitys render origin","name":"","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetRight","parent":"Entity","type":"classfunc","description":"Returns the rightward vector of the entity, as a normalized direction vector","realm":"Shared","rets":{"ret":{"text":"rightDir","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetRotatedAABB","parent":"Entity","type":"classfunc","description":"Returns axis-aligned bounding box (AABB) of a orientated bounding box (OBB) based on entity's rotation.","realm":"Shared","args":{"arg":[{"text":"Minimum extent of an OBB in local coordinates.","name":"min","type":"Vector"},{"text":"Maximum extent of an OBB in local coordinates.","name":"max","type":"Vector"}]},"rets":{"ret":[{"text":"Minimum extent of the AABB relative to entity's position.","name":"","type":"Vector"},{"text":"Maximum extent of the AABB relative to entity's position.","name":"","type":"Vector"}]}},"example":[{"description":"The entity's AABB center (regardless of model origin) is stored in 'pos'.","code":"local a, b = ent:GetRotatedAABB( v:OBBMins(), v:OBBMaxs() )\nlocal pos = ( ent:GetPos() + ( a + b ) / 2 )","output":"pos has the coordinates of the AABB center."},{"description":"If `developer` is set to `1`, displays entity's OBB and it's AABB based on entity's rotation.\n\nThe OBB can be any bounding box, not simply OBB of the model/entity.","code":"local e = Entity( 123 )\n\nlocal minsB, maxsB = e:OBBMins(), e:OBBMaxs()\nlocal minsA, maxsA = e:GetRotatedAABB( minsB, maxsB )\n\n-- Draw the AABB\ndebugoverlay.Box( e:GetPos(), minsA, maxsA, 10, Color( 255, 255, 255, 32 ) )\n\n-- Draw the OBB\ndebugoverlay.BoxAngles( e:GetPos(), minsB, maxsB, e:GetAngles(), 10, Color( 255, 0, 255, 32 ) )","output":{"text":"Pink = OBB, white = AABB","upload":{"src":"70c/8da74afc3a996dc.png","size":"556505","name":"image.png"}}}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSaveTable","parent":"Entity","type":"classfunc","description":{"text":"Returns a table of save values for an entity.\n\nThese tables are not the same between the client and the server, and different entities may have different fields.\n\n\n\nYou can get the list different fields an entity has by looking at it's source code (the 2013 SDK can be found [online](https://github.com/ValveSoftware/source-sdk-2013)). Accessible fields are defined by each `DEFINE_FIELD` and `DEFINE_KEYFIELD` inside the `DATADESC` block.\n\nTake the headcrab, for example:\n\n```\nBEGIN_DATADESC( CBaseHeadcrab )\n\t// m_nGibCount - don't save\n\tDEFINE_FIELD( m_bHidden, FIELD_BOOLEAN ),\n\tDEFINE_FIELD( m_flTimeDrown, FIELD_TIME ),\n\tDEFINE_FIELD( m_bCommittedToJump, FIELD_BOOLEAN ),\n\tDEFINE_FIELD( m_vecCommittedJumpPos, FIELD_POSITION_VECTOR ),\n\tDEFINE_FIELD( m_flNextNPCThink, FIELD_TIME ),\n\tDEFINE_FIELD( m_flIgnoreWorldCollisionTime, FIELD_TIME ),\n\t\n\tDEFINE_KEYFIELD( m_bStartBurrowed, FIELD_BOOLEAN, \"startburrowed\" ),\n\tDEFINE_FIELD( m_bBurrowed, FIELD_BOOLEAN ),\n\tDEFINE_FIELD( m_flBurrowTime, FIELD_TIME ),\n\tDEFINE_FIELD( m_nContext, FIELD_INTEGER ),\n\tDEFINE_FIELD( m_bCrawlFromCanister, FIELD_BOOLEAN ),\n\tDEFINE_FIELD( m_bMidJump, FIELD_BOOLEAN ),\n\tDEFINE_FIELD( m_nJumpFromCanisterDir, FIELD_INTEGER ),\n\tDEFINE_FIELD( m_bHangingFromCeiling, FIELD_BOOLEAN ),\n\tDEFINE_FIELD( m_flIlluminatedTime, FIELD_TIME ),\n\t\t\n\tDEFINE_INPUTFUNC( FIELD_VOID, \"Burrow\", InputBurrow ),\n\tDEFINE_INPUTFUNC( FIELD_VOID, \"BurrowImmediate\", InputBurrowImmediate ),\n\tDEFINE_INPUTFUNC( FIELD_VOID, \"Unburrow\", InputUnburrow ),\n\tDEFINE_INPUTFUNC( FIELD_VOID, \"StartHangingFromCeiling\", InputStartHangingFromCeiling ),\n\tDEFINE_INPUTFUNC( FIELD_VOID, \"DropFromCeiling\", InputDropFromCeiling ),\n\t\n\t// Function Pointers\n\tDEFINE_THINKFUNC( EliminateRollAndPitch ),\n\tDEFINE_THINKFUNC( ThrowThink ),\n\tDEFINE_ENTITYFUNC( LeapTouch ),\nEND_DATADESC()\n```\n\n* For each **DEFINE_FIELD**, the save table will have a key with name of **first** argument.\n* For each **DEFINE_KEYFIELD**, the save table will have a key with name of the **third** argument.","note":"It is highly recommended to use Entity:GetInternalVariable for retrieving a single key of the save table for performance reasons."},"realm":"Shared","args":{"arg":{"text":"If set, shows all variables, not just the ones marked for save/load system.","name":"showAll","type":"boolean","default":"false"}},"rets":{"ret":{"text":"A table containing all save values in key/value format.\n\nThe value may be a sequential table (starting with **1**) if the field in question is an array in engine.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSequence","parent":"Entity","type":"classfunc","description":"Return the index of the model sequence that is currently active for the entity.","realm":"Shared","rets":{"ret":{"text":"The index of the model sequence.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSequenceActivity","parent":"Entity","type":"classfunc","description":"Return activity id out of sequence id. Opposite of Entity:SelectWeightedSequence.","realm":"Shared","args":{"arg":{"text":"The sequence ID","name":"seq","type":"number"}},"rets":{"ret":{"text":"The activity ID, ie Enums/ACT","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSequenceActivityName","parent":"Entity","type":"classfunc","description":"Returns the activity name for the given sequence id.","realm":"Shared","args":{"arg":{"text":"The sequence id.","name":"sequenceId","type":"number"}},"rets":{"ret":{"text":"The Enums/ACT as a string, returns \"Not Found!\" with an invalid sequence and \"No model!\" when no model is set.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSequenceCount","parent":"Entity","type":"classfunc","description":"Returns the amount of sequences ( animations ) the entity's model has.","realm":"Shared","rets":{"ret":{"text":"The amount of sequences ( animations ) the entity's model has.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSequenceGroundSpeed","parent":"Entity","type":"classfunc","description":"Returns the ground speed of the entity's sequence.","realm":"Shared","args":{"arg":{"text":"The sequence ID.","name":"sequenceId","type":"number"}},"rets":{"ret":{"text":"The ground speed of this sequence.","name":"","type":"number"}}},"example":{"description":{"text":"Move the NextBot based on the ground speed of its walking animation (within its coroutine).","note":"In most cases it's better to use NextBot:BodyMoveXY instead."},"code":"local sequence = self:LookupSequence( \"walk_all\" )\n\nif ( sequence ) then\n\tself:StartActivity( ACT_WALK )\n\tself:SetSequence( sequence )\n\tself.loco:SetDesiredSpeed( self:GetSequenceGroundSpeed( sequence ) )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSequenceInfo","parent":"Entity","type":"classfunc","description":"Returns a table of information about an entity's sequence.","realm":"Shared","args":{"arg":{"text":"The sequence id of the entity.","name":"sequenceId","type":"number"}},"rets":{"ret":{"text":"Table of information about the entity's sequence, or `nil` is ID is out of range. See Structures/SequenceInfo.","name":"","type":"table"}}},"example":{"description":"Draw each player's current sequence bounding box with sequence name, activity number, and activity name above their head.","code":"hook.Add( \"PostPlayerDraw\", \"Sequence_Name\", function( ply )\n\n\tlocal seqinfo = ply:GetSequenceInfo( ply:GetSequence() )\n\tseqinfo.player = ply\n\t\n\trender.DrawWireframeBox( ply:GetPos(), ply:GetAngles(), seqinfo.bbmin, seqinfo.bbmax, color_white, true )\n\t\nend )\n\nhook.Add( \"HUDPaint\", \"Sequence_Name\", function()\n\n\tfor _, ply in ipairs( player.GetAll() ) do\n\t\n\t\tlocal seqinfo = ply:GetSequenceInfo( ply:GetSequence() )\n\t\tlocal textpos = ( ply:GetPos() + Vector( 0, 0, seqinfo.bbmax.z + 10 ) ):ToScreen()\n\t\n\t\tif textpos.visible then\n\t\t\n\t\t\tdraw.SimpleText( seqinfo.label, \"GModNotify\", textpos.x, textpos.y, color_white, TEXT_ALIGN_CENTER )\n\t\t\tdraw.SimpleText( seqinfo.activity .. \": \" .. seqinfo.activityname, \"GModNotify\", textpos.x, textpos.y + 20, color_white, TEXT_ALIGN_CENTER )\n\t\t\n\t\tend\n\t\n\tend\n\nend )","output":{"image":{"src":"GetSequenceInfo_Example.jpg"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSequenceList","parent":"Entity","type":"classfunc","description":"Returns a list of all sequences ( animations ) the model has.","realm":"Shared","rets":{"ret":{"text":"The list of all sequences ( animations ) the model has. The indices start with 0!","name":"","type":"table"}}},"example":{"description":"Example showing table structure. Prints a list of player model sequences.","code":"PrintTable( Entity(1):GetSequenceList() )","output":"```\n0\t=\tragdoll\n1\t=\treference\n2\t=\tidle_all_01\n3\t=\tidle_all_02\n4\t=\tidle_all_angry\n5\t=\tidle_all_scared\n6\t=\tidle_all_cower\n7\t=\tcidle_all\n8\t=\tswim_idle_all\n9\t=\tsit\n10\t=\tmenu_walk\n11\t=\tmenu_combine\n12\t=\tmenu_gman\n13\t=\twalk_all\n-- The rest of the sequences\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSequenceMoveDist","parent":"Entity","type":"classfunc","description":"Returns an entity's sequence move distance (the change in position over the course of the entire sequence).\n\nSee Entity:GetSequenceMovement for a similar function with more options.","realm":"Shared","args":{"arg":{"text":"The sequence index.","name":"sequenceId","type":"number"}},"rets":{"ret":{"text":"The move distance of the sequence.","name":"","type":"number"}}},"example":{"description":"Experiment which demonstrates that dividing the sequence move distance by Entity:SequenceDuration results in a value extremely close to Entity:GetSequenceGroundSpeed.","code":"local ply, seq, move_dist, seq_dur, ground_speed = nil, nil, nil, nil, nil\n\nfunction GM:Think()\n\n\t-- Player 1\n\tply = Entity(1)\n\t\n\t-- Current sequence\n\tseq = ply:GetSequence()\n\t\n\t-- The move distance\n\tmove_dist = ply:GetSequenceMoveDist(seq)\n\t\n\tif(move_dist == 0) then return end\t-- If it doesn't move, don't bother\n\t\n\t-- The sequence duration\n\tseq_dur = ply:SequenceDuration(seq)\n\t\n\t-- Actual sequence ground speed\n\tground_speed = ply:GetSequenceGroundSpeed(seq)\n\t\n\t-- Compare the calculated value to the actual value\n\tprint(tostring(ground_speed-(move_dist/seq_dur)))\n\nend","output":"A sample of some of the calculated vs. actual value differences during a sprint forward followed by an abrupt stop.\n\n```\n-3.3345255872064e-006\n3.3614563506035e-006\n0\n1.557984873557e-006\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSequenceMovement","parent":"Entity","type":"classfunc","description":"Returns the delta movement and angles of a sequence of the entity's model.","realm":"Shared","args":{"arg":[{"text":"The sequence index. See Entity:LookupSequence.","name":"sequenceId","type":"number"},{"text":"The sequence start cycle. 0 is the start of the animation, 1 is the end.","name":"startCycle","type":"number","default":"0"},{"text":"The sequence end cycle. 0 is the start of the animation, 1 is the end. Values like 2, etc are allowed.","name":"endCyclnde","type":"number","default":"1"}]},"rets":{"ret":[{"text":"Whether the operation was successful","name":"","type":"boolean"},{"text":"The delta vector of the animation, how much the model's origin point moved.","name":"","type":"Vector"},{"text":"The delta angle of the animation.","name":"","type":"Angle"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSequenceMoveYaw","parent":"Entity","type":"classfunc","description":"Returns the change in heading direction in between the start and the end of the sequence.","realm":"Server","args":{"arg":{"text":"The sequence index. See Entity:LookupSequence.","name":"seq","type":"number"}},"rets":{"ret":{"text":"The yaw delta. Returns 99999 for no movement.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetSequenceName","parent":"Entity","type":"classfunc","description":"Return the name of the sequence for the index provided.\nRefer to Entity:GetSequence to find the current active sequence on this entity.\n\nSee Entity:LookupSequence for a function that does the opposite.","realm":"Shared","args":{"arg":{"text":"The index of the sequence to look up.","name":"index","type":"number"}},"rets":{"ret":{"text":"Name of the sequence, `\"Unknown\"` if it was out of bounds or `\"Not Found!\"` if -1 is provided.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSequenceVelocity","parent":"Entity","type":"classfunc","description":"Returns an entity's sequence velocity at given animation frame.","realm":"Shared","added":"2022.06.08","args":{"arg":[{"text":"The sequence index.","name":"sequenceId","type":"number"},{"text":"The point in animation, from `0` to `1`.","name":"cycle","type":"number"}]},"rets":{"ret":{"text":"Velocity of the sequence at given point in the animation.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetShouldPlayPickupSound","parent":"Entity","type":"classfunc","description":"Checks if the entity plays a sound when picked up by a player.","realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"7-L9"},"rets":{"ret":{"text":"`true` if it plays the pickup sound, `false` otherwise.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetShouldServerRagdoll","parent":"Entity","type":"classfunc","description":"Returns if entity should create a server ragdoll on death or a client one.","realm":"Shared","rets":{"ret":{"text":"Returns true if ragdoll will be created on server, false if on client","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSkin","parent":"Entity","type":"classfunc","description":"Returns the skin index of the current skin. Can be manipulated via Entity:SetSkin.","realm":"Shared","rets":{"ret":{"text":"Current skin index.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSolid","parent":"Entity","type":"classfunc","description":"Returns solid type of an entity.","realm":"Shared","rets":{"ret":{"text":"The solid type. See the Enums/SOLID.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSolidFlags","parent":"Entity","type":"classfunc","description":"Returns solid flag(s) of an entity.","realm":"Shared","rets":{"ret":{"text":"The flag(s) of the entity, see Enums/FSOLID.","name":"","type":"number{FSOLID}"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSpawnEffect","parent":"Entity","type":"classfunc","description":"Returns if we should show a spawn effect on spawn on this entity.","realm":"Shared","rets":{"ret":{"text":"The flag to allow or disallow the spawn effect.","name":"","type":"boolean"}}},"example":{"description":"Taken from sandbox's cl_init.lua","code":"function GM:NetworkEntityCreated( ent )\n\n\t--\n\t-- If the entity wants to use a spawn effect\n\t-- then create a propspawn effect if the entity was\n\t-- created within the last second (this function gets called\n\t-- on every entity when joining a server)\n\t--\n\n\tif ( ent:GetSpawnEffect() && ent:GetCreationTime() > ( CurTime() - 1.0 ) ) then\n\t\n\t\tlocal ed = EffectData()\n\t\ted:SetEntity( ent )\n\t\tutil.Effect( \"propspawn\", ed, true, true )\n\n\tend\n\nend","output":"Checks if the entity has the spawnEffect flag set to true and checks if it was created in the last second, and then shows the propspawn effect."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSpawnFlags","parent":"Entity","type":"classfunc","description":"Returns the bitwise spawn flags used by the entity. These can be set by Entity:SetKeyValue.","realm":"Shared","rets":{"ret":{"text":"The spawn flags of the entity, see SF_Enums.","name":"","type":"number"}}},"example":{"description":"An alternative to Entity:HasSpawnFlags","code":"local sf = ent:GetSpawnFlags()\n\nif( bit.band( sf, SF_PHYSPROP_PREVENT_PICKUP ) > 0 ) then\n\tprint( \"This prop cannot be picked up.\" )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSubMaterial","parent":"Entity","type":"classfunc","description":{"text":"Returns the material override for the given index. \n\nReturns \"\" if no material override exists. Use Entity:GetMaterials to list it's default materials.","bug":{"text":"The server's value takes priority on the client.","issue":"3362"}},"realm":"Shared","args":{"arg":{"text":"The index of the sub material. Acceptable values are from 0 to 31.","name":"index","type":"number"}},"rets":{"ret":{"text":"The material that overrides this index, if any.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSubModels","parent":"Entity","type":"classfunc","description":"Returns a list of models included into the entity's model in the .qc file.","realm":"Shared","rets":{"ret":{"text":"The list of models included into the entity's model in the .qc file.","name":"","type":"table<table>"}}},"example":{"description":"Example structure of the  table. Prints into console sub models of a player model.","code":"PrintTable(Entity(1):GetSubModels() )","output":"```\n1:\n\t\tname\t=\tmodels/m_anm.mdl\n\t\tid\t=\t0\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSurroundingBounds","parent":"Entity","type":"classfunc","added":"2023.01.25","description":"Returns two vectors representing the minimum and maximum extent of the entity's axis-aligned bounding box for hitbox detection. In most cases, this will return the same bounding box as Entity:WorldSpaceAABB unless it was changed by Entity:SetSurroundingBounds or Entity:SetSurroundingBoundsType.","realm":"Shared","rets":{"ret":[{"text":"The minimum vector for the entity's bounding box in world space.","name":"","type":"Vector"},{"text":"The maximum vector for the entity's bounding box in world space.","name":"","type":"Vector"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetTable","parent":"Entity","type":"classfunc","description":"Returns a table that contains all lua-based key-value pairs saved on the Entity.\n\n\t\tFor retrieving engine-based key-value pairs, see Entity:GetSaveTable","realm":"Shared","rets":{"ret":{"text":"A table of the lua data stored on the Entity, or `nil` if the Entity is NULL.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetTouchTrace","parent":"Entity","type":"classfunc","description":{"text":"Returns the last trace used in the collision callbacks such as ENTITY:StartTouch, ENTITY:Touch and ENTITY:EndTouch.","note":"This returns the last collision trace used, regardless of the entity that caused it. As such, it's only reliable when used in the hooks mentioned above"},"realm":"Shared","rets":{"ret":{"text":"The Structures/TraceResult","name":"","type":"table{TraceResult}"}}},"example":{"description":"Dispatches an explosion at the point of impact with another entity.","code":"function ENT:Touch( otherEntity )\n\tlocal tr = self:GetTouchTrace()\n\tlocal hitPos = tr.HitPos\n\n\tlocal effectdata = EffectData()\n\teffectdata:SetOrigin( hitPos )\n\tutil.Effect( \"Explosion\", effectdata )\n\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetTransmitWithParent","parent":"Entity","type":"classfunc","description":"Returns true if the TransmitWithParent flag is set or not.","realm":"Shared","rets":{"ret":{"text":"Is the TransmitWithParent flag is set or not","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetUnFreezable","parent":"Entity","type":"classfunc","description":"Returns if the entity is unfreezable, meaning it can't be frozen with the physgun. By default props are freezable, so this function will typically return false.","realm":"Server","file":{"text":"lua/includes/extensions/entity.lua","line":"590-L592"},"rets":{"ret":{"text":"True if the entity is unfreezable, false otherwise.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetUp","parent":"Entity","type":"classfunc","description":"Returns the upward vector of the entity, as a normalized direction vector","realm":"Shared","rets":{"ret":{"text":"upDir","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetVar","parent":"Entity","type":"classfunc","description":"Retrieves a value from entity's Entity:GetTable. Set by Entity:SetVar.","realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"45-L55"},"args":{"arg":[{"text":"Key of the value to retrieve","name":"key","type":"any"},{"text":"A default value to fallback to if we couldn't retrieve the value from entity","name":"default","type":"any","default":"nil"}]},"rets":{"ret":{"text":"Retrieved value","name":"","type":"any"}}},"example":{"description":"The 2 lines of code are functionally identical.","code":"print( Entity( 1 ):GetVar( \"Test\" ) )\n\nprint( Entity( 1 ).Test )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetVelocity","parent":"Entity","type":"classfunc","description":{"text":"Returns the entity's velocity.\n\nThis returns the total velocity of the entity and is equal to local velocity + base velocity.\n\nClientside the velocity may be estimated for certain entities, such as physics based entities, instead of returning the \"real\" velocity from the server.","bug":{"text":"This can become out-of-sync on the client if the server has been up for a long time.","issue":"774"}},"realm":"Shared","rets":{"ret":{"text":"The velocity of the entity.","name":"","type":"Vector"}}},"example":{"description":"Lets you know if the object is being moved.","code":"if ent:GetVelocity():LengthSqr() > 0 then\n\t// Is being moved\nelse\n\t// Not being moved\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetWorkshopID","parent":"Entity","type":"classfunc","description":{"text":"Returns ID of workshop addon that the entity is from.","deprecated":"The function **currently** does nothing and always returns nil"},"realm":"Server","rets":{"ret":{"text":"The workshop ID","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetWorldTransformMatrix","parent":"Entity","type":"classfunc","description":{"text":"Returns the position and angle of the entity as a 3x4 matrix (VMatrix is 4x4 so the fourth row goes unused). The first three columns store the angle as a [rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix), and the fourth column stores the position vector.","bug":[{"text":"This returns incorrect results for the angular component (columns 1-3) for the local player clientside.","issue":"2764"},{"text":"This will use the local player's Global.EyeAngles in rendering hooks.","issue":"3106"},{"text":"Columns 1-3 will be all 0 (angular component) in rendering hooks while paused in single-player.","issue":"3107"}]},"realm":"Shared","rets":{"ret":{"text":"The position and angle matrix.","name":"","type":"VMatrix"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GibBreakClient","parent":"Entity","type":"classfunc","description":{"text":"Causes the entity to break into its current models gibs, if it has any.\n\nYou must call Entity:PrecacheGibs on the entity before using this function, or it will not create any gibs.\n\nIf called on server, the gibs will be spawned on the currently connected clients and will not be synchronized. Otherwise the gibs will be spawned only for the client the function is called on.","note":"this function will not remove or hide the entity it is called on.\n\tFor more expensive version of this function see Entity:GibBreakServer."},"realm":"Shared","args":{"arg":[{"text":"The force to apply to the created gibs.","name":"force","type":"Vector"},{"text":"If set, this will be color of the broken gibs instead of the entity's color.","name":"clr","type":"Color","default":"nil"}]}},"example":{"description":"A console command that breaks the prop the player is aiming at when they run the command.","code":"concommand.Add( \"break\", function( ply )\n\tlocal tr = ply:GetEyeTrace()\n\tlocal ent = tr.Entity\n\tif ( !IsValid( ent ) ) then return end -- playing not looking at any entity, bail\n\n\tent:PrecacheGibs()\n\tent:GibBreakClient( tr.HitNormal * 100 ) -- Break in some direction\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GibBreakServer","parent":"Entity","type":"classfunc","description":{"text":"Causes the entity to break into its current models gibs, if it has any.\n\nYou must call Entity:PrecacheGibs on the entity before using this function, or it will not create any gibs.\n\nThe gibs will be spawned on the server and be synchronized with all clients.\n\nNote, that this function will not remove or hide the entity it is called on.\n\nThis function is affected by `props_break_max_pieces_perframe`, `props_break_max_pieces`, `prop_active_gib_limit` and `prop_active_gib_max_fade_time` console variables.","warning":"Large numbers of serverside gibs will cause lag.\n\nYou can avoid this cost by spawning the gibs on the client using Entity:GibBreakClient","note":"Despite existing on client, it doesn't actually do anything on client."},"realm":"Shared","args":{"arg":{"text":"The force to apply to the created gibs","name":"force","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"HasBoneManipulations","parent":"Entity","type":"classfunc","description":{"text":"Returns whether or not the bone manipulation functions have ever been called on given  entity.\n\nRelated functions are Entity:ManipulateBonePosition, Entity:ManipulateBoneAngles, Entity:ManipulateBoneJiggle, and Entity:ManipulateBoneScale.","bug":{"text":"This will return true if the entity's bones have ever been manipulated. Resetting the position/angles/jiggle/scaling to 0,0,0 will not affect this function.","issue":"3131"}},"realm":"Shared","rets":{"ret":{"text":"True if the entity has been bone manipulated, false otherwise.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"HasFlexManipulatior","parent":"Entity","type":"classfunc","description":"Returns whether or not the the entity has had flex manipulations performed with Entity:SetFlexWeight or Entity:SetFlexScale.","realm":"Shared","rets":{"ret":{"text":"True if the entity has flex manipulations, false otherwise.","name":"","type":"boolean"}}},"example":{"description":"Defines server-side function which manipulates all of an entity's flexes and prints true if the entity has flex manipulations.","code":"function FlexExample(ent)\n\n\tif(!IsValid(ent)) then return end\n\t\n\t-- Loop through all flexes\n\tfor i = 0, ent:GetFlexNum()-1 do\n\t\n\t\t-- Set each flex to number ranging from 0.0 to 2.0\n\t\tent:SetFlexWeight(i, math.random()*2)\n\t\t\n\tend\n\t\n\t-- Print whether or not we have flex manipulations\n\tprint(ent:HasFlexManipulatior())\n\nend","output":{"text":"```\ntrue\n```","image":{"src":"Entity_HasFlexManipulatior_example1.jpg"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"HasSpawnFlags","parent":"Entity","type":"classfunc","description":"Returns whether this entity has the specified spawnflags bits set.","realm":"Shared","args":{"arg":{"text":"The spawnflag bits to check, see Enums/SF.","name":"spawnFlags","type":"number"}},"rets":{"ret":{"text":"Whether the entity has that spawnflag set or not.","name":"","type":"boolean"}}},"example":{"description":"As seen in sandbox's PhysgunPickup hook.","code":"function GM:PhysgunPickup( ply, ent )\n\n\t-- Don't move physboxes if the mapper logic says no\n\tif ( ent:GetClass() == \"func_physbox\" && ent:HasSpawnFlags( SF_PHYSBOX_MOTIONDISABLED ) ) then return false end\n\n\treturn true\n\t\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"HeadTarget","parent":"Entity","type":"classfunc","description":{"text":"Returns the position of the head of this entity, NPCs use this internally to aim at their targets.","note":"This only works on players and NPCs."},"realm":"Server","args":{"arg":{"text":"The vector of where the attack comes from.","name":"origin","type":"Vector"}},"rets":{"ret":{"text":"The head position.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Health","parent":"Entity","type":"classfunc","description":"Returns the health of the entity.","realm":"Shared","rets":{"ret":{"text":"health","name":"","type":"number"}}},"example":{"description":"Prints if the entity's health is at full or more.","code":"print( Entity( 1 ):Health() >= Entity( 1 ):GetMaxHealth() )","output":"\"true\" entity's health is greater than or equal to their max health, or \"false\" otherwise."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Ignite","parent":"Entity","type":"classfunc","description":"Sets the entity on fire.\n\nSee also Entity:Extinguish.","realm":"Server","args":{"arg":[{"text":"How long to keep the entity ignited, in seconds.","name":"length","type":"number"},{"text":"The radius of the ignition, will ignite everything around the entity that is in this radius.","name":"radius","type":"number","default":"0"}]}},"example":{"description":"Ignite all props on the map for 30 seconds.","code":"for _, ent in ipairs( ents.FindByClass( \"prop_physics\" ) ) do\n   ent:Ignite( 30 )\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"InitializeAsClientEntity","parent":"Entity","type":"classfunc","description":{"text":"Initializes this entity as being clientside only.\n\nOnly works on entities fully created clientside, and as such it currently has no use due to this being automatically called by ents.CreateClientProp, ents.CreateClientside, Global.ClientsideModel and Global.ClientsideScene.","deprecated":"This function got disabled and will always throw an error if it's used. This is the error: \n```\n[ERROR] InitializeAsClientEntity is deprecated and should no longer be used.\n```"},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Input","parent":"Entity","type":"classfunc","description":"Fires input to the entity with the ability to make another entity responsible, bypassing the event queue system.\n\nYou should only use this function over Entity:Fire if you know what you are doing.\n\nSee Entity:Fire for a function that conforms to the internal map IO event queue and GM:AcceptInput for a hook that can intercept inputs.","realm":"Server","args":{"arg":[{"text":"The name of the input to fire","name":"input","type":"string"},{"text":"The entity that caused this input (i.e. the player who pushed a button)","name":"activator","type":"Entity","default":"nil"},{"text":"The entity that is triggering this input (i.e. the button that was pushed)","name":"caller","type":"Entity","default":"nil"},{"text":"The value to give to the input. Can be either a string, a number or a boolean.","name":"param","type":"string|number|boolean","default":"nil"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"InstallDataTable","parent":"Entity","type":"classfunc","description":{"text":"Sets up Data Tables from entity to use with Entity:NetworkVar.","internal":""},"realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"217-L590"}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"InvalidateBoneCache","parent":"Entity","type":"classfunc","description":"Resets the entity's bone cache values in order to prepare for a model change.\n\nThis should be called after calling Entity:SetPoseParameter.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsConstrained","parent":"Entity","type":"classfunc","description":{"text":"Returns true if the entity has constraints attached to it","bug":{"text":"This will only update clientside if the server calls it first. This only checks constraints added through the constraint so this will not react to map constraints.\n\nFor a serverside alternative, see constraint.HasConstraints","issue":"3837"}},"realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"75-L97"},"rets":{"ret":{"text":"Whether the entity is constrained or not.","name":"","type":"boolean"}}},"example":{"description":"From entities/prop_effect.lua","code":"function ENT:PhysicsUpdate( physobj )\n\n\tif ( CLIENT ) then return end\n\n\t-- Don't do anything if the player isn't holding us\n\tif ( !self:IsPlayerHolding() && !self:IsConstrained() ) then\n\t\tphysobj:SetVelocity( Vector(0,0,0) )\n\t\tphysobj:Sleep() \n\tend\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsConstraint","parent":"Entity","type":"classfunc","description":{"text":"Returns if entity is constraint or not.\n\nThis also means that Entity:GetConstrainedPhysObjects. Entity:GetConstrainedEntities and  Entity:SetPhysConstraintObjects can be used on this entity.","warning":"For some constraint entities, such as `phys_spring`, `phys_slideconstraint`, `phys_torque` and `logic_collision_pair`, this function will return `false`!"},"realm":"Server","rets":{"ret":{"text":"Is the entity a constraint or not","name":"","type":"boolean"}}},"example":{"description":"Returns true if player 1 is aiming at constraint.","code":"print( Entity(1):GetEyeTrace().Entity:IsConstraint() )","output":"false"},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsDormant","parent":"Entity","type":"classfunc","description":"Returns whether the entity is dormant or not.\n\nNetworked entities become dormant clientside when they leave the [PVS (Potential Visibility Set)](https://developer.valvesoftware.com/wiki/PVS \"PVS - Valve Developer Community\"). This typically means they are no longer visible by the local player, and will not receive updates from the server.\n\nServer side, entities can only be dormant during level transitions by default.","realm":"Shared","rets":{"ret":{"text":"Whether the entity is dormant or not.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsEffectActive","parent":"Entity","type":"classfunc","description":"Returns whether an entity has engine effect applied or not.","realm":"Shared","args":{"arg":{"text":"The effect to check for, see Enums/EF.","name":"effect","type":"number{EF}"}},"rets":{"ret":{"text":"Whether the entity has the engine effect applied or not.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsEFlagSet","parent":"Entity","type":"classfunc","description":"Checks if given flag is set or not.","realm":"Shared","args":{"arg":{"text":"The engine flag to test, see Enums/EFL","name":"flag","type":"number{EFL}"}},"rets":{"ret":{"text":"Is set or not","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsFlagSet","parent":"Entity","type":"classfunc","description":"Checks if given flag(s) is set or not.","realm":"Shared","args":{"arg":{"text":"The engine flag(s) to test, see Enums/FL","name":"flag","type":"number{FL}"}},"rets":{"ret":{"text":"Is set or not","name":"","type":"boolean"}}},"example":{"description":"Checks if the player is on the ground.","code":"print( Entity( 1 ):IsFlagSet( FL_ONGROUND ))","output":"`true`"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsInWorld","parent":"Entity","type":"classfunc","description":{"text":"Returns whether the entity is in the world (not inside a wall or outside of the map).","note":"Internally this function uses util.IsInWorld, that means that this function only checks Entity:GetPos of the entity. If an entity is only partially inside a wall, or has a weird GetPos offset, this function may not give reliable output."},"realm":"Server","rets":{"ret":{"text":"False if the entity is inside a wall or outside of the map, true otherwise.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsLagCompensated","parent":"Entity","type":"classfunc","description":"Returns whether the entity is lag compensated or not.","realm":"Server","rets":{"ret":{"text":"Whether the entity is lag compensated or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsLineOfSightClear","parent":"Entity","type":"classfunc","description":{"text":"Returns true if the target is in line of sight.","note":"This will only work when called on CBaseCombatCharacter entities. This includes players, NPCs, grenades, RPG rockets, crossbow bolts, and physics cannisters."},"realm":"Shared","args":{"arg":{"text":"The target to test. You can also supply an Entity instead of a Vector","name":"target","type":"Vector"}},"rets":{"ret":{"text":"Returns true if the line of sight is clear","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsMarkedForDeletion","parent":"Entity","type":"classfunc","realm":"Shared","description":"Determines if a given Entity is going to be removed at the start of the next tick.\n\n\t\tThis will return `true` for an Entity after Entity:Remove is called on it.","rets":{"ret":{"text":"`true` if the Entity is going to be removed, `false` otherwise.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsNextBot","parent":"Entity","type":"classfunc","description":"Checks if the entity is a NextBot or not.","realm":"Shared","rets":{"ret":{"text":"Whether the entity is an NextBot entity or not.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsNPC","parent":"Entity","type":"classfunc","description":"Checks if the entity is an NPC or not.\n\nThis will return false for NextBots, see Entity:IsNextBot for that.","realm":"Shared","rets":{"ret":{"text":"Whether the entity is an NPC.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsOnFire","parent":"Entity","type":"classfunc","description":"Returns whether the entity is on fire.","realm":"Shared","rets":{"ret":{"text":"Whether the entity is on fire or not.","name":"","type":"boolean"}}},"example":{"description":"Demonstrates the use of this function.","code":"print( Entity(1):IsOnFire() )","output":"Outputs 'true' to the console if the player 1 is on fire."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsOnGround","parent":"Entity","type":"classfunc","description":"Returns whether the entity is on ground or not.\n\nInternally, this checks if FL_ONGROUND is set on the entity.\n\nThis function is an alias of Entity:OnGround.","realm":"Shared","rets":{"ret":{"text":"Whether the entity is on ground or not.","name":"","type":"boolean"}}},"example":{"description":"Demonstrates the use of this function.","code":"print( Entity( 1 ):IsOnGround() )\nprint( IsValid( Entity( 1 ):GetGroundEntity() ) ) -- This should give the exact output as the first line","output":"Outputs 'true' to the console if the player 1 is on ground."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsPlayer","parent":"Entity","type":"classfunc","description":"Checks if the entity is a player or not.","realm":"Shared","rets":{"ret":{"text":"Whether the entity is a player.","name":"","type":"boolean"}}},"example":{"description":"Checks if two entities are players.","code":"print( Entity( 1 ):IsPlayer() )\nprint( ents.FindByClass( \"prop_physics\" )[ 1 ]:IsPlayer() )","output":"```\ntrue\nfalse\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsPlayerHolding","parent":"Entity","type":"classfunc","description":{"text":"Returns true if the entity is being held by a player. Either by physics gun, gravity gun or use-key (+use).","bug":{"text":"If multiple players are holding an object and one drops it, this will return false despite the object still being held.","issue":"2046"}},"realm":"Server","rets":{"ret":{"text":"IsBeingHeld","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsPlayingGesture","parent":"Entity","type":"classfunc","description":{"text":"Returns whether there's a gesture with the given activity being played.","note":"This function only works on BaseAnimatingOverlay entites!"},"realm":"Server","args":{"arg":{"text":"The activity to test. See Enums/ACT.","name":"activity","type":"number"}},"rets":{"ret":{"text":"Whether there's a gesture is given activity being played.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsPointInBounds","parent":"Entity","type":"classfunc","description":"Returns whether a given point is within the entity's Orientated Bounding Box.\n\nThis relies on the entity having a collision mesh (not a physics object) and will be affected by `SOLID_NONE`.","added":"2022.08.02","realm":"Shared","args":{"arg":{"text":"The point to test, in world space coordinates.","name":"point","type":"Vector"}},"rets":{"ret":{"text":"Whether the point is within the entity's bounds.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsRagdoll","parent":"Entity","type":"classfunc","description":"Checks if the entity is a ragdoll, or became a ragdoll. Internally checks whether [kRenderFXRagdoll](kRenderFX) is set.","realm":"Shared","rets":{"ret":{"text":"Is ragdoll or not","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsScripted","parent":"Entity","type":"classfunc","description":"Checks if the entity is a SENT or a built-in entity.","realm":"Shared","rets":{"ret":{"text":"Returns true if entity is scripted ( SENT ), false if not ( A built-in engine entity )","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsSequenceFinished","parent":"Entity","type":"classfunc","description":"Returns whether the entity's current sequence is finished or not.","realm":"Shared","added":"2020.04.29","rets":{"ret":{"text":"Whether the entity's sequence is finished or not.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsSolid","parent":"Entity","type":"classfunc","description":"Returns if the entity is solid or not.\nVery useful for determining if the entity is a trigger or not.","realm":"Shared","rets":{"ret":{"text":"Whether the entity is solid or not.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsValid","parent":"Entity","type":"classfunc","description":{"text":"Returns whether the entity is a valid entity or not.\n\nAn entity is valid if:\n* It is not a NULL entity\n* It is not the worldspawn entity (game.GetWorld)\n\n\n\nIt will check whether the given variable contains an object (an Entity) or nothing at all for you. See examples.\n\n\nThis might be a cause for a lot of headache. Usually happening during networking etc., when completely valid entities suddenly become invalid on the client, but are never filtered with IsValid(). See GM:InitPostEntity for more details.","note":"Instead of calling this method directly, it's a good idea to call the global Global.IsValid instead, however if you're sure the variable you're using is always an entity object it's better to use this method","warning":"NULL entities can still be assigned with key/value pairs, but they will be instantly negated. See example 3"},"realm":"Shared","rets":{"ret":{"text":"true if the entity is valid, false otherwise","name":"","type":"boolean"}}},"example":[{"description":"Shows how to use the global Global.IsValid function instead of using this method directly.","code":"if ( entity && entity:IsValid() ) then\n\t-- Do stuff\nend\n\n-- The above can be replaced with the following for the same effect (and cleaner code)\n\nif ( IsValid( entity ) ) then\n\t-- Do stuff\nend"},{"code":"print( LocalPlayer():IsValid() )","output":"Outputs 'true' to the console if the player is in-game."},{"code":"local newPlayer = net.ReadEntity() --server found a new player on the server and sent it to us after \nprint( \"1/4\" )              -- it determined it was valid (newPlayer is NULL in this realm)\n\nif not isnumber(newPlayer.ImportantGameData) then --If it doesn't have a specific field, assign a value to it\n\tprint( \"2/4\" )\n\tnewPlayer.ImportantGameData = 42 \nend\nprint( \"3/4\" )\n\nprint( newPlayer.ImportantGameData * 69 ) --Attempting to do arithmetics on the new field\nprint( \"4/4\" )","output":"1/4 ... 3/4\n* A lua error telling us 'ImportantGameData' is a nil value and thus can't perform math on it\n----\nBut this shouldn't be possible, because we just created a value there. No red flags are present up until this point; all code up until this will run fine. Make sure to add an IsValid() check when the seemingly impossible happens."}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsValidLayer","parent":"Entity","type":"classfunc","description":{"text":"Returns whether the given layer ID is valid and exists on this entity.","note":"This function only works on BaseAnimatingOverlay entities."},"realm":"Shared","args":{"arg":{"text":"The Layer ID","name":"layerID","type":"number"}},"rets":{"ret":{"text":"Whether the given layer ID is valid and exists on this entity.","name":"","type":"boolean"}}},"example":{"description":"Print information about an entity's all possible active layers.","code":"local MAX_OVERLAYS = 15 -- defined in BaseAnimatingOverlay.h#L132\nlocal queryEnt = Entity(1) \nfor i = 0,MAX_OVERLAYS do -- overlay index starts from 0 up to 15 \n\tif queryEnt:IsValidLayer(i) then \n\t\ts = queryEnt:GetLayerSequence(i) \n\t\tprint(i,s,queryEnt:GetSequenceName(s),queryEnt:GetSequenceActivityName(s)) \n\tend \nend","output":"```\n0\t355\treload_revolver\tACT_HL2MP_GESTURE_RELOAD_REVOLVER\n2\t249\tjump_land\tACT_LAND\n\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsVehicle","parent":"Entity","type":"classfunc","description":"Checks if the entity is a vehicle or not.","realm":"Shared","rets":{"ret":{"text":"Whether the entity is a vehicle.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsWeapon","parent":"Entity","type":"classfunc","description":"Checks if the entity is a weapon or not.","realm":"Shared","rets":{"ret":{"text":"Whether the entity is a weapon","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsWidget","parent":"Entity","type":"classfunc","description":"Returns whether the entity is a widget or not.\n\nThis is used by the \"Edit Bones\" context menu property.","realm":"Shared","file":{"text":"lua/includes/modules/widget.lua","line":"161"},"rets":{"ret":{"text":"Whether the entity is a widget or not.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsWorld","parent":"Entity","type":"classfunc","description":"Returns if this entity is the map entity `Entity[0] worldspawn`.","realm":"Shared","rets":{"ret":{"text":"Whether this entity is the world entity.","name":"","type":"boolean"}}},"example":{"description":"Stool boilerplate for the ignite tool","code":"function TOOL:LeftClick( trace )\n\tlocal ent = trace.Entity\n \tif not IsValid( ent ) or ent:IsPlayer() or ent:IsWorld() then \n\t\treturn false \n \tend\n \t...\nend","output":"LeftClick will not run for no ent, invalid ents, players, or worldspawn."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"LocalToWorld","parent":"Entity","type":"classfunc","description":"Translates a vector relative to the entity's coordinate system into a worldspace vector.","realm":"Shared","args":{"arg":{"text":"A local space vector.","name":"lpos","type":"Vector"}},"rets":{"ret":{"text":"The corresponding worldspace vector.","name":"","type":"Vector"}}},"example":{"description":"Produces a worldspace vector 100 units in front of the position of the entity, taking into account the entity's angles.","code":"return ent:LocalToWorld( Vector( 100, 0, 0 ) )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"LocalToWorldAngles","parent":"Entity","type":"classfunc","description":"Translates an angle relative to the entity's coordinate system to a worldspace angle.","realm":"Shared","args":{"arg":{"text":"A local space angle.","name":"ang","type":"Angle"}},"rets":{"ret":{"text":"The corresponding worldspace angle.","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"LookupAttachment","parent":"Entity","type":"classfunc","description":"Returns the attachment index of the given attachment name.","realm":"Shared","args":{"arg":{"text":"The name of the attachment.","name":"attachmentName","type":"string"}},"rets":{"ret":{"text":"The attachment index, or 0 if the attachment does not exist and -1 if the model is invalid.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"LookupBone","parent":"Entity","type":"classfunc","description":{"text":"Gets the bone index of the given bone name, returns `nil` if the bone does not exist. \n\n\nSee Entity:GetBoneName for the inverse of this function.","note":"When called on Weapons equipped by any Player, this will return their viewmodel's bone index instead of worldmodel."},"realm":"Shared","args":{"arg":{"text":"The name of the bone.\n\nCommon generic bones ( for player models and some HL2 models ): \n* ValveBiped.Bip01_Head1\n* ValveBiped.Bip01_Spine\n* ValveBiped.Anim_Attachment_RH\n\nCommon hand bones (left hand equivalents also available, replace _R_ with _L_)\n* ValveBiped.Bip01_R_Hand\n* ValveBiped.Bip01_R_Forearm\n* ValveBiped.Bip01_R_Foot\n* ValveBiped.Bip01_R_Thigh\n* ValveBiped.Bip01_R_Calf\n* ValveBiped.Bip01_R_Shoulder\n* ValveBiped.Bip01_R_Elbow","name":"boneName","type":"string"}},"rets":{"ret":{"text":"Index of the given bone name, or `nil` if the bone doesn't exist on the Entity.","name":"","type":"number|nil"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"LookupPoseParameter","parent":"Entity","type":"classfunc","description":"Returns pose parameter ID from its name.","realm":"Shared","added":"2020.03.17","args":{"arg":{"text":"Pose parameter name","name":"name","type":"string"}},"rets":{"ret":{"text":"The ID of the given pose parameter name, if it exists, -1 otherwise","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"LookupSequence","parent":"Entity","type":"classfunc","description":"Returns sequence ID from either sequence name or activity name. See Entity:GetSequenceName for a function that does the opposite.\n\n**Sequences** are animations tied to a specific model. Different models can have sequences with same names, but have different IDs.  \nSequences can also be tied to certain activities (Enums/ACT), see Entity:SelectWeightedSequence.","realm":"Shared","args":{"arg":{"text":"Sequence name. Input string can alternatively be an activity name, to lookup an activity from its name and get a sequence as result.","name":"name","type":"string"}},"rets":{"ret":[{"text":"Sequence ID for that name. This **will** differ for models with same sequence names. Will be `-1` when the sequence is invalid or not found.","name":"","type":"number"},{"text":"The sequence duration, or `0` if the sequence is invalid or there's no sequence with given name on entity's current model.","name":"","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"MakePhysicsObjectAShadow","parent":"Entity","type":"classfunc","description":{"text":"Turns the Entity:GetPhysicsObject into a physics shadow.\nIt's used internally for the Player's and NPC's physics object, and certain HL2 entities such as the crane.\n\nA physics shadow can be used to have static entities that never move by setting both arguments to false.","note":"Unlike Entity:PhysicsInitShadow, this function doesn't remove the current physics object."},"realm":"Shared","args":{"arg":[{"text":"Whether to allow the physics shadow to move under stress.","name":"allowPhysicsMovement","type":"boolean","default":"true"},{"text":"Whether to allow the physics shadow to rotate under stress.","name":"allowPhysicsRotation","type":"boolean","default":"true"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ManipulateBoneAngles","parent":"Entity","type":"classfunc","description":{"text":"Sets custom bone angles.","bug":{"text":"When used repeatedly serverside, this method is strongly discouraged due to the huge network traffic produced\n\nAs of update `2024.10.29` this has been resolved. However, network traffic is still generated and should be taken into consideration.","issue":"5148"}},"realm":"Shared","args":{"arg":[{"text":"Index of the bone you want to manipulate","name":"boneID","type":"number"},{"text":"Angle to apply.\n\nThe angle is relative to the original bone angle, not relative to the world or the entity.","name":"ang","type":"Angle"},{"text":"boolean to network these changes (if called from server)","name":"networking","type":"boolean","default":"true"}]}},"example":{"description":"This example shows the network usage impact of repeatedly using bone manipulation serverside.\n\nTo see the difference, type in client's console: `net_graph 3`.\n\nThe rotation is not smooth when using Entity:SetNWFloat because it does not update the value on every frame.","code":"local server_only = true -- Change the value!\n\nif server_only then\n\tif SERVER then\n\t\thook.Add( \"Think\", \"bone_manipulation_test\", function()\n\t\t\tfor _, ent in ipairs( ents.FindByModel( \"models/buggy.mdl\" ) ) do\n\t\t\t\tent:ManipulateBoneAngles( 28, Angle( 0, 0, RealTime() * 180 ) )\n\t\t\tend\n\t\tend )\n\telse\n\t\thook.Remove( \"Think\", \"bone_manipulation_test\" )\n\tend\nelse\n\tif SERVER then\n\t\thook.Add( \"Think\", \"bone_manipulation_test\", function()\n\t\t\tfor _, ent in ipairs( ents.FindByModel( \"models/buggy.mdl\" ) ) do\n\t\t\t\t-- Entity:SetNW....() do not broadcast new values instantly.\n\t\t\t\tent:SetNWFloat( \"bone_manipulation_test\", RealTime() * 180 )\n\t\t\tend\n\t\tend )\n\telse\n\t\thook.Add( \"Think\", \"bone_manipulation_test\", function()\n\t\t\tfor _, ent in ipairs( ents.FindByModel( \"models/buggy.mdl\" ) ) do\n\t\t\t\tent:ManipulateBoneAngles( 28, Angle( 0, 0, ent:GetNWFloat( \"bone_manipulation_test\" ) ) )\n\t\t\tend\n\t\tend )\n\tend\nend","output":"Rotation of the ammo box of all HL2 buggies."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ManipulateBoneJiggle","parent":"Entity","type":"classfunc","description":"Manipulates the bone's jiggle status. This allows non jiggly bones to become jiggly.","realm":"Shared","args":{"arg":[{"text":"Index of the bone you want to manipulate.","name":"boneID","type":"number"},{"text":"The jiggle bone type. There are currently the following options:\n* `0` = No jiggle override, use model default\n* `1` = Force jiggle, with hardcoded settings\n* `2` = Force disable jiggle bone","name":"type","type":"number"}]}},"example":{"description":"Turn everyone into jelly mode.","code":{"text":"for _, ply in ipairs( player.GetAll() ) do\n\tlocal i = 0\n\n\twhile i","ply:getbonecount":{"do":"","ply:manipulatebonejiggle":"","i":["","i"],"end":"","ode":"ode"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ManipulateBonePosition","parent":"Entity","type":"classfunc","description":"Sets custom bone offsets.","realm":"Shared","args":{"arg":[{"text":"Index of the bone you want to manipulate.","name":"boneID","type":"number"},{"text":"Position vector to apply. Note that the position is relative to the original bone position, not relative to the world or the entity.","name":"pos","type":"Vector"},{"text":"boolean to network these changes (if called from server)","name":"networking","type":"boolean","default":"true"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ManipulateBoneScale","parent":"Entity","type":"classfunc","description":{"text":"Sets custom bone scale.","bug":{"text":"This does not scale procedural bones.","issue":"3502"},"note":"This silently fails when given a Vector with nan values, hiding the vertices associated with the bone. See example below."},"realm":"Shared","args":{"arg":[{"text":"Index of the bone you want to manipulate","name":"boneID","type":"number"},{"text":"Scale vector to apply. Note that the scale is relative to the original bone scale, not relative to the world or the entity.","name":"scale","type":"Vector"}]}},"example":{"description":"Shows the difference between nan and zeroing scale.","code":"-- Scales the head bone down, essentially pinching the vertices\nconcommand.Add( \"scale_player_head\", function( ply, cmd, args )\n\tlocal ply = Entity(1)\n\tlocal bone = ply:LookupBone(\"ValveBiped.Bip01_Head1\")\n\t\n\tif not bone then return end\n\tply:ManipulateBoneScale( bone, Vector(0,0,0) )\nend )\n\n-- Hides the part of the mesh that follows the head bone\nconcommand.Add( \"hide_player_head\", function( ply, cmd, args )\n\tlocal ply = Entity(1)\n\tlocal bone = ply:LookupBone(\"ValveBiped.Bip01_Head1\")\n\tlocal nan = 0/0\n\t\n\tif not bone then return end\n\tply:ManipulateBoneScale( bone, Vector(nan,nan,nan) )\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"MapCreationID","parent":"Entity","type":"classfunc","description":"Returns entity's map creation ID. Unlike Entity:EntIndex or Entity:GetCreationID, it will always be the same on same map, no matter how much you clean up or restart it.\n\nIt may change if the map is recompiled, even if no edits were made. It will definitely change if entities are added or removed from the map file.\n\nTo be used in conjunction with ents.GetMapCreatedEntity. See also Entity:CreatedByMap.","realm":"Shared","rets":{"ret":{"text":"The map creation ID or -1 if the entity is not compiled into the map.","name":"","type":"number","note":"If the ID exists, it is identical to the entity's order number as it appears in Lump 1 of the BSP file. It is believed to start at 1234 for some reason."}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"MarkShadowAsDirty","parent":"Entity","type":"classfunc","description":"Refreshes the shadow of the entity.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"MuzzleFlash","parent":"Entity","type":"classfunc","description":"Fires the muzzle flash effect of the weapon the entity is carrying. This only creates a light effect and is often called alongside Weapon:SendWeaponAnim","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"NearestPoint","parent":"Entity","type":"classfunc","description":"Performs a Ray-Orientated Bounding Box intersection from the given position to the origin of the OBBox with the entity and returns the hit position on the OBBox.\n\nThis relies on the entity having a collision mesh (not a physics object) and will be affected by `SOLID_NONE`","realm":"Shared","args":{"arg":{"text":"The vector to start the intersection from.","name":"position","type":"Vector"}},"rets":{"ret":{"text":"The nearest hit point of the entity's bounding box in world coordinates.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"NetworkVar","parent":"Entity","type":"classfunc","description":{"text":"Creates a network variable on the entity and adds Set/Get functions for it. This function should only be called in ENTITY:SetupDataTables.\n\nSee Entity:NetworkVarNotify for a function to hook NetworkVar changes.\n\n\n\n\nCombining this function with util.TableToJSON can also provide a way to network tables as serialized strings.","note":"Entity NetworkVars are influenced by the return value of ENTITY:UpdateTransmitState.  \n\tSo if you use the **PVS**(**default**), then the NetworkVars can be different for each client.","warning":"Make sure to not call the SetDT* and your custom set methods on the client realm unless you know exactly what you are doing."},"realm":"Shared","args":[{"arg":[{"text":"Supported choices:\n\n* `String` (up to 511 characters)\n* `Bool`\n* `Float`\n* `Int` (32-bit signed integer)\n* `Vector`\n* `Angle`\n* `Entity`","name":"type","type":"string"},{"text":"Each network variable has to have a unique slot. The slot is per type - so you can have an int in slot `0`, a bool in slot `0` and a float in slot `0` etc. You can't have two ints in slot `0`, instead you would do a int in slot `0` and another int in slot `1`.\n\nThe max slots for strings `4` - so you should pick a number between `0` and `3`.\n\nThe max slots for everything else `32` - so you should pick a number between `0` and `31`.\n\nThis can be omitted entirely (arguments will shift) and it will use the next available slot.","name":"slot","type":"number"},{"text":"The name will affect how you access it. If you call it `Foo` you would add two new functions on your entity - `SetFoo()` and `GetFoo()`. So be careful that what you call it won't collide with any existing functions (don't call it `Pos` for example).","name":"name","type":"string"},{"text":"A table of extended information.\n\n`KeyName`\n* Allows the NetworkVar to be set using Entity:SetKeyValue.\n* This is **required** for the entity editing to work.\n\nThis is useful if you're making an entity that you want to be loaded in a map. The sky entity uses this.\n\n`Edit`\n* The edit key lets you mark this variable as editable. See Editable Entities for more information.","name":"extended","type":"table","default":"nil"}]},{"name":"Slot argument is omitted","arg":[{"text":"Supported choices:\n\n* `String` (up to 511 characters)\n* `Bool`\n* `Float`\n* `Int` (32-bit signed integer)\n* `Vector`\n* `Angle`\n* `Entity`","name":"type","type":"string"},{"text":"The name will affect how you access it. If you call it `Foo` you would add two new functions on your entity - `SetFoo()` and `GetFoo()`. So be careful that what you call it won't collide with any existing functions (don't call it `Pos` for example).","name":"name","type":"string"},{"text":"A table of extended information.\n\n`KeyName`\n* Allows the NetworkVar to be set using Entity:SetKeyValue.\n* This is **required** for the entity editing to work.\n\nThis is useful if you're making an entity that you want to be loaded in a map. The sky entity uses this.\n\n`Edit`\n* The edit key lets you mark this variable as editable. See Editable Entities for more information.","name":"extended","type":"table","default":"nil"}]}]},"example":{"description":"Setting up data tables","code":"function ENT:SetupDataTables()\n\n\tself:NetworkVar( \"Float\", 0, \"Amount\" )\n\tself:NetworkVar( \"Vector\", \"StartPos\" ) -- note arguments shift if slot is omitted\n\tself:NetworkVar( \"Vector\", \"EndPos\" )\n\nend\n\n-- Code...\n\n-- Setting values on the entity\nself:SetStartPos( Vector( 1, 0, 0 ) )\nself:SetAmount( 100 )\n\n-- Code...\n\n-- Getting values\nlocal startpos = self:GetStartPos()"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"NetworkVarElement","parent":"Entity","type":"classfunc","description":{"text":"Similarly to Entity:NetworkVar, creates a network variable on the entity and adds Set/Get functions for it. This method stores it's value as a member value of a vector or an angle. This allows to go beyond the normal variable limit of Entity:NetworkVar for `Int` and `Float` types, at the expense of `Vector` and `Angle` limit.\n\nThis function should only be called in ENTITY:SetupDataTables.","warning":"Make sure to not call the SetDT* and your custom set methods on the client realm unless you know exactly what you are doing."},"realm":"Shared","args":[{"arg":[{"text":"Supported choices:\n* `Vector`\n* `Angle`","name":"type","type":"string"},{"text":"The slot for this `Vector` or `Angle`, from `0` to `31`. See Entity:NetworkVar for more detailed explanation.\n\nThis can be omitted entirely (arguments will shift) and it will use the next available slot.","name":"slot","type":"number"},{"text":"Which element of a `Vector` or an `Angle` to store the value on. This can be `p`, `y`, `r` for Angles, and `x`, `y`, `z` for Vectors","name":"element","type":"string"},{"text":"The name will affect how you access it. If you call it `Foo` you would add two new functions on your entity - `SetFoo()` and `GetFoo()`. So be careful that what you call it won't collide with any existing functions (don't call it \"Pos\" for example).","name":"name","type":"string"},{"text":"A table of extra information. See Entity:NetworkVar for details.","name":"extended","type":"table","default":"nil"}]},{"name":"Slot argument is omitted","arg":[{"text":"Supported choices:\n* `Vector`\n* `Angle`","name":"type","type":"string"},{"text":"Which element of a `Vector` or an `Angle` to store the value on. This can be `p`, `y`, `r` for Angles, and `x`, `y`, `z` for Vectors","name":"element","type":"string"},{"text":"The name will affect how you access it. If you call it `Foo` you would add two new functions on your entity - `SetFoo()` and `GetFoo()`. So be careful that what you call it won't collide with any existing functions (don't call it \"Pos\" for example).","name":"name","type":"string"},{"text":"A table of extra information. See Entity:NetworkVar for details.","name":"extended","type":"table","default":"nil"}]}]},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"NetworkVarNotify","parent":"Entity","type":"classfunc","description":{"text":"Creates a callback that will execute when the given network variable changes - that is, when the `Set","name":{"text":"()` function is run.\n\nThe callback is executed **before** the value is changed, and is called even if the new and old values are the same.\n\nThis function does not exist on entities in which Entity:InstallDataTable has not been called. \n\nBy default, this means this function only exists on SENTs (both serverside and clientside) and on players with a Player Class (serverside and clientside Global.LocalPlayer only).\n\nIt's therefore safest to only use this in ENTITY:SetupDataTables.","bug":{"text":"The callback will not be called clientside if the var is changed right after entity spawn.","request":"324"}}},"realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"315-L325"},"args":{"arg":[{"text":"Name of variable to track changes of.","name":"name","type":"string"},{"text":"The function to call when the variable changes.","name":"callback","type":"function","callback":{"arg":[{"text":"Entity whos variable changed.","type":"Entity","name":"entity"},{"text":"Name of changed variable.","type":"string","name":"name"},{"text":"Old/current variable value.","type":"any","name":"old"},{"text":"New variable value that it was set to.","type":"any","name":"new"}]}}]}},"example":{"description":"Example usage.","code":"function ENT:SetupDataTables()\n\tself:NetworkVar( \"Float\", 0, \"Amount\" )\n\tself:NetworkVar( \"Vector\", 1, \"StartPos\" )\n\tself:NetworkVar( \"Vector\", 2, \"EndPos\" )\n\n\tif ( SERVER ) then\n\t\tself:NetworkVarNotify( \"EndPos\", self.OnVarChanged )\n\tend\nend\n\nfunction ENT:OnVarChanged( name, old, new )\n\tprint( name, old, new )\nend","output":"Prints variable name, old value and new value whenever SetEndPos function is called."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"NextThink","parent":"Entity","type":"classfunc","description":{"text":"Controls when, relative to Global.CurTime, the Entity will next run its Think function.\n\nFor Scripted Entities, this is the ENTITY:Think function.  \nFor engine Entities, this is an internal function whose behavior will depend on the specific Entity type.\n\n\nFor a Client-side equivalent, see Entity:SetNextClientThink.","bug":{"text":"This does not work with SWEPs or Nextbots.","issue":"3269"}},"realm":"Shared","args":{"arg":{"text":"The timestamp, relative to Global.CurTime, when the next think should occur.","name":"timestamp","type":"number"}}},"example":{"description":"Repeatedly prints \"Hello, World!\" in console with a 1 second delay between each repetition.","code":"function ENT:Think()\n    print(\"Hello, World!\")\n\n    self:NextThink( CurTime() + 1 )\n    return true -- Note: You need to return true to override the default next think time\nend","output":"```\nHello, World!\nHello, World!\nHello, World!\nHello, World!\n...\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OBBCenter","parent":"Entity","type":"classfunc","description":"Returns the center of an entity's collision bounding box as a local vector.\n\nSee also Entity:GetCollisionBounds, Entity:OBBMins and Entity:OBBMaxs.","realm":"Shared","rets":{"ret":{"text":"The center of an entity's bounding box relative to its Entity:GetPos.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OBBMaxs","parent":"Entity","type":"classfunc","description":"Returns the highest corner of an entity's collision bounding box as a local vector.\n\nSee also Entity:GetCollisionBounds, Entity:OBBMins and Entity:OBBCenter.","realm":"Shared","rets":{"ret":{"text":"The local position of the highest corner of the entity's oriented bounding box.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OBBMins","parent":"Entity","type":"classfunc","description":"Returns the lowest corner of an entity's collision bounding box as a local vector.\n\nSee also Entity:GetCollisionBounds, Entity:OBBMaxs and Entity:OBBCenter.","realm":"Shared","rets":{"ret":{"text":"The local position of the lowest corner of the entity's oriented bounding box.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ObjectCaps","parent":"Entity","type":"classfunc","description":{"text":"Returns the entity's capabilities as a bitfield.\n\nIn the engine this function is mostly used to check the use type, the save/restore system and level transitions flags.\n\nEven though the function is defined shared, it is not guaranteed to return the same value across states.","note":"The enums for this are not currently implemented in Lua, however you can access the defines [here](https://github.com/ValveSoftware/source-sdk-2013/blob/55ed12f8d1eb6887d348be03aee5573d44177ffb/mp/src/game/shared/baseentity_shared.h#L21-L38)."},"realm":"Shared","rets":{"ret":{"text":"The bitfield, a combination of the [FCAP_](https://github.com/ValveSoftware/source-sdk-2013/blob/55ed12f8d1eb6887d348be03aee5573d44177ffb/mp/src/game/shared/baseentity_shared.h#L21-L38) flags.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OnGround","parent":"Entity","type":"classfunc","description":"Returns true if the entity is on the ground, and false if it isn't.\n\nInternally, this checks if FL_ONGROUND is set on the entity. This is only updated for players and NPCs, and thus won't inherently work for other entities.","realm":"Shared","rets":{"ret":{"text":"Whether the entity is on the ground or not.","name":"","type":"boolean"}}},"example":{"description":"Prints if Entity(1) is on the ground or not.","code":"print( Entity( 1 ):OnGround() )\nprint( Entity( 1 ):IsFlagSet( FL_ONGROUND ) ) -- This should give exact same output as the first line","output":"In most cases, true."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PassesDamageFilter","parent":"Entity","type":"classfunc","description":{"text":"Tests whether the damage passes the entity filter.\n\nThis will call ENTITY:PassesDamageFilter on scripted entities of the type \"filter\".","note":"This function only works on entities of the type \"filter\". ( filter_* entities, including base game filter entites )"},"realm":"Server","args":{"arg":{"text":"The damage info to test","name":"dmg","type":"CTakeDamageInfo"}},"rets":{"ret":{"text":"Whether the damage info passes the entity filter.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PassesFilter","parent":"Entity","type":"classfunc","description":{"text":"Tests whether the entity passes the entity filter.\n\nThis will call ENTITY:PassesFilter on scripted entities of the type \"filter\".","note":"This function only works on entities of the type \"filter\". ( filter_* entities, including base game filter entites )"},"realm":"Server","args":{"arg":[{"text":"The initiator of the test.\n\nFor example the trigger this filter entity is used in.","name":"caller","type":"Entity"},{"text":"The entity to test against the entity filter.","name":"ent","type":"Entity"}]},"rets":{"ret":{"text":"Whether the entity info passes the entity filter.","name":"","type":"boolean"}}},"example":{"description":"Ready-to-use entity for controlling Hammer entities through Lua (for example for `trigger_teleport`). This entity works like a CRecipientFilter: filter has a list of allowed and not allowed entities for each trigger. Note, you can add not only players.","code":"-- entities/filter_lua.lua\nENT.Type = \"filter\" -- This should be set or the entity won't work\nENT.Base = \"base_filter\" -- Base\n\nfunction ENT:Initialize()\n\tself.Lists = {} -- Creating lists\nend\n\nfunction ENT:AttachToEntity(ent) -- Attaches filter to the entity\n\tent:SetSaveValue(\"m_hFilter\", self)\n\tself.Lists[ent] = {}\nend\n\nfunction ENT:AddPlayer(ent, ply, shouldTrigger) -- Adds player to the list. `shouldTrigger` decides if the player can use this entity\n\tif not self.Lists[ent] then\n\t\terror(\"Attach filter to the entity first\")\n\tend\n\n\tself.Lists[ent][ply] = not shouldTrigger\nend\n\nfunction ENT:AddAllPlayers(ent, shouldTrigger) -- Adds all players. Same as ENT:AddPlayer\n\tif not self.Lists[ent] then\n\t\terror(\"Attach filter to the entity first\")\n\tend\n\n\tfor k, v in ipairs(player.GetAll()) do\n\t\tself.Lists[ent][v] = not shouldTrigger\n\tend\nend\n\nfunction ENT:PassesFilter(trigger, ent) -- The core of the entity. This decides if the entity is able to use the trigger.\n\treturn not self.Lists[trigger][ent]\nend\n\n-- autorun/server/filter.lua (this is just an example of usage)\nlocal function CreateLuaFilter()\n\tif LuaFilter then\n\t\tLuaFilter:Remove() -- If we have our entity, remove it\n\tend\n\n\tLuaFilter = ents.Create(\"filter_lua\") -- Creates the entity\n\tLuaFilter:Spawn()\n\n\tfor k, v in ipairs(ents.FindByClass(\"trigger_teleport\")) do -- Attaching all trigger_teleport's on the map to our entity\n\t\tLuaFilter:AttachToEntity(v) -- Attach\n\t\tLuaFilter:AddAllPlayers(v, false) -- Add all players and set the filter to `false` for them. So all players won't trigger the teleport\n\t\tLuaFilter:AddPlayer(v, Entity(1), true) -- Exclude first player. This makes the first player to be able to use teleport.\n\tend\nend\n\nhook.Add(\"InitPostEntity\", \"CreateLuaFilter\", CreateLuaFilter) -- This automatically creates the entity when map is loaded\nhook.Add(\"PostCleanupMap\", \"CreateLuaFilter\", CreateLuaFilter) -- This automatically creates the entity after map cleanup"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PhysicsDestroy","parent":"Entity","type":"classfunc","description":{"text":"Destroys the current physics object of an entity.","note":"Cannot be used on a ragdoll or the world entity.","warning":"This function cannot be used when called from a physics callback."},"realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PhysicsFromMesh","parent":"Entity","type":"classfunc","description":"Initializes the physics mesh of the entity from a triangle soup defined by a table of vertices. The resulting mesh is hollow, may contain holes, and always has a volume of 0.\n\nWhile this is very useful for static geometry such as terrain displacements, it is advised to use Entity:PhysicsInitConvex or Entity:PhysicsInitMultiConvex for moving solid objects instead.\n\nEntity:EnableCustomCollisions needs to be called if you want players to collide with the entity correctly.","realm":"Shared","args":{"arg":[{"text":"A table of Vectors. Every 3 vertices define a triangle in the physics mesh\n\nAlternatively, you can input a table consisting of Structures/MeshVertex (only the `pos` element is taken into account).","name":"vertices","type":"table"},{"text":"Physical material from [surfaceproperties.txt](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/scripts/surfaceproperties.txt) or added with physenv.AddSurfaceData.","name":"surfaceprop","type":"string","added":"2023.01.25","default":"default"},{"text":"If set, overwrites the center of mass for the created physics object.","name":"massCenterOveride","type":"Vector","default":"nil","added":"2024.10.29"}]},"rets":{"ret":{"text":"Returns `true` on success, `nil` otherwise.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PhysicsInit","parent":"Entity","type":"classfunc","description":{"text":"Initializes the physics object of the entity using its current model. Deletes the previous physics object if it existed and the new object creation was successful.\n\nIf the entity's current model has no physics mesh associated to it, no physics object will be created and the previous object will still exist, if applicable.","note":"When called clientside, this will not create a valid PhysObj if the model hasn't been precached serverside.\n\nIf successful, this function will automatically call Entity:SetSolid( solidType ) and Entity:SetSolidFlags( 0 ).","bug":{"text":"Clientside physics objects on serverside entities do not move properly in some cases. Physics objects should only created on the server or you will experience incorrect physgun beam position, prediction issues, and other unexpected behavior.\n\nA workaround is available on the Entity:PhysicsInitConvex page.","issue":"5060"}},"realm":"Shared","args":{"arg":[{"text":"The solid type of the physics object to create, see Enums/SOLID. Should be `SOLID_VPHYSICS` in most cases.","name":"solidType","type":"number","note":"Using `SOLID_NONE` will only delete the current physics object - it does not create a new one."},{"text":"If set, overwrites the center of mass for the created physics object.","name":"massCenterOverride","type":"Vector","default":"nil","added":"2024.10.29"}]},"rets":{"ret":{"text":"Returns `true` on success, `false` otherwise.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PhysicsInitBox","parent":"Entity","type":"classfunc","description":{"text":"Makes the physics object of the entity a AABB.\n\nThis function will automatically destroy any previous physics objects and do the following:\n* Entity:SetSolid( `SOLID_BBOX` )\n* Entity:SetMoveType( `MOVETYPE_VPHYSICS` )\n* Entity:SetCollisionBounds( `mins`, `maxs` )","note":"If the volume of the resulting box is 0 (the mins and maxs are the same), the mins and maxs will be changed to Global.Vector( -1, -1, -1 ) and Global.Vector( 1, 1, 1 ), respectively.","bug":{"text":"Clientside physics objects on serverside entities do not move properly in some cases. Physics objects should only created on the server or you will experience incorrect physgun beam position, prediction issues, and other unexpected behavior.\n\nA workaround is available on the Entity:PhysicsInitConvex page.","issue":"5060"}},"realm":"Shared","args":{"arg":[{"text":"The minimum position of the box. This is automatically ordered with the maxs.","name":"mins","type":"Vector"},{"text":"The maximum position of the box. This is automatically ordered with the mins.","name":"maxs","type":"Vector"},{"text":"Physical material from [surfaceproperties.txt](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/scripts/surfaceproperties.txt) or added with physenv.AddSurfaceData.","name":"surfaceprop","type":"string","added":"2023.01.25","default":"default"},{"text":"If set, overwrites the center of mass for the created physics object.","name":"massCenterOverride","type":"Vector","default":"nil","added":"2024.10.29"}]},"rets":{"ret":{"text":"Returns `true` on success, `nil` otherwise. This fails when the game cannot create any more PhysCollides.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PhysicsInitConvex","parent":"Entity","type":"classfunc","description":{"text":"Initializes the physics mesh of the entity with a convex mesh defined by a table of points. The resulting mesh is the  of all the input points. If successful, the previous physics object will be removed.\n\nThis is the standard way of creating moving physics objects with a custom convex shape. For more complex, concave shapes, see Entity:PhysicsInitMultiConvex.\n\nYou may be expected to call Entity:SetSolid with desired solid type **before** calling this function.","bug":{"text":"Clientside physics objects on serverside entities do not move properly in some cases. Physics objects should only created on the server or you will experience incorrect physgun beam position, prediction issues, and other unexpected behavior.\n\nYou can use the following workaround for movement, though clientside collisions will still be broken.\n```\nfunction ENT:Think()\n\tif ( CLIENT ) then\n\t\tlocal physobj = self:GetPhysicsObject()\n\n\t\tif ( IsValid( physobj ) ) then\n\t\t\tphysobj:SetPos( self:GetPos() )\n\t\t\tphysobj:SetAngles( self:GetAngles() )\n\t\tend\n\tend\nend\n```","issue":"5060"}},"realm":"Shared","args":{"arg":[{"text":"A table of eight Vectors, in local coordinates, to be used in the computation of the convex mesh. Order does not matter.","name":"points","type":"table"},{"text":"Physical material from [surfaceproperties.txt](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/scripts/surfaceproperties.txt) or added with physenv.AddSurfaceData.","name":"surfaceprop","type":"string","added":"2023.01.25","default":"default"},{"text":"If set, overwrites the center of mass for the created physics object.","name":"massCenterOverride","type":"Vector","default":"nil","added":"2024.10.29"}]},"rets":{"ret":{"text":"Returns `true` on success, `false` otherwise.","name":"","type":"boolean"}}},"example":{"description":"Creates a \"box\" physics mesh for the entity.","code":"function ENT:Initialize()\n\tif ( CLIENT ) then return end -- We only want to run this code serverside\n\n\tlocal x0 = -20 -- Define the min corner of the box\n\tlocal y0 = -10\n\tlocal z0 = -5\n\n\tlocal x1 = 20 -- Define the max corner of the box\n\tlocal y1 = 10\n\tlocal z1 = 5\n\n\tself:PhysicsInitConvex( {\n\t\tVector( x0, y0, z0 ),\n\t\tVector( x0, y0, z1 ),\n\t\tVector( x0, y1, z0 ),\n\t\tVector( x0, y1, z1 ),\n\t\tVector( x1, y0, z0 ),\n\t\tVector( x1, y0, z1 ),\n\t\tVector( x1, y1, z0 ),\n\t\tVector( x1, y1, z1 )\n\t} )\n\n\t-- Set up solidity and movetype\n\tself:SetMoveType( MOVETYPE_VPHYSICS )\n\tself:SetSolid( SOLID_VPHYSICS )\n\n\t-- Enable custom collisions on the entity\n\tself:EnableCustomCollisions( true )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PhysicsInitMultiConvex","parent":"Entity","type":"classfunc","description":{"text":"An advanced version of Entity:PhysicsInitConvex which initializes a physics object from multiple convex meshes. This should be used for physics objects with a custom shape which cannot be represented by a single convex mesh.\n\nIf successful, the previous physics object will be removed.\n\nYou may be expected to call Entity:SetSolid with desired solid type **before** calling this function.","bug":{"text":"Clientside physics objects on serverside entities do not move properly in some cases. Physics objects should only created on the server or you will experience incorrect physgun beam position, prediction issues, and other unexpected behavior.\n\nA workaround is available on the Entity:PhysicsInitConvex page.","issue":"5060"}},"realm":"Shared","args":{"arg":[{"text":"A table consisting of tables of Vectors. Each sub-table defines a set of points to be used in the computation of one convex mesh.","name":"vertices","type":"table"},{"text":"Physical material from [surfaceproperties.txt](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/scripts/surfaceproperties.txt) or added with physenv.AddSurfaceData.","name":"surfaceprop","type":"string","added":"2023.01.25","default":"default"},{"text":"If set, overwrites the center of mass for the created physics object.","name":"massCenterOverride","type":"Vector","default":"nil","added":"2024.10.29"}]},"rets":{"ret":{"text":"Returns `true` on success, `nil` otherwise.","name":"","type":"boolean"}}},"example":{"description":"Creates a physics mesh for the entity which consists of two boxes.","code":"local min1 = Vector( -30, -10, 0 ) -- Box1 minimum corner\nlocal max1 = Vector( -10, 10, 20 ) -- Box1 maximum corner\n\nlocal min2 = Vector( 10, -5, 10 ) -- Box2 minimum corner\nlocal max2 = Vector( 30, 5, 40 ) -- Box2 maximum corner\n\nif SERVER then\n    local convex = {\n        { -- Each sub-table is a set of vertices of a convex piece, order doesn't matter\n            Vector( min1.x, min1.y, min1.z ), -- The first box vertices\n            Vector( min1.x, min1.y, max1.z ),\n            Vector( min1.x, max1.y, min1.z ),\n            Vector( min1.x, max1.y, max1.z ),\n            Vector( max1.x, min1.y, min1.z ),\n            Vector( max1.x, min1.y, max1.z ),\n            Vector( max1.x, max1.y, min1.z ),\n            Vector( max1.x, max1.y, max1.z ),\n        },\n        { -- All these tables together form a concave collision mesh\n            Vector( min2.x, min2.y, min2.z ), -- The second box vertices\n            Vector( min2.x, min2.y, max2.z ),\n            Vector( min2.x, max2.y, min2.z ),\n            Vector( min2.x, max2.y, max2.z ),\n            Vector( max2.x, min2.y, min2.z ),\n            Vector( max2.x, min2.y, max2.z ),\n            Vector( max2.x, max2.y, min2.z ),\n            Vector( max2.x, max2.y, max2.z ),\n        },\n    }\n    \n\tfunction ENT:Initialize()\n\t\tself:SetModel( \"models/props_c17/oildrum001.mdl\" )\n\n\t\t-- Initializing the multi-convex physics mesh\n\t\tself:PhysicsInitMultiConvex( convex )\n\n\t\tself:SetSolid( SOLID_VPHYSICS ) -- Setting the solidity\n\t\tself:SetMoveType( MOVETYPE_VPHYSICS ) -- Setting the movement type\n\n\t\tself:EnableCustomCollisions( true ) -- Enabling the custom collision mesh\n\n\t\tself:PhysWake() -- Enabling the physics motion\n\tend\nelse\n\tlocal col = Color( 0, 0, 255, 255 )\n\n\t-- Drawing collision boxes on the client\n\tfunction ENT:Draw()\n\t\tself:DrawModel()\n\n\t\tlocal pos, ang = self:GetPos(), self:GetAngles()\n\n\t\trender.DrawWireframeBox( pos, ang, min1, max1, col ) -- Drawing the first collision box\n\t\trender.DrawWireframeBox( pos, ang, min2, max2, col ) -- Drawing the second collision box\n\tend\nend","output":{"image":{"src":"PhysicsInitMultiConvexExample.gif"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PhysicsInitShadow","parent":"Entity","type":"classfunc","description":{"text":"Initializes the entity's physics object as a *physics shadow*. Physics shadows can react to the environment physically (see the arguments to the function), and can push other physics objects around, but are ultimately constrained to the entity's position and angles: the physics object will attempt to return to the entity's coordinates every simulation tick.\n\nInternally, this creates a new physics object, copies the properties of the current physics object to it if one exists, and replaces the entity's physics object with the shadow. This is used internally for Player and NPC physics objects, certain HL2 entities such as the crane and barnacle tongue, parented physics entities, etc.\n\nA physics shadow can be used to have static physics entities that never move by setting both arguments to false.\n\nThe created physics object will depend on the entity's solidity `SOLID_NONE` will not create a physics object, `SOLID_BBOX` will create a Axis-Aligned BBox one, `SOLID_OBB` will create Orientated Bounding Box one, and anything else will use the models' physics mesh.\n\nSee also Structures/ShadowControlParams.","bug":{"text":"Clientside physics objects on serverside entities do not move properly in some cases. Physics objects should only created on the server or you will experience incorrect physgun beam position, prediction issues, and other unexpected behavior.\n\nA workaround is available on the Entity:PhysicsInitConvex page.","issue":"5060"}},"realm":"Shared","args":{"arg":[{"text":"Whether to allow the physics shadow to move under stress.","name":"allowPhysicsMovement","type":"boolean","default":"true"},{"text":"Whether to allow the physics shadow to rotate under stress.","name":"allowPhysicsRotation","type":"boolean","default":"true"}]},"rets":{"ret":{"text":"Return `true` on success, `false` otherwise.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PhysicsInitSphere","parent":"Entity","type":"classfunc","description":{"text":"Makes the physics object of the entity a sphere.\n\nThis function will automatically destroy any previous physics objects and do the following:\n* Entity:SetSolid( `SOLID_BBOX` )\n* Entity:SetMoveType( `MOVETYPE_VPHYSICS` )","bug":{"text":"Clientside physics objects on serverside entities do not move properly in some cases. Physics objects should only created on the server or you will experience incorrect physgun beam position, prediction issues, and other unexpected behavior.\n\nA workaround is available on the Entity:PhysicsInitConvex page.","issue":"5060"}},"realm":"Shared","args":{"arg":[{"text":"The radius of the sphere.","name":"radius","type":"number"},{"text":"Physical material from [surfaceproperties.txt](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/scripts/surfaceproperties.txt) or added with physenv.AddSurfaceData.","name":"physmat","type":"string","default":"default"}]},"rets":{"ret":{"text":"Returns `true` on success, `false` otherwise","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PhysicsInitStatic","parent":"Entity","type":"classfunc","description":{"text":"Initializes a static physics object of the entity using its current model. If successful, the previous physics object is removed.\n\nThis is what used by entities such as `func_breakable`, `prop_dynamic`, `item_suitcharger`, `prop_thumper` and `npc_rollermine` while it is in its \"buried\" state in the Half-Life 2 Campaign.\n\nIf the entity's current model has no physics mesh associated to it, no physics object will be created.","note":"This function will automatically call Entity:SetSolid( `solidType` ).","bug":{"text":"Clientside physics objects on serverside entities do not move properly in some cases. Physics objects should only created on the server or you will experience incorrect physgun beam position, prediction issues, and other unexpected behavior.\n\nA workaround is available on the Entity:PhysicsInitConvex page.","issue":"5060"}},"realm":"Shared","args":{"arg":{"text":"The solid type of the physics object to create, see Enums/SOLID. Should be `SOLID_VPHYSICS` in most cases.","name":"solidType","type":"number"}},"rets":{"ret":{"text":"Returns `true` on success, `false` otherwise. This will fail if the entity's current model has no associated physics mesh.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PhysWake","parent":"Entity","type":"classfunc","description":"Wakes up the entity's physics object","realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"168-L175"}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayScene","parent":"Entity","type":"classfunc","description":"Makes the entity play a .vcd scene. [All scenes from Half-Life 2](https://developer.valvesoftware.com/wiki/Half-Life_2_Scenes_List).","realm":"Server","args":{"arg":[{"text":"Filepath to scene.","name":"scene","type":"string"},{"text":"Delay in seconds until the scene starts playing.","name":"delay","type":"number","default":"0"}]},"rets":{"ret":[{"text":"Estimated length of the scene.","name":"","type":"number"},{"text":"The scene entity, removing which will stop the scene from continuing to play.","name":"","type":"Entity"}]}},"example":{"description":"Makes the NPC that the player 1 is looking at play the `Welcome to City 17` speech.","code":"local entity = Entity( 1 ):GetEyeTrace().Entity\n\nif ( entity:IsValid() and entity:IsNPC() ) then\n\tentity:PlayScene( \"scenes/breencast/welcome.vcd\" )\nend","output":"The entity plays the scene."},"realms":["Server"],"type":"Function"},
{"function":{"name":"PointAtEntity","parent":"Entity","type":"classfunc","description":"Changes an entities angles so that it faces the target entity.","realm":"Server","args":{"arg":{"text":"The entity to face.","name":"target","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PrecacheGibs","parent":"Entity","type":"classfunc","description":"Precaches gibs for the entity's model.\n\nNormally this function should be ran when the entity is spawned, for example the ENTITY:Initialize, after Entity:SetModel is called.\n\nThis is required for Entity:GibBreakServer and Entity:GibBreakClient to work.","realm":"Server","rets":{"ret":{"text":"The amount of gibs the prop has","name":"gibCount","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"RagdollSolve","parent":"Entity","type":"classfunc","description":"Normalizes the ragdoll. This is used alongside Kinect in Entity:SetRagdollBuildFunction, for more info see ragdoll_motion entity.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"RagdollStopControlling","parent":"Entity","type":"classfunc","description":"Sets the function to build the ragdoll. This is used alongside Kinect in Entity:SetRagdollBuildFunction, for more info see ragdoll_motion entity.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"RagdollUpdatePhysics","parent":"Entity","type":"classfunc","description":"Makes the physics objects follow the set bone positions. This is used alongside Kinect in Entity:SetRagdollBuildFunction, for more info see ragdoll_motion entity.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"Remove","parent":"Entity","type":"classfunc","realm":"Shared","description":"Removes (or deletes) a given Entity. \n\n\t\tThe Entity will continue to exist until the start of the next tick.  \n\n\t\tTo check if an Entity will be removed in the next tick, see Entity:IsMarkedForDeletion"},"example":{"description":"Removes the Entity being looked at by the first Player to join the server.","code":"local firstPlayer = player.GetAll()[1]\nlocal targetEntity = firstPlayer:GetEyeTrace().Entity\n\nif IsValid( targetEntity ) then\n    targetEntity:Remove()\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RemoveAllDecals","parent":"Entity","type":"classfunc","description":"Removes all decals from the entities surface.","realm":"Shared"},"example":{"description":"Removes all decals from all props in world.","code":"for i, ent in ipairs( ents.FindByClass( \"prop_physics\" ) ) do\n\tent:RemoveAllDecals()\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RemoveAllGestures","parent":"Entity","type":"classfunc","description":{"text":"Removes and stops all gestures.","note":["This function only works on BaseAnimatingOverlay entites!","Layer removal procedures aren't immediate. Layer removal functions actually manipulate Entity:GetLayerWeight down to 0, then remove the layer in next intervals. If the targeted layer's weight keeps changing, your layer will not be removed."]},"realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"RemoveCallback","parent":"Entity","type":"classfunc","description":"Removes a callback previously added with Entity:AddCallback","realm":"Shared","args":{"arg":[{"text":"The hook name to remove. See Entity Callbacks","name":"hook","type":"string"},{"text":"The callback id previously retrieved with the return of Entity:AddCallback or Entity:GetCallbacks","name":"callbackid","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RemoveCallOnRemove","parent":"Entity","type":"classfunc","description":"Removes a function previously added via Entity:CallOnRemove.","realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"122-L132"},"args":{"arg":{"text":"Identifier of the function given to Entity:CallOnRemove.","name":"identifier","type":"any"}}},"example":{"description":"Removes the call to stop an engine's sounds when the entity is removed","code":"Entity:RemoveCallOnRemove(\"StopEngineSound\")"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RemoveEffects","parent":"Entity","type":"classfunc","description":"Removes an engine effect applied to an entity.","realm":"Shared","args":{"arg":{"text":"The effect to remove, see Enums/EF.","name":"effect","type":"number{EF}"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RemoveEFlags","parent":"Entity","type":"classfunc","description":"Removes specified engine flag","realm":"Shared","args":{"arg":{"text":"The flag to remove, see Enums/EFL","name":"flag","type":"number{EFL}"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RemoveFlags","parent":"Entity","type":"classfunc","description":"Removes specified flag(s) from the entity","realm":"Shared","args":{"arg":{"text":"The flag(s) to remove, see Enums/FL","name":"flag","type":"number{FL}"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RemoveFromMotionController","parent":"Entity","type":"classfunc","description":{"text":"Removes a PhysObject from the entity's motion controller so that ENTITY:PhysicsSimulate will no longer be called for given PhysObject.\n\nYou must first create a motion controller with Entity:StartMotionController.","note":"Only works on a scripted Entity of anim type"},"realm":"Shared","args":{"arg":{"text":"The PhysObj to remove from the motion controller.","name":"physObj","type":"PhysObj"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RemoveGesture","parent":"Entity","type":"classfunc","description":{"text":"Removes and stops the gesture with given activity. Same as Entity:RemoveLayer with Entity:FindGestureLayer.","note":["This function only works on BaseAnimatingOverlay entites!","Layer removal procedures aren't immediate. Layer removal functions actually manipulate Entity:GetLayerWeight down to 0, then remove the layer in next intervals. If the targeted layer's weight keeps changing, your layer will not be removed."]},"realm":"Server","args":{"arg":{"text":"The activity remove. See Enums/ACT.","name":"activity","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"RemoveInternalConstraint","parent":"Entity","type":"classfunc","description":"Breaks internal Ragdoll constrains, so you can for example separate an arm from the body of a ragdoll and preserve all physics.\n\nThe visual mesh will still stretch as if it was properly connected unless the ragdoll model is specifically designed to avoid that.","realm":"Server","added":"2020.03.17","args":{"arg":{"text":"Which constraint to break, values below 0 mean break them all","name":"num","type":"number","default":"-1"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"RemoveLayer","parent":"Entity","type":"classfunc","description":{"text":"Removes the given layer by ID. See also Entity:RemoveGesture.","note":["This function only works on BaseAnimatingOverlay entites!","Layer removal procedures aren't immediate. Layer removal functions actually manipulate Entity:GetLayerWeight down to 0, then remove the layer in next intervals. If the targeted layer's weight keeps changing, your layer will not be removed."]},"added":"2025.07.31","realm":"Server","args":{"arg":{"text":"The layer ID to remove.","name":"layerID","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"RemoveSolidFlags","parent":"Entity","type":"classfunc","description":"Removes solid flag(s) from the entity.","realm":"Shared","args":{"arg":{"text":"The flag(s) to remove, see Enums/FSOLID.","name":"flags","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RemoveSpawnFlags","parent":"Entity","type":"classfunc","description":{"text":"Removes a SpawnFlag from the current SpawnFlags of an Entity.\n\nSpawnFlags can easily be found on https://developer.valvesoftware.com/wiki/.","note":"See also Entity:AddSpawnFlags, Entity:SetSpawnFlags\n\n\tUsing SF Enumerations won't work, if this function is ran clientside due to the enumerations being defined only Serverside. Use the actual SpawnFlag number."},"added":"2024.12.04","realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"15-L17"},"args":{"arg":{"text":"The SpawnFlag to remove from the Entity","name":"flag","type":"number"}}},"example":{"description":"When a turret Entity is created, it removes the `Out of Ammo` SpawnFlag, if it has it. Therefore it now has ammo.","code":"hook.Add( \"OnEntityCreated\", \"RemoveSpawnFlagsExample\", function( ent )\n\ttimer.Simple( 0.1, function()\n\t\tif ( !IsValid(ent) or ent:GetClass() != \"npc_turret_floor\" ) then return end\n\t\tif ( !ent:HasSpawnFlags(256) ) then return end\n\n\t\tent:RemoveSpawnFlags(256) -- https://developer.valvesoftware.com/wiki/Npc_turret_floor#Flags\n\tend )\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ResetSequence","parent":"Entity","type":"classfunc","description":{"text":"Plays an animation on the entity. This may not always work on engine entities.","warning":"This will not reset the animation on viewmodels, use Entity:SendViewModelMatchingSequence instead.","note":"This will not work properly if called directly after calling Entity:SetModel. Consider waiting until the next Tick.\n\nWill not work on players due to the animations being reset every frame by the base gamemode animation system. See GM:CalcMainActivity.\n\nFor custom scripted entities you will want to apply example from ENTITY:Think to make animations work."},"realm":"Shared","args":{"arg":{"text":"The sequence to play. Also accepts strings.","name":"sequence","type":"number","alttype":"string","note":"If set to a string, the function will automatically call Entity:LookupSequence to retrieve the sequence ID as a number."}}},"example":{"description":"Minimal code needed to make sequences work as expected on custom \"anim\" type entities.\n\nIn this example, when the player uses the crate, it will open, and when they use it again, it will close.","code":"ENT.Base = \"base_anim\"\nENT.Spawnable = true\nENT.AutomaticFrameAdvance = true\n\nENT.PrintName = \"Animation Test\"\nENT.Category = \"My Entity Category\"\n\nfunction ENT:Initialize()\n\tif ( SERVER ) then -- Only set this stuff on the server, it is networked to clients automatically\n\t\tself:SetModel( \"models/items/ammocrate_ar2.mdl\" ) -- Set the model\n\t\tself:PhysicsInit( SOLID_VPHYSICS ) -- Initialize physics\n\t\tself:SetUseType( SIMPLE_USE ) -- Make sure ENT:Use is ran only once per use ( per press of the use button on the entity, by default the E key )\n\tend\nend\n\nfunction ENT:Think()\n\tif ( SERVER ) then -- Only set this stuff on the server\n\t\tself:NextThink( CurTime() ) -- Set the next think for the serverside hook to be the next frame/tick\n\t\treturn true -- Return true to let the game know we want to apply the self:NextThink() call\n\tend\nend\n\nif ( SERVER ) then -- This hook is only available on the server\n\tfunction ENT:Use( activator, caller ) -- If a player uses this entity, play an animation\n\t\tif ( !self.Opened ) then -- If we are not \"opened\"\n\t\t\tself:ResetSequence( \"open\" ) -- Play the open sequence\n\t\t\tself.Opened = true -- We are now opened\n\t\telse\n\t\t\tself:ResetSequence( \"close\" ) -- Play the close sequence\n\t\t\tself.Opened = false -- We are now closed\n\t\tend\n\tend\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ResetSequenceInfo","parent":"Entity","type":"classfunc","description":"Reset entity sequence info such as playback rate, ground speed, last event check, etc.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Respawn","parent":"Entity","type":"classfunc","description":"Makes the entity/weapon respawn.\n\nOnly usable on HL2/HL:S pickups and any weapons. Seems to be buggy with weapons.\nVery unreliable.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"RestartGesture","parent":"Entity","type":"classfunc","description":{"text":"Restarts the entity's animation gesture. If the given gesture is already playing, it will reset it and play it from the beginning.","note":"This function only works on BaseAnimatingOverlay entites."},"realm":"Server","args":{"arg":[{"text":"The activity number to send to the entity. See Enums/ACT and Entity:GetSequenceActivity","name":"activity","type":"number"},{"text":"Add/start the gesture to if it has not been yet started.","name":"addIfMissing","type":"boolean","default":"true"},{"name":"autokill","type":"boolean","default":"true"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"RestoreNetworkVars","parent":"Entity","type":"classfunc","description":{"text":"Calls the associated `Entity:Set*` function for each network var provided.","internal":"Used for the built-in duplicator, you do not need to call this yourself.","note":"This function will only work on entities which had Entity:InstallDataTable called on them, which is done automatically for players and all Scripted Entities"},"realm":"Shared","args":{"arg":{"text":"The data from Entity:GetNetworkVars.","name":"data","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SelectWeightedSequence","parent":"Entity","type":"classfunc","description":"Returns sequence ID corresponding to given activity ID.\n\nMultiple sequences can be assigned to a single Enums/ACT, in which case a random one will be selected. This can be used for example to randomize idle animations (and is used for that by built-in weapons) without the need to code logic for this.  \nSee also Entity:SelectWeightedSequenceSeeded.\n\nOpposite of Entity:GetSequenceActivity.\n\nSimilar to Entity:LookupSequence.","realm":"Shared","args":{"arg":{"text":"The activity ID, see Enums/ACT.","name":"act","type":"number{ACT}"}},"rets":{"ret":{"text":"The sequence ID, or `-1` if not found.","name":"","type":"number"}}},"example":{"description":"Use this hook to check if the model has a certain ACT_* enumeration, and if it does, play it.","code":"local VModel = self:GetOwner():GetViewModel()\n\nif ( self:Clip1() == 0 and VModel:SelectWeightedSequence( ACT_VM_RELOAD_EMPTY ) ) then\n\n\tlocal SEQ = self:LookupSequence( ACT_VM_RELOAD_EMPTY )\n\n\tif ( SEQ == -1 ) then\n\n\t\tprint( \"reload\" )\n\n\t\tlocal EnumToSeq = VModel:SelectWeightedSequence( ACT_VM_RELOAD )\n\n\t\t--\tPlay the normal reload animation\n\t\tVModel:SendViewModelMatchingSequence( EnumToSeq )\n\n\telse\n\n\t\tprint( \"reload empty\" )\n\n\t\tlocal EnumToSeq = VModel:SelectWeightedSequence( ACT_VM_RELOAD_EMPTY )\n\n\t\t-- Play the empty reload animation\n\t\tVModel:SendViewModelMatchingSequence( EnumToSeq )\n\t\t\n\tend\n\nend","output":"Will play the ACT_VM_RELOAD_EMPTY enumeration if the model has it. If not, it will play the normal reload enum."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SelectWeightedSequenceSeeded","parent":"Entity","type":"classfunc","description":"Returns the sequence ID corresponding to given activity ID, and uses the provided seed for random selection. The seed should be the same server-side and client-side if used in a predicted environment.\n\nSee Entity:SelectWeightedSequence for a provided-seed version of this function.","realm":"Shared","args":{"arg":[{"text":"The activity ID, see Enums/ACT.","name":"act","type":"number"},{"text":"The seed to use for randomly selecting a sequence in the case the activity ID has multiple sequences bound to it. Entity:SelectWeightedSequence uses the same seed as util.SharedRandom internally for this.","name":"seed","type":"number"}]},"rets":{"ret":{"text":"The sequence ID, or `-1` if not found.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SendViewModelMatchingSequence","parent":"Entity","type":"classfunc","description":{"text":"Sends sequence animation to the view model. It is recommended to use this for view model animations, instead of Entity:ResetSequence.\n\nThis function is only usable on view models.","note":"Predicted viewmodels will have their sequence and cycle reset during prediction checks, making this function appear to do nothing unless also called on the server."},"realm":"Shared","args":{"arg":{"text":"The sequence ID returned by Entity:LookupSequence or  Entity:SelectWeightedSequence.","name":"seq","type":"number"}}},"example":{"description":"Converting an `ACT_VM_*` enumeration to a sequence usable by the function.","code":"local VModel = self:GetOwner():GetViewModel()\nlocal EnumToSeq = VModel:SelectWeightedSequence( ACT_VM_PRIMARYATTACK )\n\nVModel:SendViewModelMatchingSequence( EnumToSeq )","output":"Sends the primary attack enumeration sequence to the view model and plays it."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SequenceDuration","parent":"Entity","type":"classfunc","description":{"text":"Returns length of currently played sequence.","bug":{"text":"This will return incorrect results for weapons and viewmodels clientside in thirdperson.","issue":"2783"}},"realm":"Shared","args":{"arg":{"text":"A sequence ID to return the length specific sequence of instead of the entity's main/currently playing sequence.","name":"seqid","type":"number","default":"nil"}},"rets":{"ret":{"text":"The length of the sequence","name":"","type":"number"}}},"example":{"description":"Example usage for the argument. Retrieve length of animation on specific gesture slot.","code":"local ply = Entity( 1 )\nlocal seq = ply:SelectWeightedSequence( ACT_GMOD_TAUNT_CHEER )\nlocal len = ply:SequenceDuration( seq )\nprint( ply, seq, len )","output":"Player [1][Rubat]\t303\t2.7499999180436"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetAbsVelocity","parent":"Entity","type":"classfunc","description":{"text":"Sets the entity's velocity.","note":"Actually binds to CBaseEntity::SetLocalVelocity() which sets the entity's velocity due to movement in the world from forces such as gravity. Does not include velocity from entity-on-entity collision or other world movement."},"realm":"Shared","args":{"arg":{"text":"The new velocity to set.","name":"velocity","type":"Vector"}}},"example":{"description":"Makes Entity(1) fly upwards.","code":"Entity( 1 ):SetAbsVelocity( Vector( 0, 0, 500 ) )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetAngles","parent":"Entity","type":"classfunc","description":{"text":"Sets the angles of the entity.","note":"To set a player's angles, use Player:SetEyeAngles instead."},"realm":"Shared","args":{"arg":{"text":"The new angles.","name":"angles","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetAnimation","parent":"Entity","type":"classfunc","description":"Sets a player's third-person animation. Mainly used by Weapons to start the player's weapon attack and reload animations.","realm":"Shared","args":{"arg":{"text":"Player animation, see Enums/PLAYER.","name":"playerAnim","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetAnimTime","parent":"Entity","type":"classfunc","description":"Sets the start time (relative to Global.CurTime) of the current animation, which is used to determine Entity:GetCycle. Should be less than CurTime to play an animation from the middle.","realm":"Client","args":{"arg":{"text":"The time the animation was supposed to begin.","name":"time","type":"number"}}},"example":{"description":"Sets each player's animation time to 1 second in the future, which causes their animations to freeze in place.","code":"function GM:PrePlayerDraw(ply)\n\n\tply:SetAnimTime(CurTime()+1)\n\nend","output":{"image":{"src":"Entity_SetAnimTime_example1.gif"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetAttachment","parent":"Entity","type":"classfunc","description":{"text":"Parents the sprite to an attachment on another model.\n\nWorks only on `env_sprite` entities.\n\nDespite existing on client, it doesn't actually do anything on client.","deprecated":"You should be using Entity:SetParent instead."},"realm":"Shared","args":{"arg":[{"text":"The entity to attach/parent to","name":"ent","type":"Entity"},{"text":"The attachment ID to parent to","name":"attachment","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetBloodColor","parent":"Entity","type":"classfunc","description":"Sets the blood color this entity uses.","realm":"Server","args":{"arg":{"text":"An integer corresponding to Enums/BLOOD_COLOR.","name":"bloodColor","type":"number{BLOOD_COLOR}"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetBodygroup","parent":"Entity","type":"classfunc","description":{"text":"Sets the currently active Sub Model ID for the Body Group corresponding to the given Body Group ID of the Entity model.\n\nBodygroups, for which Entity:GetBodygroupCount returns `1` or less are considered invalid, and will have no effect in-game.","note":"When used on a Weapon, this will modify its viewmodel."},"realm":"Shared","args":{"arg":[{"text":"The Body Group ID to set the Sub Model ID of.  \n\t\t\tBody Group IDs start at `0`.","name":"bodyGroupId","type":"number"},{"text":"The Sub Model ID to set as active for this Body Group.  \n\t\t\tSub Model IDs start at `0`.","name":"subModelId","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetBodyGroups","parent":"Entity","type":"classfunc","description":{"text":"Sets the Entity active Sub Models via a string of Sub Model IDs in order from the first Body Group ID to the last.\n\nThis is a convenience function for Entity:SetBodygroup.","note":"When used on a Weapon, this will modify its viewmodel."},"realm":"Shared","args":{"arg":{"text":"The Sub Model IDs to activate for each Body Group on the Entity's model.\n\n\t\t\tThe first character corresponds with Body Group ID `0`, the second character coressponds to Body Group ID `1`, etc.\t\n\n\t\t\tTo support Body Groups with more than `0`-`9` options, values above `9` are represented using alphabetical characters starting with `a` and ending with `z`.","name":"subModelIds","type":"string"}}},"example":{"description":"Example of the format","code":"Entity(1):SetBodyGroups( \"021\" )","output":"This makes the following changes:  \n  \n\t\tBody Group ID `0` has Sub Model ID `0` made active.  \n\t\tBody Group ID `1` has Sub Model ID `2` set to active.  \n\t\tBody Group ID `2` has Sub Model ID `1` activated."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetBoneController","parent":"Entity","type":"classfunc","description":{"text":"Sets the specified value on the bone controller with the given ID of this entity, it's used in HL1 to change the head rotation of NPCs, turret aiming and so on.","note":"This is the precursor of pose parameters, and only works for Half Life 1: Source models supporting it."},"realm":"Shared","args":{"arg":[{"text":"The ID of the bone controller to set the value to.\nGoes from 0 to 3.","name":"boneControllerID","type":"number"},{"text":"The value to set on the specified bone controller.","name":"value","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetBoneMatrix","parent":"Entity","type":"classfunc","description":{"text":"Sets the bone matrix of given bone to given matrix. See also Entity:GetBoneMatrix. Will cause a uncatchable error when used on `__INVALIDBONE__` bones, see the examples on a way to prevent this.","note":"Despite existing serverside, it does nothing."},"realm":"Shared","args":{"arg":[{"text":"The ID of the bone","name":"boneid","type":"number"},{"text":"The matrix to set.","name":"matrix","type":"VMatrix"}]}},"example":[{"description":"Check if the bone is valid, if it is apply the bone matrix","code":"if ent:GetBoneName(boneid) ~= \"__INVALIDBONE__\" then\n\tent:SetBoneMatrix(boneid, bonematrix)\nend"},{"description":"Example usage of the function.\n\nAim at an NPC and enter \"bones_cl\" into your console.","code":"if ( CLIENT ) then\n\tconcommand.Add( \"bones_cl\", function( ply )\n\t\tlocal ent = ply:GetEyeTrace().Entity\n\t\tif ( !IsValid( ent ) ) then return end\n\n\t\tent:AddCallback( \"BuildBonePositions\", function( ent, numbones )\n\t\t\tfor i = 0, numbones - 1 do\n\t\t\t\tlocal mat = ent:GetBoneMatrix( i )\n\t\t\t\tif ( !mat ) then continue end\n\n\t\t\t\tlocal scale = mat:GetScale()\n\t\t\t\tmat:Scale( Vector( 1, 1, 1 ) * 0.5 )\n\t\t\t\tent:SetBoneMatrix( i, mat )\n\t\t\tend\n\t\tend )\n\tend )\nend"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetBonePosition","parent":"Entity","type":"classfunc","description":{"text":"Sets the bone position and angles.","validate":"For changes to happen, this must be called in a rendering hook."},"realm":"Client","args":{"arg":[{"text":"The bone ID to manipulate","name":"bone","type":"number"},{"text":"The position to set","name":"pos","type":"Vector"},{"text":"The angles to set","name":"ang","type":"Angle"}]}},"example":{"description":"Sets the head of every player above their character","code":"hook.Add(\"PrePlayerDraw\", \"HeadsUp\", function(ply, flags)\n\tlocal bone = ply:LookupBone( \"ValveBiped.Bip01_Head1\" )\n\t\n\tif not bone then \n\t\treturn\n\tend\n\n\tlocal angle = ply:EyeAngles() + Angle(-90,0,90)\n\tlocal position = ply:LocalToWorld( Vector(0,0,100) )\n\t\t\n\tply:SetBonePosition( bone, position , angle )\n\t\nend)","output":{"upload":{"src":"b56d9/8dcc485f762eac0.jpg","size":"137703","name":"SetBonePosExample.jpg"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetCollisionBounds","parent":"Entity","type":"classfunc","description":{"text":"Sets the collision bounds for the entity, which are used for triggers (Entity:SetTrigger, ENTITY:Touch), and collision (If Entity:SetSolid set as SOLID_BBOX).\n\nInput bounds are relative to Entity:GetPos! \nSee also Entity:SetCollisionBoundsWS.","note":"Player collision bounds are reset every frame to player's Player:SetHull values."},"realm":"Shared","args":{"arg":[{"text":"The minimum vector of the bounds.","name":"mins","type":"Vector"},{"text":"The maximum vector of the bounds.","name":"maxs","type":"Vector"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetCollisionBoundsWS","parent":"Entity","type":"classfunc","description":"A convenience function that sets the collision bounds for the entity in world space coordinates by transforming given vectors to entity's local space and passing them to Entity:SetCollisionBounds","realm":"Shared","args":{"arg":[{"text":"The first vector of the bounds.","name":"vec1","type":"Vector"},{"text":"The second vector of the bounds.","name":"vec2","type":"Vector"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetCollisionGroup","parent":"Entity","type":"classfunc","description":"Sets the entity's collision group.","realm":"Shared","args":{"arg":{"text":"Collision group of the entity, see Enums/COLLISION_GROUP","name":"group","type":"number{COLLISION_GROUP}"}}},"example":{"description":"Showcase function that produces reliable player-player nocollision for targets.\nFirst argument is any player entity, second is an optional number for min time.\nAfter min time elapsed, no-collision will turn off once we are not penetrating any players.\n\nContains no fail-saves or checks.","code":"function ActivateNoCollision(target, min)\n\n\tlocal oldCollision = target:GetCollisionGroup() or COLLISION_GROUP_PLAYER\n\ttarget:SetCollisionGroup(COLLISION_GROUP_PASSABLE_DOOR) -- Players can walk through target\n\n\tif (min and (tonumber(min) > 0)) then \n\n\t\ttimer.Simple(min, function() --after 'min' seconds\n\t\t\ttimer.Create(target:SteamID64()..\"_checkBounds_cycle\", 0.5, 0, function() -- check every half second\n\t\t\t\tlocal penetrating = ( self:GetPhysicsObject() and self:GetPhysicsObject():IsPenetrating() ) or false --if we are penetrating an object\n\t\t\t\tlocal tooNearPlayer = false --or inside a player's hitbox\n\t\t\t\tfor i, ply in ipairs( player.GetAll() ) do\n\t\t\t\t\tif target:GetPos():DistToSqr(ply:GetPos()) <= (80*80) then\n\t\t\t\t\t\ttooNearPlayer = true\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tif not (penetrating and tooNearPlayer) then --if both false then \n\t\t\t\t\ttarget:SetCollisionGroup(oldCollision) -- Stop no-colliding by returning the original collision group (or default player collision)\n\t\t\t\t\ttimer.Destroy(target:SteamID64()..\"_checkBounds_cycle\")\n\t\t\t\tend\n\t\t\tend)\n\t\tend)\n\tend\nend\nActivateNoCollision(Entity( 1 ), 10)","output":"You can walk through the player for 10 seconds"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetColor","parent":"Entity","type":"classfunc","description":"Sets the color of an entity.\n\nSome entities may need a custom [render mode](Enums/RENDERMODE) set for transparency to work. See example 2.\n\nEntities also must have a proper [render group](Enums/RENDERGROUP) set for transparency to work.\n\nWhen rendering a model manually via Entity:SetNoDraw inside ENTITY:Draw, you may need to use render.SetColorModulation in the render hook (where you call Entity:DrawModel) instead.","realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"180-L194"},"args":{"arg":{"text":"The color to set. Uses the Color.","name":"color","type":"Color","default":"Color(255, 255, 255, 255)"}}},"example":[{"description":"Loop through all players, make them black","code":"local colBlack = Color( 0, 0, 0, 255 ) -- Creates a black color\nfor key, ply in player.Iterator() do -- Loop through all players on the server\n\tply:SetColor(colBlack) -- Sets the players color to colBlack\nend"},{"description":"Creates a wooden crate at 0,0,0 and turns it a transparent green","code":"local ent = ents.Create(\"prop_physics\")\nent:SetPos(Vector(0,0,0))\nent:SetModel(\"models/props_junk/wood_crate001a.mdl\")\nent:Spawn()\n\nent:SetColor( Color( 0, 255, 0, 230 ) ) \nent:SetRenderMode( RENDERMODE_TRANSCOLOR ) -- You need to set the render mode on some entities in order for the color to change"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetColor4Part","parent":"Entity","type":"classfunc","description":{"text":"Sets the color of an entity without usage of a Global.Color object.","internal":"Used internally to implement Entity:SetColor."},"realm":"Shared","args":{"arg":[{"name":"r","type":"number"},{"name":"g","type":"number"},{"name":"b","type":"number"},{"name":"a","type":"number"}]}},"example":{"description":"Sets the color of the first player to black","code":"Entity(1):SetColor4Part(0, 0, 0, 0)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetCreator","parent":"Entity","type":"classfunc","description":"Sets the creator of this entity. This is set automatically in Sandbox gamemode when spawning SENTs, but is never used/read by default.","realm":"Server","file":{"text":"lua/includes/extensions/entity.lua","line":"59-L67"},"args":{"arg":{"text":"The creator","name":"ply","type":"Player","default":"NULL"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetCustomCollisionCheck","parent":"Entity","type":"classfunc","description":{"text":"Marks the entity to call GM:ShouldCollide. Not to be confused with Entity:EnableCustomCollisions.","note":"Make sure to use Entity:CollisionRulesChanged after changing this value.\n\t\t\tOtherwise it can cause crashes."},"realm":"Shared","args":{"arg":{"text":"Enable or disable the custom collision check","name":"enable","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetCycle","parent":"Entity","type":"classfunc","description":{"text":"Sets the progress of the current animation to a specific value between 0 and 1.","bug":{"text":"Viewmodels overwrite their animation cycle every frame, for prediction/interpolation purposes.","issue":"3038"}},"realm":"Shared","args":{"arg":{"text":"The desired cycle value","name":"value","type":"number"}}},"example":{"description":"Set the entity to be half way through its current sequence","code":"ent:SetCycle( .5 )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDTAngle","parent":"Entity","type":"classfunc","description":{"text":"This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible.\n\nSets the specified angle on the entity's datatable.","internal":""},"realm":"Shared","args":{"arg":[{"text":"Goes from 0 to 31.","name":"key","type":"number"},{"text":"The angle to write on the entity's datatable.","name":"ang","type":"Angle"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDTBool","parent":"Entity","type":"classfunc","description":{"text":"This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible.\n\nSets the specified bool on the entity's datatable.","internal":""},"realm":"Shared","args":{"arg":[{"text":"Goes from 0 to 31.","name":"key","type":"number"},{"text":"The boolean to write on the entity's metatable.","name":"bool","type":"boolean"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDTEntity","parent":"Entity","type":"classfunc","description":{"text":"This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible.\n\nSets the specified entity on this entity's datatable.","internal":""},"realm":"Shared","args":{"arg":[{"text":"Goes from 0 to 31.","name":"key","type":"number"},{"text":"The entity to write on this entity's datatable.","name":"ent","type":"Entity"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDTFloat","parent":"Entity","type":"classfunc","description":{"text":"This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible.\n\nSets the specified float on the entity's datatable.","internal":""},"realm":"Shared","args":{"arg":[{"text":"Goes from 0 to 31.","name":"key","type":"number"},{"text":"The float to write on the entity's datatable.","name":"float","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDTInt","parent":"Entity","type":"classfunc","description":{"text":"This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible.\n\nSets the specified integer on the entity's datatable.","internal":""},"realm":"Shared","args":{"arg":[{"text":"Goes from 0 to 31.","name":"key","type":"number"},{"text":"The integer to write on the entity's datatable. This will be cast to a 32-bit signed integer internally.","name":"integer","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDTString","parent":"Entity","type":"classfunc","description":{"text":"This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible.\n\nSets the specified string on the entity's datatable.","internal":"","note":"The length of these strings are capped at 512 characters."},"realm":"Shared","args":{"arg":[{"text":"Goes from 0 to 3.","name":"key","type":"number"},{"text":"The string to write on the entity's datatable, can't be more than 512 characters per string.","name":"str","type":"string"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDTVector","parent":"Entity","type":"classfunc","description":{"text":"This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible.\n\nSets the specified vector on the entity's datatable.","internal":""},"realm":"Shared","args":{"arg":[{"text":"Goes from 0 to 31.","name":"key","type":"number"},{"text":"The vector to write on the entity's datatable.","name":"vec","type":"Vector"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetElasticity","parent":"Entity","type":"classfunc","description":"Sets the elasticity of this entity, used by some flying entities such as the Helicopter NPC to determine how much it should bounce around when colliding.","realm":"Shared","args":{"arg":{"text":"The elasticity to set.","name":"elasticity","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetEntity","parent":"Entity","type":"classfunc","description":"Allows you to set the Start or End entity attachment for the rope.","realm":"Shared","args":{"arg":[{"text":"The name of the variable to modify.\nAccepted names are StartEntity and EndEntity.","name":"name","type":"string"},{"text":"The entity to apply to the specific attachment.","name":"entity","type":"Entity"}]}},"example":{"description":"As seen in the constraints module.","code":"local rope = ents.Create( \"keyframe_rope\" )\n\n-- Attachment point 1\nrope:SetEntity( \"StartEntity\", \tEntity(1) )\n-- Attachment point 2\nrope:SetEntity( \"EndEntity\", \tEntity(2) )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetEyeTarget","parent":"Entity","type":"classfunc","description":"Sets the position an entity's eyes look toward. This works as an override for default behavior. Set to `0,0,0` to disable the override.","realm":"Shared","args":{"arg":{"text":"For NPCs and all other entities except ragdolls - the **world position** for the entity to look towards\n\nFor ragdolls specifically - a **local position** in front of their `eyes` attachment.","name":"pos","type":"Vector"}}},"example":[{"description":"Makes an NPC (self) look into a nearby player's eyes.","code":"for p, ply in player.Iterator() do\n    if(ply:EyePos():DistToSqr(self:EyePos()) <= 60 * 60) then\n        self:SetEyeTarget(ply:EyePos())\n        break\n    end\nend"},{"description":"Makes an entity look at a vector the way the eyeposer does it","code":"local lookat = Vector( 0, 0, 0 )\n\nlocal attachment = ent:GetAttachment( ent:LookupAttachment( \"eyes\" ) )\nlocal LocalPos, LocalAng = WorldToLocal( lookat, Angle( 0, 0, 0 ), attachment.Pos, attachment.Ang )\nent:SetEyeTarget( LocalPos )"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetFlexScale","parent":"Entity","type":"classfunc","description":"Sets the scale of all the flexes of this entity. See Entity:SetFlexWeight.","realm":"Shared","args":{"arg":{"text":"The new flex scale to set to","name":"scale","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetFlexWeight","parent":"Entity","type":"classfunc","description":{"text":"Sets the weight/value of given flex controller.\n\nSetting flex weights spawns an internal networked entity (one per entity face posed) to accommodate networking to clients.","note":"Only `96` flex controllers can be set! Flex controllers on models with higher amounts will not be accessible."},"realm":"Shared","args":{"arg":[{"text":"The ID of the flex to modify weight of.  The range is between `0` and Entity:GetFlexNum - 1.","name":"flex","type":"number"},{"text":"The new weight to set.\n\nThe range is [0,1] for entities with Entity:HasFlexManipulatior, and the model-defined input range otherwise (Entity:GetFlexBounds)\n\nExceeding the range is allowed, and will amplify the effect (to possibly bad results), exactly like Entity:SetFlexScale does.","name":"weight","type":"number"}]}},"example":{"description":"Spawns a clientside ragdoll with randomized facial flexes.","code":"concommand.Add( \"test_csragdoll_flex\", function( ply )\n\n\tlocal ragdoll = ClientsideRagdoll( \"models/player/breen.mdl\" )\n\tragdoll:SetNoDraw( false )\n\tragdoll:DrawShadow( true )\n\tragdoll:SetPos( ply:GetPos() )\n\t--print( ragdoll )\n\n\tfor i=0,ragdoll:GetFlexNum() do\n\t\tragdoll:SetFlexWeight( i, math.Rand( 0, 1 ) * 5 )\n\t\t//print( ragdoll:GetFlexWeight( i ) )\n\tend\n\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetFriction","parent":"Entity","type":"classfunc","description":"Sets friction multiplier for this entity when sliding against a surface. Entities default to 1 (100%) and can be higher.\n\nThis may not affect all entities, but does work for players (the range is 0 to 10), as well as other entities using MOVETYPE_STEP \n\nThis only multiplies the friction of the entity, to change the value itself use PhysObj:SetMaterial.","realm":"Shared","args":{"arg":{"text":"Friction multiplier","name":"friction","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetGravity","parent":"Entity","type":"classfunc","description":"Sets the gravity multiplier of the entity.\n\nThis may not affect affect all entities, but does affect players, and entities with MOVETYPE_FLYGRAVITY, such as projectiles.","realm":"Shared","args":{"arg":{"text":"By how much to multiply the gravity. `1` is normal gravity, `0.5` is half-gravity, etc.","name":"multiplier","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetGroundEntity","parent":"Entity","type":"classfunc","description":"Sets the ground the entity is standing on.","realm":"Shared","args":{"arg":{"text":"The ground entity.","name":"ground","type":"Entity"}}},"example":{"description":"Gives all players the ability to (sort of) walk on water.","code":"-- shared.lua tick\nfunction GM:Tick()\n\t\n\tlocal trace = {}\n\tlocal world = Entity( 0 )\n\t\n\tfor p, ply in ipairs( player.GetAll() ) do\n\t\n\t\ttrace = util.TraceLine( {\n\t\t\tstart = ply:GetPos() + Vector( 0, 0, 72),\n\t\t\tendpos = ply:GetPos() + Vector( 0, 0, -3 ),\n\t\t\tmask = MASK_WATER,\n\t\t\tfilter = function( ent ) return true end\n\t\t} )\n\t\t\n\t\tif( trace.Hit ) then\n\t\t\tply:SetGravity( 0.0001 )\n\t\t\tply:SetGroundEntity( world )\n\t\telse\n\t\t\tply:SetGravity( 1.0 )\n\t\tend\n\t\t\n\tend\n\t\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetHealth","parent":"Entity","type":"classfunc","description":{"text":"Sets the health of the entity.","note":"You may want to take Entity:GetMaxHealth into account when calculating what to set health to, in case a gamemode has a different max health than 100.  \nIn some cases, setting health only serverside can cause hitches in movement, for example if something is modifying the player speed based on health.  \nTo solve this issue, it is better to set it shared in a predicted hook."},"realm":"Shared","args":{"arg":{"text":"New health value.","name":"newHealth","type":"number"}}},"example":[{"description":"Sets the entity's health to their maximum health.","code":"Entity( 1 ):SetHealth( Entity( 1 ):GetMaxHealth() )","output":"The entity's health is now full."},{"description":"Deducts 50 points of health from the entity.","code":"Entity( 1 ):SetHealth( Entity( 1 ):Health() - 50 )","output":"The entity now has 50 less health."}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetHitboxSet","parent":"Entity","type":"classfunc","description":"Sets the current Hitbox set for the entity.","realm":"Shared","args":{"arg":{"text":"The new hitbox set to set. Can be a name as a string, or the ID as a number.\n\nIf the operation failed, the function will silently fail.","name":"id","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetIK","parent":"Entity","type":"classfunc","description":{"text":"Enables or disable the inverse kinematic usage of this entity.","warning":"Calling this with false outside of ENTITY:Initialize requires a model change to take effect."},"realm":"Shared","args":{"arg":{"text":"The state of the IK.","name":"useIK","type":"boolean","default":"false"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetKeyValue","parent":"Entity","type":"classfunc","description":"Sets Hammer key values on an entity.\n\nYou can look up which entities have what key values on the [Valve Developer Community](https://developer.valvesoftware.com/wiki/) on entity pages. A  list of basic entities can be found [here](https://developer.valvesoftware.com/wiki/List_of_entities).\n\nAlternatively you can look at the `.fgd` files shipped with Garry's Mod in the `bin/` folder with a text editor to see the key values as they appear in Hammer.","realm":"Shared","args":{"arg":[{"text":"The internal key name","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"string","alttype":"number"}]}},"example":{"description":"Makes an NPC not drop their weapon and drop a healthkit on death, using SF Enumerations on a Combine Soldier.\n\nA list of spawnflags a Combine Soldier has can be found [here](https://developer.valvesoftware.com/wiki/Npc_combine_s#Flags).","code":"npc:SetKeyValue( \"spawnflags\", bit.bor( SF_NPC_NO_WEAPON_DROP, SF_NPC_DROP_HEALTHKIT ) )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetLagCompensated","parent":"Entity","type":"classfunc","description":{"text":"This allows the entity to be lag compensated during Player:LagCompensation.\n\n\n\nAs a side note for parented entities, if your entity can be shot at, keep in mind that its collision bounds need to be bigger than the bone's hitbox the entity is parented to, or hull/line traces ( such as the crowbar attack or bullets ) might not hit at all.","note":"Players are lag compensated by default and there's no need to call this function for them.\n\nIt's best to not enable lag compensation on parented entities, as the system does not handle it that well ( they will be moved back but then the entity will lag behind ).\nParented entities move back with the parent if it's lag compensated, so if you are making some kind of armor piece you shouldn't do anything."},"realm":"Server","args":{"arg":{"text":"Whether the entity should be lag compensated or not.","name":"enable","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetLayerAutokill","parent":"Entity","type":"classfunc","description":{"text":"Sets the autokill flag on the layer, making the layer be automatically removed once the animation playback finishes.","note":"This function only works on BaseAnimatingOverlay entites!"},"added":"2025.07.31","realm":"Server","args":{"arg":[{"text":"The layer ID to change.","name":"layerID","type":"number"},{"text":"Whether to set or unset the autokill flag.","name":"autoKill","type":"boolean"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetLayerBlendIn","parent":"Entity","type":"classfunc","description":{"text":"Sets the interval the layer will fully blend in since startup, based on Entity:GetLayerCycle. Setting this above 0 will enable internal blending of Entity:GetLayerWeight.","note":"This function only works on BaseAnimatingOverlay entites!","bug":"Enabling this will prevent looping gestures with autokill disabled to be removed with Entity:RemoveGesture or Entity:RemoveAllGestures because layer removal functions mark the layer to decrement Entity:GetLayerWeight and unallocate layer ID in next frames if the layer weight is `0`, but blending functions will still keep manipulating layer weight. \n\nTherefore; before calling layer cleanup functions, make sure both Entity:SetLayerBlendIn and Entity:SetLayerBlendOut are set to `0`."},"realm":"Shared","args":{"arg":[{"text":"The Layer ID","name":"layerID","type":"number"},{"text":"Blend range from 0 to 1.","name":"blendIn","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetLayerBlendOut","parent":"Entity","type":"classfunc","description":{"text":"Sets the interval the layer will fully blend out, based on Entity:GetLayerCycle. Setting this above 0 will enable internal blending of Entity:GetLayerWeight.","note":"This function only works on BaseAnimatingOverlay entites!","bug":"Enabling this will prevent looping gestures with autokill disabled to be removed with Entity:RemoveGesture or Entity:RemoveAllGestures because layer removal functions mark the layer to decrement Entity:GetLayerWeight and unallocate layer ID in next frames if the layer weight is `0`, but blending functions will still keep manipulating layer weight. \n\nTherefore; before calling layer cleanup functions, make sure both Entity:SetLayerBlendIn and Entity:SetLayerBlendOut are set to `0`."},"realm":"Shared","args":{"arg":[{"text":"The Layer ID","name":"layerID","type":"number"},{"text":"Blend range from 0 to 1.","name":"blendOut","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetLayerCycle","parent":"Entity","type":"classfunc","description":{"text":"Sets the animation cycle/frame of given layer.","note":"This function only works on BaseAnimatingOverlay entities."},"realm":"Shared","args":{"arg":[{"text":"The Layer ID","name":"layerID","type":"number"},{"text":"The new animation cycle/frame for given layer.","name":"cycle","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetLayerDuration","parent":"Entity","type":"classfunc","description":{"text":"Sets the duration of given layer. This internally overrides the Entity:SetLayerPlaybackRate.","note":"This function only works on BaseAnimatingOverlay entities.","bug":"This stops layer playback if layer sequence conists of 1 frame. Use `Entity:SetLayerPlaybackRate(layerID,1/duration)` instead."},"realm":"Shared","args":{"arg":[{"text":"The Layer ID","name":"layerID","type":"number"},{"text":"The new duration of the layer in seconds.","name":"duration","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetLayerLooping","parent":"Entity","type":"classfunc","description":{"text":"Sets whether the layer should loop or not.","note":"This function only works on BaseAnimatingOverlay entites!"},"realm":"Server","args":{"arg":[{"text":"The Layer ID","name":"layerID","type":"number"},{"text":"Whether the layer should loop or not.","name":"loop","type":"boolean"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetLayerPlaybackRate","parent":"Entity","type":"classfunc","description":{"text":"Sets the layer playback rate. See also Entity:SetLayerDuration.","note":"This function only works on BaseAnimatingOverlay entities."},"realm":"Shared","args":{"arg":[{"text":"The Layer ID","name":"layerID","type":"number"},{"text":"The new playback rate.","name":"rate","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetLayerPriority","parent":"Entity","type":"classfunc","description":{"text":"Sets the priority of given layer.","note":"This function only works on BaseAnimatingOverlay entites!"},"realm":"Server","args":{"arg":[{"text":"The Layer ID","name":"layerID","type":"number"},{"text":"The new priority of the layer.","name":"priority","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetLayerSequence","parent":"Entity","type":"classfunc","description":{"text":"Sets the sequence of given layer.","note":"This function only works on BaseAnimatingOverlay entities."},"added":"2020.06.24","realm":"Shared","args":{"arg":[{"text":"The Layer ID.","name":"layerID","type":"number"},{"text":"The sequenceID to set. See Entity:LookupSequence.","name":"seq","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetLayerWeight","parent":"Entity","type":"classfunc","description":{"text":"Sets the layer weight. This influences how strongly the animation should be overriding the normal animations of the entity.","note":["This function only works on BaseAnimatingOverlay entities.","Setting either Entity:SetLayerBlendIn or Entity:SetLayerBlendOut above 0 will turn on automatic weight blending, so you shouldn't be using this if you use any of above."]},"realm":"Shared","args":{"arg":[{"text":"The Layer ID","name":"layerID","type":"number"},{"text":"The new layer weight.","name":"weight","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetLegacyTransform","parent":"Entity","type":"classfunc","description":"This forces an entity to use the bone transformation behaviour from versions prior to **8 July 2014**.\n\nThis behaviour affects Entity:EnableMatrix and Entity:SetModelScale and is incorrect, therefore this function be used exclusively as a quick fix for old scripts that rely on it.","realm":"Client","args":{"arg":{"text":"Whether the entity should use the old bone transformation behaviour or not.","name":"enabled","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetLightingOriginEntity","parent":"Entity","type":"classfunc","description":"Sets the entity to be used as the light origin position for this entity.","realm":"Server","args":{"arg":{"text":"The lighting entity.","name":"lightOrigin","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetLocalAngles","parent":"Entity","type":"classfunc","description":"Sets angles relative to angles of Entity:GetParent","realm":"Shared","args":{"arg":{"text":"The local angle","name":"ang","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetLocalAngularVelocity","parent":"Entity","type":"classfunc","description":"Sets the entity's angular velocity (rotation speed).","realm":"Shared","args":{"arg":{"text":"The angular velocity to set.","name":"angVel","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetLocalPos","parent":"Entity","type":"classfunc","description":"Sets local position relative to the parented position. This is for use with Entity:SetParent to offset position.\n\t\nThis is also used by NPCs for interpolated movement. If you use Entity:SetPos for step movement, your NPC will snap to position instead.","realm":"Shared","args":{"arg":{"text":"The local position","name":"pos","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetLocalVelocity","parent":"Entity","type":"classfunc","description":{"text":"Sets the entity's local velocity which is their velocity due to movement in the world from forces such as gravity. Does not include velocity from entity-on-entity collision or other world movement.","warning":"Same as Entity:SetAbsVelocity, but clamps the given velocity, and is not recommended to be used because of that."},"realm":"Shared","args":{"arg":{"text":"The new velocity to set.","name":"velocity","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetLOD","parent":"Entity","type":"classfunc","description":"Sets the Level Of Detail model to use with this entity. This may not work for all models if the model doesn't include any LOD sub models.\n\nThis function works exactly like the clientside r_lod convar and takes priority over it.","realm":"Client","args":{"arg":{"text":"The Level Of Detail model ID to use. -1 leaves the engine to automatically set the Level of Detail.\n\nThe Level Of Detail may range from 0 to 8, with 0 being the highest quality and 8 the lowest.","name":"lod","type":"number","default":"-1"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetMaterial","parent":"Entity","type":"classfunc","description":{"text":"Sets the rendering material override of the entity.\n\nTo set a Lua material created with Global.CreateMaterial, just prepend a \"!\" to the material name.\n\nIf you wish to override a single material on the model, use Entity:SetSubMaterial instead.","note":"To apply materials to models, that material **must** have **VertexLitGeneric** shader. For that reason you cannot apply map textures onto models, map textures use a different material shader - **LightmappedGeneric**, which can be used on brush entities.","bug":{"text":"The server's value takes priority on the client.","issue":"3362"}},"realm":"Shared","args":{"arg":{"text":"New material name. Use an empty string (\"\") to reset to the default materials.","name":"materialName","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetMaxHealth","parent":"Entity","type":"classfunc","description":"Sets the maximum health for entity. Note, that you can still set entity's health above this amount with Entity:SetHealth.","realm":"Server","args":{"arg":{"text":"What the max health should be","name":"maxhealth","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetMaxYawSpeed","parent":"ENTITY","type":"classfunc","description":{"text":"Sets the NPC max yaw speed. Internally sets the `m_fMaxYawSpeed` variable which is polled by the engine.","note":"This is a helper function only available if your SENT is based on `base_ai`"},"realm":"Server","args":{"arg":{"text":"The new max yaw value to set","name":"maxyaw","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetModel","parent":"Entity","type":"classfunc","description":{"text":"Sets the model of the entity.\n\nThis does not update the physics of the entity - see Entity:PhysicsInit.","warning":"This silently fails when given an empty string."},"realm":"Shared","args":{"arg":{"text":"New model value.","name":"modelName","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetModelName","parent":"Entity","type":"classfunc","description":"Alter the model name returned by Entity:GetModel. Does not affect the entity's actual model.","realm":"Shared","args":{"arg":{"text":"The new model name.","name":"modelname","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetModelScale","parent":"Entity","type":"classfunc","description":{"text":"Uniformly scales the model of the entity, if the entity is a Player or an NPC the hitboxes will be scaled as well.\n\nTo resize the entity non-uniformly, along any axis, use Entity:EnableMatrix instead.\n\nFor some entities (Such as `prop_physics` and `anim` type Scripted Entities), calling Entity:Activate after this will scale the collision bounds and PhysObj as well; be wary as there's no optimization being done internally and highly complex collision models might crash the server.\n\nClient-side trace detection seems to mess up if `deltaTime` is set to anything but zero. A very small decimal can be used instead of zero to solve this issue.\n\nIf your old scales are wrong, use Entity:SetLegacyTransform as a quick fix.","note":"If you do not want the physics to be affected by Entity:Activate, you can use Entity:ManipulateBoneScale`( 0, Vector( scale, scale, scale ) )` instead.","bug":{"text":"On the client, `anim` types' collision testing prediction fails for changed model scales: you can use `cl_showerror 2` to see by how much. Essentially, the client will freak out when you stand/run past on a Scripted Entity or prop that has been modified using this method.","issue":"6405"},"validate":"This disables IK."},"realm":"Shared","args":{"arg":[{"text":"A float to scale the model by. 0 will not draw anything. A number less than 0 will draw the model inverted.","name":"scale","type":"number"},{"text":"Transition time of the scale change, set to 0 to modify the scale right away. To avoid issues with client-side trace detection this must be set, and can be an extremely low number to mimic a value of 0 such as .000001.","name":"deltaTime","type":"number","default":"0"}]}},"example":{"description":"From the \"Biggify\" option of right clicking an npc","code":"ent:SetModelScale( ent:GetModelScale() * 1.25, 1 )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetMoveCollide","parent":"Entity","type":"classfunc","description":"Sets the move collide type of the entity. The move collide is the way a physics object reacts to hitting an object - will it bounce, slide?","realm":"Shared","args":{"arg":{"text":"The move collide type, see Enums/MOVECOLLIDE","name":"moveCollideType","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetMoveParent","parent":"Entity","type":"classfunc","description":"Sets the Movement Parent of an entity to another entity.\n\nSimilar to Entity:SetParent, except the object's coordinates are not translated automatically before parenting.\n\nDoes nothing on client.","realm":"Shared","args":{"arg":{"text":"The entity to change this entity's Movement Parent to.","name":"Parent","type":"Entity"}}},"example":{"description":"Sets the Movement Entity of a new entity to Player 1.","code":"local hat = ents.Create(\"prop_physics\")\n//Position and angles are relative to our future parent.\nhat:SetPos(Vector(0,0,10))\nhat:SetAngles(Angle(0,90,0))\n\nhat:SetMoveParent(Entity(1))\n\nhat:Spawn()"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetMoveType","parent":"Entity","type":"classfunc","description":"Sets the entity's move type. This should be called before initializing the physics object on the entity, unless it will override SetMoveType such as Entity:PhysicsInitBox.\n\nDespite existing on client, it doesn't actually do anything on client.","realm":"Shared","args":{"arg":{"text":"The new movetype, see Enums/MOVETYPE","name":"movetype","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetName","parent":"Entity","type":"classfunc","description":"Sets the mapping name of the entity.","realm":"Server","args":{"arg":{"text":"The name to set for the entity.","name":"mappingName","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetNetworkAngles","parent":"Entity","type":"classfunc","description":"Alters the entity's perceived serverside angle on the client.","realm":"Client","args":{"arg":{"text":"Networked angle.","name":"angle","type":"Angle"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetNetworked2Angle","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked angle value on the entity.\n\nThe value can then be accessed with Entity:GetNetworked2Angle both from client and server.","deprecated":"You should be using Entity:SetNW2Angle instead.","warning":"The value will only be updated clientside if the entity is or enters the clients PVS. use Entity:SetNWAngle instead","note":"Running this function clientside will only set it for the client it is called on.  \nThe value will only be networked if it isn't the same as the current value and unlike SetNW*\nthe value will only be networked once and not every 10 seconds."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"Angle"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNetworked2Bool","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked boolean value on the entity.\n\nThe value can then be accessed with Entity:GetNetworked2Bool both from client and server.","deprecated":"You should be using Entity:SetNW2Bool instead.","warning":"The value will only be updated clientside if the entity is or enters the clients PVS. use Entity:SetNWBool instead","note":"Running this function clientside will only set it for the client it is called on.  \nThe value will only be networked if it isn't the same as the current value and unlike SetNW*\nthe value will only be networked once and not every 10 seconds."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"boolean"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNetworked2Entity","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked entity value on the entity.\n\nThe value can then be accessed with Entity:GetNetworked2Entity both from client and server.","deprecated":"You should be using Entity:SetNW2Entity instead.","warning":"The value will only be updated clientside if the entity is or enters the clients PVS. use Entity:SetNWEntity instead","note":"Running this function clientside will only set it for the client it is called on.  \nThe value will only be networked if it isn't the same as the current value and unlike SetNW*\nthe value will only be networked once and not every 10 seconds."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"Entity"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNetworked2Float","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked float (number) value on the entity.\n\nThe value can then be accessed with Entity:GetNetworked2Float both from client and server.\n\nUnlike Entity:SetNetworked2Int, floats don't have to be whole numbers.","warning":"The value will only be updated clientside if the entity is or enters the clients PVS. use Entity:SetNWFloat instead","note":"Running this function clientside will only set it for the client it is called on.  \nThe value will only be networked if it isn't the same as the current value and unlike SetNW*\nthe value will only be networked once and not every 10 seconds."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNetworked2Int","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked integer (whole number) value on the entity.\n\nThe value can then be accessed with Entity:GetNetworked2Int both from client and server.\n\nSee Entity:SetNW2Float for numbers that aren't integers.","deprecated":"You should be using Entity:SetNW2Int instead.","warning":"The value will only be updated clientside if the entity is or enters the clients PVS.  \nThe integer has a 32 bit limit. Use Entity:SetNWInt instead","note":"Running this function clientside will only set it for the client it is called on.  \nThe value will only be networked if it isn't the same as the current value and unlike SetNW*\nthe value will only be networked once and not every 10 seconds."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNetworked2String","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked string value on the entity.\n\nThe value can then be accessed with Entity:GetNetworked2String both from client and server.","deprecated":"You should be using Entity:SetNW2String instead.","warning":"The value will only be updated clientside if the entity is or enters the clients PVS. use Entity:SetNWString instead","note":"Running this function clientside will only set it for the client it is called on.  \nThe value will only be networked if it isn't the same as the current value and unlike SetNW*\nthe value will only be networked once and not every 10 seconds."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set, up to 511 characters.","name":"value","type":"string"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNetworked2Var","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked value on the entity.\n\nThe value can then be accessed with Entity:GetNetworked2Var both from client and server.\n\n| Allowed Types   |  \n| --------------- |  \n| Angle           |  \n| Boolean         |  \n| Entity          |  \n| Float           |  \n| Int             |  \n| String          |  \n| Vector          |","deprecated":"You should be using Entity:SetNW2Var instead.","warning":"Trying to network a type that is not listed above leads to the value not being networked!","note":"Running this function clientside will only set it for the client it is called on.  \nThe value will only be networked if it isn't the same as the current value and unlike SetNW*\nthe value will only ne networked once and not every 10 seconds."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"any"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNetworked2VarProxy","parent":"Entity","type":"classfunc","description":{"text":"Sets a function to be called when the NW2Var changes. Internally uses GM:EntityNetworkedVarChanged to call the function.","note":"Only one NW2VarProxy can be set per-var  \nRunning this function clientside will only set it for the client it is called on."},"realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"600-L611"},"args":{"arg":[{"text":"The name of the NW2Var to add callback for.","name":"name","type":"string"},{"text":"The function to be called when the NW2Var changes.","name":"callback","type":"function","callback":{"arg":[{"text":"The entity","type":"Entity","name":"ent"},{"text":"Name of the NW2Var that has changed","type":"string","name":"name"},{"text":"The old value","type":"any","name":"oldval"},{"text":"The new value","type":"any","name":"newval"}]}}]}},"example":{"description":"Prints all changes to a NW2Var called \"Key\" of Player 1.","code":"Entity( 1 ):SetNetworked2VarProxy( \"Key\", print )\nEntity( 1 ):SetNW2String( \"Key\", \"Value\" )\nEntity( 1 ):SetNW2String( \"Key\", \"Table\" )","output":"```\nPlayer [1][Player1]\tKey\tnil\tValue\nPlayer [1][Player1]\tKey\tValue\tTable\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNetworked2Vector","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked vector value on the entity.\n\nThe value can then be accessed with Entity:GetNetworked2Vector both from client and server.","deprecated":"You should be using Entity:SetNW2Vector instead.","warning":"The value will only be updated clientside if the entity is or enters the clients PVS. use Entity:SetNWVector instead","note":"Running this function clientside will only set it for the client it is called on.  \nThe value will only be networked if it isn't the same as the current value and unlike SetNW*\nthe value will only be networked once and not every 10 seconds."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"Vector"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNetworkedAngle","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked angle value at specified index on the entity.\n\nThe value then can be accessed with Entity:GetNetworkedAngle both from client and server.","deprecated":"You should use Entity:SetNWAngle instead.","note":"Running this function clientside will only set it clientside for the client it is called on."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"Angle","default":"Angle( 0, 0, 0 )"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNetworkedBool","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked boolean value at specified index on the entity.\n\nThe value then can be accessed with Entity:GetNetworkedBool both from client and server.","deprecated":"You should use Entity:SetNWBool instead.","note":"Running this function clientside will only set it clientside for the client it is called on."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"boolean","default":"false"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNetworkedEntity","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked entity value at specified index on the entity.\n\nThe value then can be accessed with Entity:GetNetworkedEntity both from client and server.","deprecated":"You should use Entity:SetNWEntity instead.","note":"Running this function clientside will only set it clientside for the client it is called on."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"Entity","default":"NULL"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNetworkedFloat","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked float value at specified index on the entity.\n\nThe value then can be accessed with Entity:GetNetworkedFloat both from client and server.\n\nSeems to be the same as Entity:GetNetworkedInt.","deprecated":"You should use Entity:SetNWFloat instead.","note":"Running this function clientside will only set it clientside for the client it is called on."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"number","default":"0"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNetworkedInt","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked integer value at specified index on the entity.\n\nThe value then can be accessed with Entity:GetNetworkedInt both from client and server.","deprecated":"You should use Entity:SetNWInt instead.","note":"Running this function clientside will only set it clientside for the client it is called on."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"number","default":"0"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNetworkedNumber","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked number at the specified index on the entity.","deprecated":"You should be using Entity:SetNWFloat instead."},"realm":"Shared","args":{"arg":[{"text":"The index that the value is stored in.","name":"index","type":"any"},{"text":"The value to network.","name":"number","type":"number"}]}},"example":{"description":"This will set the networked number 'score' on all clients to 3.","code":"for i, ply in ipairs( player.GetAll() ) do\n    ply:SetNetworkedNumber( 'score', 3 )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNetworkedString","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked string value at specified index on the entity.\n\nThe value then can be accessed with Entity:GetNetworkedString both from client and server.","deprecated":"You should use Entity:SetNWString instead.","note":"Running this function clientside will only set it clientside for the client it is called on."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"string","default":""}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNetworkedVar","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked value on the entity.\n\nThe value can then be accessed with Entity:GetNetworkedVar both from client and server.\n\n| Allowed Types   |  \n| --------------- |  \n| Angle           |  \n| Boolean         |  \n| Entity          |  \n| Float           |  \n| Int             |  \n| String          |  \n| Vector          |","deprecated":"","warning":"Trying to network a type that is not listed above leads to the value not being networked!  \nthe value will only be updated clientside if the entity is or enters the clients PVS.","note":"Running this function clientside will only set it for the client it is called on.  \nThe value will only be networked if it isn't the same as the current value and unlike SetNW*\nthe value will only be networked once and not every 10 seconds."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"any"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNetworkedVarProxy","parent":"Entity","type":"classfunc","description":{"text":"Sets callback function to be called when given NWVar changes.","deprecated":"You should be using Entity:SetNWVarProxy instead."},"realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"485-L493"},"args":{"arg":[{"text":"The name of the NWVar to add callback for.","name":"name","type":"string"},{"text":"The function to be called when the NWVar changes.","name":"callback","type":"function","callback":{"arg":[{"text":"The entity","type":"Entity","name":"ent"},{"text":"Name of the NWVar that has changed","type":"string","name":"name"},{"text":"The old value","type":"any","name":"oldval"},{"text":"The new value","type":"any","name":"newval"}]}}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNetworkedVector","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked vector value at specified index on the entity.\n\nThe value then can be accessed with Entity:GetNetworkedVector both from client and server.","deprecated":"You should use Entity:SetNWVector instead.","note":"Running this function clientside will only set it clientside for the client it is called on."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"Vector","default":"Vector( 0, 0, 0 )"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNetworkKeyValue","parent":"Entity","type":"classfunc","description":{"text":"A helper function to allow setting Network Variables via Entity:SetKeyValue, primarily to allow mappers to set them from Hammer.\n\nMeant to be called from ENTITY:KeyValue, see example.\n\nSee also Entity:SetNetworkVarsFromMapInput for a function that does similar thing for map inputs instead.","note":"This function will only work on entities which had Entity:InstallDataTable called on them, which is done automatically for players and all Scripted Entities."},"realm":"Server","args":{"arg":[{"text":"The key-value name, or simply the \"key\".","name":"key","type":"string"},{"text":"The key-value value.","name":"value","type":"string"}]},"rets":{"ret":{"text":"Whether a network variable was set successfully","name":"","type":"boolean"}}},"example":{"description":"Example usage, adding this will allow mappers to set all your key networks as key values. You will also need to provide manually crafted `.fgd` file that lists all the key values. `env_skypaint` can be used as an example (`garrysmod.fgd` and `env_skypaint.lua` in base gamemode).","code":"function ENT:KeyValue( key, value )\n\tif ( self:SetNetworkKeyValue( key, value ) ) then\n\t\treturn\n\tend\n\n\t-- Other code...\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetNetworkOrigin","parent":"Entity","type":"classfunc","description":{"text":"Virtually changes entity position for clients. Does almost the same thing as Entity:SetPos when used serverside.","note":"Unlike Entity:SetPos it directly changes the position without checking for any unreasonable position."},"realm":"Shared","args":{"arg":{"text":"The position to make clients think this entity is at.","name":"origin","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNetworkVarsFromMapInput","parent":"Entity","type":"classfunc","description":{"text":"A helper function to allow setting Network Variables via Entity:Fire, primarily to allow mappers to set them from Hammer via Map I/O logic.\n\nMeant to be called from ENTITY:AcceptInput, see example.\n\nSee also Entity:SetNetworkKeyValue for a function that does similar thing, but for entity key-values in Hammer instead.","note":"This function will only work on entities which had Entity:InstallDataTable called on them, which is done automatically for players and all Scripted Entities."},"realm":"Server","added":"2025.03.18","args":{"arg":[{"text":"The name of the Map I/O input, including the `Set` prefix.","name":"name","type":"string"},{"text":"The input parameter.","name":"param","type":"string"}]},"rets":{"ret":{"text":"Whether a network variable was set successfully","name":"","type":"boolean"}}},"example":{"description":"Example usage, adding this will allow mappers to set all your networks vars using Map I/O inputs. You will also need to provide manually crafted `.fgd` file that lists all the key values. `env_skypaint` can be used as an example (`garrysmod.fgd` and `env_skypaint.lua` in base gamemode).","code":"function ENT:AcceptInput( name, activator, caller, data )\n\n\tif ( self:SetNetworkVarsFromMapInput( name, data ) ) then\n\t\treturn true -- Accept the input so the there are no warnings in console with developer 2\n\tend\n\n\t-- Other code...\n\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetNextClientThink","parent":"Entity","type":"classfunc","description":"Sets the next time the clientside ENTITY:Think is called.","realm":"Client","args":{"arg":{"text":"The next time, relative to Global.CurTime, to execute the ENTITY:Think clientside.","name":"nextthink","type":"number"}}},"example":{"description":"Prints 'Hello, World!' in console and sleeps for a second.","code":"function ENT:Think()\n    print(\"Hello, World!\")\n\n    self:SetNextClientThink( CurTime() + 1 )\n    return true -- Note: You need to return true to override the default next think time\nend","output":"Hello, World! every second the entity exists in the world."},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetNoDraw","parent":"Entity","type":"classfunc","description":"Sets if the entity's model should render at all.\n\nIf set on the server, this entity will no longer network to clients, and for all intents and purposes cease to exist clientside.\n\nThe entity can still be manually rendered via Entity:DrawModel in appropriate hooks.","realm":"Shared","args":{"arg":{"text":"true disables drawing","name":"shouldNotDraw","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNotSolid","parent":"Entity","type":"classfunc","description":"Sets whether the entity is solid or not.","realm":"Shared","args":{"arg":{"text":"True will make the entity not solid, false will make it solid.","name":"IsNotSolid","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNPCClass","parent":"ENTITY","type":"classfunc","file":{"text":"gamemodes/base/entities/entities/base_ai/init.lua","line":"14"},"description":{"text":"Sets the NPC classification. Internally sets the `m_iClass` variable which is polled by the engine.","note":"This is a helper function only available if your SENT is based on `base_ai`"},"realm":"Server","args":{"arg":{"text":"The CLASS Enum","name":"classification","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetNW2Angle","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked angle value on the entity.\n\nThe value can then be accessed with Entity:GetNW2Angle both from client and server.","warning":"The value will only be updated clientside if the entity is or enters the clients PVS. use Entity:SetNWAngle instead","note":"Running this function clientside will only set it for the client it is called on.  \nThe value will only be networked if it isn't the same as the current value and unlike SetNW*\nthe value will only be networked once and not every 10 seconds."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"Angle"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNW2Bool","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked boolean value on the entity.\n\nThe value can then be accessed with Entity:GetNW2Bool both from client and server.","bug":{"text":"You should not use the NW2 System on entities that are based on a Lua Entity or else NW2Vars could get mixed up, updated multiple times or not be set.","issue":"5455"},"warning":"The value will only be updated clientside if the entity is or enters the clients PVS. use Entity:SetNWBool instead","note":"Running this function clientside will only set it for the client it is called on.  \nThe value will only be networked if it isn't the same as the current value and unlike SetNW*\nthe value will only be networked once and not every 10 seconds."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"boolean"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNW2Entity","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked entity value on the entity.\n\nThe value can then be accessed with Entity:GetNW2Entity both from client and server.","bug":{"text":"You should not use the NW2 System on entities that are based on a Lua Entity or else NW2Vars could get mixed up, updated multiple times or not be set.","issue":"5455"},"warning":"The value will only be updated clientside if the entity is or enters the clients PVS. use Entity:SetNWEntity instead","note":"Running this function clientside will only set it for the client it is called on.  \nThe value will only be networked if it isn't the same as the current value and unlike SetNW*\nthe value will only be networked once and not every 10 seconds."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"Entity"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNW2Float","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked float (number) value on the entity.\n\nThe value can then be accessed with Entity:GetNW2Float both from client and server.\n\nUnlike Entity:SetNW2Int, floats don't have to be whole numbers.","bug":{"text":"You should not use the NW2 System on entities that are based on a Lua Entity or else NW2Vars could get mixed up, updated multiple times or not be set.","issue":"5455"},"warning":"The value will only be updated clientside if the entity is or enters the clients PVS. use Entity:SetNWFloat instead","note":"Running this function clientside will only set it for the client it is called on.  \nThe value will only be networked if it isn't the same as the current value and unlike SetNW*\nthe value will only be networked once and not every 10 seconds."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNW2Int","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked integer (whole number) value on the entity.\n\nThe value can then be accessed with Entity:GetNW2Int both from client and server.\n\nSee Entity:SetNW2Float for numbers that aren't integers.","bug":{"text":"You should not use the NW2 System on entities that are based on a Lua Entity or else NW2Vars could get mixed up, updated multiple times or not be set.","issue":"5455"},"warning":"The value will only be updated clientside if the entity is or enters the clients PVS.  \nThe integer has a 32 bit limit. Use Entity:SetNWInt instead","note":"Running this function clientside will only set it for the client it is called on.  \nThe value will only be networked if it isn't the same as the current value and unlike SetNW*\nthe value will only be networked once and not every 10 seconds."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNW2String","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked string value on the entity.\n\nThe value can then be accessed with Entity:GetNW2String both from client and server.","bug":{"text":"You should not use the NW2 System on entities that are based on a Lua Entity or else NW2Vars could get mixed up, updated multiple times or not be set.","issue":"5455"},"warning":"The value will only be updated clientside if the entity is or enters the clients PVS. use Entity:SetNWString instead","note":"Running this function clientside will only set it for the client it is called on.  \nThe value will only be networked if it isn't the same as the current value and unlike SetNW*\nthe value will only be networked once and not every 10 seconds."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with, up to 1023 characters","name":"key","type":"string"},{"text":"The value to set, up to 511 characters.","name":"value","type":"string"}]}},"example":{"description":"Adds a tag after player's hud target (When you aim at someone)","code":"hook.Add(\"PlayerSay\", \"WriteTag\", function(ply, text)\n    if not text:StartsWith(\"!tag \") then return end\n\n    --Gets the text after \"!tag \"\n    local tag = text:sub(6)\n    if tag == \"\" then\n        return \"Tag cannot be empty!\"\n    elseif #tag > 511 then --Text cannot be longer than 511 characters\n        return \"Tag is too long! (Max 511 characters)\"\n    end\n\n    ply:SetNW2String(\"PlayerTag\", tag)\n    return ply:Nick() .. \" changed his tag to: \" .. tag --Notifies players of such change\nend)\n\nhook.Add(\"HUDDrawTargetID\", \"DrawTag\", function()\n    local target = LocalPlayer():GetEyeTrace().Entity\n    if not IsValid(target) or not target:IsPlayer() then return end --If we are not looking at a player, do nothing\n\n    local tag = target:GetNW2String(\"PlayerTag\", \"\")\n    if tag == \"\" then return end --If the player has no tag, do nothing\n\n    --Displays tag after player name + health\n    draw.SimpleText(tag, \"TargetIDSmall\", ScrW() / 2, ScrH() / 2 + 48, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)\nend)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNW2Var","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked value on the entity.\n\nThe value can then be accessed with Entity:GetNW2Var both from client and server.\n\n| Allowed Types   |  \n| --------------- |  \n| Angle           |  \n| Boolean         |  \n| Entity          |  \n| Float           |  \n| Int             |  \n| String          |  \n| Vector          |","warning":"Trying to network a type that is not listed above leads to the value not being networked!  \nthe value will only be updated clientside if the entity is or enters the clients PVS.","bug":{"text":"You should not use the NW2 System on entities that are based on a Lua Entity or else NW2Vars could get mixed up, updated multiple times or not be set.","issue":"5455"},"note":"Running this function clientside will only set it for the client it is called on.  \nThe value will only be networked if it isn't the same as the current value and unlike SetNW*\nthe value will only be networked once and not every 10 seconds."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"any"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNW2VarProxy","parent":"Entity","type":"classfunc","description":{"text":"Sets a function to be called when the NW2Var changes. Internally uses GM:EntityNetworkedVarChanged to call the function.  \nAlias of Entity:SetNetworked2VarProxy","bug":{"text":"You should not use the NW2 System on entities that are based on a Lua Entity, or else this will be called multiple times and the NW2Var could get mixed up with other ones.","issue":"5455"},"note":"Only one NW2VarProxy can be set per-var  \nRunning this function will only set it for the realm it is called on."},"realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"626"},"args":{"arg":[{"text":"The key of the NW2Var to add callback for.","name":"key","type":"string"},{"text":"The function to be called when the NW2Var changes. It has 4 arguments:\n* Entity ent - The entity\n* string name - Name of the NW2Var that has changed\n* any oldval - The old value\n* any newval - The new value","name":"callback","type":"function"}]}},"example":{"description":"Prints all changes to a NW2Var called \"Key\" of Player 1.","code":"Entity( 1 ):SetNW2VarProxy( \"Key\", print )\nEntity( 1 ):SetNW2String( \"Key\", \"Value\" )\nEntity( 1 ):SetNW2String( \"Key\", \"Table\" )","output":"```\nPlayer [1][Player1]\tKey\tnil\tValue\nPlayer [1][Player1]\tKey\tValue\tTable\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNW2Vector","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked vector value on the entity.\n\nThe value can then be accessed with Entity:GetNW2Vector both from client and server.","bug":{"text":"You should not use the NW2 System on entities that are based on a Lua Entity or else NW2Vars could get mixed up, updated multiple times or not be set.","issue":"5455"},"warning":"The value will only be updated clientside if the entity is or enters the clients PVS. use Entity:SetNWVector instead","note":"Running this function clientside will only set it for the client it is called on.  \nThe value will only be networked if it isn't the same as the current value and unlike SetNW*\nthe value will only be networked once and not every 10 seconds."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"Vector"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNWAngle","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked angle value on the entity.\n\nThe value can then be accessed with Entity:GetNWAngle both from client and server.","warning":"There's a 4095 slots Network limit. If you need more, consider using the net library or Entity:SetNW2Angle. You should also consider the fact that you have way too many variables. You can learn more about this limit here: Networking_Usage#nwlimits","note":"Running this function clientside will only set it for the client it is called on."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"Angle"}]}},"example":{"description":"This will set the networked angle 'direction' on all clients that is pointing straight up.","code":"for i, ply in ipairs( player.GetAll() ) do\n    ply:SetNWAngle( 'direction', Angle( -90, 0, 0 ) )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNWBool","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked boolean value on the entity.\n\nThe value can then be accessed with Entity:GetNWBool both from client and server.","warning":"There's a 4096 slots Network limit. If you need more, consider using the net library or Entity:SetNW2Bool. You should also consider the fact that you have way too many variables. You can learn more about this limit here: Networking_Usage#nwlimits","note":"Running this function clientside will only set it for the client it is called on."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"boolean"}]}},"example":{"description":"Sets a networked boolean with a key of `VIP` and a value of true on a player.","code":"print( Entity(1):GetNWBool( \"VIP\", false ) )\nEntity(1):SetNWBool( \"VIP\", true )\nprint( Entity(1):GetNWBool( \"VIP\" ) )","output":"```\nfalse\ntrue\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNWEntity","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked entity value on the entity.\n\nThe value can then be accessed with Entity:GetNWEntity both from client and server.","warning":"There's a 4096 slots Network limit. If you need more, consider using the net library or Entity:SetNW2Entity. You should also consider the fact that you have way too many variables. You can learn more about this limit here: Networking_Usage#nwlimits","note":"Running this function clientside will only set it for the client it is called on."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"Entity"}]}},"example":{"description":"This will set the networked entity 'owner' on all clients to themselves.","code":"for i, ply in ipairs( player.GetAll() ) do\n    ply:SetNWEntity( \"owner\", ply )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNWFloat","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked float (number) value on the entity.\n\nThe value can then be accessed with Entity:GetNWFloat both from client and server.\n\nUnlike Entity:SetNWInt, floats don't have to be whole numbers.","warning":"There's a 4095 slots Network limit. If you need more, consider using the net library or Entity:SetNW2Float. You should also consider the fact that you have way too many variables. You can learn more about this limit here: Networking_Usage#nwlimits","note":"Running this function clientside will only set it for the client it is called on."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"number"}]}},"example":{"description":"This will set the networked float 'money' on all clients to 10.5.","code":"for k, v in ipairs( player.GetAll() ) do\n    v:SetNWFloat( 'money', 10.5 )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNWInt","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked integer (whole number) value on the entity.\n\nThe value can then be accessed with Entity:GetNWInt both from client and server.\n\nSee Entity:SetNWFloat for numbers that aren't integers.","warning":"There's a 4095 slots Network limit. If you need more, consider using the net library or Entity:SetNW2Int. You should also consider the fact that you have way too many variables. You can learn more about this limit here: Networking_Usage#nwlimits","note":"Running this function clientside will only set it for the client it is called on.","bug":{"text":"This function will not round decimal values as it actually networks a float internally.","issue":"3374"}},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"number"}]}},"example":{"description":"This will set the networked integer 'money' on all clients to 100.","code":"for i, ply in ipairs( player.GetAll() ) do\n    ply:SetNWInt( 'money', 100 )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNWString","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked string value on the entity.\n\nThe value can then be accessed with Entity:GetNWString both from client and server.","warning":"There's a 4095 slots Network limit. If you need more, consider using the net library or Entity:SetNW2String. You should also consider the fact that you have way too many variables. You can learn more about this limit here: Networking_Usage#nwlimits","note":"Running this function clientside will only set it for the client it is called on."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set, up to 199 characters.","name":"value","type":"string"}]}},"example":{"description":"Sets a networked string with a key of \"Nickname\" and a value of \n\"John\" on a player.","code":"player:SetNWString( \"Nickname\", \"John\" )\nprint( player:GetNWString( \"Nickname\" ) )","output":"\"John\""},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNWVarProxy","parent":"Entity","type":"classfunc","description":{"text":"Sets a function to be called when the NWVar changes.","note":"Only one NWVarProxy can be set per-var  \nRunning this function will only set it for the realm it is called on."},"realm":"Shared","args":{"arg":[{"text":"The key of the NWVar to add callback for.","name":"key","type":"string"},{"text":"The function to be called when the NWVar changes.","name":"callback","type":"function","callback":{"arg":[{"text":"The entity","type":"Entity","name":"ent"},{"text":"Name of the NWVar that has changed","type":"string","name":"name"},{"text":"The old value","type":"any","name":"oldval"},{"text":"The new value","type":"any","name":"newval"}]}}]}},"example":{"description":"Prints all changes to a NWVar called \"Key\" of Player 1.","code":"Entity( 1 ):SetNWVarProxy( \"Key\", print )\nEntity( 1 ):SetNWString( \"Key\", \"Value\" )\nEntity( 1 ):SetNWString( \"Key\", \"Table\" )","output":"```\nPlayer [1][Player1]\tKey\tnil\tValue\nPlayer [1][Player1]\tKey\tValue\tTable\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNWVector","parent":"Entity","type":"classfunc","description":{"text":"Sets a networked vector value on the entity.\n\nThe value can then be accessed with Entity:GetNWVector both from client and server.","warning":"There's a 4095 slots Network limit. If you need more, consider using the net library or Entity:SetNW2Vector. You should also consider the fact that you have way too many variables. You can learn more about this limit here: Networking_Usage#nwlimits","note":"Running this function clientside will only set it for the client it is called on."},"realm":"Shared","args":{"arg":[{"text":"The key to associate the value with","name":"key","type":"string"},{"text":"The value to set","name":"value","type":"Vector"}]}},"example":{"description":"This will set the networked vector 'positionzero' on all clients to Vector( 0, 0, 0 ).","code":"for i, ply in ipairs( player.GetAll() ) do\n    ply:SetNWVector( 'positionzero', Vector( 0, 0, 0 ) )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetOwner","parent":"Entity","type":"classfunc","description":{"text":"Sets the owner of this entity, disabling all physics interaction with it.","note":"This function is generally used to disable physics interactions on projectiles being fired by their owner, but can also be used for normal ownership in case physics interactions are not involved at all. The Gravity gun will be able to pick up the entity even if the owner can't collide with it, the Physics gun however will not."},"realm":"Shared","args":{"arg":{"text":"The entity to be set as owner.","name":"owner","type":"Entity","default":"NULL"}}},"example":{"description":"Taken from Garry's Flechette gun , shoots a hunter's flechette and sets the owner of the flechette to the player using the weapon.","code":"function SWEP:PrimaryAttack()\n\tself:SetNextPrimaryFire( CurTime() + 0.1 )\n\t\n\tif (!SERVER) then return end\n\n\tlocal Forward = self:GetOwner():EyeAngles():Forward()\n\n\tlocal ent = ents.Create( \"hunter_flechette\" )\n\t\n\tif ( IsValid( ent ) ) then\n\n\t\tent:SetPos( self:GetOwner():GetShootPos() + Forward * 32 )\n\t\tent:SetAngles( self:GetOwner():EyeAngles() )\n\t\tent:Spawn()\n\t\tent:SetVelocity( Forward * 2000 )\n\t\tent:SetOwner( self:GetOwner() )\n\tend\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetParent","parent":"Entity","type":"classfunc","description":{"text":"Sets the parent of this entity, making it move with its parent. This will make the child entity non solid, nothing can interact with them, including traces (but util.TraceHull will work).\n\nAll children of the parent get removed whenever it gets removed.","note":"This does not work on the world.","warning":"This can cause undefined physics behavior when used on entities that don't support parenting. See the [Valve developer wiki](https://developer.valvesoftware.com/wiki/Entity_Hierarchy_(parenting)) for more information."},"realm":"Shared","args":{"arg":[{"text":"The entity to parent to. Setting this to nil will clear the parent.","name":"parent","type":"Entity","default":"NULL"},{"text":"The attachment or bone id to use when parenting. Defaults to -1 or whatever the parent had set previously.\n\nUse Entity:AddEffects( EF_FOLLOWBONE ) to treat this argument as a Bone ID instead of an Attachment ID. Similar to Entity:FollowBone.","name":"attachmentOrBoneId","type":"number","default":"-1","note":["You must call Entity:SetMoveType( MOVETYPE_NONE ) on the child for this argument to have any effect!","Parenting to attachment IDs more than `255` is unsupported and will output a LUA error."]}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetParentPhysNum","parent":"Entity","type":"classfunc","description":{"text":"Sets the parent of an entity to another entity with the given physics bone number. Similar to Entity:SetParent, except it is parented to a physbone. This function is useful mainly for ragdolls.","note":"Despite this function being available server side, it doesn't actually do anything server side."},"realm":"Shared","args":{"arg":{"text":"Physics bone number to attach to. Use 0 for objects with only one physics bone. (See Entity:GetPhysicsObjectNum)","name":"bone","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetPersistent","parent":"Entity","type":"classfunc","description":{"text":"Sets whether or not the given entity is persistent. A persistent entity will be saved on server shutdown and loaded back when the server starts up. Additionally, by default persistent entities cannot be grabbed with the physgun and tools cannot be used on them.\n\nIn sandbox, this can be set on an entity by opening the context menu, right clicking the entity, and choosing `\"Make Persistent\"`.","note":"Persistence can only be enabled with the sbox_persist convar, which works as an identifier for the current set of persistent entities. An empty identifier (which is the default value) disables this feature."},"realm":"Shared","args":{"arg":{"text":"Whether or not the entity should be persistent.","name":"persist","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetPhysConstraintObjects","parent":"Entity","type":"classfunc","description":"When called on a constraint entity, sets the two physics objects to be constrained.\n\nUsage is not recommended as the Constraint library provides easier ways to deal with constraints.","realm":"Server","args":{"arg":[{"text":"The first physics object to be constrained.","name":"Phys1","type":"PhysObj"},{"text":"The second physics object to be constrained.","name":"Phys2","type":"PhysObj"}]}},"example":{"description":"From constraint.lua","code":"Constraint = ents.Create(\"phys_lengthconstraint\")\n\tConstraint:SetPos( WPos1 )\n\tConstraint:SetKeyValue( \"attachpoint\", tostring(WPos2) )\n\tConstraint:SetKeyValue( \"minlength\", \"0.0\" )\n\tConstraint:SetKeyValue( \"length\", length + addlength )\n\tif ( forcelimit ) then Constraint:SetKeyValue( \"forcelimit\", forcelimit ) end\n\tif ( rigid ) then Constraint:SetKeyValue( \"spawnflags\", 2 ) end\n\tConstraint:SetPhysConstraintObjects( Phys1, Phys2 )\nConstraint:Spawn()\nConstraint:Activate()"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetPhysicsAttacker","parent":"Entity","type":"classfunc","description":{"text":"Sets the player who gets credit if this entity kills something with physics damage within the time limit.","note":"Only functional on props, \"anim\" type SENTs, vehicles and a few other select entities."},"realm":"Server","args":{"arg":[{"text":"Player who gets the kills. Setting this to a non-player entity will not work.","name":"ent","type":"Player"},{"text":"Time in seconds until the entity forgets its physics attacker and prevents it from getting the kill credit.","name":"timeLimit","type":"number","default":"5"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetPlaybackRate","parent":"Entity","type":"classfunc","description":{"text":"Allows you to set how fast an entity's animation will play, with 1.0 being the default speed.\n\n\t\tIt is networked to clients, but limited to [-4,12] range when networking.","note":"This function does not affect gestures.\n\t\t\tUse Entity:SetLayerPlaybackRate instead."},"realm":"Shared","args":{"arg":{"text":"How fast the animation will play.","name":"fSpeed","type":"number"}}},"example":{"description":"Makes Entity(1)'s viewmodel play animations 50% slower.","code":"Entity(1):GetViewModel():SetPlaybackRate(0.5)","output":"Entity(1)'s viewmodel now plays animations 50% slower."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetPos","parent":"Entity","type":"classfunc","description":{"text":"Moves the entity to the specified position.\n\nSome entities, such as ragdolls, will continually reset their position. Consider using PhysObj:SetPos on every physics object to move ragdolls.","note":"If the new position doesn't take effect right away, you can use Entity:SetupBones to force it to do so. This issue is especially common when trying to render the same entity twice or more in a single frame at different positions.","warning":"Entities with Entity:GetSolid of `SOLID_BBOX` will have their angles reset!","bug":{"text":"This will fail inside of predicted functions called during player movement processing. This includes WEAPON:PrimaryAttack and WEAPON:Think.","issue":"2447"}},"realm":"Shared","args":{"arg":{"text":"The position to move the entity to.","name":"position","type":"Vector"}}},"example":{"description":"Sets the player's position to (0, 0, 0)","code":"Entity( 1 ):SetPos( Vector( 0, 0, 0 ) )","output":"The player is now located at Vector(0, 0, 0)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetPoseParameter","parent":"Entity","type":"classfunc","description":{"text":"Sets the specified pose parameter to the specified value.\n\nYou should call Entity:InvalidateBoneCache after calling this function.","note":"Avoid calling this in draw hooks, especially when animating things, as it might cause visual artifacts."},"realm":"Shared","args":{"arg":[{"text":"Name of the pose parameter. Entity:GetPoseParameterName might come in handy here.\n\nCan also be a pose parameter ID.","name":"poseName","type":"string","alttype":"number"},{"text":"The value to set the pose to.","name":"poseValue","type":"number"}]}},"example":{"description":"Copies pose parameters from one entity to another. Since Entity:GetPoseParameter returns pose parameter values 0-1 on the client, they have to be remapped to the range returned by Entity:GetPoseParameterRange before being set on the target entity.","code":"local function CopyPoseParams(pEntityFrom, pEntityTo)\n\tif (SERVER) then\n\t\tfor i = 0, pEntityFrom:GetNumPoseParameters() - 1 do\n\t\t\tlocal sPose = pEntityFrom:GetPoseParameterName(i)\n\t\t\tpEntityTo:SetPoseParameter(sPose, pEntityFrom:GetPoseParameter(sPose))\n\t\tend\n\telse\n\t\tfor i = 0, pEntityFrom:GetNumPoseParameters() - 1 do\n\t\t\tlocal flMin, flMax = pEntityFrom:GetPoseParameterRange(i)\n\t\t\tlocal sPose = pEntityFrom:GetPoseParameterName(i)\n\t\t\tpEntityTo:SetPoseParameter(sPose, math.Remap(pEntityFrom:GetPoseParameter(sPose), 0, 1, flMin, flMax))\n\t\tend\n\tend\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetPredictable","parent":"Entity","type":"classfunc","description":{"text":"Sets whether an entity should be predictable or not.\nWhen an entity is set as predictable, its DT vars can be changed during predicted hooks. This is useful for entities which can be controlled by player input.\n\nAny datatable value that mismatches from the server will be overridden and a prediction error will be spewed.\n\nWeapons are predictable by default, and the drive system uses this function to make the controlled prop predictable as well.\n\nVisit  for a list of all predicted hooks, and the Prediction page.\nFor further technical information on the subject, visit [valve's wiki](https://developer.valvesoftware.com/wiki/Prediction).","note":["This function resets the datatable variables everytime it's called, it should ideally be called when a player starts using the entity and when he stops","Entities set as predictable with this function will be unmarked when the user lags and receives a full packet update, to handle such case visit GM:NotifyShouldTransmit"]},"realm":"Client","args":{"arg":{"text":"whether to make this entity predictable or not.","name":"setPredictable","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetPreventTransmit","parent":"Entity","type":"classfunc","description":{"text":"Prevents the server from sending any further information about the entity to a player.","note":"You must also call this function on all entity's children. See Entity:GetChildren.\n\n[issue tracker](https://github.com/Facepunch/garrysmod-issues/issues/1736)\n\nEntity:SetFlexScale and other flex/bone manipulation functions will create a child entity."},"realm":"Server","args":{"arg":[{"text":"The player to stop networking the entity to. Can also be a CRecipientFilter or a table as of March 2024 to affect multiple players at once.","name":"player","type":"Player|CRecipientFilter|table<Player>"},{"text":"true to stop the entity from networking, false to make it network again.","name":"stopTransmitting","type":"boolean"}]}},"example":{"description":"This will loop through all children entities of the ent passed and stop networking them too. Works with nextbots/players","code":"function RecursiveSetPreventTransmit( ent, ply, stopTransmitting )\n    if ( ent ~= ply and IsValid( ent ) and IsValid( ply ) ) then\n        ent:SetPreventTransmit( ply, stopTransmitting )\n        local tab = ent:GetChildren()\n        for i = 1, #tab do\n            RecursiveSetPreventTransmit( tab[ i ], ply, stopTransmitting )\n        end\n    end\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetRagdollAng","parent":"Entity","type":"classfunc","description":"Sets the bone angles. This is used alongside Kinect in Entity:SetRagdollBuildFunction, for more info see ragdoll_motion entity.","realm":"Server","args":{"arg":[{"text":"Bone ID","name":"boneid","type":"number"},{"text":"Angle to set","name":"pos","type":"Angle"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetRagdollBuildFunction","parent":"Entity","type":"classfunc","description":"Sets the function to build the ragdoll. This is used alongside Kinect, for more info see `ragdoll_motion` entity in the game files.","realm":"Server","args":{"arg":{"text":"The build function.","name":"builder","type":"function","callback":{"arg":{"text":"The ragdoll to build","type":"Entity","name":"ragdoll"}}}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetRagdollPos","parent":"Entity","type":"classfunc","description":"Sets the bone position. This is used alongside Kinect in Entity:SetRagdollBuildFunction, for more info see ragdoll_motion entity.","realm":"Server","args":{"arg":[{"text":"Bone ID","name":"boneid","type":"number"},{"text":"Position to set","name":"pos","type":"Vector"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetRenderAngles","parent":"Entity","type":"classfunc","description":"Sets the render angles override for the entity. Entity:GetAngles will return the value set by this function until the override is disabled. (This is all this does internally)\n\nSee Entity:SetRenderOrigin for the function to manipulate origin.\n\nNot to be confused with Player:SetRenderAngles.","realm":"Client","file":{"text":"lua/includes/extensions/client/entity.lua","line":"16"},"args":{"arg":{"text":"The new render angles to be set to. To disable the override, set to nil.","name":"newAngles","type":"Angle|nil","default":"nil"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetRenderBounds","parent":"Entity","type":"classfunc","description":"Sets the render bounds for the entity.\n\nFor world space coordinate alternative see Entity:SetRenderBoundsWS.","realm":"Client","args":{"arg":[{"text":"The minimum corner of the bounds, relative to origin of the entity.","name":"mins","type":"Vector"},{"text":"The maximum corner of the bounds, relative to origin of the entity.","name":"maxs","type":"Vector"},{"text":"If defined, adds this vector to maxs and subtracts this vector from mins.","name":"add","type":"Vector","default":"Vector( 0, 0, 0 )"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetRenderBoundsWS","parent":"Entity","type":"classfunc","description":"Sets the render bounds for the entity in world space coordinates. For relative coordinates see Entity:SetRenderBounds.","realm":"Client","args":{"arg":[{"text":"The minimum corner of the bounds, relative to origin of the world/map.","name":"mins","type":"Vector"},{"text":"The maximum corner of the bounds, relative to origin of the world/map.","name":"maxs","type":"Vector"},{"text":"If defined, adds this vector to maxs and subtracts this vector from mins.","name":"add","type":"Vector","default":"Vector( 0, 0, 0 )"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetRenderClipPlane","parent":"Entity","type":"classfunc","description":"Used to specify a plane, past which an object will be visually clipped.","realm":"Client","args":{"arg":[{"text":"The normal of the plane. Anything behind the normal will be clipped.","name":"planeNormal","type":"Vector"},{"text":"The position of the plane.","name":"planePosition","type":"number"}]}},"example":{"description":"Creates a blue barrel at `Vector( 0, 0, 0 )`, freezes it, and will visually clip the barrel's lower half.","code":"local ent = ents.CreateClientProp( \"models/props_borealis/bluebarrel001.mdl\" )\nent:SetPos( Vector(0, 0, 0) )\nent:Spawn()\nent:GetPhysicsObject():EnableMotion( false )\n\nlocal normal = ent:GetUp()\nlocal position = normal:Dot( ent:GetPos() )\nent:SetRenderClipPlaneEnabled( true )\nent:SetRenderClipPlane( normal, position )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetRenderClipPlaneEnabled","parent":"Entity","type":"classfunc","description":"Enables the use of clipping planes to \"cut\" objects.","realm":"Client","args":{"arg":{"text":"Enable or disable clipping planes","name":"enabled","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetRenderFX","parent":"Entity","type":"classfunc","description":"Sets entity's render FX. Requires the entitys rendermode to support transparency.","realm":"Shared","args":{"arg":{"text":"The new render FX to set, see Enums/kRenderFx","name":"renderFX","type":"number"}}},"example":{"description":"Fades a entity out and removes it.","code":"local ent = Entity( 5 )\nent:SetRenderMode( RENDERMODE_TRANSCOLOR )\nent:SetRenderFX( kRenderFxFadeSlow )\n\ntimer.Simple( 3, function()\n\tSafeRemoveEntity( ent )\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetRenderMode","parent":"Entity","type":"classfunc","description":"Sets the render mode of the entity.","realm":"Shared","args":{"arg":{"text":"New render mode to set, see Enums/RENDERMODE.","name":"renderMode","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetRenderOrigin","parent":"Entity","type":"classfunc","description":"Sets the render origin override, a position where the entity will be rendered at. Entity:GetPos will return the value set by this function until the override is disabled. (This is all this does internally)\n\nSee Entity:SetRenderAngles for the function to manipulate angles.","realm":"Client","file":{"text":"lua/includes/extensions/client/entity.lua","line":"17"},"args":{"arg":{"text":"The new origin in world coordinates where the entity's model will now be rendered at. To disable the override, set to nil.","name":"newOrigin","type":"Vector|nil","default":"nil"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetSaveValue","parent":"Entity","type":"classfunc","description":"Sets a save value for an entity. You can see a full list of an entity's save values by creating it and printing Entity:GetSaveTable.\n\nSee Entity:GetInternalVariable for the opposite of this function.","realm":"Shared","args":{"arg":[{"text":"Name of the save value to set","name":"name","type":"string"},{"text":"Value to set","name":"value","type":"any"}]},"rets":{"ret":{"text":"Key successfully set","name":"","type":"boolean"}}},"example":{"description":"Make all rollermines currently on the map friendly","code":"for i, mine in ipairs( ents.FindByClass( \"npc_rollermine\" ) ) do\n   mine:SetSaveValue( \"m_bHackedByAlyx\", true )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetSequence","parent":"Entity","type":"classfunc","description":{"text":"Sets the entity's model sequence.\n\nIf the specified sequence is already active, the animation will not be restarted. See Entity:ResetSequence for a function that restarts the animation even if it is already playing.\n\nIn some cases you want to run Entity:ResetSequenceInfo to make this function run.","note":"This will not work properly if called directly after calling Entity:SetModel. Consider waiting until the next Tick.\n\nWill not work on players due to the animations being reset every frame by the base gamemode animation system. See GM:CalcMainActivity.\n\nFor custom scripted entities you will want to apply example from ENTITY:Think to make animations work."},"realm":"Shared","args":{"arg":{"text":"The sequence to play.\n\nIf set to a number, the input is treated as the sequence ID.  \nIf set to a string, the function will automatically call Entity:LookupSequence to retrieve the sequence ID.","name":"sequence","type":"number","alttype":"string"}}},"example":[{"description":"Set the entity to play the \"idle\" sequence.","code":"self:SetSequence( \"idle\" )"},{"description":"Set the entity to play the first sequence defined on the model (usually idle).","code":"self:SetSequence( 0 )"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetShouldPlayPickupSound","parent":"Entity","type":"classfunc","description":"Sets whether or not the entity should make a physics contact sound when it's been picked up by a player.","realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"11-L13"},"args":{"arg":{"text":"True to play the pickup sound, false otherwise.","name":"playsound","type":"boolean","default":"false"}}},"example":{"description":"Enable pickup sound on all entities.","code":"function GM:OnEntityCreated(ent)\n    ent:SetShouldPlayPickupSound(true)\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetShouldServerRagdoll","parent":"Entity","type":"classfunc","description":{"text":"Sets if entity should create a server ragdoll on death or a client one.","note":"This is reset for players when they respawn (Entity:Spawn).\n\nPlayer ragdolls created with this enabled will have an owner set, see Entity:SetOwner for more information on what effects this has."},"realm":"Shared","args":{"arg":{"text":"Set `true` if ragdoll should be created on server, `false` if on client.","name":"serverragdoll","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetSkin","parent":"Entity","type":"classfunc","description":"Sets the skin of the entity.\n\nEntity:GetSkin returns current skin and Entity:SkinCount returns amount of skins.","realm":"Shared","args":{"arg":{"text":"0-based index of the skin to use.","name":"skinIndex","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetSolid","parent":"Entity","type":"classfunc","description":"Sets the solidity of an entity.","realm":"Shared","args":{"arg":{"text":"The solid type. See the Enums/SOLID.","name":"solid_type","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetSolidFlags","parent":"Entity","type":"classfunc","description":"Sets solid flag(s) for the entity.\n\nThis overrides any other flags the entity might have had. See Entity:AddSolidFlags for adding flags.","realm":"Shared","args":{"arg":{"text":"The flag(s) to set, see Enums/FSOLID.","name":"flags","type":"number{FSOLID}"}}},"example":{"description":"Mimics Entity:SetTrigger call on the entity and adds FSOLID_USE_TRIGGER_BOUNDS flag to it.","code":"ent:SetSolidFlags( bit.bor( FSOLID_TRIGGER, FSOLID_USE_TRIGGER_BOUNDS ) )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetSpawnEffect","parent":"Entity","type":"classfunc","description":{"text":"Sets whether the entity should use a spawn effect when it is created on the client.\n\nSee Entity:GetSpawnEffect for more information on how the effect is applied.","note":"This function will only have an effect when the entity spawns. After that it will do nothing even is set to true."},"realm":"Shared","args":{"arg":{"text":"Sets if we should show a spawn effect.","name":"spawnEffect","type":"boolean"}}},"example":{"description":"Simplified code taken from sandbox's commands.lua","code":"local function MakeRagdoll( Player, Pos, Ang, Model, PhysicsObjects, Data )\n\n\tlocal Ent = ents.Create( \"prop_ragdoll\" )\n\tduplicator.DoGeneric( Ent, Data )\n\tEnt:Spawn()\n\t\n\tduplicator.DoGenericPhysics( Ent, Player, Data )\n\tEnt:Activate()\n\n\tEnt:SetSpawnEffect( true )\n\treturn Ent\t\nend","output":"Spawns the ragdoll and then sets the spawnEffect flag to true."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetSpawnFlags","parent":"Entity","type":"classfunc","description":{"text":"Sets the SpawnFlags to set of an Entity\n\nSpawnFlags can easily be found on https://developer.valvesoftware.com/wiki/.","note":"See also Entity:RemoveSpawnFlags, Entity:AddSpawnFlags \n\n\t\tUsing SF Enumerations won't work, if this function is ran clientside due to the enumerations being defined only Serverside. Use the actual SpawnFlag number."},"added":"2024.12.04","realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"7-L9"},"args":{"arg":{"text":"The SpawnFlag to remove from the Entity","name":"flags","type":"number"}}},"example":{"description":"When a turret Entity is created, if it doesn't have the SpawnFlags `Out of Ammo` and `Fast Retire`, then it sets it's SpawnFlags to just them two.","code":"hook.Add( \"OnEntityCreated\", \"SetSpawnFlagsExample\", function( ent )\n\ttimer.Simple( 0.1, function()\n\t\tif ( !IsValid(ent) or ent:GetClass() != \"npc_turret_floor\" ) then return end\n\t\tif ( !ent:HasSpawnFlags(256) and !ent:HasSpawnFlags(128) ) then return end\n\n\t\tent:SetSpawnFlags( bit.bor( ent:GetSpawnFlags(), 256, 128 ) ) -- https://developer.valvesoftware.com/wiki/Npc_turret_floor#Flags\n\tend )\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetSubMaterial","parent":"Entity","type":"classfunc","description":{"text":"Overrides a single material on the model of this entity.\n\nTo set a Lua material created with Global.CreateMaterial, just prepend a `!` to the material name.","validate":"The index argument limit seems to be larger than 0 to 31.","bug":{"text":"The server's value takes priority on the client.","issue":"3362"}},"realm":"Shared","args":{"arg":[{"text":"Index of the material to override, acceptable values are from `0` to `31`.\n\nIndexes are by Entity:GetMaterials, but you have to subtract `1` from them.","name":"index","type":"number","default":"nil","note":"If called with no arguments, all sub materials will be reset."},{"text":"The material to override the default one with. Set to nil to revert to default material.","name":"material","type":"string","default":"nil"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetSurroundingBounds","parent":"Entity","type":"classfunc","added":"2023.01.25","description":"Sets the axis-aligned bounding box (AABB) for an entity's hitbox detection.\n\n\tSee also Entity:SetSurroundingBoundsType (mutually exclusive).","realm":"Shared","args":{"arg":[{"text":"Minimum extent of the AABB relative to entity's position.","name":"min","type":"Vector"},{"text":"Maximum extent of the AABB relative to entity's position.","name":"max","type":"Vector"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetSurroundingBoundsType","parent":"Entity","type":"classfunc","added":"2023.01.25","description":"Automatically sets the axis-aligned bounding box (AABB) for an entity's hitbox detection.\n\n\tSee also Entity:SetSurroundingBounds (mutually exclusive).","realm":"Shared","args":{"arg":{"text":"Bounds type of the entity, see Enums/BOUNDS","name":"bounds","type":"number{BOUNDS}"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetTable","parent":"Entity","type":"classfunc","description":{"text":"Changes the table that can be accessed by indexing an entity. Each entity starts with its own table by default.","internal":""},"realm":"Shared","args":{"arg":{"text":"Table for the entity to use","name":"tab","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetTransmitWithParent","parent":"Entity","type":"classfunc","description":{"text":"When this flag is set the entity will only transmit to the player when its parent is transmitted. This is useful for things like viewmodel attachments since without this flag they will transmit to everyone (and cause the viewmodels to transmit to everyone too).","note":"In the case of scripted entities, this will override ENTITY:UpdateTransmitState"},"realm":"Shared","args":{"arg":{"text":"Will set the TransmitWithParent flag on or off","name":"onoff","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetTrigger","parent":"Entity","type":"classfunc","description":"Marks the entity as a trigger, so it will generate ENTITY:StartTouch, ENTITY:Touch and ENTITY:EndTouch callbacks.\n\nInternally this is stored as FSOLID_TRIGGER flag.","realm":"Server","args":{"arg":{"text":"Make the entity trigger or not","name":"maketrigger","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetUnFreezable","parent":"Entity","type":"classfunc","description":"Sets whether an entity can be unfrozen, meaning that it cannot be unfrozen using the physgun.","realm":"Server","file":{"text":"lua/includes/extensions/entity.lua","line":"594-L596"},"args":{"arg":{"text":"True to make the entity unfreezable, false otherwise.","name":"freezable","type":"boolean","default":"false"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetupBones","parent":"Entity","type":"classfunc","description":{"text":"Forces the entity to reconfigure its bones. You might need to call this after changing your model's scales or when manually drawing the entity multiple times at different positions.","note":"This calls the BuildBonePositions callback added via Entity:AddCallback, so avoid calling this function inside it to prevent an infinite loop."},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetupPhonemeMappings","parent":"Entity","type":"classfunc","description":{"text":"Initializes the class names of an entity's phoneme mappings (mouth movement data). This is called by default with argument \"phonemes\" when a flex-based entity (such as an NPC) is created.","note":"TF2 phonemes can be accessed by using a path such as \"player/scout/phonemes/phonemes\" , check TF2's \"tf2_misc_dir.vpk\" with GCFScape for other paths, however it seems that TF2 sounds don't contain phoneme definitions anymore after being converted to mp3 and only rely on VCD animations, this needs to be further investigated"},"realm":"Client","args":{"arg":{"text":"The file prefix of the phoneme mappings (relative to \"garrysmod/expressions/\").","name":"fileRoot","type":"string"}}},"example":{"description":"Defines a function that can enable or disable phoneme mappings on an entity.","code":"-- Turn phoneme mappings on or off\nfunction EnablePhonemes(ent, on)\n\n\tif(!IsValid(ent)) then return end\n\t\n\tif(!on) then\n\t\t-- Disable mouth movement\n\t\tent:SetupPhonemeMappings(\"\")\n\telse\n\t\t-- Enable mouth movement\n\t\tent:SetupPhonemeMappings(\"phonemes\")\n\tend\n\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetUseType","parent":"Entity","type":"classfunc","description":"Sets the use type of an entity, affecting how often ENTITY:Use will be called for Lua entities.","realm":"Server","args":{"arg":{"text":"The use type to apply to the entity. Uses Enums/_USE.","name":"useType","type":"number{_USE}"}}},"example":{"description":"Makes the ENTITY:Use hook only get called once at every use.","code":"Entity:SetUseType( SIMPLE_USE )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetVar","parent":"Entity","type":"classfunc","description":{"text":"Allows to quickly set variable to entity's Entity:GetTable.","note":"This will not network the variable to client(s). You want Entity:SetNWString and similar functions for that"},"realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"102-L106"},"args":{"arg":[{"text":"Key of the value to set","name":"key","type":"any"},{"text":"Value to set the variable to","name":"value","type":"any"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetVelocity","parent":"Entity","type":"classfunc","description":{"text":"Sets the entity's velocity. For entities with physics, consider using PhysObj:SetVelocity on the PhysObj of the entity.","note":"Actually binds to CBaseEntity::SetBaseVelocity() which sets the entity's velocity due to forces applied by other entities.","warning":"If applied to a player, this will actually **ADD** velocity, not set it. (due to how movement code handles base velocity)"},"realm":"Shared","args":{"arg":{"text":"The new velocity to set.","name":"velocity","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetWeaponModel","parent":"Entity","type":"classfunc","description":{"text":"Sets the model and associated weapon to this viewmodel entity.\n\nThis is used internally when the player switches weapon.","note":"View models are not drawn without a weapons associated to them.","warning":"This will silently fail if the entity is not a viewmodel."},"realm":"Shared","args":{"arg":[{"text":"The model string to give to this viewmodel.\nExample: \"models/weapons/c_smg1.mdl\"","name":"viewModel","type":"string"},{"text":"The weapon entity to associate this viewmodel to.","name":"weapon","type":"Weapon","default":"NULL"}]}},"example":[{"description":"Sets the model of the second viewmodel to the smg and associates it with the player's current weapon.","code":"Entity( 1 ):GetViewModel( 1 ):SetWeaponModel( \"models/weapons/c_smg1.mdl\", Entity( 1 ):GetActiveWeapon() )"},{"description":"Initializes the extra viewmodel in Deploy and hides it again on Holster, also plays the attack animation on left and right click.","code":"SWEP.ViewModel = \"models/weapons/v_pistol.mdl\"\nSWEP.UseHands = false\nSWEP.ViewModelFlip = false\t--the default viewmodel won't be flipped\nSWEP.ViewModelFlip1 = true\t--the second viewmodel will\n\n\nfunction SWEP:Deploy()\n\t--get the second viewmodel\n\tlocal viewmodel1 = self:GetOwner():GetViewModel( 1 )\n\tif ( IsValid( viewmodel1 ) ) then\n\t\t--associate its weapon to us\n\t\tviewmodel1:SetWeaponModel( self.ViewModel , self )\n\tend\n\t\n\tself:SendViewModelAnim( ACT_VM_DEPLOY , 1 )\n\t\n\treturn true\nend\n\nfunction SWEP:Holster()\n\tlocal viewmodel1 = self:GetOwner():GetViewModel( 1 )\n\tif ( IsValid( viewmodel1 ) ) then\n\t\t--set its weapon to nil, this way the viewmodel won't show up again\n\t\tviewmodel1:SetWeaponModel( self.ViewModel , nil )\n\tend\n\t\n\treturn true\nend\n\n--since self:SendWeaponAnim always sends the animation to the first viewmodel, we need this as a replacement\nfunction SWEP:SendViewModelAnim( act , index , rate )\n\t\n\tif ( not game.SinglePlayer() and not IsFirstTimePredicted() ) then\n\t\treturn\n\tend\n\t\n\tlocal vm = self:GetOwner():GetViewModel( index )\n\t\n\tif ( not IsValid( vm ) ) then\n\t\treturn\n\tend\n\t\n\tlocal seq = vm:SelectWeightedSequence( act )\n\t\n\tif ( seq == -1 ) then\n\t\treturn\n\tend\n\t\n\tvm:SendViewModelMatchingSequence( seq )\n\tvm:SetPlaybackRate( rate or 1 )\nend\n\nfunction SWEP:PrimaryAttack()\n\t\n\tself:SendViewModelAnim( ACT_VM_PRIMARYATTACK , 0 )--target the first viewmodel\n\tself:SetNextPrimaryFire( CurTime() + 0.25 )\n\t\nend\n\nfunction SWEP:SecondaryAttack()\n\t\n\tself:SendViewModelAnim( ACT_VM_PRIMARYATTACK , 1 )--target the second\n\tself:SetNextSecondaryFire( CurTime() + 0.25 )\n\t\nend","output":{"image":{"src":"SetWeaponModelExample.jpg","alt":"thumb|center"}}}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SkinCount","parent":"Entity","type":"classfunc","description":"Returns the amount of skins the entity has.\n\nTo set the entity's skin, use Entity:SetSkin.\nTo retrieve the total number of skins without an entity, see util.GetModelInfo.","realm":"Shared","rets":{"ret":{"text":"The amount of skins the entity's model has.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SnatchModelInstance","parent":"Entity","type":"classfunc","description":"Moves the model instance from the source entity to this entity. This can be used to transfer decals that have been applied on one entity to another.\n\nBoth entities must have the same model.","realm":"Client","args":{"arg":{"text":"Entity to move the model instance from.","name":"srcEntity","type":"Entity"}},"rets":{"ret":{"text":"Whether the operation was successful or not","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Spawn","parent":"Entity","type":"classfunc","description":"Initializes the entity and starts its networking. If called on a player, it will respawn them.\n\nThis calls ENTITY:Initialize on Lua-defined entities.","realm":"Shared"},"example":{"description":"Server sided script for spawning entities","code":"local ent = ents.Create(\"Enter Entity Class\")\n\t\t\n\t\t-- Sets the position of the entity\n\t\tent:SetPos(Vector(0.0, 100, 0.0)) \n\t\t-- Sets the angle of the entity\n\t\tent:SetAngles(Angle(0.0, 90.0, 0.0)) \n\t\t-- Spawns the entity on all clients\n\t\tent:Spawn()","output":"Spawns entity on position(0.0, 100.0, 0.0) facing (0.0, 90.0, 0.0) for all clients connects to the server"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"StartLoopingSound","parent":"Entity","type":"classfunc","description":"Starts a \"looping\" sound. As with any other sound playing methods, this function expects the sound file to be looping itself and will not automatically loop a non looping sound file as one might expect.\n\nThis function is almost identical to Global.CreateSound, with the exception of the sound being created in the STATIC channel and with normal attenuation.\n\nSee also Entity:StopLoopingSound","realm":"Shared","args":{"arg":{"text":"Sound to play. Can be either a sound script or a filepath.","name":"sound","type":"string"}},"rets":{"ret":{"text":"The ID number of started sound starting with 0, or -1 if we failed for some reason.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"StartMotionController","parent":"Entity","type":"classfunc","description":{"text":"Starts a motion controller in the physics engine tied to this entity's PhysObj, which enables the use of ENTITY:PhysicsSimulate.\n\nThe motion controller can later be destroyed via Entity:StopMotionController.\n\nMotion controllers are used internally to control other Entities' PhysObjects, such as the Gravity Gun, +use pickup and the Physics Gun.\n\nThis function should be called every time you recreate the Entity's PhysObj. Or alternatively you should call Entity:AddToMotionController on the new PhysObj.\n\nAlso see Entity:AddToMotionController and Entity:RemoveFromMotionController.","note":"Only works on a scripted Entity of anim type."},"realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"StopAndDestroyParticles","parent":"Entity","type":"classfunc","description":"Stops all particle effects parented to the entity and immediately destroys them.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"StopLoopingSound","parent":"Entity","type":"classfunc","description":"Stops a sound created by Entity:StartLoopingSound.","realm":"Shared","args":{"arg":{"text":"The sound ID returned by Entity:StartLoopingSound","name":"id","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"StopMotionController","parent":"Entity","type":"classfunc","description":"Stops the motion controller created with Entity:StartMotionController.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"StopParticleEmission","parent":"Entity","type":"classfunc","description":"Stops all particle effects parented to the entity.\n\nThis is ran automatically on every client by Entity:StopParticles if called on the server.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"StopParticles","parent":"Entity","type":"classfunc","description":"Stops any attached to the entity .pcf particles using Global.ParticleEffectAttach or Global.ParticleEffect.\n\nOn client, this is the same as Entity:StopParticleEmission. ( and you should use StopParticleEmission instead )\n\n\nOn server, this is the same as running Entity:StopParticleEmission on every client.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"StopParticlesNamed","parent":"Entity","type":"classfunc","description":"Stops all particle effects parented to the entity with given name.","realm":"Client","args":{"arg":{"text":"The name of the particle to stop.","name":"name","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"StopParticlesWithNameAndAttachment","parent":"Entity","type":"classfunc","description":"Stops all particle effects parented to the entity with given name on given attachment.","realm":"Client","args":{"arg":[{"text":"The name of the particle to stop.","name":"name","type":"string"},{"text":"The attachment of the entity to stop particles on.","name":"attachment","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"StopSound","parent":"Entity","type":"classfunc","description":"Stops emitting the given sound from the entity, especially useful for looping sounds.\n\nInternally plays the sound with the SND_STOP flag to stop the sound.","realm":"Shared","args":{"arg":{"text":"The name of the sound script or the filepath to stop playback of.","name":"sound","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"TakeDamage","parent":"Entity","type":"classfunc","description":{"text":"Applies the specified amount of damage to the entity with DMG_GENERIC flag.","warning":["Calling this function on the victim entity in ENTITY:OnTakeDamage can cause infinite loops.","This function does not seem to do any damage if you apply it to a player who is driving a prop_vehicle_jeep or prop_vehicle_jeep_old vehicle. You need to call it on the vehicle instead."]},"realm":"Server","args":{"arg":[{"text":"The amount of damage to be applied.","name":"damageAmount","type":"number"},{"text":"The entity that initiated the attack that caused the damage.","name":"attacker","type":"Entity","default":"nil"},{"text":"The entity that applied the damage, eg. a weapon.","name":"inflictor","type":"Entity","default":"nil"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"TakeDamageInfo","parent":"Entity","type":"classfunc","description":{"text":"Applies the damage specified by the damage info to the entity.","warning":["Calling this function on the victim entity in ENTITY:OnTakeDamage can cause infinite loops.","This function does not seem to do any damage if you apply it to a player who is driving a prop_vehicle_jeep or prop_vehicle_jeep_old vehicle. You need to call it on the vehicle instead."],"note":"This function does not apply damage to [func_breakable_surf](https://developer.valvesoftware.com/wiki/Func_breakable_surf) entities correctly. To do this, you will need to use Entity:DispatchTraceAttack instead."},"realm":"Server","args":{"arg":{"text":"The damage to apply.","name":"damageInfo","type":"CTakeDamageInfo"}}},"example":[{"description":"Dissolve the target into oblivion.","code":"function DissolveIt( ent, ply )\n\tlocal d = DamageInfo()\n\td:SetDamage( ent:Health() )\n\td:SetAttacker( ply or ent )\n\td:SetDamageType( DMG_DISSOLVE ) \n\n\tent:TakeDamageInfo( d )\nend\nconcommand.Add( \"dissolve_it\", function( ply, cmd, arg )\n\tlocal ent = ply:GetEyeTrace().Entity\n\tif ( !IsValid( ent ) ) then return end -- Not looking at a valid entity\n\n\tDissolveIt( ent, ply )\nend )"},{"description":"Damage the vehicle if you need to kill the player inside.","code":"function TakeDamage( victim, damage, attacker, inflictor )\n\tlocal dmg = DamageInfo() -- Create a server-side damage information class\n\tdmg:SetDamage( damage )\n\tdmg:SetAttacker( attacker )\n\tdmg:SetInflictor( inflictor )\n\tdmg:SetDamageType( DMG_ENERGYBEAM )\n\tvictim:TakeDamageInfo( dmg )\nend\n\nconcommand.Add( \"kill_this_entity\", function( ply, cmd, args )\n\tlocal target = ply:GetEyeTrace().Entity\n\tif ( target:IsVehicle() ) then\n\t\ttarget = target:GetDriver() -- Convert this to damage the plater inside\n\tend\n\n\t-- When target is a player in a vehicle will not get damaged\n\tTakeDamage( target, target:Health(), ply, ply:GetActiveWeapon() )\nend )"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"TakePhysicsDamage","parent":"Entity","type":"classfunc","description":"Applies forces to our physics object in response to damage.","realm":"Server","args":{"arg":{"text":"The damageinfo to apply. Only CTakeDamageInfo:GetDamageForce and CTakeDamageInfo:GetDamagePosition are used.","name":"dmginfo","type":"CTakeDamageInfo"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"TestPVS","parent":"Entity","type":"classfunc","description":{"text":"Check if the given position or entity is within this entity's [PVS(Potential Visibility Set)](https://developer.valvesoftware.com/wiki/PVS \"PVS - Valve Developer Community\").\n\nSee also Entity:IsDormant.","note":"The function won't take in to account Global.AddOriginToPVS and the like."},"realm":"Server","args":{"arg":{"text":"Entity or Vector to test against. If an entity is given, this function will test using its bounding box.","name":"testPoint","type":"Vector|Entity"}},"rets":{"ret":{"text":"`true` if the testPoint is within our PVS.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"TranslateBoneToPhysBone","parent":"Entity","type":"classfunc","description":"Returns the ID of a PhysObj attached to the given bone.\n\nSee Entity:TranslatePhysBoneToBone for reverse function.","realm":"Shared","args":{"arg":{"text":"The ID of a bone to look up the \"physics root\" bone of.","name":"boneID","type":"number"}},"rets":{"ret":{"text":"The PhysObj ID of the given bone to be used with Entity:GetPhysicsObjectNum or `-1` if we cannot translate for some reason, such as a model bone having no physics object associated with it.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"TranslatePhysBoneToBone","parent":"Entity","type":"classfunc","description":"Returns the boneID of the bone the given PhysObj is attached to.\n\nSee Entity:TranslateBoneToPhysBone for reverse function.","realm":"Shared","args":{"arg":{"text":"The PhysObj number on the entity","name":"physNum","type":"number"}},"rets":{"ret":{"text":"The boneID of the bone the PhysObj is attached to.","name":"","type":"number"}}},"example":{"description":"Does a trace, gets the physics bone from the trace, converts the physics bone number into the bone number and prints the result","code":"concommand.Add( \"boneid\", function( ply )\n\tlocal tr = ply:GetEyeTrace()\n\tlocal bone = tr.Entity:TranslatePhysBoneToBone( tr.PhysicsBone )\n\tprint( bone )\n\tply:ChatPrint( bone )\nend )","output":"The bone number of what the client is looking at"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"UpdateBoneFollowers","parent":"Entity","type":"classfunc","description":{"text":"Updates positions of bone followers created by Entity:CreateBoneFollowers.\n\nThis should be called every tick.","note":"This function only works on `anim`, `nextbot` and `ai` type entities."},"realm":"Server","added":"2021.01.27"},"realms":["Server"],"type":"Function"},
{"function":{"name":"UpdateShadow","parent":"Entity","type":"classfunc","description":"Marks the render-to-texture (RTT) shadow of this entity as dirty, as well as any potential projected texture shadows related to this entity, so they will be updated as soon as possible.","realm":"Client","added":"2019.10.23"},"realms":["Client"],"type":"Function"},
{"ambig":{"text":"You might be looking for the \"ENTITY:Use\" hook, which has the same name as this method.","page":"ENTITY:Use"},"function":{"name":"Use","parent":"Entity","type":"classfunc","description":"Simulates a `+use` action on an entity.","realm":"Server","args":{"arg":[{"text":"The entity that caused this input. This will usually be the player who pressed their use key","name":"activator","type":"Entity"},{"text":"The entity responsible for the input. This will typically be the same as `activator` unless some other entity is acting as a proxy","name":"caller","type":"Entity","default":"NULL"},{"text":"Use type, see Enums/USE.","name":"useType","type":"number{USE}","default":"USE_ON"},{"text":"Any value.","name":"value","type":"number","default":"0"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"UseClientSideAnimation","parent":"Entity","type":"classfunc","description":{"text":"Animations will be handled purely clientside instead of a fixed animtime, enabling interpolation. This does not affect layers and gestures.","note":"Does nothing on server."},"realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"UseTriggerBounds","parent":"Entity","type":"classfunc","description":{"text":"Enables or disables trigger bounds.\n\nThis will give the entity a \"trigger box\" that extends around its bounding box by boundSize units in X/Y and (boundSize / 2) in +Z (-Z remains the same).\nThe trigger box is world aligned and will work regardless of the object's solidity and collision group.\n\nValve use trigger boxes for all pickup items. Their bloat size is 24, a surprisingly large figure.","note":"The trigger boxes can be made visible as a light blue box by using the **ent_bbox** console command while looking at the entity. Alternatively a classname or entity index can be used as the first argument.\n\nThis requires **developer** to be set to **1**."},"realm":"Shared","args":{"arg":[{"text":"Enable or disable the bounds.","name":"enable","type":"boolean"},{"text":"The distance/size of the trigger bounds.","name":"boundSize","type":"number","default":"0"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ViewModelIndex","parent":"Entity","type":"classfunc","description":"Returns the index of this view model, it can be used to identify which one of the player's view models this entity is.","realm":"Shared","rets":{"ret":{"text":"View model index, ranges from 0 to 2, nil if the entity is not a view model","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Visible","parent":"Entity","type":"classfunc","description":"Returns whether the target/given entity is visible from the this entity.\n\nThis is meant to be used only with NPCs.\n\nDifferences from a simple trace include:\n* If target has `FL_NOTARGET`, returns `false`\n* If `ai_ignoreplayers` is turned on and target is a player, returns `false`\n* Reacts to `ai_LOS_mode`:\n* * If `1`, does a simple trace with `COLLISION_GROUP_NONE` and `MASK_BLOCKLOS`\n* * If not, does a trace with `MASK_BLOCKLOS_AND_NPCS` (- `CONTENTS_BLOCKLOS` is target is player) and a custom LOS filter (`CTraceFilterLOS`)\n* Returns `true` if hits a vehicle the target is driving","realm":"Server","args":{"arg":{"text":"Entity to check for visibility to.","name":"target","type":"Entity"}},"rets":{"ret":{"text":"If the entities can see each other.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"VisibleVec","parent":"Entity","type":"classfunc","description":"Returns true if supplied vector is visible from the entity's line of sight.\n\nThis is achieved similarly to a trace.","realm":"Server","args":{"arg":{"text":"The position to check for visibility","name":"pos","type":"Vector"}},"rets":{"ret":{"text":"Within line of sight","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"WaterLevel","parent":"Entity","type":"classfunc","description":"Returns an integer that represents how deep in water the entity is.","realm":"Shared","rets":{"ret":{"text":"The water level.\n* **0** - The entity isn't in water.\n* **1** - Slightly submerged (at least to the feet).\n* **2** - The majority of the entity is submerged (at least to the waist).\n* **3** - Completely submerged.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Weapon_SetActivity","parent":"Entity","type":"classfunc","description":{"text":"Sets the activity of the entity's active weapon.","note":["This does nothing on the client.","Only works for CBaseCombatCharacter entities, which includes players and NPCs."]},"realm":"Shared","args":{"arg":[{"text":"Activity number. See Enums/ACT.","name":"act","type":"number"},{"text":"How long the animation should take in seconds.","name":"duration","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Weapon_TranslateActivity","parent":"Entity","type":"classfunc","description":{"text":"Calls and returns WEAPON:TranslateActivity on the weapon the entity (player or NPC) carries.","note":"Doesn't return anything on client, despite existing there."},"realm":"Shared","args":{"arg":{"text":"The NPC activity to translate","name":"act","type":"number"}},"rets":{"ret":{"text":"The translated activity. Defaults to `act` input when a translation doesn't exist.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WorldSpaceAABB","parent":"Entity","type":"classfunc","description":"Returns two vectors representing the minimum and maximum extent of the entity's axis-aligned bounding box (which is calculated from entity's collision bounds.","realm":"Shared","rets":{"ret":[{"text":"The minimum vector for the entity's bounding box in world space.","name":"","type":"Vector"},{"text":"The maximum vector for the entity's bounding box in world space.","name":"","type":"Vector"}]}},"example":[{"description":"Prints Entity(1)'s maximum bounding box vector.","code":"local min, max = Entity(1):WorldSpaceAABB()\nprint( max )","output":"-496.828125 11730.426758 5189.393066"},{"description":"With `developer` set to `1`, draws the AABB of given entity using debugoverlay.","code":"local e = Entity(123)\n\nlocal mi2, ma2 = e:WorldSpaceAABB()\n\ndebugoverlay.Box( vector_origin, mi2, ma2, 10,  Color( 255, 255, 255, 32 ) )","output":{"upload":{"src":"70c/8da74add0f1dc5b.png","size":"566262","name":"image.png"}}}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WorldSpaceCenter","parent":"Entity","type":"classfunc","description":"Returns the center of the entity according to its collision model.","realm":"Shared","rets":{"ret":{"text":"The center of the entity","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WorldToLocal","parent":"Entity","type":"classfunc","description":"Translates a worldspace vector into a vector relative to the entity's coordinate system.","realm":"Shared","args":{"arg":{"text":"A worldspace vector.","name":"wpos","type":"Vector"}},"rets":{"ret":{"text":"The corresponding local space vector.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WorldToLocalAngles","parent":"Entity","type":"classfunc","description":"Translates a worldspace angle into an angle relative to the entity's coordinate system.","realm":"Shared","args":{"arg":{"text":"A worldspace angle.","name":"ang","type":"Angle"}},"rets":{"ret":{"text":"The corresponding local space angle.","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Close","parent":"File","type":"classfunc","description":"Dumps the file changes to disk and closes the file handle which makes the handle useless.","realm":"Shared and Menu"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"EndOfFile","parent":"File","type":"classfunc","description":"Returns whether the File object has reached the end of file or not.","realm":"Shared and Menu","added":"2020.03.17","rets":{"ret":{"text":"Whether the file has reached end or not.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Flush","parent":"File","type":"classfunc","description":"Dumps the file changes to disk and saves the file.","realm":"Shared and Menu"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Read","parent":"File","type":"classfunc","args":{"arg":{"text":"Reads the specified amount of chars. If not set, will read the entire file.","name":"length","type":"number","default":"nil"}},"rets":{"ret":{"text":"The read data.","name":"data","type":"string"}},"description":"Reads the specified amount of chars and returns them as a binary string.","realm":"Shared and Menu"},"example":{"description":"Adapted from extensions/file.lua","code":"function file.Read( filename, path )\n\n\tif ( path == true ) then path = \"GAME\" end\n\tif ( path == nil || path == false ) then path = \"DATA\" end\n\n\tlocal f = file.Open( filename, \"rb\", path )\n\tif ( !f ) then return end\n\n\tlocal str = f:Read( f:Size() )\n\n\tf:Close()\n\n\tif ( !str ) then str = \"\" end\n\treturn str\n\nend"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ReadBool","parent":"File","type":"classfunc","description":"Reads one byte of the file and returns whether that byte was not 0.","realm":"Shared and Menu","rets":{"ret":{"text":"val","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ReadByte","parent":"File","type":"classfunc","description":"Reads one unsigned 8-bit integer from the file.","realm":"Shared and Menu","rets":{"ret":{"text":"The unsigned 8-bit integer from the file.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ReadDouble","parent":"File","type":"classfunc","description":"Reads an 8-byte little-endian IEEE-754 floating point double from the file.","realm":"Shared and Menu","rets":{"ret":{"text":"The double-precision floating point value read from the file.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ReadFloat","parent":"File","type":"classfunc","description":"Reads an IEEE 754 little-endian 4-byte float from the file.","realm":"Shared and Menu","rets":{"ret":{"text":"The read value","name":"","type":"number"}}},"example":{"code":"local f = file.Open( \"test.txt\", \"w\", \"DATA\" )\nf:WriteFloat( math.pi )\nf:WriteFloat( 66.99 )\nf:Close()\n\nlocal f = file.Open( \"test.txt\", \"r\", \"DATA\" )\nf:Seek( 4 )\nprint( f:ReadFloat() ) -- Prints 66.98999786377\nf:Close()"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ReadLine","parent":"File","type":"classfunc","description":{"text":"Returns the contents of the file from the current position up until the end of the current line.","note":"This function will look specifically for `Line Feed` characters `\\n` and will **completely ignore `Carriage Return` characters** `\\r`.\n\nIt will also stop at a `\\0` or `NULL` character, but will add a new line instead.\n\nThis function will not return more than 8192 characters. The return value will include the `\\n` character."},"realm":"Shared and Menu","rets":{"ret":{"text":"The string of data from the read line.","name":"","type":"string"}}},"example":{"description":"Open a file in read only mode, reads a line, tells where the current file pointer is at and then closes the file handle.","code":"local f = file.Open( \"cfg/mapcycle.txt\", \"r\", \"MOD\" )\nprint( f:ReadLine() )\nprint( f:ReadLine() )\nprint( f:Tell() )\nf:Close()","output":"```\n//\n\n// Default mapcycle file for Garry's Mod.\n\n45\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ReadLong","parent":"File","type":"classfunc","description":"Reads a signed little-endian 32-bit integer from the file.","realm":"Shared and Menu","rets":{"ret":{"text":"A signed 32-bit integer","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ReadShort","parent":"File","type":"classfunc","description":"Reads a signed little-endian 16-bit integer from the file.","realm":"Shared and Menu","rets":{"ret":{"text":"int16","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ReadUInt64","parent":"File","type":"classfunc","description":"Reads an unsigned 64-bit integer from the file.","realm":"Shared and Menu","added":"2023.08.30","rets":{"ret":{"text":"An unsigned 64-bit integer.","name":"","type":"string","note":"Since Lua cannot store full 64-bit integers, this function returns a string. It is mainly aimed at usage with Player:SteamID64."}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ReadULong","parent":"File","type":"classfunc","description":"Reads an unsigned little-endian 32-bit integer from the file.","realm":"Shared and Menu","rets":{"ret":{"text":"An unsigned 32-bit integer","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ReadUShort","parent":"File","type":"classfunc","description":"Reads an unsigned little-endian 16-bit integer from the file.","realm":"Shared and Menu","rets":{"ret":{"text":"The 16-bit integer","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Seek","parent":"File","type":"classfunc","description":"Sets the file pointer to the specified position.","realm":"Shared and Menu","args":{"arg":{"text":"Pointer position, in bytes.","name":"pos","type":"number"}}},"example":{"code":"local f = file.Open( \"test.txt\", \"w\", \"DATA\" )\nf:WriteFloat( math.pi )\nf:WriteFloat( 66.99 )\nf:Close()\n\nlocal f = file.Open( \"test.txt\", \"r\", \"DATA\" )\nf:Seek( 4 )\nprint( f:ReadFloat() ) -- Prints 66.98999786377\nf:Close()"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Size","parent":"File","type":"classfunc","rets":{"ret":{"name":"size","type":"number"}},"description":"Returns the size of the file in bytes.","realm":"Shared and Menu"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Skip","parent":"File","type":"classfunc","description":"Moves the file pointer by the specified amount of chars.","realm":"Shared and Menu","args":{"arg":{"text":"The amount of chars to skip, can be negative to skip backwards.","name":"amount","type":"number"}},"rets":{"ret":{"text":"amount","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Tell","parent":"File","type":"classfunc","description":"Returns the current position of the file pointer.","realm":"Shared and Menu","rets":{"ret":{"text":"pos","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Write","parent":"File","type":"classfunc","args":{"arg":{"text":"Binary data to write to the file.","name":"data","type":"string"}},"description":"Writes the given string into the file.","realm":"Shared and Menu"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"WriteBool","parent":"File","type":"classfunc","description":"Writes a boolean value to the file as one **byte**.","realm":"Shared and Menu","args":{"arg":{"text":"The bool to be written to the file.","name":"bool","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"WriteByte","parent":"File","type":"classfunc","description":"Write an 8-bit unsigned integer to the file.","realm":"Shared and Menu","args":{"arg":{"text":"The 8-bit unsigned integer to be written to the file.","name":"uint8","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"WriteDouble","parent":"File","type":"classfunc","description":"Writes an 8-byte little-endian IEEE-754 floating point double to the file.","realm":"Shared and Menu","args":{"arg":{"text":"The double to be written to the file.","name":"double","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"WriteFloat","parent":"File","type":"classfunc","description":"Writes an IEEE 754 little-endian 4-byte float to the file.","realm":"Shared and Menu","args":{"arg":{"text":"The float to be written to the file.","name":"float","type":"number"}}},"example":{"code":"local f = file.Open( \"test.txt\", \"w\", \"DATA\" )\nf:WriteFloat( math.pi )\nf:WriteFloat( 66.99 )\nf:Close()\n\nlocal f = file.Open( \"test.txt\", \"r\", \"DATA\" )\nf:Seek( 4 )\nprint( f:ReadFloat() ) -- Prints 66.98999786377\nf:Close()"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"WriteLong","parent":"File","type":"classfunc","description":"Writes a signed little-endian 32-bit integer to the file.","realm":"Shared and Menu","args":{"arg":{"text":"The 32-bit signed integer to be written to the file.","name":"int32","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"WriteShort","parent":"File","type":"classfunc","description":"Writes a signed little-endian 16-bit integer to the file.","realm":"Shared and Menu","args":{"arg":{"text":"The 16-bit signed integer to be written to the file.","name":"int16","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"WriteUInt64","parent":"File","type":"classfunc","description":"Writes an unsigned 64-bit integer to the file.","realm":"Shared and Menu","added":"2023.08.30","args":{"arg":{"text":"The unsigned 64-bit integer to be written to the file.","name":"uint64","type":"string","note":"Since Lua cannot store full 64-bit integers, this function takes a string. It is mainly aimed at usage with Player:SteamID64."}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"WriteULong","parent":"File","type":"classfunc","description":"Writes an unsigned little-endian 32-bit integer to the file.","realm":"Shared and Menu","args":{"arg":{"text":"The unsigned 32-bit integer to be written to the file.","name":"uint32","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"WriteUShort","parent":"File","type":"classfunc","description":"Writes an unsigned little-endian 16-bit integer to the file.","realm":"Shared and Menu","args":{"arg":{"text":"The unsigned 16-bit integer to the file.","name":"uint16","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"EnableLooping","parent":"IGModAudioChannel","type":"classfunc","description":"Enables or disables looping of audio channel, requires noblock flag.","realm":"Client","args":{"arg":{"text":"Enable or disable looping of this audio channel.","name":"enable","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"FFT","parent":"IGModAudioChannel","type":"classfunc","description":"Computes the [DFT (discrete Fourier transform)](https://en.wikipedia.org/wiki/Discrete_Fourier_transform) of the sound channel.\n\nThe size parameter specifies the number of consecutive audio samples to use as the input to the DFT and is restricted to a power of two. A [Hann window](https://en.wikipedia.org/wiki/Hann_function) is applied to the input data.\n\nThe computed DFT has the same number of frequency bins as the number of samples. Only half of this DFT is returned, since [the DFT magnitudes are symmetric for real input data](https://en.wikipedia.org/wiki/Discrete_Fourier_transform#The_real-input_DFT). The magnitudes of the DFT (values from 0 to 1) are used to fill the output table, starting at index 1.\n\n**Visualization protip:** For a size N DFT, bin k (1-indexed) corresponds to a frequency of (k - 1) / N * sampleRate.\n\n**Visualization protip:** Sound energy is proportional to the square of the magnitudes. Adding magnitudes together makes no sense physically, but adding energies does.\n\n**Visualization protip:** The human ear works on a logarithmic amplitude scale. You can convert to [decibels](https://en.wikipedia.org/wiki/Decibel) by taking 20 * math.log10 of frequency magnitudes, or 10 * math.log10 of energy. The decibel values will range from -infinity to 0.","realm":"Client","args":{"arg":[{"text":"The table to output the DFT magnitudes (numbers between 0 and 1) into. Indices start from 1.","name":"tbl","type":"table<number>"},{"text":"The number of samples to use. See Enums/FFT","name":"size","type":"number{FFT}"}]},"rets":{"ret":{"text":"The number of frequency bins that have been filled in the output table.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Get3DCone","parent":"IGModAudioChannel","type":"classfunc","description":"Returns 3D cone of the sound channel. See IGModAudioChannel:Set3DCone.","realm":"Client","rets":{"ret":[{"text":"The angle of the inside projection cone in degrees.","name":"","type":"number"},{"text":"The angle of the outside projection cone in degrees.","name":"","type":"number"},{"text":"The delta-volume outside the outer projection cone.","name":"","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Get3DEnabled","parent":"IGModAudioChannel","type":"classfunc","description":"Returns if the sound channel is currently in 3D mode or not. This value will be affected by IGModAudioChannel:Set3DEnabled.","realm":"Client","added":"2020.04.29","rets":{"ret":{"text":"Is currently 3D or not.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Get3DFadeDistance","parent":"IGModAudioChannel","type":"classfunc","description":"Returns 3D fade distances of a sound channel.","realm":"Client","rets":{"ret":[{"text":"The minimum distance. The channel's volume is at maximum when the listener is within this distance","name":"","type":"number"},{"text":"The maximum distance. The channel's volume stops decreasing when the listener is beyond this distance","name":"","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetAverageBitRate","parent":"IGModAudioChannel","type":"classfunc","description":"Returns the average bit rate of the sound channel.","realm":"Client","rets":{"ret":{"text":"The average bit rate of the sound channel.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetBitsPerSample","parent":"IGModAudioChannel","type":"classfunc","description":"Retrieves the number of bits per sample of the sound channel.\n\nDoesn't work for mp3 and ogg files.","realm":"Client","rets":{"ret":{"text":"Number of bits per sample, or 0 if unknown.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetBufferedTime","parent":"IGModAudioChannel","type":"classfunc","added":"2023.11.20","description":"Returns the buffered time of the sound channel in seconds, for online streaming sound channels. (sound.PlayURL)\n\nFor offline channels this will be equivalent to IGModAudioChannel:GetLength.","realm":"Client","rets":{"ret":{"text":"The current buffered time of the stream, in seconds.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetFileName","parent":"IGModAudioChannel","type":"classfunc","description":"Returns the filename for the sound channel.","realm":"Client","rets":{"ret":{"text":"The file name. This will not be always what you have put into the sound.PlayURL as first argument.","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetLength","parent":"IGModAudioChannel","type":"classfunc","description":"Returns the length of sound played by the sound channel in seconds.","realm":"Client","rets":{"ret":{"text":"The length of the sound. This value seems to be less then 0 for continuous radio streams.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetLevel","parent":"IGModAudioChannel","type":"classfunc","description":"Returns the right and left levels of sound played by the sound channel.","realm":"Client","rets":{"ret":[{"text":"The left sound level. The value is between 0 and 1.","name":"","type":"number"},{"text":"The right sound level. The value is between 0 and 1.","name":"","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetPan","parent":"IGModAudioChannel","type":"classfunc","description":"Gets the relative volume of the left and right channels.","realm":"Client","added":"2020.04.29","rets":{"ret":{"text":"Relative volume between the left and right channels. `-1` means only in left channel, `0` is center and `1` is only in the right channel. `0` by default.","name":"pan","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetPlaybackRate","parent":"IGModAudioChannel","type":"classfunc","description":"Returns the playback rate of the sound channel.","realm":"Client","rets":{"ret":{"text":"The current playback rate of the sound channel","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetPos","parent":"IGModAudioChannel","type":"classfunc","description":"Returns position of the sound channel","realm":"Client","rets":{"ret":{"text":"The position of the sound channel, previously set by IGModAudioChannel:SetPos","name":"","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetSamplingRate","parent":"IGModAudioChannel","type":"classfunc","description":"Returns the sample rate for currently playing sound.","realm":"Client","rets":{"ret":{"text":"The sample rate in Hz. This should always be 44100.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetState","parent":"IGModAudioChannel","type":"classfunc","description":"Returns the state of a sound channel","realm":"Client","rets":{"ret":{"text":"The state of the sound channel, see Enums/GMOD_CHANNEL","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTagsHTTP","parent":"IGModAudioChannel","type":"classfunc","description":"Retrieves HTTP headers from a bass stream channel created by sound.PlayURL, if available.\n\nOf special interest here are headers such as `icy-name`, `icy-br`, `ice-audio-info`, `icy-genre`.","realm":"Client","added":"2020.04.29","rets":{"ret":{"text":"A list of HTTP headers or `nil` if no information is available.\n\nExample output:\n```\n... other headers\n[7]\t=\tice-audio-info: channels=2;samplerate=44100;bitrate=128\n[8]\t=\ticy-genre: lounge\n[9]\t=\ticy-name: RTFM Lounge\n... other headers\n```","name":"info","type":"table<string>"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTagsID3","parent":"IGModAudioChannel","type":"classfunc","added":"2020.04.29","description":"Retrieves the ID3 version 1 info from a bass channel created by sound.PlayFile or sound.PlayURL, if available.\n\nID3v2 is not supported.","realm":"Client","rets":{"ret":{"text":"A table containing the information, or `nil` if no information is available.\n\nThe table will always have the following keys, filled out based on what is available:  \n`album`, `artist`, `comment`, `genre`, `id`, `title`, `year`","name":"info","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTagsMeta","parent":"IGModAudioChannel","type":"classfunc","description":"Retrieves ICY metadata from a bass stream channel created by sound.PlayURL, if available.","realm":"Client","added":"2020.04.29","rets":{"ret":{"text":"The meta information, or `nil` if no information is available.\n\nExample output: `StreamTitle='MUSIC NAME HERE';`","name":"info","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTagsMP4","parent":"IGModAudioChannel","type":"classfunc","added":"2025.10.03","description":"Retrieves `.m4a` media info, from a bass channel created by sound.PlayURL or sound.PlayFile, if available.","realm":"Client","rets":{"ret":{"text":"A list of available information in no particular order, or `nil` if no information is available.","name":"info","type":"table<string>"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTagsOGG","parent":"IGModAudioChannel","type":"classfunc","added":"2020.04.29","description":"Retrieves OGG media info tag, from a bass channel created by sound.PlayURL or sound.PlayFile, if available.","realm":"Client","rets":{"ret":{"text":"A list of available information in no particular order, or `nil` if no information is available.\n\nExample output:\n```\n[0]\t=\tAuthor=MY AUTHIOR\n[1]\t=\tTitle=MY TITLE\n... other data if available\n```","name":"info","type":"table<string>"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTagsVendor","parent":"IGModAudioChannel","type":"classfunc","description":"Retrieves OGG Vendor tag, usually containing the application that created the file, from a bass channel created by sound.PlayURL or sound.PlayFile, if available.","realm":"Client","added":"2020.04.29","rets":{"ret":{"text":"The OGG vendor tag, or `nil` if no information is available.","name":"info","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTagsWMA","parent":"IGModAudioChannel","type":"classfunc","added":"2025.10.03","description":"Retrieves `.WMA` media info, from a bass channel created by sound.PlayURL or sound.PlayFile, if available.","realm":"Client","rets":{"ret":{"text":"A list of available information in no particular order, or `nil` if no information is available.","name":"info","type":"table<string>"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTime","parent":"IGModAudioChannel","type":"classfunc","description":"Returns the current time of the sound channel in seconds","realm":"Client","rets":{"ret":{"text":"The current time of the stream","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetVolume","parent":"IGModAudioChannel","type":"classfunc","description":"Returns volume of a sound channel","realm":"Client","rets":{"ret":{"text":"The volume of the sound channel","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Is3D","parent":"IGModAudioChannel","type":"classfunc","description":"Returns if the sound channel is in 3D mode or not.","realm":"Client","rets":{"ret":{"text":"Is 3D or not.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsBlockStreamed","parent":"IGModAudioChannel","type":"classfunc","description":"Returns whether the audio stream is block streamed or not.","realm":"Client","rets":{"ret":{"text":"Is the audio stream block streamed or not.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsLooping","parent":"IGModAudioChannel","type":"classfunc","description":"Returns if the sound channel is looping or not.","realm":"Client","rets":{"ret":{"text":"Is looping or not.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsOnline","parent":"IGModAudioChannel","type":"classfunc","description":"Returns if the sound channel is streamed from the Internet or not.","realm":"Client","rets":{"ret":{"text":"Is online or not.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsValid","parent":"IGModAudioChannel","type":"classfunc","description":"Returns if the sound channel is valid or not.","realm":"Client","rets":{"ret":{"text":"Is the sound channel valid or not","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Pause","parent":"IGModAudioChannel","type":"classfunc","description":"Pauses the stream. It can be started again using IGModAudioChannel:Play","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Play","parent":"IGModAudioChannel","type":"classfunc","description":"Starts playing the stream.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Set3DCone","parent":"IGModAudioChannel","type":"classfunc","description":"Sets 3D cone of the sound channel.","realm":"Client","args":{"arg":[{"text":"The angle of the inside projection cone in degrees.\n\n\n\n\nRange is from 0 (no cone) to 360 (sphere), -1 = leave current.","name":"innerAngle","type":"number"},{"text":"The angle of the outside projection cone in degrees.\n\n\n\n\nRange is from 0 (no cone) to 360 (sphere), -1 = leave current.","name":"outerAngle","type":"number"},{"text":"The delta-volume outside the outer projection cone.\n\n\n\n\nRange is from 0 (silent) to 1 (same as inside the cone), less than 0 = leave current.","name":"outerVolume","type":"number"}]}},"example":{"description":"The default values","code":"Channel:Set3DCone( 360, 360, 0 )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Set3DEnabled","parent":"IGModAudioChannel","type":"classfunc","description":"Sets the 3D mode of the channel. This will affect IGModAudioChannel:Get3DEnabled but not IGModAudioChannel:Is3D.\n\nThis feature **requires** the channel to be initially created in 3D mode, i.e. IGModAudioChannel:Is3D should return true or this function will do nothing.","realm":"Client","added":"2020.04.29","args":{"arg":{"text":"true to enable, false to disable 3D.","name":"enable","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Set3DFadeDistance","parent":"IGModAudioChannel","type":"classfunc","description":"Sets 3D fade distances of a sound channel.","realm":"Client","args":{"arg":[{"text":"The minimum distance. The channel's volume is at maximum when the listener is within this distance.\n\n\n\n\n0 or less = leave current.","name":"min","type":"number"},{"text":"The maximum distance. The channel's volume stops decreasing when the listener is beyond this distance.\n\n\n\n\n0 or less = leave current.","name":"max","type":"number"}]}},"example":{"description":"The default values.","code":"Channel:Set3DFadeDistance( 200, 1000000000 )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetPan","parent":"IGModAudioChannel","type":"classfunc","description":"Sets the relative volume of the left and right channels.","realm":"Client","added":"2020.04.29","args":{"arg":{"text":"Relative volume between the left and right channels. `-1` means only in left channel, `0` is center (default) and `1` is only in the right channel. Fractional values are supported.","name":"pan","type":"number"}}},"example":{"description":"Plays the a Half-Life 1 sound track in the left channel.","code":"sound.PlayFile( \"sound/music/hl1_song20.mp3\", \"\", function( channel )\n\tif ( IsValid( channel ) ) then\n\t\tchannel:Play()\n\t\tchannel:SetPan( -1 )\n\tend\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetPlaybackRate","parent":"IGModAudioChannel","type":"classfunc","description":"Sets the playback rate of the sound channel. May not work with high values for radio streams.","realm":"Client","args":{"arg":{"text":"Playback rate to set to. 1 is normal speed, 0.5 is half the normal speed, etc.","name":"rate","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetPos","parent":"IGModAudioChannel","type":"classfunc","description":"Sets position of sound channel in case the sound channel has a 3d option set.","realm":"Client","args":{"arg":[{"text":"The position to put the sound into","name":"pos","type":"Vector"},{"text":"The direction of the sound","name":"dir","type":"Vector","default":"Vector( 0, 0, 0 )"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetTime","parent":"IGModAudioChannel","type":"classfunc","description":{"text":"Sets the sound channel to specified time ( Rewind to that position of the song ). Does not work on online radio streams.\n\nStreamed sounds must have \"noblock\" parameter for this to work and IGModAudioChannel:IsBlockStreamed must return false.","note":"Streamed sounds can only have their time set to up to the current IGModAudioChannel:GetBufferedTime."},"realm":"Client","args":{"arg":[{"text":"The time to set the stream to, in seconds.","name":"secs","type":"number"},{"text":"Set to true to skip decoding to set time, and instead just seek to it which is faster. Certain streams do not support seeking and have to decode to the given position.","name":"dont_decode","type":"boolean","default":"false"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetVolume","parent":"IGModAudioChannel","type":"classfunc","description":"Sets the volume of a sound channel","realm":"Client","args":{"arg":{"text":"Volume to set. 1 meaning 100% volume, 0.5 is 50% and 3 is 300%, etc.","name":"volume","type":"number"}}},"example":{"description":"Plays the a Half-Life 1 sound track at 300% volume","code":"sound.PlayFile( \"sound/music/hl1_song20.mp3\", \"\", function( channel )\n\tif ( IsValid( channel ) ) then\n\t\tchannel:Play()\n\t\tchannel:SetVolume( 3 )\n\tend\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Stop","parent":"IGModAudioChannel","type":"classfunc","description":{"text":"Stop the stream. It can be started again using IGModAudioChannel:Play.","bug":{"text":"Calling this invalidates the IGModAudioChannel object rendering it unusable for further functions.","issue":"1497"}},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetColor","parent":"IMaterial","type":"classfunc","description":"Returns the color of the specified pixel of the `$basetexture`, only works for materials created from PNG files.\n\nBasically identical to ITexture:GetColor used on IMaterial:GetTexture`( \"$basetexture\" )`.","realm":"Shared and Menu","args":{"arg":[{"text":"The X coordinate.","name":"x","type":"number"},{"text":"The Y coordinate.","name":"y","type":"number"}]},"rets":{"ret":{"text":"The color of the pixel as a Color.","name":"","type":"Color"}}},"example":{"description":"Identical functionality.","code":"local m = Material( \"gui/colors_dark.png\" )\nlocal t = m:GetTexture(\"$basetexture\")\n\nPrintTable( t:GetColor( 5, 5 ) )\nPrintTable( m:GetColor( 5, 5 ) )","output":"Both printouts will return identical color, which at the time of testing is RGBA - 255, 244, 242, 255."},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetFloat","parent":"IMaterial","type":"classfunc","description":"Returns the specified material value as a float, or nil if the value is not set.","realm":"Shared and Menu","args":{"arg":{"text":"The name of the material value.","name":"materialFloat","type":"string"}},"rets":{"ret":{"text":"float","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetInt","parent":"IMaterial","type":"classfunc","description":{"text":"Returns the specified material value as a int, rounds the value if its a float, or nil if the value is not set.","note":"Please note that certain material flags such as `$model` are stored in the `$flags` variable and cannot be directly retrieved with this function. See the full list here: Material Flags"},"realm":"Shared and Menu","args":{"arg":{"text":"The name of the material integer.","name":"materialInt","type":"string"}},"rets":{"ret":{"text":"The retrieved value as an integer","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetKeyValues","parent":"IMaterial","type":"classfunc","description":"Gets all the key values defined for the material.","realm":"Shared","rets":{"ret":{"text":"The material's key values.","name":"","type":"table<string, any>"}}},"example":{"description":"Example output of this function","code":"PrintTable( Material( \"pp/add\" ):GetKeyValues() )","output":"```\n$alpha=1\n$alphatestreference=0\n$basetexture=userdata: 0x2e13fc18\n$basetexturetransform=[1.00000,0.00000,0.00000,0.00000]\n[0.00000,1.00000,0.00000,0.00000]\n[0.00000,0.00000,1.00000,0.00000]\n[0.00000,0.00000,0.00000,1.00000]\n$color=1.000000 1.000000 1.000000\n$color2=1.000000 1.000000 1.000000\n$depthblend=0\n$depthblendscale=50\n$detailblendfactor=1\n$detailblendmode=0\n$detailframe=0\n$detailscale=4\n$detailtexturetransform=[1.00000,0.00000,0.00000,0.00000]\n[0.00000,1.00000,0.00000,0.00000]\n[0.00000,0.00000,1.00000,0.00000]\n[0.00000,0.00000,0.00000,1.00000]\n$distancealpha=0\n$distancealphafromdetail=0\n$edgesoftnessend=0.5\n$edgesoftnessstart=0.5\n$envmapcontrast=0\n$envmapframe=0\n$envmapmaskframe=0\n$envmapmasktransform=[1.00000,0.00000,0.00000,0.00000]\n[0.00000,1.00000,0.00000,0.00000]\n[0.00000,0.00000,1.00000,0.00000]\n[0.00000,0.00000,0.00000,1.00000]\n$envmapsaturation=1\n$envmaptint=1.000000 1.000000 1.000000\n$flags=32896\n$flags2=262144\n$flags_defined=32896\n$flags_defined2=0\n$flashlighttexture=userdata: 0x2e13fe68\n$flashlighttextureframe=0\n$frame=0\n$gammacolorread=0\n$glow=0\n$glowalpha=1\n$glowcolor=1.000000 1.000000 1.000000\n$glowend=0\n$glowstart=0\n$glowx=0\n$glowy=0\n$hdrcolorscale=1\n$linearwrite=0\n$outline=0\n$outlinealpha=1\n$outlinecolor=1.000000 1.000000 1.000000\n$outlineend0=0\n$outlineend1=0\n$outlinestart0=0\n$outlinestart1=0\n$phong=0\n$phongalbedotint=0\n$phongboost=0\n$phongexponent=0\n$phongfresnelranges=0.000000 0.000000 0.000000\n$phongtint=0.000000 0.000000 0.000000\n$receiveflashlight=0\n$scaleedgesoftnessbasedonscreenres=0\n$scaleoutlinesoftnessbasedonscreenres=0\n$separatedetailuvs=0\n$softedges=0\n$srgbtint=1.000000 1.000000 1.000000\n$vertexalphatest=0\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMatrix","parent":"IMaterial","type":"classfunc","description":"Returns the specified material matrix as a int, or nil if the value is not set or is not a matrix.","realm":"Shared","args":{"arg":{"text":"The name of the material matrix.","name":"materialMatrix","type":"string"}},"rets":{"ret":{"text":"matrix","name":"","type":"VMatrix"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetName","parent":"IMaterial","type":"classfunc","description":"Returns the name of the material, in most cases the path.","realm":"Shared and Menu","rets":{"ret":{"text":"Material name/path","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetShader","parent":"IMaterial","type":"classfunc","description":{"text":"Returns the name of the materials shader.","bug":{"text":"This function does not work serverside on Linux SRCDS and always returns `shader_error`.\n\nThis bug is fixed on `dev` beta and in the next update.","issue":"3256"}},"realm":"Shared and Menu","rets":{"ret":{"text":"Name of the currently loaded shader for this material, or `shader_error` if the material has no loaded shader.\n\nIt is not guaranteed to be in any specific capitalization, so case insensitive checks are advised.","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetString","parent":"IMaterial","type":"classfunc","description":"Returns the specified material string, or nil if the value is not set or if the value can not be converted to a string.","realm":"Shared and Menu","args":{"arg":{"text":"The name of the material string.","name":"materialString","type":"string"}},"rets":{"ret":{"text":"The value as a string","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetTexture","parent":"IMaterial","type":"classfunc","description":"Returns an ITexture based on the passed shader parameter.","realm":"Shared and Menu","args":{"arg":{"text":"The [shader parameter](https://developer.valvesoftware.com/wiki/Category:List_of_Shader_Parameters) to retrieve. This should normally be `$basetexture`.","name":"param","type":"string"}},"rets":{"ret":{"text":"The value of the shader parameter. Returns nothing if the param doesn't exist.","name":"","type":"ITexture"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetVector","parent":"IMaterial","type":"classfunc","description":"Returns the specified material vector, or nil if the value is not set.\n\nSee also IMaterial:GetVectorLinear","realm":"Shared and Menu","args":{"arg":{"text":"The name of the material vector.","name":"materialVector","type":"string"}},"rets":{"ret":{"text":"The color vector","name":"","type":"Vector"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetVector4D","parent":"IMaterial","type":"classfunc","description":"Returns the specified material vector as a 4 component vector.","realm":"Shared and Menu","added":"2020.08.12","args":{"arg":{"text":"The name of the material vector to retrieve.","name":"name","type":"string"}},"rets":{"ret":[{"text":"The x component of the vector.","name":"x","type":"number"},{"text":"The y component of the vector.","name":"y","type":"number"},{"text":"The z component of the vector.","name":"z","type":"number"},{"text":"The w component of the vector.","name":"w","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetVectorLinear","parent":"IMaterial","type":"classfunc","description":"Returns the specified material linear color vector, or nil if the value is not set.\n\nSee https://en.wikipedia.org/wiki/Gamma_correction\n\nSee also IMaterial:GetVector","realm":"Shared and Menu","args":{"arg":{"text":"The name of the material vector.","name":"materialVector","type":"string"}},"rets":{"ret":{"text":"The linear color vector","name":"","type":"Vector"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Height","parent":"IMaterial","type":"classfunc","description":"Returns the height of the member texture set for `$basetexture`.","realm":"Shared and Menu","rets":{"ret":{"text":"Height of the base texture.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsError","parent":"IMaterial","type":"classfunc","description":"Returns whenever the material is valid, i.e. whether it was not loaded successfully from disk or not.","realm":"Shared and Menu","rets":{"ret":{"text":"Is this material the error material? (___error)","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Recompute","parent":"IMaterial","type":"classfunc","description":"Recomputes the material's snapshot. This needs to be called if you have changed variables on your material and it isn't changing. \n\nBe careful though - this function is slow - so try to call it only when needed!","realm":"Shared and Menu"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetDynamicImage","parent":"IMaterial","type":"classfunc","description":{"text":"Changes the Material into the give Image.","internal":"This is used by the Background to change the Image."},"realm":"Menu","args":{"arg":{"text":"The path to a Image.","name":"path","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"SetFloat","parent":"IMaterial","type":"classfunc","description":"Sets the specified material float to the specified float, does nothing on a type mismatch.\n\nUnlike IMaterial:SetInt, this function **does not** call IMaterial:Recompute internally.","realm":"Shared and Menu","args":{"arg":[{"text":"The name of the material float.","name":"materialFloat","type":"string"},{"text":"The new float value.","name":"float","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetInt","parent":"IMaterial","type":"classfunc","description":{"text":"Sets the specified material value to the specified int, does nothing on a type mismatch.\n\nCalls IMaterial:Recompute internally.","note":"Please note that certain material flags such as `$model` are stored in the `$flags` variable and cannot be directly set with this function. See the full list here: Material Flags"},"realm":"Shared and Menu","args":{"arg":[{"text":"The name of the material int.","name":"materialInt","type":"string"},{"text":"The new int value.","name":"int","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetMatrix","parent":"IMaterial","type":"classfunc","description":"Sets the specified material value to the specified matrix, does nothing on a type mismatch.","realm":"Shared","args":{"arg":[{"text":"The name of the material int.","name":"materialMatrix","type":"string"},{"text":"The new matrix.","name":"matrix","type":"VMatrix"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetShader","parent":"IMaterial","type":"classfunc","description":{"text":"The functionality of this function was removed due to the amount of crashes it caused.","deprecated":"This function does nothing"},"realm":"Shared and Menu","args":{"arg":{"text":"Name of the shader","name":"shaderName","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetString","parent":"IMaterial","type":"classfunc","description":"Sets the specified material value to the specified string, does nothing on a type mismatch.","realm":"Shared and Menu","args":{"arg":[{"text":"The name of the material string.","name":"materialString","type":"string"},{"text":"The new string.","name":"string","type":"string"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetTexture","parent":"IMaterial","type":"classfunc","description":"Sets the specified material texture to the specified texture, does nothing on a type mismatch.\n\nCalls IMaterial:Recompute internally.","realm":"Shared and Menu","args":{"arg":[{"text":"The name of the keyvalue on the material to store the texture on.","name":"materialTexture","type":"string"},{"text":"The new texture. This can also be a string, the name of the new texture.","name":"texture","type":"ITexture"}]}},"example":[{"description":"Example usage of this function.","code":"local blur_mat = Material( \"pp/bokehblur\" )\n\nblur_mat:SetTexture( \"$basetexture\", render.GetScreenEffectTexture() )"},{"description":"Equivalent of Example 1, demonstrating the use of a texture's name.","code":"local blur_mat = Material( \"pp/bokehblur\" )\n\nblur_mat:SetTexture( \"$basetexture\", \"_rt_fullframefb\" )"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetUndefined","parent":"IMaterial","type":"classfunc","description":"Unsets the value for the specified material value.","realm":"Shared and Menu","args":{"arg":{"text":"The name of the material value to be unset.","name":"materialValueName","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetVector","parent":"IMaterial","type":"classfunc","description":"Sets the specified material vector to the specified vector, does nothing on a type mismatch.","realm":"Shared and Menu","args":{"arg":[{"text":"The name of the material vector.","name":"MaterialVector","type":"string"},{"text":"The new vector.","name":"vec","type":"Vector"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetVector4D","parent":"IMaterial","type":"classfunc","description":"Sets the specified material vector to the specified 4 component vector, does nothing on a type mismatch.","realm":"Shared and Menu","added":"2020.08.12","args":{"arg":[{"text":"The name of the material vector.","name":"name","type":"string"},{"text":"The x component of the new vector.","name":"x","type":"number"},{"text":"The y component of the new vector.","name":"y","type":"number"},{"text":"The z component of the new vector.","name":"z","type":"number"},{"text":"The w component of the new vector.","name":"w","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Width","parent":"IMaterial","type":"classfunc","description":"Returns the width of the member texture set for `$basetexture`.","realm":"Shared and Menu","rets":{"ret":{"text":"Width of the base texture.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"BuildFromTriangles","parent":"IMesh","type":"classfunc","description":{"text":"Builds the mesh from a table mesh vertexes.\n\nWhen modifying a previously built mesh, your new mesh must match the vertex count!\n\nSee Global.Mesh and util.GetModelMeshes for examples.","warning":"IMesh appears to have a limit of 65535 vertices. You should split your mesh into multiple meshes when above this limit. \n\nExceeding the limit may lead to undefined rendering behavior."},"realm":"Client","args":{"arg":{"text":"A table consisting of Structures/MeshVertexs.","name":"vertexes","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Destroy","parent":"IMesh","type":"classfunc","description":"Deletes the mesh and frees the memory used by it.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Draw","parent":"IMesh","type":"classfunc","description":"Renders the mesh with the active matrix.","realm":"Client"},"bug":"If this function is paired with VertexLitGeneric material, this function will reuse light parameters calculated on previously drawn model unless other are specified using render library (such as render.ResetModelLighting). If you experience lighting issues or you want engine to calculate light for you, draw a dummy (invisible) model in origin of mesh, then draw the mesh.\n\nIf utilized inside ENTITY:Draw, drawing entity's model (if it has one) should be enough.","example":{"description":"Properly renders the mesh using the SENT's model matrix.\n\n`self.Mesh` in this case is the IMesh.","code":"local myMaterial = Material( \"models/wireframe\" ) -- models/debug/debugwhite\n\nfunction ENT:Draw()\n\t-- Code containing self:DrawModel()\n\n\tif ( self.Mesh ) then\n\t\trender.SetMaterial( myMaterial )\n\t\tcam.PushModelMatrix( self:GetWorldTransformMatrix() )\n\t\t\tself.Mesh:Draw()\n\t\tcam.PopModelMatrix()\n\tend\n\n\t-- Probably other code\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawSkinned","parent":"IMesh","type":"classfunc","description":"Renders the mesh with the active matrix and given bone matrices.","realm":"Client","added":"2026.02.25","args":{"arg":[{"text":"A list of matrices to use as bones. Up to 52 of them.","type":"table<VMatrix>","name":"bones"},{"text":"If set, multiplies given matrices with currently active model matrix (cam.GetModelMatrix). This incurs a performance hit.","type":"boolean","name":"multiply","default":"false"}]}},"example":{"description":"Example usage. Draws a dancing cube using skeletal animation at maps 0, 0, 0 position. (gm_construct's spawn)","code":"local mat = Material( \"models/debug/debugwhite\" )\nlocal ZMin, ZMax = -10, 10\nlocal pos = Vector( 0, 0, 0 )\nlocal function SetPosZ( i )\n\tpos[3] = math.Remap( math.sin( ( CurTime() * 7 ) + ( i / 2 ) ), -1, 1, ZMin, ZMax )\n\treturn pos\nend\n\nlocal s = 50\n\nlocal v = {\n\tVector( -s, -s, -s ), Vector( s, -s, -s ), Vector( s, s, -s ), Vector( -s, s, -s ),\n\tVector( -s, -s, s ), Vector( s, -s, s ), Vector( s, s, s ), Vector( -s, s, s ),\n}\n\nlocal tris = {\n\t{1, 2, 3}, {1, 3, 4}, {5, 8, 7}, {5, 7, 6}, {1, 5, 6}, {1, 6, 2},\n\t{2, 6, 7}, {2, 7, 3}, {3, 7, 8}, {3, 8, 4}, {4, 8, 5}, {4, 5, 1}\n}\n\nlocal normals = {\n\tVector( 0, 0,-1 ), Vector( 0, 0,-1 ), Vector( 0, 0, 1 ),\n\tVector( 0, 0, 1 ), Vector( 0,-1, 0 ), Vector( 0,-1, 0 ),\n\tVector( 1, 0, 0 ), Vector( 1, 0, 0 ), Vector( 0, 1, 0 ),\n\tVector( 0, 1, 0 ), Vector( -1, 0, 0 ), Vector( -1, 0, 0 )\n}\n\nlocal imesh = Mesh( mat, 2 )\n\nmesh.Begin( imesh, MATERIAL_TRIANGLES, 12 )\n\tfor ti, t in ipairs( tris ) do\n\t\tlocal n = normals[ti]\n\t\tfor _, i in ipairs( t ) do\n\t\t\tmesh.Position( v[i] )\n\t\t\tmesh.BoneData( 0, i, 1 )\n\t\t\tmesh.BoneData( 1, i, 0 )\n\t\t\tmesh.Normal( n )\n\t\t\tmesh.Color( 255, 255, 255, 255 )\n\t\t\tmesh.AdvanceVertex()\n\t\tend\n\tend\nmesh.End()\n\nlocal boneCount = 8\nlocal boneTable = {}\nfor i = 1, boneCount do\n\tboneTable[i] = Matrix()\nend\n\nhook.Add(\"PostDrawOpaqueRenderables\", \"Cube\", function()\n\n\t-- Update bone matrices\n\tfor i = 1, boneCount do\n\t\tboneTable[i]:Identity()\n\t\tboneTable[i]:Translate( SetPosZ( i ) )\n\tend\n\n\t-- Setup model lighting\n\trender.ResetModelLighting( 0.5, 0.5, 0.5 )\n\trender.SetModelLighting( BOX_FRONT, 1, 1, 1 )\n\trender.SetModelLighting( BOX_LEFT, 1, 0, 0 )\n\trender.SetModelLighting( BOX_RIGHT, 0, 1, 0 )\n\trender.SetModelLighting( BOX_TOP, 0, 0, 1 )\n\n\t-- Set the render material\n\trender.SetMaterial( mat )\n\n\t-- Draw the mesh with the bone table\n\timesh:DrawSkinned( boneTable )\n\nend)"},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsValid","parent":"IMesh","type":"classfunc","description":"Returns whether this IMesh is valid or not.","realm":"Client","added":"2020.04.29","rets":{"ret":{"text":"Whether this IMesh is valid or not.","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"EndBlock","parent":"IRestore","type":"classfunc","description":"Ends current data block started with IRestore:StartBlock and returns to the parent block.\n\nTo avoid all sorts of errors, you **must** end all blocks you start.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadAngle","parent":"IRestore","type":"classfunc","description":"Reads next bytes from the restore object as an Angle.","realm":"Shared","rets":{"ret":{"text":"The angle that has been read","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadBool","parent":"IRestore","type":"classfunc","description":"Reads next bytes from the restore object as a boolean.","realm":"Shared","rets":{"ret":{"text":"The boolean that has been read","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadEntity","parent":"IRestore","type":"classfunc","description":"Reads next bytes from the restore object as an Entity.","realm":"Shared","rets":{"ret":{"text":"The entity that has been read.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadFloat","parent":"IRestore","type":"classfunc","description":"Reads next bytes from the restore object as a floating point number.","realm":"Shared","rets":{"ret":{"text":"The read floating point number.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadInt","parent":"IRestore","type":"classfunc","description":"Reads next bytes from the restore object as an integer number.","realm":"Shared","rets":{"ret":{"text":"The read integer number.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadString","parent":"IRestore","type":"classfunc","description":"Reads next bytes from the restore object as a string.","realm":"Shared","rets":{"ret":{"text":"The read string.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadVector","parent":"IRestore","type":"classfunc","description":"Reads next bytes from the restore object as a Vector.","realm":"Shared","rets":{"ret":{"text":"The read vector.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"StartBlock","parent":"IRestore","type":"classfunc","description":"Loads next block of data to be read inside current block. Blocks **must** be ended with IRestore:EndBlock.","realm":"Shared","rets":{"ret":{"text":"The name of the next data block to be read.","name":"","type":"string"}}},"example":{"description":"Example usage.","code":"saverestore.AddRestoreHook( \"HookNameHere\", function( save )\n\tlocal name = save:StartBlock()\n\tlocal myval = save:ReadString()\n\tsave:EndBlock()\n\n\tprint( name, myval )\nend )","output":"With example from ISave:StartBlock\n\n```\nTest myawesomestring\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EndBlock","parent":"ISave","type":"classfunc","description":"Ends current data block started with ISave:StartBlock and returns to the parent block.\n\nTo avoid all sorts of errors, you **must** end all blocks you start.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"StartBlock","parent":"ISave","type":"classfunc","description":"Starts a new block of data that you can write to inside current block. Blocks **must** be ended with ISave:EndBlock.","realm":"Shared","args":{"arg":{"text":"Name of the new block. Used for determining which block is which, returned by IRestore:StartBlock during game load.","name":"name","type":"string"}}},"example":{"description":"Example usage","code":"saverestore.AddSaveHook( \"HookNameHere\", function( save )\n\tsave:StartBlock( \"Test\" )\n\t\tsave:WriteString( \"myawesomestring\" )\n\tsave:EndBlock()\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteAngle","parent":"ISave","type":"classfunc","description":"Writes an Angle to the save object.","realm":"Shared","args":{"arg":{"text":"The angle to write.","name":"ang","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteBool","parent":"ISave","type":"classfunc","description":"Writes a boolean to the save object.","realm":"Shared","args":{"arg":{"text":"The boolean to write.","name":"bool","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteEntity","parent":"ISave","type":"classfunc","description":"Writes an Entity to the save object.","realm":"Shared","args":{"arg":{"text":"The entity to write.","name":"ent","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteFloat","parent":"ISave","type":"classfunc","description":"Writes a floating point number to the save object.","realm":"Shared","args":{"arg":{"text":"The floating point number to write.","name":"float","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteInt","parent":"ISave","type":"classfunc","description":"Writes an integer number to the save object.","realm":"Shared","args":{"arg":{"text":"The integer number to write.","name":"int","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteString","parent":"ISave","type":"classfunc","description":"Writes a **null terminated** string to the save object.","realm":"Shared","args":{"arg":{"text":"The string to write.","name":"str","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteVector","parent":"ISave","type":"classfunc","description":"Writes a Vector to the save object.","realm":"Shared","args":{"arg":{"text":"The vector to write.","name":"vec","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Download","parent":"ITexture","type":"classfunc","description":"Invokes the generator of the texture. Reloads file based textures from disk and clears render target textures.","realm":"Shared and Menu"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetColor","parent":"ITexture","type":"classfunc","description":"Returns the color of the specified pixel, only works for textures created from PNG files.","realm":"Shared and Menu","args":{"arg":[{"text":"The X coordinate.","name":"x","type":"number"},{"text":"The Y coordinate.","name":"y","type":"number"}]},"rets":{"ret":{"text":"The color of the pixel as a Color.","name":"","type":"Color"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetMappingHeight","parent":"ITexture","type":"classfunc","description":"Returns the true unmodified height of the texture.","realm":"Shared and Menu","rets":{"ret":{"text":"height","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetMappingWidth","parent":"ITexture","type":"classfunc","description":"Returns the true unmodified width of the texture.","realm":"Shared and Menu","rets":{"ret":{"text":"width","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetName","parent":"ITexture","type":"classfunc","description":"Returns the name of the texture, in most cases the path.","realm":"Shared and Menu","rets":{"ret":{"text":"name","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetNumAnimationFrames","parent":"ITexture","type":"classfunc","description":"Returns the number of animation frames in this texture.","realm":"Shared and Menu","added":"2021.01.27","rets":{"ret":{"text":"The number of animation frames in this texture.","name":"","type":"number"}}},"example":{"code":"local m = Material( \"effects/prisonmap_disp\" )\nlocal t = m:GetTexture( \"$basetexture\" )\nprint( t:GetNumAnimationFrames() )","output":"`39`"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Height","parent":"ITexture","type":"classfunc","description":"Returns the modified height of the texture, this value may be affected by mipmapping and other factors.","realm":"Shared and Menu","rets":{"ret":{"text":"height","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsError","parent":"ITexture","type":"classfunc","description":{"text":"Returns whenever the texture is valid. (i.e. was loaded successfully or not)","note":"The \"error\" texture is a valid texture, and therefore this function will return false when used on it. Use ITexture:IsErrorTexture, instead."},"realm":"Shared and Menu","rets":{"ret":{"text":"Whether the texture was loaded successfully or not.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsErrorTexture","parent":"ITexture","type":"classfunc","description":"Returns whenever the texture is the error texture (pink and black checkerboard pattern).","realm":"Shared and Menu","rets":{"ret":{"text":"Whether the texture is the error texture or not.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Width","parent":"ITexture","type":"classfunc","description":"Returns the modified width of the texture, this value may be affected by mipmapping and other factors.","realm":"Shared and Menu","rets":{"ret":{"text":"width","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"AddFrame","parent":"IVideoWriter","type":"classfunc","description":"Adds the current framebuffer to the video stream.","realm":"Client and Menu","args":{"arg":[{"text":"Usually set to what Global.FrameTime is, or simply 1/fps.","name":"frameTime","type":"number"},{"text":"If true it will downsample the whole screenspace to the videos width and height, otherwise it will just record from the top left corner to the given width and height and therefore not the whole screen.","name":"downsample","type":"boolean"}]}},"example":{"description":"If ActiveVideo was a IVideoWriter, it would record the screen every frame.","code":"--Taken from /lua/menu/video.lua\n\nhook.Add( \"DrawOverlay\", \"CaptureFrames\", function()\n\n\tif ( !ActiveVideo ) then return end\n\t\n\tActiveVideo:AddFrame( FrameTime(), true )\n\nend )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Finish","parent":"IVideoWriter","type":"classfunc","description":"Ends the video recording and dumps it to disk.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Height","parent":"IVideoWriter","type":"classfunc","description":"Returns the height of the video stream.","realm":"Client and Menu","rets":{"ret":{"text":"height","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetRecordSound","parent":"IVideoWriter","type":"classfunc","description":"Sets whether to record sound or not.","realm":"Client and Menu","args":{"arg":{"text":"Record.","name":"record","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Width","parent":"IVideoWriter","type":"classfunc","description":"Returns the width of the video stream.","realm":"Client and Menu","rets":{"ret":{"text":"width","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Draw","parent":"MarkupObject","type":"classfunc","description":"Draws the computed markupobject to the screen. See markup.Parse.","realm":"Client and Menu","args":{"arg":[{"text":"The X coordinate on the screen.","name":"xOffset","type":"number"},{"text":"The Y coordinate on the screen.","name":"yOffset","type":"number"},{"text":"The alignment of the x coordinate within the text using Enums/TEXT_ALIGN","name":"xAlign","type":"number","default":"TEXT_ALIGN_LEFT"},{"text":"The alignment of the y coordinate within the text using Enums/TEXT_ALIGN","name":"yAlign","type":"number","default":"TEXT_ALIGN_TOP"},{"text":"Sets the alpha of all drawn objects to this value.","name":"alphaoverride","type":"number","default":"255"},{"text":"The alignment of the text horizontally using Enums/TEXT_ALIGN","name":"textAlign","type":"number","default":"TEXT_ALIGN_LEFT"}]}},"example":{"description":"Shows the difference between xAlign and textAlign.","code":{"text":"local parsed = markup.Parse( \"\\n\" )\n\nhook.Add( \"HUDPaint\", \"MarkupTest\", function()\n\t-- xAlign = LEFT\n\tdraw.RoundedBox( 0, 200, 300, parsed:GetWidth(), parsed:GetHeight(), Color( 0, 0, 0, 100 ) )\n\tparsed:Draw( 200, 300 )\n\n\t-- xAlign = CENTER\n\tdraw.RoundedBox( 0, 200 - parsed:GetWidth() / 2, 350, parsed:GetWidth(), parsed:GetHeight(), Color( 0, 0, 0, 100 ) )\n\tparsed:Draw( 200, 350, TEXT_ALIGN_CENTER )\n\n\t-- textAlign = RIGHT\n\tdraw.RoundedBox( 0, 200, 400, parsed:GetMaxWidth(), parsed:GetHeight(), Color( 0, 0, 0, 100 ) )\n\tparsed:Draw( 200, 400, nil, nil, nil, TEXT_ALIGN_RIGHT )\nend )","font":{"text":"changed font","default":"Default"},"color":"changed color with a long text"},"output":{"upload":{"src":"70c/8d9bb26dbfc9f9d.png","size":"28939","name":"image.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetHeight","parent":"MarkupObject","type":"classfunc","description":"Gets computed the height of the markupobject.","realm":"Client and Menu","rets":{"ret":{"text":"The computed height.","name":"Height","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetMaxWidth","parent":"MarkupObject","type":"classfunc","description":"Gets maximum width for this markup object as defined in markup.Parse.","realm":"Client and Menu","rets":{"ret":{"text":"The max width.","name":"maxWidth","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetWidth","parent":"MarkupObject","type":"classfunc","description":"Gets computed the width of the markupobject.","realm":"Client and Menu","rets":{"ret":{"text":"The computed width.","name":"Width","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Size","parent":"MarkupObject","type":"classfunc","description":"Gets computed the width and height of the markupobject.","realm":"Client and Menu","rets":{"ret":[{"text":"The computed width.","name":"","type":"number"},{"text":"The computed height.","name":"","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"BecomeRagdoll","parent":"NextBot","type":"classfunc","description":"Become a ragdoll and remove the entity.","realm":"Server","args":{"arg":{"text":"Damage info passed from an onkilled event","name":"info","type":"CTakeDamageInfo"}},"rets":{"ret":{"text":"The created ragdoll, if any.","name":"","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"BodyMoveXY","parent":"NextBot","type":"classfunc","description":{"text":"Should only be called in NEXTBOT:BodyUpdate. This sets the `move_x` and `move_y` pose parameters of the bot to fit how they're currently moving, sets the animation speed (Entity:GetPlaybackRate) to suit the ground speed, and calls Entity:FrameAdvance.","bug":{"text":"This function might cause crashes with some activities.","issue":"3420"}},"realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"ClearLastKnownArea","parent":"NextBot","type":"classfunc","description":"Clears this bot's last known area. See NextBot:GetLastKnownArea.","realm":"Server","added":"2022.02.14"},"realms":["Server"],"type":"Function"},
{"function":{"name":"FindSpot","parent":"NextBot","type":"classfunc","description":"Like NextBot:FindSpots but only returns a vector.","realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_nextbot/sv_nextbot.lua","line":"201"},"args":{"arg":[{"text":"Either `\"random\"`, `\"near\"`, `\"far\"`.","name":"type","type":"string"},{"text":"This table should contain the search info.\n* string type - The type (Only `hiding` for now)\n* Vector pos - the position to search.\n* number radius - the radius to search.\n* number stepup - the highest step to step up.\n* number stepdown - the highest we can step down without being hurt.","name":"options","type":"table"}]},"rets":{"ret":{"text":"If it finds a spot it will return a vector. If not it will return nil.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"FindSpots","parent":"NextBot","type":"classfunc","description":"Returns a table of hiding spots.","realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_nextbot/sv_nextbot.lua","line":"189"},"args":{"arg":{"text":"This table should contain the search info.\n* string type - The type (optional, only `hiding` supported)\n* Vector pos - the position to search.\n* number radius - the radius to search.\n* number stepup - the highest step to step up.\n* number stepdown - the highest we can step down without being hurt.","name":"specs","type":"table"}},"rets":{"ret":{"text":"An unsorted table of tables containing:\n* Vector vector - The position of the hiding spot\n* number distance - the distance to that position","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetActivity","parent":"NextBot","type":"classfunc","description":"Returns the currently running activity","realm":"Server","rets":{"ret":{"text":"The current activity","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetFOV","parent":"NextBot","type":"classfunc","description":"Returns the Field of View of the Nextbot NPC, used for its vision functionality, such as NextBot:IsAbleToSee.","realm":"Server","added":"2020.08.12","rets":{"ret":{"text":"The current FOV of the nextbot","name":"fov","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetLastKnownArea","parent":"NextBot","type":"classfunc","description":"Returns this bots last known area. See also NextBot:ClearLastKnownArea.","realm":"Server","added":"2022.02.14","rets":{"ret":{"text":"The last area the bot is known to have been in.","name":"","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetMaxVisionRange","parent":"NextBot","type":"classfunc","description":"Returns the maximum range the nextbot can see other nextbots/players at. See NextBot:IsAbleToSee.","realm":"Server","added":"2020.08.12","rets":{"ret":{"text":"The current vision range","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetRangeSquaredTo","parent":"NextBot","type":"classfunc","description":"Returns squared distance to an entity or a position.\n\nSee also NextBot:GetRangeTo.","realm":"Server","args":{"arg":{"text":"The position to measure distance to. Can be an entity.","name":"to","type":"Vector"}},"rets":{"ret":{"text":"The squared distance","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetRangeTo","parent":"NextBot","type":"classfunc","description":"Returns the distance to an entity or position.\n\nSee also NextBot:GetRangeSquaredTo.","realm":"Server","args":{"arg":{"text":"The position to measure distance to. Can be an entity.","name":"to","type":"Vector"}},"rets":{"ret":{"text":"The distance","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetSolidMask","parent":"NextBot","type":"classfunc","description":"Returns the solid mask for given NextBot.","realm":"Server","rets":{"ret":{"text":"The solid mask, see Enums/CONTENTS and Enums/MASK","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"HandleStuck","parent":"NextBot","type":"classfunc","description":"Called from Lua when the NPC is stuck. This should only be called from the behaviour coroutine - so if you want to override this function and do something special that yields - then go for it.\n\nYou should always call self.loco:ClearStuck() in this function to reset the stuck status - so it knows it's unstuck. See CLuaLocomotion:ClearStuck.","realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_nextbot/sv_nextbot.lua","line":"265"}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsAbleToSee","parent":"NextBot","type":"classfunc","description":{"text":"Returns if the Nextbot NPC can see the give entity or not.","warning":"Using this function creates the nextbot vision interface which will cause a significant performance hit!"},"realm":"Server","added":"2020.08.12","args":{"arg":[{"text":"The entity to test if we can see","name":"ent","type":"Entity"},{"text":"Whether to use the Field of View of the Nextbot","name":"useFOV","type":"number","default":"true"}]},"rets":{"ret":{"text":"If the nextbot can see or not","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"MoveToPos","parent":"NextBot","type":"classfunc","description":"To be called in the behaviour coroutine only! Will yield until the bot has reached the goal or is stuck","realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_nextbot/sv_nextbot.lua","line":"299"},"args":{"arg":[{"text":"The position we want to get to","name":"pos","type":"Vector"},{"text":"A table containing a bunch of tweakable options.\n* number lookahead - Minimum look ahead distance.\n* number tolerance - How close we must be to the goal before it can be considered complete.\n* boolean draw - Draw the path. Only visible on listen servers and single player.\n* number maxage - Maximum age of the path before it times out.\n* number repath - Rebuilds the path after this number of seconds.","name":"options","type":"table"}]},"rets":{"ret":{"text":"Either `\"failed\"`, `\"stuck\"`, `\"timeout\"` or `\"ok\"` - depending on how the NPC got on","name":"","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlaySequenceAndWait","parent":"NextBot","type":"classfunc","description":"To be called in the behaviour coroutine only! Plays an animation sequence and waits for it to end before returning.","realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_nextbot/sv_nextbot.lua","line":"298-317"},"args":{"arg":[{"text":"The sequence name","name":"name","type":"string"},{"text":"Playback Rate of that sequence","name":"speed","type":"number","default":"1"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetFOV","parent":"NextBot","type":"classfunc","description":"Sets the Field of View for the Nextbot NPC, used for its vision functionality, such as NextBot:IsAbleToSee.","realm":"Server","added":"2020.08.12","args":{"arg":{"text":"The new FOV","name":"fov","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetMaxVisionRange","parent":"NextBot","type":"classfunc","description":"Sets the maximum range the nextbot can see other nextbots/players at. See NextBot:IsAbleToSee.","realm":"Server","added":"2020.08.12","args":{"arg":{"text":"The new vision range to set.","name":"range","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetSolidMask","parent":"NextBot","type":"classfunc","description":"Sets the solid mask for given NextBot.\n\nThe default solid mask of a NextBot is MASK_NPCSOLID.","realm":"Server","args":{"arg":{"text":"The new mask, see Enums/CONTENTS and Enums/MASK","name":"mask","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"StartActivity","parent":"NextBot","type":"classfunc","description":"Start doing an activity (animation).\n\nThis function may not produce the desired result if Entity:SetModel has not yet been called on the nextbot entity","realm":"Server","args":{"arg":{"text":"One of the Enums/ACT","name":"activity","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddEntityRelationship","parent":"NPC","type":"classfunc","description":{"text":"Makes the NPC like, hate, feel neutral towards, or fear the entity in question. If you want to setup relationship towards a certain entity `class`, use NPC:AddRelationship.","note":"NPCs do not see NextBots by default. This can be fixed by adding the FL_OBJECT flag to the NextBot."},"realm":"Server","args":{"arg":[{"text":"The entity for the relationship to be applied to.","name":"target","type":"Entity"},{"text":"A Enums/D representing the relationship type.","name":"disposition","type":"number"},{"text":"How strong the relationship is. Higher values mean higher priority over relationships with lower priority.","name":"priority","type":"number","default":"0"}]}},"example":[{"description":"Spawns a manhack and makes it fear player 1.","code":"local manhack = ents.Create( \"npc_manhack\" )\nmanhack:Spawn()\nmanhack:AddEntityRelationship( Entity(1), D_FR, 99 )"},{"description":"Make every NPC entity that touches our NPC an enemy.","code":"function ENT:StartTouch( entity )\n\tif entity:IsNPC() then -- if entity is an NPC then continue\n        entity:AddEntityRelationship( self, D_HT, 99 ) -- entity will hate self entity\n        self:AddEntityRelationship( entity, D_HT, 99 ) -- self entity will hate entity\n\tend\nend"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"AddRelationship","parent":"NPC","type":"classfunc","description":{"text":"Changes how an NPC feels towards another NPC.  If you want to setup relationship towards a certain `entity`, use NPC:AddEntityRelationship.","warning":"Avoid using this in GM:OnEntityCreated to prevent crashing due to infinite loops. This function may create an entity with given class and delete it immediately after."},"realm":"Server","args":{"arg":{"text":"A string representing how the relationship should be set up.\nShould be formatted as `\"npc_class `Enums/D` numberPriority\"`.","name":"relationstring","type":"string"}}},"example":{"description":"Spawns a manhack and makes it hate floor turrets.","code":"local manhack = ents.Create( \"npc_manhack\" )\nmanhack:Spawn()\nmanhack:AddRelationship( \"npc_turret_floor D_HT 99\" )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"AdvancePath","parent":"NPC","type":"classfunc","description":{"text":"Advances the NPC on its path to the next waypoint.","warning":"Calling this on an NPC without any route will result in an instant crash."},"realm":"Server","added":"2023.12.11"},"example":{"description":"Make your scripted NPC advance to the next waypoint without exactly having to step on the node, making it advance when the NPC's hull is nearby.","code":{"text":"function ENT:OverrideMode(flInterval)\n\tlocal vecCurWaypoint = self:GetCurWaypointPos()\n\tif !vecCurWaypoint:IsZero() then \n\t\tlocal threshold = self:BoundingRadius() or 1 \n\t\tlocal curDistance = self:GetPos():Distance(vecCurWaypoint) \n\t\tif curDistance","threshold":{"then":"","if":"","self:getnextwaypointpos:iszero":"","self:advancepath":"","else":"","self:cleargoal":"","self:onmovementcomplete":"","end":"","ode":"ode"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AlertSound","parent":"NPC","type":"classfunc","description":"Force an NPC to play their Alert sound.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"AutoMovement","parent":"NPC","type":"classfunc","description":"Executes any movement the current sequence may have.","realm":"Server","added":"2021.03.31","args":{"arg":[{"text":"This is a good place to use Entity:GetAnimTimeInterval.","name":"interval","type":"number"},{"name":"target","type":"Entity","default":"NULL"}]},"rets":{"ret":{"text":"`true` if any movement was performed.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"cat":"classfunc","title":"NPC:BecomeRagdoll","function":{"name":"BecomeRagdoll","parent":"NPC","type":"classfunc","description":"Become a ragdoll and remove the entity. Internally handles serverside/clientside ragdoll creation, momentum calculation, triggering ragdoll creation hooks / events and cloning entity's bone transforms to the created ragdoll.","added":"2025.08.08","realm":"Server","args":{"arg":{"text":"Damage info passed from an onkilled event","name":"info","type":"CTakeDamageInfo"}},"rets":{"ret":{"text":"The created serverside ragdoll, nil if failed or a clientside ragdoll created.","name":"","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"CapabilitiesAdd","parent":"NPC","type":"classfunc","description":"Adds a capability to the NPC.","realm":"Server","args":{"arg":{"text":"Capabilities to add, see Enums/CAP.","name":"capabilities","type":"number{CAP}"}}},"example":{"description":"Adds the `CAP_USE_SHOT_REGULATOR` to the NPC's capabilities.","code":"self:CapabilitiesAdd( CAP_USE_SHOT_REGULATOR )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"CapabilitiesClear","parent":"NPC","type":"classfunc","description":"Removes all of Capabilities the NPC has.","realm":"Server"},"example":{"description":"Removes all of the Capabilities that the NPC has.","code":"self:CapabilitiesClear()"},"realms":["Server"],"type":"Function"},
{"function":{"name":"CapabilitiesGet","parent":"NPC","type":"classfunc","description":"Returns the NPC's capabilities along the ones defined on its weapon.","realm":"Server","rets":{"ret":{"text":"The capabilities as a bitflag.\nSee Enums/CAP","name":"","type":"number{CAP}"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"CapabilitiesHas","parent":"NPC","type":"classfunc","description":"Checks whether the NPC has the specified capabilities.","added":"2025.09.01","realm":"Server","args":{"arg":{"text":"Capabilities to check, see Enums/CAP.","name":"capabilities","type":"number{CAP}"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"CapabilitiesRemove","parent":"NPC","type":"classfunc","description":"Remove a certain capability.","realm":"Server","args":{"arg":{"text":"Capabilities to remove, see Enums/CAP","name":"capabilities","type":"number"}}},"example":{"description":"Removes the CAP_USE_SHOT_REGULATOR capability, if the NPC has it.","code":"self:CapabilitiesRemove(CAP_USE_SHOT_REGULATOR)"},"realms":["Server"],"type":"Function"},
{"function":{"name":"Classify","parent":"NPC","type":"classfunc","description":"Returns the NPC relationship class. This is mostly used to tell NPCs who should be attacking who.\n\nDo not confuse with Entity:GetClass!","realm":"Server","rets":{"ret":{"text":"See Enums/CLASS","name":"","type":"number{CLASS}"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ClearBlockingEntity","parent":"NPC","type":"classfunc","description":"Resets the NPC:GetBlockingEntity.","realm":"Server","added":"2021.03.31"},"realms":["Server"],"type":"Function"},
{"function":{"name":"ClearCondition","parent":"NPC","type":"classfunc","description":"Clears out the specified Enums/COND on this NPC.","realm":"Server","args":{"arg":{"text":"The Enums/COND to clear out.","name":"condition","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ClearEnemyMemory","parent":"NPC","type":"classfunc","description":"Clears the Enemy from the NPC's memory, effectively forgetting it until met again with either the NPC vision or with NPC:UpdateEnemyMemory.","realm":"Server","args":{"arg":{"text":"The enemy to mark","name":"enemy","type":"Entity","default":"GetEnemy()","added":"2020.06.24"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ClearExpression","parent":"NPC","type":"classfunc","description":"Clears the NPC's current expression which can be set with NPC:SetExpression.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"ClearGoal","parent":"NPC","type":"classfunc","description":"Clears the current NPC goal or target.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"ClearSchedule","parent":"NPC","type":"classfunc","description":"Stops the current schedule that the NPC is doing.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"ConditionID","parent":"NPC","type":"classfunc","description":"Returns the ID of a given condition by name. Opposite of NPC:ConditionName.\n\nThis is useful for custom conditions defined by engine NPCs, such as `COND_ZOMBIE_RELEASECRAB` for zombies, and `COND_COMBINE_ON_FIRE` for Combine Soldiers.","added":"2025.09.03","realm":"Server","args":{"arg":{"text":"The condition name.","name":"conditionName","type":"string"}},"rets":{"ret":{"text":"The condition ID, see Enums/COND. Custom conditions will have a \"randomly\" assigned IDs, which will change with each game session.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ConditionName","parent":"NPC","type":"classfunc","description":"Translates condition ID to a string. For the opposite process, see NPC:ConditionID.","realm":"Server","args":{"arg":{"text":"The NPCs condition ID, see Enums/COND","name":"cond","type":"number"}},"rets":{"ret":{"text":"A human understandable string equivalent of that condition.","name":"","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Disposition","parent":"NPC","type":"classfunc","description":{"text":"Returns the way the NPC \"feels\" about a given entity. See NPC:AddEntityRelationship.","note":"For `ai` type entities, this will return ENTITY:GetRelationship. If it returns `nil` or for engine NPCs, this will return whatever was last set by NPC:AddEntityRelationship. As a last resort, engine will decide on the disposition based on this NPC's NPC:Classify."},"realm":"Server","args":{"arg":{"text":"The entity to test our disposition towards.","name":"ent","type":"Entity"}},"rets":{"ret":[{"text":"The NPCs disposition, see Enums/D.","name":"","type":"number{D}"},{"text":"The NPCs disposition priority.","name":"","type":"number","added":"2023.10.09"}]}},"example":{"description":"If a player is hurt by a friendly NPC, announce it.","code":"function FriendlyFireAnnouncement( ply, atk )\n   if atk:IsNPC() and atk:Disposition(ply) == D_LI then --like\n      PrintMessage(\"A \"..atk:GetClass()..\" attacked \"..ply:Nick()..\"!\", HUD_PRINTTALK)\n   end\nend\n\nhook.Add( \"PlayerHurt\", \"FriendlyFire\", FriendlyFireAnnouncement )","output":"Prints \"A ____ attacked ____!\" to everyones chat."},"realms":["Server"],"type":"Function"},
{"function":{"name":"DropWeapon","parent":"NPC","type":"classfunc","description":"Forces the NPC to drop the specified weapon.","realm":"Server","args":{"arg":[{"text":"Weapon to be dropped. If unset, will default to the currently equipped weapon.","name":"weapon","type":"Weapon","default":"nil"},{"text":"If set, launches the weapon at given position. There is a limit to how far it is willing to throw the weapon. Overrides velocity argument.","name":"target","type":"Vector","default":"nil"},{"text":"If set and previous argument is unset, launches the weapon with given velocity. If the velocity is higher than 400, it will be clamped to 400.","name":"velocity","type":"Vector","default":"nil"}]}},"example":{"description":"A console command that makes all NPCs on the map throw their weapons at the player who executed the console command","code":"concommand.Add( \"dropall\",function( ply )\n\tfor id, ent in ipairs( ents.GetAll() ) do\n\t\tif ( ent:IsNPC() ) then\n\t\t\t-- Some NPCs on some maps delete their weapons when the weapon is dropped, we don't want that.\n\t\t\tent:SetKeyValue( \"spawnflags\", bit.band( ent:GetSpawnFlags(), bit.bnot( SF_NPC_NO_WEAPON_DROP ) ) )\n\t\t\tent:DropWeapon( nil, ply:GetPos() )\n\t\tend\n\tend\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"ExitScriptedSequence","parent":"NPC","type":"classfunc","description":"Makes an NPC exit a scripted sequence, if one is playing.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"FearSound","parent":"NPC","type":"classfunc","description":"Force an NPC to play its Fear sound.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"FoundEnemySound","parent":"NPC","type":"classfunc","description":"Force an NPC to play its FoundEnemy sound.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetActiveWeapon","parent":"NPC","type":"classfunc","description":"Returns the weapon the NPC is currently carrying, or NULL.","realm":"Shared","rets":{"ret":{"text":"The NPCs current weapon","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetActivity","parent":"NPC","type":"classfunc","description":"Returns the NPC's current activity.","realm":"Server","rets":{"ret":{"text":"Current activity, see Enums/ACT.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetAimVector","parent":"NPC","type":"classfunc","description":{"text":"Returns the aim vector of the NPC. NPC alternative of Player:GetAimVector.","note":"If the NPC has both NPC:GetEnemy and NPC:GetActiveWeapon, engine will automatically call ENTITY:GetAttackSpread to add random spread degrees to the return value."},"realm":"Server","rets":{"ret":{"text":"The aim direction of the NPC, usually a noisy direction to it's NPC:GetEnemy. This will default to Entity:GetForward when there's no enemy. Thus, NPC:GetCurrentWeaponProficiency will be used.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetArrivalActivity","parent":"NPC","type":"classfunc","description":"Returns the activity to be played when the NPC arrives at its goal","realm":"Server","rets":{"ret":{"text":"The arrival activity. See Enums/ACT.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetArrivalDirection","parent":"NPC","type":"classfunc","description":"Returns the direction from the NPC origin to its current navigational destination.","realm":"Server","added":"2023.09.06","rets":{"ret":{"text":"The arrival direction.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetArrivalDistance","parent":"NPC","type":"classfunc","description":"Returns NPC arrival distance, set by NPC:SetArrivalDistance.","realm":"Server","added":"2024.05.15","rets":{"ret":{"text":"The current arrival distance.","name":"dist","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetArrivalSequence","parent":"NPC","type":"classfunc","description":"Returns the sequence to be played when the NPC arrives at its goal.","realm":"Server","rets":{"ret":{"text":"Sequence ID to be played, or -1 if there's no sequence.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetArrivalSpeed","parent":"NPC","type":"classfunc","description":"Returns NPC arrival speed, set by NPC:SetArrivalSpeed.","realm":"Server","added":"2024.05.15","rets":{"ret":{"text":"The current arrival peed.","name":"speed","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetBestSoundHint","parent":"NPC","type":"classfunc","description":"Returns the most dangerous/closest sound hint based on the NPCs location and the types of sounds it can sense.","realm":"Server","added":"2021.06.09","args":{"arg":{"text":"The types of sounds to choose from. See SOUND_ enums","name":"types","type":"number"}},"rets":{"ret":{"text":"A table with SoundHintData structure or `nil` if no sound hints are nearby.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetBlockingEntity","parent":"NPC","type":"classfunc","description":"Returns the entity blocking the NPC along its path.","realm":"Server","rets":{"ret":{"text":"Blocking entity","name":"","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetCurGoalType","parent":"NPC","type":"classfunc","description":"Returns the goal type for current navigation path.","realm":"Server","added":"2023.10.04","rets":{"ret":{"text":"The goal type. See Enums/GOALTYPE.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetCurrentSchedule","parent":"NPC","type":"classfunc","description":"Returns the NPC's current schedule.","realm":"Server","rets":{"ret":{"text":"The NPCs schedule, see Enums/SCHED or -1 if we failed for some reason","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetCurrentWeaponProficiency","parent":"NPC","type":"classfunc","description":"Returns how proficient (skilled) an NPC is with its current weapon.","realm":"Server","rets":{"ret":{"text":"NPC's proficiency for current weapon. See Enums/WEAPON_PROFICIENCY.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetCurWaypointPos","parent":"NPC","type":"classfunc","description":"Gets the NPC's current waypoint position (where NPC is currently moving towards), if any is available.","realm":"Server","added":"2020.03.17","rets":{"ret":{"text":"The position of the current NPC waypoint.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetEnemy","parent":"NPC","type":"classfunc","description":{"text":"Returns the entity that this NPC is trying to fight.","bug":{"text":"This returns nil if the NPC has no enemy. You should use Global.IsValid (which accounts for nil and NULL) on the return to verify validity of the enemy.","issue":"3132"}},"realm":"Server","rets":{"ret":{"text":"Enemy NPC.","name":"","type":"NPC"}}},"example":[{"description":"Kill any npc that sets the first player as its enemy.","code":"local function Think()\n\tfor i, ent in ipairs( ents.GetAll() ) do\n\t\tif ent:IsNPC() and ent:GetEnemy() == Entity( 1 ) then\n\t\t\tent:TakeDamage( 999 )\n\t\tend\n\tend\nend\n\nhook.Add( \"Think\", \"Kill My Enemies\", Think )","output":"Any npc that sets their enemy to Entity( 1 ) dies."},{"description":"Make every NPC that does not have an enemy (and preferably a D_HT relationship agains Players) start attacking a random Player. This code is copied from the gamemode [My Base Defence](https://steamcommunity.com/sharedfiles/filedetails/?id=1647345157):","code":"-- ...\nlocal function _SetRandomPlayerTargetForNPC(npc)\n\tif (npc:IsNPC()) then\n\t\tif (!IsValid(npc:GetEnemy())) then\n\t\t\tlocal _allPlayers\t= player.GetAll()\n\t\t\tlocal _winnerPlNr\t= math.random(1, #_allPlayers)\n\n\t\t\ttimer.Simple(0.15, function()\n\t\t\t\tlocal __Player = _allPlayers[_winnerPlNr]\n\t\t\t\t--\n\t\t\t\t--- Set the enemy for the NPC, so it does not just stand there doing nothing\n\t\t\t\t-- lika young lazy teen or something\n\t\t\t\tif (!npc:IsValid() or !__Player:IsValid()) then return end\n\t\t\t\tnpc:SetEnemy(__Player)\n\t\t\t\tnpc:UpdateEnemyMemory(__Player, __Player:GetPos())\n\t\t\t\tnpc:SetSchedule(SCHED_SHOOT_ENEMY_COVER)\n\t\t\tend)\n\t\tend\n\tend\nend\n-- - - ---\n-- --\n-- Make every NPC that might not have a target, recive one random Player..:>>\n-- (..you can place this loop inside an interval timer or something...)\nfor i, ent in ipairs( ents.GetAll('npc_*') ) do\n\tif ent:IsValid() then _SetRandomPlayerTargetForNPC( ent ) end\nend","output":"All NPCs on the SERVER will get their memory updated if they don't already have an enemy, and start moving to the last know position of the enemy and try to attack. This enemy will be a random Player. They will also try and shoot enemy cover."}],"realms":["Server"],"type":"Function"},
{"function":{"name":"GetEnemyFirstTimeSeen","parent":"NPC","type":"classfunc","description":"Returns the first time an NPC's enemy was seen by the NPC.","realm":"Server","added":"2020.06.24","args":{"arg":{"text":"The enemy to check.","name":"enemy","type":"Entity","default":"GetEnemy()"}},"rets":{"ret":{"text":"First time the given enemy was seen.","name":"time","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetEnemyLastKnownPos","parent":"NPC","type":"classfunc","description":"Returns the last known position of an NPC's enemy.\n\nSimilar to NPC:GetEnemyLastSeenPos, but the known position will be a few seconds ahead of the last seen position.","realm":"Server","added":"2020.06.24","args":{"arg":{"text":"The enemy to check.","name":"enemy","type":"Entity","default":"GetEnemy()"}},"rets":{"ret":{"text":"The last known position.","name":"pos","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetEnemyLastSeenPos","parent":"NPC","type":"classfunc","description":"Returns the last seen position of an NPC's enemy.\n\nSimilar to NPC:GetEnemyLastKnownPos, but the known position will be a few seconds ahead of the last seen position.","realm":"Server","added":"2020.06.24","args":{"arg":{"text":"The enemy to check.","name":"enemy","type":"Entity","default":"GetEnemy()"}},"rets":{"ret":{"text":"The last seen position.","name":"pos","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetEnemyLastTimeSeen","parent":"NPC","type":"classfunc","description":"Returns the last time an NPC's enemy was seen by the NPC.","realm":"Server","added":"2020.06.24","args":{"arg":{"text":"The enemy to check.","name":"enemy","type":"Entity","default":"GetEnemy()"}},"rets":{"ret":{"text":"Last time the given enemy was seen.","name":"time","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetExpression","parent":"NPC","type":"classfunc","description":"Returns the expression file the NPC is currently playing.","realm":"Server","rets":{"ret":{"text":"The file path of the expression.","name":"m_iszExpressionScene","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetEyeDirection","parent":"NPC","type":"classfunc","description":"Returns the eye direction of the NPC.","realm":"Server","added":"2025.03.07","rets":{"ret":{"text":"The eye direction.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetFOV","parent":"NPC","type":"classfunc","description":"Returns the Field Of View of the NPC. See NPC:SetFOV.","realm":"Server","added":"2024.12.03","rets":{"ret":{"text":"The FOV for the NPC in degrees.","name":"fov","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetGoalPos","parent":"NPC","type":"classfunc","description":"Returns the position we are trying to reach, if any.","realm":"Server","added":"2023.10.04","rets":{"ret":{"text":"The position we are trying to reach.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetGoalTarget","parent":"NPC","type":"classfunc","description":"Returns the entity we are trying to reach, if any.","realm":"Server","added":"2023.10.04","rets":{"ret":{"text":"The entity we are trying to reach, or `NULL`.","name":"","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetHeadDirection","parent":"NPC","type":"classfunc","description":"Returns the 2D head direction of the NPC.","realm":"Server","added":"2025.03.07","rets":{"ret":{"text":"The head direction.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetHullType","parent":"NPC","type":"classfunc","description":"Returns NPCs hull type set by NPC:SetHullType.","realm":"Server","rets":{"ret":{"text":"Hull type, see Enums/HULL","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetIdealActivity","parent":"NPC","type":"classfunc","description":{"text":"Returns the ideal activity the NPC currently wants to achieve.","note":"By default, base NPCs will automatically attempt to play a sequence bound to the ideal activity. To prevent ideal activity from overriding NPC's active sequence, set this to `ACT_DO_NOT_DISTURB`."},"realm":"Server","added":"2021.01.27","rets":{"ret":{"text":"The ideal activity. Enums/ACT.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetIdealMoveAcceleration","parent":"NPC","type":"classfunc","description":"Returns the ideal move acceleration of the NPC.","realm":"Server","added":"2021.03.31","rets":{"ret":{"text":"The ideal move acceleration.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetIdealMoveSpeed","parent":"NPC","type":"classfunc","description":"Returns the ideal move speed of the NPC.","realm":"Server","added":"2021.03.31","rets":{"ret":{"text":"The ideal move speed.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetIdealSequence","parent":"NPC","type":"classfunc","description":"Returns the ideal sequence the NPC currently wants to achieve.","realm":"Server","added":"2024.02.02","rets":{"ret":{"text":"The ideal sequence, specific to the NPCs model.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetIdealYaw","parent":"NPC","type":"classfunc","description":"Returns the ideal yaw (left right rotation) for this NPC at this moment.","realm":"Server","added":"2023.09.06","rets":{"ret":{"text":"The ideal yaw.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetKnownEnemies","parent":"NPC","type":"classfunc","description":"Returns all known enemies this NPC has. The enemy table is updated with NPC:UpdateEnemyMemory and NPC:ClearEnemyMemory, meaning other entities may be in enemies list even though your NPC doesn't hate it. \n\nSee also NPC:GetKnownEnemyCount","added":"2022.06.08","realm":"Server","rets":{"ret":{"text":"Table of entities that this NPC knows as enemies.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetKnownEnemyCount","parent":"NPC","type":"classfunc","description":"Returns known enemy count of this NPC.\n\nSee also NPC:GetKnownEnemies","added":"2022.06.08","realm":"Server","rets":{"ret":{"text":"Amount of entities that this NPC knows as enemies.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetLastPosition","parent":"NPC","type":"classfunc","description":"Returns the last registered or memorized position of the NPC. When using scheduling, the NPC will focus on navigating to the last position via nodes.\n\nSee NPC:SetLastPosition.","realm":"Server","added":"2024.12.11","rets":{"ret":{"text":"Where the NPC's last position was set to.","name":"position","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetLastTimeTookDamageFromEnemy","parent":"NPC","type":"classfunc","description":"Returns Global.CurTime based time since this NPC last received damage from given enemy. The last damage time is set when NPC:MarkTookDamageFromEnemy is called.","added":"2022.06.08","realm":"Server","args":{"arg":{"text":"The enemy to test. Defaults to currently active enemy (NPC:GetEnemy)","name":"enemy","type":"Entity","default":"nil"}},"rets":{"ret":{"text":"Time since this NPC last received damage from given enemy.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetMaxLookDistance","parent":"NPC","type":"classfunc","description":"Returns NPCs max view distance. An NPC will not be able to see enemies outside of this distance.","realm":"Server","added":"2023.01.25","rets":{"ret":{"text":"The maximum distance the NPC can see at.","name":"dist","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetMinMoveCheckDist","parent":"NPC","type":"classfunc","description":"Returns how far should the NPC look ahead in its route.","realm":"Server","added":"2021.03.31","rets":{"ret":{"text":"How far the NPC checks ahead of its route.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetMinMoveStopDist","parent":"NPC","type":"classfunc","description":"Returns how far before the NPC can come to a complete stop.","realm":"Server","added":"2021.03.31","args":{"arg":{"text":"The minimum value that will be returned by this function.","name":"minResult ","type":"number","default":"10"}},"rets":{"ret":{"text":"The minimum stop distance.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetMoveDelay","parent":"NPC","type":"classfunc","description":"Returns the movement delay for given NPC.\n\nSee NPC:SetMoveDelay.","realm":"Server","added":"2024.12.11","rets":{"ret":{"text":"The movement delay.","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetMoveInterval","parent":"NPC","type":"classfunc","description":"Returns the current timestep the internal NPC motor is working on.","realm":"Server","added":"2021.03.31","rets":{"ret":{"text":"The current timestep.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetMovementActivity","parent":"NPC","type":"classfunc","description":"Returns the NPC's current movement activity.","realm":"Server","rets":{"ret":{"text":"Current NPC movement activity, see Enums/ACT.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetMovementSequence","parent":"NPC","type":"classfunc","description":"Returns the index of the sequence the NPC uses to move.","realm":"Server","rets":{"ret":{"text":"The movement sequence index","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetMoveVelocity","parent":"NPC","type":"classfunc","description":"Returns the current move velocity of the NPC.","realm":"Server","added":"2021.03.31","rets":{"ret":{"text":"The current move velocity of the NPC.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetNavType","parent":"NPC","type":"classfunc","description":"Returns the NPC's navigation type.","realm":"Server","added":"2021.03.31","rets":{"ret":{"text":"The nav type. See Enums/NAV.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetNearestSquadMember","parent":"NPC","type":"classfunc","description":"Returns the nearest member of the squad the NPC is in.","realm":"Server","added":"2021.01.27","rets":{"ret":{"text":"The nearest member of the squad the NPC is in.","name":"nearest_member","type":"NPC"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetNextWaypointPos","parent":"NPC","type":"classfunc","description":"Gets the NPC's next waypoint position, where NPC will be moving after reaching current waypoint, if any is available.","realm":"Server","added":"2020.03.17","rets":{"ret":{"text":"The position of the next NPC waypoint.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetNPCState","parent":"NPC","type":"classfunc","description":"Returns the NPC's state.","realm":"Server","rets":{"ret":{"text":"The NPC's current state, see Enums/NPC_STATE.","name":"","type":"number"}}},"example":{"description":"Function which prints out a list of idle NPCs to the server console.","code":"function ReportIdleNPCs()\n\tfor i, npc in ipairs( ents.FindByClass( \"npc_*\" ) ) do\n\t\tif IsValid( npc ) and npc:IsNPC() and npc:GetNPCState() == NPC_STATE_IDLE then\n\t\t\tprint( \"Ent #\" .. npc:EntIndex() .. \": \" .. npc:GetClass() .. \" is idle.\" )\n\t\tend\n\tend\nend","output":"(To server console)\n\n\nEnt #111: npc_citizen is idle.\n\n\nEnt #120: npc_citizen is idle.\n\n\nEnt #122: npc_citizen is idle.\n\n\nEnt #124: npc_citizen is idle."},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetPathDistanceToGoal","parent":"NPC","type":"classfunc","realm":"Server","description":"Returns the distance the NPC is from Target Goal.","rets":{"ret":{"text":"The number of hammer units the NPC is away from the Goal.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetPathTimeToGoal","parent":"NPC","type":"classfunc","realm":"Server","description":"Returns the amount of time it will take for the NPC to get to its Target Goal.","rets":{"ret":{"text":"The amount of time to get to the target goal.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetShootPos","parent":"NPC","type":"classfunc","description":"Returns the shooting position of the NPC, i.e. where their bullets would come from, etc. \n\nIf the NPC does not overwrite this, it will return Entity:GetPos.","realm":"Server","rets":{"ret":{"text":"The NPC's shooting position.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetSquad","parent":"NPC","type":"classfunc","description":"Returns the current squad name of the NPC, as set via NPC:SetSquad.","realm":"Server","added":"2021.01.27","rets":{"ret":{"text":"The new squad name to set.","name":"name","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetStepHeight","parent":"NPC","type":"classfunc","description":"Returns NPC step height.","realm":"Server","added":"2024.05.14","rets":{"ret":{"text":"The current step height.","name":"height","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetTarget","parent":"NPC","type":"classfunc","description":{"text":"Returns the NPC's current target set by NPC:SetTarget.","bug":{"text":"This returns nil if the NPC has no target. You should use Global.IsValid (which accounts for nil and NULL) on the return to verify validity of the target.","issue":"3132"}},"realm":"Server","rets":{"ret":{"text":"Target entity","name":"","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetTaskStatus","parent":"NPC","type":"classfunc","description":"Returns the status of the current task.","realm":"Server","added":"2021.03.31","rets":{"ret":{"text":"The status. See Enums/TASKSTATUS.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetTimeEnemyLastReacquired","parent":"NPC","type":"classfunc","description":"Returns Global.CurTime based time since the enemy was reacquired, meaning it is currently in Line of Sight of the NPC.","added":"2022.06.08","realm":"Server","args":{"arg":{"text":"The enemy to test. Defaults to currently active enemy (NPC:GetEnemy)","name":"enemy","type":"Entity","default":"nil"}},"rets":{"ret":{"text":"Time enemy was last reacquired.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetViewOffset","parent":"NPC","type":"classfunc","description":"Returns the view offset of the NPC. Set by NPC:SetViewOffset.","realm":"Server","added":"2023.09.26","rets":{"ret":{"text":"The view offset of the NPC.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetWeapon","parent":"NPC","type":"classfunc","description":"Returns a specific weapon the NPC owns.","realm":"Server","added":"2020.06.24","args":{"arg":{"text":"A classname of the weapon to try to get.","name":"class","type":"string"}},"rets":{"ret":{"text":"The weapon for the specified class, or NULL of the NPC doesn't have given weapon.","name":"wep","type":"Weapon"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetWeapons","parent":"NPC","type":"classfunc","description":"Returns a table of the NPC's weapons.","realm":"Server","added":"2020.06.24","rets":{"ret":{"text":"A list of the weapons the NPC currently has.","name":"","type":"table<Weapon>"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Give","parent":"NPC","type":"classfunc","description":"Used to give a weapon to an already spawned NPC.","realm":"Server","args":{"arg":{"text":"Class name of the weapon to equip to the NPC.","name":"weapon","type":"string"}},"rets":{"ret":{"text":"The weapon entity given to the NPC.","name":"","type":"Weapon"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"HasCondition","parent":"NPC","type":"classfunc","description":"Returns whether or not the NPC has the given condition.","realm":"Server","args":{"arg":{"text":"The condition index, see Enums/COND.","name":"condition","type":"number"}},"rets":{"ret":{"text":"True if the NPC has the given condition, false otherwise.","name":"","type":"boolean"}}},"example":{"description":"Function that prints a list of conditions an NPC has.","code":"function ListConditions(npc)\n\t\n\tif(!IsValid(npc)) then return end\n\t\n\tprint(npc:GetClass()..\" (\"..npc:EntIndex()..\") has conditions:\")\n\t\n\tfor c = 0, 100 do\n\t\n\t\tif(npc:HasCondition(c)) then\n\t\t\n\t\t\tprint(npc:ConditionName(c))\n\t\t\t\n\t\tend\n\t\t\n\tend\n\t\nend","output":"(To server console):\n\n\nnpc_antlion (120) has conditions:\n\n\nCOND.IN_PVS\n\n\nCOND.NO_WEAPON\n\n\nCOND.HAVE_ENEMY_LOS\n\n\nCOND.TOO_FAR_TO_ATTACK\n\n\nCOND.NO_HEAR_DANGER\n\n\nCOND.FLOATING_OFF_GROUND"},"realms":["Server"],"type":"Function"},
{"function":{"name":"HasEnemyEluded","parent":"NPC","type":"classfunc","description":"Polls the enemy memory to check if the given entity has eluded us or not.","realm":"Server","added":"2020.06.24","args":{"arg":{"text":"The enemy to test.","name":"enemy","type":"Entity","default":"GetEnemy()"}},"rets":{"ret":{"text":"If the enemy has eluded us.","name":"eluded","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"HasEnemyMemory","parent":"NPC","type":"classfunc","description":"Polls the enemy memory to check if the NPC has any memory of given enemy.","realm":"Server","added":"2020.06.24","args":{"arg":{"text":"The entity to test.","name":"enemy","type":"Entity","default":"GetEnemy()"}},"rets":{"ret":{"text":"If we have any memory on given enemy.","name":"eluded","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"HasObstacles","parent":"NPC","type":"classfunc","description":"Returns true if the current navigation has an obstacle, this is different from NPC:GetBlockingEntity, this is for virtual navigation obstacles put by AI's local navigation system to prevent movement to the marked area, forcing NPC to steer around, [for example](https://github.com/ValveSoftware/source-sdk-2013/blob/master/src/game/server/hl2/npc_playercompanion.cpp#L2897).","realm":"Server","added":"2021.03.31","rets":{"ret":{"text":"`true` if the current navigation has an obstacle.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IdleSound","parent":"NPC","type":"classfunc","description":"Force an NPC to play their Idle sound.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"IgnoreEnemyUntil","parent":"NPC","type":"classfunc","description":"Makes the NPC ignore given entity/enemy until given time.","realm":"Server","added":"2022.06.08","args":{"arg":[{"text":"The enemy to ignore.","name":"enemy","type":"Entity"},{"text":"How long to ignore the enemy for. This will be compared to Global.CurTime, so your value should be based on it.","name":"until","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsCrouching","parent":"NPC","type":"classfunc","description":"Returns whether the NPC is currently crouching or not. Citizens and Combine Soldiers are capable of this behavior by default.","added":"2025.08.04","realm":"Server","rets":{"ret":{"text":"Whether the NPC is currently crouching.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsCurrentSchedule","parent":"NPC","type":"classfunc","description":"Returns whether or not the NPC is performing the given schedule.","realm":"Server","args":{"arg":{"text":"The schedule number, see Enums/SCHED.","name":"schedule","type":"number"}},"rets":{"ret":{"text":"True if the NPC is performing the given schedule, false otherwise.","name":"","type":"boolean"}}},"example":{"description":"Function which returns the schedule an NPC is performing.","code":"function GetNPCSchedule(npc)\n\n\tif(!IsValid(npc)) then return end\n\t\n\tfor s = 0, LAST_SHARED_SCHEDULE-1 do\n\t\tif(npc:IsCurrentSchedule(s)) then return s end\n\tend\n\t\n\treturn 0\n\t\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsCurWaypointGoal","parent":"NPC","type":"classfunc","description":"Returns whether the current navigational waypoint is the final one.","realm":"Server","added":"2023.10.04","rets":{"ret":{"text":"Whether the current navigational waypoint is the final one.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsFacingIdealYaw","parent":"NPC","type":"classfunc","description":"Returns whether the NPC is facing their ideal yaw. See NPC:SetIdealYaw, NPC:GetIdealYaw and NPC:SetIdealYawAndUpdate.","realm":"Server","added":"2023.11.17","rets":{"ret":{"text":"Whether the NPC is facing their ideal yaw.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsGoalActive","parent":"NPC","type":"classfunc","description":"Returns whether the NPC has an active goal.","realm":"Server","added":"2021.03.31","rets":{"ret":{"text":"Whether the NPC has an active goal or not.","name":"act","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsInViewCone","parent":"NPC","type":"classfunc","description":"Tests whether a position or an NPC is in the view cone of the NPC.","realm":"Server","added":"2024.12.03","args":[{"arg":{"text":"The position to test.","name":"position","type":"Vector"}},{"name":"Entity input","arg":{"text":"The entity to test. Will use the entity's position.","name":"ent","type":"Entity"}}],"rets":{"ret":{"text":"If the given position is in the view cone.","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsMoveYawLocked","parent":"NPC","type":"classfunc","description":"Returns if the current movement is locked on the Yaw axis.","realm":"Server","added":"2021.03.31","rets":{"ret":{"text":"Whether the movement is yaw locked or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsMoving","parent":"NPC","type":"classfunc","description":"Returns whether the NPC is moving or not.","realm":"Server","rets":{"ret":{"text":"Whether the NPC is moving or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsRunningBehavior","parent":"NPC","type":"classfunc","realm":"Server","description":"Checks if the NPC is running an **ai_goal**. ( e.g. An npc_citizen NPC following the Player. )","rets":{"ret":{"text":"Returns true if running an ai_goal, otherwise returns false.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsSquadLeader","parent":"NPC","type":"classfunc","description":"Returns whether the current NPC is the leader of the squad it is in.","realm":"Server","added":"2021.01.27","rets":{"ret":{"text":"Whether the NPC is the leader of the squad or not.","name":"is_leader","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsUnforgettable","parent":"NPC","type":"classfunc","description":"Returns the \"forgettable\" status for a given enemy, as set by NPC:SetUnforgettable, or by internal logic of engine NPCs.","added":"2025.09.04","realm":"Server","args":{"arg":{"text":"Enemy entity to check.","name":"enemy","type":"Entity"}},"rets":{"ret":{"text":"Whether the given enemy is unforgettable (`true`) or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsUnreachable","parent":"NPC","type":"classfunc","description":"Returns true if the entity was remembered as unreachable. The memory is updated automatically from following engine tasks if they failed:\n* TASK_GET_CHASE_PATH_TO_ENEMY\n* TASK_GET_PATH_TO_ENEMY_LKP\n* TASK_GET_PATH_TO_INTERACTION_PARTNER\n* TASK_ANTLIONGUARD_GET_CHASE_PATH_ENEMY_TOLERANCE\n* SCHED_FAIL_ESTABLISH_LINE_OF_FIRE - Combine NPCs, also when failing to change their enemy","realm":"Server","args":{"arg":{"text":"The entity to test.","name":"testEntity","type":"Entity"}},"rets":{"ret":{"text":"If the entity is reachable or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"LostEnemySound","parent":"NPC","type":"classfunc","description":"Force an NPC to play their LostEnemy sound.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"MaintainActivity","parent":"NPC","type":"classfunc","description":"Tries to achieve our ideal animation state, playing any transition sequences that we need to play to get there.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"MarkEnemyAsEluded","parent":"NPC","type":"classfunc","description":"Causes the NPC to temporarily forget the current enemy and switch on to a better one.","realm":"Server","args":{"arg":{"text":"The enemy to mark","name":"enemy","type":"Entity","default":"GetEnemy()","added":"2020.06.24"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"MarkTookDamageFromEnemy","parent":"NPC","type":"classfunc","description":"Marks the NPC as took damage from given entity.\n\nSee also NPC:GetLastTimeTookDamageFromEnemy.","added":"2022.06.08","realm":"Server","args":{"arg":{"text":"The enemy to mark. Defaults to currently active enemy (NPC:GetEnemy)","name":"enemy","type":"Entity","default":"nil"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"MoveClimbExec","parent":"NPC","type":"classfunc","description":"Executes a climb move.\n\nRelated functions are NPC:MoveClimbStart and NPC:MoveClimbStop.","realm":"Server","added":"2021.03.31","args":{"arg":[{"text":"The destination of the climb.","name":"destination","type":"Vector"},{"text":"The direction of the climb.","name":"dir","type":"Vector"},{"text":"The distance.","name":"distance","type":"number"},{"text":"The yaw angle.","name":"yaw","type":"number"},{"text":"Amount of climb nodes left?","name":"left","type":"number"}]},"rets":{"ret":{"text":"The result. See Enums/AIMR.","name":"","type":"number{AIMR}"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"MoveClimbStart","parent":"NPC","type":"classfunc","description":"Starts a climb move.\n\nRelated functions are NPC:MoveClimbExec and NPC:MoveClimbStop.","realm":"Server","added":"2021.03.31","args":{"arg":[{"text":"The destination of the climb.","name":"destination","type":"Vector"},{"text":"The direction of the climb.","name":"dir","type":"Vector"},{"text":"The distance.","name":"distance","type":"number"},{"text":"The yaw angle.","name":"yaw","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"MoveClimbStop","parent":"NPC","type":"classfunc","description":"Stops a climb move.\n\nRelated functions are NPC:MoveClimbExec and NPC:MoveClimbStart.","realm":"Server","added":"2021.03.31"},"realms":["Server"],"type":"Function"},
{"function":{"name":"MoveGroundStep","parent":"NPC","type":"classfunc","description":"Similar to other `NPC:Move*` functions, invokes internal code to move the NPC to a given location.\n\nMeant to be used within ENTITY:OverrideMove.","added":"2025.09.03","realm":"Server","args":{"arg":[{"text":"The position we want to reach.","name":"pos","type":"Vector"},{"text":"Used to test whether we hit the move target when deciding success.","name":"targetEntity","type":"Entity","default":"nil"},{"text":"Target Yaw angle at the end of the move. -1 to keep original yaw.","name":"yaw","type":"number","default":"-1"},{"text":"Whether to move as far as possible.","name":"asFarAsCan","type":"boolean","default":"true"},{"text":"Also test the Z axis of the target position and NPC position to decide success.","name":"testZ","type":"boolean","default":"true"}]},"rets":{"ret":{"text":"Whether the movement succeeded or not.\n\n`AIMotorMoveResult_t` enum:\n* AIM_FAILED = 0\n* AIM_SUCCESS = 1\n* AIM_PARTIAL_HIT_NPC = 2\n* AIM_PARTIAL_HIT_WORLD = 3\n* AIM_PARTIAL_HIT_TARGET = 4","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"MoveJumpExec","parent":"NPC","type":"classfunc","description":"Executes a jump move.\n\nRelated functions are NPC:MoveJumpStart and NPC:MoveJumpStop.","realm":"Server","added":"2021.03.31","rets":{"ret":{"text":"The result. See Enums/AIMR.","name":"","type":"number{AIMR}"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"MoveJumpStart","parent":"NPC","type":"classfunc","description":"Starts a jump move.\n\nRelated functions are NPC:MoveJumpExec and NPC:MoveJumpStop.","realm":"Server","added":"2021.03.31","args":{"arg":{"text":"The jump velocity.","name":"vel","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"MoveJumpStop","parent":"NPC","type":"classfunc","description":"Stops a jump move.\n\nRelated functions are NPC:MoveJumpExec and NPC:MoveJumpStart.","realm":"Server","added":"2021.03.31","rets":{"ret":{"text":"The result. See Enums/AIMR.","name":"","type":"number{AIMR}"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"MoveOrder","parent":"NPC","type":"classfunc","description":"Makes the NPC walk toward the given position. The NPC will return to the player after amount of time set by **player_squad_autosummon_time** ConVar.\n\nOnly works on Citizens (npc_citizen) and is a part of the Half-Life 2 squad system.\n\nThe NPC **must** be in the player's squad for this to work.","realm":"Server","args":{"arg":{"text":"The target position for the NPC to walk to.","name":"position","type":"Vector"}}},"example":{"description":"A console command that makes all Citizens on the map (if they are in the player's squad) try to go to where the player is looking at.","code":"concommand.Add( \"movenpcs\", function( ply )\n\tfor id, npc in ipairs( ents.FindByClass( \"npc_citizen\" ) ) do\n\t\tnpc:MoveOrder( ply:GetEyeTrace().HitPos )\n\tend\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"MovePause","parent":"NPC","type":"classfunc","description":"Pauses the NPC movement?\n\nRelated functions are NPC:MoveStart, NPC:MoveStop and NPC:ResetMoveCalc.","realm":"Server","added":"2021.03.31"},"realms":["Server"],"type":"Function"},
{"function":{"name":"MoveStart","parent":"NPC","type":"classfunc","description":"Starts NPC movement?\n\nRelated functions are NPC:MoveStop, NPC:MovePause and NPC:ResetMoveCalc.","realm":"Server","added":"2021.03.31"},"realms":["Server"],"type":"Function"},
{"function":{"name":"MoveStop","parent":"NPC","type":"classfunc","description":"Stops the NPC movement?\n\nRelated functions are NPC:MoveStart, NPC:MovePause and NPC:ResetMoveCalc.","realm":"Server","added":"2021.03.31"},"realms":["Server"],"type":"Function"},
{"function":{"name":"NavSetGoal","parent":"NPC","type":"classfunc","description":"Picks random node around given vector, around specified length, using dir as search direction start. Works similarly to NPC:NavSetRandomGoal, but you can decide any position you want as a search starting point rather than your NPC.","realm":"Server","args":{"arg":[{"text":"The origin to calculate a path from.","name":"pos","type":"Vector"},{"text":"The target length of the path to calculate.","name":"length","type":"number"},{"text":"The direction in which to look for a new path end goal.","name":"dir","type":"Vector"}]},"rets":{"ret":{"text":"Whether path generation was successful or not.","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"NavSetGoalPos","parent":"NPC","type":"classfunc","description":{"text":"Creates a path to closest node at given position. This won't actually force the NPC to move.\n\n\n\nSee also NPC:NavSetRandomGoal.","note":"This will call either NPC:TaskComplete or NPC:TaskFail for the current schedule and task, forcing the current task to progress to next task or fail."},"realm":"Server","added":"2022.06.08","args":{"arg":{"text":"The position to calculate a path to.","name":"pos","type":"Vector"}},"rets":{"ret":{"text":"Whether path generation was successful or not.","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"NavSetGoalTarget","parent":"NPC","type":"classfunc","description":"Set the goal target for an NPC.\n\nThis will call either NPC:TaskComplete or NPC:TaskFail for the current schedule and task, forcing the current task to progress to next task or fail.","realm":"Server","args":{"arg":[{"text":"The targeted entity to set the goal to.","name":"target","type":"Entity"},{"text":"The offset to apply to the targeted entity's position.","name":"offset","type":"Vector","default":"Vector( 0, 0, 0 )"}]},"rets":{"ret":{"text":"Whether path generation was successful or not","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"NavSetRandomGoal","parent":"NPC","type":"classfunc","description":"Creates a random path of specified minimum length between a closest start node and random node in the specified direction. This won't actually force the NPC to move.","realm":"Server","args":{"arg":[{"text":"Minimum length of path in units","name":"minPathLength","type":"number"},{"text":"Unit vector pointing in the direction of the target random node","name":"dir","type":"Vector"}]},"rets":{"ret":{"text":"Whether path generation was successful or not","type":"boolean"}}},"example":{"description":"Example usage. Keep in mind that non scriptable NPCs will override their tasks occasionally. This is meant for scriptable NPCs","code":"function MakeNPCGo( npc )\n\t-- Choose a random node to go to at least 200 units away from us in the direction we are looking\n\tnpc:NavSetRandomGoal( 200, npc:GetAimVector() )\n\t\n\t-- At this point npc:GetPathDistanceToGoal() will return a different value, if a new path was generated\n\n\t-- Force us to go there\n\t-- 48 is TASK_RUN_PATH\n\tnpc:StartEngineTask( 48, 0 )\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"NavSetWanderGoal","parent":"NPC","type":"classfunc","description":"Sets a goal in x, y offsets for the NPC to wander to","realm":"Server","args":{"arg":[{"text":"X offset","name":"xOffset","type":"number"},{"text":"Y offset","name":"yOffset","type":"number"}]},"rets":{"ret":{"text":"Whether path generation was successful or not","type":"boolean"}}},"example":{"description":"Given an NPC makes them wander to a location 100 units in both the x and y directions","code":"if IsValid( npc ) then\n    npc:NavSetWanderGoal( 100, 100 )\n    npc:SetSchedule( SCHED_IDLE_WANDER )\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PickupWeapon","parent":"NPC","type":"classfunc","description":"Forces the NPC to pickup an existing weapon entity. The NPC will not pick up the weapon if they already own a weapon of given type, or if the NPC could not normally have this weapon in their inventory.","realm":"Server","added":"2020.06.24","args":{"arg":{"text":"The weapon to try to pick up.","name":"wep","type":"Weapon"}},"rets":{"ret":{"text":"Whether the NPC succeeded in picking up the weapon or not.","name":"result","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlaySentence","parent":"NPC","type":"classfunc","description":"Forces the NPC to play a sentence from scripts/sentences.txt","realm":"Server","args":{"arg":[{"text":"The sentence string to speak.","name":"sentence","type":"string"},{"text":"Delay in seconds until the sentence starts playing.","name":"delay","type":"number"},{"text":"The volume of the sentence, from 0 to 1.","name":"volume","type":"number"}]},"rets":{"ret":{"text":"Returns the sentence index, -1 if the sentence couldn't be played.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"RememberUnreachable","parent":"NPC","type":"classfunc","description":"Makes the NPC remember an entity or an enemy as unreachable, for a specified amount of time. Use NPC:IsUnreachable to check if an entity is still unreachable.","realm":"Server","added":"2020.06.24","args":{"arg":[{"text":"The entity to mark as unreachable.","name":"ent","type":"Entity"},{"text":"For how long to remember the entity as unreachable. Negative values will act as `3` seconds.","name":"time","type":"number","default":"3"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"RemoveIgnoreConditions","parent":"NPC","type":"classfunc","description":"Removes conditions to ignore for the this NPC.","realm":"Server","added":"2023.11.17","args":{"arg":{"text":"Ignore conditions to remove, see Enums/COND. If omitted, removes all ignore conditions.","name":"conditions","type":"table","default":"nil"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ResetIdealActivity","parent":"NPC","type":"classfunc","description":"Resets the ideal activity of the NPC. See also NPC:SetIdealActivity.","realm":"Server","added":"2021.03.31","args":{"arg":{"text":"The new activity. See Enums/ACT.","name":"act","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ResetMoveCalc","parent":"NPC","type":"classfunc","description":"Resets all the movement calculations.\n\nRelated functions are NPC:MoveStart, NPC:MovePause and NPC:MoveStop.","realm":"Server","added":"2021.03.31"},"realms":["Server"],"type":"Function"},
{"function":{"name":"RunEngineTask","parent":"NPC","type":"classfunc","description":"Starts an engine task.\n\nUsed internally by the ai_task.","realm":"Server","args":{"arg":[{"text":"The task ID, see [ai_task.h](https://github.com/ValveSoftware/source-sdk-2013/blob/55ed12f8d1eb6887d348be03aee5573d44177ffb/mp/src/game/server/ai_task.h#L89-L502)","name":"taskID","type":"number"},{"text":"The task data.","name":"taskData","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SelectWeapon","parent":"NPC","type":"classfunc","description":"Forces the NPC to switch to a specific weapon the NPC owns. See NPC:GetWeapons.","realm":"Server","added":"2020.06.24","args":{"arg":{"text":"A classname of the weapon or a Weapon entity to switch to.","name":"weapon","type":"string|Weapon"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SentenceStop","parent":"NPC","type":"classfunc","description":"Stops any sounds (speech) the NPC is currently playing.\n\nEquivalent to `Entity:EmitSound( \"AI_BaseNPC.SentenceStop\" )`","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetActivity","parent":"NPC","type":"classfunc","description":"Sets the NPC's current activity.","realm":"Server","added":"2021.03.31","args":{"arg":{"text":"The new activity to set, see Enums/ACT.","name":"act","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetArrivalActivity","parent":"NPC","type":"classfunc","realm":"Server","args":{"arg":{"text":"See Enums/ACT.","name":"act","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetArrivalDirection","parent":"NPC","type":"classfunc","description":"Sets the direction from the NPC origin to its current navigational destination.","realm":"Server","args":{"arg":{"text":"The new arrival direction.","name":"dir","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetArrivalDistance","parent":"NPC","type":"classfunc","description":"Sets the distance to goal at which the NPC should stop moving and continue to other business such as doing the rest of their tasks in a schedule.","realm":"Server","args":{"arg":{"text":"The distance to goal that is close enough for the NPC","name":"dist","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetArrivalSequence","parent":"NPC","type":"classfunc","description":"Sets the sequence to be played when the NPC arrives at its goal.","realm":"Server","args":{"arg":{"text":"See Entity:LookupSequence.","name":"seq","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetArrivalSpeed","parent":"NPC","type":"classfunc","description":"Sets the arrival speed? of the NPC","realm":"Server","args":{"arg":{"text":"The new arrival speed","name":"speed","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetCondition","parent":"NPC","type":"classfunc","description":"Sets an NPC condition.","realm":"Server","args":{"arg":{"text":"The condition index, see Enums/COND.","name":"condition","type":"number{COND}"}}},"example":{"description":"Freezes an NPC for a period of time.","code":"function FreezeNPCTemporarily(npc, delay)\n\t\n\tif(!IsValid(npc)) then return end\n\t\n\tdelay = delay or 1\n\t\n\tnpc:SetSchedule(SCHED_NPC_FREEZE)\n\n\ttimer.Simple(delay, function()\n\t\tif(IsValid(npc)) then npc:SetCondition(COND.NPC_UNFREEZE) end\n\tend)\n\t\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetCurrentWeaponProficiency","parent":"NPC","type":"classfunc","description":"Sets the weapon proficiency of an NPC (how skilled an NPC is with its current weapon).","realm":"Server","args":{"arg":{"text":"The proficiency for the NPC's current weapon. See Enums/WEAPON_PROFICIENCY.","name":"proficiency","type":"number"}}},"example":{"description":"Makes all NPCs suck at using their current weapons.","code":"for _, v in ents.Iterator() do\n\tif ( v:IsNPC() ) then\n\t\tnpc:SetCurrentWeaponProficiency( WEAPON_PROFICIENCY_POOR )\n\tend\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetEnemy","parent":"NPC","type":"classfunc","description":"Sets the target for an NPC.","realm":"Server","args":{"arg":[{"text":"The enemy that the NPC should target","name":"enemy","type":"Entity"},{"text":"Calls NPC:SetCondition(COND.NEW_ENEMY) if the new enemy is valid and not equal to the last enemy.","name":"newenemy","type":"boolean","default":"true"}]}},"example":{"description":"If an NPC has no specific target, they will start to target the closest player they are hostile to, or nothing if there are none. This is run every tick on the server and can be a bottleneck if player and/or entity counts are high, so consider adding a Global.CurTime cooldown if you plan on using this in-game.","code":{"text":"hook.Add( \"Think\", \"NPCAutoSeekPlayer\", function()\n\tlocal npcs = ents.GetAll()\n\tlocal plys = player.GetAll()\n\tlocal plyCount = #plys\n\n\t-- No point trying to give NPCs a player when there are none\n\tif ( plyCount == 0 ) then\n\t\treturn\n\tend\n\n\t-- Loop over all entities and check for NPCs\n\tfor i = 1, #npcs do\n\t\tlocal npc = npcs[ i ]\n\n\t\t-- If this entity is an NPC without an enemy, give them one\n\t\tif ( npc:IsNPC() && !IsValid( npc:GetEnemy() ) ) then\n\t\t\tlocal curPly = nil\t\t\t-- Closest player\n\t\t\tlocal curPlyPos = nil\t\t-- Position of closest player\n\t\t\tlocal curDist = math.huge\t-- Lowest distance between npc and player\n\t\t\t\n\t\t\tlocal npcPos = npc:GetPos()\t-- Position of the NPC\n\n\t\t\t-- Loop over all players to check their distance from the NPC\n\t\t\tfor i = 1, plyCount do\n\t\t\t\tlocal ply = plys[ i ]\n\n\t\t\t\t-- Only consider players that this NPC hates\n\t\t\t\tif ( npc:Disposition( ply ) == D_HT ) then\n\t\t\t\t\t-- TODO: You can optimise looking up each player's position (constant)\n\t\t\t\t\t-- for every NPC by generating a table of:\n\t\t\t\t\t--- key = player identifier (entity object, UserID, EntIndex, etc.)\n\t\t\t\t\t--- value = player's position vector\n\t\t\t\t\t-- for the first NPC that passes to this part of the code,\n\t\t\t\t\t-- then reuse it for other NPCs\n\t\t\t\t\tlocal plyPos = ply:GetPos()\n\t\t\t\t\t\n\t\t\t\t\t-- Use DistToSqr for distance comparisons since\n\t\t\t\t\t-- it's more efficient than Distance, and the\n\t\t\t\t\t-- non-squared distance isn't needed for anything\n\t\t\t\t\tlocal dist = npcPos:DistToSqr( plyPos )\n\n\t\t\t\t\t-- If the new distance is lower, update the player information\n\t\t\t\t\tif ( dist","curdist":{"then":"","curply":["ply",""],"curplypos":["plyPos",""],"curdist":"dist","end":"","is":"","guarenteed":"","to":"","be":"","valid":"","since":"","this":"","code":"","will":"","only":"","run":"","if":"","there":"","at":"","least":"","one":"","player":"","npc:setenemy":"","npc:updateenemymemory":"","ode":"ode"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetExpression","parent":"NPC","type":"classfunc","description":"Sets the NPC's .vcd expression. Similar to Entity:PlayScene except the scene is looped until it's interrupted by default NPC behavior or NPC:ClearExpression.","realm":"Server","args":{"arg":{"text":"The expression filepath.","name":"m_iszExpressionScene","type":"string"}},"rets":{"ret":{"text":"Default duration of assigned expression, in seconds.","name":"flDuration","type":"number"}}},"example":{"description":"Function which makes the NPC whom the player is looking at repeat an annoying scene.","code":"function GrenadesScene(ply)\n\n\tif(!IsValid(ply)) then return end\n\t\n\tlocal npc = ply:GetEyeTrace().Entity\n\t\n\tif(IsValid(npc) && npc:IsNPC()) then\n\t\tnpc:SetExpression(\"scenes/streetwar/sniper/ba_nag_grenade0\"..math.random(1, 5)..\".vcd\")\n\tend\n\t\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetForceCrouch","parent":"NPC","type":"classfunc","description":"Forces given NPC to crouch, if it is able to do so. Only Citizens and Combine Soldiers can by default.","added":"2025.08.08","realm":"Server","args":{"arg":{"text":"Whether to force the NPC to crouch or not. `false` clears the \"force crouch\" flag, but does not guarantee to force the NPC to stand back up.","name":"force","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetFOV","parent":"NPC","type":"classfunc","description":"Sets the Field Of View of the NPC, for use with such functions as NPC:IsInViewCone. it is also used internally by the NPC for enemy detection, etc.","realm":"Server","added":"2024.12.03","args":{"arg":{"text":"The new FOV for the NPC in degrees.","name":"fov","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetHullSizeNormal","parent":"NPC","type":"classfunc","description":"Updates the NPC's hull and physics hull in order to match its model scale. Entity:SetModelScale seems to take care of this regardless.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetHullType","parent":"NPC","type":"classfunc","description":"Sets the hull type for the NPC.","realm":"Server","args":{"arg":{"text":"Hull type. See Enums/HULL","name":"hullType","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetIdealActivity","parent":"NPC","type":"classfunc","description":"Sets the ideal activity the NPC currently wants to achieve. This is most useful for custom SNPCs.","realm":"Server","added":"2021.01.27","args":{"arg":{"text":"The ideal activity to set. Enums/ACT.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetIdealSequence","parent":"NPC","type":"classfunc","description":"Sets the ideal sequence the NPC currently wants to achieve. This is most useful for custom SNPCs.","realm":"Server","added":"2024.09.12","args":{"arg":{"text":"The ideal sequence to set. Entity:LookupSequence.","name":"sequenceId","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetIdealYaw","parent":"NPC","type":"classfunc","description":"Sets the ideal yaw angle (left-right rotation) for the NPC. Does not actually force the NPC to start turning in that direction. See NPC:UpdateYaw, NPC:GetIdealYaw and NPC:SetIdealYawAndUpdate.","realm":"Server","added":"2023.11.17","args":{"arg":{"text":"The aim direction to set, the `yaw` component.","name":"angle","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetIdealYawAndUpdate","parent":"NPC","type":"classfunc","description":"Sets the ideal yaw angle (left-right rotation) for the NPC and forces them to turn to that angle.","realm":"Server","added":"2020.06.24","args":{"arg":[{"text":"The aim direction to set, the `yaw` component.","name":"angle","type":"number"},{"text":"The turn speed. Special values are:\n* `-1` - Calculate automatically\n* `-2` - Keep the previous yaw speed","name":"speed","type":"number","default":"-1"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetIgnoreConditions","parent":"NPC","type":"classfunc","description":"Sets conditions to ignore, which would normally interrupt an Engine-based schedule. Specified conditions will still be set, will call ENTITY:OnCondition and can be returned by NPC:HasCondition, but they will no longer interrupt the Engine schedule.","realm":"Server","added":"2023.11.17","args":{"arg":[{"text":"Conditions to ignore, see Enums/COND. The table must be sequential, numerical and values must correspond to condition enums.","name":"conditions","type":"table"},{"text":"Number of conditions to include in the ignored conditions table. Set this to the size of ignored conditions table to ignore all specified conditions.","name":"size","type":"number"}]}},"example":[{"description":"Ignore all conditions for this SNPC, allows it to naturally process the engine schedule.","code":"function ENT:StartEngineSchedule() -- best place to set ignored conditions without ENT.BuildScheduleTestBits \n\tlocal tblIgnoredConds = { } \n\tfor i = 1, table.Count(COND) do -- 72 keyvalues \n\t\ttblIgnoredConds[i] = i -- { [1] = 1, [2] = 2 } and so on \n\tend \n\tself:SetIgnoreConditions(tblIgnoredConds,#tblIgnoredConds) \nend"},{"description":"Ignore specific conditions from interrupting this SNPC while attacking.","code":"function ENT:StartEngineSchedule() -- best place to set ignored conditions without ENT.BuildScheduleTestBits \n\tif self:GetCurrentSchedule() >= SCHED_RANGE_ATTACK1 and self:GetCurrentSchedule() <= SCHED_SPECIAL_ATTACK2 then \n\t\tlocal tblIgnoredConds = {COND.NEW_ENEMY, COND.LIGHT_DAMAGE} \n\t\tself:SetIgnoreConditions(tblIgnoredConds,#tblIgnoredConds) \n\tend \nend"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"SetLastPosition","parent":"NPC","type":"classfunc","description":{"text":"Sets the last registered or memorized position for this NPC. When using scheduling, the NPC will focus on navigating to the last position via nodes.","note":"The navigation requires ground nodes to function properly, otherwise the NPC could only navigate in a small area. (https://developer.valvesoftware.com/wiki/Info_node)"},"realm":"Server","args":{"arg":{"text":"Where the NPC's last position will be set.","name":"position","type":"Vector"}}},"example":{"description":"Make an NPC chase a player","code":"function NPCGoGoRun(npc, ply)\n\tnpc:SetLastPosition( ply:GetPos() )\n\tnpc:SetSchedule( SCHED_FORCED_GO_RUN )\nend","output":"The NPC will chase the player."},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetMaxLookDistance","parent":"NPC","type":"classfunc","description":"Sets NPC's max view distance. An NPC will not be able to see enemies outside of this distance.","realm":"Server","added":"2023.01.25","args":{"arg":{"text":"New maximum distance the NPC can see at. Default is 2048 and 6000 for long range NPCs such as the sniper.","name":"dist","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetMaxRouteRebuildTime","parent":"NPC","type":"classfunc","description":"Sets how long to try rebuilding path before failing task.","realm":"Server","args":{"arg":{"text":"How long to try rebuilding path before failing task","name":"time","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetMoveDelay","parent":"NPC","type":"classfunc","description":"Sets the movement delay for given NPC.\n\nSee NPC:GetMoveDelay.","realm":"Server","added":"2024.12.11","args":{"arg":{"text":"The amount of time in seconds to delay movement by.","name":"delay","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetMoveInterval","parent":"NPC","type":"classfunc","description":"Sets the timestep the internal NPC motor is working on.","realm":"Server","added":"2021.03.31","args":{"arg":{"text":"The new timestep.","name":"time","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetMovementActivity","parent":"NPC","type":"classfunc","description":"Sets the activity the NPC uses when it moves.","realm":"Server","args":{"arg":{"text":"The movement activity, see Enums/ACT.","name":"activity","type":"number"}}},"example":{"description":"Makes all NPCs walk instead of run.","code":"function GM:Think()\n\tfor i, npc in ipairs( ents.FindByClass( \"npc_*\" ) ) do\n\t\tif IsValid( npc ) and npc:IsNPC() and npc:GetMovementActivity() ~= ACT_WALK then\n\t\t\tnpc:SetMovementActivity( ACT_WALK )\n\t\tend\n\tend\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetMovementSequence","parent":"NPC","type":"classfunc","description":"Sets the sequence the NPC navigation path uses for speed calculation. Doesn't seem to have any visible effect on NPC movement or actively playing sequence.\n\t\nTo be able to use this, first set NPC:SetIdealActivity to `ACT_DO_NOT_DISTURB`, set this to any sequence with root motion data and call Entity:SetSequence on your desired sequence. As long as your NPC's NPC:GetMovementSequence has root motion data, your NPC will move to navigation point even though your NPC's Entity:GetSequence doesn't have any motion.","realm":"Server","args":{"arg":{"text":"The movement sequence index","name":"sequenceId","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetMoveVelocity","parent":"NPC","type":"classfunc","description":"Sets the move velocity of the NPC","realm":"Server","added":"2021.03.31","args":{"arg":{"text":"The new movement velocity.","name":"vel","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetMoveYawLocked","parent":"NPC","type":"classfunc","description":"Sets whether the current movement should locked on the Yaw axis or not.","realm":"Server","added":"2021.03.31","args":{"arg":{"text":"Whether the movement should yaw locked or not.","name":"lock","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetNavType","parent":"NPC","type":"classfunc","description":"Sets the navigation type of the NPC.","realm":"Server","added":"2021.03.31","args":{"arg":{"text":"The new nav type. See Enums/NAV.","name":"navtype","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetNPCState","parent":"NPC","type":"classfunc","description":"Sets the state the NPC is in to help it decide on a ideal schedule.","realm":"Server","args":{"arg":{"text":"New NPC state, see Enums/NPC_STATE","name":"state","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetSchedule","parent":"NPC","type":"classfunc","description":"Sets the NPC's current schedule.","realm":"Server","args":{"arg":{"text":"The NPC schedule, see Enums/SCHED.","name":"schedule","type":"number"}}},"example":{"description":"Function which forces an NPC to walk to an entity.","code":"function NPCMoveTo( npc, ent )\n\n\tif ( !IsValid( npc ) or !IsValid( ent ) ) then return end\n\t\t\n\tnpc:SetSaveValue( \"m_vecLastPosition\", ent:GetPos() )\n\tnpc:SetSchedule( SCHED_FORCED_GO )\n\t-- npc:SetSchedule( SCHED_FORCED_GO_RUN )\n\t\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetSquad","parent":"NPC","type":"classfunc","description":"Assigns the NPC to a new squad. A squad can have up to 16 NPCs. NPCs in a single squad should be friendly to each other.\n\nSee also ai.GetSquadMembers and NPC:GetSquad.\n\nNPCs within the same squad are meant to function more effectively, tactics wise.","realm":"Server","added":"2021.01.27","args":{"arg":{"text":"The new squad name to set. Do not provide this argument to reset the squad.","name":"name","type":"string","default":"nil"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetStepHeight","parent":"NPC","type":"classfunc","description":{"text":"Sets the SNPC step height.","note":"This only works for scripted NPCs."},"realm":"Server","added":"2024.05.14","args":{"arg":{"text":"The new step height. Default is 18 Hammer Units.","name":"height","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetTarget","parent":"NPC","type":"classfunc","description":"Sets the NPC's target. This is used in some engine schedules.","realm":"Server","args":{"arg":{"text":"The target of the NPC.","name":"entity","type":"Entity"}}},"example":{"description":"Sets the NPC's target to first player.","code":"npc:SetTarget( Entity( 1 ) )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetTaskStatus","parent":"NPC","type":"classfunc","description":"Sets the status of the current task.","realm":"Server","added":"2021.03.31","args":{"arg":{"text":"The status. See Enums/TASKSTATUS.","name":"status","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetUnforgettable","parent":"NPC","type":"classfunc","description":"Sets given entity as an unforgettable enemy. The state can be retrieved via NPC:IsUnforgettable.","realm":"Server","added":"2023.09.06","args":{"arg":[{"text":"The enemy entity to set.","name":"enemy","type":"Entity"},{"text":"The entity to set.","name":"set","type":"boolean","default":"true"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetViewOffset","parent":"NPC","type":"classfunc","description":"Sets the view offset of the NPC. Player alternative of Player:SetViewOffset.\n\nThis affects NPC's NPC:GetShootPos.","realm":"Server","added":"2023.09.26","args":{"arg":{"text":"The view offset to set.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"StartEngineTask","parent":"NPC","type":"classfunc","description":"Forces the NPC to start an engine task, this has different results for every NPC.","realm":"Server","args":{"arg":[{"text":"The id of the task to start, see [ai_task.h](https://github.com/ValveSoftware/source-sdk-2013/blob/55ed12f8d1eb6887d348be03aee5573d44177ffb/mp/src/game/server/ai_task.h#L89-L502)","name":"task","type":"number"},{"text":"The task data as a float, not all tasks make use of it.","name":"taskData","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"StopMoving","parent":"NPC","type":"classfunc","description":"Resets the NPC's movement animation and velocity. Does not actually stop the NPC from moving.","realm":"Server","args":{"arg":{"text":"Whether to stop moving even when currently active goal doesn't want us to.","name":"immediate","type":"boolean","default":"true","added":"2024.05.13"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"TargetOrder","parent":"NPC","type":"classfunc","description":"Cancels NPC:MoveOrder basically.\n\nOnly works on Citizens (npc_citizen) and is a part of the Half-Life 2 squad system.\n\nThe NPC **must** be in the player's squad for this to work.","realm":"Server","args":{"arg":{"text":"Must be a player, does nothing otherwise.","name":"target","type":"Entity"}}},"example":{"description":"A console command that once used cancels Move Orders and makes the NPCs return to the player.","code":"concommand.Add( \"targetnpcs\", function( ply )\n\tfor id, npc in ipairs( ents.FindByClass( \"npc_citizen\" ) ) do\n\t\tnpc:TargetOrder( ply )\n\tend\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"TaskComplete","parent":"NPC","type":"classfunc","description":"Marks the current NPC task as completed.\n\nThis is meant to be used alongside NPC:TaskFail to complete or fail custom Lua defined tasks. (Schedule:AddTask)","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"TaskFail","parent":"NPC","type":"classfunc","description":"Marks the current NPC task as failed.\n\nThis is meant to be used alongside NPC:TaskComplete to complete or fail custom Lua defined tasks. (Schedule:AddTask)","realm":"Server","args":{"arg":{"text":"Fail reason to be passed onto ENTITY:OnTaskFailed. The fail reason can also be seen when the NPC's `ent_text` is active.","name":"failReason","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"UpdateEnemyMemory","parent":"NPC","type":"classfunc","description":"Force the NPC to update information on the supplied enemy, as if it had line of sight to it.","realm":"Server","args":{"arg":[{"text":"The enemy to update.","name":"enemy","type":"Entity"},{"text":"The last known position of the enemy.","name":"pos","type":"Vector"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"UpdateTurnActivity","parent":"NPC","type":"classfunc","description":"Updates the turn activity. Basically applies the turn animations depending on the current turn yaw.","realm":"Server","added":"2021.03.31"},"realms":["Server"],"type":"Function"},
{"function":{"name":"UpdateYaw","parent":"NPC","type":"classfunc","description":"Forces the NPC to turn to their ideal yaw angle. See NPC:SetIdealYaw and NPC:SetIdealYawAndUpdate.","realm":"Server","added":"2023.11.17","args":{"arg":{"text":"The turn speed. Special values are:\n* `-1` - Calculate automatically\n* `-2` - Keep the previous yaw speed","name":"speed","type":"number","default":"-1"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"UseActBusyBehavior","parent":"NPC","type":"classfunc","description":{"note":"This function only works on `ai` type [SENTs](Scripted_Entities)."},"realm":"Server","rets":{"ret":{"text":"If we succeeded setting the behavior.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"UseAssaultBehavior","parent":"NPC","type":"classfunc","realm":"Server","description":{"text":"Enables the AI's [Assault Behavior](https://developer.valvesoftware.com/wiki/Assault \"Assault Behavior\") when an `ai_goal_assault` is set for this SENT.","note":"This function only works on `ai` type [SENTs](Scripted_Entities)."},"rets":{"ret":{"text":"Whether the action succeeded.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"UseFollowBehavior","parent":"NPC","type":"classfunc","description":{"note":"This function only works on `ai` type [SENTs](Scripted_Entities)."},"realm":"Server","rets":{"ret":{"text":"If we succeeded setting the behavior.","name":"","type":"boolean"}}},"example":{"description":"Create a `base_ai` that follows the player, using console commands and Lua.","code":"ent_create base_ai targetname alyx additionalequipment weapon_ar2 \nent_create ai_goal_follow goal !player formation 0 actor alyx searchtype 0 startactive 1\n-- Execute Lua code below after a second: \nlua_run ents.FindByName(\"alyx\")[1]:UseFollowBehavior()"},"realms":["Server"],"type":"Function"},
{"function":{"name":"UseFuncTankBehavior","parent":"NPC","type":"classfunc","realm":"Server","description":{"text":"Orders the SNPC to control any nearby `func_tank`s looking for an NPC to operate itself, if available.","note":"This function only works on `ai` type [SENTs](Scripted_Entities)."},"rets":{"ret":{"text":"Whether the action succeeded.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"UseLeadBehavior","parent":"NPC","type":"classfunc","realm":"Server","description":{"text":"Enables the AI's [Lead Behavior](https://developer.valvesoftware.com/wiki/ai_goal_lead \"Lead Behavior\") when an `ai_goal_lead` is set for this SENT.","note":"This function only works on `ai` type [SENTs](Scripted_Entities)."},"rets":{"ret":{"text":"Whether the action succeeded.","name":"","type":"boolean"}}},"example":{"description":"For use in `gm_construct`, spawns a `base_ai` in the middle of the map and orders it to take player under a spotlight.","code":"local goalPos = Vector(1576.366943, -465.975769, -143.968750) \n\nlocal npc = ents.Create(\"base_ai\") \nnpc:SetKeyValue(\"additionalequipment\",\"weapon_stunstick\") \nnpc:SetName(\"police\") \nnpc:Spawn() \nnpc:DropToFloor() \nnpc:SetModel(\"models/police.mdl\") \n\nlocal goal = ents.Create(\"info_target\") \ngoal:SetPos(goalPos) \ngoal:SetName(\"darkroom\") \ngoal:Spawn() \n\nlocal goalHandler = ents.Create(\"ai_goal_lead\") \ngoalHandler:SetKeyValue(\"goal\",\"darkroom\") \ngoalHandler:SetKeyValue(\"waitdistance\",\"8192\") \ngoalHandler:SetKeyValue(\"leaddistance\",\"100\") \ngoalHandler:SetKeyValue(\"retrievedistance\",\"140\") \ngoalHandler:SetKeyValue(\"run\",\"0\") \ngoalHandler:SetKeyValue(\"retrieve\",\"1\") \ngoalHandler:SetKeyValue(\"leadduringcombat\",\"0\") \ngoalHandler:SetKeyValue(\"actor\",\"police\") \ngoalHandler:SetKeyValue(\"startactive\",\"1\") \ngoalHandler:SetKeyValue(\"OnSuccess\",\"police,setrelationship,!player d_ht 0\") \ngoalHandler:Spawn() \n\nnpc:DeleteOnRemove(goal) \nnpc:DeleteOnRemove(goalHandler) \n\ntimer.Simple(0.5,function() -- wait for NPC ai to properly initialize \n\tif IsValid(npc) and IsValid(goal) and IsValid(goalHandler) then \n\t\tprint(npc:UseLeadBehavior()) \n\tend \nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"UseNoBehavior","parent":"NPC","type":"classfunc","description":{"text":"Undoes the other `Use*Behavior` functions.","note":"This function only works on `ai` type [SENTs](Scripted_Entities)."},"realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PaintingDragging","parent":"Panel","type":"panelfield","description":"Set to true by the dragndrop system when the panel is being drawn for the drag'n'drop.","realm":"Client and Menu","rets":{"ret":{"text":"Set to true if drawing for the transparent dragging render.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Add","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"506-L521"},"description":"When provided with a string or table, this function will create a new vgui element with that name and set the parent to the panel that this method is called on. When provided with a panel it will use Panel:SetParent on the provided panel to set it to our source panel","realm":"Client and Menu","args":[{"arg":{"text":"The panel to be added (parented).","name":"object","type":"Panel"}},{"name":"Class Name","arg":{"text":"The class to be added.","name":"class","type":"string"}},{"name":"Panel Table","arg":{"text":"The table to create the panel from.","name":"table","type":"table"}}],"rets":{"ret":{"text":"New panel","name":"","type":"Panel"}}},"example":{"description":"Create a Panel with vgui.Register, and initialize a DScrollPanel with Panel:Add","code":"local PANEL = {}\n\nfunction PANEL:Init()\n    -- Guarantees only one instance of the frame is open at a time.\n    if IsValid(SingleDFrame) then\n        SingleDFrame:Remove()\n    end\n\n    local sw = ScrW()\n    local sh = ScrH()\n    self:SetSize(sw * 0.25, sh * 0.5)\n    self:SetTitle(\"Window (Scroll)\")\n    self:Center()\n    self:MakePopup()\n\n    self.Canvas = self:Add(\"DScrollPanel\")\n    self.Canvas:Dock(FILL)\nend\n\n\nvgui.Register(\"DFrameScrollable\", PANEL, \"DFrame\")\nSingleDFrame = vgui.Create(\"DFrameScrollable\")"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddText","parent":"Panel","type":"classfunc","description":{"text":"This function does nothing.","deprecated":"Does nothing"},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AlignBottom","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"129-L129"},"description":"Aligns the panel on the bottom of its parent with the specified offset.","realm":"Client and Menu","args":{"arg":{"text":"The align offset.","name":"offset","type":"number","default":"0"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AlignLeft","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"132-L132"},"description":"Aligns the panel on the left of its parent with the specified offset.","realm":"Client and Menu","args":{"arg":{"text":"The align offset.","name":"offset","type":"number","default":"0"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AlignRight","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"130-L130"},"description":"Aligns the panel on the right of its parent with the specified offset.","realm":"Client and Menu","args":{"arg":{"text":"The align offset.","name":"offset","type":"number","default":"0"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AlignTop","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"131-L131"},"description":"Aligns the panel on the top of its parent with the specified offset.","realm":"Client and Menu","args":{"arg":{"text":"The align offset.","name":"offset","type":"number","default":"0"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AlphaTo","parent":"Panel","type":"classfunc","description":"Uses animation to transition the current alpha value of a panel to a new alpha, over a set period of time and after a specified delay.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/animation.lua","line":"263-L269"},"args":{"arg":[{"text":"The alpha value (0-255) to approach.","name":"alpha","type":"number"},{"text":"The time in seconds it should take to reach the alpha.","name":"duration","type":"number"},{"text":"The delay before the animation starts.","name":"delay","type":"number","default":"0"},{"text":"The function to be called once the animation finishes.","name":"callback","type":"function","default":"nil","callback":{"arg":[{"text":"The Structures/AnimationData that was used.","type":"table","name":"animData"},{"text":"The panel object that was animated.","type":"Panel","name":"targetPanel"}]}}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AnimationThinkInternal","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/animation.lua","line":"20-L59"},"description":{"text":"Performs the per-frame operations required for panel animations.\n\nThis is called every frame by PANEL:AnimationThink.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AnimTail","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/animation.lua","line":"90-L100"},"description":"Returns the Global.SysTime value when all animations for this panel object will end.","realm":"Client and Menu","rets":{"ret":{"text":"The system time value when all animations will end for this panel.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AppendText","parent":"Panel","type":"classfunc","description":"Appends text to a RichText element. This does not automatically add a new line.","realm":"Client and Menu","args":{"arg":{"text":"The text to append (add on).","name":"txt","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AppendTextWithURLs","parent":"Panel","type":"classfunc","description":"Appends text to a RichText element (exactly like Panel:AppendText), while also parsing and adding valid URLs (Panel:InsertClickableTextStart). This does not automatically add a new line.","realm":"Client and Menu","added":"2023.10.25","args":{"arg":{"text":"The text to append (add on).","name":"txt","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ApplyGWEN","parent":"Panel","type":"classfunc","description":"Used by Panel:LoadGWENFile and Panel:LoadGWENString to apply a GWEN controls table to a panel object.\n\nYou can do this manually using file.Read and util.JSONToTable to import and create a GWEN table structure from a `.gwen` file. This method can then be called, passing the GWEN table's `Controls` member.","realm":"Client and Menu","file":{"text":"lua/derma/derma_gwen.lua","line":"166-L196"},"args":{"arg":{"text":"The GWEN controls table to apply to the panel.","name":"GWENTable","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Center","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"165-L170"},"description":{"text":"Centers the panel on its parent. \n\nSee Panel:CenterHorizontal and Panel:CenterVertical for more specialized functions.","note":"This will center the panel using the current size of the panel, so it should be called **AFTER** setting or adjusting the size of the panel.\n\nTake special care when using Panel:Dock as it will not update the size immediately.\n\nYou may want to use Panel:PerformLayout to set positions of child panels."},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CenterHorizontal","parent":"Panel","type":"classfunc","description":"Centers the panel horizontally with specified fraction.\n\nSee Panel:CenterVertical for vertical only centering, and  Panel:Center for a function that does both axes.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel.lua","line":"158-L160"},"args":{"arg":{"text":"The center fraction.","name":"fraction","type":"number","default":"0.5"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CenterVertical","parent":"Panel","type":"classfunc","description":"Centers the panel vertically with specified fraction.\n\nSee Panel:CenterHorizontal for horizontal only centering, and  Panel:Center for a function that does both axes.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel.lua","line":"151-L153"},"args":{"arg":{"text":"The center fraction.","name":"fraction","type":"number","default":"0.5"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ChildCount","parent":"Panel","type":"classfunc","description":"Returns the amount of children of the of panel.","file":{"text":"lua/vgui/dmenu.lua","line":"145-L147"},"realm":"Client and Menu","rets":{"ret":{"text":"The amount of children the panel has.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ChildrenSize","parent":"Panel","type":"classfunc","description":"Returns the width and height of the space between the position of the panel (upper-left corner) and the max bound of the children panels (farthest reaching lower-right corner).","realm":"Client and Menu","rets":{"ret":[{"text":"The children size width.","name":"","type":"number"},{"text":"The children size height.","name":"","type":"number"}]}},"example":{"description":"Creates a recursively generated box of panels where the size of each panel is determined by the parent panel's children size + 10x10 pixels.\n\nAlso they flash bluish colors, just for good measure.","code":{"text":"-- Parent panel\nBGPanel = vgui.Create(\"DPanel\")\nBGPanel:SetSize(200, 200)\nBGPanel:Center()\n\nlocal panel, child_size_w, child_size_h = nil, 0, 0\n\n-- Create increasingly large blocks until children size exceeds the size of the panel\nwhile(BGPanel:ChildrenSize()","bgpanel:getsize":{"do":"","child_w":"","child_h":"BGPanel:ChildrenSize()","panel":"vgui.Create(\"DPanel\",","bgpanel":"","panel:setpos0":"","increase":"","size":"","based":"","on":"","the":"","children":"","panel:setsizechild_w10":"","child_h10":"","random":"","bluish":"","color":"","every":"","frame":"","function":"","panel:performlayout":"","self:invalidatelayout":"","call":"","this":"","again":"","next":"","self:setbackgroundcolorcolormath.random0":"","math.random0":"","end":"","move":"","to":"","back":"","so":"","we":"","can":"","see":"","effect":"","panel:movetoback":"","ode":"ode","output":{"image":{"src":"Panel_ChildrenSize_example1.gif"}}}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Clear","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"590-L596"},"description":"Removes all of the panel's children. Many panels also override this method to gracefully clear their contents without breaking themselves.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ColorTo","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/animation.lua","line":"240-L250"},"description":{"text":"Fades panels color to specified one.","note":"The panel must have `GetColor` and `SetColor` functions for `ColorTo` to work."},"realm":"Client and Menu","args":{"arg":[{"text":"The color to fade to","name":"color","type":"Color"},{"text":"Length of the animation","name":"length","type":"number"},{"text":"Delay before start fading","name":"delay","type":"number","default":"0"},{"text":"Function to execute when finished","name":"callback","type":"function","default":"nil","callback":{"arg":[{"text":"The Structures/AnimationData that was used.","type":"table{AnimationData}","name":"animData"},{"text":"The panel object that was animated.","type":"Panel","name":"targetPanel"}]}}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ConVarChanged","parent":"Panel","type":"classfunc","description":"Updates a panel object's associated console variable. This must first be set up with Global.Derma_Install_Convar_Functions, and have a ConVar set using Panel:SetConVar.","file":{"text":"lua/derma/init.lua","line":"86-L91"},"realm":"Client and Menu","args":{"arg":{"text":"The new value to set the associated console variable to.","name":"newValue","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ConVarNumberThink","parent":"Panel","type":"classfunc","description":{"text":"A think hook for Panels using ConVars as a value. Call it in the Think hook. Sets the panel's value should the convar change.\n\nThis function is best for: checkboxes, sliders, number wangs\n\nFor a string alternative, see Panel:ConVarStringThink.","note":"Make sure your Panel has a SetValue function, else you may get errors."},"file":{"text":"lua/derma/init.lua","line":"106-L119"},"realm":"Client and Menu"},"example":{"description":"How it should be implemented into your input.","code":"function PANEL:Think()\n\tself:ConVarNumberThink()\nend","output":"Panel's value is changed when the convar changes."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ConVarStringThink","parent":"Panel","type":"classfunc","description":{"text":"A think hook for panels using ConVars as a value. Call it in the Think hook. Sets the panel's value should the convar change.\n\nThis function is best for: text inputs, read-only inputs, dropdown selects\n\nFor a number alternative, see Panel:ConVarNumberThink.","note":"Make sure your Panel has a SetValue function, else you may get errors."},"file":{"text":"lua/derma/init.lua","line":"94-L104"},"realm":"Client and Menu"},"example":{"description":"How it should be implemented into your input.","code":"function PANEL:Think()\n\tself:ConVarStringThink()\nend","output":"Panel's value is changed when the convar changes."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CopyBase","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"497-L504"},"description":"Gets the size, position and dock state of the passed panel object, and applies it to this one.","realm":"Client and Menu","args":{"arg":{"text":"The panel to copy the boundary and dock settings from.","name":"srcPanel","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CopyBounds","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"175-L182"},"description":"Copies position and size of the panel.","realm":"Client and Menu","args":{"arg":{"text":"The panel to copy size and position from.","name":"base","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CopyHeight","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"108-L110"},"description":"Copies the height of the panel.","realm":"Client and Menu","args":{"arg":{"text":"Panel to copy the height from.","name":"base","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CopyPos","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"122-L124"},"description":"Copies the position of the panel.","realm":"Client and Menu","args":{"arg":{"text":"Panel to position the width from.","name":"base","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CopySelected","parent":"Panel","type":"classfunc","description":{"text":"Performs the  +  key combination effect ( Copy selection to clipboard ) on selected text in a TextEntry or RichText based element.","key":["CONTROL","C"]},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CopyWidth","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"115-L117"},"description":"Copies the width of the panel.","realm":"Client and Menu","args":{"arg":{"text":"Panel to copy the width from.","name":"base","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CursorPos","parent":"Panel","type":"classfunc","description":{"text":"Returns the cursor position relative to the top left of the panel.\n\nThis is equivalent to calling gui.MousePos and then Panel:ScreenToLocal.","warning":"This function uses a cached value for the screen position of the panel, computed at the end of the last VGUI Think/Layout pass.\n\nie. inaccurate results may be returned if the panel or any of its ancestors have been repositioned outside of PANEL:Think or PANEL:PerformLayout within the last frame."},"realm":"Client and Menu","rets":{"ret":[{"text":"X coordinate of the cursor, relative to the top left of the panel.","name":"","type":"number"},{"text":"Y coordinate of the cursor, relative to the top left of the panel.","name":"","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CutSelected","parent":"Panel","type":"classfunc","description":{"text":"Performs the  +  (delete text and copy it to clipboard buffer) action on selected text in a TextEntry or RichText based element.","key":["CONTROL","X"]},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DeleteCookie","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"238-L245"},"description":"Deletes a cookie value using the panel's cookie name ( Panel:GetCookieName ) and the passed extension.","realm":"Client and Menu","args":{"arg":{"text":"The unique cookie name to delete.","name":"cookieName","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DisableLerp","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/animation.lua","line":"359-L365"},"description":"Resets the panel object's Panel:SetPos method and removes its animation table (`Panel.LerpAnim`). This effectively undoes the changes made by Panel:LerpPositions.\n\nIn order to use Lerp animation again, you must call Panel:Stop before setting its `SetPosReal` property to `nil`. See the example below.","realm":"Client and Menu"},"example":{"description":"Creates a function for changing the Lerp animation speed of a panel.","code":"function ChangeLerpSpeed( pnl, newSpeed, ease )\n\t\n\tif not IsValid(pnl) then return end -- Make sure panel is valid\n\t\n\tpnl:DisableLerp()\n\tpnl:Stop()\n\tpnl.SetPosReal = nil\n\t\n\tpnl:LerpPositions( newSpeed, ease )\n\t\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Distance","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"422-L428"},"description":"Returns the linear distance from the center of this panel object and another. **Both panels must have the same parent for this function to work properly.**","realm":"Client and Menu","args":{"arg":{"text":"The target object with which to compare position.","name":"tgtPanel","type":"Panel"}},"rets":{"ret":{"text":"The linear (straight-line) distance between the center of the two objects.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DistanceFrom","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"430-L437"},"description":"Returns the distance between the center of this panel object and a specified point **local to the parent panel**.","realm":"Client and Menu","args":{"arg":[{"text":"The horizontal (x) position in pixels of the point to compare with. Local to the parent panel, or container, not the panel the function is called on.","name":"posX","type":"number"},{"text":"The vertical (y) position in pixels of the point to compare with. Local to the parent panel, or container, not the panel the function is called on.","name":"posY","type":"number"}]},"rets":{"ret":{"text":"The linear (straight-line) distance between the specified point local to parent panel and the center of this panel object.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Dock","parent":"Panel","type":"classfunc","description":{"text":"Sets the dock type for the panel, making the panel \"dock\" in a certain direction, modifying it's position and size.\n\nYou can set the inner spacing of a panel's docking using Panel:DockPadding, which will affect docked child panels, and you can set the outer spacing of a panel's docking using Panel:DockMargin, which affects how docked siblings are positioned/sized.\n\nYou may need to use Panel:SetZPos to ensure child panels (DTextEntry) stay in a specific order.","note":"After using this function, if you want to get the correct panel's bounds (position, size), use Panel:InvalidateParent (use `true` as argument if you need to update immediately)"},"realm":"Client and Menu","args":{"arg":{"text":"Dock type using Enums/DOCK.","name":"dockType","type":"number{DOCK}"}}},"example":[{"description":"Example docking including DockMargin. Provided by Walrus Viking in [this](http://facepunch.com/showthread.php?t=1439021&p=47095061&viewfull=1#post47095061) Facepunch post.","code":"local f = vgui.Create( \"DFrame\" )\nf:SetTitle( \"Dock Test\" )\nf:SetSize( 256, 256 )\nf:Center()\nf:MakePopup()\n\nlocal p = vgui.Create( \"DPanel\", f )\np:Dock( FILL )\np:DockMargin( 0, 0, 0, 0 )\n\nfor i = 0, 10 do\n\tlocal l = vgui.Create( \"DLabel\", p )\n\tl:Dock( TOP )\n\tl:DockMargin( 4, 0, 0, 0 ) -- shift to the right\n\tl:SetColor( color_black )\n\tl:SetText( \"Hi! I'm a label!\" )\nend","output":{"image":{"src":"panel_dock_example1.png"}}},{"description":"Example showing how multiple docked elements behave.","code":"local frame = vgui.Create(\"DFrame\")\nframe:SetSize(600, 300)\nframe:SetTitle(\"Docking Demonstration\")\nframe:Center()\nframe:MakePopup(true)\n\nlocal panel = vgui.Create(\"DPanel\", frame) --Create a panel on the left\npanel:SetSize(300, 0) --Height doesn't matter since we're docking it to the left anyways\npanel:Dock(LEFT)\nlocal fill = vgui.Create(\"DButton\", panel) --Create a button and dock it\nfill:SetText(\"FILL\")\nfill:Dock(FILL)\nlocal left = vgui.Create(\"DButton\", panel)\nleft:SetText(\"LEFT\")\nleft:Dock(LEFT)\nlocal right = vgui.Create(\"DButton\", panel)\nright:SetText(\"RIGHT\")\nright:Dock(RIGHT)\nlocal top = vgui.Create(\"DButton\", panel)\ntop:SetText(\"TOP\")\ntop:Dock(TOP)\nlocal bottom = vgui.Create(\"DButton\", panel)\nbottom:SetText(\"BOTTOM\")\nbottom:Dock(BOTTOM)\n\nlocal panel = vgui.Create(\"DPanel\", frame) --Do the same thing on the right, but this time with top and bottom before left and right\npanel:SetSize(300, 0)\npanel:Dock(RIGHT)\nlocal fill = vgui.Create(\"DButton\", panel)\nfill:SetText(\"FILL\")\nfill:Dock(FILL)\nlocal top = vgui.Create(\"DButton\", panel)\ntop:SetText(\"TOP\")\ntop:Dock(TOP)\nlocal bottom = vgui.Create(\"DButton\", panel)\nbottom:SetText(\"BOTTOM\")\nbottom:Dock(BOTTOM)\nlocal left = vgui.Create(\"DButton\", panel)\nleft:SetText(\"LEFT\")\nleft:Dock(LEFT)\nlocal right = vgui.Create(\"DButton\", panel)\nright:SetText(\"RIGHT\")\nright:Dock(RIGHT)","output":{"image":{"src":"panel_dock_example_2.png"}}}],"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DockMargin","parent":"Panel","type":"classfunc","description":"Sets the dock margin of the panel.\n\nThe dock margin is the extra space that will be left around the edge when this element is docked inside its parent element.","realm":"Client and Menu","args":{"arg":[{"text":"The left margin to the parent.","name":"marginLeft","type":"number"},{"text":"The top margin to the parent.","name":"marginTop","type":"number"},{"text":"The right margin to the parent.","name":"marginRight","type":"number"},{"text":"The bottom margin to the parent.","name":"marginBottom","type":"number"}]}},"example":{"description":"Example showing the effects of DockMargin and DockPadding","code":"local frame = vgui.Create(\"DFrame\")\nframe:SetSize(600, 300)\nframe:SetTitle(\"Docking Demonstration\")\nframe:Center()\nframe:MakePopup(true)\n\nlocal panel = vgui.Create(\"DPanel\", frame)\npanel:DockMargin(10, 20, 30, 40)\npanel:DockPadding(40, 30, 20, 10)\npanel:Dock(FILL)\n\nlocal button = vgui.Create(\"DButton\", panel)\nbutton:SetText(\"Lopsided proportions!\")\nbutton:Dock(FILL)","output":{"image":{"src":"panel_dockmargin_dockpadding.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DockPadding","parent":"Panel","type":"classfunc","description":"Sets the dock padding of the panel.\n\nThe dock padding is the extra space that will be left around the edge when child elements are docked inside this element.","realm":"Client and Menu","args":{"arg":[{"text":"The left padding to the parent.","name":"paddingLeft","type":"number"},{"text":"The top padding to the parent.","name":"paddingTop","type":"number"},{"text":"The right padding to the parent.","name":"paddingRight","type":"number"},{"text":"The bottom padding to the parent.","name":"paddingBottom","type":"number"}]}},"example":{"description":"Example showing the effects of DockMargin and DockPadding","code":"local frame = vgui.Create(\"DFrame\")\nframe:SetSize(600, 300)\nframe:SetTitle(\"Docking Demonstration\")\nframe:Center()\nframe:MakePopup(true)\n\nlocal panel = vgui.Create(\"DPanel\", frame)\npanel:DockMargin(10, 20, 30, 40)\npanel:DockPadding(40, 30, 20, 10)\npanel:Dock(FILL)\n\nlocal button = vgui.Create(\"DButton\", panel)\nbutton:SetText(\"Lopsided proportions!\")\nbutton:Dock(FILL)","output":{"image":{"src":"panel_dockmargin_dockpadding.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DoModal","parent":"Panel","type":"classfunc","description":"Makes the panel \"lock\" the screen until it is removed. All input will be directed to the given panel.\n\nIt will silently fail if used while cursor is not visible.\nCall Panel:MakePopup before calling this function.\nThis must be called on a panel derived from EditablePanel.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DragClick","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"431-L438"},"description":{"text":"Called by Panel:DragMouseRelease when a user clicks one mouse button whilst dragging with another.","internal":""},"realm":"Client and Menu","rets":{"ret":{"text":"Always returns `true`.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DragHover","parent":"Panel","type":"classfunc","description":{"text":"Called by dragndrop.HoverThink to perform actions on an object that is dragged and hovered over another.","internal":""},"realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"499-L512"},"args":{"arg":{"text":"If this time is greater than 0.1, PANEL:DragHoverClick is called, passing it as an argument.","name":"HoverTime","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DragHoverEnd","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"531-L538"},"description":{"text":"Called to end a drag and hover action. This resets the panel's PANEL:PaintOver method, and is primarily used by dragndrop.StopDragging.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DragMousePress","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"412-L429"},"description":"Called to inform the dragndrop that a mouse button is being held down on a panel object.","realm":"Client and Menu","args":{"arg":{"text":"The code for the mouse button pressed, passed by, for example, PANEL:OnMousePressed. See the Enums/MOUSE.","name":"mouseCode","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DragMouseRelease","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"440-L466"},"description":"Called to inform the dragndrop that a mouse button has been depressed on a panel object.","realm":"Client and Menu","args":{"arg":{"text":"The code for the mouse button pressed, passed by, for example, PANEL:OnMouseReleased. See the Enums/MOUSE.","name":"mouseCode","type":"number"}},"rets":{"ret":{"text":"`true` if an object was being dragged, otherwise `false`.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DrawDragHover","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"514-L529"},"description":{"text":"Called to draw the drop target when an object is being dragged across another. See Panel:SetDropTarget.","internal":""},"realm":"Client and Menu","args":{"arg":[{"text":"The x coordinate of the top-left corner of the drop area.","name":"x","type":"number"},{"text":"The y coordinate of the top-left corner of the drop area.","name":"y","type":"number"},{"text":"The width of the drop area.","name":"width","type":"number"},{"text":"The height of the drop area.","name":"height","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DrawFilledRect","parent":"Panel","type":"classfunc","description":{"text":"Draws a coloured rectangle to fill the panel object this method is called on. The colour is set using surface.SetDrawColor. This should only be called within the object's PANEL:Paint or PANEL:PaintOver hooks, as a shortcut for surface.DrawRect.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DrawOutlinedRect","parent":"Panel","type":"classfunc","description":{"text":"Draws a hollow rectangle the size of the panel object this method is called on, with a border width of 1 px. The border colour is set using surface.SetDrawColor. This should only be called within the object's PANEL:Paint or PANEL:PaintOver hooks, as a shortcut for surface.DrawOutlinedRect.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DrawSelections","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/selections.lua","line":"91-L101"},"description":"Used to draw the magenta highlight colour of a panel object when it is selected. This should be called in the object's PANEL:PaintOver hook. Once this is implemented, the highlight colour will be displayed only when the object is selectable and selected. This is achieved using Panel:SetSelectable and Panel:SetSelected respectively.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DrawTextEntryText","parent":"Panel","type":"classfunc","description":{"text":"Used to draw the text in a DTextEntry within a derma skin. This is usually called within the SKIN:PaintTextEntry skin hook.","note":"Will silently fail if any of arguments are not given.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu","args":{"arg":[{"text":"The colour of the main text.","name":"textCol","type":"table"},{"text":"The colour of the selection highlight (when selecting text).","name":"highlightCol","type":"table"},{"text":"The colour of the text cursor (or caret).","name":"cursorCol","type":"table"}]}},"example":{"description":"The paint function used in the default derma skin.","code":"function SKIN:PaintTextEntry( panel, w, h )\n\n\tif ( panel.m_bBackground ) then\n\t\n\t\tif ( panel:GetDisabled() ) then\n\t\t\tself.tex.TextBox_Disabled( 0, 0, w, h )\n\t\telseif ( panel:HasFocus() ) then\n\t\t\tself.tex.TextBox_Focus( 0, 0, w, h )\n\t\telse\n\t\t\tself.tex.TextBox( 0, 0, w, h )\n\t\tend\n\t\n\tend\n\t\n\tpanel:DrawTextEntryText( panel.m_colText, panel.m_colHighlight, panel.m_colCursor )\n\t\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DrawTexturedRect","parent":"Panel","type":"classfunc","description":{"text":"Draws a textured rectangle to fill the panel object this method is called on. The texture is set using surface.SetTexture or surface.SetMaterial. This should only be called within the object's PANEL:Paint or PANEL:PaintOver hooks, as a shortcut for surface.DrawTexturedRect.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Droppable","parent":"Panel","type":"classfunc","description":"Makes this panel droppable. This is used with Panel:Receiver to create drag and drop events.\n\nCan be called multiple times with different names allowing to be dropped onto different receivers.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"302-L310"},"args":{"arg":{"text":"Name of your droppable panel","name":"name","type":"string"}},"rets":{"ret":{"text":"Blank table stored on the panel itself under pnl.m_DragSlot[ name ]. Is reset every time this function is called and does not appear to be used or exposed anywhere else.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"EndBoxSelection","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/selections.lua","line":"223-L249"},"description":"Completes a box selection. If the end point of the selection box is within the selection canvas, mouse capture is disabled for the panel object, and the selected state of each child object within the selection box is toggled.","realm":"Client and Menu","rets":{"ret":{"text":"Whether the end point of the selection box was within the selection canvas.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Exec","parent":"Panel","type":"classfunc","description":{"text":"Used to run commands within a DHTML window.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The command to be run.","name":"cmd","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Find","parent":"Panel","type":"classfunc","description":"Finds a panel in its children(and sub children) with the given name.","realm":"Client and Menu","args":{"arg":{"text":"The name of the panel that should be found.","name":"panelName","type":"string"}},"rets":{"ret":{"text":"foundPanel","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"FocusNext","parent":"Panel","type":"classfunc","description":"Focuses the next panel in the focus queue.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"FocusPrevious","parent":"Panel","type":"classfunc","description":"Focuses the previous panel in the focus queue.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetAlpha","parent":"Panel","type":"classfunc","description":"Returns the alpha multiplier for this panel.","realm":"Client and Menu","rets":{"ret":{"text":"alphaMul","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetBGColor","parent":"Panel","type":"classfunc","description":{"text":"Returns the background color of a panel such as a RichText, Label or DColorCube.","note":"This doesn't apply to all VGUI elements and its function varies between them"},"realm":"Client and Menu","added":"2020.03.17","rets":{"ret":{"text":"The Color.","name":"color","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetBounds","parent":"Panel","type":"classfunc","description":"Returns the position and size of the panel.\n\nThis is equivalent to calling Panel:GetPos and Panel:GetSize together.","realm":"Client and Menu","rets":{"ret":[{"text":"The x coordinate of the panel, relative to its parent's top left.","name":"","type":"number"},{"text":"The y coordinate of the panel, relative to its parent's top left.","name":"","type":"number"},{"text":"The width of the panel.","name":"","type":"number"},{"text":"The height of the panel.","name":"","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetCaretPos","parent":"Panel","type":"classfunc","description":"Returns the position/offset of the caret (or text cursor) in a text-based panel object.","realm":"Client and Menu","rets":{"ret":{"text":"The caret position/offset from the start of the text. A value of `0` means the caret sits before the first character.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetChild","parent":"Panel","type":"classfunc","description":"Gets a child by its index. For use with Panel:ChildCount.","realm":"Client and Menu","args":{"arg":{"text":"The index of the child to get.","name":"childIndex","type":"number","note":"This index starts at 0, except when you use this on a DMenu."}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetChildPosition","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"442-L458"},"description":"Gets a child object's position relative to this panel object. The number of levels is not relevant; the child may have many parents between itself and the object on which the method is called.","realm":"Client and Menu","args":{"arg":{"text":"The panel to get the position of.","name":"pnl","type":"Panel"}},"rets":{"ret":[{"text":"The horizontal (x) position of the child relative to this panel object.","name":"","type":"number"},{"text":"The vertical (y) position of the child relative to this panel object.","name":"","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetChildren","parent":"Panel","type":"classfunc","description":"Returns a table with all the child panels of the panel.","realm":"Client and Menu","rets":{"ret":{"text":"All direct children of this panel.","name":"","type":"table"}}},"example":{"description":"Print the classnames of the children on the panel.","code":"for _, v in ipairs( panel:GetChildren() ) do\n\tprint( v:GetClassName() )\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetChildrenInRect","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/selections.lua","line":"162-L187"},"description":"Returns a table of all visible, selectable children of the panel object that lie at least partially within the specified rectangle.","realm":"Client and Menu","args":{"arg":[{"text":"The horizontal (x) position of the top-left corner of the rectangle, relative to the panel object.","name":"x","type":"number"},{"text":"The vertical (y) position of the top-left corner of the rectangle, relative to the panel object.","name":"y","type":"number"},{"text":"The width of the rectangle.","name":"w","type":"number"},{"text":"The height of the rectangle.","name":"h","type":"number"}]},"rets":{"ret":{"text":"A table of panel objects that lie at least partially within the specified rectangle.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetClassName","parent":"Panel","type":"classfunc","description":"Returns the class name of the panel. This would be the class name of the base engine-level panel, not Lua classname. The latter is stored usually in Panel:GetName.","realm":"Client and Menu","rets":{"ret":{"text":"The panel's class name.","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetClosestChild","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"523-L538"},"description":"Returns the child of this panel object that is closest to the specified point. The point is relative to the object on which the method is called. The distance the child is from this point is also returned.","realm":"Client and Menu","args":{"arg":[{"text":"The horizontal (x) position of the point.","name":"x","type":"number"},{"text":"The vertical (y) position of the point.","name":"y","type":"number"}]},"rets":{"ret":[{"text":"The child object that was closest to the specified point.","name":"","type":"Panel"},{"text":"The distance that this child was from the point.","name":"","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetContentAlignment","parent":"Panel","type":"classfunc","description":{"text":"Returns the alignment of the text of a Label.","note":"This function only works on Label panels and its derivatives."},"added":"2025.04.03","realm":"Client and Menu","rets":{"ret":{"text":"The direction of the content, based on the number pad.\n\n: **bottom-left** \n\n: **bottom-center** \n\n: **bottom-right** \n\n: **middle-left** \n\n: **center** \n\n: **middle-right** \n\n: **top-left** \n\n: **top-center** \n\n: **top-right**","name":"alignment","type":"number","key":["1","2","3","4","5","6","7","8","9"],"image":{"src":"DLabel_SetContentAlignment.gif"}}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetContentSize","parent":"Panel","type":"classfunc","description":"Gets the size of the content/children within a panel object.\n\nOnly works with Label derived panels by default such as DLabel.\n\n\nWill also work on any panel that manually implements this method.","realm":"Client and Menu","rets":{"ret":[{"text":"The content width of the object.","name":"","type":"number"},{"text":"The content height of the object.","name":"","type":"number"}]}},"example":{"description":"Demonstrates how to implement this function in your own panel.","code":"local PANEL = {}\n\nfunction PANEL:GetContentSize()\n\tsurface.SetFont( self:GetFont() )\n\treturn surface.GetTextSize( self:GetText() )\nend\n\nvgui.Register( \"DTextEntry_Edit\", PANEL, \"DTextEntry\" )\n\n-- Somewhere else, to test the newly created panel\nlocal frame = vgui.Create( \"DFrame\" )\nframe:SetSize( 500, 200 )\nframe:Center()\nframe:MakePopup()\n\nlocal txt = vgui.Create( \"DTextEntry_Edit\", frame )\ntxt:SetPos( 5, 25 )\ntxt:SetSize( 100, 10 )\ntxt:SetText( \"Really long string that is bigger than 100 pixels\" )\ntxt:SizeToContentsX( 5 ) -- Must be called after setting the text\ntxt:SizeToContentsY( 5 ) -- These two functions will not have effect on a normal DTextEntry"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetCookie","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"214-L221"},"description":"Gets the value of a cookie stored by the panel object. This can also be done with cookie.GetString, using the panel's cookie name, a fullstop, and then the actual name of the cookie.\n\nMake sure the panel's cookie name has not changed since writing, or the cookie will not be accessible. This can be done with Panel:GetCookieName and Panel:SetCookieName.","realm":"Client and Menu","args":{"arg":[{"text":"The name of the cookie from which to retrieve the value.","name":"cookieName","type":"string"},{"text":"The default value to return if the cookie does not exist.","name":"default","type":"string"}]},"rets":{"ret":{"text":"The value of the stored cookie, or the default value should the cookie not exist.","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetCookieName","parent":"Panel","type":"classfunc","description":"Gets the name the panel uses to store cookies. This is set with Panel:SetCookieName.","realm":"Client and Menu","rets":{"ret":{"text":"The name the panel uses when reading or writing cookies. The format used is as follows: \n```\npanelCookieName.individualCookieName\n```","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetCookieNumber","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"202-L209"},"description":"Gets the value of a cookie stored by the panel object, as a number. This can also be done with cookie.GetNumber, using the panel's cookie name, a fullstop, and then the actual name of the cookie.\n\nMake sure the panel's cookie name has not changed since writing, or the cookie will not be accessible. This can be done with Panel:GetCookieName and Panel:SetCookieName.","realm":"Client and Menu","args":{"arg":[{"text":"The name of the cookie from which to retrieve the value.","name":"cookieName","type":"string"},{"text":"The default value to return if the cookie does not exist.","name":"default","type":"number"}]},"rets":{"ret":{"text":"The number value of the stored cookie, or the default value should the cookie not exist.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDock","parent":"Panel","type":"classfunc","description":"Returns a dock enum for the panel's current docking type.","realm":"Client and Menu","rets":{"ret":{"text":"The dock enum for the panel. See Enums/DOCK.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDockMargin","parent":"Panel","type":"classfunc","description":"Returns the docked margins of the panel. (set by Panel:DockMargin)","realm":"Client and Menu","rets":{"ret":[{"text":"Left margin.","name":"","type":"number"},{"text":"Top margin.","name":"","type":"number"},{"text":"Right margin.","name":"","type":"number"},{"text":"Bottom margin.","name":"","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDockPadding","parent":"Panel","type":"classfunc","description":"Returns the docked padding of the panel. (set by Panel:DockPadding)","realm":"Client and Menu","rets":{"ret":[{"text":"Left padding.","name":"","type":"number"},{"text":"Top padding.","name":"","type":"number"},{"text":"Right padding.","name":"","type":"number"},{"text":"Bottom padding.","name":"","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetFGColor","parent":"Panel","type":"classfunc","description":{"text":"Returns the foreground color of the panel.\n\nFor a Label or RichText, this is the color of its text.","note":"This doesn't apply to all VGUI elements (such as DLabel) and its function varies between them"},"added":"2020.03.17","realm":"Client and Menu","rets":{"ret":{"text":"The Color.","name":"color","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetFont","parent":"Panel","type":"classfunc","description":{"text":"Returns the name of the font that the panel renders its text with.\n\nThis is the same font name set with Panel:SetFontInternal.","note":"Only works on Label and TextEntry and their derived panels by default (such as DLabel and DTextEntry), and on any panel that manually implemented the Panel:GetFont method."},"realm":"Client and Menu","rets":{"ret":{"text":"The font name.","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetHTMLMaterial","parent":"Panel","type":"classfunc","description":"Returns the panel's HTML material. Only works with Awesomium, HTML and DHTML panels that have been fully loaded.","realm":"Client","rets":{"ret":{"text":"The HTML material used by the panel. Typically starts with `__vgui_texture_` followed by an incremental number.","name":"","type":"IMaterial"}}},"example":{"description":"Defines a new entity which can display a web page on a TV screen.","code":"AddCSLuaFile()\n\nENT.Type = \"anim\"\nENT.Base = \"base_entity\"\n\nENT.PrintName = \"Web Screen\"\nENT.Author = \"Microflash\"\nENT.Spawnable = true\n\nif ( CLIENT ) then\n\tENT.Mat = nil\n\tENT.Panel = nil\nend\n\nfunction ENT:Initialize()\n\n\tif ( SERVER ) then\n\t\t\n\t\tself:SetModel(\"models/props_phx/rt_screen.mdl\")\n\t\tself:SetMoveType(MOVETYPE_VPHYSICS)\n\t\tself:SetSolid(SOLID_VPHYSICS)\n\t\t\n\t\tself:PhysicsInit(SOLID_VPHYSICS)\n\t\t\n\t\tself:Freeze()\n\t\t\n\telse\n\t\n\t\t-- Reset material and panel and load DHTML panel\n\t\tself.Mat = nil\n\t\tself.Panel = nil\n\t\tself:OpenPage()\n\t\t\n\tend\n\t\nend\n\nfunction ENT:Freeze()\n\tlocal phys = self:GetPhysicsObject()\n\tif (IsValid(phys)) then phys:EnableMotion(false) end\nend\n\n-- Load the DHTML reference panel\nfunction ENT:OpenPage()\n\n\t-- Iff for some reason a panel is already loaded, delete it\n\tif(self.Panel) then\n\t\n\t\tself.Panel:Remove()\n\t\tself.Panel = nil\n\t\n\tend\n\n\t-- Create a web page panel and fill the entire screen\n\tself.Panel = vgui.Create(\"DHTML\")\n\tself.Panel:Dock(FILL)\n\t\n\t-- Wiki page URL\n\tlocal url = \"https://wiki.facepunch.com/gmod/Material\"\n\t\n\t-- Load the wiki page\n\tself.Panel:OpenURL(url)\n\t\n\t-- Hide the panel\n\tself.Panel:SetAlpha(0)\n\tself.Panel:SetMouseInputEnabled(false)\n\t\n\t-- Disable HTML messages\n\tfunction self.Panel:ConsoleMessage(msg) end\n\nend\n\nfunction ENT:Draw()\n\t\n\tif ( self.Mat ) then -- If the material has already been grabbed from the panel\n\n\t\t-- Apply it to the screen/model\n\t\tif ( render.MaterialOverrideByIndex ) then\n\t\t\trender.MaterialOverrideByIndex(1, self.Mat)\n\t\telse\n\t\t\trender.ModelMaterialOverride(self.Mat)\n\t\tend\n\n\telseif ( self.Panel and self.Panel:GetHTMLMaterial() ) then -- Otherwise, check that the panel is valid and the HTML material is finished loading\n\n\t\t-- Get the html material\n\t\tlocal html_mat = self.Panel:GetHTMLMaterial()\n\t\t\n\t\t-- Used to make the material fit the model screen\n\t\t-- May need to be changed iff using a different model\n\t\t-- For the multiplication number it goes in segments of 512\n\t\t-- Based off the players screen resolution\n\t\tlocal scale_x, scale_y = ScrW() / 2048, ScrH() / 1024\n\t\t\n\t\t-- Create a new material with the proper scaling and shader\n\t\tlocal matdata = {\n\t\t\t[\"$basetexture\"] = html_mat:GetName(),\n\t\t\t[\"$basetexturetransform\"] = \"center 0 0 scale \" .. scale_x .. \" \" .. scale_y .. \" rotate 0 translate 0 0\",\n\t\t\t[\"$model\"] = 1\n\t\t}\n\t\t-- Unique ID used for material name\n\t\tlocal uid = string.Replace(html_mat:GetName(), \"__vgui_texture_\", \"\")\n\t\t\n\t\t-- Create the model material\n\t\tself.Mat = CreateMaterial(\"WebMaterial_\" .. uid, \"VertexLitGeneric\", matdata)\n\t\n\tend\n\n\t-- Render the model\n\tself:DrawModel()\n\t\n\t-- Reset the material override or else everything will have a HTML material!\n\trender.ModelMaterialOverride(nil)\n\nend\n\nfunction ENT:OnRemove()\n\t-- Make sure the panel is removed too\n\tif ( self.Panel ) then self.Panel:Remove() end\nend","output":{"image":{"src":"Panel_GetHTMLMaterial_example1.gif"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetLineHeight","parent":"Panel","type":"classfunc","description":"Returns the height of a single line of a RichText panel.","realm":"Client and Menu","added":"2023.10.25","rets":{"ret":{"text":"The line height.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetMaximumCharCount","parent":"Panel","type":"classfunc","description":"Returns the current maximum character count.\n\nThis function will only work on RichText and TextEntry panels and their derivatives.","realm":"Client and Menu","added":"2020.03.17","rets":{"ret":{"text":"The maximum amount of characters this panel is allowed to contain.","name":"maxChar","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetName","parent":"Panel","type":"classfunc","description":"Returns the internal name of the panel. Can be set via Panel:SetName.","realm":"Client and Menu","rets":{"ret":{"text":"The previously set internal name of the panel.","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetNumLines","parent":"Panel","type":"classfunc","description":"Returns the number of lines in a RichText or a TextEntry.\n\nYou must wait a couple frames before calling this after using Panel:AppendText or Panel:SetText, otherwise it will return the number of text lines before the text change.","realm":"Client and Menu","rets":{"ret":{"text":"The number of lines.","name":"","type":"number"}}},"example":{"description":"Creates a rich text panel with a block of text and prints out the number of text lines before and after `PerformLayout` is called.","code":"-- Create a window frame\nTextFrame = vgui.Create(\"DFrame\")\nTextFrame:SetSize(200, 224)\nTextFrame:Center()\nTextFrame:SetTitle(\"Generic Frame\")\n\n-- RichText panel\nlocal richtext = vgui.Create(\"RichText\", TextFrame)\nrichtext:Dock(FILL)\n\n-- Throw some text in the panel\nrichtext:SetText(\"This is a block of text demonstrating how line wrapping and panel size relates to the number of lines shown inside of a RichText panel.\")\n\n-- Keep track of PerformLayout calls\nrichtext.layoutCount = 0\n\n-- Custom function for this example\nfunction richtext:NumLinesExample()\n\tprint(\"PerformLayout called \"..self.layoutCount..\" times: \"..richtext:GetNumLines()..\" line(s) returned\")\t\nend\n\n-- Print # of lines before any layouts\nrichtext:NumLinesExample()\n\n-- Render update\nfunction richtext:PerformLayout()\n\n\tself.layoutCount = self.layoutCount + 1\n\tself:NumLinesExample()\t-- Print current # of lines\n\nend","output":{"text":"The panel shows 5 lines of text, but the number 5 isn't returned until PerformLayout has been called 2 times.\n\n```\nPerformLayout called 0 times: 1 line(s) returned\nPerformLayout called 1 times: 1 line(s) returned\nPerformLayout called 2 times: 5 line(s) returned\n```","image":{"src":"RichText_GetNumLines_example1.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetParent","parent":"Panel","type":"classfunc","description":"Returns the parent of the panel, returns nil if there is no parent.","realm":"Client and Menu","rets":{"ret":{"text":"The parent of given panel","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetPos","parent":"Panel","type":"classfunc","description":"Returns the position of the panel relative to its Panel:GetParent.\n\nIf you require the panel's position **and** size, consider using Panel:GetBounds instead.\n\nIf you need the position in screen space, see Panel:LocalToScreen.\n\nSee also Panel:GetX and Panel:GetY.","realm":"Client and Menu","rets":{"ret":[{"text":"X coordinate, relative to this panels parents top left corner.","name":"","type":"number"},{"text":"Y coordinate, relative to this panels parents top left corner.","name":"","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetScrollStartIndexes","parent":"Panel","type":"classfunc","description":"Returns the vertical and horizontal start indexes of a TextEntry's visible text. This is useful when the panel is scrolled.","added":"2023.10.04","realm":"Client and Menu","rets":{"ret":[{"text":"The horizontal start index. (characters)","name":"horizontalIndex","type":"number"},{"text":"The vertical start index. (lines)","name":"verticalIndex","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSelectedChildren","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/selections.lua","line":"189-L205"},"description":"Returns a table of all children of the panel object that are selected. This is recursive, and the returned table will include tables for any child objects that also have children. This means that not all first-level members in the returned table will be of type Panel.","realm":"Client and Menu","rets":{"ret":{"text":"A table of any child objects that are selected, including tables for children of the child objects (These tables may also contain table members, as the method is recursive).","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSelectedTextRange","parent":"Panel","type":"classfunc","description":"Returns the currently selected range of text.\n\nThis function will only work on RichText and TextEntry panels and their derivatives.","realm":"Client and Menu","added":"2020.03.17","rets":{"ret":[{"text":"The start of the range. If no text is selected it may be 0 and/or equal to the end range.","name":"start","type":"number"},{"text":"The end of the range. If no text is selected it may be 0 and/or equal to the start range.","name":"endrange","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSelectionCanvas","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/selections.lua","line":"116-L131"},"description":"Returns the selection canvas for this panel. This will be the first parent that has Panel:SetSelectionCanvas set to true (or `self` if this panel is the selection canvas)\n\nA selection canvas would be the panel that contains a bunch of selectable panels (Panel:SetSelectable), usually for the drag'n'drop system. Calling this function on any of the selectable items, or any of their children, will return the first parent that can contain selectable panels.","realm":"Client and Menu","rets":{"ret":{"text":"The selection canvas, otherwise `nil`.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSize","parent":"Panel","type":"classfunc","description":"Returns the size of the panel.\n\nIf you require both the panel's position and size, consider using Panel:GetBounds instead.","realm":"Client and Menu","rets":{"ret":[{"text":"The panel's width. (Panel:GetWide)","name":"","type":"number"},{"text":"The panel's height (Panel:GetTall)","name":"","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSkin","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"378-L413"},"description":"Returns the table for the derma skin currently being used by this panel object.","realm":"Client and Menu","rets":{"ret":{"text":"The derma skin table currently being used by this object.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTable","parent":"Panel","type":"classfunc","description":"Returns the internal Lua table of the panel.","realm":"Client and Menu","rets":{"ret":{"text":"A table containing all the members of given panel object.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTall","parent":"Panel","type":"classfunc","description":"Returns the height of the panel.\n\nSee Panel:GetWide for the width of the panel. See also Panel:GetSize for a function that returns both.","realm":"Client and Menu","rets":{"ret":{"text":"height","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetText","parent":"Panel","type":"classfunc","description":"Returns the panel's text (where applicable).\n\nThis method returns a maximum of 1023 bytes, except for TextEntry.","realm":"Client and Menu","rets":{"ret":{"text":"The panel's text.","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTextInset","parent":"Panel","type":"classfunc","description":"Gets the left and top text margins of a text-based panel object, such as a DButton or DLabel. This is set with Panel:SetTextInset.","realm":"Client and Menu","rets":{"ret":[{"text":"The left margin of the text, in pixels.","name":"","type":"number"},{"text":"The top margin of the text, in pixels.","name":"","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTextSize","parent":"Panel","type":"classfunc","description":"Gets the size of the text within a Label derived panel.","realm":"Client and Menu","rets":{"ret":[{"text":"The width of the text in the DLabel.","name":"","type":"number"},{"text":"The height of the text in the DLabel.","name":"","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTooltip","parent":"Panel","type":"classfunc","description":"Returns the tooltip text that was set with PANEL:SetTooltip.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel.lua","line":"277-L282"},"rets":{"ret":{"text":"The tooltip text, if it was set.","name":"tooltip","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTooltipDelay","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"294-L296"},"description":"Returns the tooltip delay (time between hovering over the panel, and the tooltip showing up) that was set with Panel:SetTooltipDelay, or nothing if it was not set.\n\nIf the delay is not explicitly set by this function, it will fallback to the value of the `tooltip_delay` ConVar, which is `0.5` by default.","realm":"Client and Menu","added":"2023.04.19","rets":{"ret":{"text":"The tooltip delay in seconds, if it was set.","name":"tooltip","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTooltipPanel","parent":"Panel","type":"classfunc","description":"Returns the tooltip panel that was set with PANEL:SetTooltipPanel.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel.lua","line":"287-L289"},"rets":{"ret":{"text":"The tooltip panel, if it was set.","name":"tooltip","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetValidReceiverSlot","parent":"Panel","type":"classfunc","description":"Gets valid receiver slot of currently dragged panel.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"335-L359"},"rets":{"ret":[{"text":"The panel this was called on if a valid receiver slot exists, otherwise false.","name":"","type":"Panel"},{"text":"The slot table.","name":"","type":"table"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetValue","parent":"Panel","type":"classfunc","description":{"text":"Returns the value the panel holds.\n\nIn engine is only implemented for CheckButton, Label and TextEntry as a string.","note":"This function is limited to 8092 Bytes. If using DTextEntry, use Panel:GetText for unlimited bytes."},"realm":"Client and Menu","rets":{"ret":{"text":"The value the panel holds.","name":"","type":"any"}}},"example":{"description":"Returns the string typed in a TextEntry.","code":"local TextEntry = vgui.Create( \"TextEntry\" )\nTextEntry:SetText( \"Hello world!\" )\nprint( TextEntry:GetValue() )","output":"\"Hello world!\""},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetWide","parent":"Panel","type":"classfunc","description":"Returns the width of the panel.\n\nSee Panel:GetTall for the height of the panel. See also Panel:GetSize for a function that returns both.","realm":"Client and Menu","rets":{"ret":{"text":"width","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetX","parent":"Panel","type":"classfunc","description":"Returns the X position of the panel relative to its Panel:GetParent.\n\nUses Panel:GetPos internally.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel.lua","line":"62-L65"},"added":"2021.03.31","rets":{"ret":{"text":"X coordinate.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetY","parent":"Panel","type":"classfunc","description":"Returns the Y position of the panel relative to its Panel:GetParent.\n\nUses Panel:GetPos internally.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel.lua","line":"66-L69"},"added":"2021.03.31","rets":{"ret":{"text":"Y coordinate.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetZPos","parent":"Panel","type":"classfunc","description":"Returns the Z position of the panel.","realm":"Client and Menu","rets":{"ret":{"text":"The Z order position of the panel.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GoBack","parent":"Panel","type":"classfunc","description":"Goes back one page in the HTML panel's history if available.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GoForward","parent":"Panel","type":"classfunc","description":"Goes forward one page in the HTML panel's history if available.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GoToHistoryOffset","parent":"Panel","type":"classfunc","description":"Goes to the page in the HTML panel's history at the specified relative offset.","realm":"Client and Menu","args":{"arg":{"text":"The offset in the panel's back/forward history, relative to the current page, that you would like to skip to. Because this is relative, 0 = current page while negative goes back and positive goes forward. For example, -2 will go back 2 pages in the history.","name":"offset","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GotoTextEnd","parent":"Panel","type":"classfunc","description":"Causes a RichText element to scroll to the bottom of its text.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GotoTextStart","parent":"Panel","type":"classfunc","description":"Causes a RichText element to scroll to the top of its text.","realm":"Client and Menu"},"example":{"description":"Creates a RichText panel with a \"Back to Top\" button which scrolls the text to the start.","code":"-- Create a window frame\nTextFrame = vgui.Create(\"DFrame\")\nTextFrame:SetSize(250, 200)\nTextFrame:Center()\nTextFrame:SetTitle(\"#ServerBrowser_ServerWarningTitle\")\nTextFrame:MakePopup()\n\n-- RichText panel\nlocal richtext = vgui.Create(\"RichText\", TextFrame)\nrichtext:Dock(FILL)\n\n-- Yellow colored localized text about player capacity\nrichtext:InsertColorChange(255, 255, 192, 255)\nrichtext:AppendText(\"#ServerBrowser_ServerWarning_MaxPlayers\")\n\n-- Create a button that moves the text back to the start\nlocal topbutton = vgui.Create(\"DButton\", richtext)\ntopbutton:SetSize(60, 20)\ntopbutton:SetPos(160, 146)\ntopbutton:SetText(\"Back to Top\")\n\n-- When clicked, go to the start of the text\ntopbutton.DoClick = function() richtext:GotoTextStart()\tend\n\n-- Apply background color and font\nfunction richtext:PerformLayout()\n\t\n\tself:SetFontInternal(\"Trebuchet18\")\n\tself:SetBGColor(Color(64, 64, 84))\n\t\nend","output":{"image":{"src":"RichText_GotoTextStart_example1.gif"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GWEN_SetCheckboxText","parent":"Panel","type":"classfunc","description":{"text":"Used by Panel:ApplyGWEN to apply the `CheckboxText` property to a DCheckBoxLabel. This does exactly the same as Panel:GWEN_SetText, but exists to cater for the seperate GWEN properties.","internal":""},"file":{"text":"lua/derma/derma_gwen.lua","line":"222"},"realm":"Client and Menu","args":{"arg":{"text":"The text to be applied to the DCheckBoxLabel.","name":"txt","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GWEN_SetControlName","parent":"Panel","type":"classfunc","description":{"text":"Used by Panel:ApplyGWEN to apply the `ControlName` property to a panel. This calls Panel:SetName.","internal":""},"realm":"Client and Menu","file":{"text":"lua/derma/derma_gwen.lua","line":"204"},"args":{"arg":{"text":"The new name to apply to the panel.","name":"name","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GWEN_SetDock","parent":"Panel","type":"classfunc","description":{"text":"Used by Panel:ApplyGWEN to apply the `Dock` property to a  panel object. This calls Panel:Dock.","internal":""},"realm":"Client and Menu","file":{"text":"lua/derma/derma_gwen.lua","line":"214-L220"},"args":{"arg":{"text":"The dock mode to pass to the panel's `Dock` method. This reads a string and applies the approriate Enums/DOCK.\n* `Right`: Dock right.\n* `Left`: Dock left.\n* `Bottom`: Dock at the bottom.\n* `Top`: Dock at the top.\n* `Fill`: Fill the parent panel.","name":"dockState","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GWEN_SetHorizontalAlign","parent":"Panel","type":"classfunc","description":{"text":"Used by Panel:ApplyGWEN to apply the `HorizontalAlign` property to a  panel object. This calls Panel:SetContentAlignment.","internal":""},"realm":"Client and Menu","file":{"text":"lua/derma/derma_gwen.lua","line":"208-L212"},"args":{"arg":{"text":"The alignment, as a string, to pass to Panel:SetContentAlignment. Accepts:\n* `Right`: Align mid-right.\n* `Left`: Align mid-left.\n* `Center`: Align mid-center.","name":"hAlign","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GWEN_SetMargin","parent":"Panel","type":"classfunc","description":{"text":"Used by Panel:ApplyGWEN to apply the `Margin` property to a  panel object. This calls Panel:DockMargin.","internal":""},"realm":"Client and Menu","file":{"text":"lua/derma/derma_gwen.lua","line":"205"},"args":{"arg":{"text":"A four-membered table containing the margins as numbers:\n* number left - The left margin.\n* number top - The top margin.\n* number right - The right margin.\n* number bottom - The bottom margin.","name":"margins","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GWEN_SetMax","parent":"Panel","type":"classfunc","description":{"text":"Used by Panel:ApplyGWEN to apply the `Max` property to a  DNumberWang, Slider, DNumSlider or DNumberScratch. This calls `SetMax` on one of the previously listed methods.","internal":""},"realm":"Client and Menu","file":{"text":"lua/derma/derma_gwen.lua","line":"207"},"args":{"arg":{"text":"The maximum value the element is to permit.","name":"maxValue","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GWEN_SetMin","parent":"Panel","type":"classfunc","description":{"text":"Used by Panel:ApplyGWEN to apply the `Min` property to a  DNumberWang, Slider, DNumSlider or DNumberScratch. This calls `SetMin` on one of the previously listed methods.","internal":""},"realm":"Client and Menu","file":{"text":"lua/derma/derma_gwen.lua","line":"206"},"args":{"arg":{"text":"The minimum value the element is to permit.","name":"minValue","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GWEN_SetPosition","parent":"Panel","type":"classfunc","description":{"text":"Used by Panel:ApplyGWEN to apply the `Position` property to a  panel object. This calls Panel:SetPos.","internal":""},"realm":"Client and Menu","file":{"text":"lua/derma/derma_gwen.lua","line":"201"},"args":{"arg":{"text":"A two-membered table containing the x and y coordinates as numbers:\n* number x - The x coordinate.\n* number y - The y coordinate.","name":"pos","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GWEN_SetSize","parent":"Panel","type":"classfunc","description":{"text":"Used by Panel:ApplyGWEN to apply the `Size` property to a  panel object. This calls Panel:SetSize.","internal":""},"realm":"Client and Menu","file":{"text":"lua/derma/derma_gwen.lua","line":"202"},"args":{"arg":{"text":"A two-membered table containing the width and heights as numbers:\n* number w - The width.\n* number h - The height.","name":"size","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GWEN_SetText","parent":"Panel","type":"classfunc","description":{"text":"Used by Panel:ApplyGWEN to apply the `Text` property to a panel.","internal":""},"realm":"Client and Menu","file":{"text":"lua/derma/derma_gwen.lua","line":"203"},"args":{"arg":{"text":"The text to be applied to the panel.","name":"txt","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"HasChildren","parent":"Panel","type":"classfunc","description":"Returns whenever the panel has child panels.","realm":"Client and Menu","rets":{"ret":{"text":"hasChilds","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"HasFocus","parent":"Panel","type":"classfunc","description":"Returns if the panel is focused.","realm":"Client and Menu","rets":{"ret":{"text":"hasFocus","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"HasHierarchicalFocus","parent":"Panel","type":"classfunc","description":"Returns if the panel or any of its children(sub children and so on) has the focus.","realm":"Client and Menu","rets":{"ret":{"text":"hasHierarchicalFocus","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"HasParent","parent":"Panel","type":"classfunc","description":"Returns whether the panel is a descendent of the given panel.","realm":"Client and Menu","args":{"arg":{"name":"parentPanel","type":"Panel"}},"rets":{"ret":{"text":"True if the panel is contained within parentPanel.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Hide","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"606-L608"},"description":"Makes a panel invisible.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InsertClickableTextEnd","parent":"Panel","type":"classfunc","description":"Marks the end of a clickable text segment in a RichText element, started with Panel:InsertClickableTextStart.","realm":"Client and Menu"},"example":{"description":"Creates a panel with some information on RichText panels along with a click-able link to the RichText page.","code":"-- Create a window frame\nTextFrame = vgui.Create(\"DFrame\")\nTextFrame:SetSize(250, 150)\nTextFrame:Center()\nTextFrame:SetTitle(\"RichText\")\nTextFrame:MakePopup()\n\n-- RichText panel\nlocal richtext = vgui.Create(\"RichText\", TextFrame)\nrichtext:Dock(FILL)\n\n-- First segment\nrichtext:InsertColorChange(255, 255, 255, 255)\nrichtext:AppendText(\"This is a Rich Text panel — a panel used in Source MP's default chat box and developer console.\\n\\nSee the \")\n\n-- Second segment\nrichtext:InsertColorChange(192, 192, 255, 255)\nrichtext:InsertClickableTextStart(\"OpenWiki\")\t-- Make incoming text fire the \"OpenWiki\" value when clicked\nrichtext:AppendText(\"Garry's Mod Wiki\")\nrichtext:InsertClickableTextEnd()\t-- End clickable text here\n\n-- Third segment\nrichtext:InsertColorChange(255, 255, 255, 255)\nrichtext:AppendText(\" for information on how to use a Rich Text panel.\")\n\n-- Background color\nfunction richtext:PerformLayout() self:SetBGColor(Color(32, 32, 46)) end\n\n-- Handle any commands we get from the panel\nfunction richtext:OnTextClicked( id )\n\n\t-- Open the wiki\n\tif ( id == \"OpenWiki\" ) then\n\t\n\t\tgui.OpenURL( \"https://wiki.facepunch.com/gmod/Panel:InsertClickableTextStart\" ) \n\t\n\tend\n\nend","output":{"image":{"src":"RichText_InsertClickableText_example.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InsertClickableTextStart","parent":"Panel","type":"classfunc","description":{"text":"Starts the insertion of clickable text for a RichText element. Any text appended with Panel:AppendText between this call and Panel:InsertClickableTextEnd will become clickable text.\n\nThe hook PANEL:OnTextClicked is called when the text is clicked.","note":"The clickable text is a separate Derma panel which will not inherit the current font from the `RichText`."},"realm":"Client and Menu","args":{"arg":{"text":"The text passed as the action signal's value.","name":"signalValue","type":"string"}}},"example":{"description":"Creates a panel with some information on Rich Text panels along with a click-able link to the RichText page.","code":"-- Create a window frame\nTextFrame = vgui.Create(\"DFrame\")\nTextFrame:SetSize(250, 150)\nTextFrame:Center()\nTextFrame:SetTitle(\"RichText\")\nTextFrame:MakePopup()\n\n-- RichText panel\nlocal richtext = vgui.Create(\"RichText\", TextFrame)\nrichtext:Dock( FILL )\n\n-- First segment\nrichtext:InsertColorChange(255, 255, 255, 255)\nrichtext:AppendText(\"This is a Rich Text panel — a panel used in Source MP's default chat box and developer console.\\n\\nSee the \")\n\n-- Second segment\nrichtext:InsertColorChange(192, 192, 255, 255)\nrichtext:InsertClickableTextStart(\"OpenWiki\")\t-- Make incoming text fire the \"OpenWiki\" value when clicked\nrichtext:AppendText(\"Garry's Mod Wiki\")\nrichtext:InsertClickableTextEnd()\t-- End clickable text here\n\n-- Third segment\nrichtext:InsertColorChange(255, 255, 255, 255)\nrichtext:AppendText(\" for information on how to use a Rich Text panel.\")\n\n-- Background color\nfunction richtext:PerformLayout() self:SetBGColor(Color(32, 32, 46)) end\n\n-- Handle any commands we get from the panel\nfunction richtext:OnTextClicked( id )\n\n\t-- Open the wiki\n\tif ( id == \"OpenWiki\" ) then\n\t\n\t\tgui.OpenURL( \"https://wiki.facepunch.com/gmod/Panel:InsertClickableTextStart\" ) \n\t\n\tend\n\nend","output":{"image":{"src":"RichText_InsertClickableText_example.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InsertColorChange","parent":"Panel","type":"classfunc","description":"Inserts a color change in a RichText element, which affects the color of all text added with Panel:AppendText until another color change is applied.","realm":"Client and Menu","args":{"arg":[{"text":"The red value `(0 - 255)`.","name":"r","type":"number"},{"text":"The green value `(0 - 255)`.","name":"g","type":"number"},{"text":"The blue value `(0 - 255)`.","name":"b","type":"number"},{"text":"The alpha value `(0 - 255)`.","name":"a","type":"number"}]}},"example":[{"description":"Creates a RichText panel with color coding on certain segments of text.","code":"-- Create a window frame\nTextFrame = vgui.Create( \"DFrame\" )\nTextFrame:SetSize( 200, 200 )\nTextFrame:Center()\nTextFrame:SetTitle( \"Colored text\" )\nTextFrame:MakePopup()\n\n-- RichText panel\nlocal richtext = vgui.Create( \"RichText\", TextFrame )\nrichtext:Dock( FILL )\nrichtext:SetVerticalScrollbarEnabled( false )\n\n-- Text blocks\nrichtext:InsertColorChange( 255, 255, 192, 255 )\nrichtext:AppendText( \"This is an example of \" )\n\nrichtext:InsertColorChange( 0, 255, 0, 255 )\nrichtext:AppendText( \"color coding \" )\n\nrichtext:InsertColorChange( 255, 255, 192, 255 )\nrichtext:AppendText( \"different segments of text throughout a \" )\n\nrichtext:InsertColorChange( 255, 200, 0, 255 )\nrichtext:AppendText( \"Rich Text panel.\\n\\n\" )\n\nrichtext:InsertColorChange(64, 0, 255, 255 )\nrichtext:AppendText( \"Here is another line of text shown in the color \")\n\nrichtext:InsertColorChange( 128, 0, 255, 255 )\nrichtext:AppendText( \"purple.\" )\n\n-- When the panel is ready for layout, apply font and background color\nfunction richtext:PerformLayout()\n\tself:SetFontInternal( \"Trebuchet18\" )\n\tself:SetBGColor( Color( 0, 16, 32 ) )\nend","output":{"image":{"src":"RichText_InsertColorChange_example1.png"}}},{"description":"Word by word coloring using string.Explode and random colors.","code":"-- Create a window frame\nlocal TextFrame = vgui.Create( \"DFrame\" )\nTextFrame:SetSize( 300, 200 )\nTextFrame:Center()\nTextFrame:SetTitle( \"Randomly Colored Words\" )\nTextFrame:MakePopup()\n\n-- RichText panel\nlocal richtext = vgui.Create( \"RichText\", TextFrame )\nrichtext:Dock( FILL )\nrichtext:SetVerticalScrollbarEnabled( false )\n\nlocal txt_tbl = {\n    \"Here's a fun example involving word by word text coloring.\",\n    \"Each word is separated by a space, colored, and appended to the Rich Text panel individually.\",\n    \"The colors are randomly generated shades of red, orange, yellow, and pink.\"\n}\n\nfor _, txt in ipairs( txt_tbl ) do\n    txt = string.Explode( \" \", txt, false )\n    \n    for _, word in ipairs( txt ) do\n        richtext:InsertColorChange( 255, math.random( 0, 255 ), math.random( 0, 255 ), 255 )\n        richtext:AppendText( word .. \" \" )\n    end\nend\n\nfunction richtext:PerformLayout()\n    self:SetFontInternal( \"GModNotify\" )\n    self:SetBGColor( Color( 32, 16, 0 ) )\nend","output":{"image":{"src":"RichText_InsertColorChange_example2.png"}}}],"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InsertFade","parent":"Panel","type":"classfunc","description":"Begins a text fade for a RichText element where the last appended text segment is fully faded out after a specific amount of time, at a specific speed.\n\nThe alpha of the text at any given time is determined by the text's base alpha * ((`sustain` - Global.CurTime) / `length`) where Global.CurTime is added to `sustain` when this method is called.","realm":"Client and Menu","args":{"arg":[{"text":"The number of seconds the text remains visible.","name":"sustain","type":"number"},{"text":"The number of seconds it takes the text to fade out.\n\nIf set **lower** than `sustain`, the text will not begin fading out until (`sustain` - `length`) seconds have passed.\n\nIf set **higher** than `sustain`, the text will begin fading out immediately at a fraction of the base alpha.\n\nIf set to **-1**, the text doesn't fade out.","name":"length","type":"number"}]}},"example":[{"description":"Creates a Rich Text panel that sustains visibility for 6 seconds with a 2 second long fade-out.","code":"-- Create a window frame\nTextFrame = vgui.Create(\"DFrame\")\nTextFrame:SetSize(200, 200)\nTextFrame:Center()\nTextFrame:SetTitle(\"Fading Text\")\nTextFrame:MakePopup()\n\n-- RichText panel\nlocal richtext = vgui.Create(\"RichText\", TextFrame)\nrichtext:Dock(FILL)\n\n-- Sample text\nrichtext:SetText(\"This is an example of a Rich Text panel using a fade-out with:\\n\\n6 seconds of sustain\\n\\n2 second fade-out length\")\n\t\n-- When the panel is ready for layout, begin the fade\nfunction richtext:PerformLayout()\n\t\n\tself:SetFontInternal(\"Trebuchet18\")\n\tself:SetBGColor(Color(64, 64, 92))\n\t\n\t-- Wait 6 seconds, then fade out in 2 seconds\n\tself:InsertFade(6, 2)\n\t\nend","output":{"text":"Some identical example outputs are shown below, only with different `length` values swapped in.","image":[{"src":"RichText_InsertFade_output1.gif"},{"src":"RichText_InsertFade_output2.gif"},{"src":"RichText_InsertFade_output3.gif"}]}},{"description":"Create a Rich Text panel where Dr. Kleiner reads a fading message in sync with text.","code":"-- Create a window frame\nTextFrame = vgui.Create(\"DFrame\")\nTextFrame:SetSize(350, 100)\nTextFrame:Center()\nTextFrame:SetTitle(\"Kleiner says:\")\nTextFrame:MakePopup()\n\n-- RichText panel\nlocal richtext = vgui.Create(\"RichText\", TextFrame)\nrichtext:Dock(FILL)\t\n\n-- Red text\nrichtext:InsertColorChange(200, 60, 32, 255)\nrichtext:SetVerticalScrollbarEnabled(false)\n\t\nlocal words = {\"There's\", \"only\", \"one\", \"hedy...\"}\nlocal delay = 0\n\n-- Display each word in half second interval\nfor w, txt in pairs(words) do\n\n\tif(w == 1) then delay = 0.2\n\telse delay = (w-1)*0.45 end\n\n\ttimer.Simple(delay, function()\n\t\n\t\trichtext:AppendText(txt..\" \")\n\t\trichtext:InsertFade(2, 1)\t-- Sustain for 2 seconds while fading out after 1 second\n\t\t\n\t\trichtext:SetBGColor(Color(0, 0, 0))\n\t\trichtext:SetFontInternal(\"DermaLarge\")\n\t\n\tend)\n\nend\n\n-- Kleiner read along\nLocalPlayer():EmitSound(\"vo/k_lab2/kl_onehedy.wav\")","output":{"image":{"src":"RichText_InsertFade_example2.gif"}}}],"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InvalidateChildren","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"473-L487"},"description":"Invalidates the layout of this panel object and all its children. This will cause these objects to re-layout immediately, calling PANEL:PerformLayout. If you want to perform the layout in the next frame, you will have loop manually through all children, and call Panel:InvalidateLayout on each.","realm":"Client and Menu","args":{"arg":{"text":"If `true`, the method will recursively invalidate the layout of all children. Otherwise, only immediate children are affected.","name":"recursive","type":"boolean","default":"false"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InvalidateLayout","parent":"Panel","type":"classfunc","description":{"text":"Causes the panel to re-layout in the next frame. During the layout process  PANEL:PerformLayout will be called on the target panel.\n\nYou should avoid calling this function every frame.","bug":{"text":"Using this on a panel after clicking on a docked element will cause docked elements to reorient themselves incorrectly. This can be fixed by assigning a unique Panel:SetZPos to each docked element.","issue":"2574"}},"realm":"Client and Menu","args":{"arg":{"text":"If true the panel will re-layout instantly and not wait for the next frame.","name":"layoutNow","type":"boolean","default":"false"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InvalidateParent","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"250-L260"},"description":"Calls Panel:InvalidateLayout on the panel's parent. This function will silently fail if the panel has no parent.\n\nThis will cause the parent panel to re-layout, calling PANEL:PerformLayout.\n\nInternally sets `LayingOutParent` to `true` on this panel, and will silently fail if it is already set.","realm":"Client and Menu","args":{"arg":{"text":"If `true`, the re-layout will occur immediately, otherwise it will be performed in the next frame.","name":"layoutNow","type":"boolean","default":"false"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsChildHovered","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"610-L621"},"description":"Determines whether the mouse cursor is hovered over one of this panel object's children. This is a reverse process using vgui.GetHoveredPanel, and looks upward to find the parent.","realm":"Client and Menu","args":{"arg":{"text":"Set to true to check only the immediate children of given panel ( first level )","name":"immediate","type":"boolean","default":"false"}},"rets":{"ret":{"text":"Whether or not one of this panel object's children is being hovered over.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsDraggable","parent":"Panel","type":"classfunc","description":"Returns whether this panel is draggable ( if user is able to drag it ) or not.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"361-L365"},"rets":{"ret":{"text":"Whether this panel is draggable ( if user is able to drag it ) or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsDragging","parent":"Panel","type":"classfunc","description":"Returns whether this panel is currently being dragged or not.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"367-L373"},"rets":{"ret":{"text":"Whether this panel is currently being dragged or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsEnabled","parent":"Panel","type":"classfunc","description":"Returns whether the the panel is enabled or disabled.\n\nSee Panel:SetEnabled for a function that makes the panel enabled or disabled.","realm":"Client and Menu","rets":{"ret":{"text":"Whether the panel is enabled or disabled.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsHovered","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"598-L600"},"description":"Returns whether the mouse cursor is hovering over this panel or not\n\nUses vgui.GetHoveredPanel internally.\n\nRequires Panel:SetMouseInputEnabled to be set to true.","realm":"Client and Menu","rets":{"ret":{"text":"true if the panel is hovered","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsKeyboardInputEnabled","parent":"Panel","type":"classfunc","description":"Returns true if the panel can receive keyboard input.","realm":"Client and Menu","rets":{"ret":{"text":"keyboardInputEnabled","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsLoading","parent":"Panel","type":"classfunc","description":{"text":"Determines whether or not a HTML or DHTML element is currently loading a page.","note":["Before calling Panel:SetHTML or DHTML:OpenURL, the result seems to be `false` with the Awesomium web renderer and `true` for the Chromium web renderer. This difference can be used to determine the available HTML5 capabilities.","On Awesomium, the result remains `true` until the root document is loaded and when in-page content is loading (when adding pictures, frames, etc.). During this state, the HTML texture is not refreshed and the panel is not painted (it becomes invisible).\n\nOn Chromium, the value is only `true` when the root document is not ready. The rendering is not suspended when in-page elements are loading."]},"realm":"Client and Menu","rets":{"ret":{"text":"Whether or not the (D)HTML object is loading.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsMarkedForDeletion","parent":"Panel","type":"classfunc","description":"Returns if the panel is going to be deleted in the next frame.","realm":"Client and Menu","rets":{"ret":{"text":"markedForDeletion","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsModal","parent":"Panel","type":"classfunc","description":"Returns whether the panel was made modal or not. See Panel:DoModal.","realm":"Client and Menu","added":"2021.01.27","rets":{"ret":{"text":"True if the panel is modal.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsMouseInputEnabled","parent":"Panel","type":"classfunc","description":"Returns true if the panel can receive mouse input.","realm":"Client and Menu","rets":{"ret":{"text":"mouseInputEnabled","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsMultiline","parent":"Panel","type":"classfunc","description":"Determines whether or not a TextEntry panel is in multi-line mode. This is set with Panel:SetMultiline.","realm":"Client and Menu","rets":{"ret":{"text":"Whether the object is in multi-line mode or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsOurChild","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"489-L495"},"description":"Returns whether the panel contains the given panel, recursively.","realm":"Client and Menu","args":{"arg":{"name":"childPanel","type":"Panel"}},"rets":{"ret":{"text":"True if the panel contains childPanel.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsPopup","parent":"Panel","type":"classfunc","description":"Returns if the panel was made popup or not. See Panel:MakePopup","realm":"Client and Menu","added":"2021.01.27","rets":{"ret":{"text":"`true` if the panel was made popup.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsSelectable","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/selections.lua","line":"66-L70"},"description":{"text":"Determines if the panel object is selectable (like icons in the Spawn Menu, holding ). This is set with Panel:SetSelectable.","key":"Shift"},"realm":"Client and Menu","rets":{"ret":{"text":"Whether the panel is selectable or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsSelected","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/selections.lua","line":"59-L64"},"description":{"text":"Returns if the panel object is selected (like icons in the Spawn Menu, holding ). This can be set in Lua using Panel:SetSelected.","key":"Shift"},"realm":"Client and Menu","rets":{"ret":{"text":"Whether the panel object is selected or not. Always returns false if the object is not selectable. This can be modified using Panel:SetSelectable.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsSelectionCanvas","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/selections.lua","line":"17-L21"},"description":"Determines if the panel object is a selection canvas or not. This is set with Panel:SetSelectionCanvas.","realm":"Client and Menu","rets":{"ret":{"text":"The value (if any) set by Panel:SetSelectionCanvas.","name":"","type":"any"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsValid","parent":"Panel","type":"classfunc","description":"Returns if the panel is valid and not marked for deletion.","realm":"Client and Menu","rets":{"ret":{"text":"True if the object is valid.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsVisible","parent":"Panel","type":"classfunc","description":"Returns if the panel is visible. This will **NOT** take into account visibility of the parent.","realm":"Client and Menu","rets":{"ret":{"text":"`true` if the panel ls visible, `false` otherwise.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsWorldClicker","parent":"Panel","type":"classfunc","description":"Returns if a panel allows world clicking set by Panel:SetWorldClicker.","realm":"Client and Menu","rets":{"ret":{"text":"If the panel allows world clicking.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"KillFocus","parent":"Panel","type":"classfunc","description":"Remove the focus from the panel.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"LerpPositions","parent":"Panel","type":"classfunc","description":"Redefines the panel object's Panel:SetPos method to operate using frame-by-frame linear interpolation (Global.Lerp). When the panel's position is changed, it will move to the target position at the speed defined. You can undo this with Panel:DisableLerp.\n\nUnlike the other panel animation functions, such as Panel:MoveTo, this animation method will not operate whilst the game is paused. This is because it relies on Global.FrameTime.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/animation.lua","line":"338-L354"},"args":{"arg":[{"text":"The speed at which to move the panel. This is affected by the value of `easeOut`. Recommended values are:\n* **0.1 - 10** when `easeOut` is `false`.\n* **0.1 - 1** when `easeOut` is `true`.","name":"speed","type":"number"},{"text":"This causes the panel object to 'jump' at the target, slowing as it approaches. This affects the `speed` value significantly, see above.","name":"easeOut","type":"boolean"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"LoadControlsFromFile","parent":"Panel","type":"classfunc","description":{"text":"Similar to Panel:LoadControlsFromString but loads controls from a file.","deprecated":"No longer does anything.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The path to load the controls from.","name":"path","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"LoadControlsFromString","parent":"Panel","type":"classfunc","description":{"text":"Loads controls(positions, etc) from given data. This is what the default options menu uses.","deprecated":"No longer does anything.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The data to load controls from. Format unknown.","name":"data","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"LoadGWENFile","parent":"Panel","type":"classfunc","description":"Loads a .gwen file (created by GWEN Designer) and calls Panel:LoadGWENString with the contents of the loaded file.\n\nUsed to load panel controls from a file.","realm":"Client and Menu","file":{"text":"lua/derma/derma_gwen.lua","line":"126-L133"},"args":{"arg":[{"text":"The file to open. The path is relative to garrysmod/garrysmod/.","name":"filename","type":"string"},{"text":"The path used to look up the file.\n\n* \"GAME\" Structured like base folder (garrysmod/), searches all the mounted content (main folder, addons, mounted games etc)\n* \"LUA\" or \"lsv\" - All Lua folders (lua/) including gamesmodes and addons\n* \"DATA\" Data folder (garrysmod/data)\n* \"MOD\" Strictly the game folder (garrysmod/), ignores mounting.","name":"path","type":"string","default":"GAME"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"LoadGWENString","parent":"Panel","type":"classfunc","description":"Loads controls for the panel from a JSON string.","realm":"Client and Menu","file":{"text":"lua/derma/derma_gwen.lua","line":"138-L146"},"args":{"arg":{"text":"JSON string containing information about controls to create.","name":"str","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"LoadTGAImage","parent":"Panel","type":"classfunc","description":{"text":"Sets a new image to be loaded by a TGAImage.","deprecated":"DImage should be used instead (with `.png` or `.jpg` images). `TGAImage` panel has no advantages."},"realm":"Client and Menu","args":{"arg":[{"text":"The file path.","name":"imageName","type":"string"},{"text":"The PATH to search in. See File Search Paths.\n\nThis isn't used internally.","name":"strPath","type":"string"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"LocalCursorPos","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"540-L542"},"description":"Returns the cursor position local to the position of the panel (usually the upper-left corner).","realm":"Client and Menu","rets":{"ret":[{"text":"The x coordinate","name":"","type":"number"},{"text":"The y coordinate","name":"","type":"number"}]}},"example":{"description":"Create and center a label panel and update its text with the local cursor position.","code":"TestLabel = vgui.Create(\"DLabel\")\nTestLabel:SetSize(100, 20)\nTestLabel:Center()\nTestLabel:SetPaintBackgroundEnabled(true)\nTestLabel:SetColor(Color(255, 0, 0))\n\nlocal x, y = 0, 0\n\nfunction TestLabel:PerformLayout()\n\n\tx, y = self:LocalCursorPos()\n\n\tself:SetText(\" X: \"..x..\" , Y: \"..y)\n\t\nend","output":{"image":{"src":"Panel_LocalCursorPos_example1.gif"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"LocalToScreen","parent":"Panel","type":"classfunc","description":{"text":"Takes X and Y coordinates relative to the panel and returns their corresponding positions relative to the screen.\n\nSee also Panel:ScreenToLocal.","warning":"This function uses a cached value for the screen position of the panel, computed at the end of the last VGUI Think/Layout pass, so inaccurate results may be returned if the panel or any of its ancestors have been re-positioned outside of PANEL:Think or PANEL:PerformLayout within the last frame.","note":"If the panel uses Panel:Dock, this function will return 0, 0 when the panel was created. The position will be updated in the next frame."},"realm":"Client and Menu","args":{"arg":[{"text":"The X coordinate of the position on the panel to translate.","name":"posX","type":"number"},{"text":"The Y coordinate of the position on the panel to translate.","name":"posY","type":"number"}]},"rets":{"ret":[{"text":"The X coordinate relative to the screen.","name":"","type":"number"},{"text":"The Y coordinate relative to the screen.","name":"","type":"number"}]}},"example":{"name":"Basic Usages","description":"Here we create a DFrame derivative and use it to display the screen coordinates of the center of the panel. For and explanation of the design structure read VGUI Creating Custom Elements","code":"--Creating the table that we will use to make our table\nlocal PANEL = {}\n\nfunction PANEL:Init()\n    self:SetSize(200,200)\n    self:Center()\n\tself:MakePopup()\n\n    self.Text = vgui.Create(\"DLabel\",self) --Creating the DLabel to display our coordinates \n    self.Text:Center()\n    self.Text:SetColor(color_black)\n    \nend\n\nfunction PANEL:Think()\n    self.BaseClass.Think(self) --Allows us to keep the default DFrame think hook without overriding it.\n\n\t\n\t--Here we use the function to translate the center coordinate of our panel to the screen coordinate of at that same spot.\n    self.ScreenXPos, self.ScreenYPos = self:LocalToScreen(self:GetWide() / 2,self:GetTall() / 2)\n    \n\t--Updating our text display\n\tself.Text:SetText(\"X: \" .. self.ScreenXPos .. \" | Y: \" .. self.ScreenYPos)\n    self.Text:SizeToContents()\nend\n\n\nvgui.Register(\"WikiExample\", PANEL, \"DFrame\")\n\n--You can create this panel using vgui.Create(\"WikiExample\")","output":{"image":{"src":"aaf9e/8dc93bb0caa838e.png","size":"21025","name":"image.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MakePopup","parent":"Panel","type":"classfunc","description":{"text":"Focuses the panel and enables it to receive input.\n\nThis automatically calls Panel:SetMouseInputEnabled and Panel:SetKeyboardInputEnabled and sets them to `true`.","note":"Panels derived from Panel will not work properly with this function. Due to this, any children will not be intractable with keyboard. Derive from EditablePanel instead.\n\nFor non gui related mouse focus, you can use gui.EnableScreenClicker."},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MouseCapture","parent":"Panel","type":"classfunc","description":"Allows the panel to receive mouse input even if the mouse cursor is outside the bounds of the panel.","realm":"Client and Menu","args":{"arg":{"text":"Set to true to enable, set to false to disable.","name":"doCapture","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MoveAbove","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"137-L137"},"description":"Places the panel above the passed panel with the specified offset.","realm":"Client and Menu","args":{"arg":[{"text":"Panel to position relatively to.","name":"panel","type":"Panel"},{"text":"The align offset.","name":"offset","type":"number","default":"0"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MoveBelow","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"138-L138"},"description":"Places the panel below the passed panel with the specified offset.","realm":"Client and Menu","args":{"arg":[{"text":"Panel to position relatively to.","name":"panel","type":"Panel"},{"text":"The align offset.","name":"offset","type":"number","default":"0"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MoveBy","parent":"Panel","type":"classfunc","description":"Moves the panel by the specified coordinates using animation.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/animation.lua","line":"286-L292"},"args":{"arg":[{"text":"The number of pixels to move by in the horizontal (x) direction.","name":"moveX","type":"number"},{"text":"The number of pixels to move by in the vertical (y) direction.","name":"moveY","type":"number"},{"text":"The time (in seconds) in which to perform the animation.","name":"time","type":"number"},{"text":"The delay (in seconds) before the animation begins.","name":"delay","type":"number","default":"0"},{"text":"The easing of the start and/or end speed of the animation. See Panel:NewAnimation for how this works.","name":"ease","type":"number","default":"-1"},{"text":"The function to be called once the animation is complete.","name":"callback","type":"function","default":"nil","callback":{"arg":[{"text":"The Structures/AnimationData that was used.","type":"table","name":"animData"},{"text":"The panel object that was animated.","type":"Panel","name":"targetPanel"}]}}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MoveLeftOf","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"140-L140"},"description":"Places the panel left to the passed panel with the specified offset.","realm":"Client and Menu","args":{"arg":[{"text":"Panel to position relatively to.","name":"panel","type":"Panel"},{"text":"The align offset.","name":"offset","type":"number","default":"0"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MoveRightOf","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"139-L139"},"description":"Places the panel right to the passed panel with the specified offset.","realm":"Client and Menu","args":{"arg":[{"text":"Panel to position relatively to.","name":"panel","type":"Panel"},{"text":"The align offset.","name":"offset","type":"number","default":"0"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MoveTo","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/animation.lua","line":"146-L157"},"description":{"text":"Moves the panel to the specified position using animation.","note":"Setting the ease argument to 0 will result in the animation happening instantly, this applies to all MoveTo/SizeTo functions"},"realm":"Client and Menu","args":{"arg":[{"text":"The target x coordinate of the panel.","name":"posX","type":"number"},{"text":"The target y coordinate of the panel.","name":"posY","type":"number"},{"text":"The time to perform the animation within.","name":"time","type":"number"},{"text":"The delay before the animation starts.","name":"delay","type":"number","default":"0"},{"text":"The easing of the start and/or end speed of the animation. See Panel:NewAnimation for how this works.","name":"ease","type":"number","default":"-1"},{"text":"The function to be called once the animation finishes.","name":"callback","type":"function","default":"nil","callback":{"arg":[{"text":"The Structures/AnimationData that was used.","type":"table","name":"animData"},{"text":"The panel object that was animated.","type":"Panel","name":"targetPanel"}]}}]}},"example":{"description":"Move panel to center","code":"local frame = vgui.Create(\"DFrame\")\nframe:SetSize(ScrW() / 4, ScrH() / 4)\nframe:SetPos(ScrW() / 4, ScrH() / 2)\nframe:SetTitle(\"MoveTo Example\")\n\nlocal btn = vgui.Create(\"DButton\", frame)\nbtn:SetSize(frame:GetWide() / 2, frame:GetTall() / 3)\nbtn:Center()\nbtn:SetText(\"Move !\")\nbtn.DoClick = function(self)\n\tframe:MoveTo(ScrW() / 2 - frame:GetWide() / 2, ScrH() / 2 - frame:GetTall() / 2, 1, 0, -1, function()\n\t\tself:SetText(\"Yeah !\")\n\tend)\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MoveToAfter","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"544-L565"},"description":"Moves this panel object in front of the specified sibling (child of the same parent) in the render order, and shuffles up the Z-positions of siblings now behind.","realm":"Client and Menu","args":{"arg":{"text":"The panel to move this one in front of. Must be a child of the same parent panel.","name":"siblingPanel","type":"Panel"}},"rets":{"ret":{"text":"`false` if the passed panel is not a sibling, otherwise `nil`.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MoveToBack","parent":"Panel","type":"classfunc","description":"Moves the panel object behind all other panels on screen. If the panel has been made a pop-up with Panel:MakePopup, it will still draw in front of any panels that haven't.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MoveToBefore","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"567-L588"},"description":"Moves this panel object behind the specified sibling (child of the same parent) in the render order, and shuffles up the Panel:SetZPos of siblings now in front.","realm":"Client and Menu","args":{"arg":{"text":"The panel to move this one behind. Must be a child of the same parent panel.","name":"siblingPanel","type":"Panel"}},"rets":{"ret":{"text":"`false` if the passed panel is not a sibling, otherwise `nil`.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MoveToFront","parent":"Panel","type":"classfunc","description":"Moves the panel in front of all other panels on screen. Unless the panel has been made a pop-up using Panel:MakePopup, it will still draw behind any that have.","realm":"Client and Menu"},"example":{"description":"Creates two frame panels where one acts normal and the other acts as a persistent warning window that will move in front of all other panels until it is closed.","code":"-- Regular message\nlocal popup1 = vgui.Create(\"DFrame\")\npopup1:SetSize(400, 300)\npopup1:Center()\npopup1:MakePopup()\npopup1:SetTitle(\"This is a normal window.\")\n\n-- Warning message\nlocal popup2 = vgui.Create(\"DFrame\")\npopup2:SetSize(300, 100)\npopup2:Center()\npopup2:MakePopup()\npopup2:SetTitle(\"Warning!\")\n\n-- Warning label\nlocal warning = vgui.Create(\"DLabel\", popup2)\nwarning:SetSize(280, 80)\nwarning:Center()\nwarning:SetText(\"The server will be shutting down in 5 minutes!\")\nwarning:SetFont(\"GModNotify\")\nwarning:SetWrap(true)\n\n-- Move the warning message to front constantly\nfunction popup2:Think()\n\tself:MoveToFront()\nend","output":{"image":{"src":"Panel_MoveToFront_example1.gif"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"NewAnimation","parent":"Panel","type":"classfunc","description":"Creates a new animation for the panel object.\n\nMethods that use this function:\n* Panel:MoveTo\n* Panel:SizeTo\n* Panel:SlideUp\n* Panel:SlideDown\n* Panel:ColorTo\n* Panel:AlphaTo\n* Panel:MoveBy\n* Panel:LerpPositions","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/animation.lua","line":"102-L136"},"args":{"arg":[{"text":"The length of the animation in seconds.","name":"length","type":"number"},{"text":"The delay before the animation starts.","name":"delay","type":"number","default":"0"},{"text":"The power/index to use for easing.\n* Positive values greater than 1 will ease in; the higher the number, the sharper the curve's gradient (less linear).\n* A value of 1 removes all easing.\n* Positive values between 0 and 1 ease out; values closer to 0 increase the curve's gradient (less linear).\n* A value of 0 will break the animation and should be avoided.\n* Any value less than zero will ease in/out; the value has no effect on the gradient.","name":"ease","type":"number","default":"-1"},{"text":"The function to be called when the animation ends.","name":"callback","type":"function","default":"nil","callback":{"arg":[{"text":"The Structures/AnimationData that was used.","type":"table","name":"animData"},{"text":"The panel object that was animated.","type":"Panel","name":"targetPanel"}]}}]},"rets":{"ret":{"text":"Partially filled Structures/AnimationData with the following members: \n* number **EndTime** - Equal to `length` and `delay` arguments added together, plus either the Global.SysTime if there is no other animation queued or the end time of the last animation in the queue.\n* number **StartTime** - Equal to the `delay` argument, plus either the Global.SysTime if there is no other animation queued or the end time of the last animation in the queue.\n* number **Ease** - Equal to the `ease` argument.\n* function **OnEnd** - Equal to the `callback` argument.","name":"","type":"table"}}},"example":{"description":"Example on how to use this function, makes a button go around in a circle in a DFrame.","code":"local frame = vgui.Create( \"DFrame\" )\nframe:SetSize( 500, 500 )\nframe:Center()\nframe:MakePopup()\n\nlocal butt = frame:Add( \"DButton\" )\nbutt:SetPos( 5, 30 )\nbutt:SetSize( 100, 40 )\n\nfunction butt:doAnim()\n\tlocal anim = self:NewAnimation( 10, 0, 1, function( anim, pnl )\n\t\tself:doAnim()\n\tend )\n\n\tanim.Think = function( anim, pnl, fraction )\n\t\tlocal radius = 200\n\t\tpnl:SetPos( 250 + math.sin( Lerp( fraction, -math.pi, math.pi ) ) * radius - pnl:GetWide() / 2,\n\t\t\t\t\t250 + math.cos( Lerp( fraction, -math.pi, math.pi ) ) * radius - pnl:GetTall() / 2 )\n\n\t\tpnl:SetText( \"Frac: \" .. fraction .. \"\\nTime: \" .. ( SysTime() - anim.StartTime ) )\n\tend\nend\nbutt:doAnim()"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"NewObject","parent":"Panel","type":"classfunc","description":{"internal":""},"realm":"Client and Menu","args":{"arg":{"name":"objectName","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"NewObjectCallback","parent":"Panel","type":"classfunc","description":{"internal":""},"realm":"Client and Menu","args":{"arg":[{"name":"objectName","type":"string"},{"name":"callbackName","type":"string"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"NoClipping","parent":"Panel","type":"classfunc","description":{"text":"Sets whether this panel's drawings should be clipped within the parent panel's bounds.\n\nSee render.SetScissorRect if you wish to set the clipping rect instead.","note":"This only disabled clipping for the Paint Related functions (as far as i can tell at the current moment, more testing should be done) so things like the text of a DLabel will still be clipped to the parent.\n\nTo fully disable the clipping of any children see Global.DisableClipping."},"realm":"Client and Menu","args":{"arg":{"text":"Whether to disable clipping or not. `true` to disable clipping, `false` to enable clipping.","name":"disableClipping","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"NumSelectedChildren","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/selections.lua","line":"207-L221"},"description":"Returns the number of children of the panel object that are selected. This is equivalent to calling Panel:IsSelected on all child objects and counting the number of returns that are `true`.","realm":"Client and Menu","rets":{"ret":{"text":"The number of child objects that are currently selected. This does not include the parent object you are calling the method from.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OpenURL","parent":"Panel","type":"classfunc","description":"Instructs a HTML control to download and parse a HTML script using the passed URL.\n\nThis function can only be used on [HTML](HTML) panel and its derivatives.","realm":"Client and Menu","args":{"arg":{"text":"URL to open. It has to start or be one of the following:\n* `http://`\n* `https://`\n* `asset://`\n* `about:blank`\n* `chrome://credits/`","name":"URL","type":"string"}}},"example":[{"description":"Displays the Garry's Mod wiki page.","code":"local frame = vgui.Create( \"DFrame\" )\nframe:SetTitle( \"HTML Example\" )\nframe:SetSize( ScrW() * 0.75, ScrH() * 0.75 )\nframe:Center()\nframe:MakePopup()\n\nlocal html = vgui.Create( \"DHTML\", frame )\nhtml:Dock( FILL )\nhtml:OpenURL( \"wiki.facepunch.com/gmod\" )"},{"description":"Displays the default loading screen from the HTML folder.","code":"local frame = vgui.Create( \"DFrame\" )\nframe:SetTitle( \"HTML Example\" )\nframe:SetSize( ScrW() * 0.75, ScrH() * 0.75 )\nframe:Center()\nframe:MakePopup()\n\nlocal html = vgui.Create( \"HTML\", frame )\nhtml:Dock( FILL )\nhtml:OpenURL( \"asset://garrysmod/html/loading.html\" )","output":{"image":{"src":"html_openurl_example.png","alt":"800px"}}}],"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PaintAt","parent":"Panel","type":"classfunc","description":{"text":"Paints a ghost copy of the panel at the given position.","warning":"This function sets Z pos of panel's children (PANEL:SetZPos). It also briefly unparents and reparents the panel."},"realm":"Client and Menu","args":{"arg":[{"text":"The x coordinate to draw the panel from.","name":"posX","type":"number"},{"text":"The y coordinate to draw the panel from.","name":"posY","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PaintManual","parent":"Panel","type":"classfunc","description":"Paints the panel at its current position. To use this you must call Panel:SetPaintedManually(true).","realm":"Client and Menu","args":{"arg":{"text":"If set, overrides panels' clipping so that it can render fully when its size is larger than the game's resolution.","name":"unclamp","type":"boolean","default":"false"}}},"example":{"description":"Paints a simple panel inside a 3D rendering context.","code":"local frame = vgui.Create( \"DFrame\" )\nframe:SetTitle( \"PaintManual Test\" )\nframe:SetSize( 500, 500 )\nframe:SetPaintedManually( true )\n\nhook.Add( \"PostDrawTranslucentRenderables\", \"PaintManual Test\", function()\n\tif IsValid(frame) then\n\t\tlocal eyePos = Entity(1):EyePos()\n\t\tlocal forward = Entity(1):GetForward()\n\t\tlocal forwardAngle = forward:Angle()\n\n\t\tcam.Start3D2D(eyePos + (forward * 250), Angle(0, forwardAngle.y - 90, forwardAngle.r + 90), 0.2)\n\t\t\tframe:PaintManual()\n\t\tcam.End3D2D()\n\tend\nend )","output":{"text":"The panel will be drawn facing the player located on the player's crosshair.","image":{"src":"panel_paintmanual_example1_output.png","alt":"left"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ParentToHUD","parent":"Panel","type":"classfunc","description":"Parents the panel to the HUD.\nMakes it invisible on the escape-menu and disables controls.","realm":"Client"},"example":{"code":"Panel:ParentToHUD()"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Paste","parent":"Panel","type":"classfunc","description":{"text":"Only works for TextEntries.\n\nPastes the contents of the clipboard into the TextEntry.","deprecated":"Due to privacy concerns, this function has been disabled","note":"Tab characters will be dropped from the pasted text"},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PositionLabel","parent":"Panel","type":"classfunc","description":"Sets the width and position of a DLabel and places the passed panel object directly to the right of it. Returns the `y` value of the bottom of the tallest object. The panel on which this method is run is not relevant; only the passed objects are affected.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel.lua","line":"262-L275"},"args":{"arg":[{"text":"The width to set the label to.","name":"lblWidth","type":"number"},{"text":"The horizontal (x) position at which to place the label.","name":"x","type":"number"},{"text":"The vertical (y) position at which to place the label.","name":"y","type":"number"},{"text":"The label to resize and position.","name":"lbl","type":"Panel"},{"text":"The panel object to place to the right of the label.","name":"panelObj","type":"Panel"}]},"rets":{"ret":{"text":"The distance from the top of the parent panel to the bottom of the tallest object (the `y` position plus the height of the label or passed panel, depending on which is tallest).","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Prepare","parent":"Panel","type":"classfunc","description":{"text":"Installs Lua defined functions into the panel.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Queue","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/animation.lua","line":"84-L88"},"description":"Enables the queue for panel animations. If enabled, the next new animation will begin after all current animations have ended. This must be called before Panel:NewAnimation to work, and only applies to the next new animation. If you want to queue many, you must call this before each.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"RebuildSpawnIcon","parent":"Panel","type":"classfunc","description":"Causes a SpawnIcon to rebuild its model image.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"RebuildSpawnIconEx","parent":"Panel","type":"classfunc","description":{"text":"Re-renders a spawn icon with customized cam data.\n\nGlobal.PositionSpawnIcon can be used to easily calculate the necessary camera parameters.","note":"This function does **not** accept the standard Structures/CamData."},"realm":"Client","args":{"arg":{"text":"A four-membered table containing the information needed to re-render:\n* Vector cam_pos - The relative camera position the model is viewed from.\n* Angle cam_ang - The camera angle the model is viewed from.\n* number cam_fov - The camera's field of view (FOV).\n* Entity ent - The entity object of the model.\nSee the example below for how to retrieve these values.","name":"data","type":"table"}}},"example":{"description":"The `RenderIcon` method used by IconEditor. `SpawnIcon` is a SpawnIcon and `ModelPanel` is a DAdjustableModelPanel.","code":"function PANEL:RenderIcon()\n\t\n\tlocal ent = self.ModelPanel:GetEntity()\n\t\n\tlocal tab = {}\n\ttab.ent\t\t= ent\n\ttab.cam_pos = self.ModelPanel:GetCamPos()\n\ttab.cam_ang = self.ModelPanel:GetLookAng()\n\ttab.cam_fov = self.ModelPanel:GetFOV()\n\n\tself.SpawnIcon:RebuildSpawnIconEx( tab )\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Receiver","parent":"Panel","type":"classfunc","description":"Allows the panel to receive drag and drop events. Can be called multiple times with different names to receive multiple different draggable panel events.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"315-L324"},"args":{"arg":[{"text":"Name of DnD panels to receive. This is set on the drag'n'drop-able panels via  Panel:Droppable","name":"name","type":"string"},{"text":"This function is called whenever a panel with valid name is hovering above and dropped on this panel.","name":"func","type":"function","callback":{"arg":[{"text":"The receiver panel","type":"Panel","name":"pnl"},{"text":"A table of panels dropped onto receiver panel","type":"table","name":"tbl"},{"text":"False if hovering over, true if dropped onto","type":"boolean","name":"dropped"},{"text":"Index of clicked menu item from third argument of Panel:Receiver","type":"number","name":"menuIndex"},{"text":"Cursor pos, relative to the receiver","type":"number","name":"x"},{"text":"Cursor pos, relative to the receiver","type":"number","name":"y"}]}},{"text":"A table of strings that will act as a menu if drag'n'drop was performed with a right click","name":"menu","type":"table","default":"nil"}]}},"example":{"description":"A very simple drag'n'drop example without using DDragBase.","code":"local function DoDrop( self, panels, bDoDrop, Command, x, y )\n\tif ( bDoDrop ) then\n\t\tfor k, v in pairs( panels ) do\n\t\t\tself:AddItem( v )\n\t\tend\n\tend\nend\n\nconcommand.Add( \"test2\", function()\n\n\tlocal frame = vgui.Create( \"DFrame\" )\n\tframe:SetSize( 500, 300 )\n\tframe:SetTitle( \"Frame\" )\n\tframe:MakePopup()\n\tframe:Center()\n\n\tlocal left = vgui.Create( \"DScrollPanel\", frame )\n\tleft:Dock( LEFT )\n\tleft:SetWidth( frame:GetWide() / 2 - 7 )\n\tleft:SetPaintBackground( true )\n\tleft:DockMargin( 0, 0, 4, 0 )\n\tleft:Receiver( \"myDNDname\", DoDrop ) -- Make the panel a receiver for drag and drop events\n\n\tlocal right = vgui.Create( \"DScrollPanel\", frame )\n\tright:Dock( FILL )\n\tright:SetPaintBackground( true )\n\tright:Receiver( \"myDNDname\", DoDrop )\n\n\tfor i = 1, 30 do\n\t\tlocal but = vgui.Create( \"DButton\" )\n\t\tbut:SetText( i )\n\t\tbut:SetSize( 36, 24 )\n\t\tbut:Dock( TOP )\n\t\tbut:Droppable( \"myDNDname\" ) -- make the panel be able to be drag'n'dropped onto other panels\n\t\tright:AddItem( but )\n\tend\n\nend )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Refresh","parent":"Panel","type":"classfunc","description":"Refreshes the HTML panel's current page.","realm":"Client and Menu","args":{"arg":{"text":"If true, the refresh will ignore cached content similar to \"ctrl+f5\" in most browsers.","name":"ignoreCache","type":"boolean","default":"false"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Remove","parent":"Panel","type":"classfunc","description":"Marks a panel for deletion so it will be deleted on the next frame.\n\nThis will not mark child panels for deletion this frame, but they will be marked and deleted in the next frame.\n\nSee also Panel:IsMarkedForDeletion\n\nWill automatically call Panel:InvalidateParent.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"RequestFocus","parent":"Panel","type":"classfunc","description":"Attempts to obtain focus for this panel.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ResetAllFades","parent":"Panel","type":"classfunc","description":"Resets all text fades in a RichText element made with Panel:InsertFade.","realm":"Client and Menu","args":{"arg":[{"text":"True to reset fades, false otherwise.","name":"hold","type":"boolean"},{"text":"Any value equating to `true` will reset fades only on text segments that are completely faded out.","name":"expiredOnly","type":"boolean"},{"text":"The new sustain value of each faded text segment. Set to -1 to keep the old sustain value.","name":"newSustain","type":"number"}]}},"example":{"description":"Creates a RichText panel where two text segments slowly fade out and get reset to full alpha 5 seconds after being created.","code":"-- Window frame\nTextFrame = vgui.Create(\"DFrame\")\nTextFrame:SetSize(200, 100)\nTextFrame:Center()\nTextFrame:SetTitle(\"ResetAllFades\")\nTextFrame:MakePopup()\n\n-- Rich Text panel\nlocal richtext = vgui.Create(\"RichText\", TextFrame)\nrichtext:Dock(FILL)\n\n-- Append text and start fading a few frames after creation (won't work otherwise)\ntimer.Simple(0.05, function()\n\n\trichtext:SetBGColor(Color(32, 32, 32))\n\trichtext:SetFontInternal(\"GModNotify\")\n\n\trichtext:AppendText(\"This is \")\n\trichtext:InsertFade(5, 2)\n\t\n\trichtext:AppendText(\"a test...\")\n\trichtext:InsertFade(5, 1)\n\t\nend)\n\n-- 5 seconds after creation, reset all the fades\ntimer.Simple(5, function()\n\n\trichtext:ResetAllFades(true, false, -1)\n\nend)","output":{"image":{"src":"RichText_ResetAllFades_example1.gif"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"RunJavascript","parent":"Panel","type":"classfunc","realm":"Client and Menu","description":{"text":"Executes a string as JavaScript code on a web document panel.","note":["This function does **NOT** allow you to pass variables from JavaScript (JS) to Lua context.  \nIf you wish to pass/return values from JS to Lua, you may want to use DHTML:AddFunction function to accomplish that job.","The Awesomium web renderer automatically delays the code execution if the document is not ready, but the Chromium web renderer does not!\n\nThis means that with Chromium, you cannot JavaScript run code immediatly after calling Panel:SetHTML or Panel:OpenURL. You should wait for the events HTML:OnDocumentReady or HTML:OnFinishLoadingDocument to be triggered before proceeding, otherwise you may manipulate an empty / incomplete document."]},"args":{"arg":{"text":"Specify JavaScript code to be executed.","name":"js","type":"string"}}},"example":{"description":"Shows how to change [document.body.innerHTML](http://www.w3schools.com/jsref/prop_html_innerhtml.asp) property by calling this function on  panel.","code":"-- First we create a container, in this case it is a full-screen Derma Frame window.\nlocal dframe = vgui.Create( 'DFrame' )\ndframe:SetSize( ScrW(), ScrH() )\ndframe:SetTitle( \"Garry's Mod Wiki\" )\ndframe:Center()\ndframe:MakePopup() -- Enable keyboard and mouse interaction for DFrame panel.\n\n-- Create a new DHTML panel as a child of dframe, and dock-fill it.\nlocal dhtml = vgui.Create( 'DHTML', dframe )\ndhtml:Dock( FILL )\n\n-- Navigate to Garry's Mod wikipedia website.\ndhtml:OpenURL( 'https://wiki.facepunch.com/gmod/' )\n\n-- Wait for the document to load...\ndhtml.OnDocumentReady = function()\n\t-- Run JavaScript code.\n\tdhtml:RunJavascript( [[console.log(\"hello world\"); document.body.innerHTML = 'HTML changed from Lua using JavaScript!';]] )\nend\n\n-- This does not throw an error/exception, but instead returns nil/no value.\n-- That means you can't pass/return values from JavaScript back to Lua context using this function.\nlocal number = dhtml:Call( '22;' )\nprint( number )","output":"Inner HTML of document body in DHTML panel is now set to \"HTML changed from Lua using JavaScript!\"."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SaveUndoState","parent":"Panel","type":"classfunc","description":"Saves the current state (caret position and the text inside) of a TextEntry as an undo state.\n\nSee also Panel:Undo.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ScreenToLocal","parent":"Panel","type":"classfunc","description":{"text":"Translates global screen coordinate to coordinates relative to the panel.\n\nSee also Panel:LocalToScreen.","warning":"This function uses a cached value for the screen position of the panel, computed at the end of the last VGUI Think/Layout pass, so inaccurate results may be returned if the panel or any of its ancestors have been re-positioned outside of PANEL:Think or PANEL:PerformLayout within the last frame."},"realm":"Client and Menu","args":{"arg":[{"text":"The x coordinate of the screen position to be translated.","name":"screenX","type":"number"},{"text":"The y coordinate of the screed position be to translated.","name":"screenY","type":"number"}]},"rets":{"ret":[{"text":"Relativeposition X","name":"","type":"number"},{"text":"Relativeposition Y","name":"","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SelectAll","parent":"Panel","type":"classfunc","description":{"text":"Selects all items within a panel or object. For text-based objects, selects all text.","note":"Only works on RichText and TextEntry and their derived panels by default (such as DTextEntry), and on any panel that manually reimplemented this method."},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SelectAllOnFocus","parent":"Panel","type":"classfunc","description":"If called on a TextEntry, clicking the text entry for the first time will automatically select all of the text ready to be copied by the user.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SelectAllText","parent":"Panel","type":"classfunc","description":{"text":"Selects all the text in a panel object. Will not select non-text items; for this, use Panel:SelectAll.","deprecated":"Duplicate of Panel:SelectAll."},"realm":"Client and Menu","args":{"arg":{"text":"Reset cursor pos?","name":"resetCursorPos","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SelectNone","parent":"Panel","type":"classfunc","description":{"text":"Deselects all items in a panel object. For text-based objects, this will deselect all text.","note":"Only works on RichText and TextEntry and their derived panels by default (such as DTextEntry), and on any panel that manually reimplemented this method."},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetAchievement","parent":"Panel","type":"classfunc","description":"Sets the achievement to be displayed by AchievementIcon.","realm":"Client and Menu","args":{"arg":{"text":"Achievement number ID","name":"id","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetAllowNonAsciiCharacters","parent":"Panel","type":"classfunc","description":"Configures a TextEntry to allow user to type characters that are not included in the US-ASCII (7-bit ASCII) character set.\n\nCharacters not included in US-ASCII are multi-byte characters in UTF-8. They can be accented characters, non-Latin characters and special characters.","realm":"Client and Menu","args":{"arg":{"text":"Set to true in order not to restrict input characters.","name":"allowed","type":"boolean"}}},"example":{"description":"Replaces the default vgui.Create() function to always allow non US-ASCII characters for text inputs.","code":"if vgui.CreateStdRestrict == nil then\n\tvgui.CreateStdRestrict = vgui.Create\nend\nfunction vgui.Create( classname, parent, name )\n\tlocal vgui_elt = vgui.CreateStdRestrict(classname, parent, name)\n\tif classname == \"DTextEntry\" or classname == \"RichText\" or classname == \"TextEntry\" then\n\t\tvgui_elt:SetAllowNonAsciiCharacters(true)\n\tend\n\treturn vgui_elt\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetAlpha","parent":"Panel","type":"classfunc","description":"Sets the alpha multiplier for the panel","realm":"Client and Menu","args":{"arg":{"text":"The alpha value in the range of 0-255.","name":"alpha","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetAnimationEnabled","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/animation.lua","line":"65-L76"},"description":"Enables or disables animations for the panel object by overriding the PANEL:AnimationThink hook to nil and back.","realm":"Client and Menu","args":{"arg":{"text":"Whether to enable or disable animations.","name":"enable","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetAutoDelete","parent":"Panel","type":"classfunc","description":"Sets whenever the panel should be removed if the parent was removed.","realm":"Client and Menu","args":{"arg":{"text":"Whenever to delete if the parent was removed or not.","name":"autoDelete","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetBGColor","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"32-L40"},"description":{"text":"Sets the background color of a panel such as a RichText, Label, DColorCube or the base Panel.\n\nFor many panels, such as DLabel and Panel, you must use Panel:SetPaintBackgroundEnabled( true ) for the background to appear.\n\nPlease note that for most panels the engine will overwrite the foreground and background colors a frame after panel creation via the PANEL:ApplySchemeSettings hook, so you may want to set the color in that hook instead.\n\nSee Panel:SetFGColor for the foreground color.","note":"This doesn't apply to all VGUI elements and its function varies between them"},"realm":"Client and Menu","args":[{"arg":[{"text":"The red channel of the color.","name":"r","type":"number"},{"text":"The green channel of the color.","name":"g","type":"number"},{"text":"The blue channel of the color.","name":"b","type":"number"},{"text":"The alpha channel of the color.","name":"a","type":"number"}]},{"name":"Use color object","arg":{"text":"A Color object/table to read the color from. This is slower than providing four numbers. You could use Color:Unpack to address this. You should also cache your color objects if you wish to use them, for performance reasons.","name":"color","type":"Color"}}]},"example":{"description":"Creates a RichText panel that mimics a [blue screen of death](http://en.wikipedia.org/wiki/Blue_Screen_of_Death).","code":"-- Create a window frame\nTextFrame = vgui.Create(\"DFrame\")\nTextFrame:SetSize(300, 100)\nTextFrame:Center()\nTextFrame:SetTitle(\"Windows XP Blue Screen\")\nTextFrame:MakePopup()\n\n-- RichText panel\nlocal richtext = vgui.Create(\"RichText\", TextFrame)\nrichtext:Dock(FILL)\n\n-- Sample text\nrichtext:SetText(\"A problem has been detected and Windows has been shut down to prevent damage to your computer.\\n\\nMOTHERBOARD_FRIED\")\n\n-- When the panel is ready for layout, set the background color to blue\nfunction richtext:PerformLayout()\n\t\n\tself:SetBGColor(Color(0, 0, 255))\n\t\nend","output":{"image":{"src":"RichText_SetBGColor_example1.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetBGColorEx","parent":"Panel","type":"classfunc","description":{"text":"Sets the background color of the panel.","internal":""},"realm":"Client and Menu","args":{"arg":[{"text":"The red channel of the color.","name":"r","type":"number"},{"text":"The green channel of the color.","name":"g","type":"number"},{"text":"The blue channel of the color.","name":"b","type":"number"},{"text":"The alpha channel of the color.","name":"a","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetCaretPos","parent":"Panel","type":"classfunc","description":"Sets the position of the caret (or text cursor) in a text-based panel object.","realm":"Client and Menu","args":{"arg":{"text":"Caret position/offset from the start of text. A value of `0` places the caret before the first character.","name":"offset","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetContentAlignment","parent":"Panel","type":"classfunc","description":{"text":"Sets the alignment of the contents.","note":["This function only works on Label panels and its derivatives.","This function doesnt work, if Panel:SetWrap is true."]},"realm":"Client and Menu","args":{"arg":{"text":"The direction of the content, based on the number pad.\n\n: **bottom-left** \n\n: **bottom-center** \n\n: **bottom-right** \n\n: **middle-left** \n\n: **center** \n\n: **middle-right** \n\n: **top-left** \n\n: **top-center** \n\n: **top-right**","name":"alignment","type":"number","key":["1","2","3","4","5","6","7","8","9"],"image":{"src":"DLabel_SetContentAlignment.gif"}}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetConVar","parent":"Panel","type":"classfunc","description":{"text":"Sets this panel's convar. When the convar changes this panel will update automatically.\n\nFor developer implementation, see Global.Derma_Install_Convar_Functions.","warning":["This function does not exist on all panels","This function cannot interact with serverside convars unless you are host"],"note":"Blocked convars will not work with this, see Blocked ConCommands"},"realm":"Client and Menu","args":{"arg":{"text":"The console variable to check.","name":"convar","type":"string"}}},"example":{"description":"Makes a checkbox linked to the **cl_drawhud** convar.","code":"local DermaPanel = vgui.Create( \"DFrame\" )\nDermaPanel:SetPos( 100, 100 )\nDermaPanel:SetSize( 300, 200 )\nDermaPanel:SetTitle( \"My new Derma frame\" )\nDermaPanel:SetDraggable( true )\nDermaPanel:MakePopup()\n\nlocal Checkbox = vgui.Create( \"DCheckBoxLabel\", DermaPanel )\nCheckbox:SetConVar( \"cl_drawhud\" )\nCheckbox:SetText( \"Enable HUD?\" )\nCheckbox:SetPos( 5, 25 )\nCheckbox:SizeToContents()","output":{"image":{"src":"panel_setcvar.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetCookie","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"226-L233"},"description":{"text":"Stores a string in the named cookie using Panel:GetCookieName as prefix.\n\nYou can also retrieve and modify this cookie by using the cookie. Cookies are stored in this format:\n\n```\npanelCookieName.cookieName\n```","warning":"The panel's cookie name MUST be set for this function to work. See Panel:SetCookieName."},"realm":"Client and Menu","args":{"arg":[{"text":"The unique name used to retrieve the cookie later.","name":"cookieName","type":"string"},{"text":"The value to store in the cookie. This can be retrieved later as a string or number.","name":"value","type":"string"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetCookieName","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"187-L197"},"description":"Sets the panel's cookie name. Calls PANEL:LoadCookies if defined.","realm":"Client and Menu","args":{"arg":{"text":"The panel's cookie name. Used as prefix for Panel:SetCookie, therefore should be a unique value.","name":"name","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetCursor","parent":"Panel","type":"classfunc","description":"Sets the appearance of the cursor. You can find a list of all available cursors with image previews [here](https://wiki.facepunch.com/gmod/Cursors).","realm":"Client and Menu","args":{"arg":{"text":"The cursor to be set. Can be one of the following:\n\n* [arrow](https://wiki.facepunch.com/gmod/Cursors#:~:text=arrow)\n* [beam](https://wiki.facepunch.com/gmod/Cursors#:~:text=beam)\n* [hourglass](https://wiki.facepunch.com/gmod/Cursors#:~:text=hourglass)\n* [waitarrow](https://wiki.facepunch.com/gmod/Cursors#:~:text=waitarrow)\n* [crosshair](https://wiki.facepunch.com/gmod/Cursors#:~:text=crosshair)\n* [up](https://wiki.facepunch.com/gmod/Cursors#:~:text=up)\n* [sizenwse](https://wiki.facepunch.com/gmod/Cursors#:~:text=sizenwse)\n* [sizenesw](https://wiki.facepunch.com/gmod/Cursors#:~:text=sizenesw)\n* [sizewe](https://wiki.facepunch.com/gmod/Cursors#:~:text=sizewe)\n* [sizens](https://wiki.facepunch.com/gmod/Cursors#:~:text=sizens)\n* [sizeall](https://wiki.facepunch.com/gmod/Cursors#:~:text=sizeall)\n* [no](https://wiki.facepunch.com/gmod/Cursors#:~:text=no)\n* [hand](https://wiki.facepunch.com/gmod/Cursors#:~:text=hand)\n* [blank](https://wiki.facepunch.com/gmod/Cursors#:~:text=blank)\n\nSet to anything else to set it to \"none\", the default fallback. Do note that a value of \"none\" does not, as one might assume, result in no cursor being drawn - hiding the cursor requires a value of \"blank\" instead.","name":"cursor","type":"string"}}},"example":{"code":"function draw.CustomCursor(panel, material)\n\t-- Paint the custom cursor\n\tlocal cursorX, cursorY = panel:LocalCursorPos()\n\n\tsurface.SetDrawColor(255, 255, 255, 240)\n\tsurface.SetMaterial(material)\n\tsurface.DrawTexturedRect(cursorX, cursorY, 20, 20)\nend\n\nlocal myPanel = vgui.Create(\"DFrame\")\nmyPanel:SetCursor(\"blank\") -- Make the default cursor disappear\n\nlocal customCursorMaterial = Material(\"vgui/your_cursor\")\nmyPanel.Paint = function(s, w, h)\n\tdraw.CustomCursor(s, customCursorMaterial)\nend"},"upload":{"src":"5598e/8d7dfba5b02b2c7.png","size":"5451","name":"cursor.png"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDragParent","parent":"Panel","type":"classfunc","description":"Sets the drag parent.\n\nDrag parent means that when we start to drag this panel, we'll really start dragging the defined parent.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"331-L333"},"args":{"arg":{"text":"The panel to set as drag parent.","name":"parent","type":"Panel"}}},"example":{"code":"local function DoDrop( self, panels, bDoDrop, Command, x, y )\n\tif ( bDoDrop ) then\n\t\tfor _, v in ipairs( panels ) do\n\t\t\tself:AddItem( v )\n\t\tend\n\tend\nend\n\nconcommand.Add( \"test2\", function()\n\tlocal frame = vgui.Create( \"DFrame\" )\n\tframe:SetSize( 500, 300 )\n\tframe:SetTitle( \"Frame\" )\n\tframe:MakePopup()\n\tframe:Center()\n\n\tlocal left = vgui.Create( \"DScrollPanel\", frame )\n\tleft:Dock( LEFT )\n\tleft:SetWidth( frame:GetWide() / 2 - 7 )\n\tleft:SetPaintBackground( true )\n\tleft:DockMargin( 0, 0, 4, 0 )\n\tleft:Receiver( \"myDNDname\", DoDrop ) -- Make the panel a receiver for drag and drop events\n\n\tlocal right = vgui.Create( \"DScrollPanel\", frame )\n\tright:Dock( FILL )\n\tright:SetPaintBackground( true )\n\tright:Receiver( \"myDNDname\", DoDrop )\n\n\tfor i = 1, 30 do\n\t\tlocal but = vgui.Create( \"DButton\" )\n\t\tbut:SetText( \"button text \" .. i )\n\t\tbut:SetSize( 36, 24 )\n\t\tbut:Dock( TOP )\n\t\tbut:Droppable( \"myDNDname\" ) -- make the panel be able to be drag'n'dropped onto other panels\n\t\tright:AddItem( but )\n\t\t\n\t\tlocal mdl = vgui.Create( \"DModelPanel\", but ) -- Put another panel over the draggable button\n\t\tmdl:Dock( FILL )\n\t\tmdl:SetModel( \"models/alyx.mdl\" )\n\t\tmdl:SetDragParent( but ) -- The magic bit. Without it, you would not be able to drag the button at all\n\tend\nend )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDrawLanguageID","parent":"Panel","type":"classfunc","description":"Sets the visibility of the language selection box when typing in non-English mode.\n\n\t\tSee Panel:SetDrawLanguageIDAtLeft for a function that changes the position of the language selection box.","realm":"Client and Menu","args":{"arg":{"text":"true to make it visible, false to hide it.","name":"visible","type":"boolean"}},"example":{"code":"local TextEntry = vgui.Create( \"DTextEntry\" )\n\t\t\tTextEntry:SetDrawLanguageID(false)","output":"Hides language selection box."}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDrawLanguageIDAtLeft","parent":"Panel","type":"classfunc","description":"Sets where to draw the language selection box.\n\nSee Panel:SetDrawLanguageID for a function that hides or shows the language selection box.","realm":"Client and Menu","args":{"arg":{"text":"true = left, false = right","name":"left","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDrawOnTop","parent":"Panel","type":"classfunc","description":{"text":"Makes the panel render in front of all others, including the spawn menu and main menu.\n\nPriority is given based on the last call, so of two panels that call this method, the second will draw in front of the first.","note":"This only makes the panel **draw** above other panels. If there's another panel that would have otherwise covered it, users will not be able to interact with it.\n\nCompletely disregards PANEL:ParentToHUD.","warning":"This does not work when using PANEL:SetPaintedManually or PANEL:PaintAt."},"realm":"Client and Menu","args":{"arg":{"text":"Whether or not to draw the panel in front of all others.","name":"drawOnTop","type":"boolean","default":"false"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDropTarget","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"468-L485"},"description":"Sets the target area for dropping when an object is being dragged around this panel using the dragndrop. \n\nThis draws a target box of the specified size and position, until Panel:DragHoverEnd is called. It uses Panel:DrawDragHover to draw this area.","realm":"Client and Menu","args":{"arg":[{"text":"The x coordinate of the top-left corner of the drop area.","name":"x","type":"number"},{"text":"The y coordinate of the top-left corner of the drop area.","name":"y","type":"number"},{"text":"The width of the drop area.","name":"width","type":"number"},{"text":"The height of the drop area.","name":"height","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetEnabled","parent":"Panel","type":"classfunc","description":"Sets the enabled state of a panel object that supports being disabled, such as a DButton or DTextEntry.\n\nDisabled panels cannot be interacted with, and have a different appearance to indicate this.\n\nSee Panel:IsEnabled for a function that retrieves the \"enabled\" state of a panel.","realm":"Client and Menu","args":{"arg":{"text":"Whether to enable or disable the panel object.","name":"enable","type":"boolean"}}},"example":{"description":"Crates a panel that is enabled and a panel that is disabled.","code":"local frame = vgui.Create( \"DFrame\" )\nframe:SetSize( 300, 250 )\nframe:Center()\nframe:MakePopup()\n\nlocal DermaButton = vgui.Create( \"DButton\", frame )\nDermaButton:SetText( \"Say hi\" )\nDermaButton:SetPos( 25, 50 )\nDermaButton:SetSize( 250, 30 )\nDermaButton.DoClick = function()\n\tRunConsoleCommand( \"say\", \"Hi\" )\nend\n\n-- This panel is disabled, so the button won't be clickable\nlocal DisabledButton = vgui.Create( \"DButton\", frame )\nDisabledButton:SetText( \"Can't touch me\" )\nDisabledButton:SetEnabled( false )\nDisabledButton:SetPos( 25, 100 )\nDisabledButton:SetSize( 250, 30 )\nDisabledButton.DoClick = function()\n\tRunConsoleCommand( \"say\", \"This will never show up\" )\nend","output":{"upload":{"src":"70c/8de3d8855c1c53d.png","size":"5405","name":"image.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetExpensiveShadow","parent":"Panel","type":"classfunc","description":{"text":"Adds a shadow falling to the bottom right corner of the panel's text.","note":"This works only on  panels that derive from Label."},"realm":"Client and Menu","args":{"arg":[{"text":"The distance of the shadow from the panel.","name":"distance","type":"number"},{"text":"The color of the shadow. Uses Color.","name":"Color","type":"Color"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetFGColor","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"18-L26"},"description":{"text":"Sets the foreground color of a panel.\n\nFor a Label or RichText, this is the color of its text.\n\nThis function calls Panel:SetFGColorEx internally. \n\nPlease note that for most panels the engine will overwrite the foreground and background colors a frame after panel creation via the PANEL:ApplySchemeSettings hook, so you may want to set the color in that hook instead.\n\nSee Panel:SetBGColor for the background color.","note":"This doesn't apply to all VGUI elements (such as DLabel) and its function varies between them"},"realm":"Client and Menu","args":[{"arg":[{"text":"The red channel of the color.","name":"r","type":"number"},{"text":"The green channel of the color.","name":"g","type":"number"},{"text":"The blue channel of the color.","name":"b","type":"number"},{"text":"The alpha channel of the color.","name":"a","type":"number"}]},{"name":"Use color object","arg":{"text":"A Color object/table to read the color from. This is slower than providing four numbers. You could use Color:Unpack to address this. You should also cache your color objects if you wish to use them, for performance reasons.","name":"color","type":"Color"}}]},"example":[{"description":"Creates a Label and sets its text color to white.","code":"local label = vgui.Create( \"Label\" )\n\nlabel:SetFGColor( Color( 255, 255, 255, 255 ) )"},{"description":"Sets the foreground color of a RichText to match the chat box format.","code":"-- Create a window frame\nTextFrame = vgui.Create(\"DFrame\")\nTextFrame:SetSize(200, 50)\nTextFrame:Center()\nTextFrame:SetTitle(\"This is a color test\")\nTextFrame:MakePopup()\n\n-- RichText panel\nlocal richtext = vgui.Create(\"RichText\", TextFrame)\nrichtext:Dock(FILL)\n\n-- Sample text\nrichtext:SetText(\"Here is some light green text.\")\n\n-- When the panel is ready for layout, make the text light green\nfunction richtext:PerformLayout()\n\tself:SetFGColor(Color(153, 255, 153))\nend","output":{"image":{"src":"RichText_SetFGColor_example1.png"}}}],"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetFGColorEx","parent":"Panel","type":"classfunc","description":{"text":"Sets the foreground color of the panel.\n\nFor labels, this is the color of their text.","internal":""},"realm":"Client and Menu","args":{"arg":[{"text":"The red channel of the color.","name":"r","type":"number"},{"text":"The green channel of the color.","name":"g","type":"number"},{"text":"The blue channel of the color.","name":"b","type":"number"},{"text":"The alpha channel of the color.","name":"a","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetFocusTopLevel","parent":"Panel","type":"classfunc","description":{"text":"Sets the panel that owns this FocusNavGroup to be the root in the focus traversal hierarchy. This function will only work on EditablePanel class panels and its derivatives.","note":"Child panels that should be part of the tab navigation need Panel:SetTabPosition called on them."},"realm":"Client and Menu","args":{"arg":{"name":"state","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetFontInternal","parent":"Panel","type":"classfunc","description":"Sets the font used to render this panel's text. This works for Label, TextEntry and RichText, but it's a better idea to use their local `SetFont` (DTextEntry:SetFont, DLabel:SetFont) methods when available.\n\nTo retrieve the font used by a panel, call Panel:GetFont.","realm":"Client and Menu","args":{"arg":{"text":"The name of the font.\n\nSee here for a list of existing fonts.\nAlternatively, use surface.CreateFont to create your own custom font.","name":"fontName","type":"string"}}},"example":{"description":"Sets the font of a RichText element to match the chat box font.","code":"-- Create a window frame\nlocal TextFrame = vgui.Create( \"DFrame\" )\nTextFrame:SetSize( 300, 200 )\nTextFrame:Center()\nTextFrame:SetTitle( \"This is a font test\" )\nTextFrame:MakePopup()\n\n-- RichText panel\nlocal richtext = vgui.Create( \"RichText\", TextFrame )\nrichtext:Dock( FILL )\n\n-- Sample text\nrichtext:SetText( \"This is a sample of text using the chat box font.\" )\n\n-- Ensure font and text color changes are applied\n-- We have to wait until after the internals of RichText set the default font\nfunction richtext:PerformLayout()\n\n\tif ( self:GetFont() != \"ChatFont\" ) then self:SetFontInternal( \"ChatFont\" ) end\n\tself:SetFGColor( color_white )\n\t\nend","output":{"image":{"src":"RichText_SetFontInternal_example1.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetHeight","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"45-L47"},"description":"Sets the height of the panel.\n\nCalls PANEL:OnSizeChanged and marks this panel for layout (Panel:InvalidateLayout).\nAutomatically rounds the height down\n\nSee also Panel:SetSize.","realm":"Client and Menu","args":{"arg":{"text":"The height to be set.","name":"height","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetHTML","parent":"Panel","type":"classfunc","description":"Allows you to set HTML code within a panel.","realm":"Client and Menu","args":{"arg":{"text":"The HTML code to set.","name":"HTML","type":"string"}}},"example":{"code":{"text":"local HTML = vgui.Create( \"HTML\", DPanel )\nHTML:SetHTML( \"\" )\nHTML:SetSize( 390, 400 )","p":"Put HTML code here"}},"realms":["Client","Menu"],"type":"Function"},
{"ambig":{"text":"You might be looking for Panel:SetKeyboardInputEnabled (lowercase `board`), which has the same name but isn't deprecated.","page":"Panel:SetKeyboardInputEnabled(lowercase)"},"function":{"name":"SetKeyBoardInputEnabled","parent":"Panel","type":"classfunc","description":{"text":"Enables or disables the keyboard input for the panel.","deprecated":"Alias of Panel:SetKeyboardInputEnabled"},"realm":"Client and Menu","args":{"arg":{"text":"Whether to enable or disable keyboard input.","name":"keyboardInput","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetLineHeight","parent":"Panel","type":"classfunc","description":"Sets the height of a single line of a RichText panel.","realm":"Client and Menu","added":"2023.10.25","rets":{"ret":{"text":"The new line height. Values below zero mean no override.","name":"height","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMaximumCharCount","parent":"Panel","type":"classfunc","description":"Sets the maximum character count this panel should have.\n\nThis function will only work on RichText and TextEntry panels and their derivatives.","realm":"Client and Menu","added":"2020.03.17","args":{"arg":{"text":"The new maximum amount of characters this panel is allowed to contain.","name":"maxChar","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMinimumSize","parent":"Panel","type":"classfunc","description":"Sets the minimum dimensions of the panel or object.\n\nYou can restrict either or both values.\n\nCalling the function without arguments will remove the minimum size.","realm":"Client and Menu","args":{"arg":[{"text":"The minimum width of the object.","name":"minW","type":"number","default":"nil"},{"text":"The minimum height of the object.","name":"minH","type":"number","default":"nil"}]}},"example":{"description":"Restricting height but not width","code":"local frame = vgui.Create( \"DFrame\" )\nframe:SetSize( 800, 600 )\nframe:SetSizable( true )\nframe:SetMinimumSize( nil, 300 )\nframe:MakePopup()"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetModel","parent":"Panel","type":"classfunc","description":{"text":"Sets the model to be displayed by SpawnIcon.","note":"This must be called after setting size if you wish to use a different size spawnicon"},"realm":"Client","args":{"arg":[{"text":"The path of the model to set","name":"ModelPath","type":"string"},{"text":"The skin to set","name":"skin","type":"number","default":"0"},{"text":"The body groups to set. Each single-digit number in the string represents a separate bodygroup, **This argument must be 9 characters in total**.","name":"bodygroups","type":"string","default":"nil"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetMouseInputEnabled","parent":"Panel","type":"classfunc","description":{"text":"Enables or disables the mouse input for the panel.","note":"Panels parented to the context menu will not be clickable unless Panel:SetKeyboardInputEnabled is enabled or Panel:MakePopup has been called. If you want the panel to have mouse input but you do not want to prevent players from moving, set Panel:SetKeyboardInputEnabled to false immediately after calling Panel:MakePopup."},"realm":"Client and Menu","args":{"arg":{"text":"Whenever to enable or disable mouse input.","name":"mouseInput","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMultiline","parent":"Panel","type":"classfunc","description":"Enables or disables the multi-line functionality of TextEntry panel and its derivatives.","realm":"Client and Menu","args":{"arg":{"text":"Whether to enable multiline or not.","name":"multiline","type":"boolean"}}},"example":{"description":"\n\t","code":"concommand.Add( \"test_textentry\", function(ply)\n\tlocal frame = vgui.Create( \"DFrame\" )\n\tframe:SetSize( 400, 200 )\n\tframe:Center()\n\tframe:MakePopup()\n\n\tlocal TextEntry = vgui.Create( \"DTextEntry\", frame ) -- create the form as a child of frame\n\tTextEntry:Dock( FILL )\n\tTextEntry:SetMultiline( true )\n\tTextEntry.OnChange = function( self )\n\t\tchat.AddText( self:GetValue() )\t-- print the textentry text as a chat message\n\tend\n\nend )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetName","parent":"Panel","type":"classfunc","description":"Sets the internal name of the panel. Can be retrieved with Panel:GetName.","realm":"Client and Menu","args":{"arg":{"text":"The new name of the panel.","name":"name","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetOpenLinksExternally","parent":"Panel","type":"classfunc","description":"Set to true to open links in an external browser. This only functions on the `x86-64` beta.","realm":"Menu","args":{"arg":{"name":"openExternally","type":"boolean"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"SetPaintBackgroundEnabled","parent":"Panel","type":"classfunc","description":"Sets whether the default background of the panel should be drawn or not. It's color is usually set by Panel:SetBGColor.","realm":"Client and Menu","args":{"arg":{"text":"Whether to draw the background or not.","name":"paintBackground","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetPaintBorderEnabled","parent":"Panel","type":"classfunc","description":"Sets whether the default border of the panel should be drawn or not.","realm":"Client and Menu","args":{"arg":{"text":"Whether to draw the border or not.","name":"paintBorder","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetPaintedManually","parent":"Panel","type":"classfunc","description":"Enables or disables painting of the panel manually with Panel:PaintManual.","realm":"Client and Menu","args":{"arg":{"text":"True if the panel should be painted manually.","name":"paintedManually","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetParent","parent":"Panel","type":"classfunc","description":{"text":"Sets the parent of the panel.","note":"Panels parented to the context menu will not be clickable unless Panel:SetMouseInputEnabled and Panel:SetKeyboardInputEnabled are both true or Panel:MakePopup has been called. If you want the panel to have mouse input but you do not want to prevent players from moving, set Panel:SetKeyboardInputEnabled to false immediately after calling Panel:MakePopup."},"realm":"Client and Menu","args":{"arg":{"text":"The new parent of the panel.","name":"parent","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetPlayer","parent":"Panel","type":"classfunc","description":"Used by AvatarImage to load an avatar for given player.","realm":"Client","args":{"arg":[{"text":"The player to use avatar of.","name":"player","type":"Player"},{"text":"The size of the avatar to use. Acceptable sizes are `32`, `64`, `184`. Non matching sizes will be clamped down to the highest valid number.","name":"size","type":"number","default":"32"}]}},"example":{"description":"Creates an AvatarImage with the LocalPlayer's avatar inside.","code":"concommand.Add( \"testavatar\", function()\n\n\tlocal Panel = vgui.Create( \"DFrame\" )\n\tPanel:SetPos( 200, 200 )\n\tPanel:SetSize( 500, 500 )\n\tPanel:SetTitle( \"Avatar Test\" )\n\tPanel:MakePopup()\n\n\tlocal Avatar = vgui.Create( \"AvatarImage\", Panel )\n\tAvatar:SetSize( 64, 64 )\n\tAvatar:SetPos( 4, 30 )\n\tAvatar:SetPlayer( LocalPlayer(), 64 )\n\n\t-- After a second reset the avatar to no player\n\ttimer.Simple( 1, function() Avatar:SetPlayer( NULL, 64 ) end )\n\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetPopupStayAtBack","parent":"Panel","type":"classfunc","description":"If this panel object has been made a popup with Panel:MakePopup, this method will prevent it from drawing in front of other panels when it receives input focus.","realm":"Client and Menu","args":{"arg":{"text":"If `true`, the popup panel will not draw in front of others when it gets focus, for example when it is clicked.","name":"stayAtBack","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetPos","parent":"Panel","type":"classfunc","description":{"text":"Sets the position of the panel's top left corner.\n\nThis will trigger PANEL:PerformLayout. You should avoid calling this function in PANEL:PerformLayout to avoid infinite loops.\n\nSee also Panel:SetX and Panel:SetY.","note":"If you wish to position and re-size panels without much guesswork and have them look good on different screen resolutions, you may find Panel:Dock useful"},"realm":"Client and Menu","args":{"arg":[{"text":"The x coordinate of the position.","name":"posX","type":"number"},{"text":"The y coordinate of the position.","name":"posY","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetRenderInScreenshots","parent":"Panel","type":"classfunc","description":"Sets whenever the panel should be rendered in a screenshot. (`jpeg` or `screenshot` commands, Camera SWEP)","realm":"Client and Menu","args":{"arg":{"text":"Whether to render in the screenshot or not.","name":"renderInScreenshot","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSelectable","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/selections.lua","line":"23-L27"},"description":{"text":"Sets whether the panel object can be selected or not (like icons in the Spawn Menu, holding ). If enabled, this will affect the function of a DButton whilst  is pressed. Panel:SetSelected can be used to select/deselect the object.","key":["Shift","Shift"]},"realm":"Client and Menu","args":{"arg":{"text":"Whether the panel object should be selectable or not.","name":"selectable","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSelected","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/selections.lua","line":"47-L57"},"description":"Sets the selected state of a selectable panel object. This functionality is set with Panel:SetSelectable and checked with Panel:IsSelectable.","realm":"Client and Menu","args":{"arg":{"text":"Whether the object should be selected or deselected. Panel:IsSelected can be used to determine the selected state of the object.","name":"selected","type":"boolean","default":"false"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSelectionCanvas","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/selections.lua","line":"10-L15"},"description":"Enables the panel object for selection (much like the spawn menu).","realm":"Client and Menu","args":{"arg":{"text":"Whether to enable selection.","name":"set","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSize","parent":"Panel","type":"classfunc","description":{"text":"Sets the size of the panel.\n\nCalls PANEL:OnSizeChanged and marks this panel for layout (Panel:InvalidateLayout).\nAutomatically rounds the width and height down\n\n\nSee also Panel:SetWidth and Panel:SetHeight.","note":"If you wish to position and re-size panels without much guesswork and have them look good on different screen resolutions, you may find Panel:Dock useful"},"realm":"Client and Menu","args":{"arg":[{"text":"The width of the panel.","name":"width","type":"number"},{"text":"The height of the panel.","name":"height","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSkin","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"364-L373"},"description":"Sets the derma skin that the panel object will use, and refreshes all panels with derma.RefreshSkins.","realm":"Client and Menu","args":{"arg":{"text":"The name of the skin to use. The default derma skin is `Default`.","name":"skinName","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSpawnIcon","parent":"Panel","type":"classfunc","description":"Sets the `.png` image to be displayed on a  SpawnIcon or the panel it is based on - ModelImage.\n\nOnly `.png` images can be used with this function.","realm":"Client","args":{"arg":{"text":"A path to the .png material, for example one of the Silkicons shipped with the game.","name":"icon","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetSteamID","parent":"Panel","type":"classfunc","description":"Used by AvatarImage panels to load an avatar by its 64-bit Steam ID (community ID).","realm":"Client","args":{"arg":[{"text":"The 64bit SteamID of the player to load avatar of","name":"steamid","type":"string"},{"text":"The size of the avatar to use. Acceptable sizes are 32, 64, 184.","name":"size","type":"number"}]}},"example":{"description":"Creates a grid of randomly generated Steam avatars which link to their corresponding Steam user pages.","code":"-- Returns a random 64-bit Steam ID between STEAM_0:0:1 and STEAM_0:1:100000000\nfunction GetRandomSteamID()\n\treturn \"7656119\"..tostring(7960265728+math.random(1, 200000000))\nend\n\n-- Create the Steam User Grid\n-- Arg1: the size of each avatar\n-- Arg2: the size to load each avatar (16, 32, 64, 84, 128, 184)\nfunction CreateSteamUserGrid(av_size, av_res)\n\n\t-- Remove this block of code if you do not mind loading thousands of avatars\n\tif(av_size < 64) then\n\t\tError(\"Avatar size cannot be less than 64 square pixels.\\n\")\n\t\treturn\n\tend\n\t\n\t-- Delete existing grid\n\tif(SteamUserGrid) then SteamUserGrid:Remove() end\n\t\n\t-- The amount of avatars we can fit width-wise and height-wise\n\tlocal w_count = math.floor(ScrW()/av_size)\n\tlocal h_count = math.floor((ScrH()-25)/av_size)\t-- 25 = frame header size\n\t\t\n\t-- Container panel\n\tSteamUserGrid = vgui.Create(\"DFrame\")\n\tSteamUserGrid:SetSize(w_count*av_size, (h_count*av_size)+25)\n\tSteamUserGrid:Center()\n\tSteamUserGrid:SetTitle(\"Randomly Generated Grid of Steam Users\")\n\tSteamUserGrid:MakePopup()\n\t\n\t-- Loop variables\n\tlocal avatar, random_id\n\t\n\t-- Create enough avatars to fill up screen without overflowing\n\tfor i = 0, (w_count*h_count)-1 do\n\t\n\t\trandom_id = GetRandomSteamID()\n\t\t\n\t\t-- Add avatar to container panel\n\t\tavatar = vgui.Create(\"AvatarImage\", SteamUserGrid)\n\t\t\n\t\t-- Layout the avatars in a grid\n\t\tavatar:SetPos((i%w_count)*av_size, 25+math.floor(i/w_count)*av_size)\n\t\t\n\t\t-- Load the avatar image\n\t\tavatar:SetSteamID(random_id, av_res)\n\n\t\tavatar:SetSize(av_size, av_size)\n\n\t\tavatar.id = random_id\n\t\t\n\t\t-- Open user's Steam page on avatar click\n\t\tavatar.OnMousePressed = function(self)\n\t\t\t\n\t\t\tlocal url = \"http://steamcommunity.com/profiles/\" .. self.id\n\t\t\t\n\t\t\tgui.OpenURL(url)\n\t\t\t\n\t\tend\n\t\t\n\tend\n\t\nend","output":{"text":"`CreateSteamUserGrid(64, 64)`\n\n\n\n\n\n\n\n\n\nThe white question mark avatars mean no custom icon used or the user hasn't set up a community profile. The blue question mark avatars mean the user doesn't exist.","image":{"src":"AvatarImage_SetSteamID_example1.png"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetTabPosition","parent":"Panel","type":"classfunc","description":{"text":"When TAB is pressed, the next selectable panel in the number sequence is selected.","note":"This function requires Panel:SetFocusTopLevel to be called on the parent panel for tab navigation to work."},"realm":"Client and Menu","args":{"arg":{"name":"position","type":"number"}}},"example":{"description":"Creates a menu to put information in with SetTablePosition application.","code":"local Panel = vgui.Create(\"DFrame\")\nPanel:SetSize(500,250)\nPanel:Center()\nPanel:SetText(\"My Information\")\nPanel:MakePopup()\n\nlocal FirstName = vgui.Create(\"DTextEntry\", Panel)\nFirstName:SetSize(400,35)\nFirstName:SetPos(50, 50)\nFirstName:SetPlaceholderText(\"First Name\")\nFirstName:SetTabPosition( 1 )\n\nlocal LastName = vgui.Create(\"DTextEntry\", Panel)\nLastName:SetSize(400,35)\nLastName:SetPos(50, 100)\nLastName:SetPlaceholderText(\"Last Name\")\nLastName:SetTabPosition( 2 )\n\nlocal FavoriteColor = vgui.Create(\"DTextEntry\", Panel)\nFavoriteColor:SetSize(400,35)\nFavoriteColor:SetPos(50, 150)\nFavoriteColor:SetPlaceholderText(\"Favorite Color\")\nFavoriteColor:SetTabPosition( 3 )\n\nlocal CompletedButton = vgui.Create(\"DButton\", Panel)\nCompletedButton:SetSize(200,35)\nCompletedButton:SetPos(150, 200)\nCompletedButton:SetText(\"Done\")\nfunction CompletedButton:DoClick()\n    LocalPlayer():ConCommand(\"say My name is \" .. FirstName:GetText() .. \" \" .. LastName:GetText() .. \" and my favorite color is \" .. FavoriteColor:GetText() .. \"!\")\n    Panel:Remove()\nend","output":"A Panel with a functional TAB Button."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTall","parent":"Panel","type":"classfunc","description":"Sets height of a panel. An alias of Panel:SetHeight.","realm":"Client and Menu","args":{"arg":{"text":"Desired height to set","name":"height","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTerm","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/animation.lua","line":"10-L15"},"description":{"text":"Removes the panel after given time in seconds.","note":"This function will not work if PANEL:AnimationThink is overridden, unless Panel:AnimationThinkInternal is called every frame."},"realm":"Client and Menu","args":{"arg":{"text":"Delay in seconds after which the panel should be removed.","name":"delay","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetText","parent":"Panel","type":"classfunc","description":{"text":"Sets the text value of a panel object containing text, such as a Label, TextEntry or  RichText and their derivatives, such as DLabel, DTextEntry or DButton.","warning":["When used on a Label or its derivatives ( DLabel and DButton ), it will automatically call Panel:InvalidateLayout, meaning that you should avoid running this function every frame on these panels to avoid unnecessary performance loss.","Label & its derivatives has hard length limit, maximum 1023 ascii characters."]},"realm":"Client and Menu","args":{"arg":{"text":"The text value to set.","name":"text","type":"string"}}},"example":{"description":"Creates a RichText element and sets the text to a localized string; the default VAC rejection message.","code":"-- Window frame for the RichText\nTextFrame = vgui.Create(\"DFrame\")\nTextFrame:SetSize(250, 150)\nTextFrame:Center()\nTextFrame:SetTitle(\"#VAC_ConnectionRefusedTitle\") -- Results in \"Connection Refused - VAC\"\n\n-- RichText panel\nlocal richtext = vgui.Create(\"RichText\", TextFrame)\nrichtext:Dock(FILL)\n\n-- Set the text to the message you get when VAC banned\nrichtext:SetText(\"#VAC_ConnectionRefusedDetail\")","output":{"image":{"src":"RichText_SetText_example1.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTextHidden","parent":"Panel","type":"classfunc","description":"Makes TextEntry's text be replaced by `*` characters, just like a password-entry text field would.","added":"2025.09.22","realm":"Client and Menu","args":{"arg":{"text":"Whether to have the text be hidden.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTextInset","parent":"Panel","type":"classfunc","description":"Sets the left and top text margins of a text-based panel object, such as a DButton or DLabel.","realm":"Client and Menu","args":{"arg":[{"text":"The left margin for the text, in pixels. This will only affect centered text if the margin is greater than its x-coordinate.","name":"insetX","type":"number"},{"text":"The top margin for the text, in pixels.","name":"insetY","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTextSelectionColors","parent":"Panel","type":"classfunc","description":"Sets text selection colors of a RichText element.","realm":"Client and Menu","added":"2023.01.25","args":{"arg":[{"text":"The Color to set for selected text.","name":"textColor","type":"Color"},{"text":"The Color to set for selected text background.","name":"backgroundColor","type":"Color"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetToFullHeight","parent":"Panel","type":"classfunc","description":{"text":"Sets the height of a RichText element to accommodate the text inside.","note":"This function internally relies on Panel:GetNumLines, so it should be called at least a couple frames after modifying the text using Panel:AppendText"},"realm":"Client and Menu"},"example":{"description":"Creates a RichText panel with no set height. The proper height is applied 2 seconds after being created in order to show the difference.","code":"-- Create a window frame\nTextFrame = vgui.Create(\"DFrame\")\nTextFrame:SetSize(250, 210)\nTextFrame:Center()\nTextFrame:SetTitle(\"No set height\")\nTextFrame:MakePopup()\n\n-- RichText panel\nlocal richtext = vgui.Create(\"RichText\", TextFrame)\nrichtext:SetPos(10, 30)\nrichtext:SetWidth(230)\n\n-- Block of text\nrichtext:AppendText(\"#ServerBrowser_ServerWarning_MaxPlayers\")\n\nfunction richtext:PerformLayout() self:SetBGColor(Color(0, 0, 0)) end\n\n-- Set to full height after 2 seconds\ntimer.Simple(2, function()\n\n\trichtext:SetToFullHeight()\n\t\n\tTextFrame:SetTitle(\"Full set height\")\n\t\nend)","output":{"image":{"src":"RichText_SetToFullHeight_example1.gif"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTooltip","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"301-L303"},"description":"Sets the tooltip to be displayed when a player hovers over the panel object with their cursor.\n\nBy default, DTooltip will be used. Panel:SetTooltipPanelOverride can be used to override the tooltip panel.","realm":"Client and Menu","args":{"arg":{"text":"The text to be displayed in the tooltip. Set `nil` to disable it.","name":"str","type":"string","default":"nil"}}},"example":{"description":"Give DButton a tooltip, that will be automatically shown when the player hovers over the button for a certain amount of time, decided by `tooltip_delay` ConVar.","code":"concommand.Add( \"test_tooltip\", function( ply )\n\tlocal frame = vgui.Create( \"DFrame\" )\n\tframe:SetSize( 200, 200 )\n\tframe:Center()\n\tframe:MakePopup()\n\n\tlocal btn = frame:Add( \"DButton\" )\n\tbtn:SetPos( 20, 40 )\n\tbtn:SetSize( 100, 64 )\n\tbtn:SetText( \"Hover over me!\" )\n\tbtn:SetTooltip( \"I am the tooltip text!\" )\nend )","output":{"upload":{"src":"70c/8de029dfe107ffc.gif","size":"12567","name":"October03-1797-gmod.gif"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTooltipDelay","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"323-L325"},"description":"Sets the tooltip delay. (time between hovering over the panel, and the tooltip showing up)\n\nCan be retrieved with Panel:GetTooltipDelay.","realm":"Client and Menu","added":"2023.04.19","args":{"arg":{"text":"The tooltip delay to set.","name":"tooltip","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTooltipPanel","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"309-L312"},"description":{"text":"Sets the panel to be displayed as contents of a DTooltip when a player hovers over the panel object with their cursor. See Panel:SetTooltipPanelOverride if you are looking to override DTooltip itself.","note":"Panel:SetTooltip will override this functionality.","warning":"Calling this from PANEL:OnCursorEntered is too late! The tooltip will not be displayed or be updated.\n\n\tGiven panel or the previously set one will **NOT** be automatically removed."},"realm":"Client and Menu","args":{"arg":{"text":"The panel to use as the tooltip.","name":"tooltipPanel","type":"Panel","default":"nil"}}},"example":{"description":"Example usage of this function","code":"concommand.Add( \"test_tooltip_content\", function( ply )\n\tlocal frame = vgui.Create( \"DFrame\" )\n\tframe:SetSize( 500, 500 )\n\tframe:Center()\n\tframe:MakePopup()\n\n\tlocal panel = vgui.Create( \"Panel\" )\n\tpanel:SetSize( 100, 100 )\n\tpanel:SetVisible( false )\n\tpanel.Paint = function( self, width, height )\n\t\tsurface.SetDrawColor( 255, 0, 0 )\n\t\tsurface.DrawRect( 0, 0, width, height)\n\tend\n\n\tlocal button1 = vgui.Create( \"DButton\", panel )\n\tbutton1:SetText( \"test\" )\n\tbutton1:SetSize( 50, 50 )\n\tbutton1:SetPos( 5, 5 )\n\n\tlocal button2 = frame:Add( \"DButton\" )\n\tbutton2:Dock( TOP )\n\t-- button2:SetTooltip( \"test\" ) -- This will stop SetTooltipPanel from working.\n\tbutton2:SetTooltipPanel( panel )\nend )","output":{"upload":{"src":"70c/8de029f729bbc5e.png","size":"58419","name":"image.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTooltipPanelOverride","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"316-L318"},"description":"Sets the panel class to be created instead of DTooltip when the player hovers over this panel and a tooltip needs creating.","realm":"Client and Menu","added":"2020.04.29","args":{"arg":{"text":"The panel class to override the default DTooltip. The new panel class must have the following methods:\n* SetText - If you are using Panel:SetTooltip.\n* SetContents - If you are using Panel:SetTooltipPanel.\n* OpenForPanel - A \"hook\" type function that gets called shortly after creation (and after the above 2) to open and position the tooltip. You can see this logic in `lua/includes/util/tooltips.lua`.","name":"override","type":"string"}}},"example":{"description":"Create a custom drawn tooltip.","code":"local PANEL = {}\nfunction PANEL:Paint( w, h )\n\t-- My fancy white background\n\tdraw.RoundedBox( 5, 0, 0, w, h, Color( 255, 255, 255, 255 ) )\nend\nvgui.Register( \"MyCustomTooltipPanel\", PANEL, \"DTooltip\" )\n\nconcommand.Add( \"test_custom_tooltip\", function( ply )\n\tlocal DFrame = vgui.Create( \"DFrame\" )\n\tDFrame:SetSize( 200, 200 )\n\tDFrame:Center()\n\tDFrame:MakePopup()\n\n\tlocal btn = DFrame:Add( \"DButton\" )\n\tbtn:SetPos( 20, 40 )\n\tbtn:SetSize( 100, 64 )\n\tbtn:SetText( \"Hover over me!\" )\n\tbtn:SetTooltip( \"I am the tooltip text with a custom panel!\" )\n\tbtn:SetTooltipPanelOverride( \"MyCustomTooltipPanel\" )\n\nend )","output":{"upload":{"src":"70c/8de029f2c873514.png","size":"36982","name":"image.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetUnderlineFont","parent":"Panel","type":"classfunc","description":"Sets the underlined font for use by clickable text in a RichText. See also Panel:InsertClickableTextStart\n\nThis function will only work on RichText panels.","realm":"Client and Menu","added":"2020.03.17","args":{"arg":{"text":"The name of the font.\n\nSee here for a list of existing fonts.\nAlternatively, use surface.CreateFont to create your own custom font.","name":"fontName","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetURL","parent":"Panel","type":"classfunc","description":"Sets the URL of a link-based panel such as DLabelURL.","realm":"Client and Menu","args":{"arg":{"text":"The URL to set. It **must** begin with either `http://` or `https://`.","name":"url","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetVerticalScrollbarEnabled","parent":"Panel","type":"classfunc","description":"Sets the visibility of the vertical scrollbar.\n\nWorks for RichText and TextEntry.","realm":"Client and Menu","args":{"arg":{"text":"True to display the vertical text scroll bar, false to hide it.","name":"display","type":"boolean","default":"false"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetVisible","parent":"Panel","type":"classfunc","description":"Sets the \"visibility\" of the panel.","realm":"Client and Menu","args":{"arg":{"text":"The visibility of the panel.","name":"visible","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetWide","parent":"Panel","type":"classfunc","description":"Sets width of a panel. An alias of Panel:SetWidth.","realm":"Client and Menu","args":{"arg":{"text":"Desired width to set","name":"width","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetWidth","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"53-L55"},"description":"Sets the width of the panel.\n\nCalls PANEL:OnSizeChanged and marks this panel for layout (Panel:InvalidateLayout).\nAutomatically rounds the width down\n\nSee also Panel:SetSize.","realm":"Client and Menu","args":{"arg":{"text":"The new width of the panel.","name":"width","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetWorldClicker","parent":"Panel","type":"classfunc","description":"This makes it so that when you're hovering over this panel you can \"click\" on the world. Your weapon aim (and its viewmodel) will follow the cursor. This is primarily used for the Sandbox context menu.","realm":"Client and Menu","args":{"arg":{"text":"Whether to enable or disable the feature for this panel.","name":"enable","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetWrap","parent":"Panel","type":"classfunc","description":"Sets whether text wrapping should be enabled or disabled on Label and DLabel panels.\n\nUse DLabel:SetAutoStretchVertical to automatically correct vertical size; Panel:SizeToContents will not set the correct height.","realm":"Client and Menu","args":{"arg":{"text":"`True` to enable text wrapping, `false` otherwise.","name":"wrap","type":"boolean"}}},"example":{"description":"Creates two labels in a panel and sets the text wrapping to false and true respectively.","code":"-- Background panel\nlocal BGPanel = vgui.Create( \"DPanel\" )\nBGPanel:SetSize( 300, 130 )\nBGPanel:Center()\nBGPanel:SetBackgroundColor( color_black )\n\t\t\n-- Label with no text wrapping\nlocal lbl_nowrap = vgui.Create( \"DLabel\", BGPanel )\nlbl_nowrap:SetPos( 10, 10 )\nlbl_nowrap:SetSize( 280, 50 )\t\t\nlbl_nowrap:SetFont( \"GModNotify\" )\nlbl_nowrap:SetText( \"This is a label that has text wrapping disabled.\" )\n\nlbl_nowrap:SetWrap( false )\n\n-- Label with text wrapping\nlocal lbl_wrap = vgui.Create( \"DLabel\", BGPanel )\nlbl_wrap:SetPos( 10, 70 )\nlbl_wrap:SetSize( 280, 50 )\nlbl_wrap:SetFont( \"GModNotify\" )\nlbl_wrap:SetText( \"This is a label that has text wrapping enabled.\" )\n\nlbl_wrap:SetWrap( true )","output":{"image":{"src":"Panel_SetWrap_example1.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetX","parent":"Panel","type":"classfunc","description":"Sets the X position of the panel.\n\nUses Panel:SetPos internally.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel.lua","line":"70-L72"},"added":"2021.03.31","args":{"arg":{"text":"The X coordinate of the position.","name":"x","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetY","parent":"Panel","type":"classfunc","description":"Sets the Y position of the panel.\n\nUses Panel:SetPos internally.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel.lua","line":"73-L75"},"added":"2021.03.31","args":{"arg":{"text":"The Y coordinate of the position.","name":"y","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetZPos","parent":"Panel","type":"classfunc","description":"Sets the panels z position which determines the rendering order.\n\nPanels with lower z positions appear behind panels with higher z positions.\n\nThis also controls in which order panels docked with Panel:Dock appears.","realm":"Client and Menu","args":{"arg":{"text":"The z position of the panel. \n\nCan't be lower than -32768 or higher than 32767.","name":"zIndex","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Show","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"602-L604"},"description":"Makes a panel visible.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SizeTo","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/animation.lua","line":"182-L197"},"description":"Uses animation to resize the panel to the specified size.","realm":"Client and Menu","args":{"arg":[{"text":"The target width of the panel. Use -1 to retain the current width.","name":"sizeW","type":"number","default":"0"},{"text":"The target height of the panel. Use -1 to retain the current height.","name":"sizeH","type":"number","default":"0"},{"text":"The time to perform the animation within.","name":"time","type":"number"},{"text":"The delay before the animation starts.","name":"delay","type":"number","default":"0"},{"text":"Easing of the start and/or end speed of the animation. See Panel:NewAnimation for how this works.","name":"ease","type":"number","default":"-1"},{"text":"The function to be called once the animation finishes.","name":"callback","type":"function","default":"nil","callback":{"arg":[{"text":"The Structures/AnimationData that was used.","type":"table","name":"animData"},{"text":"The panel object that was animated.","type":"Panel","name":"targetPanel"}]}}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SizeToChildren","parent":"Panel","type":"classfunc","description":{"text":"Resizes the panel to fit the bounds of its children.","note":["Your panel must have its layout updated (Panel:InvalidateLayout) for this function to work properly.","The sizeW and sizeH parameters are false by default. Therefore, calling this function with no arguments will result in a no-op."]},"realm":"Client and Menu","args":{"arg":[{"text":"Resize with width of the panel.","name":"sizeW","type":"boolean","default":"false"},{"text":"Resize the height of the panel.","name":"sizeH","type":"boolean","default":"false"}]}},"example":{"description":"Using Panel:InvalidateLayout","code":"local Frame = vgui.Create( \"DFrame\" )\nFrame:SetSize( 300, 400 )\nFrame:Center()\nFrame:MakePopup()\nFrame:SetSizable( true )\n\n-- with :InvalidateLayout(true)\nlocal backgroundPanel = vgui.Create( \"DPanel\", Frame )\nbackgroundPanel:Dock( TOP )\nbackgroundPanel:DockPadding( 4, 4, 4, 4 )\nbackgroundPanel:DockMargin( 0, 0, 0, 4 )\n\nlocal button1 = vgui.Create( \"DButton\", backgroundPanel )\nbutton1:Dock( TOP )\nbutton1:DockMargin( 0, 0, 0, 4 )\nbutton1:SetTall( 60 )\nbutton1:SetText( \"c1\" )\n\nlocal button2 = vgui.Create( \"DButton\", backgroundPanel )\nbutton2:Dock( TOP )\nbutton2:SetTall( 60 )\nbutton2:SetText( \"c2\" )\n\nbackgroundPanel:InvalidateLayout( true )\nbackgroundPanel:SizeToChildren( false, true )\n\n\n-- now w/o :InvalidateLayout\nlocal backgroundPanel = vgui.Create( \"DPanel\", Frame )\nbackgroundPanel:Dock( TOP )\nbackgroundPanel:DockPadding( 4, 4, 4, 4 )\n\nlocal button1 = vgui.Create( \"DButton\", backgroundPanel )\nbutton1:Dock( TOP )\nbutton1:DockMargin( 0, 0, 0, 4 )\nbutton1:SetTall( 60 )\nbutton1:SetText( \"c1\" )\n\nlocal button2 = vgui.Create( \"DButton\", backgroundPanel )\nbutton2:Dock( TOP )\nbutton2:SetTall( 60 )\nbutton2:SetText( \"c2\" )\n\nbackgroundPanel:SizeToChildren( false, true )","output":{"image":{"src":"panel_stc_invalidation_ex1.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SizeToContents","parent":"Panel","type":"classfunc","description":{"text":"Resizes the panel so that its width and height fit all of the content inside.","note":"Only works on Label derived panels such as DLabel by default, and on any panel that manually implemented the Panel:SizeToContents method, such as DNumberWang and DImage.","warning":"You must call this function **AFTER** setting text/font, adjusting child panels or otherwise altering the panel."},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SizeToContentsX","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"342-L349"},"description":{"text":"Resizes the panel object's width to accommodate all child objects/contents.\n\nOnly works on Label derived panels such as DLabel by default, and on any panel that manually implemented Panel:GetContentSize method.","note":"You must call this function **AFTER** setting text/font or adjusting child panels."},"realm":"Client and Menu","args":{"arg":{"text":"The number of extra pixels to add to the width. Can be a negative number, to reduce the width.","name":"addVal","type":"number","default":"0"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SizeToContentsY","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"330-L337"},"description":{"text":"Resizes the panel object's height to accommodate all child objects/contents.\n\nOnly works on Label derived panels such as DLabel by default, and on any panel that manually implemented Panel:GetContentSize method.","note":"You must call this function **AFTER** setting text/font or adjusting child panels."},"realm":"Client and Menu","args":{"arg":{"text":"The number of extra pixels to add to the height.","name":"addVal","type":"number","default":"0"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SlideDown","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/animation.lua","line":"216-L224"},"description":"Slides the panel in from above.","realm":"Client and Menu","args":{"arg":{"text":"Time to complete the animation.","name":"Length","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SlideUp","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/animation.lua","line":"202-L211"},"description":"Slides the panel out to the top.","realm":"Client and Menu","args":{"arg":{"text":"Time to complete the animation.","name":"Length","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"StartBoxSelection","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/selections.lua","line":"134-L160"},"description":"Begins a box selection, enables mouse capture for the panel object, and sets the start point of the selection box to the mouse cursor's position, relative to this object. For this to work, either the object or its parent must be enabled as a selection canvas. This is set using Panel:SetSelectionCanvas.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Stop","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/animation.lua","line":"78-L82"},"description":"Stops all panel animations by clearing its animation list. This also clears all delayed animations.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"StopLoading","parent":"Panel","type":"classfunc","description":"Stops the loading of the HTML panel's current page.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"StretchBottomTo","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"146-L146"},"description":"Resizes the panel object's height so that its bottom is aligned with the top of the passed panel. An offset greater than zero will reduce the panel's height to leave a gap between it and the passed panel.","realm":"Client and Menu","args":{"arg":[{"text":"The panel to align the bottom of this one with.","name":"tgtPanel","type":"Panel"},{"text":"The gap to leave between this and the passed panel. Negative values will cause the panel's height to increase, forming an overlap.","name":"offset","type":"number","default":"0"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"StretchRightTo","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"145-L145"},"description":"Resizes the panel object's width so that its right edge is aligned with the left of the passed panel. An offset greater than zero will reduce the panel's width to leave a gap between it and the passed panel.","realm":"Client and Menu","args":{"arg":[{"text":"The panel to align the right edge of this one with.","name":"tgtPanel","type":"Panel"},{"text":"The gap to leave between this and the passed panel. Negative values will cause the panel's width to increase, forming an overlap.","name":"offset","type":"number","default":"0"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"StretchToParent","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"80-L103"},"description":"Sets the dimensions of the panel to fill its parent. It will only stretch in directions that aren't nil.","realm":"Client and Menu","args":{"arg":[{"text":"The left offset to the parent.","name":"offsetLeft","type":"number","default":"nil"},{"text":"The top offset to the parent.","name":"offsetTop","type":"number","default":"nil"},{"text":"The right offset to the parent.","name":"offsetRight","type":"number","default":"nil"},{"text":"The bottom offset to the parent.","name":"offsetBottom","type":"number","default":"nil"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ToggleSelection","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/selections.lua","line":"29-L33"},"description":"Toggles the selected state of a selectable panel object. This functionality is set with Panel:SetSelectable and checked with Panel:IsSelectable. To check whether the object is selected or not, Panel:IsSelected is used.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ToggleVisible","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel.lua","line":"418-L420"},"description":"Toggles the visibility of a panel and all its children.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Undo","parent":"Panel","type":"classfunc","description":"Restores the last saved state (caret position and the text inside) of a TextEntry. Should act identically to pressing CTRL+Z in a TextEntry.\n\nSee also Panel:SaveUndoState.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UnselectAll","parent":"Panel","type":"classfunc","file":{"text":"lua/includes/extensions/client/panel/selections.lua","line":"35-L43"},"description":"Recursively deselects this panel object and all of its children. This will cascade to all child objects at every level below the parent.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateHTMLTexture","parent":"Panel","type":"classfunc","description":{"text":"Forcibly updates the panels' HTML Material, similar to when Paint is called on it.\nThis is only useful if the panel is not normally visible, i.e the panel exists purely for its HTML Material.","note":["Only works on with panels that have a HTML Material. See Panel:GetHTMLMaterial for more details.","A good place to call this is in the GM:PreRender hook"]},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Valid","parent":"Panel","type":"classfunc","description":{"text":"Returns if a given panel is valid or not.","deprecated":"Use Panel:IsValid instead."},"realm":"Client and Menu","rets":{"ret":{"text":"Whether the panel is valid or not, true being it is, false being it isn't.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Chase","parent":"PathFollower","type":"classfunc","description":"Computes the shortest path to the provided entity arg. PathFollower Object must have `Chase` type. \n\nFor PathFollower objects of the `Follow` type use PathFollower:Compute","realm":"Server","args":{"arg":[{"text":"The bot to update along the path. This can also be a nextbot player (player.CreateNextbot)","name":"bot","type":"NextBot"},{"text":"The entity we want to chase","name":"ent","type":"Entity"},{"text":"A function that allows you to alter the path generation. See example on PathFollower:Compute for the default function.","name":"generator","type":"function","default":"nil","added":"2024.05.14","callback":{"arg":[{"text":"The area to move to.","name":"area","type":"CNavArea"},{"text":"The area to move from.","name":"fromArea","type":"CNavArea"},{"text":"The ladder to move to or from (Validation required), if any.","name":"ladder","type":"CNavLadder"},{"text":"Will probably be always NULL","name":"elevator","type":"Entity"},{"text":"Precomputed length between `area` and `fromArea`.","name":"length","type":"number"}],"ret":{"text":"The cost of movement between `area` and `fromArea`.","name":"cost","type":"number"}}}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Compute","parent":"PathFollower","type":"classfunc","description":"Compute shortest path from bot to 'goal' via A* algorithm. This only works if the PathFollower is the `Follow` Type. \n\nFor PathFollowers of the `Chase` Type see PathFollower:Chase","realm":"Server","args":{"arg":[{"text":"The nextbot we're generating for.  This can also be a nextbot player (player.CreateNextbot).","name":"bot","type":"NextBot"},{"text":"The target location, the goal.","name":"goal","type":"Vector"},{"text":"A function that allows you to alter the path generation by adjusting the \"cost\". See example below for the default function.","name":"generator","type":"function","default":"nil","callback":{"arg":[{"text":"The area to move to.","name":"area","type":"CNavArea"},{"text":"The area to move from.","name":"fromArea","type":"CNavArea"},{"text":"The ladder to move to or from (Validation required), if any.","name":"ladder","type":"CNavLadder"},{"text":"Will probably be always NULL","name":"elevator","type":"Entity"},{"text":"Precomputed length between `area` and `fromArea`.","name":"length","type":"number"}],"ret":{"text":"The cost of movement between `area` and `fromArea`.","name":"cost","type":"number"}}}]},"rets":{"ret":{"text":"* If returns true, path was found to the goal position.\n* If returns false, path may either be invalid (use IsValid() to check), or valid but doesn't reach all the way to the goal.","name":"","type":"boolean"}}},"example":{"description":"The default path generator. You **do not have** to provide the `PathFollower.Compute` any generator functions if you want to use the default generator.","code":"path:Compute( self, pos, function( area, fromArea, ladder, elevator, length )\n\tif ( !IsValid( fromArea ) ) then\n\n\t\t-- first area in path, no cost\n\t\treturn 0\n\t\n\telse\n\t\n\t\tif ( !self.loco:IsAreaTraversable( area ) ) then\n\t\t\t-- our locomotor says we can't move here\n\t\t\treturn -1\n\t\tend\n\n\t\t-- compute distance traveled along path so far\n\t\tlocal dist = 0\n\n\t\tif ( IsValid( ladder ) ) then\n\t\t\tdist = ladder:GetLength()\n\t\telseif ( length > 0 ) then\n\t\t\t-- optimization to avoid recomputing length\n\t\t\tdist = length\n\t\telse\n\t\t\tdist = ( area:GetCenter() - fromArea:GetCenter() ):GetLength()\n\t\tend\n\n\t\tlocal cost = dist + fromArea:GetCostSoFar()\n\n\t\t-- check height change\n\t\tlocal deltaZ = fromArea:ComputeAdjacentConnectionHeightChange( area )\n\t\tif ( deltaZ >= self.loco:GetStepHeight() ) then\n\t\t\tif ( deltaZ >= self.loco:GetMaxJumpHeight() ) then\n\t\t\t\t-- too high to reach\n\t\t\t\treturn -1\n\t\t\tend\n\n\t\t\t-- jumping is slower than flat ground\n\t\t\tlocal jumpPenalty = 5\n\t\t\tcost = cost + jumpPenalty * dist\n\t\telseif ( deltaZ < -self.loco:GetDeathDropHeight() ) then\n\t\t\t-- too far to drop\n\t\t\treturn -1\n\t\tend\n\n\t\treturn cost\n\tend\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"Draw","parent":"PathFollower","type":"classfunc","description":"Draws the path. This is meant for debugging - and uses debugoverlay.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"FirstSegment","parent":"PathFollower","type":"classfunc","description":"Returns the first segment of the path.","realm":"Server","rets":{"ret":{"text":"A table with Structures/PathSegment.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetAge","parent":"PathFollower","type":"classfunc","description":"Returns the age since the path was built","realm":"Server","rets":{"ret":{"text":"Path age","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetAllSegments","parent":"PathFollower","type":"classfunc","description":"Returns all of the segments of the given path.","realm":"Server","rets":{"ret":{"text":"A table of tables with Structures/PathSegment.","name":"","type":"table{PathSegment}"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetClosestPosition","parent":"PathFollower","type":"classfunc","description":"The closest position along the path to a position","realm":"Server","args":{"arg":{"text":"The point we're querying for","name":"position","type":"Vector"}},"rets":{"ret":{"text":"The closest position on the path","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetCurrentGoal","parent":"PathFollower","type":"classfunc","description":"Returns the current goal data. Can return nil if the current goal is invalid, for example immediately after PathFollower:Update.","realm":"Server","rets":{"ret":{"text":"A table with Structures/PathSegment.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetCursorData","parent":"PathFollower","type":"classfunc","description":"Returns the cursor data","realm":"Server","rets":{"ret":{"text":"A table with 3 keys:\nnumber curvature\n\n\nVector forward\n\n\nVector pos","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetCursorPosition","parent":"PathFollower","type":"classfunc","description":"Returns the current progress along the path","realm":"Server","rets":{"ret":{"text":"The current progress","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetEnd","parent":"PathFollower","type":"classfunc","description":"Returns the path end position","realm":"Server","rets":{"ret":{"text":"The end position","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetGoalTolerance","parent":"PathFollower","type":"classfunc","description":"Returns how close we can get to the goal to call it done.","realm":"Server","rets":{"ret":{"text":"The distance we're setting it to","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetHindrance","parent":"PathFollower","type":"classfunc","realm":"Server","description":{"text":"Returns the entity the bot is currently trying to avoid.","deprecated":"Currently always returns NULL due to internal implementation of Lua Nextbots, where nothing is considered a hindrance, so do not try to use."},"rets":{"ret":{"text":"The current path hindrance, if any.","name":"","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetLength","parent":"PathFollower","type":"classfunc","description":"Returns the total length of the path","realm":"Server","rets":{"ret":{"text":"The length of the path","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetMinLookAheadDistance","parent":"PathFollower","type":"classfunc","description":"Returns the minimum range movement goal must be along path.","realm":"Server","rets":{"ret":{"text":"The minimum look ahead distance","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetPositionOnPath","parent":"PathFollower","type":"classfunc","description":"Returns the vector position of distance along path","realm":"Server","args":{"arg":{"text":"The distance along the path to query","name":"distance","type":"number"}},"rets":{"ret":{"text":"The position","name":"","type":"Vector"}}},"example":{"description":"Gets the current position on the path as a Vector.","code":"path:GetPositionOnPath( path:GetCursorPosition() )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetStart","parent":"PathFollower","type":"classfunc","description":"Returns the path start position","realm":"Server","rets":{"ret":{"text":"The start position","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Invalidate","parent":"PathFollower","type":"classfunc","description":"Invalidates the current path","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsValid","parent":"PathFollower","type":"classfunc","description":"Returns true if the path is valid","realm":"Server","rets":{"ret":{"text":"Wether the path is valid or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"LastSegment","parent":"PathFollower","type":"classfunc","description":"Returns the last segment of the path.","realm":"Server","rets":{"ret":{"text":"A table with Structures/PathSegment.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"MoveCursor","parent":"PathFollower","type":"classfunc","description":"Moves the cursor by give distance.\n\nFor a function that sets the distance, see PathFollower:MoveCursorTo.","realm":"Server","args":{"arg":{"text":"The distance to move the cursor (in relative world units)","name":"distance","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"MoveCursorTo","parent":"PathFollower","type":"classfunc","description":"Sets the cursor position to given distance.\n\nFor relative distance, see PathFollower:MoveCursor.","realm":"Server","args":{"arg":{"text":"The distance to move the cursor (in world units)","name":"distance","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"MoveCursorToClosestPosition","parent":"PathFollower","type":"classfunc","description":"Moves the cursor of the path to the closest position compared to given vector.","realm":"Server","args":{"arg":[{"name":"pos","type":"Vector"},{"text":"Seek type\n\n\n0 = SEEK_ENTIRE_PATH - Search the entire path length\n\n\n1 = SEEK_AHEAD - Search from current cursor position forward toward end of path\n\n\n2 = SEEK_BEHIND - Search from current cursor position backward toward path start","name":"type","type":"number","default":"0"},{"name":"alongLimit","type":"number","default":"0"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"MoveCursorToEnd","parent":"PathFollower","type":"classfunc","description":"Moves the cursor to the end of the path","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"MoveCursorToStart","parent":"PathFollower","type":"classfunc","description":"Moves the cursor to the end of the path","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"NextSegment","parent":"PathFollower","type":"classfunc","description":"Returns the next segment of the path.","realm":"Server","added":"2019.03.29","rets":{"ret":{"text":"A table with Structures/PathSegment.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PriorSegment","parent":"PathFollower","type":"classfunc","description":"Returns the previous segment of the path.","realm":"Server","added":"2019.03.29","rets":{"ret":{"text":"A table with Structures/PathSegment.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ResetAge","parent":"PathFollower","type":"classfunc","description":"Resets the age which is retrieved by PathFollower:GetAge to 0.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetGoalTolerance","parent":"PathFollower","type":"classfunc","description":"How close we can get to the goal to call it done","realm":"Server","args":{"arg":{"text":"The distance we're setting it to","name":"distance","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetMinLookAheadDistance","parent":"PathFollower","type":"classfunc","description":"Sets minimum range movement goal must be along path","realm":"Server","args":{"arg":{"text":"The minimum look ahead distance","name":"mindist","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Update","parent":"PathFollower","type":"classfunc","description":{"text":"Move the bot along the path.","note":"player nextbots require CUserCmd:SetForwardMove to move forward along the path"},"realm":"Server","args":{"arg":{"text":"The bot to update along the path. This can also be a nextbot player (player.CreateNextbot)","name":"bot","type":"NextBot"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Destroy","parent":"PhysCollide","type":"classfunc","description":"Destroys the PhysCollide object.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsValid","parent":"PhysCollide","type":"classfunc","description":"Checks whether this PhysCollide object is valid or not.\n\nYou should just use Global.IsValid instead.","realm":"Shared","rets":{"ret":{"text":"Is valid or not.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"TraceBox","parent":"PhysCollide","type":"classfunc","description":"Performs a trace against this PhysCollide with the given parameters. This can be used for both line traces and box traces.","realm":"Shared","args":{"arg":[{"text":"The origin for the PhysCollide during the trace","name":"origin","type":"Vector"},{"text":"The angles for the PhysCollide during the trace","name":"angles","type":"Angle"},{"text":"The start position of the trace","name":"rayStart","type":"Vector"},{"text":"The end position of the trace","name":"rayEnd","type":"Vector"},{"text":"The mins of the trace's bounds","name":"rayMins","type":"Vector"},{"text":"The maxs of the trace's bounds","name":"rayMaxs","type":"Vector"}]},"rets":{"ret":[{"text":"Hit position of the trace. This is false if the trace did not hit.","name":"","type":"Vector"},{"text":"Hit normal of the trace","name":"","type":"Vector"},{"text":"Fraction of the trace. This is calculated from the distance between startPos, hitPos, and endPos.","name":"","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddAngleVelocity","parent":"PhysObj","type":"classfunc","description":"Adds the specified [angular velocity](https://en.wikipedia.org/wiki/Angular_velocity) velocity to the current PhysObj.","realm":"Shared","args":{"arg":{"text":"The additional velocity in `degrees/s`. (Local to the physics object.)","name":"angularVelocity","type":"Vector","note":"Does nothing on frozen objects."}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddGameFlag","parent":"PhysObj","type":"classfunc","description":"Adds one or more bit flags.","realm":"Shared","args":{"arg":{"text":"Bitflag, see Enums/FVPHYSICS.","name":"flags","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddVelocity","parent":"PhysObj","type":"classfunc","description":"Adds the specified velocity to the current.","realm":"Shared","args":{"arg":{"text":"Additional velocity in `source_unit/s`. (World frame)","name":"velocity","type":"Vector","note":"Does nothing on frozen objects."}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AlignAngles","parent":"PhysObj","type":"classfunc","description":"Rotates the object so that it's angles are aligned to the ones inputted.","realm":"Shared","args":{"arg":[{"name":"from","type":"Angle"},{"name":"to","type":"Angle"}]},"rets":{"ret":{"name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ApplyForceCenter","parent":"PhysObj","type":"classfunc","description":{"text":"Applies the specified impulse in the mass center of the physics object.","note":"This will not work on players, use Entity:SetVelocity instead."},"realm":"Shared","args":{"arg":{"text":"The [impulse](https://en.wikipedia.org/wiki/Impulse_(physics)) to be applied in `kg*source_unit/s`. (The vector is in world frame)","name":"impulse","type":"Vector"}}},"example":{"description":{"text":"An entity that simulates its own gravity by applying a force downward on the entity based on the force equation:\n\n`(Force = mass * acceleration)`\n\nSince, by default, entities already have gravity, the default gravity must be turned off by adding `phys:EnableGravity(false)` in the entity's Initialize function so that the default gravity doesn't interfere with our custom gravity.\n\n**NOTE**: We can get the mass of the entity by using the PhysObj:GetMass function.","note":["-9.80665 (meters / second ^ 2)  Is the approximate acceleration of objects on Earth due to gravity. (It is negative because gravity pushes things downwards.)","Considering that the unit of the impulse that ApplyForceCenter accepts is kg*source_unit / s, we have to do unit conversion: 1 meter ≈ 39.37 source units ([on entity scale](https://developer.valvesoftware.com/wiki/Dimensions#Source_Engine_Scale_Calculations))"]},"code":"function ENT:Initialize()\n    self:SetModel( \"models/hunter/blocks/cube1x1x1.mdl\" )\n\tself:PhysicsInit( SOLID_VPHYSICS )\n\tself:SetSolid( SOLID_VPHYSICS )\n\tself:SetMoveType( MOVETYPE_VPHYSICS )\n\n    local phys = self:GetPhysicsObject()\n    if phys:IsValid() then\n        phys:EnableGravity( false ) -- This is required. Since we are creating our own gravity.\n        phys:Wake()\n    end\nend\n\nfunction ENT:PhysicsUpdate( phys )\n\tlocal force = phys:GetMass() * Vector( 0, 0, -9.80665 ) * 39.37 -- This gives us the force in kg*source_unit/s^2\n\tlocal dt = engine.TickInterval() -- The time interval over which the force acts on the object (in seconds)\n    phys:ApplyForceCenter( force * dt ) -- Multiplying the two gives us the impulse in kg*source_unit/s\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ApplyForceOffset","parent":"PhysObj","type":"classfunc","description":"Applies the specified impulse on the physics object at the specified position.","realm":"Shared","args":{"arg":[{"text":"The impulse to be applied in `kg*source_unit/s`. (World frame)","name":"impulse","type":"Vector"},{"text":"The position in world coordinates (`source units`) where the force is applied to the physics object.","name":"position","type":"Vector"}]}},"example":{"description":"Pull what the player is looking at towards him.","code":"local tr = Entity(1):GetEyeTrace()\nif IsValid(tr.Entity) then\n\tlocal phys = tr.Entity:GetPhysicsObjectNum(tr.PhysicsBone)\n\t\n\tlocal pushvec = tr.Normal * -100000\n\tlocal pushpos = tr.HitPos\n\t\n\tphys:ApplyForceOffset(pushvec, pushpos)\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ApplyTorqueCenter","parent":"PhysObj","type":"classfunc","description":"Applies the specified angular impulse to the physics object. See PhysObj:CalculateForceOffset","realm":"Shared","args":{"arg":{"text":"The angular impulse to be applied in `kg * m^2 * degrees / s`. (The vector is in world frame)","name":"angularImpulse","type":"Vector","note":"The unit conversion between meters and source units in this case is `1 meter ≈ 39.37 source units (100/2.54 exactly)`"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CalculateForceOffset","parent":"PhysObj","type":"classfunc","description":"Calculates the linear and angular impulse on the object's center of mass for an offset impulse.\nThe outputs can be used with PhysObj:ApplyForceCenter and PhysObj:ApplyTorqueCenter, respectively.\n\n**Be careful to convert the angular impulse to world frame (PhysObj:LocalToWorldVector) if you are going to use it with ApplyTorqueCenter.**","realm":"Shared","args":{"arg":[{"text":"The impulse acting on the object in `kg*source_unit/s`. (World frame)","name":"impulse","type":"Vector"},{"text":"The location of the impulse in world coordinates (`source units`)","name":"position","type":"Vector"}]},"rets":{"ret":[{"text":"The calculated linear impulse on the physics object's center of mass in `kg*source_unit/s`. (World frame)","name":"linearImpulse","type":"Vector"},{"text":"The calculated angular impulse on the physics object's center of mass in `kg*m^2*degrees/s`. (Local frame)","name":"angularImpulse","type":"Vector"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CalculateVelocityOffset","parent":"PhysObj","type":"classfunc","description":{"text":"Calculates the linear and angular velocities on the center of mass for an offset impulse. The outputs can be directly passed to PhysObj:AddVelocity and PhysObj:AddAngleVelocity, respectively.","warning":"This will return zero length vectors if the physics object's motion is disabled. See PhysObj:IsMotionEnabled."},"realm":"Shared","args":{"arg":[{"text":"The impulse acting on the object in `kg*source_unit/s`. (World frame)","name":"impulse","type":"Vector"},{"text":"The location of the impulse in world coordinates (`source units`)","name":"position","type":"Vector"}]},"rets":{"ret":[{"text":"The calculated linear velocity from the impulse on the physics object's center of mass in `source_unit/s`. (World frame)","name":"","type":"Vector"},{"text":"The calculated angular velocity from the impulse on the physics object's center of mass in `degrees/s`. (Local frame)","name":"","type":"Vector"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ClearGameFlag","parent":"PhysObj","type":"classfunc","description":"Removes one of more specified flags.","realm":"Shared","args":{"arg":{"text":"Bitflag, see Enums/FVPHYSICS.","name":"flags","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ComputeShadowControl","parent":"PhysObj","type":"classfunc","description":"Allows you to move a PhysObj to a point and angle in 3D space. Works with any PhysObj, not just physics shadows.","realm":"Shared","args":{"arg":{"text":"The parameters for the shadow. See Structures/ShadowControlParams.","name":"shadowparams","type":"table"}}},"example":{"description":"Move a PhysObj to vector 0 0 0 with angles 0 0 0.","code":"function ENT:Initialize()\n \n\tself:StartMotionController()\n\tself.ShadowParams = {}\n \nend\nfunction ENT:PhysicsSimulate( phys, deltatime )\n \n\tphys:Wake()\n \n\tself.ShadowParams.secondstoarrive = 1 \n\tself.ShadowParams.pos = Vector( 0, 0, 0 )\n\tself.ShadowParams.angle = Angle( 0, 0, 0 )\n\tself.ShadowParams.maxangular = 5000\n\tself.ShadowParams.maxangulardamp = 10000\n\tself.ShadowParams.maxspeed = 1000000\n\tself.ShadowParams.maxspeeddamp = 10000\n\tself.ShadowParams.dampfactor = 0.8\n\tself.ShadowParams.teleportdistance = 200\n\tself.ShadowParams.delta = deltatime\n \n\tphys:ComputeShadowControl(self.ShadowParams)\n \nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EnableCollisions","parent":"PhysObj","type":"classfunc","description":{"text":"Sets whether the physics object should collide with anything or not, including world.","warning":"This function currently has major problems with player collisions, and as such should be avoided at all costs.\n\n\n\nA better alternative to this function would be using Entity:SetCollisionGroup( COLLISION_GROUP_WORLD )."},"realm":"Shared","args":{"arg":{"text":"True to enable, false to disable.","name":"enable","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EnableDrag","parent":"PhysObj","type":"classfunc","description":"Sets whenever the physics object should be affected by drag.","realm":"Shared","args":{"arg":{"text":"True to enable, false to disable.","name":"enable","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EnableGravity","parent":"PhysObj","type":"classfunc","description":"Sets whether the PhysObject should be affected by gravity","realm":"Shared","args":{"arg":{"text":"True to enable, false to disable.","name":"enable","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EnableMotion","parent":"PhysObj","type":"classfunc","description":"Sets whether the physobject should be able to move or not.\n\nThis is the exact method the Physics Gun uses to freeze props. If a motion-disabled physics object is grabbed with the physics gun, the object will be able to move again. To disallow this, use GM:PhysgunPickup.","realm":"Shared","args":{"arg":{"text":"True to enable, false to disable.","name":"enable","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAABB","parent":"PhysObj","type":"classfunc","description":"Returns the mins and max of the physics object Axis-Aligned Bounding Box.","realm":"Shared","rets":{"ret":[{"text":"The minimum extents of the bounding box, or `nil` for runtime generated physics object.","name":"","type":"Vector|nil"},{"text":"The maximum extents of the bounding box.","name":"","type":"Vector"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAngles","parent":"PhysObj","type":"classfunc","description":"Returns the angles of the physics object in degrees.","realm":"Shared","rets":{"ret":{"text":"The angles of the physics object.","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAngleVelocity","parent":"PhysObj","type":"classfunc","description":"Gets the angular velocity of the object in degrees per second as a local vector. You can use dot product to read the magnitude from a specific axis.","realm":"Shared","rets":{"ret":{"text":"The angular velocity","name":"","type":"Vector"}}},"example":{"description":"Calculate the RPM of an object rotating around its local Z axis with one revolution per second.","code":"print(\"RPM\", oPhys:GetAngleVelocity():Dot( Vector(0, 0, 1) ) / 6)","output":"RPM 60"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBuoyancyRatio","parent":"PhysObj","type":"classfunc","description":{"text":"Returns the buoyancy ratio of the physics object. (How well it floats in water).","note":"This feature is not available on x86-64 beta and on MacOS version of the game."},"realm":"Shared","added":"2025.08.08","rets":{"ret":{"text":"Buoyancy ratio, where 0 is not buoyant at all (like a rock), and 1 is very buoyant (like wood)","name":"buoyancy","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetContents","parent":"PhysObj","type":"classfunc","description":"Returns the contents flag of the PhysObj.","realm":"Shared","rets":{"ret":{"text":"The Enums/CONTENTS.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDamping","parent":"PhysObj","type":"classfunc","description":"Returns the linear and angular damping of the physics object.","realm":"Shared","rets":{"ret":[{"text":"The linear damping","name":"","type":"number"},{"text":"The angular damping","name":"","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetEnergy","parent":"PhysObj","type":"classfunc","description":"Returns the sum of the linear and rotational kinetic energies of the physics object.","realm":"Shared","rets":{"ret":{"text":"The kinetic energy","name":"","type":"number"}}},"example":{"description":"Replicates what GetEnergy does internally.","code":"local linear_kenergy = 0.5 * phys:GetMass() * phys:GetVelocity() ^ 2 -- 1/2 mv^2\nlocal rotational_kenergy = 0.5 * phys:GetInertia() * phys:GetAngleVelocity() ^ 2 -- 1/2 Iw^2\nlocal kenergy = linear_kenergy + rotational_kenergy"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetEntity","parent":"PhysObj","type":"classfunc","description":"Returns the parent entity of the physics object.","realm":"Shared","rets":{"ret":{"text":"The entity this physics object belongs to","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetFrictionSnapshot","parent":"PhysObj","type":"classfunc","description":"Returns the friction snapshot of this physics object. This is useful for determining if an object touching ground for example.","realm":"Server","added":"2020.03.17","rets":{"ret":{"text":"A table of tables containing the following data:\n* PhysObj Other - The other physics object we came in contact with\n* number EnergyAbsorbed - \n* number FrictionCoefficient - \n* number NormalForce - \n* Vector Normal - Direction of the friction event\n* Vector ContactPoint - Contact point of the friction event\n* number Material - Surface Property ID of our physics obj\n* number MaterialOther - Surface Property ID of the physics obj we came in contact with","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetIndex","parent":"PhysObj","type":"classfunc","description":"Returns the index this physics object is on its PhysObj:GetEntity.\n\nUseful for Entity:TranslateBoneToPhysBone.","realm":"Shared","added":"2024.11.20","rets":{"ret":{"text":"The physics object index on its parent entity.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetInertia","parent":"PhysObj","type":"classfunc","description":"Returns the principal moments of inertia `(Ixx, Iyy, Izz)` of the physics object, in the local frame, with respect to the center of mass.","realm":"Shared","rets":{"ret":{"text":"The moment of inertia in `kg * m^2`","name":"angularInertia","type":"Vector","note":["The unit conversion between meters and source units in this case is `1 meter ≈ 39.37 source units (100/2.54 exactly)`","This value changes proportionally to the physics object's mass (e.g. making the object twice as heavy will result in it having twice the angular inertia)"]}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetInvInertia","parent":"PhysObj","type":"classfunc","description":"Returns 1 divided by the angular inertia. See PhysObj:GetInertia","realm":"Shared","rets":{"ret":{"text":"The inverted angular inertia","name":"invAngularInertia","type":"Vector","warning":"Returns `[0, 0, 0]` on frozen physics objects."}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetInvMass","parent":"PhysObj","type":"classfunc","description":"Returns 1 divided by the physics object's mass (in kilograms).","realm":"Shared","rets":{"ret":{"text":"The inverted mass.","name":"","type":"number","warning":"Returns 0 on frozen physics objects."}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMass","parent":"PhysObj","type":"classfunc","description":"Returns the mass of the physics object.","realm":"Shared","rets":{"ret":{"text":"The mass in kilograms.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMassCenter","parent":"PhysObj","type":"classfunc","description":"Returns the center of mass of the physics object as a local vector.","realm":"Shared","rets":{"ret":{"text":"The center of mass of the physics object.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMaterial","parent":"PhysObj","type":"classfunc","description":"Returns the [physical material](https://developer.valvesoftware.com/wiki/Material_surface_properties) ($surfaceprop) of the physics object.\n\nSee util.GetSurfaceData for a function that adds these types as well as further explanation of what they are.","realm":"Shared","rets":{"ret":{"text":"The physical material name. ($surfaceprop)","name":"","type":"string"}}},"example":{"description":"Play an appropriate sound when we hit something.","code":"function ENT:Initialize()\n\tlocal phys = self.Entity:GetPhysicsObject()\n\tif IsValid(phys) then \n\t\tself.ImpactSound = util.GetSurfaceData(util.GetSurfaceIndex(phys:GetMaterial())).impactHardSound\n\tend\nend\n\nfunction ENT:PhysicsCollide(data, physobj)\n\tif (data.Speed > 50) then\n\t\tself:EmitSound(Sound(self.ImpactSound))\n\tend\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMesh","parent":"PhysObj","type":"classfunc","description":"Returns the physics mesh of the object which is used for physobj-on-physobj collision.","realm":"Shared","rets":{"ret":{"text":"Table of Structures/MeshVertexs where each three vertices represent a triangle. Returns nil if the physics object is a sphere.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMeshConvexes","parent":"PhysObj","type":"classfunc","description":"Returns all convex physics meshes of the object. See Entity:PhysicsInitMultiConvex for more information.","realm":"Shared","rets":{"ret":{"text":"Table of Structures/MeshVertexs where each Structures/MeshVertex is an independent convex mesh and each three vertices represent a triangle. Returns nil if the physics object is a sphere.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetName","parent":"PhysObj","type":"classfunc","description":"Returns the name of the physics object.","realm":"Shared","rets":{"ret":{"text":"The name of the physics object.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPos","parent":"PhysObj","type":"classfunc","description":"Returns the position of the physics object.","realm":"Shared","rets":{"ret":{"text":"The position in world coordinates. (`source units`)","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPositionMatrix","parent":"PhysObj","type":"classfunc","description":"Returns the position and angle of the physics object as a 3x4 matrix (VMatrix is 4x4 so the fourth row goes unused). The first three columns store the angle as a [rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix), and the fourth column stores the position vector.","realm":"Shared","rets":{"ret":{"text":"The position and angle matrix.","name":"","type":"VMatrix"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetRotDamping","parent":"PhysObj","type":"classfunc","description":"Returns the rotation damping of the physics object.","realm":"Shared","rets":{"ret":{"text":"The rotation damping","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetShadowAngles","parent":"PhysObj","type":"classfunc","description":"Returns the angles of the PhysObj shadow. See PhysObj:UpdateShadow.","realm":"Shared","rets":{"ret":{"text":"The angles of the PhysObj shadow.","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetShadowPos","parent":"PhysObj","type":"classfunc","description":"Returns the position of the PhysObj shadow. See PhysObj:UpdateShadow.","realm":"Shared","rets":{"ret":{"text":"The position of the PhysObj shadow.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSpeedDamping","parent":"PhysObj","type":"classfunc","description":"Returns the speed damping of the physics object.","realm":"Shared","rets":{"ret":{"text":"speedDamping","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetStress","parent":"PhysObj","type":"classfunc","description":"Returns the internal and external stress of the entity.","realm":"Server","rets":{"ret":[{"text":"The external stress (`𝜎𝑒`). It's the value of a giving force to other entities (in kg).","name":"","type":"number"},{"text":"The internal stress (`𝜎𝑖`). It's the value of a receiving force from other entities (in kg).","name":"","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetSurfaceArea","parent":"PhysObj","type":"classfunc","description":"Returns the surface area of the physics object in source-units². Or nil if the PhysObj is a generated sphere or box.","realm":"Shared","rets":{"ret":{"text":"The surface area or `nil` if the PhysObj is a generated sphere or box.","name":"","type":"number|nil"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetVelocity","parent":"PhysObj","type":"classfunc","description":"Returns the absolute directional velocity of the physobject.","realm":"Shared","rets":{"ret":{"text":"velocity","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetVelocityAtPoint","parent":"PhysObj","type":"classfunc","description":"Returns the world velocity of a point in world coordinates about the object. This is useful for objects rotating around their own axis/origin.","realm":"Shared","args":{"arg":{"text":"A point to test in world space coordinates","name":"point","type":"Vector"}},"rets":{"ret":{"text":"Velocity at the given point","name":"velocity","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetVolume","parent":"PhysObj","type":"classfunc","description":"Returns the volume in source units³. Or nil if the PhysObj is a generated sphere or box.","realm":"Shared","rets":{"ret":{"text":"The volume or `nil` if the PhysObj is a generated sphere or box.","name":"","type":"number|nil"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"HasGameFlag","parent":"PhysObj","type":"classfunc","description":"Returns whenever the specified flag(s) is/are set.","realm":"Shared","args":{"arg":{"text":"Bitflag, see Enums/FVPHYSICS.","name":"flags","type":"number"}},"rets":{"ret":{"text":"If flag was set or not","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsAsleep","parent":"PhysObj","type":"classfunc","description":"Returns whether the physics object is \"sleeping\".\n\nSee PhysObj:Sleep for more information.","realm":"Shared","rets":{"ret":{"text":"Whether the physics object is sleeping.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsCollisionEnabled","parent":"PhysObj","type":"classfunc","description":"Returns whenever the entity is able to collide or not.","realm":"Shared","rets":{"ret":{"text":"isCollisionEnabled","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsDragEnabled","parent":"PhysObj","type":"classfunc","description":"Returns whenever the entity is affected by drag.","realm":"Shared","rets":{"ret":{"text":"dragEnabled","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsGravityEnabled","parent":"PhysObj","type":"classfunc","description":"Returns whenever the entity is affected by gravity.","realm":"Shared","rets":{"ret":{"text":"`true` if the gravity is enabled, `false` otherwise","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsMotionEnabled","parent":"PhysObj","type":"classfunc","description":"Returns if the physics object can move itself (by velocity, acceleration)","realm":"Shared","rets":{"ret":{"text":"`true` if the motion is enabled, `false` otherwise.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsMoveable","parent":"PhysObj","type":"classfunc","description":"Returns whenever the entity is able to move.","realm":"Shared","rets":{"ret":{"text":"movable","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsPenetrating","parent":"PhysObj","type":"classfunc","description":"Returns whenever the physics object is penetrating another physics object.\n\nThis is internally implemented as `PhysObj:HasGameFlag( FVPHYSICS_PENETRATING )` and thus is only updated for non-static physics objects.","realm":"Shared","rets":{"ret":{"text":"Whether the physics object is penetrating another object.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsValid","parent":"PhysObj","type":"classfunc","description":"Returns if the physics object is valid/not NULL.","realm":"Shared","rets":{"ret":{"text":"Whether the physics object is valid or not.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"LocalToWorld","parent":"PhysObj","type":"classfunc","description":{"text":"Translates a vector in the physics object's local space into worldspace coordinates.","note":"Internally transforms the vector by the PhysObj:GetPositionMatrix.\n\nSo in GLua it approximates to:\n```\nlocal matrixWorldTransform = PhysObj:GetPositionMatrix()\nlocal vecWorldspaced = Vector()\nvecWorldspaced:Set( vecLocal )\nvecWorldspaced:Mul( matrixWorldTransform )\n\nreturn vecWorldspaced\n```"},"realm":"Shared","args":{"arg":{"text":"A vector in the physics object's local space.","name":"vecLocal","type":"Vector"}},"rets":{"ret":{"text":"The corresponding worldspace vector.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"LocalToWorldVector","parent":"PhysObj","type":"classfunc","description":{"text":"Rotationally transforms a vector in the physics object's local space by the PhysObj:GetPositionMatrix.","note":"In contrast to PhysObj:LocalToWorld, this function doesn't translate the vector."},"realm":"Shared","args":{"arg":{"text":"A vector in the physics object's local space.","name":"vecLocal","type":"Vector"}},"rets":{"ret":{"text":"The resulting vector from the rotational transformation.","name":"","type":"Vector"}}},"example":{"description":"Displays the forward, right, and up directions of the physics object the player's looking at, using debugoverlay.","code":"local vector_forward = Vector( 1, 0, 0 )\nlocal vector_right = Vector( 0, -1, 0 )\nlocal vector_up = Vector( 0, 0, 1 )\n\nlocal color_forward = Color( 255, 0, 0 )\nlocal color_right = Color( 255, 0, 255 ) -- Note: Green's taken for left, so then the inverse for the opposite\nlocal color_up = Color( 0, 0, 255 )\n\nconcommand.Add( 'test_localtoworldvector', function( pPlayer )\n\n\tlocal traceAim = pPlayer:GetEyeTrace()\n\tlocal pEntity = traceAim.Entity\n\n\tif ( not pEntity:IsValid() ) then\n\t\treturn\n\tend\n\n\tlocal pPhysObj = pEntity:GetPhysicsObject()\n\n\tif ( not pPhysObj:IsValid() ) then\n\t\treturn\n\tend\n\n\tlocal vecForward = pPhysObj:LocalToWorldVector( vector_forward )\n\tlocal vecRight = pPhysObj:LocalToWorldVector( vector_right )\n\tlocal vecUp = pPhysObj:LocalToWorldVector( vector_up )\n\n\tlocal vecPos = pPhysObj:GetPos()\n\tdebugoverlay.Line( vecPos, vecPos + vecForward * 48, 5, color_forward, true )\n\tdebugoverlay.Line( vecPos, vecPos + vecRight * 48, 5, color_right, true )\n\tdebugoverlay.Line( vecPos, vecPos + vecUp * 48, 5, color_up, true )\n\nend )","output":{"upload":{"src":"8cd79/8de286f90755a43.jpg","size":"605485","name":"test_localtoworldvector.jpg"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OutputDebugInfo","parent":"PhysObj","type":"classfunc","description":"Prints debug info about the state of the physics object to the console.","realm":"Shared"},"example":{"description":"Outputs physics info about the entity the player is looking at to the console.","code":"Entity(1):GetEyeTrace().Entity:GetPhysicsObject():OutputDebugInfo()","output":"```\n-----------------\nObject: models/props_borealis/bluebarrel001.mdl\nMass: 60.0 (inv 0.017)\nInertia: 8.69, 8.69, 2.46 (inv 0.115, 0.115, 0.406)\nVelocity: 0.00, 0.00, -0.00 \nAng Velocity: 0.00, 0.00, -0.00 \nDamping 0.00 linear, 0.00 angular\nLinear Drag: 0.02, 0.01, 0.01 (factor 1.00)\nAngular Drag: 0.01, 0.02, 0.01 (factor 1.00)\nattached to 5 controllers\n4) sys:friction\n3) sys:friction\n2) sys:friction\n1) vphysics:drag\n0) sys:gravity\nState: Asleep, Collision Enabled, Motion Enabled, Flags 1127 (game 0000, index 0)\nMaterial: plastic_barrel : density(500.0), thickness(0.25), friction(0.80), elasticity(0.01)\nCollisionModel: Compact Surface: 1 convex pieces no outer hull\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RecheckCollisionFilter","parent":"PhysObj","type":"classfunc","description":"Call this when the collision filter conditions change due to this object's state (e.g. changing solid type or collision group)","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RotateAroundAxis","parent":"PhysObj","type":"classfunc","description":"A convinience function for Angle:RotateAroundAxis.","realm":"Shared","args":{"arg":[{"text":"Direction, around which we will rotate","name":"dir","type":"Vector"},{"text":"Amount of rotation, in degrees","name":"ang","type":"number"}]},"rets":{"ret":{"text":"The resulting angle","name":"","type":"Angle"}}},"example":{"description":"Shows that it is the same as Angle:RotateAroundAxis.","code":"local phys = Entity(1):GetEyeTrace().Entity:GetPhysicsObject() -- Our physics object\n\nprint( phys:RotateAroundAxis( Vector( 1, 0, 0 ), 20 ) )\n\nlocal a = phys:GetAngles()\na:RotateAroundAxis( Vector( 1, 0, 0 ), 20 )\nprint( a )","output":"Two exactly the same angles\n\n```\n-27.179 133.246 -23.236\n-27.179 133.246 -23.236\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetAngleDragCoefficient","parent":"PhysObj","type":"classfunc","description":"Sets the amount of [drag](https://en.wikipedia.org/wiki/Drag_(physics)) to apply to a physics object when attempting to rotate.","realm":"Shared","args":{"arg":{"text":"[Drag coefficient](https://en.wikipedia.org/wiki/Drag_coefficient). The bigger this value is, the slower the angles will change.","name":"coefficient","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetAngles","parent":"PhysObj","type":"classfunc","description":"Sets the angles of the physobject in degrees.","realm":"Shared","args":{"arg":{"text":"The new angles of the physobject.","name":"angles","type":"Angle","warning":"The new angle will not be applied on the parent entity while the physics object is asleep (PhysObj:Sleep)"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetAngleVelocity","parent":"PhysObj","type":"classfunc","description":"Sets the specified [angular velocity](https://en.wikipedia.org/wiki/Angular_velocity) on the PhysObj","realm":"Shared","added":"2021.06.09","args":{"arg":{"text":"The new velocity in `degrees/s`. (Local frame)","name":"angularVelocity","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetAngleVelocityInstantaneous","parent":"PhysObj","type":"classfunc","description":"Sets the specified instantaneous [angular velocity](https://en.wikipedia.org/wiki/Angular_velocity) on the PhysObj","realm":"Shared","added":"2021.06.09","args":{"arg":{"text":"The new velocity to set velocity.","name":"angularVelocity","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetBuoyancyRatio","parent":"PhysObj","type":"classfunc","description":"Sets the buoyancy ratio of the physics object. (How well it floats in water)","realm":"Shared","args":{"arg":{"text":"Buoyancy ratio, where 0 is not buoyant at all (like a rock), and 1 is very buoyant (like wood). You can set values larger than 1 for greater effect.","name":"buoyancy","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetContents","parent":"PhysObj","type":"classfunc","description":"Sets the contents flag of the PhysObj.","realm":"Shared","args":{"arg":{"text":"The Enums/CONTENTS.","name":"contents","type":"number{CONTENTS}"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDamping","parent":"PhysObj","type":"classfunc","description":"Sets the linear and angular damping of the physics object.","realm":"Shared","args":{"arg":[{"text":"Linear damping.","name":"linearDamping","type":"number"},{"text":"Angular damping.","name":"angularDamping","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDragCoefficient","parent":"PhysObj","type":"classfunc","description":"Modifies how much drag (air resistance) affects the object.","realm":"Shared","args":{"arg":{"text":"The drag coefficient\nIt can be positive or negative.","name":"drag","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetInertia","parent":"PhysObj","type":"classfunc","description":{"text":"Sets the angular inertia. See PhysObj:GetInertia.","note":"This does not affect linear inertia."},"realm":"Shared","args":{"arg":{"text":"The angular inertia of the object.","name":"angularInertia","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetMass","parent":"PhysObj","type":"classfunc","description":{"text":"Sets the mass of the physics object.","warning":"This resets PhysObj:SetBuoyancyRatio (Recalculated based materials' and the physics objects' densities, latter of which is dependent on mass).\n\nIf you used a custom ratio, you will have to re-set it again after `SetMass`."},"realm":"Shared","args":{"arg":{"text":"The mass in kilograms, in range `[0, 50000]`","name":"mass","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetMaterial","parent":"PhysObj","type":"classfunc","description":{"text":"Sets the material of the physobject.","note":"Impact sounds will only change if this is called on client"},"realm":"Shared","args":{"arg":{"text":"The name of the phys material to use. From this list: [Valve Developer](https://developer.valvesoftware.com/wiki/Material_surface_properties)","name":"materialName","type":"string"}}},"example":{"description":"Randomize the physical properties of an entity","code":"local tbl = {\n\t\"gmod_ice\", -- Makes the entity slide around\n\t\"gmod_bouncy\", -- Makes the entity bouncy\n\t\"gmod_silent\", -- Makes the entity not play sounds on impact\n\t\"flesh\" -- Makes the entity play flesh sounds on impact\n}\n\nlocal phys = SomeEntity:GetPhysicsObject()\n\nif ( IsValid( phys ) ) then\n\n\tphys:SetMaterial( table.Random( tbl ) )\n\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetPos","parent":"PhysObj","type":"classfunc","description":"Sets the position of the physobject.","realm":"Shared","args":{"arg":[{"text":"The new position of the physobject in world coordinates. (`source units`).","name":"position","type":"Vector","warning":"The new position will not be applied on the parent entity while the physics object is asleep (PhysObj:Sleep)"},{"text":"If `true`, temporarily disables collisions of the physics objects just before moving it, then enables collisions back again.","name":"teleport","type":"boolean","default":"false"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetVelocity","parent":"PhysObj","type":"classfunc","description":"Sets the velocity of the physics object for the next iteration.","realm":"Shared","args":{"arg":{"text":"The new velocity of the physics object in `source_unit/s`. (World frame)","name":"velocity","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetVelocityInstantaneous","parent":"PhysObj","type":"classfunc","description":"Sets the velocity of the physics object.","realm":"Shared","args":{"arg":{"text":"The new velocity of the physics object.","name":"velocity","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Sleep","parent":"PhysObj","type":"classfunc","description":"Makes the physics object \"sleep\". The physics object will no longer be moving unless it is \"woken up\" by either a collision with another moving object, or by PhysObj:Wake. \n\nThis is an optimization feature of the physics engine. Normally physics objects will automatically \"sleep\" when not moving for a short while, to save resources, but it can be used for other purposes, for example to temporarily suspend an object mid air.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"UpdateShadow","parent":"PhysObj","type":"classfunc","description":{"text":"Unlike PhysObj:SetPos and PhysObj:SetAngles, this allows the movement of a physobj while leaving physics interactions intact.\n\nThis is used internally by the motion controller of the Gravity Gun , the +use pickup and the Physics Gun, and entities such as the crane.","note":"This is the ideal function to move a physics shadow created with Entity:PhysicsInitShadow or Entity:MakePhysicsObjectAShadow."},"realm":"Shared","args":{"arg":[{"text":"The position we should move to.","name":"targetPosition","type":"Vector"},{"text":"The angle we should rotate towards.","name":"targetAngles","type":"Angle"},{"text":"The frame time to use for this movement, can be generally filled with Global.FrameTime or ENTITY:PhysicsSimulate with the deltaTime. \n\nCan be set to 0 when you need to update the physics object just once.","name":"frameTime","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Wake","parent":"PhysObj","type":"classfunc","description":"Wakes the physics object, so that it will continue to simulate physics/gravity.\n\nSee PhysObj:Sleep for more information.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WorldToLocal","parent":"PhysObj","type":"classfunc","description":"Translates a worldspace vector into the physics object's local space.","realm":"Shared","args":{"arg":{"text":"A worldspace vector.","name":"vec","type":"Vector"}},"rets":{"ret":{"text":"The corresponding local space vector.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WorldToLocalVector","parent":"PhysObj","type":"classfunc","description":{"text":"Rotationally transforms a worldspace vector into the physics object's local space by the inverted PhysObj:GetPositionMatrix.\n\nFor example, in GMod this is used in thrusters, for working out linear force for local acceleration.","note":"In contrast to PhysObj:WorldToLocal, this function doesn't translate the vector."},"realm":"Shared","args":{"arg":{"text":"A worldspace vector.","name":"vec","type":"Vector"}},"rets":{"ret":{"text":"The resulting vector from the rotational transformation.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AccountID","parent":"Player","type":"classfunc","description":{"text":"Returns the player's AccountID part of their full SteamID.\n\nSince this does not include other vital parts of the SteamID such as \"Account Type\" and \"Account Instance\", it should be avoided, as AccountIDs are finite, and can theoretically be the same for multiple valid accounts.\n\nSee Player:SteamID for the text representation of the full SteamID.\nSee Player:SteamID64 for a 64bit representation of the full SteamID.","note":"In a `-multirun` environment, this will return `-1` for all \"copies\" of a player because they are not authenticated with Steam.\n\nFor bots this will return values starting with `0` for the first bot, `1` for the second bot and so on."},"realm":"Shared","rets":{"ret":{"text":"The AccountID of Player's SteamID.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddCleanup","parent":"Player","type":"classfunc","description":{"text":"Adds an entity to the player's clean up list. This uses cleanup.Add internally.","note":"This function is only available in Sandbox and its derivatives."},"realm":"Server","file":{"text":"gamemodes/sandbox/gamemode/player_extension.lua","line":"107-L111"},"args":{"arg":[{"text":"The Cleanup type for this Entity.","name":"type","type":"string"},{"text":"The Entity to add.","name":"ent","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddCount","parent":"Player","type":"classfunc","description":{"text":"Adds an entity to the player's list of entities of the same type. See Player:GetCount to get the current count of entities of an entity type added with this function.","note":"This function is only available in Sandbox and its derivatives."},"realm":"Shared","file":{"text":"gamemodes/sandbox/gamemode/player_extension.lua","line":"72-L91"},"args":{"arg":[{"text":"The type of this Entity.","name":"str","type":"string"},{"text":"The Entity you want to add to the list.","name":"ent","type":"Entity"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddDeaths","parent":"Player","type":"classfunc","description":"Adds the provided amount to the player's death count.","realm":"Server","args":{"arg":{"text":"The amount to add to the death count.","name":"count","type":"number"}}},"example":{"description":"Adds 2 deaths to player","code":"Entity( 1 ):AddDeaths( 2 )","output":"Player1 has 2 extra deaths on the scoreboard relative to their old score."},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddFrags","parent":"Player","type":"classfunc","description":"Adds the provided amount to the player's frag/kill count.","realm":"Server","args":{"arg":{"text":"The amount to add.","name":"count","type":"number"}}},"example":{"description":"Adds 2 frags to player","code":"Entity( 1 ):AddFrags( 2 )","output":"Player1 has 2 extra frags on the scoreboard relative to their old score."},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddFrozenPhysicsObject","parent":"Player","type":"classfunc","description":"Adds an entity to the player's list of frozen objects.","realm":"Server","file":{"text":"gamemodes/base/gamemode/obj_player_extend.lua","line":"9-L30"},"args":{"arg":[{"text":"The Entity to add.","name":"ent","type":"Entity"},{"text":"The physics object of the Entity.","name":"physobj","type":"PhysObj"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddPlayerOption","parent":"Player","type":"classfunc","description":"Sets up the voting system for the player.\nThis is a really barebone system. By calling this a vote gets started, when the player presses 0-9 the callback function gets called along with the key the player pressed. Use the draw callback to draw the vote panel.","realm":"Client","file":{"text":"lua/includes/extensions/client/player.lua","line":"21-L39"},"args":{"arg":[{"text":"Name of the vote","name":"name","type":"string"},{"text":"Time until the vote expires","name":"timeout","type":"number"},{"text":"The function to be run when the player presses 0-9 while a vote is active.","name":"vote_callback","type":"function","callback":{"arg":{"text":"Which option the player pressed, 1-9 and 0 being the very last option.","name":"voteNum","type":"number"},"ret":{"text":"Return true to remove this option from the vote.","name":"","type":"boolean"}}},{"text":"Used to draw the vote panel.","name":"draw_callback","type":"function"}]}},"example":{"description":"Simple example. Prints player's choice in chat.","code":"function AfterChoice( num ) -- This is callback after we press number (Argument #3)\n\tchat.AddText( \"Your rate is \" .. num .. \". Thanks!\" )\n\n\treturn true -- Return true to close vote\nend\n\nlocal BlackTransparent = Color( 0, 0, 0, 200 )\nfunction VisualVote() -- This is drawing function (Argument #4)\n    draw.RoundedBox( 4, ScrW() / 2 - 300, ScrH() / 2 - 25, 600, 50, BlackTransparent )\n    draw.SimpleText( \"Rate our server by scale of zero to nine. Use number line to vote.\", \"Trebuchet24\", ScrW() / 2 , ScrH() / 2, color_white, 1, 1 )\nend\n\nLocalPlayer():AddPlayerOption( \"SelectWeapon\", 30, AfterChoice, VisualVote ) -- Creates new vote"},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddVCDSequenceToGestureSlot","parent":"Player","type":"classfunc","description":{"text":"Plays a sequence directly from a sequence number, similar to Player:AnimRestartGesture. This function has the advantage to play sequences that haven't been bound to an existing Enums/ACT","warning":"This is not automatically networked. This function has to be called on the client to be seen by said client."},"realm":"Shared","args":{"arg":[{"text":"Gesture slot using Enums/GESTURE_SLOT","name":"slot","type":"number"},{"text":"The sequence ID to play, can be retrieved with Entity:LookupSequence.","name":"sequenceId","type":"number"},{"text":"The cycle to start the animation at, ranges from 0 to 1.","name":"cycle","type":"number"},{"text":"If the animation should not loop. true = stops the animation, false = the animation keeps playing.","name":"autokill","type":"boolean","default":"false"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Alive","parent":"Player","type":"classfunc","description":"Checks if the player is alive. \n\nPlayer specific implementation of Entity:Alive, the value is synchronized to the client.","realm":"Shared","rets":{"ret":{"text":"Whether the player is alive","name":"","type":"boolean"}}},"example":{"description":"Loops through all the players and kills alive ones.","code":"for i, ply in ipairs( player.GetAll() ) do\n\tif ply:Alive() then\n\t\tply:Kill()\n\tend\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AllowFlashlight","parent":"Player","type":"classfunc","description":"Sets if the player can toggle their flashlight. Function exists on both the server and client but has no effect when ran on the client.\n\nThis is a Lua method that internally uses GM:PlayerSwitchFlashlight. If current gamemode overwrites that hook and doesn't respect Player:CanUseFlashlight, this function will not have any effect.","realm":"Shared","file":{"text":"lua/includes/extensions/player.lua","line":"182"},"args":{"arg":{"text":"True allows flashlight toggling","name":"canFlashlight","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AllowImmediateDecalPainting","parent":"Player","type":"classfunc","description":"Lets the player spray their decal without delay","realm":"Server","args":{"arg":{"text":"Allow or disallow","name":"allow","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AnimResetGestureSlot","parent":"Player","type":"classfunc","description":"Resets player gesture in selected slot.","realm":"Shared","args":{"arg":{"text":"Slot to reset. See the Enums/GESTURE_SLOT.","name":"slot","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AnimRestartGesture","parent":"Player","type":"classfunc","description":{"text":"Restart a gesture on a player, within a gesture slot.","warning":"This is not automatically networked. This function has to be called on the client to be seen by said client."},"realm":"Shared","args":{"arg":[{"text":"Gesture slot using Enums/GESTURE_SLOT","name":"slot","type":"number"},{"text":"The activity ( see Enums/ACT ) or sequence that should be played","name":"activity","type":"number"},{"text":"Whether the animation should be automatically stopped. true = stops the animation, false = the animation keeps playing/looping","name":"autokill","type":"boolean","default":"false"}]}},"example":{"description":"Defines part of a SWEP with pistol whipping functionality by using a pistol hold type and AnimRestartGesture for the melee attack animation.","code":"function SWEP:Initialize()\n\tself:SetHoldType(\"pistol\")\nend\n\nfunction SWEP:PrimaryAttack()\n\n\t-- Weapon attack delay\n\tself:SetNextPrimaryFire(CurTime()+0.5)\n\n\t-- Get entity in front of us\n\tlocal tr = util.TraceLine(util.GetPlayerTrace(self:GetOwner()))\n\t\n\tlocal ent = tr.Entity\n\t\n\t-- If there's an enemy under 50 units in front of us\n\tif(IsValid(ent) && self:GetOwner():GetShootPos():Distance(tr.HitPos) < 50) then\n\t\n\t\t-- Play the melee attack animation\n\t\tself:GetOwner():AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE, true)\n\t\t\n\t\t-- Create damage info (server-side)\n\t\tif SERVER then\n\t\t\n\t\t\tlocal dmg = DamageInfo()\t\t\n\t\t\tdmg:SetDamage(math.random(5, 10))\n\t\t\tdmg:SetAttacker(self:GetOwner())\n\t\t\tdmg:SetInflictor(self)\n\t\t\tdmg:SetDamageForce(self:GetOwner():GetAimVector()*300)\n\t\t\tdmg:SetDamagePosition(tr.HitPos)\n\t\t\tdmg:SetDamageType(DMG_CLUB)\n\t\t\n\t\t\t-- Apply damage to enemy\n\t\t\tent:TakeDamageInfo(dmg)\n\t\t\t\n\t\tend\n\t\t\n\t\t-- Play impact sound\n\t\tent:EmitSound(\"physics/flesh/flesh_impact_bullet\"..math.random(1, 5)..\".wav\")\n\t\t\n\t\t-- Make viewmodel pistol whip effect\n\t\tself:GetOwner():ViewPunch(Angle(0, 45, 0))\n\t\t\n\telse\n\t\n\t\t-- Typical pistol shot code goes here\n\t\t-- Some can be found in 'weapon_base/shared.lua'\n\t\n\tend\n\t\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AnimRestartMainSequence","parent":"Player","type":"classfunc","description":"Restarts the main animation on the player, has the same effect as calling Entity:SetCycle( 0 ).","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AnimSetGestureSequence","parent":"Player","type":"classfunc","description":"Sets the sequence of the animation playing in the given gesture slot.","realm":"Shared","args":{"arg":[{"text":"The gesture slot. See Enums/GESTURE_SLOT","name":"slot","type":"number"},{"text":"Sequence ID to set.","name":"sequenceID","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AnimSetGestureWeight","parent":"Player","type":"classfunc","description":"Sets the weight of the animation playing in the given gesture slot.","realm":"Shared","args":{"arg":[{"text":"The gesture slot. See Enums/GESTURE_SLOT","name":"slot","type":"number"},{"text":"The weight this slot should be set to. Value must be ranging from 0 to 1.","name":"weight","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Armor","parent":"Player","type":"classfunc","description":"Returns the player's armor.","realm":"Shared","rets":{"ret":{"text":"The player's armor.","name":"","type":"number"}}},"example":{"description":"Loops through all the players and checks if they have any armor, if they do not, then sets their armor to 100.","code":"for i, ply in ipairs( player.GetAll( ) ) do\n    if ply:Armor() == 0 then\n         ply:SetArmor( 100 )\n    end\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Ban","parent":"Player","type":"classfunc","description":"Bans the player from the server for a certain amount of minutes.","realm":"Server","args":{"arg":[{"text":"Duration of the ban in minutes (0 is permanent)","name":"minutes","type":"number"},{"text":"Whether to kick the player after banning them or not","name":"kick","type":"boolean","default":"false"}]}},"example":{"description":"Kicks and bans the player for a day.","code":"Entity( 1 ):Ban( 1440, true )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"CanUseFlashlight","parent":"Player","type":"classfunc","description":{"text":"Returns true if the player's flashlight hasn't been disabled by Player:AllowFlashlight.","note":"This is not synchronized between clients and server automatically!"},"realm":"Shared","file":{"text":"lua/includes/extensions/player.lua","line":"183"},"rets":{"ret":{"text":"Whether the player can use flashlight.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ChatPrint","parent":"Player","type":"classfunc","description":{"text":"Prints a string to the chatbox of the client.","warning":"Just like the usermessage, this function is affected by the 255 byte limit!"},"realm":"Shared","args":{"arg":{"text":"String to be printed","name":"message","type":"string"}}},"example":{"description":"Prints \"Hello World\" to chat of all players","code":"for i, ply in ipairs( player.GetAll() ) do\n\tply:ChatPrint( \"Hello World\" )\nend","output":"Hello World (In chatbox)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CheckLimit","parent":"Player","type":"classfunc","description":{"text":"Checks if the limit of an entity type added by Player:AddCount is hit or not. If it's hit, it will call the GM:PlayerCheckLimit hook, and call Player:LimitHit if the hook doesn't return `false`.\n\nThis will always return `true` in singleplayer, as singleplayer does not have limits.","note":"This function is only available in Sandbox and its derivatives."},"realm":"Shared","file":{"text":"gamemodes/sandbox/gamemode/player_extension.lua","line":"9-L32"},"args":{"arg":{"text":"The entity type to check the limit for. Default types:\n* \"constraints\"\n* \"props\"\n* \"ragdolls\"\n* \"vehicles\"\n* \"effects\"\n* \"balloons\"\n* \"cameras\"\n* \"npcs\"\n* \"sents\"\n* \"dynamite\"\n* \"lamps\"\n* \"lights\"\n* \"wheels\"\n* \"thrusters\"\n* \"hoverballs\"\n* \"buttons\"\n* \"emitters\"","name":"str","type":"string"}},"rets":{"ret":{"text":"Returns `true` if the limit of this type is not hit, `false` otherwise.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ConCommand","parent":"Player","type":"classfunc","description":{"text":"Runs the concommand on the player. This does not work on bots. If used clientside, always runs the command on the local player.\n\nIf you wish to directly modify the movement input of bots, use GM:StartCommand instead.","note":"Some commands/convars are blocked from being run/changed using this function, usually to prevent harm/annoyance to clients. For a list of blocked commands, see Blocked ConCommands."},"realm":"Shared","args":{"arg":{"text":"command to run","name":"command","type":"string"}}},"example":{"description":"Kills the player using the concommand","code":"Entity( 1 ):ConCommand( \"kill\" )","output":"The Player1 dies."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CreateRagdoll","parent":"Player","type":"classfunc","description":"Creates the player's death ragdoll entity and deletes the old one.\n\nThis is normally used when a player dies, to create their death ragdoll.\n\nThe ragdoll will be created with the player's properties such as Position, Angles, PlayerColor, Velocity and Model.\n\nYou can retrieve the entity this creates with Player:GetRagdollEntity.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"CrosshairDisable","parent":"Player","type":"classfunc","description":"Disables the default player's crosshair. Can be reenabled with Player:CrosshairEnable. This will affect WEAPON:DoDrawCrosshair.","realm":"Server"},"example":{"description":"Disables crosshair of the first player on the server.","code":"Entity( 1 ):CrosshairDisable()"},"realms":["Server"],"type":"Function"},
{"function":{"name":"CrosshairEnable","parent":"Player","type":"classfunc","description":"Enables the player's crosshair, if it was previously disabled via Player:CrosshairDisable.","realm":"Server"},"example":{"description":"Enables crosshair of the first player on the server, if it was disabled.","code":"Entity( 1 ):CrosshairEnable()"},"realms":["Server"],"type":"Function"},
{"function":{"name":"Crouching","parent":"Player","type":"classfunc","description":"Returns whether the player is crouching or not (FL_DUCKING flag).","realm":"Shared","rets":{"ret":{"text":"Whether the player is crouching.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Deaths","parent":"Player","type":"classfunc","description":"Returns the player's death count","realm":"Shared","rets":{"ret":{"text":"The number of deaths the player has had.","name":"","type":"number"}}},"example":{"description":"If the player's deaths are over 10, then they cannot spawn.","code":"hook.Add( \"PlayerDeathThink\", \"BlockSpawning\", function( ply, ent, att )\n\treturn ply:Deaths() < 10 -- If less than 10 deaths then allow to spawn\nend )","output":"The player will not be able to spawn after they've died 10 times."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DebugInfo","parent":"Player","type":"classfunc","description":"Prints the players' name and position to the console.","realm":"Shared","file":{"text":"lua/includes/extensions/player.lua","line":"48-L53"}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DetonateTripmines","parent":"Player","type":"classfunc","description":"Detonates all tripmines belonging to the player.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"DisableWorldClicking","parent":"Player","type":"classfunc","description":"Disables world clicking for given player. See Panel:SetWorldClicker and Player:IsWorldClickingDisabled.","realm":"Server","added":"2023.01.25","args":{"arg":{"text":"Whether the world clicking should be disabled.","name":"disable","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"DoAnimationEvent","parent":"Player","type":"classfunc","description":"Sends a third person animation event to the player.\n\nCalls GM:DoAnimationEvent with PLAYERANIMEVENT_CUSTOM_GESTURE as the event, data as the given data.","realm":"Shared","args":{"arg":{"text":"The data to send.","name":"data","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DoAttackEvent","parent":"Player","type":"classfunc","description":"Starts the player's attack animation. The attack animation is determined by the weapon's HoldType.\n\nSimilar to other animation event functions, calls GM:DoAnimationEvent with PLAYERANIMEVENT_ATTACK_PRIMARY as the event and no extra data.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DoCustomAnimEvent","parent":"Player","type":"classfunc","description":"Sends a specified third person animation event to the player.\n\nCalls GM:DoAnimationEvent with specified arguments.","realm":"Shared","args":{"arg":[{"text":"The event to send. See Enums/PLAYERANIMEVENT.","name":"event","type":"number"},{"text":"The data to send alongside the event.","name":"data","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DoReloadEvent","parent":"Player","type":"classfunc","description":"Sends a third person reload animation event to the player.\n\nSimilar to other animation event functions, calls GM:DoAnimationEvent with PLAYERANIMEVENT_RELOAD as the event and no extra data.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DoSecondaryAttack","parent":"Player","type":"classfunc","description":"Sends a third person secondary fire animation event to the player.\n\nSimilar to other animation event functions, calls GM:DoAnimationEvent with PLAYERANIMEVENT_ATTACK_SECONDARY as the event and no extra data.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DrawViewModel","parent":"Player","type":"classfunc","description":"Show/Hide the player's weapon's viewmodel.","realm":"Shared","args":{"arg":[{"text":"Should draw","name":"draw","type":"boolean"},{"text":"Which view model to show/hide, 0-2.","name":"vm","type":"number","default":"0"}]}},"example":{"description":"Create a ConVar object on the client realm to enable/disable the viewmodel.","code":"local cvarObject = CreateClientConVar(\"nogun\", \"1\", true, false, \"Hide the current viewmodel.\") -- Create the ConVar object\n\nhook.Add(\"HUDPaint\", \"draw_viewmodel\", function()\n\tLocalPlayer():DrawViewModel( cvarObject:GetBool() ) -- Call ConVar:GetBool() inside the parameters of DrawViewModel\nend)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DrawWorldModel","parent":"Player","type":"classfunc","description":"Show/Hide the player's weapon's worldmodel.","realm":"Server","args":{"arg":{"text":"Should draw","name":"draw","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"DropNamedWeapon","parent":"Player","type":"classfunc","description":"Drops the players' weapon of a specific class.","realm":"Server","args":{"arg":[{"text":"The class to drop.","name":"class","type":"string"},{"text":"If set, launches the weapon at given position. There is a limit to how far it is willing to throw the weapon. Overrides velocity argument.","name":"target","type":"Vector","default":"nil"},{"text":"If set and previous argument is unset, launches the weapon with given velocity. If the velocity is higher than 400, it will be clamped to 400.","name":"velocity","type":"Vector","default":"nil"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"DropObject","parent":"Player","type":"classfunc","description":"Drops any object the player is currently holding with either Gravity Gun, Physics Gun or `+use` (E key)\n\nSee also Entity:ForcePlayerDrop.","realm":"Server","args":{"arg":{"text":"Only drop if the held entity is this entity. If left blank, drop any held entity.","name":"entity","type":"Entity","default":"nil"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"DropWeapon","parent":"Player","type":"classfunc","description":"Forces the player to drop the specified weapon","realm":"Server","args":{"arg":[{"text":"Weapon to be dropped. If unset, will default to the currently equipped weapon.","name":"weapon","type":"Weapon","default":"nil"},{"text":"If set, launches the weapon at given position. There is a limit to how far it is willing to throw the weapon. Overrides velocity argument.","name":"target","type":"Vector","default":"nil"},{"text":"If set and previous argument is unset, launches the weapon with given velocity. If the velocity is higher than 400, it will be clamped to 400.","name":"velocity","type":"Vector","default":"nil"}]}},"example":[{"description":"A console command that drops all the player's weapons","code":"concommand.Add( \"drop_weapons\", function( ply )\n\tif ( ply:IsValid() ) then\n\t\t-- Loop through all player weapons and drop them.\n\t\tfor _, wep in ipairs( ply:GetWeapons() ) do\n\t\t\tply:DropWeapon( wep )\n\t\tend\n\tend\nend )"},{"description":"A console command that drops only the currently equipped weapon","code":"concommand.Add( \"drop_weapon\", function( ply )\n\tif ( ply:IsValid() ) then\n\t\tply:DropWeapon()\n\tend\nend )"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"EnterVehicle","parent":"Player","type":"classfunc","description":"Force puts the player into a specified vehicle.\nThis **does not** bypass GM:CanPlayerEnterVehicle.","realm":"Server","args":{"arg":{"text":"Vehicle the player will enter","name":"vehicle","type":"Vehicle"}}},"example":{"description":"Enters the player into the vehicle they're looking at","code":"local jeep = Entity( 1 ):GetEyeTrace().Entity\nEntity( 1 ):EnterVehicle( jeep )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"EquipSuit","parent":"Player","type":"classfunc","description":"Equips the player with the HEV suit.\n\nAllows the player to zoom, walk slowly, sprint, pickup armor batteries, use the health and armor stations and also shows the HUD.\n\nThe player also emits a flatline sound on death, which can be overridden with GM:PlayerDeathSound.\n\nThe player is automatically equipped with the suit on spawn, if you wish to stop that, use Player:RemoveSuit.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"ExitLadder","parent":"Player","type":"classfunc","description":"Forces the player off the current ladder if they are on one.","realm":"Server","added":"2025.02.06"},"realms":["Server"],"type":"Function"},
{"function":{"name":"ExitVehicle","parent":"Player","type":"classfunc","description":"Forces the player to exit the vehicle if they're in one.\n\nThis function will bypass GM:CanExitVehicle. See also GM:PlayerLeaveVehicle","realm":"Server"},"example":{"description":"Makes player 1 leave their vehicle if they're in one.","code":"Entity( 1 ):ExitVehicle()","output":"Player 1 will exit the the vehicle that they're currently in."},"realms":["Server"],"type":"Function"},
{"function":{"name":"Flashlight","parent":"Player","type":"classfunc","description":{"text":"Enables/Disables the player's flashlight.\n\nPlayer:CanUseFlashlight must be true in order for the player's flashlight to be changed.\nGM:PlayerSwitchFlashlight can block this function.","note":"Added in [2025.11.12](https://gmod.facepunch.com/changelist/4026), the `gmod_flashlight` attachment is used as a source for the player's flashlight. In thirdperson, the playermodel and weapon worldmodel are checked; in firstperson, the viewmodel is checked. If the attachment isn't found, default engine functionality is used.\n\nThe light sprite attached to the playermodel when the flashlight is on will also follow the playermodel's `gmod_flashlight` attachment if it exists."},"realm":"Server","args":{"arg":{"text":"Turns the flashlight on/off","name":"isOn","type":"boolean"}}},"example":{"description":"Turns off and disables the player's flashlight","code":"Entity( 1 ):Flashlight( false )\nEntity( 1 ):AllowFlashlight( false )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"FlashlightIsOn","parent":"Player","type":"classfunc","description":"Returns true if the player's flashlight is on.","realm":"Shared","rets":{"ret":{"text":"Whether the player's flashlight is on.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Frags","parent":"Player","type":"classfunc","description":{"text":"Returns the amount of frags a player has.","note":"The value will change depending on the player's kill or suicide: +1 for a kill, -1 for a suicide."},"realm":"Shared","rets":{"ret":{"text":"frags","name":"","type":"number"}}},"example":{"description":"Prints the users frags in console.","code":"print( Entity( 1 ):Frags() )","output":"`0`"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Freeze","parent":"Player","type":"classfunc","description":"Freeze the player. Frozen players cannot move, look around, or attack. Key bindings are still called. Similar to Player:Lock but the player can still take damage.\n\nManages the FL_FROZEN flag on the player.","realm":"Server","file":{"text":"lua/includes/extensions/player.lua","line":"212-L220"},"args":{"arg":{"text":"Whether the player should be frozen.","name":"frozen","type":"boolean","default":"false"}}},"example":{"description":"Freezes all players","code":"for _, ply in ipairs( player.GetAll() ) do\n    ply:Freeze( true )\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetActiveWeapon","parent":"Player","type":"classfunc","description":"Returns the player's active weapon.\n\nIf used on a Global.LocalPlayer() and the player is spectating another player with `OBS_MODE_IN_EYE`, the weapon returned will be of the spectated player.","realm":"Shared","rets":{"ret":{"text":"The weapon the player currently has equipped or NULL if the player doesn't have an active weapon eg. when they're dead.","name":"","type":"Weapon"}}},"example":{"description":"Prints the player's active weapon's class name.","code":"print( Entity( 1 ):GetActiveWeapon():GetClass() )","output":"The active weapon's class. For example, if you are holding the tool gun then this will be \"gmod_tool\"."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetActivity","parent":"Player","type":"classfunc","description":"Returns the player's current activity.","added":"2021.03.31","realm":"Server","rets":{"ret":{"text":"The player's current activity. See Enums/ACT.","name":"act","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetAimVector","parent":"Player","type":"classfunc","description":"Returns the direction that the player is aiming.","realm":"Shared","rets":{"ret":{"text":"The direction vector of players aim","name":"","type":"Vector"}}},"example":{"description":"Launches the player in the direction they're facing.","code":"local ply = Entity( 1 )\nply:SetVelocity( ply:GetAimVector() * 1000 )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAllowFullRotation","parent":"Player","type":"classfunc","description":"Returns true if the players' model is allowed to rotate around the pitch and roll axis.","realm":"Shared","rets":{"ret":{"text":"Allowed","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAllowWeaponsInVehicle","parent":"Player","type":"classfunc","description":"Returns whether the player is allowed to use their weapons in a vehicle or not.","realm":"Shared","rets":{"ret":{"text":"Whether the player is allowed to use their weapons in a vehicle or not.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAmmo","parent":"Player","type":"classfunc","description":"Returns a table of all ammo the player has.","realm":"Shared","rets":{"ret":{"text":"A table with the following format\n* number Key - AmmoID to be used with functions like game.GetAmmoName.\n* number Value - Amount of ammo the player has of this kind.","name":"","type":"table"}}},"example":{"description":"Output ammo table of the default Sandbox weapon loadout.","code":"PrintTable( Entity( 1 ):GetAmmo() )","output":"```\n1\t=\t130\n2\t=\t6\n3\t=\t256\n4\t=\t256\n5\t=\t32\n6\t=\t36\n7\t=\t64\n8\t=\t3\n10\t=\t6\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAmmoCount","parent":"Player","type":"classfunc","description":"Gets the amount of ammo the player has.","realm":"Shared","args":{"arg":{"text":"The ammunition type. Can be either number ammo ID or string ammo name.","name":"ammotype","type":"any"}},"rets":{"ret":{"text":"The amount of ammo player has in reserve.","name":"","type":"number"}}},"example":[{"description":"A function that returns the ammo for the weapon the player is currently holding.","code":"function GetAmmoForCurrentWeapon( ply )\n\tif ( !IsValid( ply ) ) then return -1 end\n\n\tlocal wep = ply:GetActiveWeapon()\n\tif ( !IsValid( wep ) ) then return -1 end\n \n\treturn ply:GetAmmoCount( wep:GetPrimaryAmmoType() )\nend","output":"31"},{"description":"Example usage. \"pistol\" ammo type has ID of 3.","code":"print( Entity( 1 ):GetAmmoCount( 3 ) )\nprint( Entity( 1 ):GetAmmoCount( \"3\" ) )\nprint( Entity( 1 ):GetAmmoCount( \"pistol\" ) )","output":"```\n255\n0\n255\n```"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAvoidPlayers","parent":"Player","type":"classfunc","description":"Gets if the player will be pushed out of nocollided players.","realm":"Shared","rets":{"ret":{"text":"pushed","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetCanWalk","parent":"Player","type":"classfunc","description":"Returns true if the player is able to walk using the (default) alt key.","realm":"Shared","rets":{"ret":{"text":"AbleToWalk","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetCanZoom","parent":"Player","type":"classfunc","description":"Determines whenever the player is allowed to use the zoom functionality.","realm":"Shared","rets":{"ret":{"text":"canZoom","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetClassID","parent":"Player","type":"classfunc","description":"Returns the player's class id.","realm":"Shared","rets":{"ret":{"text":"The player's class id.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetCount","parent":"Player","type":"classfunc","description":{"text":"Gets the total amount of entities of an entity type added by Player:AddCount.\n\nDefault types:\n```\nballoons\nbuttons\ncameras\ndynamite\neffects\nemitters\nhoverballs\nlamps\nlights\nnpcs\nprops\nragdolls\nsents\nthrusters\nvehicles\nwheels\n```","note":"This function is only available in Sandbox and its derivatives."},"realm":"Shared","file":{"text":"gamemodes/sandbox/gamemode/player_extension.lua","line":"34-L70"},"args":{"arg":[{"text":"Type to get entity count of.","name":"type","type":"string"},{"text":"If specified, it will reduce the counter by this value. Works only serverside.","name":"minus","type":"number","default":"0"}]},"rets":{"ret":{"text":"The returned count.","name":"count","type":"number"}}},"example":{"code":"print( Entity(1):GetCount(\"props\") )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetCrouchedWalkSpeed","parent":"Player","type":"classfunc","description":"Returns the crouched walk speed multiplier.\n\nSee also Player:GetWalkSpeed and Player:SetCrouchedWalkSpeed.","realm":"Shared","rets":{"ret":{"text":"The crouched walk speed multiplier.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetCurrentCommand","parent":"Player","type":"classfunc","description":{"text":"Returns the last command which was sent by the specified player. This can only be called on the player which Global.GetPredictionPlayer() returns.","note":"When called clientside in singleplayer during WEAPON:Think, it will return nothing as the hook is not technically predicted in that instance. See the note on the page.","bug":{"text":"This will fail in GM:StartCommand.","issue":"3302"}},"realm":"Shared","rets":{"ret":{"text":"Last user commands","name":"","type":"CUserCmd"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetCurrentViewOffset","parent":"Player","type":"classfunc","description":"Gets the current applied view offset, which transitions between the player's standing and ducked view offset depending on their duck state.\n\nDo not confuse with Player:GetViewOffset and Player:GetViewOffsetDucked, which always return the standing or ducked offset respectively.","realm":"Shared","rets":{"ret":{"text":"The actual view offset.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDrivingEntity","parent":"Player","type":"classfunc","description":"Gets the entity the player is currently driving via the drive library.","realm":"Shared","rets":{"ret":{"text":"The currently driven entity, or NULL entity","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDrivingMode","parent":"Player","type":"classfunc","description":"Returns driving mode of the player. See Entity Driving.","realm":"Shared","rets":{"ret":{"text":"The drive mode ID or 0 if player doesn't use the drive system.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDuckSpeed","parent":"Player","type":"classfunc","description":"Returns a player's duck speed (in seconds)","realm":"Shared","rets":{"ret":{"text":"duckspeed","name":"","type":"number"}}},"example":{"description":"Gets player 1's duck speed in seconds, and prints it to console","code":"print( Entity( 1 ):GetDuckSpeed() )","output":"0.3 in console (tested)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetEntityInUse","parent":"Player","type":"classfunc","description":"Returns the entity the player is currently using, like func_tank mounted turrets or +use prop pickups.","realm":"Shared","rets":{"ret":{"text":"Entity in use, or NULL entity otherwise. For +use prop pickups, this will be NULL clientside.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetEyeTrace","parent":"Player","type":"classfunc","description":"Returns a table with information of what the player is looking at.\n\nThe results of this function are **cached** clientside every frame.\n\nUses util.GetPlayerTrace internally and is therefore bound by its limits.\n\nSee also Player:GetEyeTraceNoCursor.","realm":"Shared","file":{"text":"gamemodes/base/gamemode/obj_player_extend.lua","line":"172-L192"},"rets":{"ret":{"text":"Trace information, see Structures/TraceResult.","name":"","type":"table{TraceResult}"}}},"example":{"description":"Prints the entity the player is looking at.","code":"print( Entity( 1 ):GetEyeTrace().Entity )","output":"`Entity [0][worldspawn]` in console, if you aim at world."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetEyeTraceNoCursor","parent":"Player","type":"classfunc","description":{"text":"Returns the trace according to the players view direction, ignoring their mouse (holding  and moving the mouse in Sandbox).\n\nThe results of this function are **cached** clientside every frame.\n\nUses util.GetPlayerTrace internally and is therefore bound by its limits.\n\nSee also Player:GetEyeTrace.","key":"C"},"realm":"Shared","file":{"text":"gamemodes/base/gamemode/obj_player_extend.lua","line":"194-L213"},"rets":{"ret":{"text":"Trace result. See Structures/TraceResult.","name":"","type":"table{TraceResult}"}}},"realms":["Server","Client"],"type":"Function"},
{"cat":"classfunc","function":{"name":"GetFlashlightColor","parent":"Player","type":"classfunc","description":"Returns the color of a player's flashlight.","added":"2026.05.13","realm":"Client","rets":{"ret":{"text":"Flashlight color","name":"","type":"Color","default":"Color(255,255,255)"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetFOV","parent":"Player","type":"classfunc","description":"Returns the FOV of the player.","realm":"Shared","rets":{"ret":{"text":"Field of view as a float","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetFriendStatus","parent":"Player","type":"classfunc","description":"Returns the steam \"relationship\" towards the player.","realm":"Client","rets":{"ret":{"text":"Should return one of four different things depending on their status on your friends list: \"friend\", \"blocked\", \"none\", \"requested\" or \"error_nofriendid\" for bots.","name":"","type":"string"}}},"example":{"description":"Prints the steam relationship towards another player","code":"print( Entity( 1 ):GetFriendStatus() )","output":"\"friend\""},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetHands","parent":"Player","type":"classfunc","description":"Gets the hands entity of a player","realm":"Shared","rets":{"ret":{"text":"The hands entity if players has one","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetHoveredWidget","parent":"Player","type":"classfunc","description":"Returns the widget the player is hovering with their mouse.","realm":"Shared","rets":{"ret":{"text":"The hovered widget.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetHull","parent":"Player","type":"classfunc","description":"Retrieves the minimum and maximum Vectors of the [Axis-Aligned Bounding Box (AABB)](https://en.wikipedia.org/wiki/Minimum_bounding_box) used for the Player physics and movement Hull Traces.\n\n\t\tSee also: Player:SetHull, Player:SetHullDuck, Player:GetHullDuck","realm":"Shared","rets":{"ret":[{"text":"The hull mins, the lowest corner of the Player's bounding box.","name":"mins","type":"Vector"},{"text":"The hull maxs, the highest corner of the Player's bounding box, opposite of the mins.","name":"maxs","type":"Vector"}]}},"example":{"description":"Prints the mins and maxs of all Players.","code":"for _, ply in ipairs( player.GetAll() ) do\n\tlocal mins, maxs = ply:GetHull()\n\n\tprint(mins)\n\tprint(maxs)\nend","output":"With one Player on the Server:\n```\n-16.000000 -16.000000 0.000000\n16.000000 16.000000 72.000000\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetHullDuck","parent":"Player","type":"classfunc","description":"Retrieves the minimum and maximum Vectors of the [Axis-Aligned Bounding Box (AABB)](https://en.wikipedia.org/wiki/Minimum_bounding_box) used for the Player physics and movement Hull Traces while they are crouching (or \"Ducking\").\n\n\t\tSee also: Player:SetHullDuck, Player:GetHull, Player:SetHull","realm":"Shared","rets":{"ret":[{"text":"The hull mins, the lowest corner of the Player's bounding box while crouching.","name":"mins","type":"Vector"},{"text":"The hull maxs, the highest corner of the Player's crouching bounding box, opposite of the mins.","name":"maxs","type":"Vector"}]}},"example":{"description":"Prints the crouching mins and maxs of all Players.","code":"for _, ply in ipairs( player.GetAll() ) do\n\tlocal bottom, top = ply:GetHullDuck()\n\n\tprint(bottom)\n\tprint(top)\nend","output":"With one Player on the Server:\n```\n-16.000000 -16.000000 0.000000\n16.000000 16.000000 36.000000\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetInfo","parent":"Player","type":"classfunc","description":"Retrieves the value of a client-side ConVar. The ConVar must have a FCVAR_USERINFO flag for this to work.\n\nOn client this function will return value of the local player, regardless of which player the function was called on!\n\nSee Player:GetInfoNum for the same function that automatically converts the string to a number.","realm":"Shared","args":{"arg":{"text":"The name of the client-side ConVar.","name":"cVarName","type":"string"}},"rets":{"ret":{"text":"The value of the ConVar. Or an empty string if the convar doesn't exist.","name":"","type":"string","warning":"The returned value is truncated to 259 bytes."}}},"example":{"description":"Creates clientside ConVar `Apple` and retrieves value of it.","code":"if CLIENT then\n\tCreateConVar( \"Apple\", \"ILikeApples\", FCVAR_USERINFO )\nelse\n\tMsgN( Entity( 1 ):GetInfo( \"Apple\" ) )\nend","output":"ILikeApples"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetInfoNum","parent":"Player","type":"classfunc","description":"Retrieves the numeric value of a client-side convar, returns nil if value is not convertible to a number. The ConVar must have a FCVAR_USERINFO flag for this to work.","realm":"Shared","args":{"arg":[{"text":"The name of the ConVar to query the value of","name":"cVarName","type":"string"},{"text":"Default value if we failed to retrieve the number.","name":"default","type":"number"}]},"rets":{"ret":{"text":"The value of the ConVar or the default value","name":"","type":"number"}}},"example":[{"description":"Creates clientside ConVar 'Apple' and retrieves value of it.","code":"if CLIENT then\n\tCreateConVar( \"Apple\", \"1\", FCVAR_USERINFO )\nelse\n\tMsgN( Entity( 1 ):GetInfoNum( \"Apple\" ) )\nend","output":"`1`"},{"description":"Shows difference between Player:GetInfo and Player:GetInfoNum.","code":"if CLIENT then\n\tCreateConVar( \"Apple\", \"1\", FCVAR_USERINFO )\nelse\n\tMsgN( type( Entity( 1 ):GetInfoNum( \"Apple\", 1 ) ) )\n\tMsgN( type( Entity( 1 ):GetInfo( \"Apple\" ) ) )\nend","output":"```\nnumber\nstring\n```"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetJumpPower","parent":"Player","type":"classfunc","description":"Returns the jump power of the player","realm":"Shared","rets":{"ret":{"text":"Jump power","name":"","type":"number"}}},"example":{"description":"Prints 1st player's jump power","code":"print( Entity( 1 ):GetJumpPower() )","output":"200"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetLadderClimbSpeed","parent":"Player","type":"classfunc","description":"Returns the player's ladder climbing speed.\n\nSee Player:GetWalkSpeed for normal walking speed, Player:GetRunSpeed for sprinting speed and Player:GetSlowWalkSpeed for slow walking speed.","realm":"Shared","added":"2020.03.17","rets":{"ret":{"text":"The ladder climbing speed.","name":"speed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetLaggedMovementValue","parent":"Player","type":"classfunc","description":"Returns the timescale multiplier of the player movement.","realm":"Shared","rets":{"ret":{"text":"The timescale multiplier, defaults to `1`.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMaxArmor","parent":"Player","type":"classfunc","description":"Returns the maximum amount of armor the player should have. Default value is 100.","realm":"Shared","added":"2020.10.14","rets":{"ret":{"text":"The new max armor value","name":"maxarmor","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMaxSpeed","parent":"Player","type":"classfunc","description":"Returns the player's maximum movement speed.\n\nSee also Player:SetMaxSpeed, Player:GetWalkSpeed and Player:GetRunSpeed.","realm":"Shared","rets":{"ret":{"text":"The maximum movement speed the player can go at.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetName","parent":"Player","type":"classfunc","file":{"text":"lua/includes/extensions/player.lua","line":"56-L56"},"description":{"text":"Returns the player's name, this is an alias of Player:Nick.","deprecated":"Use Player:Nick.","note":"This function overrides Entity:GetName (in the Lua metatable, not in c++), keep it in mind when dealing with ents.FindByName or any engine function which requires the mapping name."},"realm":"Shared","rets":{"ret":{"text":"The player's name.","name":"","type":"string"}}},"example":{"description":"Prints the player's name","code":"print( Entity( 1 ):GetName() )","output":"Player1"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNoCollideWithTeammates","parent":"Player","type":"classfunc","description":"Returns whenever the player is set not to collide with their teammates.","realm":"Shared","rets":{"ret":{"text":"noCollideWithTeammates","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetObserverMode","parent":"Player","type":"classfunc","description":"Returns the the observer mode of the player","realm":"Shared","rets":{"ret":{"text":"Observe mode of that player, see Enums/OBS_MODE.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetObserverTarget","parent":"Player","type":"classfunc","description":"Returns the entity the player is currently observing.\n\nSet using Player:SpectateEntity.","realm":"Shared","rets":{"ret":{"text":"The entity the player is currently spectating, or NULL if the player has no target.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPData","parent":"Player","type":"classfunc","description":{"text":"Returns a **P**ersistent **Data** key-value pair from the SQL database. (`sv.db` when called on server, `cl.db` when called on client)\n\nInternally uses the sql library. See util.GetPData for cases when the player is not currently on the server.","note":["This function internally uses Player:SteamID64, it previously utilized Player:UniqueID which can cause collisions (two or more players sharing the same PData entry). Player:SetPData now replaces all instances of Player:UniqueID with Player:SteamID64 when running Player:SetPData","PData is not networked from servers to clients!"]},"realm":"Shared","file":{"text":"lua/includes/extensions/player.lua","line":"111-L131"},"args":{"arg":[{"text":"Name of the PData key","name":"key","type":"string"},{"text":"Default value if PData key doesn't exist.","name":"default","type":"any","default":"nil"}]},"rets":{"ret":{"text":"The data in the SQL database or the default value given.","name":"","type":"string"}}},"example":{"description":"Reads the key \"money\" from player 1's PData","code":"Entity( 1 ):GetPData( \"money\", 0 )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPlayerColor","parent":"Player","type":"classfunc","description":{"text":"Returns a player's character model color.\n\nThe part of the model that is colored is determined by the model's materials, and is therefore different for each model.\n\nSee Player:GetWeaponColor for the accompanying function for the weapon color.","note":"Override this function clientside on any Entity (including a player) with a supported model set (such as default player models) and returned color will apply to the model. This is done via the `PlayerColor` matproxy."},"realm":"Shared","rets":{"ret":{"text":"The format is `Vector(r,g,b)`, and each color component should be between 0 and 1.","name":"","type":"Vector"}}},"example":{"description":"Gets player 1's model color, and prints it to console","code":"print( Entity( 1 ):GetPlayerColor() )","output":"```\nVector( 1, 1, 1 )\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPlayerInfo","parent":"Player","type":"classfunc","description":"Returns a table containing player information.","realm":"Shared","rets":{"ret":{"text":"A table containing player information.","name":"","type":"table"}}},"example":{"description":"Example output for a bot and a player.","code":"PrintTable( Entity( 1 ):GetPlayerInfo() ) -- A player\nPrintTable( Entity( 2 ):GetPlayerInfo() ) -- A bot","output":"Player:\n```\nfriendname\t=\t\ncustomfiles:\n\t\t1\t=\t0912fb2c\n\t\t2\t=\t0912fb2c\n\t\t3\t=\t0912fb2c\n\t\t4\t=\t0912fb2c\nfakeplayer\t=\tfalse\nguid\t=\tSTEAM_0:0:18313012\nishltv\t=\tfalse\nfilesdownloaded\t=\t0\nfriendid\t=\t36626024\nname\t=\tRubat\nuserid\t=\t2\n```\n\nBot:\n```\nfriendname\t=\t\ncustomfiles:\n\t\t1\t=\t00000000\n\t\t2\t=\t00000000\n\t\t3\t=\t00000000\n\t\t4\t=\t00000000\nfakeplayer\t=\ttrue\nguid\t=\tBOT\nishltv\t=\tfalse\nfilesdownloaded\t=\t0\nfriendid\t=\t0\nname\t=\tBot01\nuserid\t=\t3\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPreferredCarryAngles","parent":"Player","type":"classfunc","description":"Returns the preferred carry angles of an object, if any are set.\n\nCalls GM:GetPreferredCarryAngles with the target entity and returns the carry angles.","realm":"Server","args":{"arg":{"text":"Entity to retrieve the carry angles of.","name":"carryEnt","type":"Entity"}},"rets":{"ret":{"text":"Carry angles or nil if the entity has no preferred carry angles.","name":"","type":"Angle"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetPressedWidget","parent":"Player","type":"classfunc","description":"Returns the widget entity the player is using.\n\nHaving a pressed widget stops the player from firing their weapon to allow input to be passed onto the widget.","realm":"Shared","rets":{"ret":{"text":"The pressed widget.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPreviousWeapon","parent":"Player","type":"classfunc","description":"Returns the weapon the player previously had equipped.","realm":"Shared","rets":{"ret":{"text":"The previous weapon of the player.","name":"","type":"Entity","warning":"This is not guaranteed to be a weapon entity so it should be checked with Entity:IsWeapon for safety."}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPunchAngle","parent":"Player","type":"classfunc","description":{"text":"Returns players screen punch effect angle. See Player:ViewPunch and Player:SetViewPunchAngles","deprecated":"You should use Player:GetViewPunchAngles instead."},"realm":"Shared","rets":{"ret":{"text":"The punch angle","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetRagdollEntity","parent":"Player","type":"classfunc","description":{"text":"Returns players death ragdoll. The ragdoll is created by Player:CreateRagdoll.","note":"Calling Entity:GetPos server-side with this function then will return the position where Player:CreateRagdoll was used, as it is a hl2mp_ragdoll which is a serverside point entity that creates a clientside ragdoll for everyone (opposed to prop_ragdoll that is serverside and networks)."},"realm":"Shared","rets":{"ret":{"text":"The ragdoll.\n\nUnlike normal clientside ragdolls (`C_ClientRagdoll`), this will be a `C_HL2MPRagdoll` on the client, and `hl2mp_ragdoll` on the server.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetRenderAngles","parent":"Player","type":"classfunc","description":"Returns the render angles for the player.","realm":"Shared","rets":{"ret":{"text":"The render angles of the player. Only **yaw** part of the angle seems to be present.","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetRunSpeed","parent":"Player","type":"classfunc","description":"Returns the player's sprint speed.\n\nSee also Player:SetRunSpeed, Player:GetWalkSpeed and Player:GetMaxSpeed.","realm":"Shared","rets":{"ret":{"text":"The sprint speed","name":"","type":"number"}}},"example":{"description":"Prints the players run speed in the code.","code":"print( Entity( 1 ):GetRunSpeed() )","output":"500"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetShootPos","parent":"Player","type":"classfunc","description":{"text":"Returns the position of a Player's view","note":"This is the same as calling Entity:EyePos on the player."},"realm":"Shared","rets":{"ret":{"text":"The position of the player's view.","name":"","type":"Vector"}}},"example":[{"description":"Gets player 1's shoot position, and prints it to console","code":"print( Entity( 1 ):GetShootPos() )","output":"A vector of the player's shooting position in the console."},{"description":"Prints the position of your player's camera, but using 3 different functions.\n\nThis example demonstrates that it doesn't matter whichever of these functions you use, you will get the SAME result.","code":"// run on client\nprint( LocalPlayer():GetEyeTrace().StartPos )\nprint( LocalPlayer():GetShootPos() )\nprint( LocalPlayer():EyePos() )","output":"```\n94.856689 -115.472549 -83.981430\n94.856689 -115.472549 -83.981430\n94.856689 -115.472549 -83.981430\n```"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSlowWalkSpeed","parent":"Player","type":"classfunc","description":{"text":"Returns the player's slow walking speed, which is activated via  keybind.\n\nSee Player:GetWalkSpeed for normal walking speed, Player:GetRunSpeed for sprinting speed and Player:GetLadderClimbSpeed for ladder climb speed.","key":"+WALK"},"realm":"Shared","added":"2020.03.17","rets":{"ret":{"text":"The new slow walking speed.","name":"speed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetStepSize","parent":"Player","type":"classfunc","description":"Returns the maximum height player can step onto.","realm":"Shared","rets":{"ret":{"text":"The maximum height player can get up onto without jumping, in hammer units.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSuitPower","parent":"Player","type":"classfunc","description":{"text":"Returns the player's HEV suit power.","bug":{"text":"This will only work for the local player when used clientside.","issue":"3449"}},"realm":"Shared","rets":{"ret":{"text":"The current suit power.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetTimeoutSeconds","parent":"Player","type":"classfunc","description":{"text":"Returns the number of seconds that the player has been timing out for. You can check if a player is timing out with Player:IsTimingOut.","note":"This function is relatively useless because it is tied to the value of the `sv_timeout` ConVar, which is irrelevant to the description above. [This is not considered as a bug](https://discord.com/channels/565105920414318602/567617926991970306/748970396224585738)."},"realm":"Server","rets":{"ret":{"text":"Timeout seconds.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetTool","parent":"Player","type":"classfunc","description":"Returns TOOL table of players current tool, or of the one specified.","realm":"Shared","file":{"text":"gamemodes/sandbox/gamemode/player_extension.lua","line":"105-L115"},"args":{"arg":{"text":"Classname of the tool to retrieve. ( Filename of the tool in gmod_tool/stools/ )","name":"mode","type":"string","default":"nil"}},"rets":{"ret":{"text":"TOOL table, or nil if the table wasn't found or the player doesn't have a tool gun.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetUnDuckSpeed","parent":"Player","type":"classfunc","description":"Returns a player's unduck speed (in seconds)","realm":"Shared","rets":{"ret":{"text":"unduck speed","name":"","type":"number"}}},"example":{"description":"Gets player 1's unduck speed, and prints it to console","code":"print( Entity( 1 ):GetUnDuckSpeed() )","output":"0.3 in console"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetUseEntity","parent":"Player","type":"classfunc","description":{"text":"Returns the entity the player would use if they would press their `+use` keybind.","note":{"text":"Because entity physics objects usually do not exist on the client, the client's use entity will resolve to whatever the crosshair is placed on within a little less than 72 units of the player's eye position. This differs from the entity returned by the server, which has fully physical use checking. See util.TraceHull.\n\nIssue tracker: [5027](https://github.com/Facepunch/garrysmod-issues/issues/5027)","issue":"5027"}},"realm":"Shared","added":"2020.06.24","rets":{"ret":{"text":"The entity that would be used or NULL.","name":"ent","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetUserGroup","parent":"Player","type":"classfunc","description":"Returns the player's user group. By default, player user groups are loaded from `garrysmod/settings/users.txt`.","realm":"Shared","file":{"text":"lua/includes/extensions/player_auth.lua","line":"44-L48"},"rets":{"ret":{"text":"The user group of the player. This will return `\"user\"` if player has no user group.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetVehicle","parent":"Player","type":"classfunc","description":"Returns the vehicle the player is driving.","realm":"Shared","rets":{"ret":{"text":"The vehicle the player is currently driving, if any.\n\nReturns NULL entity if the player is not driving.","name":"","type":"Vehicle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetViewEntity","parent":"Player","type":"classfunc","description":{"text":"Returns the entity the player is using to see from (such as the player itself, the camera, or another entity).","note":"This function will return a [NULL Entity] until Player:SetViewEntity has been used.\n\nIt will also not return the currently spectated entity. See Player:GetObserverTarget."},"realm":"Shared","rets":{"ret":{"text":"The entity the player is using to see from","name":"","type":"Entity"}}},"example":{"description":"Will print what entity the first player uses to look through.","code":"print( Entity( 1 ):GetViewEntity() )","output":"Player [1][ExamplePlayer]"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetViewModel","parent":"Player","type":"classfunc","description":{"text":"Returns the player's view model entity by the index.\nEach player has 3 view models by default, but only the first one is used.\n\nTo use the other viewmodels in your SWEP, see Entity:SetWeaponModel.","note":"In the Client realm, other players' viewmodels are not available unless they are being spectated."},"realm":"Shared","args":{"arg":{"text":"optional index of the view model to return, can range from 0 to 2","name":"index","type":"number","default":"0"}},"rets":{"ret":{"text":"The view model entity","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetViewOffset","parent":"Player","type":"classfunc","description":"Returns the view offset of the player, which equals the difference between the player's actual position and their view when standing.\n\nSee also Player:GetViewOffsetDucked.","realm":"Shared","rets":{"ret":{"text":"New view offset, must be local vector to player's Entity:GetPos","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetViewOffsetDucked","parent":"Player","type":"classfunc","description":"Returns the ducked view offset of the player, which equals the difference between the player's actual position and their view when ducked.\n\nSee also Player:GetViewOffset.","realm":"Shared","rets":{"ret":{"text":"New crouching view offset, must be local vector to player's Entity:GetPos","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetViewPunchAngles","parent":"Player","type":"classfunc","description":"Returns players screen punch effect angle.","realm":"Shared","rets":{"ret":{"text":"The punch angle","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetViewPunchVelocity","parent":"Player","type":"classfunc","description":"Returns client's view punch velocity. See Player:ViewPunch and Player:SetViewPunchVelocity","realm":"Shared","added":"2020.10.14","rets":{"ret":{"text":"The current view punch angle velocity.","name":"punchVel","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetVoiceVolumeScale","parent":"Player","type":"classfunc","description":"Returns the current voice volume scale for given player on client.","realm":"Client","added":"2021.06.09","rets":{"ret":{"text":"The voice volume scale, where 0 is 0% and 1 is 100%.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetWalkSpeed","parent":"Player","type":"classfunc","description":"Returns the player's normal walking speed. Not sprinting, not slow walking. (+walk)\n\nSee also Player:SetWalkSpeed, Player:GetMaxSpeed and Player:GetRunSpeed.","realm":"Shared","rets":{"ret":{"text":"The normal walking speed.","name":"","type":"number"}}},"example":{"description":"Gets player 1's walk speed, and prints it to console","code":"print( Entity( 1 ):GetWalkSpeed() )","output":"200 in console by default"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetWeapon","parent":"Player","type":"classfunc","description":"Returns the weapon for the specified class","realm":"Shared","args":{"arg":{"text":"Class name of weapon","name":"className","type":"string"}},"rets":{"ret":{"text":"The weapon for the specified class, or NULL ENTITY if the player does not have this weapon.","name":"","type":"Weapon"}}},"example":{"description":"Prints the weapon if the player has the toolgun","code":"print( Entity( 1 ):GetWeapon( \"gmod_tool\" ) )","output":"Something like \"Weapon [77]\" in console."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetWeaponColor","parent":"Player","type":"classfunc","description":"Returns a player's weapon color.\n\nThe part of the model that is colored is determined by the model itself, and is different for each model. \n\nSee Player:GetPlayerColor for the accompanying function for the player character model color.","realm":"Shared","rets":{"ret":{"text":"The format is `Vector(r,g,b)`, and each color should be between 0 and 1.","name":"","type":"Vector"}}},"example":{"description":"Gets player 1's weapon color, and prints it to console","code":"print( Entity( 1 ):GetWeaponColor() )","output":"Vector( 1, 1, 1 )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetWeapons","parent":"Player","type":"classfunc","description":{"text":"Returns a table of the player's weapons.","note":"This function returns a sequential table. Prefer to loop it with Global.ipairs instead of the Global.pairs function."},"realm":"Shared","rets":{"ret":{"text":"All the weapons the player currently has.","name":"","type":"table"}}},"example":{"description":"Prints how many weapons the player has.","code":"print( #Entity( 1 ):GetWeapons() )","output":"The number of weapons the player has (e.g. 5)."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Give","parent":"Player","type":"classfunc","description":{"text":"Gives the player a weapon.\n\nThis function will call GM:PlayerCanPickupWeapon. If that hook returns false, this function will do nothing.","note":"While this function is meant for weapons/pickupables only, it is **not** restricted to weapons. Any entity can be spawned using this function, including NPCs and SENTs."},"realm":"Server","args":{"arg":[{"text":"Class name of weapon to give the player","name":"weaponClassName","type":"string"},{"text":"Set to true to not give any ammo on weapon spawn. (Reserve ammo set by DefaultClip)","name":"bNoAmmo","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"The weapon given to the player, if one was given. It will return NULL if the player already has the weapon, or the weapon entity (entity with given classname) doesn't exist.","name":"","type":"Weapon"}}},"example":[{"description":"Gives the player a toolgun","code":"Entity( 1 ):Give( \"gmod_tool\" )"},{"description":"Removes all weapons and ammo from a player and gives a weapon_base SWEP with no ammo in it.","code":"Entity( 1 ):StripWeapons()\nEntity( 1 ):StripAmmo()\nEntity( 1 ):Give( \"weapon_base\", true )"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"GiveAmmo","parent":"Player","type":"classfunc","description":"Gives ammo to a player","realm":"Server","args":{"arg":[{"text":"Amount of ammo","name":"amount","type":"number"},{"text":"Type of ammo.\nThis is a string for named ammo types, and a number for ammo ID.\n\nYou can find a list of default ammo types here.","name":"type","type":"string","alttype":"number"},{"text":"Hide display popup when giving the ammo","name":"hidePopup","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"Ammo given.","name":"","type":"number"}}},"example":{"description":"Give the player 200 rounds for the pistol, hiding the popup.","code":"Entity( 1 ):GiveAmmo( 200, \"Pistol\", true )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"GodDisable","parent":"Player","type":"classfunc","description":"Disables god mode on the player. Removes the FL_GODMODE flag from the player.","realm":"Server","file":{"text":"lua/includes/extensions/player.lua","line":"232-L240"}},"example":{"description":"Disables god mode on all players.","code":"for _, ply in ipairs( player.GetAll() ) do\n    ply:GodDisable()\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"GodEnable","parent":"Player","type":"classfunc","description":"Enables god mode on the player. Adds the FL_GODMODE flag to the player.","realm":"Server","file":{"text":"lua/includes/extensions/player.lua","line":"222-L230"}},"example":{"description":"Enable god mode on all players.","code":"for _, ply in ipairs( player.GetAll() ) do\n    ply:GodEnable()\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"HasGodMode","parent":"Player","type":"classfunc","description":"Returns whether the player has god mode or not, contolled by Player:GodEnable and Player:GodDisable.","realm":"Shared","file":{"text":"lua/includes/extensions/player.lua","line":"254-L262"},"rets":{"ret":{"text":"Whether the player has god mode or not.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"HasWeapon","parent":"Player","type":"classfunc","description":"Returns if the player has the specified weapon","realm":"Shared","args":{"arg":{"text":"Class name of the weapon","name":"className","type":"string"}},"rets":{"ret":{"text":"True if the player has the weapon","name":"","type":"boolean"}}},"example":{"description":"prints if the player has the physgun","code":"print( Entity( 1 ):HasWeapon( \"weapon_physgun\" ) )","output":"\"true\" in console, if player 1 has Physics Gun."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"InVehicle","parent":"Player","type":"classfunc","description":"Returns if the player is in a vehicle","realm":"Shared","rets":{"ret":{"text":"Whether the player is in a vehicle.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IPAddress","parent":"Player","type":"classfunc","description":{"text":"Returns the player's IP address and connection port in ip:port form","note":"Returns `Error!` for bots."},"realm":"Server","rets":{"ret":{"text":"The player's IP address and connection port","name":"ip","type":"string"}}},"example":{"description":"Prints the player's IP and port","code":"print( Entity( 1 ):IPAddress() )","output":"192.168.1.101:27005"},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsAdmin","parent":"Player","type":"classfunc","description":"Returns whether the player is an admin or not. It will also return `true` if the player is Player:IsSuperAdmin by default.\n\nInternally this is determined by Player:IsUserGroup.","realm":"Shared","file":{"text":"lua/includes/extensions/player_auth.lua","line":"9-L16"},"rets":{"ret":{"text":"True if the player is an admin or a super admin.","name":"","type":"boolean"}}},"example":{"description":"Every time a player spawns, print in the console whether they are an admin.","code":"hook.Add( \"PlayerSpawn\", \"PrintIfAdmin\", function( ply )\n    if ( ply:IsAdmin() ) then \n\t\tprint( \"It's true, \" .. ply:Nick() .. \" is an admin\" )\n    else\n\t\tprint( \"It's false, \" .. ply:Nick() .. \" is not an admin\" )\n    end\nend )","output":"```\nIt's true, Alice is an admin.\nIt's false, Bob is not an admin.\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsBot","parent":"Player","type":"classfunc","description":"Returns if the player is an bot or not","realm":"Shared","rets":{"ret":{"text":"`true` if the player is a bot.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsConnected","parent":"Player","type":"classfunc","description":"Returns true from the point when the player is sending client info but not fully in the game until they disconnect.","realm":"Server","rets":{"ret":{"text":"isConnected","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsDrivingEntity","parent":"Player","type":"classfunc","description":"Used to find out if a player is currently 'driving' an entity (by which we mean 'right click > drive' ).","realm":"Shared","rets":{"ret":{"text":"A value representing whether or not the player is 'driving' an entity.","name":"","type":"boolean"}}},"example":{"description":"Kills every player currently 'driving' an entity.","code":"for i, ply in ipairs( player.GetAll() ) do\n    if ( ply:IsDrivingEntity() ) then\n        ply:Kill()\n    end\nend","output":"Every player 'driving' an entity will die a painful death."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsFrozen","parent":"Player","type":"classfunc","description":"Returns whether the players movement is currently frozen, controlled by Player:Freeze.","realm":"Shared","file":{"text":"lua/includes/extensions/player.lua","line":"244-L252"},"rets":{"ret":{"text":"Whether the players movement is currently frozen or not.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsFullyAuthenticated","parent":"Player","type":"classfunc","description":"Returns whether the player identity was confirmed by the Steam network.\n\nSee also GM:NetworkIDValidated.","realm":"Server","rets":{"ret":{"text":"Whether the player has been fully authenticated or not.\n\nThis will always be true for singleplayer and the listen server host.\nThis will always be false for bots.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsListenServerHost","parent":"Player","type":"classfunc","description":"Returns if a player is the host of the current session.","realm":"Shared","rets":{"ret":{"text":"`true` if the player is the listen server host, `false` otherwise.\n\nThis will always be `true` in single player, and `false` on a dedicated server.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsMuted","parent":"Player","type":"classfunc","description":"Returns whether or not the player is voice muted locally.","realm":"Client","rets":{"ret":{"text":"whether or not the player is muted locally.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsPlayingTaunt","parent":"Player","type":"classfunc","description":"Returns true if the player is playing a taunt.","realm":"Shared","rets":{"ret":{"text":"Whether the player is playing a taunt.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsSpeaking","parent":"Player","type":"classfunc","description":"Returns whenever the player is heard by the local player clientside, or if the player is speaking serverside.","realm":"Shared","rets":{"ret":{"text":"Is the player speaking or not.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsSprinting","parent":"Player","type":"classfunc","description":"Returns whether the player is currently sprinting or not, specifically if they are holding their sprint key and are allowed to sprint.\n\nThis will not check if the player is currently sprinting into a wall. (i.e. holding their sprint key but not moving)","realm":"Shared","rets":{"ret":{"text":"Is the player sprinting or not","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsSuitEquipped","parent":"Player","type":"classfunc","description":{"text":"Returns whenever the player is equipped with the suit item.","bug":{"text":"This will only work for the local player when used clientside.","issue":"3449"}},"realm":"Shared","rets":{"ret":{"text":"Is the suit equipped or not.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsSuperAdmin","parent":"Player","type":"classfunc","description":"Returns whether the player is a super admin.\n\nInternally this is determined by Player:IsUserGroup. See also Player:IsAdmin.","realm":"Shared","file":{"text":"lua/includes/extensions/player_auth.lua","line":"22-L26"},"rets":{"ret":{"text":"True if the player is a super admin.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsTimingOut","parent":"Player","type":"classfunc","description":"Returns `true` if the player is timing out (i.e. is losing connection), `false` otherwise.\n\nA player is considered timing out when more than 4 seconds has elapsed since a network packet was received from given player.","realm":"Server","rets":{"ret":{"text":"Whether the player is timing out.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsTyping","parent":"Player","type":"classfunc","description":"Returns whether the player is typing in their chat.\n\nThis may not work properly if the server uses a custom chatbox.","realm":"Shared","rets":{"ret":{"text":"Whether the player is typing in their chat or not.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsUserGroup","parent":"Player","type":"classfunc","description":"Returns whether the player is in specified group or not. See Player:GetUserGroup for a way to get player's user group.","realm":"Shared","file":{"text":"lua/includes/extensions/player_auth.lua","line":"32-L38"},"args":{"arg":{"text":"Group to check the player for.","name":"groupName","type":"string"}},"rets":{"ret":{"text":"`true` if the player has the given user group.","name":"","type":"boolean"}}},"example":{"description":"Prints in the players console \"yes, I'm awesome!\" if he's in the superadmin group.","code":"if ( Entity( 1 ):IsUserGroup( \"superadmin\" ) ) then\n    print( \"Yes, I'm awesome!\" )\nend","output":"\"Yes, I'm awesome!\" in console."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsVoiceAudible","parent":"Player","type":"classfunc","description":"Returns if the player can be heard by the local player.","realm":"Client","rets":{"ret":{"text":"isAudible","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsWalking","parent":"Player","type":"classfunc","description":"Returns if the player currently walking. (`+walk` keybind)","realm":"Shared","added":"2023.09.11","rets":{"ret":{"text":"`true` if the player is currently walking.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsWorldClicking","parent":"Player","type":"classfunc","description":"Returns whether the player is using the world clicking feature, see Panel:SetWorldClicker","realm":"Shared","rets":{"ret":{"text":"Is the player world clicking or not.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsWorldClickingDisabled","parent":"Player","type":"classfunc","description":"Returns whether the world clicking is disabled for given player or not. See Player:DisableWorldClicking.","realm":"Shared","added":"2023.01.25","rets":{"ret":{"text":"Whether the world clicking is disabled or not.","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"KeyDown","parent":"Player","type":"classfunc","description":"Returns whether a key is down. This is not networked to other players, meaning only the local client can see the keys they are pressing.","realm":"Shared","args":{"arg":{"text":"The key, see Enums/IN","name":"key","type":"number"}},"rets":{"ret":{"text":"whether the key is down or not.","name":"","type":"boolean"}}},"example":{"description":{"text":"Prints whenever the first player is holding  key ( on QWERTY keyboards).","key":["+FORWARD","W"]},"code":"hook.Add( \"Tick\", \"KeyDown_Test\", function()\n\tif ( Entity( 1 ):KeyDown( IN_FORWARD ) ) then\n\t\tprint( \"Player is pressing forward!\" )\n\tend\nend )","output":"```\nPlayer is pressing forward!\nPlayer is pressing forward!\nPlayer is pressing forward!\nPlayer is pressing forward!\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"KeyDownLast","parent":"Player","type":"classfunc","description":"Gets whether a key was down one tick ago.","realm":"Shared","args":{"arg":{"text":"The key, see Enums/IN","name":"key","type":"number"}},"rets":{"ret":{"text":"Is key down ?","name":"","type":"boolean"}}},"example":{"description":{"text":"Prints whenever the first player stopped pressing  key ( on QWERTY keyboards) last tick","key":["+FORWARD","W"]},"code":"hook.Add( \"Tick\", \"CheckPlayer1Forward\", function()\n\tif !Entity( 1 ):KeyDown( IN_FORWARD ) and Entity( 1 ):KeyDownLast( IN_FORWARD ) then\n\t\tprint( \"Player1 is no longer holding W!\" )\n\tend\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"KeyPressed","parent":"Player","type":"classfunc","description":"Gets whether a key was just pressed this tick.","realm":"Shared","args":{"arg":{"text":"Corresponds to an Enums/IN. You can use bit.bor here (see example 2)","name":"key","type":"number"}},"rets":{"ret":{"text":"Was pressed or not","name":"","type":"boolean"}}},"example":[{"description":{"text":"Prints whenever the first player first starts pressing  key ( on QWERTY keyboards).","key":["+FORWARD","W"]},"code":"hook.Add( \"Tick\", \"CheckPlayer1Forward\", function()\n\tif Entity( 1 ):KeyPressed( IN_FORWARD ) then\n\t\tprint( \"Player1 just started moving forward!\" )\n\tend\nend )"},{"description":{"text":"Respawn the player when pressing ,  or  (defaults to ,  and  respectively)","key":["+ATTACK","+ATTACK2","+JUMP","LMB","RMB","SPACE"]},"code":"local respawnKeys = bit.bor( IN_ATTACK, IN_ATTACK2, IN_JUMP )\nhook.Add( \"PlayerDeathThink\", \"DoRespawn\", function( ply )\n\tif ply:KeyPressed( respawnKeys ) then\n\t\tply:Spawn()\n\tend\nend )"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"KeyReleased","parent":"Player","type":"classfunc","description":"Gets whether a key was just released this tick.","realm":"Shared","args":{"arg":{"text":"The key, see Enums/IN","name":"key","type":"number"}},"rets":{"ret":{"text":"Was released or not","name":"","type":"boolean"}}},"example":{"description":{"text":"Prints whenever the first player first stops pressing  key ( on QWERTY keyboards).","key":["+FORWARD","W"]},"code":"hook.Add( \"Tick\", \"CheckPlayer1Forward\", function()\n\tif Entity( 1 ):KeyReleased( IN_FORWARD ) then\n\t\tprint( \"Player1 just stopped moving forward!\" )\n\tend\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Kick","parent":"Player","type":"classfunc","description":{"text":"Kicks the player from the server.","note":"This can not be run before the player has fully joined in. Use game.KickID for that."},"realm":"Server","args":{"arg":{"text":"Reason to show for disconnection.","name":"reason","type":"string","default":"No reason given","warning":"This will be shortened to ~512 chars, though this includes the command itself and the player index so will realistically be more around ~498. It is recommended to avoid going near the limit to avoid truncation."}}},"example":{"description":"Kick a player with reason \"Goodbye\"","code":"Entity( 1 ):Kick( \"Goodbye\" )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"Kill","parent":"Player","type":"classfunc","description":"Kills a player and calls GM:PlayerDeath.","realm":"Server"},"example":{"description":"When the user types \"/respawn\" the user will be killed and then respawned.","code":"hook.Add( \"PlayerSay\", \"RespawnCommand\", function( ply, text, public )\n\tif ( string.lower( text ) == \"/respawn\" ) then\n\t\tply:Kill()\n\t\tply:Spawn()\n\n\t\treturn \"\"\n\tend\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"KillSilent","parent":"Player","type":"classfunc","description":"Kills a player without notifying the rest of the server.\n\nThis will call GM:PlayerSilentDeath instead of GM:PlayerDeath.","realm":"Server"},"example":{"description":"Silently kills the player.","code":"Entity( 1 ):KillSilent()"},"realms":["Server"],"type":"Function"},
{"function":{"name":"LagCompensation","parent":"Player","type":"classfunc","description":{"text":"This allows the server to mitigate the lag of the player by moving back all the entities that can be lag compensated to the time the player attacked with his weapon.\n\nThis technique is most commonly used on things that hit other entities instantaneously, such as traces.\n\n\n\nLag compensation only works for players and entities that have been enabled with Entity:SetLagCompensated\n\nDespite being defined shared, it can only be used server-side in a Predicted Hook.","note":"Entity:FireBullets calls this function internally.","warning":"This function NEEDS to be disabled after you're done with it or it will break the movement of the entities affected!","bug":{"text":"Lag compensation does not support pose parameters.","issue":"3683"}},"realm":"Shared","args":{"arg":{"text":"The state of the lag compensation, true to enable and false to disable.","name":"lagCompensation","type":"boolean"}}},"example":{"description":"Do a crowbar-like melee trace, enabling lag compensation before doing so.","code":"function SWEP:PrimaryAttack()\n\tlocal tracedata = {}\n\ttracedata.start = self:GetOwner():GetShootPos()\n\ttracedata.endpos = self:GetOwner():GetShootPos() + self:GetOwner():GetAimVector() * 75\n\ttracedata.filter = self:GetOwner()\n\ttracedata.mins =  Vector( -8 , -8 , -8 )\n\ttracedata.maxs =  Vector( 8 , 8 , 8 )\n\t\n\t-- It is recommended to use an IsPlayer check in case the weapon is being used by an NPC.\n\tif ( self:GetOwner():IsPlayer() ) then\n\t\tself:GetOwner():LagCompensation( true )\n\tend\n\t\n\tlocal tr = util.TraceHull( tracedata )\n\t\n\tif ( self:GetOwner():IsPlayer() ) then\n\t\tself:GetOwner():LagCompensation( false )\n\tend\n\t\n\tif tr.Hit then\n\t\tprint( tr.Entity )\t--your code here\n\tend\n\t\n\tself:SetNextPrimaryFire( CurTime() + 0.5 )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"LastHitGroup","parent":"Player","type":"classfunc","description":"Returns the hitgroup where the player was last hit.","realm":"Server","rets":{"ret":{"text":"Hitgroup, see Enums/HITGROUP","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"LimitHit","parent":"Player","type":"classfunc","description":{"text":"Shows \"limit hit\" notification in sandbox.","note":"This function is only available in Sandbox and its derivatives."},"realm":"Server","file":{"text":"gamemodes/sandbox/gamemode/player_extension.lua","line":"120-L124"},"args":{"arg":{"text":"Type of hit limit.","name":"type","type":"string"}}},"example":{"description":"Sends a fake `limit hit` notification.","code":"for _, ply in ipairs( player.GetAll() ) do\n\tply:LimitHit( \"test\" )\nend","output":"A notification pops up saying `You have hit the test limit!`. It will use the following location: hint.hitXlimit"},"realms":["Server"],"type":"Function"},
{"function":{"name":"LocalEyeAngles","parent":"Player","type":"classfunc","description":{"text":"Returns the direction a player is looking as a entity/local-oriented angle.\n\nUnlike Entity:EyeAngles, this function does not include angles of the Player's Entity:GetParent.","bug":"Does not work correctly clientside for non local players when in a vehicle. (validate: when parented in general?)"},"added":"2021.06.09","realm":"Shared","rets":{"ret":{"text":"The local eye angles.","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Lock","parent":"Player","type":"classfunc","description":"Stops a player from using any inputs, such as moving, turning, or attacking. Key binds are still called. Similar to Player:Freeze but the player takes no damage.\n\nAdds the FL_FROZEN and FL_GODMODE flags to the player.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"MotionSensorPos","parent":"Player","type":"classfunc","description":"Returns the position of a Kinect bone.","realm":"Shared","args":{"arg":{"text":"Bone to get the position of. Must be from 0 to 19.","name":"bone","type":"number"}},"rets":{"ret":{"text":"Position of the bone.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Name","parent":"Player","type":"classfunc","description":{"text":"Returns the player's nick name. Identical to Player:Nick and Player:GetName.","deprecated":"Use Player:Nick."},"realm":"Shared","file":{"text":"lua/includes/extensions/player.lua","line":"57-L57"},"rets":{"ret":{"text":"Player's name.","name":"","type":"string"}}},"example":{"description":"Prints the players name in console.","code":"print( Entity( 1 ):Name() )","output":"Player1"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Nick","parent":"Player","type":"classfunc","description":"Returns the player's nick name also known as display name, as it appears in Steam.","realm":"Shared","rets":{"ret":{"text":"Player's nick name","name":"","type":"string"}}},"example":{"description":"Prints the players name in console.","code":"print( Entity( 1 ):Name() )","output":"Player1"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OwnerSteamID64","parent":"Player","type":"classfunc","description":{"text":"Returns the 64-bit SteamID aka CommunityID of the Steam Account that owns the Garry's Mod license this player is using. This is useful for detecting players using Steam Family Sharing.\n\nIf player is not using Steam Family Sharing, this will return the player's actual SteamID64().","note":"This data will only be available after the player has fully authenticated with Steam. See Player:IsFullyAuthenticated."},"realm":"Server","added":"2020.08.12","rets":{"ret":{"text":"The 64bit SteamID","name":"","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PacketLoss","parent":"Player","type":"classfunc","description":"Returns the percentage of packets lost by the client. It is not networked so it only returns 0 when run clientside.","realm":"Shared","rets":{"ret":{"text":"Percentage of packets lost (0-100)","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PhysgunUnfreeze","parent":"Player","type":"classfunc","description":"Unfreezes the props player is looking at. This is essentially the same as pressing reload with the physics gun, including double press for unfreeze all.\n\nFor freezing props, use PhysObj:EnableMotion.","realm":"Shared","file":{"text":"gamemodes/base/gamemode/obj_player_extend.lua","line":"53-L96"},"rets":{"ret":{"text":"Number of props unfrozen.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PickupObject","parent":"Player","type":"classfunc","description":{"text":"This makes the player hold (same as pressing  on a small prop) given entity.\n\nNot to be confused with picking up items like ammo or health kits.\n\nThis picks up the passed entity regardless of its mass or distance from the player.","key":"E"},"realm":"Server","args":{"arg":{"text":"Entity to pick up.","name":"entity","type":"Entity"}}},"example":{"description":"An extra function to make sure the object isn't held before being picked up.","code":"function PlayerPickupObject( ply, obj )\n\tif ( obj:IsPlayerHolding() ) then return end\n\n\tply:PickupObject( obj )\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PickupWeapon","parent":"Player","type":"classfunc","description":"Forces the player to pickup an existing weapon entity. The player will not pick up the weapon if they already own a weapon of given type, or if the player could not normally have this weapon in their inventory.\n\nThis function **will** bypass GM:PlayerCanPickupWeapon.","realm":"Server","added":"2020.06.24","args":{"arg":[{"text":"The weapon to try to pick up.","name":"wep","type":"Weapon"},{"text":"If set to true, the player will only attempt to pick up the ammo from the weapon. The weapon will not be picked up even if the player doesn't have a weapon of this type, and the weapon will be removed if the player picks up any ammo from it.","name":"ammoOnly","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"Whether the player succeeded in picking up the weapon or not.","name":"result","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Ping","parent":"Player","type":"classfunc","description":"Returns the player's ping to server.","realm":"Shared","rets":{"ret":{"text":"The player's ping.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayStepSound","parent":"Player","type":"classfunc","description":"Plays the correct step sound according to what the player is staying on.","realm":"Server","args":{"arg":{"text":"Volume for the sound, in range from 0 to 1","name":"volume","type":"number","default":"1"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PrintMessage","parent":"Player","type":"classfunc","description":{"text":"Displays a message either in their chat, console, or center of the screen. See also Global.PrintMessage.","note":"When called serverside, this uses the archaic user message system (the umsg) and hence is limited to ≈250 characters.\n\n`HUD_PRINTCENTER` will not work when this is called clientside."},"realm":"Shared","args":{"arg":[{"text":"Which type of message should be sent to the player (Enums/HUD).","name":"type","type":"number"},{"text":"Message to be sent to the player.","name":"message","type":"string"}]}},"example":{"description":"Prints into the first players chat: `I'm new here.`.","code":"Entity( 1 ):PrintMessage( HUD_PRINTTALK, \"I'm new here.\" )","output":"I'm new here."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RemoveAllAmmo","parent":"Player","type":"classfunc","description":"Removes all ammo from a certain player","realm":"Server"},"example":{"description":"A console command that removes ammo on the player that used it.","code":"concommand.Add( \"removeammo\", function( ply )\n\tply:RemoveAllAmmo()\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"RemoveAllItems","parent":"Player","type":"classfunc","description":"Removes all weapons and ammo from the player.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"RemoveAmmo","parent":"Player","type":"classfunc","description":"Removes the amount of the specified ammo from the player.","realm":"Shared","args":{"arg":[{"text":"The amount of ammunition to remove.","name":"ammoCount","type":"number"},{"text":"The name of the ammunition to remove from. This can also be a number ammoID.","name":"ammoName","type":"string","alttype":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RemovePData","parent":"Player","type":"classfunc","description":{"text":"Removes a **P**ersistent **Data** key-value pair from the SQL database. (`sv.db` when called on server, `cl.db` when called on client)\n\nInternally uses the sql library. See util.RemovePData for cases when the player is not currently on the server.","note":["This function internally uses Player:SteamID64, it previously utilized Player:UniqueID which can cause collisions (two or more players sharing the same PData entry). Player:SetPData now replaces all instances of Player:UniqueID with Player:SteamID64 when running Player:SetPData","PData is not networked from servers to clients!"]},"realm":"Shared","file":{"text":"lua/includes/extensions/player.lua","line":"148-L164"},"args":{"arg":{"text":"Key to remove","name":"key","type":"string"}},"rets":{"ret":{"text":"true is succeeded, false otherwise","name":"","type":"boolean"}}},"example":{"description":"Deletes the key \"money\" from player 1","code":"Entity( 1 ):RemovePData( \"money\" )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RemoveSuit","parent":"Player","type":"classfunc","description":"Strips the player's suit item.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"ResetHull","parent":"Player","type":"classfunc","description":"Resets both normal and duck hulls to their default values.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Say","parent":"Player","type":"classfunc","description":{"text":"Forces the player to say whatever the first argument is. Works on bots too.","note":"This function ignores the default chat message cooldown","warning":"The argument can only contain 126 characters. [Source SDK 2013](https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/game/server/client.cpp#L84-L86)"},"realm":"Server","args":{"arg":[{"text":"The text to force the player to say.","name":"text","type":"string"},{"text":"Whether to send this message to our own team only.","name":"teamOnly","type":"boolean","default":"false"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ScreenFade","parent":"Player","type":"classfunc","description":"Fades the screen","realm":"Shared","args":{"arg":[{"text":"Fade flags defined with Enums/SCREENFADE.","name":"flags","type":"number"},{"text":"The color of the screenfade","name":"color","type":"Color","default":"color_white"},{"text":"Fade(in/out) effect transition time ( From no fade to full fade and vice versa ).\n\nThis is limited to 7 bits integer part and 9 bits fractional part.","name":"fadeTime","type":"number"},{"text":"Fade effect hold time.\n\nThis is limited to 7 bits integer part and 9 bits fractional part.","name":"fadeHold","type":"number"}]}},"example":{"description":"Flashes the screen red to nothing over 0.3 seconds when a player gets hurt.","code":"hook.Add( \"PlayerHurt\", \"hurt_effect_fade\", function( ply )\n\tply:ScreenFade( SCREENFADE.IN, Color( 255, 0, 0, 128 ), 0.3, 0 )\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SelectWeapon","parent":"Player","type":"classfunc","description":{"text":"Sets the active weapon of the player by its class name.","warning":"This will switch the weapon out of prediction, causing delay on the client and WEAPON:Deploy and WEAPON:Holster to be called out of prediction. Try using CUserCmd:SelectWeapon or input.SelectWeapon, instead.","note":"This will trigger the weapon switch event and associated animations. To switch weapons silently, use Player:SetActiveWeapon."},"realm":"Server","args":{"arg":{"text":"The class name of the weapon to switch to.\n\nIf the player doesn't have the specified weapon, nothing will happen. You can use Player:Give to give the weapon first.","name":"className","type":"string"}}},"example":[{"description":"Force the player to switch to toolgun","code":"Entity( 1 ):SelectWeapon( \"gmod_tool\" )"},{"description":"Selects a random weapon from the player's inventory and switches to it.","code":"local weapons = Entity( 1 ):GetWeapons()\nlocal weapon = weapons[ math.random( #weapons ) ]\n\nEntity( 1 ):SelectWeapon( weapon:GetClass() )"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"SendHint","parent":"Player","type":"classfunc","description":{"text":"Sends a hint to a player.","note":"This function is only available in Sandbox and its derivatives. Since this adds `#Hint_` to the beginning of each message, you should only use it with default hint messages, or those cached with language.Add. For hints with custom text, look at notification.AddLegacy."},"realm":"Server","file":{"text":"gamemodes/sandbox/gamemode/player_extension.lua","line":"119-L127"},"args":{"arg":[{"text":"Name/class/index of the hint. You can find a list of hint names for this function here.","name":"name","type":"string"},{"text":"Delay in seconds before showing the hint","name":"delay","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SendLua","parent":"Player","type":"classfunc","description":{"text":"Executes a simple Lua string on the player.","note":"If you need to use this function more than once consider using net library. Send net message and make the entire code you want to execute in net.Receive on client."},"realm":"Server","args":{"arg":{"text":"The script to execute, limited to 6000 bytes.","name":"script","type":"string"}}},"example":{"description":"Sends \"Hello World\" to the client's console.","code":"Entity( 1 ):SendLua( \"print( 'Hello World' )\" )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetActiveWeapon","parent":"Player","type":"classfunc","description":"Sets the player's active weapon. You should use CUserCmd:SelectWeapon or Player:SelectWeapon, instead in most cases.\n\nThis function will not trigger the weapon switch events or associated equip animations. It will bypass \n GM:PlayerSwitchWeapon and the currently active weapon's WEAPON:Holster return value.","realm":"Server","args":{"arg":{"text":"The weapon to equip.","name":"weapon","type":"Weapon"}}},"example":{"description":"Holster the weapon of a player and restore it after 20 seconds.","code":"local ply = Entity( 1 )\nlocal prevWeapon = ply:GetActiveWeapon()\nlocal prevWeaponClass = prevWeapon:GetClass()\n\nply:SetActiveWeapon( NULL ) -- Holster the weapon\n\ntimer.Simple(20, function()\n\tif ( !prevWeapon:IsValid() ) then\n\t\tprevWeapon = ply:Give( prevWeaponClass )\n\tend\n\n\tply:SelectWeapon( prevWeapon )\nend)"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetActivity","parent":"Player","type":"classfunc","description":"Sets the player's activity.","added":"2021.03.31","realm":"Server","args":{"arg":{"text":"The new activity to set. See Enums/ACT.","name":"act","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetAllowFullRotation","parent":"Player","type":"classfunc","description":"Set if the players' model is allowed to rotate around the pitch and roll axis.","realm":"Shared","args":{"arg":{"text":"Allowed to rotate","name":"Allowed","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetAllowWeaponsInVehicle","parent":"Player","type":"classfunc","description":{"text":"Allows player to use their weapons in a vehicle. You need to call this before entering a vehicle.","bug":{"text":"Shooting in a vehicle fires two bullets.","issue":"1277"}},"realm":"Server","args":{"arg":{"text":"Show we allow player to use their weapons in a vehicle or not.","name":"allow","type":"boolean"}}},"example":{"description":"Adds a console command to toggle the ability to use weapons in vehicles.","code":"concommand.Add( \"weps_in_car\", function( ply )\n\tply:SetAllowWeaponsInVehicle( not ply:GetAllowWeaponsInVehicle() )\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetAmmo","parent":"Player","type":"classfunc","description":"Sets the amount of the specified ammo for the player.","realm":"Shared","args":{"arg":[{"text":"The amount of ammunition to set.","name":"ammoCount","type":"number"},{"text":"The ammunition type. Can be either number ammo ID or string ammo name. See Default Ammo Types for default values.","name":"ammoType","type":"any"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetArmor","parent":"Player","type":"classfunc","description":"Sets the player armor value.\n\nSee GM:HandlePlayerArmorReduction for a hook that allows manipulating what armor does.","realm":"Server","args":{"arg":{"text":"The amount to set the armor value of the player to.","name":"amount","type":"number"}}},"example":[{"description":"Sets the player armor to 100 when they types \"SetArmor\" at the console.","code":"concommand.Add( \"SetArmor\", function( ply )\n\tply:SetArmor( 100 )\nend )","output":"Sets the player armor to 100"},{"description":"Gives the player armor to first vararg when they types \"AddArmor\" at the console.","code":"concommand.Add( \"AddArmor\", function( ply, cmd, args )\n\tlocal Armor = args[1] or 100\n\tply:SetArmor( ply:Armor() + Armor )\nend )","output":"Adds the player armor to first vararg"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"SetAvoidPlayers","parent":"Player","type":"classfunc","description":"Pushes the player away from other players whenever the player inside another players' bounding box.\n\nThis avoidance is performed clientside by altering movement sent to server.\n\nThis applies to players within a single team. (Player:Team)","realm":"Shared","args":{"arg":{"text":"Whether to avoid teammates, or not.","name":"avoidPlayers","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetCanWalk","parent":"Player","type":"classfunc","description":"Set if the player should be allowed to walk using the (default) alt key. (`+walk` keybind)","realm":"Shared","args":{"arg":{"text":"`true` allows the player to walk.","name":"canWalk","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetCanZoom","parent":"Player","type":"classfunc","description":"Sets whether the player can use the HL2 suit zoom (`+zoom` bind) or not.","realm":"Shared","args":{"arg":{"text":"Whether to make the player able or unable to zoom.","name":"canZoom","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetClassID","parent":"Player","type":"classfunc","description":{"text":"Sets the player's class id.","internal":"Use player_manager.SetPlayerClass instead."},"realm":"Shared","args":{"arg":{"text":"The class id the player is being set with.","name":"classID","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetCrouchedWalkSpeed","parent":"Player","type":"classfunc","description":"Sets the crouched walk speed multiplier.\n\nHas no effect for values above 1.\n\nSee also Player:SetWalkSpeed and Player:GetCrouchedWalkSpeed.","realm":"Shared","args":{"arg":{"text":"The walk speed multiplier that crouch speed should be.","name":"speed","type":"number"}}},"example":{"description":"Set the crouch speed to be as fast as the players walk speed.","code":"Entity( 1 ):SetCrouchedWalkSpeed( 1 )","output":"The player will crouch-walk as fast as normal walking."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetCurrentViewOffset","parent":"Player","type":"classfunc","description":"Sets the **actual** view offset which equals the difference between the players actual position and their view when standing.\n\nDo not confuse with Player:SetViewOffset and Player:SetViewOffsetDucked","realm":"Shared","args":{"arg":{"text":"The new view offset.","name":"viewOffset","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDeaths","parent":"Player","type":"classfunc","description":"Sets a player's death count","realm":"Server","args":{"arg":{"text":"Number of deaths (positive or negative)","name":"deathCount","type":"number"}}},"example":{"description":"Sets the deaths of player 1 to 5","code":"Entity( 1 ):SetDeaths( 5 )","output":"None"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetDrivingEntity","parent":"Player","type":"classfunc","description":{"text":"Sets the driving entity and driving mode.\n\nUse drive.PlayerStartDriving instead, see Entity Driving.","internal":""},"realm":"Shared","args":{"arg":[{"text":"The entity the player should drive.","name":"drivingEntity","type":"Entity","default":"NULL"},{"text":"The driving mode index.","name":"drivingMode","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDSP","parent":"Player","type":"classfunc","description":"Activates a given DSP (Digital Signal Processor) effect on all sounds that the player hears. This is equivalent to setting `dsp_player` convar on the player.\n\n\t\tTo apply a DSP effect to individual sounds, see CSoundPatch:SetDSP","realm":"Shared","args":{"arg":[{"text":"The index of the DSP sound filter to apply.\n\n\t\t\tFor a list of the available IDs and their meaning, see DSP Presets.","name":"dspEffectId","type":"number"},{"text":"If set to true the sound filter will be removed faster.","name":"fastReset","type":"boolean","note":"**This only works clientside**  \n\t\t\t\tIf used serverside, a message will be displayed (`SetPlayerDSP: fastReset only valid from client`) in the server console."}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDuckSpeed","parent":"Player","type":"classfunc","description":{"text":"Sets how quickly a player ducks.","bug":{"text":"This will not work for values >= 1.","issue":"2722"}},"realm":"Shared","args":{"arg":{"text":"How quickly the player will duck.","name":"duckSpeed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetEyeAngles","parent":"Player","type":"classfunc","description":{"text":"Sets the local angle of the player's view (may rotate body too if angular difference is large)","note":"This function works differently when the player is in a vehicle. In that case passing `Angle(0, 90, 0)` will have the player look forward (out the windshield) and `Angle(0, 0, 0)` will have them look to the right."},"realm":"Shared","args":{"arg":{"text":"Angle to set the view to","name":"angle","type":"Angle"}}},"example":{"description":"Points the first player at `Vector(0, 0, 0)` or forward if they are in a vehicle","code":"local ply = player.GetByID(1)\n\nif (not ply:InVehicle()) then\n\tlocal vec1 = Vector( 0, 0, 0 ) -- Where the player should look at\n\tlocal vec2 = ply:GetShootPos() -- The player's eye pos\n\n\tply:SetEyeAngles( ( vec1 - vec2 ):Angle() ) -- Sets to the angle between the two vectors\nelse\n\tply:SetEyeAngles( Vector( 0, 90, 0 ) )\nend","output":"The first player will look at 0, 0, 0 or forward if they are in a vehicle"},"realms":["Server","Client"],"type":"Function"},
{"cat":"classfunc","function":{"name":"SetFlashlightColor","parent":"Player","type":"classfunc","description":"Sets the color of a player's flashlight. \n\t\tCan be used on other players.","added":"2025.09.25","realm":"Client","args":{"arg":{"text":"Flashlight color","name":"color","type":"Color","default":"Color(255,255,255)"}}},"example":{"description":"Makes local player's flashlight cycle through all the rainbow colors","code":"hook.Add( \"Think\", \"RainbowFlashlight\", function()\n\tlocal clr = HSVToColor( ( CurTime() * 20 ) % 360, 1, 1 );\n\tLocalPlayer():SetFlashlightColor( clr )\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetFOV","parent":"Player","type":"classfunc","description":"Set a player's FOV (Field Of View) over a certain amount of time.\n\nThis is meant to be called on the server or shared (for prediction), it will have no effect if called clientside only. You may want to use GM:CalcView for that instead.","realm":"Shared","args":{"arg":[{"text":"the angle of perception (FOV). Set to 0 to return to default user FOV. ( Which is ranging from 75 to 100, depending on user settings )","name":"fov","type":"number"},{"text":"the time it takes to transition to the FOV expressed in a floating point.","name":"time","type":"number","default":"0"},{"text":"The requester or \"owner\" of the zoom event. Only this entity will be able to change the player's FOV until it is set back to 0.","name":"requester","type":"Entity","default":"self","added":"2020.03.17"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetFrags","parent":"Player","type":"classfunc","description":"Sets a player's frags (kills)","realm":"Server","args":{"arg":{"text":"Number of frags (positive or negative)","name":"fragCount","type":"number"}}},"example":{"description":"Sets the frags of player 1 to 9001","code":"Entity( 1 ):SetFrags( 9001 )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetHands","parent":"Player","type":"classfunc","description":"Sets the hands entity of a player.\n\nThe hands entity is an entity introduced in Garry's Mod 13 and it's used to show the player's hands attached to the viewmodel.\nThis is similar to the approach used in L4D and CS:GO, for more information on how to implement this system in your gamemode visit Using Viewmodel Hands.","realm":"Shared","args":{"arg":{"text":"The hands entity to set","name":"hands","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetHoveredWidget","parent":"Player","type":"classfunc","description":"Sets the widget that is currently hovered by the player's mouse.","realm":"Shared","args":{"arg":{"text":"The widget entity that the player is hovering.","name":"widget","type":"Entity","default":"NULL"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetHull","parent":"Player","type":"classfunc","description":{"text":"Sets the size of the Player [Axis-Aligned Bounding Box (AABB)](https://en.wikipedia.org/wiki/Minimum_bounding_box) used for physics and movement Hull Traces.\n\n\t\tSee also: Player:GetHull, Player:SetHullDuck, Player:GetHullDuck","note":"This value is **not** replicated automatically to clients and must be manually called in both the Server and Client Realms."},"realm":"Shared","args":{"arg":[{"text":"The hull mins, the lowest corner of the Player's bounding box.","name":"mins","type":"Vector"},{"text":"The hull maxs, the highest corner of the Player's bounding box, opposite of the mins.","name":"maxs","type":"Vector"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetHullDuck","parent":"Player","type":"classfunc","description":{"text":"Sets the size of the Player [Axis-Aligned Bounding Box (AABB)](https://en.wikipedia.org/wiki/Minimum_bounding_box) used for physics and movement Hull Traces while they are crouching (or \"Ducking\").\n\n\t\tSee also: Player:GetHullDuck, Player:GetHull, Player:SetHull","note":"This value is **not** replicated automatically to clients and must be manually called in both the Server and Client Realms."},"realm":"Shared","args":{"arg":[{"text":"The hull mins, the lowest corner of the Player's bounding box while crouching.","name":"mins","type":"Vector"},{"text":"The hull maxs, the highest corner of the Player's crouching bounding box, opposite of the mins.","name":"maxs","type":"Vector"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetJumpPower","parent":"Player","type":"classfunc","description":"Sets the jump power, eg. the velocity that will be applied to the player when they jump.","realm":"Shared","args":{"arg":{"text":"The new jump velocity.","name":"jumpPower","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetLadderClimbSpeed","parent":"Player","type":"classfunc","description":"Sets the player's ladder climbing speed.\n\nSee Player:SetWalkSpeed for normal walking speed, Player:SetRunSpeed for sprinting speed and Player:SetSlowWalkSpeed for slow walking speed.","realm":"Shared","added":"2020.03.17","args":{"arg":{"text":"The ladder climbing speed.","name":"speed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetLaggedMovementValue","parent":"Player","type":"classfunc","description":{"text":"Slows down the player movement simulation by the timescale, this is used internally in the HL2 weapon stripping sequence.\n\nIt achieves such behavior by multiplying the Global.FrameTime by the specified timescale at the start of the movement simulation and then restoring it afterwards.","note":"This is reset to 1 on spawn.\n\nThere is no weapon counterpart to this, you'll have to hardcode the multiplier in the weapon or call Weapon:SetNextPrimaryFire / Weapon:SetNextSecondaryFire manually."},"realm":"Server","args":{"arg":{"text":"The timescale multiplier.","name":"timescale","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetLastHitGroup","parent":"Player","type":"classfunc","description":"Sets the hitgroup where the player was last hit.","realm":"Server","added":"2020.03.17","args":{"arg":{"text":"The hitgroup to set as the \"last hit\", see Enums/HITGROUP.","name":"hitgroup","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetMaxArmor","parent":"Player","type":"classfunc","description":"Sets the maximum amount of armor the player should have. This affects default built-in armor pickups, but not Player:SetArmor.","realm":"Server","added":"2020.10.14","args":{"arg":{"text":"The new max armor value.","name":"maxarmor","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetMaxSpeed","parent":"Player","type":"classfunc","description":{"text":"Sets the maximum speed which the player can move at.","note":"This is called automatically by the engine. If you wish to limit player speed without setting their run/sprint speeds, see CMoveData:SetMaxClientSpeed."},"realm":"Shared","args":{"arg":{"text":"The maximum speed.","name":"walkSpeed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetMuted","parent":"Player","type":"classfunc","description":"Sets if the player should be voicechat muted locally.","realm":"Client","args":{"arg":{"text":"Mute or unmute.","name":"mute","type":"boolean"}}},"example":[{"description":"Mutes all players on the server","code":"for i, ply in ipairs( player.GetAll() ) do\n\tply:SetMuted( true )\nend"},{"description":"Make muting also apply to text chat","code":"hook.Add( \"OnPlayerChat\", \"MutePlayerChat\", function( ply )\n\tif ply:IsMuted() then\n\t\treturn true\n\tend\nend )"}],"realms":["Client"],"type":"Function"},
{"function":{"name":"SetNoCollideWithTeammates","parent":"Player","type":"classfunc","description":{"text":"Sets whenever the player should not collide with their teammates, based on their Player:Team.","note":["This will only work for teams with ID 1 to 4 due to internal Engine limitations.","This causes traces with COLLISION_GROUP_PLAYER to pass through players."]},"realm":"Shared","args":{"arg":{"text":"`true` to disable, `false` to enable collision.","name":"shouldNotCollide","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNoTarget","parent":"Player","type":"classfunc","description":"Sets the players visibility towards NPCs.\n\nInternally this toggles the FL_NOTARGET flag, which you can manually test for using Entity:IsFlagSet","realm":"Server","args":{"arg":{"text":"The visibility.","name":"visibility","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetObserverMode","parent":"Player","type":"classfunc","description":"Sets the players observer mode. You must start the spectating first with Player:Spectate.","realm":"Shared","args":{"arg":{"text":"Spectator mode using Enums/OBS_MODE.","name":"mode","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetPData","parent":"Player","type":"classfunc","description":{"text":"Writes a **P**ersistent **Data** key-value pair to the SQL database. (`sv.db` when called on server, `cl.db` when called on client)\n\nInternally uses the sql library. See util.SetPData for cases when the player is not currently on the server.","note":["This function internally uses Player:SteamID64, it previously utilized Player:UniqueID which could have caused collisions (two or more players sharing the same PData entry). Player:SetPData now replaces all instances of Player:UniqueID with Player:SteamID64 when running Player:SetPData","PData is not networked from servers to clients!"]},"realm":"Shared","file":{"text":"lua/includes/extensions/player.lua","line":"133-L146"},"args":{"arg":[{"text":"Name of the PData key","name":"key","type":"string"},{"text":"Value to write to the key (**must** be an SQL valid data type, such as a string or integer)","name":"value","type":"any"}]},"rets":{"ret":{"text":"Whether the operation was successful or not","name":"","type":"boolean"}}},"example":{"description":"Sets the key \"money\" from player 1's PData to 100","code":"Entity( 1 ):SetPData( \"money\", 100 )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetPlayerColor","parent":"Player","type":"classfunc","description":"Sets the player model's color. The part of the model that is colored is determined by the model itself, and is different for each model.","realm":"Shared","args":{"arg":{"text":"This is the color to be set. The format is Vector(r, g, b), and each color should be between 0 and 1.","name":"Color","type":"Vector"}}},"example":[{"description":"When a player spawns their color will be red.","code":"hook.Add( \"PlayerSpawn\", \"PlayerColor\", function( ply )\n\tply:SetPlayerColor( Vector( 1, 0, 0 ) )\nend)"},{"description":"A function you could use to set the player's color to a Global.Color rather than a Vector.","code":"function SetColor( ply, color )\n\tply:SetPlayerColor( Vector( color.r / 255, color.g / 255, color.b / 255 ) )\nend"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetPressedWidget","parent":"Player","type":"classfunc","description":"Sets the widget that is currently in use by the player's mouse.\n\nHaving a pressed widget stops the player from firing their weapon to allow input to be passed onto the widget.","realm":"Shared","args":{"arg":{"text":"The widget the player is currently using.","name":"pressedWidget","type":"Entity","default":"NULL"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetRenderAngles","parent":"Player","type":"classfunc","description":"Sets the render angles of a player. Value set by this function is reset to player's angles (Entity:GetAngles) right after GM:UpdateAnimation.","realm":"Shared","args":{"arg":{"text":"The new render angles to set","name":"ang","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetRunSpeed","parent":"Player","type":"classfunc","description":{"text":"Sets the player's sprint speed.\n\nSee also Player:GetRunSpeed, Player:SetWalkSpeed and Player:SetMaxSpeed.","note":"player_default class run speed is: `400`"},"realm":"Shared","args":{"arg":{"text":"The new sprint speed when `sv_friction` is below `10`. Higher `sv_friction` values will result in slower speed.\n\nHas to be `7` or above or the player **won't** be able to move.","name":"runSpeed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetSlowWalkSpeed","parent":"Player","type":"classfunc","description":{"text":"Sets the player's slow walking speed, which is activated via  keybind.\n\nSee Player:SetWalkSpeed for normal walking speed, Player:SetRunSpeed for sprinting speed and Player:SetLadderClimbSpeed for ladder climb speed.","key":"+WALK"},"realm":"Shared","added":"2020.03.17","args":{"arg":{"text":"The new slow walking speed.","name":"speed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetStepSize","parent":"Player","type":"classfunc","description":"Sets the maximum height a player can step onto without jumping.","realm":"Shared","args":{"arg":{"text":"The new maximum height the player can step onto without jumping","name":"stepHeight","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetSuitPower","parent":"Player","type":"classfunc","description":{"text":"Sets the player's HEV suit power.","bug":{"text":"This will only work for the local player when used clientside.","issue":"3449"}},"realm":"Shared","args":{"arg":{"text":"The new suit power.","name":"power","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetSuppressPickupNotices","parent":"Player","type":"classfunc","description":"Sets whenever to suppress the pickup notification for the player.","realm":"Shared","args":{"arg":{"text":"Whenever to suppress the notice or not.","name":"doSuppress","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetTeam","parent":"Player","type":"classfunc","description":"Sets the player to the chosen team. The value is networked to clients at reduced bit count (16 bits) as as a signed value, so the real range is [-32768, 32767].\n\nCan be retrieved via Player:Team","realm":"Server","args":{"arg":{"text":"The team that the player is being set to.","name":"team","type":"number"}}},"example":{"description":"Sets the players team to the first argument when writing \"set_team\" into the console and respawns the player afterwards, ex. \"set_team 1\".","code":"concommand.Add( \"set_team\", function( ply, cmd, args )\n\tlocal Team = args[1] or 1\n\tply:SetTeam( Team )\n\tply:Spawn()\nend )","output":"Sets the player to team 1 and respawns them."},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetUnDuckSpeed","parent":"Player","type":"classfunc","description":"Sets how quickly a player un-ducks","realm":"Shared","args":{"arg":{"text":"How quickly the player will un-duck","name":"UnDuckSpeed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetupHands","parent":"Player","type":"classfunc","description":"Sets up the player's hands for the viewmodel. Calls GM:PlayerSetHandsModel to determine the model. If no entity is provided, uses the player's own hands model. If spectating another entity, pass that entity to use its hands model instead.","realm":"Server","file":{"text":"lua/includes/extensions/player.lua","line":"185-L200"},"args":{"arg":{"text":"If the player is spectating an entity, this should be the entity the player is spectating, so we can use its hands model instead.","name":"ent","type":"Entity","default":"nil"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetUserGroup","parent":"Player","type":"classfunc","description":"Sets the usergroup of the player.","realm":"Server","file":{"text":"lua/includes/extensions/player_auth.lua","line":"61-L65"},"args":{"arg":{"text":"The user group of the player.","name":"groupName","type":"string"}}},"example":{"description":"Make the player superadmin and print their group.","code":"Player( 1 ):SetUserGroup( \"superadmin\" )\nprint( Player( 1 ):GetUserGroup() )","output":"```\nsuperadmin\n```"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetViewEntity","parent":"Player","type":"classfunc","description":"Attaches the players view to the position and angles of the specified entity.","realm":"Server","args":{"arg":{"text":"The entity to attach the player view to.","name":"viewEntity","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetViewOffset","parent":"Player","type":"classfunc","description":"Sets the **desired** view offset which equals the difference between the players actual position and their view when standing.\n\nIf you want to set **actual** view offset, use Player:SetCurrentViewOffset\n\nSee also Player:SetViewOffsetDucked for **desired** view offset when crouching.","realm":"Shared","args":{"arg":{"text":"The new desired view offset when standing.","name":"viewOffset","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetViewOffsetDucked","parent":"Player","type":"classfunc","description":"Sets the **desired** view offset which equals the difference between the players actual position and their view when crouching.\n\nIf you want to set **actual** view offset, use Player:SetCurrentViewOffset\n\nSee also Player:SetViewOffset for **desired** view offset when standing.","realm":"Shared","args":{"arg":{"text":"The new desired view offset when crouching.","name":"viewOffset","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetViewPunchAngles","parent":"Player","type":"classfunc","description":"Sets client's view punch angle, but not the velocity. See Player:ViewPunch","realm":"Shared","args":{"arg":{"text":"The angle to set.","name":"punchAngle","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetViewPunchVelocity","parent":"Player","type":"classfunc","description":"Sets client's view punch velocity. See Player:ViewPunch and Player:SetViewPunchAngles","realm":"Shared","added":"2020.10.14","args":{"arg":{"text":"The angle velocity to set.","name":"punchVel","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetVoiceVolumeScale","parent":"Player","type":"classfunc","description":{"text":"Sets the voice volume scale for given player on client. This value will persist from server to server, but will be reset when the game is shut down.","note":"This doesn't work on bots, their scale will always be `1`. Does not work with multiruns."},"realm":"Client","added":"2021.06.09","args":{"arg":{"text":"The voice volume scale, where `0` is 0% and `1` is 100%.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetWalkSpeed","parent":"Player","type":"classfunc","description":{"text":"Sets the player's normal walking speed. Not sprinting, not slow walking .\n\nSee also Player:SetSlowWalkSpeed, Player:GetWalkSpeed, Player:SetCrouchedWalkSpeed, Player:SetMaxSpeed and Player:SetRunSpeed.","key":"+walk","bug":{"text":"Using a speed of `0` can lead to prediction errors, and can cause players to move at sv_maxvelocity","issue":"2030"},"note":"`player_default` class walk speed is: `200`."},"realm":"Shared","args":{"arg":{"text":"The new walk speed when `sv_friction` is below `10`. Higher `sv_friction` values will result in slower speed.\n\nHas to be `7` or above or the player **won't** be able to move.","name":"walkSpeed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetWeaponColor","parent":"Player","type":"classfunc","description":"Sets the player weapon's color. The part of the model that is colored is determined by the model itself, and is different for each model.","realm":"Shared","args":{"arg":{"text":"This is the color to be set. The format is Vector(r,g,b), and each color should be between 0 and 1.","name":"Color","type":"Vector"}}},"example":{"description":"When a player spawns their weapon's color will be red.","code":"hook.Add(\"PlayerSpawn\", \"SpawnSetColor\", function( ply )\n\tply:SetWeaponColor( Vector( 1, 0, 0 ) )\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ShouldDrawLocalPlayer","parent":"Player","type":"classfunc","description":"Returns whether the **local player's** player model will be drawn at the time the function is called.\n\nDespite this being a method on a player object, this will always represent the state of the local player, not of the player entity this method is used on.","realm":"Client","rets":{"ret":{"text":"`true` if the player's playermodel is visible","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ShouldDropWeapon","parent":"Player","type":"classfunc","description":{"text":"Sets whether the player's current weapon should drop on death.","note":"This is reset on spawn to the player class's **DropWeaponOnDie** field by player_manager.OnPlayerSpawn."},"realm":"Server","args":{"arg":{"text":"Whether to drop the player's current weapon or not","name":"drop","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ShowProfile","parent":"Player","type":"classfunc","description":"Opens the player steam profile page in the steam overlay browser.","realm":"Client"},"example":{"description":"Frame with all players and when click on it open Steam Profile.","code":"local frame = vgui.Create( \"DFrame\" )\nframe:Center()\nframe:SetSize( 300, 100 )\nframe:SetTitle( \"Show Steam Profile\" )\n\nfor i, ply in ipairs(player.GetHumans()) do\n\tlocal addbutton = vgui.Create( \"DButton\", frame )\n\taddbutton:SetPos( ( i * 75 ) - 50, 50 )\n\taddbutton:SetSize( 75, 20 )\n\taddbutton:SetText( ply:Name() )\n\taddbutton.DoClick = function()\n\t\tply:ShowProfile()\n\tend\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SimulateGravGunDrop","parent":"Player","type":"classfunc","description":"Signals the entity that it was dropped by the gravity gun.","realm":"Server","args":{"arg":{"text":"Entity that was dropped.","name":"ent","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SimulateGravGunPickup","parent":"Player","type":"classfunc","description":"Signals the entity that it was picked up by the gravity gun. This call is only required if you want to simulate the situation of picking up objects.","realm":"Server","args":{"arg":[{"text":"The entity picked up","name":"ent","type":"Entity"},{"text":"Whether or not to show lightning effects around the entity","name":"lightning","type":"boolean","default":"false"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Spectate","parent":"Player","type":"classfunc","description":{"text":"Starts spectate mode for given player. This will also affect the players movetype in some cases.\n\nPlayer:UnSpectate should be used to remove the player from spectate mode, or call this with `OBS_MODE_NONE`.","bug":"The player must be respawned, otherwise they will be able to walk through doors and become invincible. This will be fixed in a future update."},"realm":"Server","args":{"arg":{"text":"Spectate mode, see Enums/OBS_MODE.","name":"mode","type":"number{OBS_MODE}"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SpectateEntity","parent":"Player","type":"classfunc","description":"Makes the player spectate the entity.\n\nTo get the applied spectated entity, use Player:GetObserverTarget.","realm":"Server","args":{"arg":{"text":"Entity to spectate.","name":"entity","type":"Entity"}}},"example":{"description":"Creates a entity, spectates it and after 5 seconds, stops spectating it.","code":"local ent = ents.Create( \"prop_physics\" )\nent:SetModel( \"models/hunter/misc/sphere025x025.mdl\" )\nent:SetPos( Vector( 0, 0, 0 ) )\nent:Spawn()\n \nfor _, ply in ipairs( player.GetAll() ) do\n\tply:Spectate( OBS_MODE_CHASE )\n\tply:SpectateEntity( ent )\n\tply:StripWeapons()\n\n\ttimer.Simple( 5, function()\n\t\tif IsValid( ply ) then\n\t\t\tply:UnSpectate()\n\t\t\tply:Spawn()\n\t\tend\n\tend )\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SprayDecal","parent":"Player","type":"classfunc","description":"Makes a player spray their decal.","realm":"Server","args":{"arg":[{"text":"The location to spray from","name":"sprayOrigin","type":"Vector"},{"text":"The location to spray to","name":"sprayEndPos","type":"Vector"}]}},"example":{"description":"Makes the player spray their decal 5000 units away.","code":"local ply = Entity( 1 )\nlocal eyepos = ply:EyePos()\nply:SprayDecal( eyepos, eyepos + ply:GetAimVector() * 5000 )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SprintDisable","parent":"Player","type":"classfunc","description":"Disables the sprint on the player.","realm":"Server"},"example":{"description":"Stops and prevents player with ID 1 from sprinting","code":"Entity( 1 ):SprintDisable()"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SprintEnable","parent":"Player","type":"classfunc","description":"Enables the sprint on the player.","realm":"Server"},"example":{"description":{"text":"Allows the player with ID 1 to use the sprint ( by default) feature.","key":"SHIFT"},"code":"Entity( 1 ):SprintEnable()"},"realms":["Server"],"type":"Function"},
{"function":{"name":"StartSprinting","parent":"Player","type":"classfunc","description":{"text":"Doesn't appear to do anything.","deprecated":"This appears to be a direct binding to internal functionality that is overridden by the engine every frame so calling these functions may not have any or expected effect."},"realm":"Shared"},"example":{"description":"An example alternative to this function.","code":{"text":"local vDelay = 0\nlocal prevDown = 0\nhook.Add( \"StartCommand\", \"TestFunc\", function( ply, cmd )\n    if ( cmd:KeyDown( IN_FORWARD ) and prevDown == false ) then\n        vDelay = CurTime() + 0.4\n    elseif ( cmd:KeyDown( IN_FORWARD ) ) then\n        if ( vDelay","curtime":{"then":"","cmd:setbuttons":"","bit.bor":"","cmd:getbuttons":"","in_speed":"","end":"","prevdown":"cmd:KeyDown(","in_forward":"","ode":"ode"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"StartWalking","parent":"Player","type":"classfunc","description":{"text":"When used in a GM:SetupMove hook, this function will force the player to walk, as well as preventing the player from sprinting.","deprecated":"This appears to be a direct binding to internal functionality that is overridden by the engine every frame so calling these functions may not have any or expected effect."},"realm":"Shared"},"example":{"description":"Example usage, forces the player to walk. (+walk console command)","code":"hook.Add( \"SetupMove\", \"TestFunc\", function( ply, mv, cmd )\n\tply:StartWalking()\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SteamID","parent":"Player","type":"classfunc","description":{"text":"Returns the player's SteamID.\n\nSee Player:AccountID for a shorter version of the SteamID and Player:SteamID64 for the full SteamID.\n\nIt is recommended to use Player:SteamID64 over the other SteamID formats whenever possible.","note":"In a `-multirun` environment, this will return `STEAM_ID_LAN` for all \"copies\" of a player because they are not authenticated with Steam.\n\nFor Bots this will return `BOT`."},"realm":"Shared","rets":{"ret":{"text":"\"Text\" representation of the player's SteamID.","name":"","type":"string"}}},"example":{"description":"Prints the EntityID, Name and SteamID of all players.","code":"for _, ply in ipairs( player.GetAll() ) do\n\tprint( \"[\" .. ply:EntIndex() .. \"]\", ply:Nick(), ply:SteamID() )\nend","output":"A list consisting of every player's EntityID, Name & SteamID on the server."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SteamID64","parent":"Player","type":"classfunc","description":{"text":"Returns the player's full **64-bit SteamID**, also known as **CommunityID**. Information on how data is packed into this value can be found [here](https://developer.valvesoftware.com/wiki/SteamID).\n\nSee Player:AccountID for a function that returns only the Account ID part of the SteamID and Player:SteamID for the text version of the SteamID.","note":"In a `-multirun` environment, this will return `\"0\"` for all \"copies\" of a player because they are not authenticated with Steam.\n\nFor bots, this will return `90071996842377216` (equivalent to `STEAM_0:0:0`) for the first bot to join.\n\nFor each additional bot, the number increases by 1. So the next bot will be `90071996842377217` (`STEAM_0:1:0`) then `90071996842377218` (`STEAM_0:0:1`) and so on."},"realm":"Shared","rets":{"ret":{"text":"Player's 64-bit SteamID aka CommunityID.","name":"","type":"string","note":"The return value is a string, not a number, since Lua's numbers are unable to store the entire 64bit numbers without data loss."}}},"example":{"description":"Prints the 64bit SteamID of player.","code":"print( Entity( 1 ):SteamID64() )","output":"64bit SteamID (about 17 digits)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"StopSprinting","parent":"Player","type":"classfunc","description":{"text":"When used in a GM:SetupMove hook, this function will prevent the player from sprinting.\n\nWhen +walk is engaged, the player will still be able to sprint to half speed (normal run speed) as opposed to full sprint speed without this function.","deprecated":"This appears to be a direct binding to internal functionality that is overridden by the engine every frame so calling these functions may not have any or expected effect."},"realm":"Shared"},"example":{"description":"Example usage, disables sprinting at all times.","code":"hook.Add( \"SetupMove\", \"TestFunc\", function( ply, mv, cmd )\n\tply:StopSprinting()\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"StopWalking","parent":"Player","type":"classfunc","description":{"text":"When used in a GM:SetupMove hook, this function behaves unexpectedly by preventing the player from sprinting similar to Player:StopSprinting.","deprecated":"This appears to be a direct binding to internal functionality that is overridden by the engine every frame so calling these functions may not have any or expected effect."},"realm":"Shared"},"example":{"description":"Disables Sprinting, not Walking.","code":"hook.Add( \"SetupMove\", \"TestFunc\", function( ply, mv, cmd )\n\tply:StopWalking()\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"StopZooming","parent":"Player","type":"classfunc","description":"Turns off the zoom mode of the player. (+zoom console command)\n\nBasically equivalent of entering \"-zoom\" into player's console.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"StripAmmo","parent":"Player","type":"classfunc","description":{"text":"Removes all ammo from the player.","deprecated":"Alias of Player:RemoveAllAmmo"},"realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"StripWeapon","parent":"Player","type":"classfunc","description":{"text":"Removes the specified weapon class from a certain player","note":"this function will call the Entity:OnRemove but if you try use Entity:GetOwner it will return nil"},"realm":"Server","args":{"arg":{"text":"The weapon class to remove","name":"weapon","type":"string"}}},"example":{"description":"Removes the crowbar from the player with the ID 1","code":"Entity( 1 ):StripWeapon( \"weapon_crowbar\" )","output":"Crowbar removed from player 1"},"realms":["Server"],"type":"Function"},
{"function":{"name":"StripWeapons","parent":"Player","type":"classfunc","description":"Removes all weapons from a certain player","realm":"Server"},"example":{"description":"Removes all the weapons from the player with the ID 1","code":"Entity( 1 ):StripWeapons()","output":"Player 1 has no weapons anymore"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SuppressHint","parent":"Player","type":"classfunc","description":{"text":"Prevents a hint from showing up.","note":"This function is only available in Sandbox and its derivatives"},"realm":"Server","file":{"text":"gamemodes/sandbox/gamemode/player_extension.lua","line":"129-L137"},"args":{"arg":{"text":"Hint name/class/index to prevent from showing up. You can find a list of hint names for this function here.","name":"name","type":"string"}}},"example":{"description":"Removes three default Sandbox hints (taken from the source code of the Sandbox gamemode):","code":"-- Hint type: Show opening menu hint\n-- ... Suppress this hint =>\nply:SuppressHint( \"OpeningMenu\" )\n\n-- Hint type: Tell them how to turn the hints off\n-- ... Suppress this hint =>\nply:SuppressHint( \"Annoy1\" )\nply:SuppressHint( \"Annoy2\" )\n\n-- Other default Hint types: PhysgunFreeze, PhysgunUse, VehicleView ..."},"realms":["Server"],"type":"Function"},
{"function":{"name":"SwitchToDefaultWeapon","parent":"Player","type":"classfunc","description":"Attempts to switch the player weapon to the one specified in the \"cl_defaultweapon\" convar, if the player does not own the specified weapon nothing will happen.\n\nIf you want to switch to a specific weapon, use: Player:SetActiveWeapon","realm":"Server","file":{"text":"lua/includes/extensions/player.lua","line":"166-L177"}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Team","parent":"Player","type":"classfunc","description":"Returns the player's team ID, set by Player:SetTeam\n\nReturns 0 clientside when the game is not fully loaded.","realm":"Shared","rets":{"ret":{"text":"The player's team's index number, as in the Enums/TEAM or a custom team defined in team.SetUp.","name":"","type":"number"}}},"example":{"description":"Prints the name of the player's team","code":"print( team.GetName( Entity( 1 ):Team() ) )","output":"Something like `Unassigned` in console."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"TimeConnected","parent":"Player","type":"classfunc","description":"Returns the time in seconds since the player connected.\n\nBots will always return value 0.","realm":"Server","rets":{"ret":{"text":"How long this player was connected to the server for, in seconds.","name":"connectedTime","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"TraceHullAttack","parent":"Player","type":"classfunc","description":{"text":"Performs a trace hull and applies damage to the entities hit, returns the first entity hit.","warning":"Hitting the victim entity with this function in ENTITY:OnTakeDamage can cause infinite loops."},"realm":"Server","args":{"arg":[{"text":"The start position of the hull trace.","name":"startPos","type":"Vector"},{"text":"The end position of the hull trace.","name":"endPos","type":"Vector"},{"text":"The minimum coordinates of the hull.","name":"mins","type":"Vector"},{"text":"The maximum coordinates of the hull.","name":"maxs","type":"Vector"},{"text":"The damage to be applied.","name":"damage","type":"number"},{"text":"Bitflag specifying the damage type, see Enums/DMG.","name":"damageFlags","type":"number"},{"text":"The force to be applied to the hit object.","name":"damageForce","type":"number"},{"text":"Whether to apply damage to all hit NPCs or not.","name":"damageAllNPCs","type":"boolean"}]},"rets":{"ret":{"text":"The hit entity","name":"","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"TranslateWeaponActivity","parent":"Player","type":"classfunc","description":"Translates Enums/ACT according to the holdtype of players currently held weapon.","realm":"Shared","args":{"arg":{"text":"The initial Enums/ACT","name":"act","type":"number"}},"rets":{"ret":{"text":"Translated Enums/ACT","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"UnfreezePhysicsObjects","parent":"Player","type":"classfunc","description":{"text":"Unfreezes all objects the player has frozen with their Physics Gun. Same as double pressing  while holding Physics Gun.","key":"R"},"realm":"Shared","file":{"text":"gamemodes/base/gamemode/obj_player_extend.lua","line":"98-L153"}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"UniqueID","parent":"Player","type":"classfunc","description":{"text":"Returns a 32 bit integer that remains constant for a player across joins/leaves and across different servers. This can be used when a string is inappropriate - e.g. in a database primary key.","deprecated":"**This function has collisions,** where more than one player can have the same UniqueID. It is **highly** recommended to use Player:SteamID64, Player:SteamID or Player:AccountID instead, which are guaranteed to be unique to each player.","note":"In Singleplayer, this function will always return 1.","bug":{"text":"In a `-multirun` environment, the value returned is different on the serverside and clientside.","issue":"6389"}},"realm":"Shared","rets":{"ret":{"text":"The player's Unique ID","name":"","type":"number"}}},"example":[{"description":"Gets the Unique ID of a player.","code":"Entity( 1 ):UniqueID()","output":"Something like 1592073762"},{"description":"You can retrieve the UniqueID if the player is not on the server. To do this, you will need the player's Player:SteamID and execute the following line:","code":"local iUniqueID = util.CRC((\"gm_%s_gm\"):format(Entity( 1 ):SteamID():upper()))\nprint(iUniqueID == Entity(1):UniqueID())","output":"true"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"UniqueIDTable","parent":"Player","type":"classfunc","description":{"text":"Returns a table that will stay allocated for the specific player serverside between connects until the server shuts down or change map. On client it has no such special behavior.","note":"This table is not synchronized (networked) between client and server."},"file":{"text":"gamemodes/base/gamemode/obj_player_extend.lua","line":"157-L170"},"realm":"Shared","args":{"arg":{"text":"Unique table key.","name":"key","type":"any"}},"rets":{"ret":{"text":"The table that contains any info you have put in it.","name":"","type":"table"}}},"example":{"description":"Example usage","code":"local table = Entity( 1 ):UniqueIDTable( \"mytable\" )\ntable.MyValue = \"test\"\n\n// Somewhere else\nlocal table = Entity( 1 ):UniqueIDTable( \"mytable\" )\nprint( table.MyValue )\nlocal table = Entity( 1 ):UniqueIDTable( \"mytable_other\" )\nprint( table.MyValue )","output":"```\n\"test\"\nnil\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"UnLock","parent":"Player","type":"classfunc","description":"Unlocks the player movement if locked previously.\n\nWill disable godmode for the player if locked previously.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"UnSpectate","parent":"Player","type":"classfunc","description":{"text":"Removes the player from the spectate mode entirely.","bug":"The player must be respawned, otherwise they will be able to walk through doors and become invincible. This will be fixed in a future update."},"realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"UserID","parent":"Player","type":"classfunc","description":"Returns the player's user ID. This number will always be unique, but will reset if the player reconnects. (Always increments for each connecting player)\n\nYou can use Global.Player global function to get a player by their user ID.","realm":"Shared","rets":{"ret":{"text":"The player's user ID","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ViewPunch","parent":"Player","type":"classfunc","description":{"text":"Simulates a push on the client's screen. This **adds** view punch velocity, and does not reset the current view punch angle, for which you can use Player:SetViewPunchAngles.","note":"Despite being defined shared, it only functions when called server-side."},"realm":"Shared","args":{"arg":{"text":"The angle in which to push the player's screen.","name":"punchAngle","type":"Angle"}}},"example":{"description":"Knocks the player's camera upward","code":"Entity( 1 ):ViewPunch( Angle( -10, 0, 0 ) )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ViewPunchReset","parent":"Player","type":"classfunc","description":"Resets the player's view punch (and the view punch velocity, read more at Player:ViewPunch) effect back to normal.","realm":"Shared","args":{"arg":{"text":"Reset all ViewPunch below this threshold.","name":"tolerance","type":"number","default":"0"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"VoiceVolume","parent":"Player","type":"classfunc","description":"Returns the players voice volume, how loud the player's voice communication currently is, as a number in range of [0,1].","realm":"Client","rets":{"ret":{"text":"The voice volume.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetAngles","parent":"ProjectedTexture","type":"classfunc","description":"Returns the angle of the ProjectedTexture, which were previously set by ProjectedTexture:SetAngles","realm":"Client","rets":{"ret":{"text":"The angles of the ProjectedTexture.","name":"","type":"Angle"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetBrightness","parent":"ProjectedTexture","type":"classfunc","description":"Returns the brightness of the ProjectedTexture, which was previously set by ProjectedTexture:SetBrightness","realm":"Client","rets":{"ret":{"text":"The brightness of the ProjectedTexture.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetColor","parent":"ProjectedTexture","type":"classfunc","description":"Returns the color of the ProjectedTexture, which was previously set by ProjectedTexture:SetColor.","realm":"Client","rets":{"ret":{"text":"The Color of the ProjectedTexture.","name":"","type":"Color"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetConstantAttenuation","parent":"ProjectedTexture","type":"classfunc","description":"Returns the constant attenuation of the projected texture, which can also be set by ProjectedTexture:SetConstantAttenuation.","realm":"Client","rets":{"ret":{"text":"The constant attenuation","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetEnableShadows","parent":"ProjectedTexture","type":"classfunc","description":"Returns whether shadows are enabled for this ProjectedTexture, which was previously set by ProjectedTexture:SetEnableShadows","realm":"Client","rets":{"ret":{"text":"Whether shadows are enabled.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetFarZ","parent":"ProjectedTexture","type":"classfunc","description":"Returns the projection distance of the ProjectedTexture, which was previously set by ProjectedTexture:SetFarZ","realm":"Client","rets":{"ret":{"text":"The projection distance of the ProjectedTexture.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetHorizontalFOV","parent":"ProjectedTexture","type":"classfunc","description":"Returns the horizontal FOV of the ProjectedTexture, which was previously set by ProjectedTexture:SetHorizontalFOV or ProjectedTexture:SetFOV","realm":"Client","rets":{"ret":{"text":"The horizontal FOV of the ProjectedTexture.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetLightWorld","parent":"ProjectedTexture","type":"classfunc","description":"Returns whenever or not the Texture should light up world geometry.","realm":"Client","added":"2023.06.28","rets":{"ret":{"text":"`true` if the Texture should light up world geometry.","name":"lightworld","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetLinearAttenuation","parent":"ProjectedTexture","type":"classfunc","description":"Returns the linear attenuation of the projected texture, which can also be set by ProjectedTexture:SetLinearAttenuation.","realm":"Client","rets":{"ret":{"text":"The linear attenuation.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetNearZ","parent":"ProjectedTexture","type":"classfunc","description":"Returns the NearZ value of the ProjectedTexture, which was previously set by ProjectedTexture:SetNearZ","realm":"Client","rets":{"ret":{"text":"NearZ of the ProjectedTexture.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetNoCull","parent":"ProjectedTexture","type":"classfunc","description":"Returns the state of projected texture view-frustum culling. See ProjectedTexture:SetNoCull.","added":"2024.10.09","realm":"Client","rets":{"ret":{"text":"`false` if culling is enabled (default), `true` if disabled.","name":"enable","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetOrthographic","parent":"ProjectedTexture","type":"classfunc","description":"Returns the current orthographic settings of the Projected Texture. To set these values, use ProjectedTexture:SetOrthographic.","realm":"Client","rets":{"ret":[{"text":"Whether or not this projected texture is orthographic. When false, nothing else is returned.","name":"","type":"boolean"},{"text":"left","name":"","type":"number"},{"text":"top","name":"","type":"number"},{"text":"right","name":"","type":"number"},{"text":"bottom","name":"","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetPos","parent":"ProjectedTexture","type":"classfunc","description":"Returns the position of the ProjectedTexture, which was previously set by ProjectedTexture:SetPos","realm":"Client","rets":{"ret":{"text":"The position of the ProjectedTexture.","name":"","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetQuadraticAttenuation","parent":"ProjectedTexture","type":"classfunc","description":"Returns the quadratic attenuation of the projected texture, which can also be set by ProjectedTexture:SetQuadraticAttenuation.","realm":"Client","rets":{"ret":{"text":"The quadratic attenuation","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetShadowDepthBias","parent":"ProjectedTexture","type":"classfunc","description":"Returns the shadow depth bias of the projected texture.\n\nSet by ProjectedTexture:SetShadowDepthBias.","added":"2021.03.31","realm":"Client","rets":{"ret":{"text":"The current shadow depth bias.","name":"bias","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetShadowFilter","parent":"ProjectedTexture","type":"classfunc","description":"Returns the shadow \"filter size\" of the projected texture. `0` is fully pixelated, higher values will blur the shadow more.\n\nSet by ProjectedTexture:SetShadowFilter.","added":"2021.03.31","realm":"Client","rets":{"ret":{"text":"The current shadow filter size.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetShadowSlopeScaleDepthBias","parent":"ProjectedTexture","type":"classfunc","description":"Returns the shadow depth slope scale bias of the projected texture.\n\nSet by ProjectedTexture:SetShadowSlopeScaleDepthBias.","added":"2021.03.31","realm":"Client","rets":{"ret":{"text":"The current shadow depth slope scale bias.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetSkipShadowUpdates","parent":"ProjectedTexture","type":"classfunc","description":"Returns whether shadow updates are disabled for this ProjectedTexture, which was previously set by ProjectedTexture:SetSkipShadowUpdates.","added":"2026.04.10","realm":"Client","rets":{"ret":{"text":"Whether shadow updates are disabled.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTargetEntity","parent":"ProjectedTexture","type":"classfunc","description":"Returns the target entity of this projected texture.","added":"2021.03.31","realm":"Client","rets":{"ret":{"text":"The current target entity.","name":"","type":"Entity"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTexture","parent":"ProjectedTexture","type":"classfunc","description":"Returns the texture of the ProjectedTexture, which was previously set by ProjectedTexture:SetTexture","realm":"Client","rets":{"ret":{"text":"The texture of the ProjectedTexture.","name":"","type":"ITexture"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTextureFrame","parent":"ProjectedTexture","type":"classfunc","description":"Returns the texture frame of the ProjectedTexture, which was previously set by ProjectedTexture:SetTextureFrame","realm":"Client","rets":{"ret":{"text":"The texture frame.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetVerticalFOV","parent":"ProjectedTexture","type":"classfunc","description":"Returns the vertical FOV of the ProjectedTexture, which was previously set by ProjectedTexture:SetVerticalFOV or ProjectedTexture:SetFOV","realm":"Client","rets":{"ret":{"text":"The vertical FOV of the ProjectedTexture.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsValid","parent":"ProjectedTexture","type":"classfunc","description":"Returns true if the projected texture is valid (i.e. has not been removed), false otherwise.\n\nInstead of calling this directly it's a good idea to call Global.IsValid in case the variable is nil.\n\n\n```\nIsValid( ptexture )\n```\n\n\nThis not only checks whether the projected texture is valid - but also checks whether it's nil.","realm":"Client","rets":{"ret":{"text":"Whether the projected texture is valid.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Remove","parent":"ProjectedTexture","type":"classfunc","description":"Removes the projected texture. After calling this, ProjectedTexture:IsValid will return false, and any hooks with the projected texture as the identifier will be automatically deleted.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetAngles","parent":"ProjectedTexture","type":"classfunc","description":"Sets the angles (direction) of the projected texture.\n\nYou must call ProjectedTexture:Update after using this function for it to take effect.","realm":"Client","args":{"arg":{"name":"angle","type":"Angle"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetBrightness","parent":"ProjectedTexture","type":"classfunc","description":"Sets the brightness of the projected texture.\n\nYou must call ProjectedTexture:Update after using this function for it to take effect.","realm":"Client","args":{"arg":{"text":"The brightness to give the projected texture. A float from 0 to 1, where 1 is 100% brightness. Can be higher.","name":"brightness","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetColor","parent":"ProjectedTexture","type":"classfunc","description":"Sets the color of the projected texture.\n\nYou must call ProjectedTexture:Update after using this function for it to take effect.","realm":"Client","args":{"arg":{"text":"Unlike other projected textures, this color can only go up to 255.","name":"color","type":"Color"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetConstantAttenuation","parent":"ProjectedTexture","type":"classfunc","description":"Sets the constant attenuation of the projected texture.\n\nSee also ProjectedTexture:SetLinearAttenuation and ProjectedTexture:SetQuadraticAttenuation.\n\nYou must call ProjectedTexture:Update after using this function for it to take effect.","realm":"Client","args":{"arg":{"name":"constAtten","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetEnableShadows","parent":"ProjectedTexture","type":"classfunc","description":{"text":"Enable or disable shadows cast from the projected texture.\n\n\n\nYou must call ProjectedTexture:Update after using this function for it to take effect.","note":"As with all types of projected textures (including the player's flashlight and env_projectedtexture), there can only be 8 projected textures with shadows enabled in total.\n\nThis limit can be increased with the launch parameter `-numshadowtextures LIMIT` where `LIMIT` is the new limit.\n\nNaturally, many projected lights with shadows enabled will drastically decrease framerate."},"realm":"Client","args":{"arg":{"name":"newState","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetFarZ","parent":"ProjectedTexture","type":"classfunc","description":"Sets the distance at which the projected texture ends.\n\nYou must call ProjectedTexture:Update after using this function for it to take effect.","realm":"Client","args":{"arg":{"name":"farZ","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetFOV","parent":"ProjectedTexture","type":"classfunc","description":"Sets the angle of projection.\n\nYou must call ProjectedTexture:Update after using this function for it to take effect.","realm":"Client","args":{"arg":{"text":"Must be higher than 0 and lower than 180","name":"fov","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetHorizontalFOV","parent":"ProjectedTexture","type":"classfunc","description":"Sets the horizontal angle of projection without affecting the vertical angle.\n\nYou must call ProjectedTexture:Update after using this function for it to take effect.","realm":"Client","args":{"arg":{"text":"The new horizontal Field Of View for the projected texture. Must be in range between 0 and 180.","name":"hFOV","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetLightWorld","parent":"ProjectedTexture","type":"classfunc","description":"Set whenever or not the Texture should light up world geometry.","realm":"Client","added":"2023.06.28","args":{"arg":{"text":"Set it to `true` if the Texture should light up world geometry.","name":"lightworld","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetLinearAttenuation","parent":"ProjectedTexture","type":"classfunc","description":"Sets the linear attenuation of the projected texture.\n\nSee also ProjectedTexture:SetConstantAttenuation and ProjectedTexture:SetQuadraticAttenuation.\n\nThe default value of linear attenuation when the projected texture is created is 100. (others are 0, as you are not supposed to mix them)\n\nYou must call ProjectedTexture:Update after using this function for it to take effect.","realm":"Client","args":{"arg":{"name":"linearAtten","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetNearZ","parent":"ProjectedTexture","type":"classfunc","description":{"text":"Sets the distance at which the projected texture begins its projection.\n\nYou must call ProjectedTexture:Update after using this function for it to take effect.","note":["Setting this to 0 will disable the projected texture completely! This may be useful if you want to disable a projected texture without actually removing it","This seems to affect the rendering of shadows - a higher Near Z value will have shadows begin to render closer to their casting object. Comparing a low Near Z value (like 1) with a normal one (12) or high one (1000) is the easiest way to understand this artifact"]},"realm":"Client","args":{"arg":{"name":"nearZ","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetNoCull","parent":"ProjectedTexture","type":"classfunc","description":"Allows disabling of projected texture view-frustum culling for cases where said culling creates unwanted side effects. Disabling culling will have a negative effect on performance.\n\nCulling makes projected textures off screen to stop rendering/updating.","added":"2024.10.09","realm":"Client","args":{"arg":{"text":"`false` to enable culling (default), `true` to disable.","name":"enable","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetOrthographic","parent":"ProjectedTexture","type":"classfunc","description":"Changes the current projected texture between orthographic and perspective projection.\n\nYou must call ProjectedTexture:Update after using this function for it to take effect.\n\nShadows dont work. (For non static props and for most map brushes)","realm":"Client","args":{"arg":[{"text":"When false, all other arguments are ignored and the texture is reset to perspective projection.","name":"orthographic","type":"boolean"},{"text":"The amount of units left from the projected texture's origin to project.","name":"left","type":"number"},{"text":"The amount of units upwards from the projected texture's origin to project.","name":"top","type":"number"},{"text":"The amount of units right from the projected texture's origin to project.","name":"right","type":"number"},{"text":"The amount of units downwards from the projected texture's origin to project.","name":"bottom","type":"number"}]}},"example":{"description":"Set the projected texture back to perspective projection.","code":"ProjectedTexture:SetOrthographic( false )\nProjectedTexture:Update()"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetPos","parent":"ProjectedTexture","type":"classfunc","description":"Move the Projected Texture to the specified position.\n\nYou must call ProjectedTexture:Update after using this function for it to take effect.","realm":"Client","args":{"arg":{"name":"position","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetQuadraticAttenuation","parent":"ProjectedTexture","type":"classfunc","description":"Sets the quadratic attenuation of the projected texture.\n\nSee also ProjectedTexture:SetLinearAttenuation and ProjectedTexture:SetConstantAttenuation.\n\nYou must call ProjectedTexture:Update after using this function for it to take effect.","realm":"Client","args":{"arg":{"name":"quadAtten","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetShadowDepthBias","parent":"ProjectedTexture","type":"classfunc","description":{"text":"Sets the shadow depth bias of the projected texture.\n\nThe initial value is `0.0001`. Normal projected textures obey the value of the `mat_depthbias_shadowmap` ConVar.","validate":"You must call ProjectedTexture:Update after using this function for it to take effect."},"added":"2021.03.31","realm":"Client","args":{"arg":{"text":"The shadow depth bias to set.","name":"bias","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetShadowFilter","parent":"ProjectedTexture","type":"classfunc","description":{"text":"Sets the shadow \"filter size\" of the projected texture. `0` is fully pixelated, higher values will blur the shadow more. The initial value is the value of `r_projectedtexture_filter` ConVar.","validate":"You must call ProjectedTexture:Update after using this function for it to take effect."},"added":"2021.03.31","realm":"Client","args":{"arg":{"text":"The shadow filter size to set.","name":"filter","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetShadowSlopeScaleDepthBias","parent":"ProjectedTexture","type":"classfunc","description":{"text":"Sets the shadow depth slope scale bias of the projected texture.\n\nThe initial value is `2`. Normal projected textures obey the value of the `mat_slopescaledepthbias_shadowmap` ConVar.","validate":"You must call ProjectedTexture:Update after using this function for it to take effect."},"added":"2021.03.31","realm":"Client","args":{"arg":{"text":"The shadow depth slope scale bias to set.","name":"bias","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetSkipShadowUpdates","parent":"ProjectedTexture","type":"classfunc","description":"Sets whether shadow updates are disabled for this ProjectedTexture. This can be useful to save up on performance, but it will inevitably cause graphical glitches if left not updating for long.","added":"2026.04.10","realm":"Client","args":{"arg":{"text":"Whether future shadow updates should be skipped.","name":"enable","type":"boolean"}}},"example":{"description":"Creates a projected texture on the entity, holding reload key will freeze the projected shadow.","code":"function ENT:OnRemove()\n\tif ( IsValid( self.lamp ) ) then\n\t\tself.lamp:Remove()\n\tend\nend\n\n\nfunction ENT:Think()\n\t-- Keep updating the light so it's attached to our entity\n\t-- you might want to call other functions here, you can do animations here as well\n\tlocal pos = self:GetPos()\n\tlocal angles = self:GetAngles()\n\n\tif ( IsValid( self.lamp ) ) then\n\t\tself.lamp:SetPos( pos )\n\t\tself.lamp:SetAngles( angles )\n\t\tif ( Entity(1):KeyDown( IN_RELOAD ) ) then\n\t\t\tself.lamp:SetColor( Color( 255, 255, 255 ) )\n\t\t\tself.lamp:SetSkipShadowUpdates( true )\n\t\t\tself.lamp:Update()\n\t\telse\n\t\t\tself.lamp:SetColor( Color( 255, 255, 255 ) )\n\t\t\tself.lamp:SetSkipShadowUpdates( false )\n\t\t\tself.lamp:Update()\n\t\tend\n\t\tself.FrameFlipFlop = !self.FrameFlipFlop\n\telse\n\t\tlocal lamp = ProjectedTexture() -- Create a projected texture\n\t\tself.lamp = lamp -- Assign it to the entity table so it may be accessed later\n\n\t\t-- Set it all up\n\t\tlamp:SetTexture( \"effects/flashlight001\" )\n\t\tlamp:SetFarZ( 500 ) -- How far the light should shine\n\n\t\tlamp:SetPos( pos ) -- Initial position and angles\n\t\tlamp:SetAngles( angles )\n\t\tlamp:Update()\n\tend\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetTargetEntity","parent":"ProjectedTexture","type":"classfunc","description":{"text":"Sets the target entity for this projected texture, meaning it will only be lighting the given entity and the world.","validate":"You must call ProjectedTexture:Update after using this function for it to take effect."},"added":"2021.03.31","realm":"Client","args":{"arg":{"text":"The target entity, or `NULL` to reset.","name":"target","type":"Entity","default":"NULL"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetTexture","parent":"ProjectedTexture","type":"classfunc","description":"Sets the texture to be projected.\n\nYou must call ProjectedTexture:Update after using this function for it to take effect.","realm":"Client","args":{"arg":{"text":"The name of the texture. Can also be an ITexture.","name":"texture","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetTextureFrame","parent":"ProjectedTexture","type":"classfunc","description":"For animated textures, this will choose which frame in the animation will be projected.\n\nYou must call ProjectedTexture:Update after using this function for it to take effect.","realm":"Client","args":{"arg":{"text":"The frame index to use.","name":"frame","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetVerticalFOV","parent":"ProjectedTexture","type":"classfunc","description":"Sets the vertical angle of projection without affecting the horizontal angle.\n\nYou must call ProjectedTexture:Update after using this function for it to take effect.","realm":"Client","args":{"arg":{"text":"The new vertical Field Of View for the projected texture. Must be in range between 0 and 180.","name":"vFOV","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Update","parent":"ProjectedTexture","type":"classfunc","description":"Updates the Projected Light and applies all previously set parameters.\n\nThe best place to call this function is in GM:PreDrawOpaqueRenderables.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddTask","parent":"Schedule","type":"classfunc","description":"Adds a task to the schedule. See also Schedule:AddTaskEx if you wish to customize task start and run function names.\n\nSee also ENTITY:StartSchedule, NPC:StartEngineTask, and NPC:RunEngineTask.","realm":"Server","file":{"text":"lua/includes/modules/ai_schedule.lua","line":"56-L62"},"args":{"arg":[{"text":"Custom task name","name":"taskname","type":"string"},{"text":"Task data to be passed into the NPC's functions","name":"taskdata","type":"any"}]}},"example":{"description":"This creates a new schedule with a task named \"HelloWorld\" that is defined to print the taskdata passed in.","code":{"text":"local schdHello = ai_schedule.New( \"SayHello\" )\nschdHello:AddTask( \"HelloWorld\", \"HELLO\" )\n\n-- Called when the task is initiated (started)\nfunction ENT:TaskStart_HelloWorld( data )\n    print(data)\n\n    -- Set a variable that is 5 seconds in the future so the task can complete when we tick past it\n    self.TaskEndTime = CurTime() + 5\nend\n\n-- Called every think until the task is completed\nfunction ENT:Task_HelloWorld(data)\n    print( data, \"again\" )\n\n    -- Check if the 5 seconds have passed\n    if CurTime()","self.taskendtime":{"then":"","self:taskcomplete":"","end":"","ode":"ode","output":"Prints \"HELLO\" in the console, then prints \"HELLO again\" on every NPC think until 5 seconds have passed."}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddTaskEx","parent":"Schedule","type":"classfunc","description":"Adds a task to the schedule with completely custom function names.\n\nSee also Schedule:AddTask.","realm":"Server","file":{"text":"lua/includes/modules/ai_schedule.lua","line":"70-L76"},"args":{"arg":[{"text":"The full name of a function on the entity's table to be ran when the task is started.","name":"start","type":"string"},{"text":"The full name of a function on the entity's table to be ran when the task is continuously running.","name":"run","type":"string"},{"text":"Task data to be passed into the NPC's functions","name":"data","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"EngTask","parent":"Schedule","type":"classfunc","description":"Adds an engine task to the schedule.","realm":"Server","file":{"text":"lua/includes/modules/ai_schedule.lua","line":"36-L42"},"args":{"arg":[{"text":"Task name, see [ai_task.h](https://github.com/ValveSoftware/source-sdk-2013/blob/55ed12f8d1eb6887d348be03aee5573d44177ffb/mp/src/game/server/ai_task.h#L89-L502)","name":"taskname","type":"string"},{"text":"Task data, can be a float.","name":"taskdata","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetTask","parent":"Schedule","type":"classfunc","description":"Returns the task at the given index.","realm":"Server","file":{"text":"lua/includes/modules/ai_schedule.lua","line":"82-L84"},"args":{"arg":{"text":"Task index.","name":"num","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Init","parent":"Schedule","type":"classfunc","description":{"text":"Initialises the Schedule. Called by ai_schedule.New when the Schedule is created.","internal":""},"realm":"Server","file":{"text":"lua/includes/modules/ai_schedule.lua","line":"21-L27"},"args":{"arg":{"text":"The name passed from ai_schedule.New.","name":"debugName","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"NumTasks","parent":"Schedule","type":"classfunc","description":"Returns the number of tasks in the schedule.","realm":"Server","file":{"text":"lua/includes/modules/ai_schedule.lua","line":"78-L80"},"rets":{"ret":{"text":"The number of tasks in this schedule.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Pop","parent":"Stack","type":"classfunc","description":"Pop an item from the stack","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/util.lua","line":"257-L277"},"args":{"arg":{"text":"Amount of items you want to pop.","name":"amount","type":"number","default":"1"}},"rets":{"ret":{"text":"Latest popped item.","name":"object","type":"any"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"PopMulti","parent":"Stack","type":"classfunc","description":"Pop an item from the stack","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/util.lua","line":"279-L305"},"args":{"arg":{"text":"Amount of items you want to pop.","name":"amount","type":"number","default":"1"}},"rets":{"ret":{"text":"The Popped Items.","name":"items","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Push","parent":"Stack","type":"classfunc","description":"Push an item onto the stack","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/util.lua","line":"251-L255"},"args":{"arg":{"text":"The item you want to push","name":"object","type":"any"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Size","parent":"Stack","type":"classfunc","description":"Returns the size of the stack","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/util.lua","line":"317-L319"},"rets":{"ret":{"text":"The size of the stack","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Top","parent":"Stack","type":"classfunc","description":"Get the item at the top of the stack","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/util.lua","line":"307-L315"},"rets":{"ret":{"text":"The item at the top of the stack","name":"","type":"any"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetMaterial","parent":"SurfaceInfo","type":"classfunc","description":"Returns the brush surface's material.","realm":"Shared","rets":{"ret":{"text":"Material of one portion of a brush model.","name":"","type":"IMaterial"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetVertices","parent":"SurfaceInfo","type":"classfunc","description":"Returns a list of vertices the brush surface is built from.","realm":"Shared","rets":{"ret":{"text":"A list of Vector points. This will usually be 4 corners of a quadrilateral in counter-clockwise order.","name":"","type":"table<Vector>"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsNoDraw","parent":"SurfaceInfo","type":"classfunc","description":{"text":"Checks if the brush surface is a nodraw surface, meaning it will not be drawn by the engine.","note":"This internally checks the SURFDRAW_NODRAW flag."},"realm":"Shared","rets":{"ret":{"text":"Returns true if this surface won't be drawn.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsSky","parent":"SurfaceInfo","type":"classfunc","description":{"text":"Checks if the brush surface is displaying the skybox.","note":"This internally checks the SURFDRAW_SKY flag."},"realm":"Shared","rets":{"ret":{"text":"Returns true if the surface is the sky.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsWater","parent":"SurfaceInfo","type":"classfunc","description":{"text":"Checks if the brush surface is water.","note":"This internally checks the SURFDRAW_WATER flag."},"realm":"Shared","rets":{"ret":{"text":"Returns true if the surface is water.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Init","parent":"Task","type":"classfunc","description":{"text":"Initialises the AI task. Called by ai_task.New.","internal":""},"realm":"Server","file":{"text":"lua/includes/modules/ai_task.lua","line":"29-L31"}},"realms":["Server"],"type":"Function"},
{"function":{"name":"InitEngine","parent":"Task","type":"classfunc","description":"Initialises the AI task as an engine task.","realm":"Server","file":{"text":"lua/includes/modules/ai_task.lua","line":"36-L43"},"args":{"arg":[{"text":"The name of the task.","name":"taskname","type":"string"},{"name":"taskdata","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"InitFunctionName","parent":"Task","type":"classfunc","description":"Initialises the AI task as NPC method-based.","realm":"Server","file":{"text":"lua/includes/modules/ai_task.lua","line":"56"},"args":{"arg":[{"text":"The name of the NPC method to call on task start.","name":"startname","type":"string"},{"text":"The name of the NPC method to call on task run.","name":"runname","type":"string"},{"name":"taskdata","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsEngineType","parent":"Task","type":"classfunc","description":"Determines if the task is an engine task (`TYPE_ENGINE`, 1).","realm":"Server","file":{"text":"lua/includes/modules/ai_task.lua","line":"67"}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsFNameType","parent":"Task","type":"classfunc","description":"Determines if the task is an NPC method-based task (`TYPE_FNAME`, 2).","realm":"Server","file":{"text":"lua/includes/modules/ai_task.lua","line":"75"}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Run","parent":"Task","type":"classfunc","description":"Runs the AI task.","realm":"Server","file":{"text":"lua/includes/modules/ai_task.lua","line":"112"},"args":{"arg":{"text":"The NPC to run the task on.","name":"target","type":"NPC"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Run_FName","parent":"Task","type":"classfunc","description":{"text":"Runs the AI task as an NPC method. This requires the task to be of type `TYPE_FNAME`.","internal":""},"realm":"Server","file":{"text":"lua/includes/modules/ai_task.lua","line":"125"},"args":{"arg":{"text":"The NPC to run the task on.","name":"target","type":"NPC"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Start","parent":"Task","type":"classfunc","description":"Starts the AI task.","realm":"Server","file":{"text":"lua/includes/modules/ai_task.lua","line":"83"},"args":{"arg":{"text":"The NPC to start the task on.","name":"target","type":"NPC"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Start_FName","parent":"Task","type":"classfunc","description":{"text":"Starts the AI task as an NPC method.","internal":""},"realm":"Server","file":{"text":"lua/includes/modules/ai_task.lua","line":"99"},"args":{"arg":{"text":"The NPC to start the task on.","name":"target","type":"NPC"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Allowed","parent":"Tool","type":"classfunc","description":"Returns whether the tool is allowed to be used or not. This function ignores the SANDBOX:CanTool hook.\n\nBy default this will always return true clientside and uses `TOOL.AllowedCVar`which is a ConVar object pointing to  `toolmode_allow_*toolname*` convar on the server.","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/stool.lua","line":"90"},"rets":{"ret":{"text":"Returns true if the tool is allowed.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"BuildConVarList","parent":"Tool","type":"classfunc","description":"Builds a list of all ConVars set via the ClientConVar variable on the Structures/TOOL and their default values. This is used for the preset system.","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/stool.lua","line":"67"},"rets":{"ret":{"text":"A list of all convars and their default values.","name":"convars","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CheckObjects","parent":"Tool","type":"classfunc","description":{"text":"Checks all added objects to see if they're still valid, if not, clears the list of objects.","internal":"This is called automatically for most toolgun actions so you shouldn't need to use it."},"realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/stool.lua","line":"117"}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ClearObjects","parent":"Tool","type":"classfunc","description":"Clears all objects previously set with Tool:SetObject.","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/object.lua","line":"34"}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Create","parent":"Tool","type":"classfunc","description":{"text":"Initializes the tool object","internal":"This is called automatically for all tools."},"realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/stool.lua","line":"11"},"rets":{"ret":{"text":"The created tool object.","name":"tool","type":"Tool"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CreateConVars","parent":"Tool","type":"classfunc","description":{"text":"Creates clientside ConVars based on the ClientConVar table specified in the tool structure. Also creates the 'toolmode_allow_X' ConVar.","internal":"This is called automatically for all tools."},"realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/stool.lua","line":"33"}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBone","parent":"Tool","type":"classfunc","description":"Retrieves a physics bone number previously stored using Tool:SetObject.","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/object.lua","line":"81"},"args":{"arg":{"text":"The id of the object which was set in Tool:SetObject.","name":"id","type":"number"}},"rets":{"ret":{"text":"Associated physics bone with given id.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetClientBool","parent":"Tool","type":"classfunc","description":"Attempts to grab a clientside tool ConVar value as a boolean.","realm":"Shared","added":"2023.01.25","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/stool.lua","line":"87"},"args":{"arg":[{"text":"Name of the ConVar to retrieve. The function will automatically add the `mytoolfilename_` part to it.","name":"name","type":"string"},{"text":"The default value to return in case the lookup fails.","name":"default","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"The value of the requested ConVar. It will be true if the value if the convar is not 0, just like ConVar:GetBool","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetClientInfo","parent":"Tool","type":"classfunc","description":"Attempts to grab a clientside tool ConVar as a string.","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/stool.lua","line":"67"},"args":{"arg":{"text":"Name of the convar to retrieve. The function will automatically add the `mytoolfilename_` part to it.","name":"name","type":"string"}},"rets":{"ret":{"text":"The value of the requested ConVar.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetClientNumber","parent":"Tool","type":"classfunc","description":"Attempts to grab a clientside tool ConVar's value as a number.","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/stool.lua","line":"77"},"args":{"arg":[{"text":"Name of the convar to retrieve. The function will automatically add the `mytoolfilename_` part to it.","name":"name","type":"string"},{"text":"The default value to return in case the lookup fails.","name":"default","type":"number","default":"0"}]},"rets":{"ret":{"text":"The value of the requested ConVar.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetEnt","parent":"Tool","type":"classfunc","description":"Retrieves an Entity previously stored using Tool:SetObject.","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/object.lua","line":"48"},"args":{"arg":{"text":"The id of the object which was set in Tool:SetObject.","name":"id","type":"number"}},"rets":{"ret":{"text":"Associated Entity with given id.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetHelpText","parent":"Tool","type":"classfunc","description":"Returns a language key based on this tool's name and the current stage it is on.","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/object.lua","line":"163"},"rets":{"ret":{"text":"The returned language key, for example `\"#tool.weld.1\"`","name":"key","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetLocalPos","parent":"Tool","type":"classfunc","description":"Retrieves an local vector previously stored using Tool:SetObject.\nSee also Tool:GetPos.","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/object.lua","line":"76"},"args":{"arg":{"text":"The id of the object which was set in Tool:SetObject.","name":"id","type":"number"}},"rets":{"ret":{"text":"Associated local vector with given id.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMode","parent":"Tool","type":"classfunc","description":"Returns the name of the current tool mode.","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/stool.lua","line":"101"},"rets":{"ret":{"text":"The current tool mode.","name":"","type":"string"}}},"example":{"description":"The Toolgun weapon has a similar function, checking weapon class is strongly recommended as GetMode() is not available on all weapons.","code":"local wep = Entity( 1 ):GetActiveWeapon()\nif ( IsValid( wep ) && wep:GetClass() == \"gmod_tool\" ) then\n\tprint( wep:GetMode() )\nend","output":"```\nremover\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNormal","parent":"Tool","type":"classfunc","description":"Retrieves an normal vector previously stored using Tool:SetObject.","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/object.lua","line":"85"},"args":{"arg":{"text":"The id of the object which was set in Tool:SetObject.","name":"id","type":"number"}},"rets":{"ret":{"text":"Associated normal vector with given id.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetOperation","parent":"Tool","type":"classfunc","description":"Returns the current operation of the tool set by Tool:SetOperation.","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/object.lua","line":"28"},"rets":{"ret":{"text":"The current operation the tool is at.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetOwner","parent":"Tool","type":"classfunc","description":"Returns the owner of this tool.","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/stool.lua","line":"120"},"rets":{"ret":{"text":"Player using the tool","name":"","type":"Player"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPhys","parent":"Tool","type":"classfunc","description":"Retrieves an PhysObj previously stored using Tool:SetObject.\nSee also Tool:GetEnt.","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/object.lua","line":"100-L108"},"args":{"arg":{"text":"The id of the object which was set in Tool:SetObject.","name":"id","type":"number"}},"rets":{"ret":{"text":"Associated PhysObj with given id. If it wasn't specified, returns current PhysObj of associated Entity.","name":"","type":"PhysObj"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPos","parent":"Tool","type":"classfunc","description":"Retrieves an vector previously stored using Tool:SetObject. See also Tool:GetLocalPos.","realm":"Shared","file":{"text":"gamemode/sandbox/entities/weapons/gmod_tool/object.lua","line":"61"},"args":{"arg":{"text":"The id of the object which was set in Tool:SetObject.","name":"id","type":"number"}},"rets":{"ret":{"text":"Associated vector with given id. The vector is converted from Tool:GetLocalPos.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetServerInfo","parent":"Tool","type":"classfunc","description":"Attempts to grab a serverside tool ConVar.\nThis will not do anything on client, despite the function being defined shared.","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/stool.lua","line":"59"},"args":{"arg":{"text":"Name of the convar to retrieve. The function will automatically add the \"mytoolfilename_\" part to it.","name":"name","type":"string"}},"rets":{"ret":{"text":"The value of the requested ConVar.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetStage","parent":"Tool","type":"classfunc","description":"Returns the current stage of the tool set by Tool:SetStage.","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/object.lua","line":"16"},"rets":{"ret":{"text":"The current stage of the current operation the tool is at.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSWEP","parent":"Tool","type":"classfunc","description":{"text":"Returns the Tool Gun (`gmod_tool`) Scripted Weapon.","deprecated":"Use Tool:GetWeapon instead."},"realm":"Shared","rets":{"ret":{"text":"The tool gun weapon. (`gmod_tool`)","name":"","type":"Weapon"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetWeapon","parent":"Tool","type":"classfunc","description":"Returns the Tool Gun (`gmod_tool`) Scripted Weapon.","realm":"Shared","rets":{"ret":{"text":"The tool gun weapon. (`gmod_tool`)","name":"","type":"Weapon"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"MakeGhostEntity","parent":"Tool","type":"classfunc","description":"Initializes the ghost entity with the given model. Removes any old ghost entity if called multiple times.\n\nThe ghost is a regular prop_physics entity in singleplayer games, and a clientside prop in multiplayer games.","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/ghostentity.lua","line":"6"},"args":{"arg":[{"text":"The model of the new ghost entity","name":"model","type":"string"},{"text":"Position to initialize the ghost entity at, usually not needed since this is updated in Tool:UpdateGhostEntity.","name":"pos","type":"Vector"},{"text":"Angle to initialize the ghost entity at, usually not needed since this is updated in Tool:UpdateGhostEntity.","name":"angle","type":"Angle"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"NumObjects","parent":"Tool","type":"classfunc","description":{"text":"Returns the amount of stored objects ( Entitys ) the tool has.","validate":"Are TOOLs limited to 4 entities?"},"realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/object.lua","line":"149"},"rets":{"ret":{"text":"The amount of stored objects, or Tool:GetStage clientide.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RebuildControlPanel","parent":"Tool","type":"classfunc","description":"Automatically forces the tool's control panel to be rebuilt.","realm":"Client","added":"2023.01.25","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/stool_cl.lua","line":"12"},"args":{"arg":{"text":"Any arguments given to this function will be added to TOOL.BuildCPanel's arguments.","name":"extra_args","type":"vararg"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ReleaseGhostEntity","parent":"Tool","type":"classfunc","description":"Removes any ghost entity created for this tool.\n\nThis is called automatically at various points, including when changing tools, holstering the toolgun, therefore it is a very good idea to implement this callback in your custom tool to cleanup any custom ghost entities.","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/ghostentity.lua","line":"68"}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetObject","parent":"Tool","type":"classfunc","description":"Stores an Entity for later use in the tool.\n\nThe stored values can be retrieved by Tool:GetEnt, Tool:GetPos, Tool:GetLocalPos, Tool:GetPhys, Tool:GetBone and Tool:GetNormal","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/object.lua","line":"112"},"args":{"arg":[{"text":"The id of the object to store.","name":"id","type":"number"},{"text":"The entity to store.","name":"ent","type":"Entity"},{"text":"The position to store.","name":"pos","type":"Vector","note":"this position is in **global space** and is internally converted to **local space** relative to the object, so when you retrieve it later it will be corrected to the object's new position"},{"text":"The physics object to store.","name":"phys","type":"PhysObj"},{"text":"The hit bone to store.","name":"bone","type":"number"},{"text":"The hit normal to store.","name":"normal","type":"Vector"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetOperation","parent":"Tool","type":"classfunc","description":"Sets the current operation of the tool. Does nothing clientside. See also Tool:SetStage.\n\nOperations and stages work as follows:\n* Operation 1\n* * Stage 1\n* * Stage 2\n* * Stage 3\n* Operation 2\n* * Stage 1\n* * Stage 2\n* * Stage ...","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/object.lua","line":"20"},"args":{"arg":{"text":"The new operation ID to set.","name":"operation","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetStage","parent":"Tool","type":"classfunc","description":"Sets the current stage of the tool. Does nothing clientside.\n\nSee also Tool:SetOperation.","realm":"Shared","file":{"text":"/gamemodes/sandbox/entities/weapons/gmod_tool/object.lua","line":"8-L14"},"args":{"arg":{"text":"The new stage to set.","name":"stage","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"StartGhostEntity","parent":"Tool","type":"classfunc","description":"Initializes the ghost entity based on the supplied entity.","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/ghostentity.lua","line":"54"},"args":{"arg":{"text":"The entity to copy ghost parameters off","name":"ent","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"UpdateData","parent":"Tool","type":"classfunc","description":{"text":"Sets the tool's stage to how many stored objects the tool has.","internal":"Called on deploy automatically"},"realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/object.lua","line":"2"}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"UpdateGhostEntity","parent":"Tool","type":"classfunc","description":"Updates the position and orientation of the ghost entity based on where the toolgun owner is looking along with data from object with id 1 set by Tool:SetObject.\n\nThis should be called in the tool's TOOL:Think hook.\n\nThis command is only used for tools that move props, such as easy weld, axis and motor. If you want to update a ghost like the thruster tool does it for example, check its [source code](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/gamemodes/sandbox/entities/weapons/gmod_tool/stools/thruster.lua#L179).","realm":"Shared","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/ghostentity.lua","line":"101"}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Add","parent":"Vector","type":"classfunc","description":"Adds the values of the argument vector to the original vector. This function is the same as vector1 + vector2 without creating a new vector object, skipping object construction and garbage collection.","realm":"Shared and Menu","args":{"arg":{"text":"The vector to add.","name":"vector","type":"Vector"}}},"example":[{"description":"Adds the components of the vectors together.","code":"a = Vector(1, 1, 1)\na:Add(Vector(1, 2, 3))\nprint(a)","output":"2 3 4"},{"description":"If you don't want to set your vector to the result, and just return a new vector as the result. You can use a '+' operator to add two vectors together. The original vector will remain unchanged.","code":"a = Vector(1, 1, 1)\nprint(a + Vector(1, 2, 3))","output":"2 3 4"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Angle","parent":"Vector","type":"classfunc","description":"Returns an angle representing the normal of the vector.","realm":"Shared and Menu","rets":{"ret":{"text":"The angle/direction of the vector.","name":"","type":"Angle"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"AngleEx","parent":"Vector","type":"classfunc","description":"Returns the angle of this vector (normalized), but instead of assuming that up is Global.Vector( 0, 0, 1 ) (Like Vector:Angle does) you can specify which direction is 'up' for the angle.","realm":"Shared and Menu","args":{"arg":{"text":"The up direction vector","name":"up","type":"Vector"}},"rets":{"ret":{"text":"The angle","name":"","type":"Angle"}}},"example":[{"description":"Shows usage of the function","code":"print( Vector( 0, 0, 100 ):AngleEx( Vector( 0, 0, 0 ) ) )","output":"Angle( -90.000, -0.000, 0.000 )"},{"description":"Use forward and up vector to produce angle. These two lines below will\n\t\treturn the same angle","code":"local e = ents.Create(\"prop_physics\")\nprint(e:GetAngles())\nprint(e:GetForward():AngleEx(e:GetUp()))"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Cross","parent":"Vector","type":"classfunc","description":"Calculates the cross product of this vector and the passed one.\n\nThe cross product of two vectors is a 3-dimensional vector with a direction perpendicular (at right angles) to both of them (according to the [right-hand rule](https://en.wikipedia.org/wiki/Right-hand_rule)), and magnitude equal to the area of parallelogram they span. This is defined as the product of the magnitudes, the sine of the angle between them, and unit (normal) vector `n` defined by the right-hand rule:\n:**a** × **b** = |**a**| |**b**| sin(θ) **n̂**\nwhere **a** and **b** are vectors, and **n̂** is a unit vector (magnitude of 1) perpendicular to both.","realm":"Shared and Menu","args":{"arg":{"text":"Vector to calculate the cross product with.","name":"otherVector","type":"Vector"}},"rets":{"ret":{"text":"The cross product of the two vectors.","name":"","type":"Vector"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Distance","parent":"Vector","type":"classfunc","description":{"text":"Returns the Euclidean distance between the vector and the other vector.","note":"This function is more expensive than Vector:DistToSqr. However, please see the notes for Vector:DistToSqr before using it as squared distances are not the same as euclidean distances."},"realm":"Shared and Menu","args":{"arg":{"text":"The vector to get the distance to.","name":"otherVector","type":"Vector"}},"rets":{"ret":{"text":"Distance between the vectors.","name":"","type":"number"}}},"example":{"description":"Gets the distance from A to B.","code":"print( Vector( 0, 0, 0 ):Distance( Vector( 2, 3, 4 ) ) )","output":"```\n5.3851647377014\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Distance2D","parent":"Vector","type":"classfunc","description":{"text":"Returns the Euclidean distance between the vector and the other vector in 2D space. The Z axis is ignored.","note":"This function is more expensive than Vector:Distance2DSqr. However, please see the notes for Vector:Distance2DSqr before using it as squared distances are not the same as Euclidean distances."},"added":"2023.11.03","realm":"Shared and Menu","args":{"arg":{"text":"The vector to get the distance to.","name":"otherVector","type":"Vector"}},"rets":{"ret":{"text":"Distance between the vectors in 2D space.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Distance2DSqr","parent":"Vector","type":"classfunc","description":{"text":"Returns the squared distance between 2 vectors in 2D space, ignoring the Z axis. This is faster than Vector:Distance2D as calculating the square root is an expensive process.","note":"Squared distances should not be summed. If you need to sum distances, use Vector:Distance2D.\n\nWhen performing a distance check, ensure the distance being checked against is squared."},"added":"2023.11.03","realm":"Shared and Menu","args":{"arg":{"text":"The vector to calculate the distance to.","name":"otherVec","type":"Vector"}},"rets":{"ret":{"text":"Squared distance to the vector in 2D space.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"DistToSqr","parent":"Vector","type":"classfunc","description":{"text":"Returns the squared distance of 2 vectors, this is quicker to call than Vector:Distance as DistToSqr does not need to calculate the square root, which is an expensive process.","note":"Squared distances should not be summed. If you need to sum distances, use Vector:Distance.\n\nWhen performing a distance check, ensure the distance being checked against is squared. See example code below."},"realm":"Shared and Menu","args":{"arg":{"text":"The vector to calculate the distance to.","name":"otherVec","type":"Vector"}},"rets":{"ret":{"text":"Squared distance to the vector.","name":"","type":"number"}}},"example":{"description":"Checks if a player is within `dist` units of another player in the most efficient way possible.","code":{"text":"function PlayerWithinBounds( ply, target, dist )\n\t-- Square the input distance in order to perform our distance check on Source units.\n\tlocal distSqr = dist * dist\n\n\treturn ply:GetPos():DistToSqr( target:GetPos() )","distsqr":{"end":"","print":"","playerwithinbounds":"","entity1":"","entity2":"","ode":"ode","output":"```\ntrue\n```"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Div","parent":"Vector","type":"classfunc","description":"Divide the vector by the given number, that means x, y and z are divided by that value. This will change the value of the original vector, see example 2 for division without changing the value.","realm":"Shared and Menu","args":{"arg":{"text":"The value to divide the vector with.","name":"divisor","type":"number"}}},"example":[{"description":"Divides a vector by 255.","code":"a = Vector(255, 130, 0)\na:Div(255)\nprint(a)","output":"```\n1 0.509804 0\n```"},{"description":"If you don't want to set your vector to the result, and just return a new vector as the result. You can use a ' / ' operator to divide a vector with a divisor.","code":"a = Vector(255, 255, 255)\nprint(a/255)","output":"```\n1 1 1\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Dot","parent":"Vector","type":"classfunc","description":"Returns the [dot product](https://en.wikipedia.org/wiki/Dot_product#Geometric_definition)  of this vector and the passed one.\n\nThe dot product of two vectors is the product of their magnitudes (lengths), and the cosine of the angle between them:\n\n\n**a · b** = |**a**| |**b**| cos(θ) \n\n\nwhere **a** and **b** are vectors.\n\n\nSee Vector:Length for obtaining magnitudes.\n\nA dot product returns just the cosine of the angle if both vectors are normalized, and zero if the vectors are at right angles to each other.","realm":"Shared and Menu","args":{"arg":{"text":"The vector to calculate the dot product with","name":"otherVector","type":"Vector"}},"rets":{"ret":{"text":"The dot product between the two vectors","name":"","type":"number"}}},"example":[{"description":"Get the angle of two opposite normalized vectors.","code":"local a = Vector(0, 1, 0)\nlocal b = Vector(0, -1, 0)\n\nlocal dot = a:Dot(b) -- returns the cos(ang) of the two vectors because they're both of length 1\nprint(\"Radians\", math.acos(dot)) -- the inverse of the cosine to get the angle\nprint(\"Degrees\", math.deg(math.acos(dot))) -- Convert radians to degrees","output":"Radians    3.1415926535898\n\nDegrees    180"},{"description":"Calculates whether the player is looking in the direction of an entity. This is often faster than traces, but it produces a slightly different result.\n\nThe player is looking in the direction of the entity if the angle between the aimvector and the vector from the player to the entity is less than 22.5 degrees (or pi / 8 radians).","code":"local directionAngCos = math.cos(math.pi / 8)\nlocal aimVector = ply:GetAimVector()\n-- The vector that goes from the player's shoot pos to the entity's position\nlocal entVector = ent:GetPos() - ply:GetShootPos() \nlocal angCos = aimVector:Dot(entVector) / entVector:Length()\nprint(angCos >= directionAngCos)","output":"This script will say if the player is looking in the direction of the entity."},{"description":"A function to make sure the player is looking somewhere.","code":"function IsLookingAt(ply, targetVec)\n\tlocal diff = targetVec - ply:GetShootPos()\n\treturn ply:GetAimVector():Dot(diff) / diff:Length() >= 0.95 \nend","output":"Returns true if ply is looking at (or close to) the target."}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"DotProduct","parent":"Vector","type":"classfunc","description":{"text":"Returns the dot product of the two vectors.","deprecated":"This is an alias of Vector:Dot. Use that instead."},"realm":"Shared and Menu","args":{"arg":{"text":"The other vector.","name":"Vector","type":"Vector"}},"rets":{"ret":{"text":"Dot Product","name":"","type":"number"}}},"example":{"description":"A function to make sure the player is looking somewhere.","code":"function IsLookingAt( ply, targetVec )\n return ply:GetAimVector():DotProduct( ( targetVec - ply:GetPos() + Vector(70) ):GetNormalized() ) < 0.95 \nend","output":"Returns true if ply is looking at (or close to) the target."},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetNegated","parent":"Vector","type":"classfunc","description":"Returns the negative version of this vector, i.e. a vector with every component to the negative value of itself.\n\nSee also Vector:Negate.","realm":"Shared and Menu","added":"2021.12.15","rets":{"ret":{"text":"The negative of this vector.","type":"Vector"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetNormal","parent":"Vector","type":"classfunc","description":{"text":"Returns a normalized version of the vector. This is a alias of Vector:GetNormalized.","deprecated":"Use Vector:GetNormalized instead."},"realm":"Shared and Menu","rets":{"ret":{"text":"Normalized version of the vector.","name":"","type":"Vector"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetNormalized","parent":"Vector","type":"classfunc","description":"Returns a normalized version of the vector. Normalized means vector with same direction but with length of 1.\n\nThis does not affect the vector you call it on; to do this, use Vector:Normalize.","realm":"Shared and Menu","rets":{"ret":{"text":"Normalized version of the vector.","name":"","type":"Vector"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsEqualTol","parent":"Vector","type":"classfunc","description":"Returns if the vector is equal to another vector with the given tolerance.","realm":"Shared and Menu","args":{"arg":[{"text":"The vector to compare to.","name":"compare","type":"Vector"},{"text":"The tolerance range.","name":"tolerance","type":"number"}]},"rets":{"ret":{"text":"Are the vectors equal or not.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsZero","parent":"Vector","type":"classfunc","description":"Checks whenever all fields of the vector are 0.","realm":"Shared and Menu","rets":{"ret":{"text":"Do all fields of the vector equal 0 or not","name":"","type":"boolean"}}},"example":{"description":"Confirm that the Vector is indeed 0.","code":"a = Vector(0, 0, 0)\nprint(a:IsZero())","output":"true"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Length","parent":"Vector","type":"classfunc","description":{"text":"Returns the [Euclidean length](https://en.wikipedia.org/wiki/Euclidean_vector#Length) of the vector: √(x² + y² + z²).","warning":"This is a relatively expensive process since it uses the square root. It is recommended that you use Vector:LengthSqr whenever possible."},"realm":"Shared and Menu","rets":{"ret":{"text":"Length of the vector.","name":"","type":"number"}}},"example":{"description":"Gets the length of the vector.","code":"print( Vector( 15, 16, 17 ):Length() )","output":"```\n27.748874664307\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Length2D","parent":"Vector","type":"classfunc","description":{"text":"Returns the length of the vector in two dimensions, without the Z axis.","warning":"This is a relatively expensive process since it uses the square root. It is recommended that you use Vector:Length2DSqr whenever possible."},"realm":"Shared and Menu","rets":{"ret":{"text":"Length of the vector in two dimensions, √(x² + y²)","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Length2DSqr","parent":"Vector","type":"classfunc","description":"Returns the squared length of the vectors x and y value, x² + y².\n\nThis is faster than Vector:Length2D as calculating the square root is an expensive process.","realm":"Shared and Menu","rets":{"ret":{"text":"Squared length of the vector in two dimensions","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"LengthSqr","parent":"Vector","type":"classfunc","description":"Returns the squared length of the vector, x² + y² + z².\n\nThis is faster than Vector:Length as calculating the square root is an expensive process.","realm":"Shared and Menu","rets":{"ret":{"text":"Squared length of the vector","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Mul","parent":"Vector","type":"classfunc","description":"Scales the vector by the given number (that means x, y and z are multiplied by that value), a Vector (X, Y, and Z of each vector are multiplied) or a VMatrix (Transforms the vector by the matrix's rotation/translation).","realm":"Shared and Menu","args":[{"arg":{"text":"The value to multiply the vector with.","name":"multiplier","type":"number"}},{"arg":{"text":"The vector to multiply the vector with.","name":"multiplier","type":"Vector"}},{"arg":{"text":"The matrix to transform the vector by.","name":"matrix","type":"VMatrix"}}]},"example":[{"description":"Scales a vector by 250.","code":"a = Vector(1, 1, 1)\na:Mul(250)\nprint(a)","output":"```\n250 250 250\n```"},{"description":"If you don't want to modify your existing vector and instead return a new vector as the result, you can use the `*` operator.","code":"a = Vector(1, 1, 1)\nprint(a*250)","output":"```\n250 250 250\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Negate","parent":"Vector","type":"classfunc","description":"Negates this vector, i.e. sets every component to the negative value of itself. Same as `Vector( -vec.x, -vec.y, -vec.z )`","realm":"Shared and Menu","added":"2021.12.15"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Normalize","parent":"Vector","type":"classfunc","description":"Normalizes the given vector. This changes the vector you call it on, if you want to return a normalized copy without affecting the original, use Vector:GetNormalized.","realm":"Shared and Menu"},"example":{"description":"Normalizes Vector(4, 3, 2).","code":"local test = Vector(4, 3, 2)\ntest:Normalize()\nMsgN( test )","output":"0.7428 0.5571 0.3714."},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Random","parent":"Vector","type":"classfunc","description":"Randomizes each element of this Vector object.","realm":"Shared and Menu","added":"2021.12.15","args":{"arg":[{"text":"The minimum value for each component.","name":"min","type":"number","default":"-1"},{"text":"The maximum value for each component.","name":"max","type":"number","default":"1"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Rotate","parent":"Vector","type":"classfunc","description":"Rotates a vector by the given angle.\nDoesn't return anything, but rather changes the original vector.","realm":"Shared and Menu","args":{"arg":{"text":"The angle to rotate the vector by.","name":"rotation","type":"Angle"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Set","parent":"Vector","type":"classfunc","description":"Copies the values from the second vector to the first vector.","realm":"Shared and Menu","args":{"arg":{"text":"The vector to copy from.","name":"vector","type":"Vector"}}},"example":{"description":"Sets vector B to vector A's value.","code":"a = Vector(1, 2, 3)\nb = Vector()\nb:Set(a)\nprint(b)","output":"1, 2, 3."},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetUnpacked","parent":"Vector","type":"classfunc","description":"Sets the x, y, and z of the vector.","realm":"Shared and Menu","args":{"arg":[{"text":"The x component","name":"x","type":"number"},{"text":"The y component","name":"y","type":"number"},{"text":"The z component","name":"z","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Sub","parent":"Vector","type":"classfunc","description":"Substracts the values of the second vector from the orignal vector, this function can be used to avoid garbage collection.","realm":"Shared and Menu","args":{"arg":{"text":"The other vector.","name":"vector","type":"Vector"}}},"example":[{"description":"Subtracts vector A's components with the other vector.","code":"a = Vector(5, 6, 7)\na:Sub(Vector(1, 2, 3))\nprint(a)","output":"```\n4 4 4\n```"},{"description":"If you don't want to set your vector to the result, and just return a new vector as the result. You can use a ' - ' operator to subtract two vectors from each other.","code":"a = Vector(5, 6, 7)\nprint(a-Vector(1, 2, 3))","output":"```\n4 4 4\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ToColor","parent":"Vector","type":"classfunc","description":"Translates the Vector (values ranging from 0 to 1) into a Color. This will also range the values from 0 - 1 to 0 - 255.\n\nx * 255 -> r\n\ny * 255 -> g\n\nz * 255 -> b\n\nThis is the opposite of Color:ToVector","realm":"Shared","file":{"text":"lua/includes/extensions/vector.lua","line":"8-L12"},"rets":{"ret":{"text":"The created Color.","name":"","type":"Color"}}},"example":{"description":"Get the Player1's player model color but in RGB","code":"print( Entity( 1 ):GetPlayerColor( ):ToColor( ) )","output":"Prints the player color of Player1 in RGB instead of a Vector"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ToScreen","parent":"Vector","type":"classfunc","description":{"text":"Returns where on the screen the specified position vector would appear. A related function is gui.ScreenToVector, which converts a 2D coordinate to a 3D direction.","note":"Should be called from a 3D rendering environment or after cam.Start3D or it may not work correctly.","bug":[{"text":"Errors in a render hook can make this value incorrect until the player restarts their game.","issue":"462"},{"text":"cam.Start3D or 3D context cam.Start with non-default parameters incorrectly sets the reference FOV for this function, causing incorrect return values. This can be fixed by creating and ending a default 3D context (cam.Start3D with no arguments).","issue":"1404"}]},"realm":"Client","rets":{"ret":{"text":"The created Structures/ToScreenData.","name":"","type":"table{ToScreenData}"}}},"example":{"description":"Draw some text on certain entities/positions in-world.","code":"hook.Add( \"HUDPaint\", \"ToScreenExample\", function()\n\n\t-- Get a list of all props and draw a marker on screen for each prop\n\tfor _, ent in ipairs( ents.FindByClass( \"prop_*\" ) ) do\n\n\t\tlocal point = ent:GetPos() + ent:OBBCenter() -- Gets the position of the entity, specifically the center\n\t\tlocal data2D = point:ToScreen() -- Gets the position of the entity on your screen\n\n\t\t-- The position is not visible from our screen, don't draw and continue onto the next prop\n\t\tif ( not data2D.visible ) then continue end\n\n\t\t-- Draw a simple text over where the prop is\n\t\tdraw.SimpleText( \"Prop here\", \"Default\", data2D.x, data2D.y, Color( 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )\n\n\tend\n\nend )","output":{"upload":{"src":"70c/8d7e20f173a4dae.png","size":"485139","name":"image.png"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ToTable","parent":"Vector","type":"classfunc","description":"Returns the vector as a table with three elements.","realm":"Shared and Menu","rets":{"ret":{"text":"The table with elements 1 = x, 2 = y, 3 = z.","name":"","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Unpack","parent":"Vector","type":"classfunc","description":"Returns the x, y, and z of the vector.","realm":"Shared and Menu","rets":{"ret":[{"text":"x or Vector[1].","name":"","type":"number"},{"text":"y or Vector[2].","name":"","type":"number"},{"text":"z or Vector[3].","name":"","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"WithinAABox","parent":"Vector","type":"classfunc","description":{"text":"Returns whenever the given vector is in a box created by the 2 other vectors.","upload":{"src":"22674/8d9276d7e6dd0af.png","size":"6279","name":"image.png"}},"realm":"Shared and Menu","args":{"arg":[{"text":"The first vector.","name":"boxStart","type":"Vector"},{"text":"The second vector.","name":"boxEnd","type":"Vector"}]},"rets":{"ret":{"text":"Is the vector in the box or not.","name":"","type":"boolean"}}},"example":[{"description":"Checks if player is within a certain area on the map.","code":"-- Position to test, we get the position of first player on the server\nlocal testPos = Entity( 1 ):GetPos()\n\n-- Positions to test, in this case we test if the player is in spawn area of gm_construct\nlocal pos1 = Vector( 1119, 895, 63 )\nlocal pos2 = Vector( 656, -896, -144 )\n\n-- This will return true if the player is within the tested area\nprint( testPos:WithinAABox( pos1, pos2 ) )"},{"description":"Implement a function to check if world position is inside an entity by converting it to local coordinates that are always axis aligned. Do not check when entity is invalid.","code":"local function IsInside( pos, ent )\n  if ( not IsValid( ent ) ) then return false end\n\n  local vmin = ent:OBBMins()\n  local vmax = ent:OBBMaxs()\n  local vpos = ent:WorldToLocal( pos )\n\n  return vpos:WithinAABox( vmax, vmin )\nend\n\nprint( IsInside( trace.HitPos, trace.Entity ) ) -- Trace hit position a part of the entity"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Zero","parent":"Vector","type":"classfunc","description":"Sets x, y and z to 0.","realm":"Shared and Menu"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"BoostTimeLeft","parent":"Vehicle","type":"classfunc","description":"Returns the remaining boosting time left.","realm":"Server","rets":{"ret":{"text":"The remaining boosting time left","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"CheckExitPoint","parent":"Vehicle","type":"classfunc","description":"Tries to find an Exit Point for leaving vehicle, if one is unobstructed in the direction given.","realm":"Server","args":{"arg":[{"text":"Yaw/roll from vehicle angle to check for exit","name":"yaw","type":"number"},{"text":"Distance from origin to drop player","name":"distance","type":"number"}]},"rets":{"ret":{"text":"Returns the vector for exit position or nil if cannot exit that way.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"EnableEngine","parent":"Vehicle","type":"classfunc","description":"Sets whether the engine is enabled or disabled, i.e. can be started or not.","realm":"Server","args":{"arg":{"text":"Enable or disable the engine","name":"enable","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetAmmo","parent":"Vehicle","type":"classfunc","description":"Returns information about the ammo of the vehicle","realm":"Client","rets":{"ret":[{"text":"Ammo type of the vehicle ammo","name":"","type":"number"},{"text":"Clip size","name":"","type":"number"},{"text":"Count","name":"","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetCameraDistance","parent":"Vehicle","type":"classfunc","description":"Returns third person camera distance.","realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"683-L687"},"rets":{"ret":{"text":"Camera distance","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDriver","parent":"Vehicle","type":"classfunc","description":"Gets the driver of the vehicle, returns NULL if no driver is present.","realm":"Shared","rets":{"ret":{"text":"The driver of the vehicle.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetHLSpeed","parent":"Vehicle","type":"classfunc","description":"Returns the current speed of the vehicle in Half-Life Hammer Units (in/s). Same as Entity:GetVelocity + Vector:Length.","realm":"Server","rets":{"ret":{"text":"The speed of the vehicle","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetMaxSpeed","parent":"Vehicle","type":"classfunc","description":"Returns the max speed of the vehicle in MPH.","realm":"Server","rets":{"ret":{"text":"The max speed of the vehicle in MPH","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetOperatingParams","parent":"Vehicle","type":"classfunc","description":"Returns some info about the vehicle.","realm":"Server","rets":{"ret":{"text":"The operating parameters.","name":"","type":"table{OperatingParams}"}}},"example":{"description":"Example output on a default Half-Life 2 Jeep.","code":"PrintTable( Entity(1):GetVehicle():GetOperatingParams() )","output":"```\nRPM\t=\t19.902961730957\ngear\t=\t0\nisTorqueBoosting\t=\tfalse\nspeed\t=\t-0.67361652851105\nsteeringAngle\t=\t0\nwheelsInContact\t=\t4\n```"},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetPassenger","parent":"Vehicle","type":"classfunc","description":"Gets the passenger of the vehicle, returns NULL if no drivers is present.","realm":"Shared","args":{"arg":{"text":"The index of the passenger ( 0 is the driver )","name":"passenger","type":"number"}},"rets":{"ret":{"text":"The passenger","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPassengerSeatPoint","parent":"Vehicle","type":"classfunc","description":"Returns the seat position and angle of a given passenger seat.","realm":"Server","args":{"arg":{"text":"The passenger role. ( 0 is the driver )","name":"role","type":"number"}},"rets":{"ret":[{"text":"The seat position in worldspace coordinates.","name":"","type":"Vector"},{"text":"The seat angle in worldspace coordinates.","name":"","type":"Angle"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetRPM","parent":"Vehicle","type":"classfunc","description":"Returns the current RPM of the vehicle. This value is fake and doesn't actually affect the vehicle movement.","realm":"Server","rets":{"ret":{"text":"The RPM.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetSpeed","parent":"Vehicle","type":"classfunc","description":"Returns the current speed of the vehicle in MPH.","realm":"Server","rets":{"ret":{"text":"The speed of the vehicle in MPH","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetSteering","parent":"Vehicle","type":"classfunc","description":"Returns the current steering of the vehicle.","realm":"Server","rets":{"ret":{"text":"The current steering of the vehicle.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetSteeringDegrees","parent":"Vehicle","type":"classfunc","description":"Returns the maximum steering degree of the vehicle","realm":"Server","rets":{"ret":{"text":"The maximum steering degree of the vehicle","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetThirdPersonMode","parent":"Vehicle","type":"classfunc","description":"Returns if vehicle has thirdperson mode enabled or not.","realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"696-L700"},"rets":{"ret":{"text":"Returns `true` if third person mode enabled, `false` otherwise","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetThrottle","parent":"Vehicle","type":"classfunc","description":"Returns the current throttle of the vehicle.","realm":"Server","rets":{"ret":{"text":"The current throttle of the vehicle","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetVehicleClass","parent":"Vehicle","type":"classfunc","description":"Returns the vehicle class name. This is only useful for Sandbox spawned vehicles or any vehicle that properly sets the vehicle class with Vehicle:SetVehicleClass.","realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"684-L688"},"rets":{"ret":{"text":"The class name of the vehicle.","name":"","type":"string"}}},"example":{"description":"Prints the spawn menu name of the vehicle the player is currently in.","code":"local c = Entity(1):GetVehicle():GetVehicleClass()\nif ( !list.Get( \"Vehicles\" )[ c ] ) then return end\nlocal t = list.Get( \"Vehicles\" )[ c ]\nprint( t.Name )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetVehicleParams","parent":"Vehicle","type":"classfunc","description":"Returns the vehicle parameters of given vehicle.","realm":"Server","rets":{"ret":{"text":"The vehicle parameters.","name":"","type":"table{VehicleParams}"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetVehicleViewPosition","parent":"Vehicle","type":"classfunc","description":"Returns the view position and forward angle of a given passenger seat.","realm":"Shared","args":{"arg":{"text":"The passenger role. 0 is the driver. This parameter seems to be ignored by the game engine and is therefore optional.","name":"role","type":"number","default":"0"}},"rets":{"ret":[{"text":"The view position, will be 0, 0, 0 on failure","name":"","type":"Vector"},{"text":"The view angles, will be 0, 0, 0 on failure","name":"","type":"Angle"},{"text":"The field of view, will be 0 on failure","name":"","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetWheel","parent":"Vehicle","type":"classfunc","description":"Returns the PhysObj of given wheel.","realm":"Server","args":{"arg":{"text":"The wheel to retrieve","name":"wheel","type":"number"}},"rets":{"ret":{"text":"The wheel","name":"","type":"PhysObj"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetWheelBaseHeight","parent":"Vehicle","type":"classfunc","description":"Returns the base wheel height.","realm":"Server","args":{"arg":{"text":"The wheel to get the base wheel height of.","name":"wheel","type":"number"}},"rets":{"ret":{"text":"The base wheel height.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetWheelContactPoint","parent":"Vehicle","type":"classfunc","description":"Returns the wheel contact point.","realm":"Server","args":{"arg":{"text":"The wheel to check","name":"wheel","type":"number"}},"rets":{"ret":[{"text":"The contact position","name":"","type":"Vector"},{"text":"The Surface Properties ID of hit surface.","name":"","type":"number"},{"text":"Whether the wheel is on ground or not","name":"","type":"boolean"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetWheelCount","parent":"Vehicle","type":"classfunc","description":"Returns the wheel count of the vehicle","realm":"Server","rets":{"ret":{"text":"The amount of wheels","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetWheelTotalHeight","parent":"Vehicle","type":"classfunc","description":"Returns the total wheel height.","realm":"Server","args":{"arg":{"text":"The wheel to get the base wheel height of.","name":"wheel","type":"number"}},"rets":{"ret":{"text":"The total wheel height.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"HasBoost","parent":"Vehicle","type":"classfunc","description":"Returns whether this vehicle has boost at all.","realm":"Server","rets":{"ret":{"text":"Whether this vehicle has boost at all.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"HasBrakePedal","parent":"Vehicle","type":"classfunc","description":"Returns whether this vehicle has a brake pedal. See Vehicle:SetHasBrakePedal.","realm":"Server","rets":{"ret":{"text":"Whether this vehicle has a brake pedal or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsBoosting","parent":"Vehicle","type":"classfunc","description":"Returns whether this vehicle is currently boosting or not.","realm":"Server","rets":{"ret":{"text":"Whether this vehicle is currently boosting or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsEngineEnabled","parent":"Vehicle","type":"classfunc","description":"Returns whether the engine is enabled or not, i.e. whether it can be started.","realm":"Server","rets":{"ret":{"text":"Whether the engine is enabled","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsEngineStarted","parent":"Vehicle","type":"classfunc","description":"Returns whether the engine is started or not.","realm":"Server","rets":{"ret":{"text":"Whether the engine is started or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsValidVehicle","parent":"Vehicle","type":"classfunc","description":"Determines whether a given Vehicle is fully initialized.\n\nIt is possible, in uncommon circumstances, for a valid vehicle entity to be in an invalid state, such as before Entity:Spawn is called on the vehicle after creation.\n\nIf this function returns `false`, then the Vehicle functions are not usable on this vehicle, while Entity functions are.","realm":"Shared","rets":{"ret":{"text":"`true` if the Vehicle is in a valid state, or `false` if the Vehicle is in an invalid state.","name":"","type":"boolean"}}},"example":{"description":"Below is an example demonstrating a way that a Vehicle can return `true` to Global.IsValid and Entity:IsVehicle but still be in an invalid Vehicle state.","code":"-- Create a new jeep, but leave it in an unfinished state\nlocal jeep = ents.Create( \"prop_vehicle_jeep\" )\n\nprint( IsValid( jeep ) ) -- Prints \"true\"\nprint( jeep:IsVehicle() ) -- Prints \"true\"\nprint( jeep:IsValidVehicle() ) -- Prints \"false\"\n\ntimer.Simple( 1, function()\n\t-- Finalize the jeep's creation and put it into a valid Vehicle state\n\tjeep:Spawn()\n\tprint( jeep:IsValidVehicle() ) -- Prints \"true\"\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsVehicleBodyInWater","parent":"Vehicle","type":"classfunc","description":"Returns whether this vehicle's engine is underwater or not. ( Internally the attachment point \"engine\" or \"vehicle_engine\" is checked )","realm":"Server","rets":{"ret":{"text":"Whether this vehicle's engine is underwater or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ReleaseHandbrake","parent":"Vehicle","type":"classfunc","description":"Releases the vehicle's handbrake (Jeep) so it can roll without any passengers.\n\nThis will be overwritten if the vehicle has a driver. Same as Vehicle:SetHandbrake( false )","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetBoost","parent":"Vehicle","type":"classfunc","description":"Sets the boost. It is possible that this function does not work while the vehicle has a valid driver in it.","realm":"Server","args":{"arg":{"text":"The new boost value","name":"boost","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetCameraDistance","parent":"Vehicle","type":"classfunc","description":"Sets the third person camera distance of the vehicle.","realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"677-L681"},"args":{"arg":{"text":"Camera distance to set to","name":"distance","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetHandbrake","parent":"Vehicle","type":"classfunc","description":"Turns on or off the Jeep handbrake so it can roll without a driver inside.\n\nDoes nothing while the vehicle has a driver in it.","realm":"Server","args":{"arg":{"text":"true to turn on, false to turn off.","name":"handbrake","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetHasBrakePedal","parent":"Vehicle","type":"classfunc","description":"Sets whether this vehicle has a brake pedal.","realm":"Server","args":{"arg":{"text":"Whether this vehicle has a brake pedal","name":"brakePedal","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetMaxReverseThrottle","parent":"Vehicle","type":"classfunc","description":"Sets maximum reverse throttle","realm":"Server","args":{"arg":{"text":"The new maximum throttle. This number must be negative.","name":"maxRevThrottle","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetMaxThrottle","parent":"Vehicle","type":"classfunc","description":"Sets maximum forward throttle","realm":"Server","args":{"arg":{"text":"The new maximum throttle.","name":"maxThrottle","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetSpringLength","parent":"Vehicle","type":"classfunc","description":"Sets spring length of given wheel","realm":"Server","args":{"arg":[{"text":"The wheel to change spring length of","name":"wheel","type":"number"},{"text":"The new spring length","name":"length","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetSteering","parent":"Vehicle","type":"classfunc","description":{"text":"Sets the steering of the vehicle.","validate":"The correct range, 0 to 1 or -1 to 1"},"realm":"Server","args":{"arg":[{"text":"Angle of the front wheels (-1 to 1)","name":"front","type":"number"},{"text":"Angle of the rear wheels (-1 to 1)","name":"rear","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetSteeringDegrees","parent":"Vehicle","type":"classfunc","description":"Sets the maximum steering degrees of the vehicle","realm":"Server","args":{"arg":{"text":"The new maximum steering degree","name":"steeringDegrees","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetThirdPersonMode","parent":"Vehicle","type":"classfunc","description":"Sets the third person mode state.","realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"665-L669"},"args":{"arg":{"text":"Enable or disable the third person mode for this vehicle","name":"enable","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetThrottle","parent":"Vehicle","type":"classfunc","description":"Sets the throttle of the vehicle. It is possible that this function does not work with a valid driver in it.","realm":"Server","args":{"arg":{"text":"The new throttle.","name":"throttle","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetVehicleClass","parent":"Vehicle","type":"classfunc","description":{"text":"Sets the vehicle class name.","internal":""},"realm":"Shared","file":{"text":"lua/includes/extensions/entity.lua","line":"678-L682"},"args":{"arg":{"text":"The vehicle class name to set","name":"class","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetVehicleEntryAnim","parent":"Vehicle","type":"classfunc","description":"Sets whether the entry or exit camera animation should be played or not.","realm":"Server","args":{"arg":{"text":"Whether the entry or exit camera animation should be played or not.","name":"bOn","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetVehicleParams","parent":"Vehicle","type":"classfunc","description":{"text":"Sets the vehicle parameters for given vehicle.","note":"Not all variables from the Structures/VehicleParams can be set."},"realm":"Server","args":{"arg":{"text":"The new new vehicle parameters. See Structures/VehicleParams.","name":"params","type":"table"}}},"example":{"description":"Adds 25 horsepower to every vehicle spawned.","code":"hook.Add(\"PlayerSpawnedVehicle\", \"VehicleParamsExample\", function(ply, entity)\n\n    local params = entity:GetVehicleParams()\n\n    params.engine.horsepower = params.engine.horsepower + 25\n\n    entity:SetVehicleParams(params)\n\nend)"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetWheelFriction","parent":"Vehicle","type":"classfunc","description":"Sets friction of given wheel.  This function may be broken.","realm":"Server","args":{"arg":[{"text":"The wheel to change the friction of","name":"wheel","type":"number"},{"text":"The new friction to set","name":"friction","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"StartEngine","parent":"Vehicle","type":"classfunc","description":"Starts or stops the engine.","realm":"Server","args":{"arg":{"text":"True to start, false to stop.","name":"start","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Add","parent":"VMatrix","type":"classfunc","description":"Adds given matrix to this matrix.","added":"2021.12.15","realm":"Shared","args":{"arg":{"text":"The input matrix to add.","name":"input","type":"VMatrix"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAngles","parent":"VMatrix","type":"classfunc","description":"Returns the absolute rotation of the matrix. Scaled matrix might produce unexpected results!","realm":"Shared","rets":{"ret":{"text":"Absolute rotation of the matrix","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetField","parent":"VMatrix","type":"classfunc","description":"Returns a specific field in the matrix.","realm":"Shared","args":{"arg":[{"text":"Row of the field whose value is to be retrieved, from 1 to 4","name":"row","type":"number"},{"text":"Column of the field whose value is to be retrieved, from 1 to 4","name":"column","type":"number"}]},"rets":{"ret":{"text":"The value of the specified field","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetForward","parent":"VMatrix","type":"classfunc","description":"Gets the forward direction of the matrix.\n\nie. The first column of the matrix, excluding the w coordinate.","realm":"Shared","rets":{"ret":{"text":"The forward direction of the matrix.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetInverse","parent":"VMatrix","type":"classfunc","description":"Returns an inverted matrix without modifying the original matrix.\n\nInverting the matrix will fail if its [determinant](https://en.wikipedia.org/wiki/Determinant) is 0 or close to 0. (ie. its \"scale\" in any direction is 0.)\n\nSee also VMatrix:GetInverseTR.","realm":"Shared","rets":{"ret":{"text":"The inverted matrix if possible, nil otherwise","name":"","type":"VMatrix"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetInverseTR","parent":"VMatrix","type":"classfunc","description":"Returns an inverted matrix without modifying the original matrix. This function will not fail, but only works correctly on matrices that contain only translation and/or rotation.\n\nUsing this function on a matrix with modified scale may return an incorrect inverted matrix.\n\nTo get the inverse of a matrix that contains other modifications, see VMatrix:GetInverse.","realm":"Shared","rets":{"ret":{"text":"The inverted matrix.","name":"","type":"VMatrix"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetRight","parent":"VMatrix","type":"classfunc","description":"Gets the right direction of the matrix.\n\nie. The second column of the matrix, negated, excluding the w coordinate.","realm":"Shared","rets":{"ret":{"text":"The right direction of the matrix.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetScale","parent":"VMatrix","type":"classfunc","description":"Returns the absolute scale of the matrix.","realm":"Shared","rets":{"ret":{"text":"Absolute scale of the matrix","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetTranslation","parent":"VMatrix","type":"classfunc","description":"Returns the absolute translation of the matrix.","realm":"Shared","rets":{"ret":{"text":"Absolute translation of the matrix","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetTransposed","parent":"VMatrix","type":"classfunc","description":"Returns the transpose (each row becomes a column) of this matrix.","added":"2021.12.15","realm":"Shared","rets":{"ret":{"text":"The transposed matrix.","name":"transposed","type":"VMatrix"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetUp","parent":"VMatrix","type":"classfunc","description":"Gets the up direction of the matrix.\n\nie. The third column of the matrix, excluding the w coordinate.","realm":"Shared","rets":{"ret":{"text":"The up direction of the matrix.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Identity","parent":"VMatrix","type":"classfunc","description":"Initializes the matrix as Identity matrix.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Invert","parent":"VMatrix","type":"classfunc","description":"Inverts the matrix.\n\nInverting the matrix will fail if its [determinant](https://en.wikipedia.org/wiki/Determinant) is 0 or close to 0. (ie. its \"scale\" in any direction is 0.)\n\nIf the matrix cannot be inverted, it does not get modified.\n\nSee also VMatrix:InvertTR.","realm":"Shared","rets":{"ret":{"text":"Whether the matrix was inverted or not","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"InvertTR","parent":"VMatrix","type":"classfunc","description":"Quickly inverts the matrix. This function will not fail, but only works correctly on matrices that contain only translation and/or rotation.\n\nUsing this function on a matrix with modified scale may return an incorrect inverted matrix.\n\nTo invert a matrix that contains other modifications, see VMatrix:Invert. This function is faster.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsIdentity","parent":"VMatrix","type":"classfunc","description":"Returns whether the matrix is equal to Identity matrix or not.","realm":"Shared","rets":{"ret":{"text":"Is the matrix an Identity matrix or not","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsRotationMatrix","parent":"VMatrix","type":"classfunc","description":"Returns whether the matrix is a rotation matrix or not.\n\nTechnically it checks if the forward, right and up vectors are orthogonal and normalized.","realm":"Shared","rets":{"ret":{"text":"Is the matrix a rotation matrix or not","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsZero","parent":"VMatrix","type":"classfunc","description":"Checks whenever all fields of the matrix are 0, aka if this is a [null matrix](https://en.wikipedia.org/wiki/Zero_matrix).","realm":"Shared","rets":{"ret":{"text":"If the matrix is a null matrix.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Mul","parent":"VMatrix","type":"classfunc","description":"Multiplies this matrix by given matrix.","added":"2021.12.15","realm":"Shared","args":{"arg":{"text":"The input matrix to multiply by.","name":"input","type":"VMatrix"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Rotate","parent":"VMatrix","type":"classfunc","description":"Rotates the matrix by the given angle.\n\nPostmultiplies the matrix by a rotation matrix (A = AR).","realm":"Shared","args":{"arg":{"text":"Rotation.","name":"rotation","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Scale","parent":"VMatrix","type":"classfunc","description":"Scales the matrix by the given vector.\n\nPostmultiplies the matrix by a scaling matrix (A = AS).","realm":"Shared","args":{"arg":{"text":"Vector to scale with matrix with.","name":"scale","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ScaleTranslation","parent":"VMatrix","type":"classfunc","description":"Scales the absolute translation with the given value.","realm":"Shared","args":{"arg":{"text":"Value to scale the translation with.","name":"scale","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Set","parent":"VMatrix","type":"classfunc","description":"Copies values from the given matrix object.","realm":"Shared","args":{"arg":{"text":"The matrix to copy values from.","name":"src","type":"VMatrix"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetAngles","parent":"VMatrix","type":"classfunc","description":"Sets the absolute rotation of the matrix.","realm":"Shared","args":{"arg":{"text":"New angles.","name":"angle","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetField","parent":"VMatrix","type":"classfunc","description":"Sets a specific field in the matrix.","realm":"Shared","args":{"arg":[{"text":"Row of the field to be set, from 1 to 4","name":"row","type":"number"},{"text":"Column of the field to be set, from 1 to 4","name":"column","type":"number"},{"text":"The value to set in that field","name":"value","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetForward","parent":"VMatrix","type":"classfunc","description":"Sets the forward direction of the matrix.\n\nie. The first column of the matrix, excluding the w coordinate.","realm":"Shared","args":{"arg":{"text":"The forward direction of the matrix.","name":"forward","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetRight","parent":"VMatrix","type":"classfunc","description":"Sets the right direction of the matrix.\n\nie. The second column of the matrix, negated, excluding the w coordinate.","realm":"Shared","args":{"arg":{"text":"The right direction of the matrix.","name":"right","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetScale","parent":"VMatrix","type":"classfunc","description":"Modifies the scale of the matrix while preserving the rotation and translation.","realm":"Shared","args":{"arg":{"text":"The scale to set.","name":"scale","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetTranslation","parent":"VMatrix","type":"classfunc","description":"Sets the absolute translation of the matrix.","realm":"Shared","args":{"arg":{"text":"New translation.","name":"translation","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetUnpacked","parent":"VMatrix","type":"classfunc","description":"Sets each component of the matrix.","realm":"Shared","args":{"arg":[{"name":"e11","type":"number"},{"name":"e12","type":"number"},{"name":"e13","type":"number"},{"name":"e14","type":"number"},{"name":"e21","type":"number"},{"name":"e22","type":"number"},{"name":"e23","type":"number"},{"name":"e24","type":"number"},{"name":"e31","type":"number"},{"name":"e32","type":"number"},{"name":"e33","type":"number"},{"name":"e34","type":"number"},{"name":"e41","type":"number"},{"name":"e42","type":"number"},{"name":"e43","type":"number"},{"name":"e44","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetUp","parent":"VMatrix","type":"classfunc","description":"Sets the up direction of the matrix.\n\nie. The third column of the matrix, excluding the w coordinate.","realm":"Shared","args":{"arg":{"text":"The up direction of the matrix.","name":"up","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Sub","parent":"VMatrix","type":"classfunc","description":"Subtracts given matrix from this matrix.","added":"2021.12.15","realm":"Shared","args":{"arg":{"text":"The input matrix to subtract.","name":"input","type":"VMatrix"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ToTable","parent":"VMatrix","type":"classfunc","description":"Converts the matrix to a 4x4 table. See Global.Matrix function.","realm":"Shared","rets":{"ret":{"text":"The 4x4 table.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Translate","parent":"VMatrix","type":"classfunc","description":"Translates the matrix by the given vector aka. adds the vector to the translation.\n\nPostmultiplies the matrix by a translation matrix (A = AT).","realm":"Shared","args":{"arg":{"text":"Vector to translate the matrix by.","name":"translation","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Unpack","parent":"VMatrix","type":"classfunc","description":"Returns each component of the matrix, expanding rows before columns.","realm":"Shared","rets":{"ret":[{"text":"VMatrix:GetField(1, 1)","name":"","type":"number"},{"text":"VMatrix:GetField(1, 2)","name":"","type":"number"},{"text":"VMatrix:GetField(1, 3)","name":"","type":"number"},{"text":"VMatrix:GetField(1, 4)","name":"","type":"number"},{"text":"VMatrix:GetField(2, 1)","name":"","type":"number"},{"text":"VMatrix:GetField(2, 2)","name":"","type":"number"},{"text":"VMatrix:GetField(2, 3)","name":"","type":"number"},{"text":"VMatrix:GetField(2, 4)","name":"","type":"number"},{"text":"VMatrix:GetField(3, 1)","name":"","type":"number"},{"text":"VMatrix:GetField(3, 2)","name":"","type":"number"},{"text":"VMatrix:GetField(3, 3)","name":"","type":"number"},{"text":"VMatrix:GetField(3, 4)","name":"","type":"number"},{"text":"VMatrix:GetField(4, 1)","name":"","type":"number"},{"text":"VMatrix:GetField(4, 2)","name":"","type":"number"},{"text":"VMatrix:GetField(4, 3)","name":"","type":"number"},{"text":"VMatrix:GetField(4, 4)","name":"","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Zero","parent":"VMatrix","type":"classfunc","description":"Sets all components of the matrix to 0, also known as a [null matrix](https://en.wikipedia.org/wiki/Zero_matrix).\n\nThis function is more efficient than setting each element manually.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AllowsAutoSwitchFrom","parent":"Weapon","type":"classfunc","description":"Returns whether the weapon allows to being switched from when a better ( Weapon:GetWeight ) weapon is being picked up.","realm":"Shared","rets":{"ret":{"text":"Whether the weapon allows to being switched from.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AllowsAutoSwitchTo","parent":"Weapon","type":"classfunc","description":"Returns whether the weapon allows to being switched to when a better (Weapon:GetWeight) weapon is being picked up.","realm":"Shared","rets":{"ret":{"text":"Whether the weapon allows to being switched to.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CallOnClient","parent":"Weapon","type":"classfunc","description":{"text":"Calls a SWEP function on client. Does nothing on client.","warning":"This uses the usermessage internally, because of that, the combined length of the arguments of this function may not exceed 254 bytes/characters or the function will cease to function!"},"realm":"Shared","args":{"arg":[{"text":"Name of function to call. If you want to call `SWEP:MyFunc()` on client, you type in `\"MyFunc\"`","name":"functionName","type":"string"},{"text":"Custom data to be passed to the target SWEP function as the first argument.","name":"data","type":"string","default":""}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Clip1","parent":"Weapon","type":"classfunc","description":{"text":"Returns how much primary ammo is in the magazine.","note":"This is not shared between clients and will instead return the maximum primary clip size."},"realm":"Shared","rets":{"ret":{"text":"The amount of primary ammo in the magazine.","name":"","type":"number"}}},"example":{"description":"Prints the amount of primary ammo in the magazine of the weapon the 1st player has equipped.","code":"print( Entity( 1 ):GetActiveWeapon():Clip1() )","output":"Will print 45 for fully loaded SMG1."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Clip2","parent":"Weapon","type":"classfunc","description":{"text":"Returns how much secondary ammo is in the magazine.","note":"This is not shared between clients and will instead return the maximum secondary clip size."},"realm":"Shared","rets":{"ret":{"text":"The amount of secondary ammo in the magazine.","name":"","type":"number"}}},"example":{"description":"Prints the amount of secondary ammo in the magazine of the weapon the 1st player has equipped.","code":"print( Entity( 1 ):GetActiveWeapon():Clip2() )","output":"Will print -1 for all HL2 weapons."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DefaultReload","parent":"Weapon","type":"classfunc","description":{"text":"Forces the weapon to reload while playing given animation.","note":"This will stop the Weapon:Think function from getting called while the weapon is reloading!"},"realm":"Shared","args":{"arg":{"text":"Sequence to use as reload animation. Uses the Enums/ACT.","name":"act","type":"number"}},"rets":{"ret":{"text":"Did reloading actually take place","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetActivity","parent":"Weapon","type":"classfunc","description":{"text":"Returns the sequence enumeration number that the weapon is playing.","bug":{"text":"This can return inconsistent results between the server and client.","issue":"2543"}},"realm":"Shared","rets":{"ret":{"text":"Current activity, see Enums/ACT. Returns 0 if the weapon doesn't have active sequence.","name":"","type":"number"}}},"example":{"description":"This will return the ACT_ENUM that is currently active for the weapon.","code":"local wep = Entity(1):GetActiveWeapon()\n \nif ( IsValid( wep ) ) then // Makes sure that wep exists\n \n    print( wep:GetActivity() ) // Prints the sequence number\n \nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetDeploySpeed","parent":"Weapon","type":"classfunc","description":"Returns the weapon deploy speed, as set by Weapon:SetDeploySpeed. If not previously set, the value will be polled from the `sv_defaultdeployspeed` ConVar.","realm":"Shared","added":"2023.06.28","rets":{"ret":{"text":"The value to set deploy speed to.","name":"speed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetHoldType","parent":"Weapon","type":"classfunc","description":"Returns the hold type of the weapon.","realm":"Shared","rets":{"ret":{"text":"The hold type of the weapon. You can find a list of default hold types here.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMaxClip1","parent":"Weapon","type":"classfunc","description":"Returns maximum primary clip size","realm":"Shared","rets":{"ret":{"text":"Maximum primary clip size","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMaxClip2","parent":"Weapon","type":"classfunc","description":"Returns maximum secondary clip size","realm":"Shared","rets":{"ret":{"text":"Maximum secondary clip size","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNextPrimaryFire","parent":"Weapon","type":"classfunc","description":"Gets the next time the weapon can primary fire. ( Can call WEAPON:PrimaryAttack )","realm":"Shared","rets":{"ret":{"text":"The time, relative to Global.CurTime","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetNextSecondaryFire","parent":"Weapon","type":"classfunc","description":"Gets the next time the weapon can secondary fire. ( Can call WEAPON:SecondaryAttack )","realm":"Shared","rets":{"ret":{"text":"The time, relative to Global.CurTime","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPrimaryAmmoType","parent":"Weapon","type":"classfunc","description":"Gets the primary ammo type of the given weapon.","realm":"Shared","rets":{"ret":{"text":"The ammo type ID, or -1 if not found.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPrintName","parent":"Weapon","type":"classfunc","description":{"text":"Returns the non-internal name of the weapon, that should be for displaying.","note":["If that returns an untranslated message (#HL2_XX), use language.GetPhrase to see the \"nice\" name.","If SWEP.PrintName is not set in the Weapon or the Weapon Base then \"<MISSING SWEP PRINT NAME>\" will be returned."]},"realm":"Shared","rets":{"ret":{"text":"The \"nice\" name of the weapon.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSecondaryAmmoType","parent":"Weapon","type":"classfunc","description":"Gets the ammo type of the given weapons secondary fire.","realm":"Shared","rets":{"ret":{"text":"The secondary ammo type ID, or -1 if not found.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSlot","parent":"Weapon","type":"classfunc","description":{"text":"Returns the slot of the weapon.","note":"The slot numbers start from 0."},"realm":"Shared","rets":{"ret":{"text":"The slot of the weapon.","name":"","type":"number"}}},"example":{"description":"How you could use this function to check if a weapon slot was empty or not.","code":"function IsSlotEmpty( ply, slot )\n\tslot = slot - 1 -- take away 1 from the slot number you want since it starts from 0\n\n\tfor _, v in ipairs( ply:GetWeapons() ) do -- get all the weapons the player has and loop through them\n\t\tif v:GetSlot() == slot then return false end -- check if the slot is the slot you wanted to check, if it is, return false\n\tend\n\n\treturn true -- otherwise return true\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSlotPos","parent":"Weapon","type":"classfunc","description":"Returns slot position of the weapon","realm":"Shared","rets":{"ret":{"text":"The slot position of the weapon","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetWeaponViewModel","parent":"Weapon","type":"classfunc","description":"Returns the view model of the weapon.","realm":"Shared","rets":{"ret":{"text":"The view model of the weapon.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetWeaponWorldModel","parent":"Weapon","type":"classfunc","description":"Returns the world model of the weapon.","realm":"Shared","rets":{"ret":{"text":"The world model of the weapon.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetWeight","parent":"Weapon","type":"classfunc","description":"Returns the \"weight\" of the weapon, which is used when deciding which Weapon is better by the engine.","realm":"Shared","rets":{"ret":{"text":"The weapon \"weight\".","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"HasAmmo","parent":"Weapon","type":"classfunc","description":{"text":"Returns whether the weapon has ammo left or not. It will return false when there's no ammo left in the magazine **and** when there's no reserve ammo left.","note":"This will return true for weapons like crowbar, gravity gun, etc."},"realm":"Shared","rets":{"ret":{"text":"Whether the weapon has ammo or not.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsCarriedByLocalPlayer","parent":"Weapon","type":"classfunc","description":"Returns whenever the weapon is carried by the local player.","realm":"Client","rets":{"ret":{"text":"Is the weapon is carried by the local player or not","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsScripted","parent":"Weapon","type":"classfunc","description":"Checks if the weapon is a SWEP or a built-in weapon.","realm":"Shared","rets":{"ret":{"text":"Returns true if weapon is scripted ( SWEP ), false if not ( A built-in HL2/HL:S weapon )","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsWeaponVisible","parent":"Weapon","type":"classfunc","description":"Returns whether the weapon is visible. The term visibility is not exactly what gets checked here, first it checks if the owner is a player, then checks if the active view model has EF_NODRAW flag NOT set.","realm":"Shared","rets":{"ret":{"text":"Is visible or not","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"LastShootTime","parent":"Weapon","type":"classfunc","description":"Returns the time since this weapon last fired a bullet with Entity:FireBullets in seconds. It is not networked.","realm":"Shared","rets":{"ret":{"text":"The time in seconds when the last bullet was fired.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SendWeaponAnim","parent":"Weapon","type":"classfunc","description":"Forces weapon to play activity/animation.","realm":"Shared","args":{"arg":{"text":"Activity to play. See the Enums/ACT (specifically `ACT_VM_`).","name":"act","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetActivity","parent":"Weapon","type":"classfunc","description":"Sets the activity the weapon is playing.\n\nSee also Weapon:GetActivity.","added":"2021.03.31","realm":"Shared","args":{"arg":{"text":"The new activity to set, see Enums/ACT.","name":"act","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetClip1","parent":"Weapon","type":"classfunc","description":"Lets you change the number of bullets in the given weapons primary clip.","realm":"Shared","args":{"arg":{"text":"The amount of bullets the clip should contain","name":"ammo","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetClip2","parent":"Weapon","type":"classfunc","description":"Lets you change the number of bullets in the given weapons secondary clip.","realm":"Shared","args":{"arg":{"text":"The amount of bullets the clip should contain","name":"ammo","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetDeploySpeed","parent":"Weapon","type":"classfunc","description":"Sets the weapon deploy speed. This value needs to match on client and server.","realm":"Shared","args":{"arg":{"text":"The value to set deploy speed to. Values less than `1` will slow down the animations. Minimum value is `0.1`.","name":"speed","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetHoldType","parent":"Weapon","type":"classfunc","description":{"text":"Sets the hold type of the weapon. This function also calls WEAPON:SetWeaponHoldType and properly networks it to all clients.","note":"This only works on scripted weapons.","bug":"Using this function on weapons held by bots will not network holdtype changes to clients if the world model is set to an empty string (SWEP.WorldModel = \"\")."},"realm":"Shared","args":{"arg":{"text":"Name of the hold type. You can find all default hold types here","name":"name","type":"string"}}},"example":{"description":"Puts a players hands down by its sides on reload.","code":"function SWEP:Reload()\n\tself:SetHoldType( \"normal\" )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetLastShootTime","parent":"Weapon","type":"classfunc","description":"Sets the time since this weapon last fired in seconds. Used in conjunction with Weapon:LastShootTime.\n\nThis value is **not** networked to the client if set from server.","realm":"Shared","args":{"arg":{"text":"The time in seconds when the last time the weapon was fired.","name":"time","type":"number","default":"CurTime()"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNextPrimaryFire","parent":"Weapon","type":"classfunc","description":{"text":"Sets when the weapon can fire again. Time should be based on Global.CurTime.","note":"The standard HL2 Pistol (`weapon_pistol`) bypasses this function due to an [internal implementation](https://github.com/ValveSoftware/source-sdk-2013/blob/master/src/game/server/hl2/weapon_pistol.cpp#L313-L317).","bug":{"text":"This will fire extra bullets if the time is set to less than Global.CurTime.","issue":"3786"}},"realm":"Shared","args":{"arg":{"text":"Time when player should be able to use primary fire again","name":"time","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetNextSecondaryFire","parent":"Weapon","type":"classfunc","description":"Sets when the weapon can alt-fire again. Time should be based on Global.CurTime.","realm":"Shared","args":{"arg":{"text":"Time when player should be able to use secondary fire again","name":"time","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Fetch","parent":"WorkshopFileBase","type":"classfunc","description":{"text":"Fetches all subscriptions for the set namespace and type","note":"If you want to use the type `local` you need to implement the `:FetchLocal(offset, perpage)` function!"},"realm":"Shared and Menu","args":{"arg":[{"text":"The type to search for. (`local`, `subscribed`, `subscribed_ugc`, `mine`, `favorite`)","name":"type","type":"string"},{"text":"Skips the first x results.","name":"offset","type":"number"},{"text":"How many results per page should be returned.","name":"perpage","type":"number"},{"text":"additional tags to filter the results.","name":"extratags","type":"table"},{"text":"text that needs to be in the addon title. Use an empty string for none","name":"searchText","type":"string"},{"text":"The filter for the results. (`enabledonly`, `disabledonly`)","name":"filter","type":"number","default":"nil"},{"text":"How it should be sorted. If set to `nil`, it will fallback to `timeadded`. (`title`, `size`, `updated`)","name":"sort","type":"string","default":"nil"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"FetchSubscribed","parent":"WorkshopFileBase","type":"classfunc","description":"Fetches all subscriptions for the set namespace and passes the result to WorkshopFileBase:FillFileInfo.","realm":"Shared and Menu","args":{"arg":[{"text":"Skips the first x results.","name":"offset","type":"number"},{"text":"How many results per page should be returned.","name":"perpage","type":"number"},{"text":"additional tags to filter the results.","name":"tags","type":"table"},{"text":"text that needs to be in the addon title. Use an empty string for none","name":"searchText","type":"string"},{"text":"if true it will use engine.GetUserContent instead of engine.GetAddons","name":"isUGC","type":"boolean","default":"nil"},{"text":"The filter for the results. (`enabledonly`, `disabledonly`)","name":"filter","type":"number","default":"nil"},{"text":"How it should be sorted. If set to `nil`, it will fallback to `timeadded`. (`title`, `size`, `updated`)","name":"sort","type":"string","default":"nil"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"FillFileInfo","parent":"WorkshopFileBase","type":"classfunc","description":"Updates the set HTML panel with the newly fetched results","realm":"Shared and Menu","args":{"arg":[{"text":"The type to search for. (`local`, `subscribed`, `subscribed_ugc`, `mine`, `favorite`)","name":"results","type":"table"},{"text":"Skips the first x results.","name":"isUGC","type":"boolean"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Publish","parent":"WorkshopFileBase","type":"classfunc","description":"Creates a UGCPublishWindow to publish the dupe or save","realm":"Shared and Menu","args":{"arg":[{"text":"The type to search for. (`local`, `subscribed`, `subscribed_ugc`, `mine`, `favorite`)","name":"filename","type":"string"},{"text":"The image to use","name":"image","type":"string"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"RetrieveUserName","parent":"WorkshopFileBase","type":"classfunc","description":"Retrieves the username for the given SteamID.","realm":"Shared and Menu","args":{"arg":[{"text":"SteamID to retrieve the name for","name":"steamid","type":"string"},{"text":"Callback function.","name":"callback","type":"function","callback":{"arg":{"text":"The retrieved name","type":"string","name":"name"}}}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"BalloonPopped","parent":"achievements","type":"libraryfunc","description":{"text":"Adds one to the count of balloons burst. Once this count reaches 1000, the 'Popper' achievement is unlocked.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Count","parent":"achievements","type":"libraryfunc","description":"Returns the amount of achievements currently in Garry's Mod.","realm":"Client and Menu","rets":{"ret":{"text":"The amount of achievements available.\n\nThis will include 1 extra hidden/non functional achievement at index 0.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"EatBall","parent":"achievements","type":"libraryfunc","description":{"text":"Adds one to the count of balls eaten. Once this count reaches 200, the 'Ball Eater' achievement is unlocked.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetCount","parent":"achievements","type":"libraryfunc","description":"Retrieves progress of given achievement.","realm":"Client and Menu","args":{"arg":{"text":"The ID of the achievement.","name":"achievementID","type":"number"}},"rets":{"ret":{"text":"The numerical progress.\n\nOne-time achievements **always** have the progress of 0.","name":"","type":"number"}}},"example":{"description":"Prints your current progress for every achievement into the console.","code":"for i = 1, achievements.Count() - 1 do\n\tprint( achievements.GetName( i ), achievements.GetCount( i ) )\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDesc","parent":"achievements","type":"libraryfunc","description":"Retrieves the description of the given achievement.","realm":"Client and Menu","args":{"arg":{"text":"The ID of the achievement.","name":"achievementID","type":"number"}},"rets":{"ret":{"text":"The description.","name":"","type":"string"}}},"example":{"description":"Prints the description of every achievement into the console.","code":"for i = 1, achievements.Count() - 1 do\n\tprint( achievements.GetDesc( i ) )\nend","output":"```\nPlay singleplayer at least once\nPlay multiplayer at least once\nStart Garry's Mod 1000 times\nSay the secret phrase\nYou have wasted a year of your life playing GMod!\nPlay 20 different maps\nPlay a gamemode that isn't sandbox\nKilled 1000 Baddies\nPlay with 10 friends\nPlay on the same server as garry\nPlay on the same server & map for 8 hours\n24 hours of your life wasted\nOne whole week of your life wasted\nOne whole month of your life wasted\nPlay on the same server & map for 4 hours\nKill 1000 innocent animals\nKill 1000 friendly NPCs\nEat 200 balls\nSpawn 5000 props\nBurst 1000 balloons\nRemove 5000 things\nOpen the spawnmenu 100,000 times\nExperience 500 Lua programming errors\nSpawn 1000 NPCs\nSpawn 2000 ragdolls\nYour Workshop uploads got 10 thumbs\nYour workshop uploads got 100 thumbs\nYour Workshop uploads got 1000 thumbs\nGet 1000 thumbs on a single upload (then go to jail)\n```"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetGoal","parent":"achievements","type":"libraryfunc","description":"Retrieves the end progress goal of the given achievement.","realm":"Client and Menu","args":{"arg":{"text":"The ID of the achievement.","name":"achievementID","type":"number"}},"rets":{"ret":{"text":"The end progress goal.","name":"","type":"number"}}},"example":{"description":"Prints your current progress and the goal for every achievement into the console.","code":"for i = 1, achievements.Count() - 1 do\n\tprint( achievements.GetName( i ), achievements.GetCount( i ) .. \" / \" .. achievements.GetGoal( i ) )\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetName","parent":"achievements","type":"libraryfunc","description":"Retrieves the name of the given achievement.","realm":"Client and Menu","args":{"arg":{"text":"The ID of the achievement.","name":"achievementID","type":"number"}},"rets":{"ret":{"text":"The name.","name":"","type":"string"}}},"example":{"description":"Prints the name of every achievement into the console.","code":"for i = 1, achievements.Count() - 1 do\n\tprint( achievements.GetName( i ) )\nend","output":"```\nPlay Singleplayer\nPlay Multiplayer\nStartup Millenium\nSecret Phrase\nAddict\nMap Loader\nPlay Around\nWar Zone\nFriendly\nYes, I am the real garry!\nMarathon\nOne Day\nOne Week\nOne Month\nHalf Marathon\nInnocent Bystander\nBad Friend\nBall Eater\nCreator\nPopper\nDestroyer\nMenu User\nBad Coder\nProcreator\nDollhouse\n10 Thumbs\n100 Thumbs\n1000 Thumbs\nMega Upload\n```"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IncBaddies","parent":"achievements","type":"libraryfunc","description":{"text":"Adds one to the count of baddies killed. Once this count reaches 1000, the 'War Zone' achievement is unlocked.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"IncBystander","parent":"achievements","type":"libraryfunc","description":{"text":"Adds one to the count of innocent animals killed. Once this count reaches 1000, the 'Innocent Bystander' achievement is unlocked.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"IncGoodies","parent":"achievements","type":"libraryfunc","description":{"text":"Adds one to the count of friendly NPCs killed. Once this count reaches 1000, the 'Bad Friend' achievement is unlocked.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsAchieved","parent":"achievements","type":"libraryfunc","description":"Returns whether the given achievement is obtained or not.","realm":"Client and Menu","args":{"arg":{"text":"The ID of the achievement.","name":"achievementID","type":"number"}},"rets":{"ret":{"text":"The state.","name":"","type":"boolean"}}},"example":{"description":"Prints the current status for every your achievement into the console.","code":"for i = 1, achievements.Count() - 1 do\n\tprint( achievements.GetName( i ), achievements.IsAchieved( i ) )\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Remover","parent":"achievements","type":"libraryfunc","description":{"text":"Adds one to the count of things removed. Once this count reaches 5000, the 'Destroyer' achievement is unlocked.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SpawnedNPC","parent":"achievements","type":"libraryfunc","description":{"text":"Adds one to the count of NPCs spawned. Once this count reaches 1000, the 'Procreator' achievement is unlocked.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SpawnedProp","parent":"achievements","type":"libraryfunc","description":{"text":"Adds one to the count of props spawned. Once this count reaches 5000, the 'Creator' achievement is unlocked.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SpawnedRagdoll","parent":"achievements","type":"libraryfunc","description":{"text":"Adds one to the count of ragdolls spawned. Once this count reaches 2000, the 'Dollhouse' achievement is unlocked.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SpawnMenuOpen","parent":"achievements","type":"libraryfunc","description":{"text":"Adds one to the count of how many times the spawnmenu has been opened. Once this count reaches 100,000, the 'Menu User' achievement is unlocked.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetNodeCount","parent":"ai","type":"libraryfunc","description":"Returns the number of AI nodes on the map, used by the base game NPCs.\n\nFor NextBots, see navmesh.","added":"2025.07.03","realm":"Server","rets":{"ret":{"text":"The node count.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetScheduleID","parent":"ai","type":"libraryfunc","description":"Translates a schedule name to its corresponding ID.","realm":"Server","args":{"arg":{"text":"Then schedule name. In most cases, this will be the same as the Enums/SCHED name.","name":"sched","type":"string"}},"rets":{"ret":{"text":"The schedule ID, see Enums/SCHED. Returns -1 if the schedule name isn't valid.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetSquadLeader","parent":"ai","type":"libraryfunc","description":"Returns the squad leader of the given squad.","realm":"Server","added":"2021.01.27","args":{"arg":{"text":"The squad name.","name":"squad","type":"string"}},"rets":{"ret":{"text":"The squad leader.","name":"","type":"NPC"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetSquadMemberCount","parent":"ai","type":"libraryfunc","description":"Returns the amount of members a given squad has. See also ai.GetSquadMembers.","realm":"Server","added":"2021.01.27","args":{"arg":{"text":"The squad name.","name":"squad","type":"string"}},"rets":{"ret":{"text":"The member count.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetSquadMembers","parent":"ai","type":"libraryfunc","description":"Returns all members of a given squad. See also ai.GetSquadMemberCount and NPC:GetSquad.","realm":"Server","added":"2021.01.27","args":{"arg":{"text":"The squad name.","name":"squad","type":"string"}},"rets":{"ret":{"text":"A table of NPCs in the given squad.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetTaskID","parent":"ai","type":"libraryfunc","description":"Translates a task name to its corresponding ID.","realm":"Server","args":{"arg":{"text":"The task name.","name":"task","type":"string"}},"rets":{"ret":{"text":"The task ID, see [ai_task.h](https://github.com/ValveSoftware/source-sdk-2013/blob/55ed12f8d1eb6887d348be03aee5573d44177ffb/mp/src/game/server/ai_task.h#L89-L502). Returns -1 if the schedule name isn't valid.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"New","parent":"ai_schedule","type":"libraryfunc","description":"Creates a schedule for scripted NPC.","realm":"Server","file":{"text":"lua/includes/modules/ai_schedule.lua","line":"89-L98"},"args":{"arg":{"text":"Name of the schedule.","name":"name","type":"string"}},"rets":{"ret":{"text":"A table containing schedule information to be used with ENTITY:StartSchedule.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"New","parent":"ai_task","type":"libraryfunc","description":"Create a new empty task. Used by Schedule:AddTask and Schedule:EngTask.","realm":"Server","file":{"text":"lua/includes/modules/ai_task.lua","line":"109-L123"},"rets":{"ret":{"text":"The new task object.","name":"","type":"Task"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Get","parent":"baseclass","type":"libraryfunc","description":{"text":"Gets the base class of an an object.\n\n\tThis is used not just by entities, but also by widgets, panels, drive modes, weapons and gamemodes (with \"gamemode_\" prefix).\n\n\tThe keyword **DEFINE_BASECLASS** translates into a call to this function. In the engine, it is replaced with:\n\n\t```lua\n\tlocal BaseClass = baseclass.Get\n\t```\n\n\t\n\n\tFor more information, including usage examples, see the BaseClasses reference page.","note":"You should prefer using this instead of `self.BaseClass` to avoid infinite recursion."},"realm":"Shared and Menu","file":{"text":"lua/includes/modules/baseclass.lua","line":"32-L41"},"args":{"arg":{"text":"The child class.","name":"name","type":"string"}},"rets":{"ret":{"text":"The base class's meta table.","name":"","type":"table"}}},"example":{"description":"Inherits the weapon from weapon_csbasegun and calls its base functions.","code":"AddCSLuaFile()\nDEFINE_BASECLASS( \"weapon_csbasegun\" ) //this is equivalent to local BaseClass = baseclass.Get( \"weapon_csbasegun\" )\n\n//omitted generic swep definitions\n\nfunction SWEP:Initialize()\n\tBaseClass.Initialize( self ) //calls SWEP:Initialize() from weapon_csbasegun\n\tself:SetHoldType( \"pistol\" )\nend\n\nfunction SWEP:Deploy()\n\tself:SetAccuracy( 0.9 )\n\treturn BaseClass.Deploy( self ) //calls SWEP:Deploy() from weapon_csbasegun and returns its result\nend\n\nfunction SWEP:SetupDataTables()\n\tBaseClass.SetupDataTables( self ) //calls SWEP:SetupDataTables() from weapon_csbasegun and inits its dtvars\nend"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Set","parent":"baseclass","type":"libraryfunc","description":"Add a new base class that can be derived by others. This is done automatically for:\n* [panels](vgui.Register)\n* [drive modes](drive.Register)\n* [entities and widgets](scripted_ents.Register)\n* [weapons](weapons.Register)\n* [gamemodes](gamemode.Register) (with prefix \"gamemode_\")\n\nFor more information, including usage examples, see the BaseClasses reference page.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/baseclass.lua","line":"43-L58"},"args":{"arg":[{"text":"The name of this base class. Must be completely unique.","name":"name","type":"string"},{"text":"The base class.","name":"tab","type":"table"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"arshift","parent":"bit","type":"libraryfunc","description":"Returns the arithmetically shifted value.","realm":"Shared and Menu","args":{"arg":[{"text":"The value to be manipulated.","name":"value","type":"number"},{"text":"Amounts of bits to shift.","name":"shiftCount","type":"number"}]},"rets":{"ret":{"text":"The shifted value.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"band","parent":"bit","type":"libraryfunc","description":"Performs the bitwise `and` for all values specified.","realm":"Shared and Menu","args":{"arg":[{"text":"The value to be manipulated.","name":"value","type":"number"},{"text":"Values bit to perform bitwise \"and\" with. Optional.","name":"...","type":"vararg"}]},"rets":{"ret":{"text":"Result of bitwise \"and\" operation.","name":"","type":"number"}}},"example":[{"code":"local a = 170    -- 10101010 in binary form\nlocal b = 146    -- 10010010 in binary form\nprint( bit.band( a, b ) )","output":"130 (10000010 in binary form)"},{"description":"Tests for a specific damage type.","code":"local myDamage = bit.bor( DMG_BULLET, DMG_RADIATION )\nlocal isBulletDamage = bit.band( myDamage, DMG_BULLET ) == DMG_BULLET \nprint( isBulletDamage )"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"bnot","parent":"bit","type":"libraryfunc","description":"Returns the bitwise not of the value. Inverts every bit of the 32bit integer.","realm":"Shared and Menu","args":{"arg":{"text":"The value to be inverted.","name":"value","type":"number"}},"rets":{"ret":{"text":"The result of bitwise not. 0101 becomes 1010, etc.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"bor","parent":"bit","type":"libraryfunc","description":"Returns the bitwise OR of all values specified.","realm":"Shared and Menu","args":{"arg":[{"text":"The first value.","name":"value1","type":"number"},{"text":"Extra values to be evaluated. (must all be numbers)","name":"...","type":"vararg"}]},"rets":{"ret":{"text":"The bitwise OR result between all numbers.","name":"","type":"number"}}},"example":[{"description":"Performs the bitwise OR operation between three values.","code":"local a = math.BinToInt(\"1000\")\nlocal b = math.BinToInt(\"0100\")\nlocal c = math.BinToInt(\"0001\")\n\nlocal result = bit.bor(a, b, c)\n\nprint(math.IntToBin(result))\nprint(result)","output":"```\n1101\n13\n```"},{"description":"Adding multiple capabilities to an NPC.","code":"NPC:CapabilitiesAdd( bit.bor( CAP_MOVE_GROUND, CAP_ANIMATEDFACE, CAP_TURN_HEAD ) )"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"bswap","parent":"bit","type":"libraryfunc","description":"Swaps the byte order.","realm":"Shared and Menu","args":{"arg":{"text":"The value to be byte swapped.","name":"value","type":"number"}},"rets":{"ret":{"text":"The resulting swapped value.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"bxor","parent":"bit","type":"libraryfunc","description":"Returns the bitwise xor of all values specified.","realm":"Shared and Menu","args":{"arg":[{"text":"The value to be manipulated.","name":"value","type":"number"},{"text":"Values bit xor with. Optional.","name":"otherValues","type":"number","default":"nil"}]},"rets":{"ret":{"text":"The XORed value.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"lshift","parent":"bit","type":"libraryfunc","description":{"text":"Returns the result of shifting given value left bitwise by given number of bits. See [this wiki article](https://en.wikipedia.org/wiki/Bitwise_operation#Bit_shifts) for more details.","note":"The returned value will be clamped to a signed 32-bit integer, even on 64-bit builds."},"realm":"Shared and Menu","args":{"arg":[{"text":"The value to be manipulated.","name":"value","type":"number"},{"text":"Amounts of bits to shift left by.","name":"shiftCount","type":"number"}]},"rets":{"ret":{"text":"The resulting value. Input of `0b1001` will become `0b10010` for one left shift, etc.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"rol","parent":"bit","type":"libraryfunc","description":"Returns the left rotated value.","realm":"Shared and Menu","args":{"arg":[{"text":"The value to be manipulated.","name":"value","type":"number"},{"text":"Amounts of bits to rotate left by.","name":"shiftCount","type":"number"}]},"rets":{"ret":{"text":"The shifted value.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ror","parent":"bit","type":"libraryfunc","description":"Returns the right rotated value.","realm":"Shared and Menu","args":{"arg":[{"text":"The value to be manipulated.","name":"value","type":"number"},{"text":"Amounts of bits to rotate right by.","name":"shiftCount","type":"number"}]},"rets":{"ret":{"text":"The shifted value.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"rshift","parent":"bit","type":"libraryfunc","description":{"text":"Returns the right shifted value.","note":"The returned value will be clamped to a signed 32-bit integer, even on 64-bit builds."},"realm":"Shared and Menu","args":{"arg":[{"text":"The value to be manipulated.","name":"value","type":"number"},{"text":"Amounts of bits to shift right by.","name":"shiftCount","type":"number"}]},"rets":{"ret":{"text":"The shifted value.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"tobit","parent":"bit","type":"libraryfunc","description":"Normalizes the specified value and clamps it in the range of a signed 32bit integer.","realm":"Shared and Menu","args":{"arg":{"text":"The value to be normalized.","name":"value","type":"number"}},"rets":{"ret":{"text":"The 32 bits of the provided value.","name":"","type":"number"}}},"example":{"description":"","code":"print( bit.tobit( 9999999999 ) )","output":{"text":"1410065407\n\nVisual explanation:","upload":{"src":"70c/8dd3989d89f3bae.png","size":"591911","name":"January20-1021-gmod.png"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"tohex","parent":"bit","type":"libraryfunc","description":"Returns the hexadecimal representation of the number with the specified number of characters.","realm":"Shared and Menu","args":{"arg":[{"text":"The value to be normalized.","name":"value","type":"number"},{"text":"Maximum number of characters, if set. The absolute maximum is 8.","name":"characters","type":"number","default":"8"}]},"rets":{"ret":{"text":"The hexadecimal representation, such as \"00000001\".","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ApplyShake","parent":"cam","type":"libraryfunc","description":"Shakes the screen at a certain position.","realm":"Client","args":{"arg":[{"text":"Origin of the shake.","name":"pos","type":"Vector"},{"text":"Angles of the shake.","name":"angles","type":"Angle"},{"text":"The shake factor.","name":"factor","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"End","parent":"cam","type":"libraryfunc","description":"Switches the renderer back to the previous drawing mode from a 3D context.\n\nThis function is an alias of cam.End3D.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"End2D","parent":"cam","type":"libraryfunc","description":"Switches the renderer back to the previous drawing mode from a 2D context.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"End3D","parent":"cam","type":"libraryfunc","description":"Switches the renderer back to the previous drawing mode from a 3D context.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"End3D2D","parent":"cam","type":"libraryfunc","description":"Switches the renderer back to the previous drawing mode from a 3D2D context.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"EndOrthoView","parent":"cam","type":"libraryfunc","description":"Switches the renderer back to the previous drawing mode from a 3D orthographic rendering context.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetModelMatrix","parent":"cam","type":"libraryfunc","description":{"text":"Returns a copy of the model matrix that is at the top of the stack.","note":"Editing the matrix **will not** edit the current view. To do so, you will have to use cam.PushModelMatrix."},"realm":"Client","rets":{"ret":{"text":"The currently active model matrix.","name":"","type":"VMatrix"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetProjectionMatrix","parent":"cam","type":"libraryfunc","description":"Returns a copy of the projection matrix. Also see cam.GetViewMatrix.\n\nWill return Identity matrix in 2D Render context. In this case use cam.Start3D. See Render Hook Order.","added":"2026.06.03","realm":"Client","rets":{"ret":{"text":"The currently active projection matrix.","name":"","type":"VMatrix"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetViewMatrix","parent":"cam","type":"libraryfunc","description":"Returns a copy of the view matrix. Also see cam.GetProjectionMatrix.\n\nWill return Identity matrix in 2D Render context. In this case use cam.Start3D. See Render Hook Order.","added":"2026.06.03","realm":"Client","rets":{"ret":{"text":"The currently active view matrix.","name":"","type":"VMatrix"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"IgnoreZ","parent":"cam","type":"libraryfunc","description":"Tells the renderer to ignore the depth buffer and draw any upcoming operation \"ontop\" of everything that was drawn yet.\n\nThis is identical to calling `render.DepthRange( 0, 0.01 )` for `true` and  `render.DepthRange( 0, 1 )` for `false`. See render.DepthRange.","realm":"Client","args":{"arg":{"text":"Determines whenever to ignore the depth buffer or not.","name":"ignoreZ","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PopModelMatrix","parent":"cam","type":"libraryfunc","description":"Removes the currently active model matrix (pushed previously with cam.PushModelMatrix) from the stack and reinstates the previous one.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PushModelMatrix","parent":"cam","type":"libraryfunc","description":"Pushes the specified matrix onto the render matrix stack. Each pushed matrix must be popped via cam.PopModelMatrix.\n\nWhen used in PANEL:Paint, if you want to rely on the top-left position of the panel, you must use VMatrix:Translate with the (0, 0) position of the panel relative to the screen.\n\nIf trying to use it with with cam.Start3D2D, set `multiply` to `true`, since **cam.Start3D2D** pushes its own model matrix.","realm":"Client","args":{"arg":[{"text":"The matrix to push.","name":"matrix","type":"VMatrix"},{"text":"If set, multiplies given matrix with currently active matrix (cam.GetModelMatrix) before pushing.","name":"multiply","type":"boolean","default":"false"}]}},"example":[{"description":"Simple function to draw rotated and/or scaled text.","code":"local vector_one = Vector( 1, 1, 1 )\nfunction draw.RotatedText( text, font, x, y, color, ang, scale )\n\trender.PushFilterMag( TEXFILTER.ANISOTROPIC )\n\trender.PushFilterMin( TEXFILTER.ANISOTROPIC )\n\n\tlocal m = Matrix()\n\tm:Translate( Vector( x, y, 0 ) )\n\tm:Rotate( Angle( 0, ang, 0 ) )\n\tm:Scale( vector_one * ( scale or 1 ) )\n\n\tsurface.SetFont( font )\n\tlocal w, h = surface.GetTextSize( text )\n\n\tm:Translate( Vector( -w / 2, -h / 2, 0 ) )\n\n\tcam.PushModelMatrix( m, true )\n\t\tdraw.DrawText( text, font, 0, 0, color )\n\tcam.PopModelMatrix()\n\n\trender.PopFilterMag()\n\trender.PopFilterMin()\nend\n\nhook.Add(\"HUDPaint\", \"2d rotation test\", function()\n\tlocal w, h = ScrW(), ScrH()\n\tlocal ang = RealTime() * 50\n\tlocal scale = ( math.sin( ang / 10 ) + 2 ) * 0.5\n\tdraw.RotatedText( \"My fancy Rotating Text\", \"DermaLarge\", w / 2, h / 2, color_white, ang, scale )\nend)","output":{"upload":{"src":"70c/8dc53b786182f21.mp4","size":"411916","name":"hl2_QmJKFXNAVS.mp4"}}},{"description":"Rotating a box while keeping it's matrix positions relative to the panel.","code":"concommand.Add(\"test_matrix\", function()\n\tlocal menu = vgui.Create( \"DFrame\" )\n\tmenu:SetSize( 200, 200 )\n\tmenu:SetTitle(\"Matrix rotation example\")\n\tmenu:SetPos( 200, 200 )\n\n\tlocal panel = menu:Add( \"DPanel\" )\n\tpanel:SetSize( 100, 100 )\n\tpanel:Center()\n\n\tlocal grin = Material(\"icon16/emoticon_evilgrin.png\", \"smooth noclamp\")\n\tlocal angle = 0\n\tfunction panel:Paint(w, h)\n\t\tdraw.RoundedBox( 8, 0, 0, w, h, color_white )\n\n\t\t-- time to draw our matrix\n\t\tlocal m = Matrix()\n\t\t\n\t\t-- to keep the matrix relative to the panel, we get the center of it relative to the screen\n\t\tlocal x, y = self:LocalToScreen( w / 2, h / 2 )\n\t\tlocal center = Vector( x, y, 0 )\n\n\t\tm:Translate( center )\n\t\tm:Rotate( Angle( 0, angle, 0 ) )\n\t\tm:Translate( -center )\n\t\t\n\t\t-- rotate the angle after drawing for next time\n\t\tangle = angle + FrameTime() * 60\n\n\t\t-- push a filter mag to take away the crispiness\n\t\trender.PushFilterMag( TEXFILTER.ANISOTROPIC )\n\t\trender.PushFilterMin( TEXFILTER.ANISOTROPIC )\n\n\t\t\tcam.PushModelMatrix( m )\n\t\t\t\tdraw.RoundedBox( 8, 0, 0, w, h, color_black )\n\t\t\t\tsurface.SetDrawColor( 255, 255, 255, 255 )\n\t\t\t\tsurface.SetMaterial( grin )\n\t\t\t\tsurface.DrawTexturedRect( w/2-16, h/2-16, 32, 32 )\n\t\t\tcam.PopModelMatrix()\n\n\t\trender.PopFilterMag()\n\t\trender.PopFilterMin()\n\tend\n\nend)","output":{"upload":{"src":"50e40/8dcab076b160bde.gif","size":"486812","name":"gmod_UtOWgVrILW.gif"}}},{"description":"Draws a mesh at where the local player is looking at, without regenerating the mesh every frame.","code":"local mat = Material( \"models/shadertest/shader5\" ) -- The material\nlocal mat2 = Material( \"models/wireframe\" ) -- The material (a wireframe)\n\nlocal segCount = 18\nlocal radius = 100\n\n-- Generate the vertices for a circle mesh, using simple trigonometry.\n-- We also calculate UV coordinates for texturing the mesh.\nlocal center = { pos = Vector( 0, 0, 0 ), u = 0.5, v = 0.5 }\nlocal verts = {}\nfor j = 1, segCount do\n\tlocal angle1 = ( ( j - 1 ) / segCount ) * math.pi * -2\n\tlocal angle2 = ( j / segCount ) * math.pi * -2\n\n\tlocal v1 = {\n\t\tpos = Vector( math.cos( angle1 ) * radius, math.sin( angle1 ) * radius, 0 ),\n\t\tu = math.cos( angle1 ) * 0.5 + 0.5, v = math.sin( angle1 ) * 0.5 + 0.5\n\t}\n\tlocal v2 = {\n\t\tpos = Vector( math.cos( angle2 ) * radius, math.sin( angle2 ) * radius, 0 ),\n\t\tu = math.cos( angle2 ) * 0.5 + 0.5, v = math.sin( angle2 ) * 0.5 + 0.5\n\t}\n\tverts[#verts + 1] = center\n\tverts[#verts + 1] = v1\n\tverts[#verts + 1] = v2\nend\n\nlocal obj = Mesh() -- Create the IMesh object\nmesh.Begin( obj, MATERIAL_TRIANGLES, segCount ) -- Begin writing to the static mesh\nfor i = 1, #verts do\n\tmesh.Position( verts[i].pos ) -- Set the position\n\tmesh.TexCoord( 0, verts[i].u, verts[i].v ) -- Set the texture UV coordinates\n\tmesh.AdvanceVertex() -- Write the vertex\nend\nmesh.End() -- Finish writing to the IMesh\n\nhook.Add( \"PostDrawOpaqueRenderables\", \"MeshLibTest\", function()\n\trender.UpdateRefractTexture()\n\trender.SetMaterial( mat )\n\n\tlocal playerTrace = LocalPlayer():GetEyeTrace()\n\n\tlocal m = Matrix()\n\tm:Translate( playerTrace.HitPos + playerTrace.HitNormal * 10 )\n\tm:Rotate( playerTrace.HitNormal:Angle() )\n\tm:Rotate( Angle( 0, -90, -90 ) )\n\n\trender.ResetModelLighting( 1, 1, 1 )\n\tcam.PushModelMatrix( m )\n\tobj:Draw() -- Draw the mesh\n\tcam.PopModelMatrix()\nend )","output":{"upload":{"src":"70c/8de786a81499d8b.png","size":"292259","name":"image.png"}}}],"realms":["Client"],"type":"Function"},
{"function":{"name":"Start","parent":"cam","type":"libraryfunc","description":{"text":"Sets up a new rendering context. This is an extended version of cam.Start3D and cam.Start2D. Must be finished by cam.End3D or cam.End2D.","bug":{"text":"This will not update current view properties for 3D contexts.","issue":"2682"}},"realm":"Client","args":{"arg":{"text":"Render context config. See Structures/RenderCamData.","name":"dataTbl","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Start2D","parent":"cam","type":"libraryfunc","file":{"text":"lua/includes/extensions/client/render.lua","line":"109-L113"},"description":{"text":"Sets up a new 2D rendering context. Must be finished by cam.End2D.\n\nThis is almost always used with a render target from the render. To set its position use render.SetViewPort with a target already stored.","note":"This will put an identity matrix at the top of the model matrix stack. If you are trying to use cam.PushModelMatrix, call it after this function and not before.","rendercontext":{"hook":"true","type":"2D"}},"realm":"Client"},"example":{"description":"Sets the viewport then draws on the view with 2d methods.","code":"local oldW, oldH = ScrW(), ScrH()\nrender.SetViewPort( 0, 100, 50, 50 )\ncam.Start2D()\n\tsurface.SetDrawColor( 255, 255, 255 )\n\tsurface.DrawLine( 10, 10, 100, 100 )\ncam.End2D()\nrender.SetViewPort( 0, 0, oldW, oldH )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Start3D","parent":"cam","type":"libraryfunc","file":{"text":"lua/includes/extensions/client/render.lua","line":"115-L144"},"description":{"text":"Sets up a new 3D rendering context. Must be finished by cam.End3D.\n\nFor more advanced settings such as an orthographic view, use cam.Start instead, which this is an alias of basically.\n\nAll parameters are optional, and fall back parameters that of the \"current\" or \"last\" render operation.","rendercontext":{"hook":"true","type":"3D"},"bug":[{"text":"Negative x/y values won't work.","issue":"1995"},{"text":"This will not update current view properties.","issue":"2682"}]},"realm":"Client","args":{"arg":[{"text":"Render cam position.","name":"pos","type":"Vector","default":"nil"},{"text":"Render cam angles.","name":"angles","type":"Angle","default":"nil"},{"text":"Field of view.","name":"fov","type":"number","default":"nil"},{"text":"X coordinate of where to start the new view port.","name":"x","type":"number","default":"nil"},{"text":"Y coordinate of where to start the new view port.","name":"y","type":"number","default":"nil"},{"text":"Width of the new viewport.","name":"w","type":"number","default":"nil"},{"text":"Height of the new viewport.","name":"h","type":"number","default":"nil"},{"text":"Distance to near clipping plane.","name":"zNear","type":"number","default":"nil","note":"Both `zNear` and `zFar` need a value before any of them work.\n\nzNear also requires a value higher than 0."},{"text":"Distance to far clipping plane.","name":"zFar","type":"number","default":"nil"}]}},"example":{"description":"Set up a 3D rendering environment in a 2D rendering hook to render models on HUD.","code":"hook.Add( \"HUDPaint\", \"3d_camera_example\", function()\n\tcam.Start3D()\n\t\tfor id, ply in ipairs( player.GetAll() ) do\n\t\t\tply:DrawModel()\n\t\tend\n\tcam.End3D()\nend )","output":"All players can be seen through walls."},"realms":["Client"],"type":"Function"},
{"function":{"name":"Start3D2D","parent":"cam","type":"libraryfunc","description":{"text":"Sets up the model transformation matrix to draw 2D content in 3D space and pushes it into the stack (cam.PushModelMatrix).\n\nMatrix formula:\n```\nlocal m = Matrix()\nm:SetAngles( angles )\nm:SetTranslation( pos )\nm:SetScale( Vector( scale, -scale, 1 ) )\n```\n\n\nrender.SetToneMappingScaleLinear may of use when dealing with bloom.","warning":"This must be closed by cam.End3D2D. If not done so, unexpected issues might arise."},"realm":"Client","args":{"arg":[{"text":"Origin of the 3D2D context, ie. the top left corner, (0, 0).","name":"pos","type":"Vector"},{"text":"Angles of the 3D2D context.\n+x in the 2d context corresponds to +x of the angle (its forward direction).\n+y in the 2d context corresponds to -y of the angle (its right direction).\n\nIf (dx, dy) are your desired (+x, +y) unit vectors, the angle you want is dx:AngleEx(dx:Cross(-dy)).","name":"angles","type":"Angle"},{"text":"The scale of the render context.\nIf scale is 1 then 1 pixel in 2D context will equal to 1 unit in 3D context.","name":"scale","type":"number"}]}},"example":[{"description":"Makes a floating rectangle with text above each player, pointing at the local player.","code":"surface.CreateFont( \"PlayerTagFont\", {\n\tfont = \"Arial\",\n\tsize = 72,\n} )\n\nhook.Add( \"PostPlayerDraw\", \"player_name_tags\", function(ply)\n\t-- Player too far, don't bother\n\tif ( ply:GetPos():Distance( EyePos() ) > 512 ) then return end\n\n\t-- Player is the local player in the first person, don't bother\n\tif ( ply == LocalPlayer() ) then return end\n\n\t-- Get the player position, and move it above their head.\n\tlocal pos = ply:GetPos() + ply:GetUp() * ( ply:OBBMaxs().z + 5 )\n\n\t-- Apply some neat bobbing animation\n\tpos = pos + Vector( 0, 0, math.cos( CurTime() / 2 ) )\n\n\t-- Get the angle between the local player and the target player\n\tlocal angle = ( pos - EyePos() ):GetNormalized():Angle()\n\n\t-- Only use the Yaw component of the angle\n\tangle = Angle( 0, angle.y, 0 )\n\n\t-- Apply some animation to the angle\n\tangle.y = angle.y + math.sin( CurTime() ) * 10\n\n\t-- Correct the angle so it points at the camera\n\t-- This is usually done by trial and error using Up(), Right() and Forward() axes\n\tangle:RotateAroundAxis( angle:Up(), -90 )\n\tangle:RotateAroundAxis( angle:Forward(), 90 )\n\n\t-- Notice the scale is small, so text looks crispier\n\tcam.Start3D2D( pos, angle, 0.05 )\n\t\t-- Get the size of the text we are about to draw\n\n\t\tsurface.SetFont( \"PlayerTagFont\" )\n\t\tlocal tW, tH = surface.GetTextSize( ply:Nick() )\n\n\t\t-- This defines amount of padding for the box around the text\n\t\tlocal padX = 20\n\t\tlocal padY = 5\n\n\t\t-- Draw a rectable. This has to be done before drawing the text, to prevent overlapping\n\t\t-- Notice how we start drawing in negative coordinates\n\t\t-- This is to make sure the 3d2d display rotates around our position by its center, not left corner\n\t\tsurface.SetDrawColor( 0, 0, 0, 100 )\n\t\tsurface.DrawRect( -tW / 2 - padX, -padY, tW + padX * 2, tH + padY * 2 )\n\n\t\t-- Draw some text\n\t\tdraw.SimpleText( ply:Nick(), \"PlayerTagFont\", -tW / 2, 0, color_white )\n\tcam.End3D2D()\nend )","output":{"image":{"src":"70c/8dc53c0087ef97a.png","size":"928654","name":"image.png"}}},{"description":"An example on how to correctly rotate and position 3D2D \"screen\" attached to a prop.","code":"function ENT:Draw( flags )\n\tself:DrawModel( flags )\n\n\tlocal ang = self:GetAngles()\n\t-- Change these numbers to rotate the screen correctly for your model\n\tang:RotateAroundAxis( self:GetUp(), 90 )\n\tang:RotateAroundAxis( self:GetRight(), -90 + 4.5 )\n\tang:RotateAroundAxis( self:GetForward(), 0 )\n\n\tlocal pos = self:GetPos()\n\t-- Change these numbers to position the screen on your model\n\tpos = pos + self:GetForward() * 11.7\n\tpos = pos + self:GetRight() * 9.69\n\tpos = pos + self:GetUp() * 11.8\n\n\t-- Higher the value, the better the resolution\n\tlocal resolution = 1.1\n\n\tcam.Start3D2D( pos, ang, 0.05 / resolution )\n\t\t-- Paint the background. Effectively a 388x320 pixel screen\n\t\tsurface.SetDrawColor( 0, 0, 0, 255 )\n\t\tsurface.DrawRect( 0, 0, 388 * resolution, 320 * resolution )\n\n\t\t-- Paint the content\n\t\tdraw.SimpleText( \"Loading GMod BIOS v0.9.....\", \"Default\", 5, 5, color_white )\n\t\tdraw.SimpleText( \"Fancy text..\", \"Default\", 5, 16, color_white )\n\tcam.End3D2D()\nend","output":{"image":{"src":"70c/8dc53be7f864914.png","size":"608035","name":"image.png"}}}],"realms":["Client"],"type":"Function"},
{"function":{"name":"StartOrthoView","parent":"cam","type":"libraryfunc","description":"Sets up a new 3d context using orthographic projection.","realm":"Client","args":{"arg":[{"text":"The left plane offset.","name":"leftOffset","type":"number"},{"text":"The top plane offset.","name":"topOffset","type":"number"},{"text":"The right plane offset.","name":"rightOffset","type":"number"},{"text":"The bottom plane offset.","name":"bottomOffset","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddText","parent":"chat","type":"libraryfunc","description":"Adds text to the local player's chat box (which only they can read).","realm":"Client","args":{"arg":{"text":"The message to be added to the chat box.  \n\nArguments can be:\n* Color - Will set the color for all following strings until the next Color argument.\n* string - Text to be added to the chat box.\n* Player - Adds the name of the player in the player's team color to the chat box.\n* any - Any other type, such as Entity will be converted to string and added as text.\n\nThese argument types can be combined to create formatted messages.","name":"arguments","type":"vararg"}}},"example":{"description":"Prints the player's name and current weapon to their chat area.","code":"local ply = LocalPlayer()\nchat.AddText(\n\t-- Sets the text color of upcoming strings to blue\n\tColor( 100, 100, 255 ),\n\t-- A Player whose name will be automatically colored according to their team color\n\t-- Note: this will ignore the string color set on the line above\n\tply,\n\t-- A string which will be colored blue because of the text color set above\n\t\", you are holding \",\n\t-- Sets the text color to green\n\tColor( 100, 255, 100 ),\n\t-- A string which will be colored green\n\tply:GetActiveWeapon():GetClass()\n)","output":{"image":{"src":"chat_AddText.png","alt":"center"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Close","parent":"chat","type":"libraryfunc","description":"Closes the chat window.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetChatBoxPos","parent":"chat","type":"libraryfunc","description":"Returns the chatbox position.","realm":"Client","rets":{"ret":[{"text":"The X coordinate of the chatbox's position.","name":"","type":"number"},{"text":"The Y coordinate of the chatbox's position.","name":"","type":"number"}]}},"example":{"description":"Prints the x and y coordinates of the chatbox.","code":"print( chat.GetChatBoxPos() )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetChatBoxSize","parent":"chat","type":"libraryfunc","description":"Returns the chatbox size.","realm":"Client","rets":{"ret":[{"text":"The width of the chatbox.","name":"","type":"number"},{"text":"The height of the chatbox.","name":"","type":"number"}]}},"example":{"description":"Prints the width and the height of the chatbox.","code":"print( chat.GetChatBoxSize() )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Open","parent":"chat","type":"libraryfunc","description":"Opens the chat window.","realm":"Client","args":{"arg":{"text":"If equals 1, opens public chat, otherwise opens team chat.","name":"mode","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PlaySound","parent":"chat","type":"libraryfunc","description":"Plays the chat \"tick\" sound.","realm":"Client"},"example":{"description":"Plays an obnoxious tick sound.","code":"chat.PlaySound()"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Add","parent":"cleanup","type":"libraryfunc","description":"Adds an entity to a player's cleanup list.","realm":"Server","file":{"text":"lua/includes/modules/cleanup.lua","line":"59-L74"},"args":{"arg":[{"text":"Who's cleanup list to add the entity to.","name":"pl","type":"Player"},{"text":"The type of cleanup.","name":"type","type":"string"},{"text":"The entity to add to the player's cleanup list.","name":"ent","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"CC_AdminCleanup","parent":"cleanup","type":"libraryfunc","description":{"text":"Called by the `gmod_admin_cleanup` console command. Allows admins to clean up the server.","internal":""},"realm":"Server","file":{"text":"lua/includes/modules/cleanup.lua","line":"148-L200"},"args":{"arg":[{"text":"The player that called the console command.","name":"pl","type":"Player"},{"text":"The console command that called this function.","name":"command","type":"string"},{"text":"First and only arg is the cleanup type.","name":"args","type":"table"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"CC_Cleanup","parent":"cleanup","type":"libraryfunc","description":{"text":"Called by the `gmod_cleanup` console command. Allows players to cleanup their own props.","internal":""},"realm":"Server","file":{"text":"lua/includes/modules/cleanup.lua","line":"98-L146"},"args":{"arg":[{"text":"The player that called the console command.","name":"pl","type":"Player"},{"text":"The console command that called this function.","name":"command","type":"string"},{"text":"First and only argument is the cleanup type.","name":"args","type":"table"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetList","parent":"cleanup","type":"libraryfunc","description":"Gets the cleanup list.","realm":"Server","file":{"text":"lua/includes/modules/cleanup.lua","line":"40-L42"}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetTable","parent":"cleanup","type":"libraryfunc","description":"Gets the table of cleanup types.","realm":"Shared","file":{"text":"lua/includes/modules/cleanup.lua","line":"31-L33"},"rets":{"ret":{"text":"A list of cleanup types.","name":"","type":"table"}}},"example":{"description":"Example of output table structure.","code":"PrintTable( cleanup.GetTable() )","output":"```\n1\t=\tprops\n2\t=\tragdolls\n3\t=\teffects\n4\t=\tnpcs\n5\t=\tconstraints\n6\t=\tropeconstraints\n7\t=\tsents\n8\t=\tvehicles\n9\t=\tballoons\n10\t=\tbuttons\n11\t=\tcameras\n12\t=\tduplicates\n13\t=\tdynamite\n14\t=\temitters\n15\t=\thoverballs\n16\t=\tlamps\n17\t=\tlights\n18\t=\tnocollide\n19\t=\tthrusters\n20\t=\ttrails\n21\t=\twheels\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Register","parent":"cleanup","type":"libraryfunc","description":"Registers a new cleanup type.","realm":"Shared","file":{"text":"lua/includes/modules/cleanup.lua","line":"17-L29"},"args":{"arg":{"text":"Name of type.","name":"type","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReplaceEntity","parent":"cleanup","type":"libraryfunc","description":"Replaces one entity in the cleanup module with another.\n\nYou very likely want to call undo.ReplaceEntity with the same entities as well.","realm":"Server","file":{"text":"lua/includes/modules/cleanup.lua","line":"76-L95"},"args":{"arg":[{"text":"The old entity.","name":"from","type":"Entity"},{"text":"The new entity. Can be a `NULL` entity to remove the old entity from the cleanup system.","name":"to","type":"Entity|nil"}]},"rets":{"ret":{"text":"Whether any action was taken.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"UpdateUI","parent":"cleanup","type":"libraryfunc","description":{"text":"Repopulates the clients cleanup menu.","internal":""},"realm":"Client","file":{"text":"lua/includes/modules/cleanup.lua","line":"207-L238"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Add","parent":"concommand","type":"libraryfunc","description":{"text":"Creates a console command that runs a function in lua with optional autocompletion function and help text.","warning":"Clients can still run commands created only on the server. Always check permissions in the callback.","bug":{"text":"This will fail if the concommand was previously removed with concommand.Remove in a different realm (creating a command on the client that was removed from the server and vice-versa).","issue":"1183"}},"realm":"Shared and Menu","file":{"text":"lua/includes/modules/concommand.lua","line":"24-L33"},"args":{"arg":[{"text":"The command name to be used in console.\n\nThis cannot be a name of existing console command or console variable. It will silently fail if it is.","name":"name","type":"string"},{"text":"The function to run when the concommand is executed.","name":"callback","type":"function","callback":{"arg":[{"text":"The player that ran the concommand. NULL entity if command was entered with the dedicated server console.","name":"ply","type":"Player"},{"text":"The concommand string (if one callback is used for several concommands).","name":"cmd","type":"string"},{"text":"A table of all string arguments.","name":"args","type":"table"},{"text":"The arguments as a string (including double quotes if there were any).","name":"argStr","type":"string"}]}},{"text":"The function to call which should return a table of options for autocompletion. (Autocompletion Tutorial)\n\nThis only properly works on the client since it is **not** networked.","name":"autoComplete","type":"function","default":"nil","callback":{"arg":[{"text":"The concommand this autocompletion is for.","name":"cmd","type":"string"},{"text":"The arguments typed so far.","name":"argStr","type":"string"},{"text":"A table of all string arguments.","name":"args","type":"table"}],"ret":{"text":"A table containing the autocomplete options to display.","name":"tbl","type":"table"}}},{"text":"The text to display should a user run 'help cmdName'.","name":"helpText","type":"string","default":"nil"},{"text":"Console command modifier flags. Either a bitflag, or a table of enums. See Enums/FCVAR.","name":"flags","type":"number{FCVAR}|table<number>","default":"0"}]}},"example":[{"description":"Adds a concommand `killyourself` which will kill the user.","code":"concommand.Add( \"killyourself\", function( ply, cmd, args )\n    ply:Kill()\n    print( \"You killed yourself!\" )\nend )"},{"description":"A concommand that prints the SteamID and nickname of every player on the server.","code":"concommand.Add( \"retrieveplayers\", function()  \n\tfor _, ply in ipairs( player.GetAll() ) do\n\t\tprint( ply:Nick() .. \", \" .. ply:SteamID() .. \"\\n\" )\n\tend\nend )"},{"description":"A simple autocomplete example.","code":"local function SimpleAutoComplete( cmd, args, ... )\n\tlocal possibleArgs = { ... }\n\tlocal autoCompletes = {}\n\n\t--TODO: Handle \"test test\" \"test test\" type arguments\n\tlocal arg = string.Split( args:TrimLeft(), \" \" )\n\n\tlocal lastItem = nil\n\tfor i, str in pairs( arg ) do\n\t\tif ( str == \"\" && ( lastItem && lastItem == \"\" ) ) then table.remove( arg, i ) end\n\t\tlastItem = str\n\tend -- Remove empty entries. Can this be done better?\n\n\tlocal numArgs = #arg\n\tlocal lastArg = table.remove( arg, numArgs )\n\tlocal prevArgs = table.concat( arg, \" \" )\n\tif ( #prevArgs > 0 ) then prevArgs = \" \" .. prevArgs end\n\n\tlocal possibilities = possibleArgs[ numArgs ] or { lastArg }\n\tfor _, acStr in pairs( possibilities ) do\n\t\tif ( !acStr:StartsWith( lastArg ) ) then continue end\n\t\ttable.insert( autoCompletes, cmd .. prevArgs .. \" \" .. acStr )\n\tend\n\t\t\n\treturn autoCompletes\nend\n\nconcommand.Add( \"cmd_with_autocomplete\", function( ply, cmd, args )\n\tprint( \"my concommand got these args:\", unpack( args ) )\nend, function( cmd, args )\n\treturn SimpleAutoComplete( cmd, args, { \"test1\", \"test2\", \"hell\", \"yeah\" }, { \"batman\", \"ironman\", \"antman\", \"superman\", \"superiorman\" }  )\nend )","output":{"upload":{"src":"70c/8dc70edf195ee53.mp4","size":"136796","name":"May10-88-hl2.mp4"}}}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"AutoComplete","parent":"concommand","type":"libraryfunc","description":{"text":"Used by the engine to call the autocomplete function for a console command, and retrieve returned options.","internal":""},"realm":"Shared and Menu","file":{"text":"lua/includes/modules/concommand.lua","line":"63-L75"},"args":{"arg":[{"text":"Name of command.","name":"command","type":"string"},{"text":"Arguments given to the command.","name":"arguments","type":"string"}]},"rets":{"ret":{"text":"Possibilities for auto-completion. This is the return value of the auto-complete callback.","name":"","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetTable","parent":"concommand","type":"libraryfunc","description":"Returns the tables of all console command callbacks, and autocomplete functions, that were added to the game with concommand.Add.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/concommand.lua","line":"16-L22"},"rets":{"ret":[{"text":"Table of command callback functions.","name":"","type":"table<string,function>"},{"text":"Table of command autocomplete functions.","name":"","type":"table<string,function>"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Remove","parent":"concommand","type":"libraryfunc","description":{"text":"Removes a console command.","bug":{"text":"concommand.Add will fail if the concommand was previously removed with this function in a different realm (creating a command on the client that was removed from the server and vice-versa).","issue":"1183"}},"realm":"Shared and Menu","file":{"text":"lua/includes/modules/concommand.lua","line":"35-L43"},"args":{"arg":{"text":"The name of the command to be removed.","name":"name","type":"string"}}},"example":{"description":"Removes the built-in concommand `gmod_camera` which would normally quickly select the camera swep.","code":"concommand.Remove(\"gmod_camera\")"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Run","parent":"concommand","type":"libraryfunc","description":{"text":"Used by the engine to run a console command's callback function. This will only be called for commands that were added with Global.AddConsoleCommand, which concommand.Add calls internally. An error is sent to the player's console if no callback is found.\n\nThis will still be called for concommands removed with concommand.Remove but will return false. This will not be called for concommands added by the engine, only those made from Lua.","internal":"You might be looking for Global.RunConsoleCommand or Player:ConCommand."},"realm":"Shared and Menu","file":{"text":"lua/includes/modules/concommand.lua","line":"45-L61"},"args":{"arg":[{"text":"Player to run concommand on.","name":"ply","type":"Player"},{"text":"Command name.","name":"cmd","type":"string"},{"text":"Command arguments.\nCan be table or string.","name":"args","type":"any"},{"text":"string of all arguments sent to the command.","name":"argumentString","type":"string"}]},"rets":{"ret":{"text":"`true` if the console command with the given name exists, and `false` if it doesn't.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"AddConstraintTable","parent":"constraint","type":"libraryfunc","description":{"text":"Stores the constraint entity in the constrained entity's `Constraints` table.\n\nThis will make the `constrt` entity be removed if any of the other entities `ent1`, `ent2`, `ent3` or `ent4` are removed by any means.  \nTo prevent this, constraint.AddConstraintTableNoDelete can be used instead.","internal":""},"realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"352-L368"},"args":{"arg":[{"text":"The entity to store the information on.","name":"ent1","type":"Entity"},{"text":"The constraint to store in the entity's table.","name":"constrt","type":"Entity"},{"text":"Optional. If different from `ent1`, the info will also be stored in the table for this entity.","name":"ent2","type":"Entity","default":"nil"},{"text":"Optional. Same as `ent2`.","name":"ent3","type":"Entity","default":"nil"},{"text":"Optional. Same as `ent2`.","name":"ent4","type":"Entity","default":"nil"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddConstraintTableNoDelete","parent":"constraint","type":"libraryfunc","description":{"text":"Stores info about the constraints on the entity's table.\n\nThe only difference between this and constraint.AddConstraintTable is that the constraint does not get deleted when any of the constrained entities are removed.","internal":""},"realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"374-L389"},"args":{"arg":[{"text":"The entity to store the information on.","name":"ent1","type":"Entity"},{"text":"The constraint to store in the entity's table.","name":"constrt","type":"Entity"},{"text":"Optional. If different from `ent1`, the info will also be stored in the table for this entity.","name":"ent2","type":"Entity","default":"nil"},{"text":"Optional. Same as `ent2`.","name":"ent3","type":"Entity","default":"nil"},{"text":"Optional. Same as `ent2`.","name":"ent4","type":"Entity","default":"nil"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AdvBallsocket","parent":"constraint","type":"libraryfunc","description":"Creates an advanced ballsocket (ragdoll) constraint. See constraint.Ballsocket for the simpler version.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"856-L925"},"args":{"arg":[{"text":"First entity.","name":"ent1","type":"Entity"},{"text":"Second entity.","name":"ent2","type":"Entity"},{"text":"PhysObj number of first entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone1","type":"number"},{"text":"PhysObj number of second entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone2","type":"number"},{"text":"Position relative to the the first physics object to constrain to.","name":"localPos1","type":"Vector"},{"text":"Position relative to the the second physics object to constrain to.","name":"localPos2","type":"Vector","default":"nil","warning":"Does nothing!"},{"text":"Amount of force until it breaks (0 = unbreakable).","name":"forceLimit","type":"number","default":"0"},{"text":"Amount of torque (rotation speed) until it breaks (0 = unbreakable).","name":"torqueLimit","type":"number","default":"0"},{"text":"Minimum angle in rotations around the X axis local to the constraint.","name":"xMin","type":"number"},{"text":"Minimum angle in rotations around the Y axis local to the constraint.","name":"yMin","type":"number"},{"text":"Minimum angle in rotations around the Z axis local to the constraint.","name":"zMin","type":"number"},{"text":"Maximum angle in rotations around the X axis local to the constraint.","name":"xMax","type":"number"},{"text":"Maximum angle in rotations around the Y axis local to the constraint.","name":"yMax","type":"number"},{"text":"Maximum angle in rotations around the Z axis local to the constraint.","name":"zMax","type":"number"},{"text":"Rotational friction in the X axis local to the constraint.","name":"xFric","type":"number","default":"0"},{"text":"Rotational friction in the Y axis local to the constraint.","name":"yFric","type":"number","default":"0"},{"text":"Rotational friction in the Z axis local to the constraint.","name":"zFric","type":"number","default":"0"},{"text":"Only limit rotation, free movement.","name":"onlyRotation","type":"number","default":"0"},{"text":"Whether the entities should be no-collided.","name":"noCollide","type":"number","default":"0"}]},"rets":{"ret":{"text":"A [phys_ragdollconstraint](https://developer.valvesoftware.com/wiki/Phys_ragdollconstraint) entity. Will return `false` if the constraint could not be created.","name":"","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Axis","parent":"constraint","type":"libraryfunc","description":"Creates an axis constraint.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"793-L849"},"args":{"arg":[{"text":"First entity.","name":"ent1","type":"Entity"},{"text":"Second entity.","name":"ent2","type":"Entity"},{"text":"PhysObj number of first entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone1","type":"number"},{"text":"PhysObj number of second entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone2","type":"number"},{"text":"Position relative to the the first physics object to constrain to.","name":"localPos1","type":"Vector"},{"text":"Position relative to the the second physics object to constrain to.","name":"localPos2","type":"Vector"},{"text":"Amount of force until it breaks (0 = unbreakable).","name":"forceLimit","type":"number","default":"0"},{"text":"Amount of torque (rotational force) until it breaks (0 = unbreakable).","name":"torqueLimit","type":"number","default":"0"},{"text":"Constraint friction.","name":"friction","type":"number","default":"0"},{"text":"Whether the entities should be no-collided.","name":"noCollide","type":"number","default":"0"},{"text":"If you include the LocalAxis then LPos2 will not be used in the final constraint. However, LPos2 is still a required argument.","name":"localAxis","type":"Vector","default":"nil"},{"text":"Whether or not to add the constraint info on the entity table. See constraint.AddConstraintTable.","name":"dontAddTable","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"The created constraint. ([phys_hinge](https://developer.valvesoftware.com/wiki/Phys_hinge)) Will return `false` if the constraint could not be created.","name":"","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Ballsocket","parent":"constraint","type":"libraryfunc","description":"Creates a ballsocket joint. See See constraint.AdvBallsocket if you also wish to limit rotation angles in some way.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"1232-L1276"},"args":{"arg":[{"text":"First entity.","name":"ent1","type":"Entity"},{"text":"Second entity.","name":"ent2","type":"Entity"},{"text":"PhysObj number of first entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone1","type":"number"},{"text":"PhysObj number of second entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone2","type":"number"},{"text":"Center position of the joint, relative to the **second** entity's physics object.","name":"localPos","type":"Vector"},{"text":"Amount of force until it breaks (0 = unbreakable).","name":"forceLimit","type":"number","default":"0"},{"text":"Amount of torque (rotational force) until it breaks (0 = unbreakable).","name":"torqueLimit","type":"number","default":"0"},{"text":"Whether the constrained entities should collided with each other or not.","name":"nocollide","type":"number","default":"0"}]},"rets":{"ret":{"text":"The created constraint. ([phys_ballsocket](https://developer.valvesoftware.com/wiki/Phys_ballsocket)) Will return `false` if the constraint could not be created.","name":"","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"CanConstrain","parent":"constraint","type":"libraryfunc","description":"Basic checks to make sure that the specified entity and bone are valid. Returns false if we should not be constraining the entity.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"269-L278"},"args":{"arg":[{"text":"The entity to check.","name":"ent","type":"Entity"},{"text":"The bone of the entity to check (use 0 for mono boned ents).","name":"bone","type":"number"}]},"rets":{"ret":{"text":"Whether a constraint can or should be created.","name":"","type":"boolean"}}},"example":{"description":"From modules/constraint.lua","code":"function Weld( Ent1, Ent2, Bone1, Bone2, forcelimit, nocollide, deleteonbreak )\n if ( !CanConstrain( Ent1, Bone1 ) ) then return false end\n if ( !CanConstrain( Ent2, Bone2 ) ) then return false end"},"realms":["Server"],"type":"Function"},
{"function":{"name":"CreateKeyframeRope","parent":"constraint","type":"libraryfunc","description":"Creates a rope without any constraint.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"296-L346"},"args":{"arg":[{"text":"Position for the rope entity. Unknown effect, probably none.","name":"pos","type":"Vector"},{"text":"Width of the rope.","name":"width","type":"number"},{"text":"Material of the rope. If unset, will be solid black.","name":"material","type":"string","default":"nil"},{"text":"Constraint for the rope. If set, the rope will be deleted when the constraint entity is.","name":"constraint","type":"Entity","default":"nil"},{"text":"First entity.","name":"ent1","type":"Entity"},{"text":"Position relative to the the first physics object to constrain to.","name":"localPos1","type":"Vector"},{"text":"PhysObj number of first entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone1","type":"number"},{"text":"Second entity.","name":"ent2","type":"Entity"},{"text":"Position relative to the the second physics object to constrain to.","name":"localPos2","type":"Vector"},{"text":"PhysObj number of second entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone2","type":"number"},{"text":"Any additional key/values to be set on the rope.","name":"keyValues","type":"table","default":"nil"}]},"rets":{"ret":{"text":"The created rope ([keyframe_rope](https://developer.valvesoftware.com/wiki/Keyframe_rope)), or `nil` or failure.","name":"","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"CreateStaticAnchorPoint","parent":"constraint","type":"libraryfunc","description":{"text":"Creates an invisible, non-moveable anchor point in the world to which things can be attached.","note":"The entity used internally by this function (`gmod_anchor`) only exists in Sandbox derived gamemodes, meaning this function will only work in these gamemodes.  \n\n\t\tTo use this in other gamemodes, you may need to create your own [gmod_anchor](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/gamemodes/sandbox/entities/entities/gmod_anchor.lua) entity."},"realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"665-L677"},"args":{"arg":{"text":"The position to spawn the anchor at","name":"pos","type":"Vector"}},"rets":{"ret":[{"text":"The anchor entity. (`gmod_anchor`)","name":"","type":"Entity"},{"text":"The achor entity's physics object. (Entity:GetPhysicsObject)","name":"","type":"PhysObj"},{"text":"Always `0`.","name":"","type":"number"},{"text":"Always `vector_zero`.","name":"","type":"Vector"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Elastic","parent":"constraint","type":"libraryfunc","description":"Creates an elastic rope constraint.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"546-L614"},"args":{"arg":[{"text":"First entity.","name":"ent1","type":"Entity"},{"text":"Second entity.","name":"ent2","type":"Entity"},{"text":"PhysObj number of first entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone1","type":"number"},{"text":"PhysObj number of second entity to constrain to. (0 for non-ragdolls). Must be different from `bone1`.\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone2","type":"number"},{"text":"Position relative to the the first physics object to constrain to.","name":"localPos1","type":"Vector"},{"text":"Position relative to the the second physics object to constrain to.","name":"localPos2","type":"Vector"},{"text":"Stiffness of the elastic. The larger the number the less the elastic will stretch.","name":"constant","type":"number"},{"text":"How much energy the elastic loses. The larger the number, the less bouncy the elastic.","name":"damping","type":"number"},{"text":"The amount of energy the elastic loses proportional to the relative velocity of the two objects the elastic is attached to.","name":"relDamping","type":"number"},{"text":"The material of the rope. If unset, will be solid black.","name":"material","type":"string","default":""},{"text":"Width of rope.","name":"width","type":"number"},{"text":"Apply physics forces only on stretch.","name":"stretchOnly","type":"boolean","default":"false"},{"text":"The color of the rope. See Color.","name":"color","type":"Color","default":"color_white"}]},"rets":{"ret":[{"text":"The created constraint. ([phys_spring](https://developer.valvesoftware.com/wiki/Phys_spring)) Will return `false` if the constraint could not be created.","name":"","type":"Entity"},{"text":"The created rope. ([keyframe_rope](https://developer.valvesoftware.com/wiki/Keyframe_rope)) Will return `nil` if the constraint could not be created.","name":"","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Find","parent":"constraint","type":"libraryfunc","description":"Returns the constraint of a specified type between two entities, if it exists","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"222-L244"},"args":{"arg":[{"text":"The first entity to check.","name":"ent1","type":"Entity"},{"text":"The second entity to check.","name":"ent2","type":"Entity"},{"text":"The type of constraint, case sensitive. List of default constrains is as follows:\n* `Weld`\n* `Axis`\n* `AdvBallsocket`\n* `Rope`\n* `Elastic`\n* `NoCollide`\n* `Motor`\n* `Pulley`\n* `Ballsocket`\n* `Winch`\n* `Hydraulic`\n* `Muscle`\n* `Keepupright`\n* `Slider`","name":"type","type":"string"},{"text":"The bone number for the first entity (0 for monoboned entities).","name":"bone1","type":"number"},{"text":"The bone number for the second entity.","name":"bone2","type":"number"}]},"rets":{"ret":{"text":"The constraint found.","name":"","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"FindConstraint","parent":"constraint","type":"libraryfunc","description":"Returns the first constraint of a specific type directly connected to the entity found.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"1605-L1619"},"args":{"arg":[{"text":"The entity to check.","name":"ent","type":"Entity"},{"text":"The type of constraint, case sensitive. List of default constrains is as follows:\n* `Weld`\n* `Axis`\n* `AdvBallsocket`\n* `Rope`\n* `Elastic`\n* `NoCollide`\n* `Motor`\n* `Pulley`\n* `Ballsocket`\n* `Winch`\n* `Hydraulic`\n* `Muscle`\n* `Keepupright`\n* `Slider`","name":"type","type":"string"}]},"rets":{"ret":{"text":"The constraint table, set with constraint.AddConstraintTable","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"FindConstraintEntity","parent":"constraint","type":"libraryfunc","description":"Returns the other entity involved in the first constraint of a specific type directly connected to the entity.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"1624-L1638"},"args":{"arg":[{"text":"The entity to check.","name":"ent","type":"Entity"},{"text":"The type of constraint, case sensitive. List of default constrains is as follows:\n* `Weld`\n* `Axis`\n* `AdvBallsocket`\n* `Rope`\n* `Elastic`\n* `NoCollide`\n* `Motor`\n* `Pulley`\n* `Ballsocket`\n* `Winch`\n* `Hydraulic`\n* `Muscle`\n* `Keepupright`\n* `Slider`","name":"type","type":"string"}]},"rets":{"ret":{"text":"The other entity.","name":"","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"FindConstraints","parent":"constraint","type":"libraryfunc","description":"Returns a table of all constraints of a specific type directly connected to the entity.\n\nIf you are looking for a list of all constraints, use constraint.GetTable.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"1584-L1600"},"args":{"arg":[{"text":"The entity to check.","name":"ent","type":"Entity"},{"text":"The type of constraint, case sensitive. List of default constrains is as follows:\n* `Weld`\n* `Axis`\n* `AdvBallsocket`\n* `Rope`\n* `Elastic`\n* `NoCollide`\n* `Motor`\n* `Pulley`\n* `Ballsocket`\n* `Winch`\n* `Hydraulic`\n* `Muscle`\n* `Keepupright`\n* `Slider`","name":"type","type":"string"}]},"rets":{"ret":{"text":"All the constraints of this entity.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ForgetConstraints","parent":"constraint","type":"libraryfunc","description":"Make this entity forget any constraints it knows about. Note that this will not actually remove the constraints.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"1574-L1578"},"args":{"arg":{"text":"The entity that will forget its constraints.","name":"ent","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetAllConstrainedEntities","parent":"constraint","type":"libraryfunc","description":"Returns a table of all entities recursively constrained to an entity.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"1643-L1666"},"args":{"arg":[{"text":"The entity to check.","name":"ent","type":"Entity"},{"text":"Table used to return result. Optional.","name":"resultTable","type":"table","default":"nil"}]},"rets":{"ret":{"text":"A table containing all of the constrained entities. This includes all entities constrained to entities constrained to the supplied entity, etc.","name":"","type":"table"}}},"example":{"description":"Adapted from stools/remover.lua","code":"-- Remove this entity and everything constrained\nfunction TOOL:RightClick( trace )\n\tif ( !IsValid( trace.Entity ) or trace.Entity:IsPlayer() ) then return false end\n\t-- Loop through all the entities in the system\n\tfor _, Entity in pairs( constraint.GetAllConstrainedEntities( trace.Entity ) ) do\n\t\tDoRemoveEntity( Entity )\n\tend\n\treturn true\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetTable","parent":"constraint","type":"libraryfunc","description":"Returns a table of all constraints directly connected to the entity.\n\nIf you are looking for a list of specific constraint(s), use constraint.FindConstraints.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"1531-L1569"},"args":{"arg":{"text":"The entity to check.","name":"ent","type":"Entity"}},"rets":{"ret":{"text":"A list of all constraints connected to the entity.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"HasConstraints","parent":"constraint","type":"libraryfunc","description":"Returns true if the entity has constraints attached to it","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"1502-L1524"},"args":{"arg":{"text":"The entity to check.","name":"ent","type":"Entity"}},"rets":{"ret":{"text":"Whether the entity has any constraints or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Hydraulic","parent":"constraint","type":"libraryfunc","description":"Creates a controllable constraint.Elastic, aka a Hydraulic constraint.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"1337-L1415"},"args":{"arg":[{"text":"The player that will be able to control the constraint. Used to call numpad.OnDown.","name":"player","type":"Player"},{"text":"First entity.","name":"ent1","type":"Entity"},{"text":"Second entity.","name":"ent2","type":"Entity"},{"text":"PhysObj number of first entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone1","type":"number"},{"text":"PhysObj number of second entity to constrain to. (0 for non-ragdolls). Must be different from `bone1`.\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone2","type":"number"},{"text":"Position relative to the the first physics object to constrain to.","name":"localPos1","type":"Vector"},{"text":"Position relative to the the second physics object to constrain to.","name":"localPos2","type":"Vector"},{"text":"Minimum length of the constraint.","name":"length1","type":"number"},{"text":"Maximum length of the constraint.","name":"length2","type":"number"},{"text":"The width of the rope.","name":"width","type":"number"},{"text":"The key binding, corresponding to an Enums/KEY.","name":"key","type":"number"},{"text":"Whether the hydraulic is fixed, i.e. cannot bend. Must be `1` to act as `true`.","name":"slider","type":"number"},{"text":"How fast it changes the length from `length1` to `length2` and backwards.","name":"speed","type":"number"},{"text":"The material of the rope. If unset, will be solid black.","name":"material","type":"string","default":""},{"text":"Whether the hydraulic should be a toggle, not a \"hold key to extend\" action.","name":"toggle","type":"boolean","default":"true"},{"text":"The color of the rope.","name":"color","type":"Color","default":"color_white"}]},"rets":{"ret":[{"text":"The created constraint. ([phys_spring](https://developer.valvesoftware.com/wiki/Phys_spring)) Will return `false` if the constraint could not be created.","name":"","type":"Entity"},{"text":"The created rope. ([keyframe_rope](https://developer.valvesoftware.com/wiki/Keyframe_rope)) Will return `nil` if the constraint could not be created.","name":"","type":"Entity"},{"text":"The muscle controller. (`gmod_winch_controller`) Will return `nil` if the constraint could not be created.","name":"","type":"Entity"},{"text":"The slider ([phys_slideconstraint](https://developer.valvesoftware.com/wiki/Phys_slideconstraint)) if `fixed` was exactly `1`. Will return nil otherwise, or if the constraint could not be created.","name":"","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Keepupright","parent":"constraint","type":"libraryfunc","description":"Creates a keep upright constraint.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"621-L662"},"args":{"arg":[{"text":"The entity to keep upright.","name":"ent","type":"Entity"},{"text":"The angle defined as \"upright\".","name":"ang","type":"Angle"},{"text":"The bone of the entity to constrain (0 for boneless).","name":"bone","type":"number"},{"text":"Basically, the strength of the constraint. Must be above 0.","name":"angularLimit","type":"number"}]},"rets":{"ret":{"text":"The created constraint, if any or false if the constraint failed to set.","name":"","type":"Entity"}}},"example":{"description":"Adds a console command that makes whatever prop the player is looking at to be kept upright.","code":"concommand.Add( \"keep_upright\",function( ply, cmd, args )\n\tlocal tr = ply:GetEyeTrace()\n\n\tlocal ent = tr.Entity\n\tif ( !IsValid( ent ) ) then return end\n\n\tconstraint.Keepupright( ent, ent:GetAngles(), tr.PhysicsBone, 999999 )\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"Motor","parent":"constraint","type":"libraryfunc","description":"Creates a motor constraint, a player controllable constraint.Axis.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"1037-L1130"},"args":{"arg":[{"text":"First entity.","name":"ent1","type":"Entity"},{"text":"Second entity.","name":"ent2","type":"Entity"},{"text":"PhysObj number of first entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone1","type":"number"},{"text":"PhysObj number of second entity to constrain to. (0 for non-ragdolls). Must be different from `bone1`.\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone2","type":"number"},{"text":"Position relative to the the first physics object to constrain to.","name":"localPos1","type":"Vector"},{"text":"Position relative to the the second physics object to constrain to.","name":"localPos2","type":"Vector"},{"text":"Motor friction.","name":"friction","type":"number"},{"text":"Motor torque.","name":"torque","type":"number"},{"text":"Automatic shut-off after this time has passed. A value of 0 means to stay on forever or until deactivated.","name":"forcetime","type":"number"},{"text":"Whether the entities should be no-collided.","name":"nocollide","type":"number","default":"0"},{"text":"Whether the constraint is on toggle.","name":"toggle","type":"number","default":"false"},{"text":"The player that will control the motor. Used to to call numpad.OnDown and numpad.OnUp.","name":"player","type":"Player","default":"NULL"},{"text":"Amount of force until it breaks (0 = unbreakable).","name":"forcelimit","type":"number","default":"0"},{"text":"The key binding for \"forward\", corresponding to an Enums/KEY.","name":"key_fwd","type":"number","default":"nil"},{"text":"The key binding for \"backwards\", corresponding to an Enums/KEY.","name":"key_bwd","type":"number","default":"nil"},{"text":"Either `1` or `-1` signifying which direction the motor should spin.","name":"direction","type":"number","default":"1"},{"text":"Overrides axis of rotation?","name":"localAxis","type":"Vector","default":"nil","validate":""}]},"rets":{"ret":[{"text":"The created constraint. ([phys_torque](https://developer.valvesoftware.com/wiki/Phys_torque)) Will return `false` if the constraint could not be created.","name":"","type":"Entity"},{"text":"The created axis constraint. ([phys_hinge](https://developer.valvesoftware.com/wiki/Phys_hinge)) Will return `nil` if the constraint could not be created.","name":"","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Muscle","parent":"constraint","type":"libraryfunc","description":"Creates a muscle constraint.\n\nVery similar to constraint.Hydraulic, but instead of a toggle between fully expanded and contracted, it will continuously alternate between the 2 states while enabled.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"1422-L1496"},"args":{"arg":[{"text":"The player that will be able to control the constraint. Used to call numpad.OnDown.","name":"player","type":"Player"},{"text":"First entity.","name":"ent1","type":"Entity"},{"text":"Second entity.","name":"ent2","type":"Entity"},{"text":"PhysObj number of first entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone1","type":"number"},{"text":"PhysObj number of second entity to constrain to. (0 for non-ragdolls). Must be different from `bone1`.\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone2","type":"number"},{"text":"Position relative to the the first physics object to constrain to.","name":"localPos1","type":"Vector"},{"text":"Position relative to the the second physics object to constrain to.","name":"localPos2","type":"Vector"},{"text":"Minimum length of the constraint.","name":"length1","type":"number"},{"text":"Maximum length of the constraint.","name":"length2","type":"number"},{"text":"Width of the rope.","name":"width","type":"number"},{"text":"The key binding, corresponding to an Enums/KEY.","name":"key","type":"number"},{"text":"Whether the constraint is fixed, i.e. cannot bend. Must be `1` to act as `true`.","name":"fixed","type":"number"},{"text":"How often the \"contractions\" should happen.","name":"period","type":"number"},{"text":"Amplification of the \"contractions\"?","name":"amplitude","type":"number"},{"text":"Whether the constraint should start activated. (i.e. spazzing).","name":"startOn","type":"boolean","default":"false"},{"text":"Material of the rope. If left unset, will be solid black.","name":"material","type":"string","default":""},{"text":"The color of the rope.","name":"color","type":"Color","default":"color_white"}]},"rets":{"ret":[{"text":"The created constraint. ([phys_spring](https://developer.valvesoftware.com/wiki/Phys_spring)) Will return `false` if the constraint could not be created.","name":"","type":"Entity"},{"text":"The created rope. ([keyframe_rope](https://developer.valvesoftware.com/wiki/Keyframe_rope)) Will return `nil` if the constraint could not be created.","name":"","type":"Entity"},{"text":"The muscle controller. (`gmod_winch_controller`) Will return `nil` if the constraint could not be created.","name":"","type":"Entity"},{"text":"The slider ([phys_slideconstraint](https://developer.valvesoftware.com/wiki/Phys_slideconstraint)) if `fixed` was exactly `1`. Will return nil otherwise, or if the constraint could not be created.","name":"","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"NoCollide","parent":"constraint","type":"libraryfunc","description":{"text":"Creates an no-collide \"constraint\". Disables collision between two entities.","note":"Does not work with players."},"realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"913-L954"},"args":{"arg":[{"text":"First entity.","name":"ent1","type":"Entity"},{"text":"Second entity.","name":"ent2","type":"Entity"},{"text":"PhysObj number of first entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone1","type":"number"},{"text":"PhysObj number of second entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone2","type":"number"},{"text":"If set, the nocollide will be reversed if the constraint is removed.","name":"disableOnRemove","type":"boolean","default":"false","added":"2024.10.29"}]},"rets":{"ret":{"text":"The created constraint. ([logic_collision_pair](https://developer.valvesoftware.com/wiki/Logic_collision_pair)) Will return `false` if the constraint could not be created.","name":"","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Pulley","parent":"constraint","type":"libraryfunc","description":"Creates a pulley constraint.\n\nIt consists of 3 rope segments, 2 of which have variable length, visually connected by a 3rd. Reducing length of one end will increase the length of the other end.\n\nYou can visualize the pulley like so:\n```\nWPos2 --- WPos3\n  |\t\t\t|\n  |\t\t\t|\n Ent1\t   Ent4\n```","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"1137-L1207"},"args":{"arg":[{"text":"First entity to constrain.","name":"ent1","type":"Entity"},{"text":"The other entity to attach to.","name":"ent4","type":"Entity"},{"text":"PhysObj number of first entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone1","type":"number"},{"text":"PhysObj number of second entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone4","type":"number"},{"text":"Position relative to the the first physics object to constrain to.","name":"localPos1","type":"Vector"},{"text":"Position relative to the the second physics object to constrain to.","name":"localPos4","type":"Vector"},{"text":"World position constrain the first entity to. This point will be static.","name":"worldPos2","type":"Vector"},{"text":"World position constrain the second entity to. This point will be static.","name":"worldPos3","type":"Vector"},{"text":"Amount of force until it breaks (0 = unbreakable).","name":"forceLimit","type":"number"},{"text":"Whether the constraint is rigid, i.e. cannot bend.","name":"rigid","type":"boolean","default":"false"},{"text":"Width of the rope. If below or at `0`, visual rope segments will not be created.","name":"width","type":"number"},{"text":"Material of the rope. If unset, will be solid black.","name":"material","type":"string","default":""},{"text":"The color of the rope.","name":"color","type":"Color","default":"color_white"}]},"rets":{"ret":[{"text":"The created constraint. ([phys_pulleyconstraint](https://developer.valvesoftware.com/wiki/Phys_pulleyconstraint)) Will return `false` if the constraint could not be created.","name":"","type":"Entity"},{"text":"The first rope segment. ([keyframe_rope](https://developer.valvesoftware.com/wiki/Keyframe_rope)) Will return `nil` if the constraint or this rope segment could not be created.","name":"","type":"Entity"},{"text":"The second rope segment. ([keyframe_rope](https://developer.valvesoftware.com/wiki/Keyframe_rope)) Will return `nil` if the constraint or this rope segment could not be created.","name":"","type":"Entity"},{"text":"The third rope segment. ([keyframe_rope](https://developer.valvesoftware.com/wiki/Keyframe_rope)) Will return `nil` if the constraint or this rope segment could not be created.","name":"","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"RemoveAll","parent":"constraint","type":"libraryfunc","description":"Attempts to remove all constraints associated with an entity.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"189-L216"},"args":{"arg":{"text":"The entity to remove constraints from.","name":"ent","type":"Entity"}},"rets":{"ret":[{"text":"Whether any constraints were removed.","name":"","type":"boolean"},{"text":"Number of constraints removed.","name":"","type":"number"}]}},"example":{"description":"From stools/remover.lua.","code":"-- Reload removes all constraints on the targetted entity\nfunction TOOL:Reload( trace )\n\tif ( !IsValid( trace.Entity ) or trace.Entity:IsPlayer() ) then return false end\n\treturn constraint.RemoveAll( trace.Entity )\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"RemoveConstraints","parent":"constraint","type":"libraryfunc","description":"Attempts to remove all constraints of a specified type associated with an entity","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"146-L182"},"args":{"arg":[{"text":"The entity to check.","name":"ent","type":"Entity"},{"text":"The constraint type to remove (eg. `\"Weld\"`, `\"Elastic\"`, `\"NoCollide\"`).","name":"type","type":"string"}]},"rets":{"ret":[{"text":"Whether we removed any constraints or not.","name":"","type":"boolean"},{"text":"The amount of constraints removed.","name":"","type":"number"}]}},"example":{"description":"From stools/axis.lua.","code":"function TOOL:Reload( trace )\n\tif (!trace.Entity:IsValid() or trace.Entity:IsPlayer() ) then return false end\n\tlocal bool = constraint.RemoveConstraints( trace.Entity, \"Axis\" )\n\treturn bool\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"Rope","parent":"constraint","type":"libraryfunc","description":"Creates a simple rope (length) based constraint.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"468-L540"},"args":{"arg":[{"text":"First entity.","name":"ent1","type":"Entity"},{"text":"Second entity.","name":"ent2","type":"Entity"},{"text":"PhysObj number of first entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone1","type":"number"},{"text":"PhysObj number of second entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone2","type":"number"},{"text":"Position relative to the the first physics object to constrain to.","name":"localPos1","type":"Vector"},{"text":"Position relative to the the second physics object to constrain to.","name":"localPos2","type":"Vector"},{"text":"Length of the rope.","name":"length","type":"number"},{"text":"Amount to add to the length of the rope. Works as it does in the Rope tool.","name":"addLength","type":"number","default":"0"},{"text":"Amount of force until it breaks (0 = unbreakable).","name":"forceLimit","type":"number","default":"0"},{"text":"Width of the rope.","name":"width","type":"number"},{"text":"Material of the rope. If unset, will be solid black.","name":"material","type":"string","default":"nil"},{"text":"Whether the constraint is rigid.","name":"rigid","type":"boolean","default":"false"},{"text":"The color of the rope.","name":"color","type":"Color","default":"color_white"}]},"rets":{"ret":[{"text":"The constraint entity ([phys_lengthconstraint](https://developer.valvesoftware.com/wiki/Phys_lengthconstraint)).\n\nWill be a `keyframe_rope` if you are roping to the same bone on the same entity. Will return `false` if the constraint could not be created.","name":"constraint","type":"Entity"},{"text":"The rope entity. Will return `nil` if `constraint` return value is a [keyframe_rope](https://developer.valvesoftware.com/wiki/Keyframe_rope) or if the constraint could not be created.","name":"rope","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Slider","parent":"constraint","type":"libraryfunc","description":"Creates a slider constraint. A slider is like a rope, but allows the constrained object to move only in 1 direction.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"684-L767"},"args":{"arg":[{"text":"First entity.","name":"ent1","type":"Entity"},{"text":"Second entity.","name":"ent2","type":"Entity"},{"text":"PhysObj number of first entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone1","type":"number"},{"text":"PhysObj number of second entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone2","type":"number"},{"text":"Position relative to the the first physics object to constrain to.","name":"localPos1","type":"Vector"},{"text":"Position relative to the the second physics object to constrain to.","name":"localPos2","type":"Vector"},{"text":"The width of the rope.","name":"width","type":"number"},{"text":"The material of the rope. If unset, will be solid black.","name":"material","type":"string","default":""},{"text":"The color of the rope. See Color.","name":"color","type":"Color","default":"color_white"}]},"rets":{"ret":[{"text":"The created constraint entity. ([phys_slideconstraint](https://developer.valvesoftware.com/wiki/Phys_slideconstraint)) Will return `false` if the constraint could not be created.","name":"","type":"Entity"},{"text":"The created rope. ([keyframe_rope](https://developer.valvesoftware.com/wiki/Keyframe_rope)) Will return `nil` if the constraint or the rope could not be created.","name":"","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Weld","parent":"constraint","type":"libraryfunc","description":"Creates a weld constraint.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"396-L461"},"args":{"arg":[{"text":"The first entity.","name":"ent1","type":"Entity"},{"text":"The second entity.","name":"ent2","type":"Entity"},{"text":"PhysObj number of first entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone1","type":"number"},{"text":"PhysObj number of second entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone2","type":"number"},{"text":"The amount of force appliable to the constraint before it will break (0 is never).","name":"forceLimit","type":"number","default":"0"},{"text":"Should `ent1` be nocollided to `ent2` via this constraint.","name":"noCollide","type":"boolean","default":"false"},{"text":"If true, when `ent2` is removed, `ent1` will also be removed.","name":"deleteEnt1OnBreak","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"The created constraint entity, or false if the constraint failed. ([phys_constraint](https://developer.valvesoftware.com/wiki/Phys_constraint))","name":"","type":"Entity"}}},"example":{"description":"Adapted from stools/thruster.lua.","code":"function TOOL:LeftClick( trace )\n\t-- Boilerplate stool code to extract ClientConVars to variables\n\n\tlocal thruster = MakeThruster( ply, model, Ang, trace.HitPos, key, key_bk, force, toggle, effect, damageable, soundname )\n\tlocal weld = constraint.Weld( thruster, trace.Entity, 0, trace.PhysicsBone, 0, collision == 0, true )\n\n\t-- If you remove the entity thrusters are welded to, the thruster is removed as well\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"Winch","parent":"constraint","type":"libraryfunc","description":"Creates a winch constraint, a player controllable constraint.Elastic, allowing gradually increasing or decreasing the length.","realm":"Server","file":{"text":"lua/includes/modules/constraint.lua","line":"1265-L1330"},"args":{"arg":[{"text":"The player that will be used to call numpad.OnDown and numpad.OnUp.","name":"player","type":"Player"},{"text":"First entity.","name":"ent1","type":"Entity"},{"text":"Second entity.","name":"ent2","type":"Entity"},{"text":"PhysObj number of first entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone1","type":"number"},{"text":"PhysObj number of second entity to constrain to. (0 for non-ragdolls).\n\nSee Entity:TranslateBoneToPhysBone.","name":"bone2","type":"number"},{"text":"Position relative to the the first physics object to constrain to.","name":"localPos1","type":"Vector"},{"text":"Position relative to the the second physics object to constrain to.","name":"localPos2","type":"Vector"},{"text":"The width of the rope.","name":"width","type":"number"},{"text":"The key binding for \"forward\", corresponding to an Enums/KEY.","name":"fwdBind","type":"number"},{"text":"The key binding for \"backwards\", corresponding to an Enums/KEY.","name":"bwdBind","type":"number"},{"text":"Forward speed.","name":"fwdSpeed","type":"number"},{"text":"Backwards speed.","name":"bwdSpeed","type":"number"},{"text":"The material of the rope. If unset, will be solid black.","name":"material","type":"string","default":""},{"text":"Whether the winch should be on toggle.","name":"toggle","type":"boolean","default":"false"},{"text":"The color of the rope.","name":"color","type":"Color","default":"color_white"}]},"rets":{"ret":[{"text":"The created constraint. ([phys_spring](https://developer.valvesoftware.com/wiki/Phys_spring)) Can return `nil`. Will return `false` if the constraint could not be created.","name":"","type":"Entity"},{"text":"The created rope. ([keyframe_rope](https://developer.valvesoftware.com/wiki/Keyframe_rope)) Will return `nil` if the constraint could not be created.","name":"","type":"Entity"},{"text":"The winch controller. (`gmod_winch_controller`) Can return `nil`.","name":"","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Magnet","parent":"construct","type":"libraryfunc","description":"Creates a magnet.","realm":"Server","file":{"text":"lua/includes/modules/construct.lua","line":"95-L149"},"args":{"arg":[{"text":"Player that will have the numpad control over the magnet.","name":"ply","type":"Player"},{"text":"The position of the magnet.","name":"pos","type":"Vector"},{"text":"The angles of the magnet.","name":"ang","type":"Angle"},{"text":"The model of the magnet.","name":"model","type":"string"},{"text":"Material of the magnet ( texture ).","name":"material","type":"string"},{"text":"The key to toggle the magnet, see Enums/KEY.","name":"key","type":"number"},{"text":"Maximum amount of objects the magnet can hold.","name":"maxObjects","type":"number"},{"text":"Strength of the magnet.","name":"strength","type":"number"},{"text":"If > 0, disallows the magnet to pull objects towards it.","name":"nopull","type":"number","default":"0"},{"text":"If > 0, allows rotation of the objects attached.","name":"allowrot","type":"number","default":"0"},{"text":"If > 0, enabled from spawn.","name":"startOn","type":"number","default":"0"},{"text":"If != 0, pressing the key toggles the magnet, otherwise you'll have to hold the key to keep it enabled.","name":"toggle","type":"number"},{"text":"Velocity to set on spawn.","name":"vel","type":"Vector","default":"Vector( 0, 0, 0 )"},{"text":"Angular velocity to set on spawn.","name":"aVel","type":"Angle","default":"Angle( 0, 0, 0 )"},{"text":"Freeze the magnet on start.","name":"frozen","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"The magnet.","name":"","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetPhysProp","parent":"construct","type":"libraryfunc","description":"Sets props physical properties.","realm":"Server","file":{"text":"lua/includes/modules/construct.lua","line":"13-L51"},"args":{"arg":[{"text":"The player. This variable is not used and can be left out.","name":"ply","type":"Player"},{"text":"The entity to apply properties to.","name":"ent","type":"Entity"},{"text":"You can use this or the argument below. This will be used in case you don't provide argument below.","name":"physObjID","type":"number"},{"text":"The physics object to apply the properties to.","name":"physObj","type":"PhysObj"},{"text":"The table containing properties to apply. See Structures/PhysProperties.","name":"data","type":"table"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Clear","parent":"controlpanel","type":"libraryfunc","description":"Clears ALL the control panels ( for tools ).","realm":"Client","file":{"text":"lua/includes/modules/controlpanel.lua","line":"43-L47"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Get","parent":"controlpanel","type":"libraryfunc","description":"Returns (or creates if not exists) a control panel.","realm":"Client","file":{"text":"lua/includes/modules/controlpanel.lua","line":"21-L41"},"args":{"arg":{"text":"The name of the panel. For normal tools this will be equal to `TOOL.Mode` (the tool's filename without the extension).\n\nWhen you create a tool/option via spawnmenu.AddToolMenuOption, the internal control panel name is `TOOL.Mode .. \"_\" .. tool_tab:lower() .. \"_\" .. tool_category:lower()`.","name":"name","type":"string"}},"rets":{"ret":{"text":"The ControlPanel panel.","name":"","type":"Panel"}}},"example":{"description":"Get the Contextmenus panel for the weld tool.","code":"local ControlPanel = controlpanel.Get( \"Weld\" )"},"realms":["Client"],"type":"Function"},
{"text":"---","function":{"name":"Delete","parent":"cookie","type":"libraryfunc","file":{"text":"lua/includes/modules/cookie.lua","line":"105-L114"},"realm":"Shared and Menu","description":"Removes any cookie with the given name.\n\t\t\n\t\tDoes nothing if the cookie doesn't exist.","args":{"arg":{"text":"The name of the cookie that you want to delete.","name":"key","type":"string"}}},"example":{"description":"Sets & deletes a cookie & print it's values on every step.","code":"cookie.Set('My-Cookie','Hello World')\n\nprint('Set My-Cookie')\n\nprint('My-Cookie:',cookie.GetString('My-Cookie'))\n\n\ncookie.Delete('My-Cookie')\n\nprint('Deleted My-Cookie')\n\nprint('My-Cookie:',cookie.GetString('My-Cookie'))","output":"```\nSet My-Cookie\nMy-Cookie: Hello World\nDeleted My-Cookie\nMy-Cookie: nil\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetNumber","parent":"cookie","type":"libraryfunc","description":"Gets the value of a cookie on the client as a number.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/cookie.lua","line":"95-L103"},"args":{"arg":[{"text":"The name of the cookie that you want to get.","name":"name","type":"string"},{"text":"Value to return if the cookie does not exist.","name":"default","type":"any","default":"nil"}]},"rets":{"ret":{"text":"The cookie value.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetString","parent":"cookie","type":"libraryfunc","description":"Gets the value of a cookie on the client as a string.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/cookie.lua","line":"85-L93"},"args":{"arg":[{"text":"The name of the cookie that you want to get.","name":"name","type":"string"},{"text":"Value to return if the cookie does not exist.","name":"default","type":"any","default":"nil"}]},"rets":{"ret":{"text":"The cookie value.","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"text":"---","function":{"name":"Set","parent":"cookie","type":"libraryfunc","file":{"text":"lua/includes/modules/cookie.lua","line":"116-L121"},"realm":"Shared and Menu","description":"Creates / updates a cookie in the Database.","args":{"arg":[{"text":"The name of the cookie.","name":"key","type":"string"},{"text":"The data stored in the cookie.","name":"value","type":"string"}]}},"example":{"description":"Sets & prints out a cookie's value.","code":"cookie.Set('My-Cookie','Hello World')\n\nprint('Set My-Cookie')\n\nprint('My-Cookie:',cookie.GetString('My-Cookie'))","output":"```\nSet My-Cookie\nMy-Cookie: Hello World\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"create","parent":"coroutine","type":"libraryfunc","description":"Creates a coroutine of the given function.","realm":"Shared and Menu","args":{"arg":{"text":"The function for the coroutine to use.","name":"func","type":"function"}},"rets":{"ret":{"text":"The created coroutine.","name":"","type":"thread"}}},"example":{"description":"Display the location of each player in an endless loop, but only one player per frame.","code":"local function displayer()\n\tlocal players\n\n\twhile true do -- endless loop: you must guarantee that coroutine.yield() is always called!\n\t\tplayers = player.GetAll()\n\t\t\n\t\tif not next( players ) then -- empty table\n\t\t\tcoroutine.yield() -- guarantee a pause in coroutine even with an empty table\n\t\telse\n\t\t\tfor _, ply in ipairs( players ) do\n\t\t\t\tcoroutine.yield() -- We yield here so what you may do next will start immediatly when this for loop finishes.\n\t\t\t\t\n\t\t\t\tif IsValid( ply ) then -- The player ply may be disconnected now!\n\t\t\t\t\tprint( ply:Nick(), \"is located at\", ply:GetPos() )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend\n\t\nlocal co\nhook.Add( \"Think\", \"DisplayPlayersLocation\", function()\n\tif not co or not coroutine.resume( co ) then\n\t\tco = coroutine.create( displayer )\n\t\tcoroutine.resume( co )\n\tend\nend )","output":"```\nCustom Nickname\tis located at\t10.102 59.04 -100.96\nSuperBoss\tis located at\t55.85 1209.11 -100.96\nCustom Nickname\tis located at\t11.126 51.92 -100.96\n...\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"isyieldable","parent":"coroutine","type":"libraryfunc","description":{"text":"Returns whether the running coroutine can yield.  \n\t\tA running coroutine is yieldable if it is not in the main thread, and it is not inside a non-yieldable C function.","note":"This is only available on the x86-64 versions, because of the difference in the LuaJIT version. [See here](jit.version)"},"realm":"Shared and Menu","rets":{"ret":{"text":"Returns true when the running coroutine can yield.","name":"canyield","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"resume","parent":"coroutine","type":"libraryfunc","description":"Resumes the given coroutine and passes the given vararg to either the function arguments or the coroutine.yield that is inside that function and returns whatever yield is called with the next time or by the final return in the function.","realm":"Shared and Menu","args":{"arg":[{"text":"Coroutine to resume.","name":"coroutine","type":"thread"},{"text":"Arguments to be returned by coroutine.yield.","name":"args","type":"vararg"}]},"rets":{"ret":[{"text":"If the executed thread code had no errors occur within it.","name":"","type":"boolean"},{"text":"If an error occurred, this will be a string containing the error message. Otherwise, this will be arguments that were yielded.","name":"","type":"vararg"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"running","parent":"coroutine","type":"libraryfunc","description":"Returns the active coroutine or nil if we are not within a coroutine.","realm":"Shared and Menu","rets":{"ret":{"text":"The active coroutine.","name":"","type":"thread"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"status","parent":"coroutine","type":"libraryfunc","description":"Returns the status of the coroutine passed to it, the possible statuses are \"suspended\", \"running\", and \"dead\".","realm":"Shared and Menu","args":{"arg":{"text":"Coroutine to check the status of.","name":"coroutine","type":"thread"}},"rets":{"ret":{"text":"The coroutine's status.","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"wait","parent":"coroutine","type":"libraryfunc","description":"Repeatedly yields the coroutine for the given duration before continuing. \n\nOnly works inside a coroutine. Only useful in nextbot coroutine think function. \n\nThis function uses Global.CurTime instead of Global.RealTime.","realm":"Shared","file":{"text":"lua/includes/extensions/coroutine.lua","line":"15-L26"},"args":{"arg":{"text":"The number of seconds to wait.","name":"duration","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"wrap","parent":"coroutine","type":"libraryfunc","description":"Returns a function which calling is equivalent with calling coroutine.resume with the coroutine and all extra parameters.\n\nThe values returned by the returned function only contain the values passed to the inner coroutine.yield call and do not include the *no error* status that coroutine.resume provides. In case of failure, an error is thrown instead.","realm":"Shared and Menu","args":{"arg":{"text":"Coroutine to resume.","name":"coroutine","type":"function"}},"rets":{"ret":{"name":"","type":"function"}}},"example":{"description":"Performs a standard HTTP request while waiting for the server response to continue executing the code. Useful to improve the readability of the code and avoid using callback functions.","code":"local function HTTPRequest( url, headers )\n    local running = coroutine.running()\n\n    local function onSuccess( body, length, header, code )\n        coroutine.resume( running, true, body )\n    end\n\n    local function onFailure( err )\n        coroutine.resume( running, false, err )\n    end\n\n    http.Fetch( url, onSuccess, onFailure, headers )\n\n    return coroutine.yield()\nend\n\ncoroutine.wrap( function()\n    local state, response = HTTPRequest( \"https://www.google.com/\" )\n\n    if state then\n        -- Success!\n        print( \"HTTP body:\" .. response )\n    else\n        -- Error(?)\n        print( \"HTTP request error: \" .. response )\n    end\n\n\t-- Important code to be performed after the request is completed..\nend )()","output":"The body of the HTTP page if the request was successful, otherwise the error code in case of failure."},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"yield","parent":"coroutine","type":"libraryfunc","description":"Pauses the active coroutine and passes all additional variables to the call of coroutine.resume that resumed the coroutine last time, and returns all additional variables that were passed to the previous call of resume.","realm":"Shared and Menu","args":{"arg":{"text":"Arguments to be returned by the last call of coroutine.resume.","name":"returnValue","type":"vararg"}},"rets":{"ret":{"text":"Arguments that were set previously by coroutine.resume.","name":"","type":"vararg"}}},"example":{"description":"Demonstrates the use of using varargs as a return value.","code":"local co = coroutine.create( function()\n\tcoroutine.yield( \"Hello world!\" )\nend )\n\nprint( coroutine.resume( co ) )","output":"```\ntrue, \"Hello world!\"\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"AddChangeCallback","parent":"cvars","type":"libraryfunc","description":{"text":"Adds a callback to be called when the named convar changes.","bug":[{"text":"This does not callback convars in the menu state.","issue":"1440"},{"text":"This does not callback convars on the client with FCVAR_GAMEDLL and convars on the server without FCVAR_GAMEDLL.","issue":"3503"},{"text":"This does not callback convars on the client with FCVAR_REPLICATED.","issue":"3740"}]},"realm":"Shared and Menu","file":{"text":"lua/includes/modules/cvars.lua","line":"54-L81"},"args":{"arg":[{"text":"The name of the convar to add the change callback to.","name":"name","type":"string"},{"text":"The function to be called when the convar changes.","name":"callback","type":"function","callback":{"arg":[{"text":"The name of the convar.","type":"string","name":"convar"},{"text":"The old value of the convar.","type":"string","name":"oldValue"},{"text":"The new value of the convar.","type":"string","name":"newValue"}]}},{"text":"If set, you will be able to remove the callback using cvars.RemoveChangeCallback.\n\n The identifier is not required to be globally unique, as it's paired with the actual name of the convar.","name":"identifier","type":"string","default":"nil"}]}},"example":{"description":"Called when convar changes.","code":"cvars.AddChangeCallback(\"convar name\", function(convar_name, value_old, value_new)\n    print(convar_name, value_old, value_new)\nend)","output":"\"convar name\" 2 5"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Bool","parent":"cvars","type":"libraryfunc","description":"Retrieves console variable as a boolean.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/cvars.lua","line":"138-L147"},"args":{"arg":[{"text":"Name of console variable.","name":"cvar","type":"string"},{"text":"The value to return if the console variable does not exist.","name":"default","type":"boolean","default":"nil"}]},"rets":{"ret":{"text":"Retrieved value.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetConVarCallbacks","parent":"cvars","type":"libraryfunc","description":"Returns a table of the given ConVars callbacks.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/cvars.lua","line":"21-L31"},"args":{"arg":[{"text":"The name of the ConVar.","name":"name","type":"string"},{"text":"Whether or not to create the internal callback table for given ConVar if there isn't one yet.\n\n\nThis argument is internal and should not be used.","name":"createIfNotFound","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"A table of the convar's callbacks, or nil if the convar doesn't exist.","name":"","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Number","parent":"cvars","type":"libraryfunc","description":"Retrieves console variable as a number.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/cvars.lua","line":"123-L132"},"args":{"arg":[{"text":"Name of console variable.","name":"cvar","type":"string"},{"text":"The value to return if the console variable does not exist.","name":"default","type":"any","default":"nil"}]},"rets":{"ret":{"text":"Retrieved value or the second argument if the console variable does not exist. Will return 0 if the console variable exists and has a string value.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"OnConVarChanged","parent":"cvars","type":"libraryfunc","description":{"text":"Called by the engine when a convar value changes.","internal":"You are probably looking for cvars.AddChangeCallback."},"realm":"Shared and Menu","file":{"text":"lua/includes/modules/cvars.lua","line":"38-L52"},"args":{"arg":[{"text":"Convar name.","name":"name","type":"string"},{"text":"The old value of the convar.","name":"oldVal","type":"string"},{"text":"The new value of the convar.","name":"newVal","type":"string"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"RemoveChangeCallback","parent":"cvars","type":"libraryfunc","description":"Removes a callback for a convar using the the callback's identifier. The identifier should be the third argument specified for cvars.AddChangeCallback.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/cvars.lua","line":"87-L102"},"args":{"arg":[{"text":"The name of the convar to remove the callback from.","name":"name","type":"string"},{"text":"The callback's identifier.","name":"indentifier","type":"string"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"String","parent":"cvars","type":"libraryfunc","description":"Retrieves console variable as a string.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/cvars.lua","line":"108-L117"},"args":{"arg":[{"text":"Name of console variable.","name":"cvar","type":"string"},{"text":"The value to return if the console variable does not exist.","name":"default","type":"any","default":"nil"}]},"rets":{"ret":{"text":"Retrieved value.","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"debug","parent":"debug","type":"libraryfunc","description":{"text":"Enters an interactive mode with the user, running each string that the user enters. Using simple commands and other debug facilities, the user can inspect global and local variables, change their values, evaluate expressions, and so on. A line containing only the word cont finishes this function, so that the caller continues its execution.\n\n* Commands for debug.debug are not lexically nested within any function, and so have no direct access to local variables.\n* To exit this interactive mode, you can press Ctrl + Z then Enter OR type the word 'cont' on a single line and press enter.","deprecated":"","note":"This only works on the source dedicated server."},"realm":"Shared and Menu"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"getfenv","parent":"debug","type":"libraryfunc","description":{"text":"Returns the environment of the passed object. This can be set with debug.setfenv.","deprecated":""},"realm":"Shared and Menu","args":{"arg":{"text":"Object to get environment of.","name":"object","type":"table"}},"rets":{"ret":{"text":"The environment.","name":"","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"gethook","parent":"debug","type":"libraryfunc","description":{"text":"Returns the current hook settings of the passed thread. The thread argument can be omitted. This is completely different to gamemode hooks. More information on hooks can be found at http://www.lua.org/pil/23.2.html. This function will simply return the function, mask, and count of the last called debug.sethook.","deprecated":""},"realm":"Shared and Menu","args":{"arg":{"text":"Which thread to retrieve it's hook from, doesn't seem to actually work.","name":"thread","type":"thread","default":"nil"}},"rets":{"ret":[{"text":"Hook function.","name":"","type":"function"},{"text":"Hook mask. This is reversed of the debug.sethook mask (\"clr\" would be \"rlc\").","name":"","type":"string"},{"text":"Hook count.","name":"","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"getinfo","parent":"debug","type":"libraryfunc","description":"Returns debug information about a function.","realm":"Shared and Menu","args":{"arg":[{"text":"Takes either a function or a number representing the stack level as an argument. Stack level 0 always corresponds to the debug.getinfo call, 1 would be the function calling debug.getinfo in most cases, and so on.\n\nReturns useful information about that function in a table.","name":"funcOrStackLevel","type":"function","alttype":"number"},{"text":"A string whose characters specify the information to be retrieved.\n\n* `f` - Populates the func field.\n* `l` - Populates the currentline field.\n* `L` - Populates the activelines field.\n* `n` - Populates the name and namewhat fields - only works if stack level is passed rather than function pointer.\n* `S` - Populates the location fields (lastlinedefined, linedefined, short_src, source and what).\n* `u` - Populates the argument and upvalue fields (isvararg, nparams, nups).\n* `>` - Causes this function to use the last argument to get the data from.","name":"fields","type":"string","default":">flnSu"},{"text":"Function to use. (Only used by the `>` field)","name":"function","type":"function|nil"}]},"rets":{"ret":{"text":"A table as a Structures/DebugInfo containing information about the function you passed. Can return nil if the stack level didn't point to a valid stack frame.","name":"","type":"table"}}},"example":{"description":"Let's find out information about net.Receive, such as which file it's defined in, the line it starts and the line it ends, and if it's defined in Lua, or C plus additional information.","code":"PrintTable( debug.getinfo( net.Receive ) )","output":"```\ncurrentline\t=\t-1\nfunc\t=\tfunction: 0x2430a158\nisvararg\t=\tfalse\nlastlinedefined\t=\t13\nlinedefined\t=\t9\nnamewhat\t=\t\nnparams\t=\t2\nnups\t=\t0\nshort_src\t=\tlua/includes/extensions/net.lua\nsource\t=\t@lua/includes/extensions/net.lua\nwhat\t=\tLua\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"getlocal","parent":"debug","type":"libraryfunc","description":{"text":"Gets the name and value of a local variable indexed from the level.","deprecated":"","warning":"When a function has a tailcall return, you cannot access the locals of this function."},"realm":"Shared and Menu","args":{"arg":[{"text":"The thread.","name":"thread","type":"thread","default":"Current thread"},{"text":"The level above the thread. \n* 0 = the function that was called (most always this function)'s arguments.\n* 1 = the thread that had called this function.\n* 2 = the thread that had called the function that started the thread that called this function.\n\nA function defined in Lua can also be passed as the level. The index will specify the parameter's name to be returned (a parameter will have a value of nil).","name":"level","type":"number"},{"text":"The variable's index you want to get.\n* 1 = the first local defined in the thread.\n* 2 = the second local defined in the thread.\n* etc...","name":"index","type":"number"}]},"rets":{"ret":[{"text":"The name of the variable.\n\nSometimes this will be `(*temporary)` if the local variable had no name.","name":"","type":"string","note":"Variables with names starting with **(** are **internal variables**."},{"text":"The value of the local variable.","name":"","type":"any"}]}},"example":[{"description":"Gets all the local variables of the current thread and stores them in a table.","code":"local varA = 1\nlocal varB\nlocal locals = {}\nlocal i = 1\n\nwhile ( true ) do\n    local name, value = debug.getlocal( 1, i )\n    if ( name == nil ) then break end\n\n    locals[i] = {\n        name = name,\n        value = value,\n    }\n\n    i = i + 1\nend\n\nfor k, v in pairs( locals ) do\n    print(v.name, \"=\", v.value)\nend","output":"```\nvarA    =       1\nvarB    =       nil\nlocals  =       table: 0xa78f5ab2\ni       =       4\n```"},{"description":"Prints the parameter names for hook.Add.","code":"local print = print\nlocal getlocal = debug.getlocal\n\nlocal function PrintFunctionParameters( func )\n\tlocal k = 2\n\tlocal param = getlocal( func, 1 )\n\twhile param ~= nil do\n\t\tprint( param )\n\t\tparam = getlocal( func, k )\n\t\tk = k + 1\n\tend\nend\n\nPrintFunctionParameters( hook.Add )","output":"```\nevent_name\nname\nfunc\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"getmetatable","parent":"debug","type":"libraryfunc","description":{"text":"Returns the metatable of an object. This function ignores the metatable's __metatable field.","deprecated":""},"realm":"Shared and Menu","args":{"arg":{"text":"The object to retrieve the metatable from.","name":"object","type":"any"}},"rets":{"ret":{"text":"The metatable of the given object.","name":"","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"getregistry","parent":"debug","type":"libraryfunc","description":{"text":"Returns the internal Lua registry table.\n\nThe Lua registry is used by the engine and binary modules to create references to Lua values. The registry contains every global ran and used in the Lua environment. Avoid creating entries into the registry with a number as the key, as they are reserved for the reference system.","deprecated":"This function now returns a table that serves as a proxy to Global.FindMetaTable and Global.RegisterMetaTable. If you previously used the registry to get/add metatables, you should use those functions directly instead.","warning":"Improper editing of the registry can result in unintended side effects, including crashing the game."},"realm":"Shared and Menu","file":{"text":"lua/includes/util.lua","line":"2-L19"},"rets":{"ret":{"text":"The Lua registry.","name":"","type":"table"}}},"example":{"description":"Let's try to find the global table (_G) inside the registry (_R).","code":"local _R = debug.getregistry()\nMsgN(_R._LOADED._G) -- _LOADED contains most things ran in Lua, but there are all sorts of other interesting tables inside of the registry.\nMsgN(_R._LOADED._G == _G)","output":"```\ntable: 0xcece1d62\ntrue\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"getupvalue","parent":"debug","type":"libraryfunc","description":{"text":"Used for getting variable values in an index from the passed function. This does nothing for C functions.","deprecated":""},"realm":"Shared and Menu","args":{"arg":[{"text":"Function to get the upvalue indexed from.","name":"func","type":"function"},{"text":"The index in the upvalue array. The max number of entries can be found in debug.getinfo's \"nups\" key.","name":"index","type":"number"}]},"rets":{"ret":[{"text":"Name of the upvalue. Will be nil if the index was out of range (< 1 or > debug.getinfo.nups), or the function was defined in C.","name":"","type":"string"},{"text":"Value of the upvalue.","name":"","type":"any"}]}},"example":{"description":"Prints the upvalues of some local functions.","code":"local foo = 5\nlocal bar = \"hello\"\nlocal test = { \"table\", true, \"variable\" }\n\nlocal function DoSomethingWithFoo()\n\t-- This code won't be run but the function\n\t-- has to reference the variable for\n\t-- it to be counted as an upvalue\n\tfoo = foo + 1\nend\n\nlocal function DoSomethingWithFooAndBar()\n\tfoo = foo / 2\n\tbar = bar .. \" world\"\nend\n\nlocal function DoSomethingWithBarAndTest()\n\ttest[1] = bar .. \"reader!\"\nend\n\n\n-- level = stack level to get local variables of\n-- returns a table with string keys representing the variable name\nlocal function GetUpvalues( func )\n\tlocal info = debug.getinfo( func, \"uS\" )\n\tlocal variables = {}\n\n\t-- Upvalues can't be retrieved from C functions\n\tif ( info != nil && info.what == \"Lua\" ) then\n\t\tlocal upvalues = info.nups\n\n\t\tfor i = 1, upvalues do\n\t\t\tlocal key, value = debug.getupvalue( func, i )\n\t\t\tvariables[ key ] = value\n\t\tend\n\tend\n\n\treturn variables\nend\n\nprint( \"DoSomethingWithFoo:\" )\nPrintTable( GetUpvalues( DoSomethingWithFoo ) )\n\nprint( \"\\nDoSomethingWithFooAndBar:\" )\nPrintTable( GetUpvalues( DoSomethingWithFooAndBar ) )\n\nprint( \"\\nDoSomethingWithBarAndTest:\" )\nPrintTable( GetUpvalues( DoSomethingWithBarAndTest ) )","output":"```\nDoSomethingWithFoo:\nfoo\t=\t5\n\nDoSomethingWithFooAndBar:\nbar\t=\thello\nfoo\t=\t5\n\nDoSomethingWithBarAndTest:\nbar\t=\thello\ntest:\n\t\t1\t=\ttable\n\t\t2\t=\ttrue\n\t\t3\t=\tvariable\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"setfenv","parent":"debug","type":"libraryfunc","description":{"text":"Sets the environment of the passed object.  \n\nUnlike Global.setfenv, this also works on **any** userdata, allowing you to save data stored to it which can be accessed using debug.getfenv.  \nUserdata seem to intentionally support this & setting/changing it does not affect anything (though unused by gmod / Entities and such don't this)  \nThis can be useful when trying to store data on a IGModAudioChannel, Vector, Angle or any other that doesn't already allow you to store data on it.","deprecated":""},"realm":"Shared and Menu","args":{"arg":[{"text":"Object to set environment of. Valid types: userdata, thread, function.","name":"object","type":"any"},{"text":"Environment to set.","name":"env","type":"table"}]},"rets":{"ret":{"text":"The object.","name":"","type":"table"}}},"example":{"description":"Create a new environment and setfenv Display inside it.","code":"local newenvironment = {}\n\nfunction newenvironment.log( msg )\n\tprint( msg )\nend\n\nlocal function Display()\n\tlog( \"yay\" )\nend\n\ndebug.setfenv( Display , newenvironment )\n\nDisplay()","output":"```\nyay\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"sethook","parent":"debug","type":"libraryfunc","description":{"text":"Sets the given function as a Lua hook. This is completely different to gamemode hooks. The thread argument can be completely omitted and calling this function with no arguments will remove the current hook. This is used by default for infinite loop detection. More information on hooks can be found at http://www.lua.org/pil/23.2.html and https://www.gammon.com.au/scripts/doc.php?lua=debug.sethook\n\nHooks are not always ran when code that has been compiled by LuaJIT's JIT compiler is being executed, this is due to Intermediate Representation internally storing constantly running bytecode for performance reasons.","deprecated":""},"realm":"Shared and Menu","args":{"arg":[{"text":"Thread to set the hook on. This argument can be omitted.","name":"thread","type":"thread"},{"text":"Function for the hook to call. First argument in this function will be the mask event that called the hook as a full string (not as 'c' but instead as 'call').","name":"hook","type":"function"},{"text":"The hook's mask. Can be one or more of the following events: \n* c - Triggers the hook on each function call made from Lua.\n* r - Triggers the hook on each function return made from Lua.\n* l - Triggers the hook on each line compiled of code.","name":"mask","type":"string"},{"text":"How often to call the hook (in instructions). 0 for every instruction. Can be omitted.","name":"count","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"setlocal","parent":"debug","type":"libraryfunc","description":{"text":"Sets a local variable's value.","removed":"This function was removed due to security concerns."},"realm":"Shared and Menu","args":{"arg":[{"text":"The thread.","name":"thread","type":"thread","default":"Current Thread"},{"text":"The level above the thread.  \n\n0 is the function that was called (most always this function)'s arguments.\n\n1 is the thread that had called this function.\n\n2 is the thread that had called the function that started the thread that called this function.","name":"level","type":"number"},{"text":"The variable's index you want to get.\n\n1 = the first local defined in the thread.\n\n2 = the second local defined in the thread.","name":"index","type":"number"},{"text":"The value to set the local to.","name":"value","type":"any","default":"nil"}]},"rets":{"ret":{"text":"The name of the local variable if the local at the index exists, otherwise nil is returned.","name":"","type":"string"}}},"example":{"description":"Prints the local variables, sets them, then prints the variables again.","code":"local var1 = \"Luke, I am not your father.\"\nlocal var2 = \"PMFPMF\"\n\n(function()\n\tprint(\"Getting the locals now!\")\n\tPrintTable({debug.getlocal(2, 1)})\n\tPrintTable({debug.getlocal(2, 2)})\n\n\tprint(\"\\nSetting the locals now!\")\n\tprint(debug.setlocal(2, 1, \"I'm actually your mother.\"))\n\tprint(debug.setlocal(2, 2, \"Chemo-chi\"))\n\tprint(debug.setlocal(2, 3, \"nil should be returned here!\"))\n\n\tprint(\"\\nHere are the locals after being set!\")\n\tPrintTable({debug.getlocal(2, 1)})\n\tPrintTable({debug.getlocal(2, 2)})\nend)()","output":"```\nGetting the locals now!\n1\t=\tvar1\n2\t=\tLuke, I am not your father.\n1\t=\tvar2\n2\t=\tPMFPMF\n\nSetting the locals now!\nvar1\nvar2\nnil\n\nHere are the locals after being set!\n1\t=\tvar1\n2\t=\tI'm actually your mother.\n1\t=\tvar2\n2\t=\tChemo-chi\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"setmetatable","parent":"debug","type":"libraryfunc","description":{"text":"Sets the object's metatable. Unlike Global.setmetatable, this function works regardless of whether the first object passed is a valid table or not; this function even works on primitive datatypes such as numbers, functions, and even nil.","deprecated":""},"realm":"Shared and Menu","args":{"arg":[{"text":"Object to set the metatable for.","name":"object","type":"any"},{"text":"The metatable to set for the object.\nIf this argument is nil, then the object's metatable is removed.","name":"metatable","type":"table"}]},"rets":{"ret":{"text":"true if the object's metatable was set successfully.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"setupvalue","parent":"debug","type":"libraryfunc","description":{"text":"Sets the variable indexed from func.","removed":"This function was removed due to security concerns."},"realm":"Shared and Menu","args":{"arg":[{"text":"The function to index the upvalue from.","name":"func","type":"function"},{"text":"The index from func.","name":"index","type":"number"},{"text":"The value to set the upvalue to.","name":"val","type":"any","default":"nil"}]},"rets":{"ret":{"text":"Returns nil if there is no upvalue with the given index, otherwise it returns the upvalue's name.","name":"","type":"string"}}},"example":{"description":"An example demonstrating a function overwrite.","code":"local function my_isfunction(f)\n\treturn type(f) == \"function\" or f == \"coolguy\"\t\nend\n\nprint(debug.setupvalue(hook.Add, 1, my_isfunction))"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Trace","parent":"debug","type":"libraryfunc","description":"Prints out the lua function call stack to the console.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/debug.lua","line":"24-L51"}},"example":{"description":"Prints the current call stack.","code":"debug.Trace()","output":"```\nTrace: \n 1: Line 32 \"Trace\" lua/includes/extensions/debug.lua\n 2: Line 1 \"(null)\" LuaCmd\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"traceback","parent":"debug","type":"libraryfunc","description":{"text":"Returns a full execution stack trace.","deprecated":""},"realm":"Shared and Menu","args":{"arg":[{"text":"Thread (ie. error object from xpcall error handler) to build traceback for. If this argument is not set to a proper thread it will act as the next argument.","name":"thread","type":"thread","default":"current thread"},{"text":"Appended at the beginning of the traceback.","name":"message","type":"string","default":"nil"},{"text":"Which level to start the traceback.","name":"level","type":"number","default":"1"}]},"rets":{"ret":{"text":"A dump of the execution stack.","name":"","type":"string"}}},"example":[{"description":"Prints the traceback into console.","code":"print(debug.traceback())","output":"> print(debug.traceback())...\nstack traceback:\n```\n\n        lua_run:1: in main chunk\n```"},{"description":"Defines two functions that are later visible in the traceback. Enter \"lua_run TracebackTest()\" into the development console to achieve exact results.","code":"function TracebackTest()\n     AnotherTracebackFunction()\nend\n\nfunction AnotherTracebackFunction()\n     print(debug.traceback())\nend","output":"stack traceback:\n```\n\n        lua_run:1: in function 'AnotherTracebackFunction'\n        lua_run:1: in function 'TracebackTest'\n        lua_run:1: in main chunk\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"upvalueid","parent":"debug","type":"libraryfunc","description":{"text":"Returns an unique identifier for the upvalue indexed from func.","removed":"This function was removed due to security concerns."},"realm":"Shared and Menu","args":{"arg":[{"text":"The function to index the upvalue from.","name":"func","type":"function"},{"text":"The index from func.","name":"index","type":"number"}]},"rets":{"ret":{"text":"A unique identifier.","name":"","type":"number"}}},"example":{"description":"Small example showing the type of the returned data.","code":"print(type(debug.upvalueid(hook.Add, 1)))","output":"userdata"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"upvaluejoin","parent":"debug","type":"libraryfunc","description":{"text":"Makes an upvalue of `func1` refer to an upvalue of `func2`. Both functions provided must be Lua-defined, otherwise an error is thrown.","removed":"This function was removed due to security concerns."},"realm":"Shared and Menu","args":{"arg":[{"name":"func1","type":"function"},{"text":"The index of the upvalue in `func1`.","name":"upvalueIndex1","type":"number"},{"name":"func2","type":"function"},{"text":"The index of the upvalue in `func2`.","name":"upvalueIndex2","type":"number"}]}},"example":{"description":"Example code to demonstrate how the function works.","code":"local x = 5\nlocal y = 8\n\n-- 1st upvalue refers to 'x' local variable\n-- 2st upvalue refers to 'y' local variable\nlocal function Add()\n    return x + y\nend\n\nlocal z = 12\n\n-- 1st upvalue refers to 'z' local variable\n-- 2st upvalue refers to 'x' local variable\nlocal function Subtract()\n    return z - x\nend\n\nprint(Add()) -- Expected: 13\n\n--[[\n    Makes the 2nd upvalue of 'Add' refer to the 1st upvalue of 'Subtract'.\n\n    The 2nd upvalue of 'Add' is stil 'y', but the function will now use the\n    the 1st upvalue of 'Subtract' in its place.\n]]\ndebug.upvaluejoin(Add, 2, Subtract, 1)\n\nprint(Add()) -- Expected: 17\n\n-- Show that debug.upvaluejoin did not modify the values of the variables\nprint(x, y, z) -- Expected: 5, 8, 12","output":"```\n13\n17\n5       8       12\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Axis","parent":"debugoverlay","type":"libraryfunc","description":{"text":"Displays an axis indicator at the specified position, with 3 lines pointing in the positive direction (i.e. direction in which the values increase) of each axis.","note":"This function will silently fail if the `developer` ConVar is set to `0`.  \n\t\tIt is not networked to clients, except for the listen server host.  \n\t\tIt will not work when the game is paused."},"realm":"Shared","args":{"arg":[{"text":"Position origin.","name":"origin","type":"Vector"},{"text":"Angle of the axis.","name":"ang","type":"Angle"},{"text":"Size of the axis.","name":"size","type":"number"},{"text":"Number of seconds to appear.","name":"lifetime","type":"number","default":"1"},{"text":"If true, will draw on top of everything; ignoring the Z buffer.","name":"ignoreZ","type":"boolean","default":"false"}]}},"example":{"description":"Render the axis at the map origin, unrotated (`Angle(0, 0, 0)`).\n\nNote that the green line is pointing to the left, despite there not being an **Angle:Left** function. It operates per the [right hand rule](https://developer.valvesoftware.com/wiki/Coordinates).\n\nThe colors represent the direction it is pointing to:\n* **Red:** Points to `ang:Forward()`, positive X\n* **Green:** Points to `-ang:Right()`, \"left\" or \"negative right\", positive Y\n* **Blue:** Points to `ang:Up()`, positive Z","code":"local pos = Vector(0, 0, 0)\nlocal ang = Angle(0, 0, 0)\nlocal len = 30\nlocal lifetime = 5\nlocal size = 10\n\ndebugoverlay.Axis(pos, ang, size, lifetime, true)\ndebugoverlay.Cross(pos + ang:Forward() * len, size, lifetime, Color(255, 0, 0), true) -- Red\ndebugoverlay.Cross(pos - ang:Right()   * len, size, lifetime, Color(0, 255, 0), true) -- Green\ndebugoverlay.Cross(pos + ang:Up()      * len, size, lifetime, Color(0, 0, 255), true) -- Blue","output":{"upload":{"src":"70c/8de8e92ed4a599f.png","size":"391835","name":"image.png"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Box","parent":"debugoverlay","type":"libraryfunc","description":{"text":"Displays a solid coloured box at the specified position.","note":"This function will silently fail if the `developer` ConVar is set to `0`.  \nIt is not networked to clients, except for the listen server host.  \nIt will not work when the game is paused."},"realm":"Shared","args":{"arg":[{"text":"Position origin.","name":"origin","type":"Vector"},{"text":"Minimum bounds of the box.","name":"mins","type":"Vector"},{"text":"Maximum bounds of the box.","name":"maxs","type":"Vector"},{"text":"Number of seconds to appear.","name":"lifetime","type":"number","default":"1"},{"text":"The color of the box.","name":"color","type":"Color","default":"Color( 255, 255, 255, 255 )"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"BoxAngles","parent":"debugoverlay","type":"libraryfunc","description":{"text":"Displays a solid colored rotated box at the specified position.","note":"This function will silently fail if the `developer` ConVar is set to `0`.  \nIt is not networked to clients, except for the listen server host.  \nIt will not work when the game is paused."},"realm":"Shared","args":{"arg":[{"text":"World position.","name":"pos","type":"Vector"},{"text":"The mins of the box (lowest corner).","name":"mins","type":"Vector"},{"text":"The maxs of the box (highest corner).","name":"maxs","type":"Vector"},{"text":"The angle to draw the box at.","name":"ang","type":"Angle"},{"text":"Amount of seconds to show the box.","name":"lifetime","type":"number","default":"1"},{"text":"The color of the box.","name":"color","type":"Color","default":"Color( 255, 255, 255, 255 )"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Cross","parent":"debugoverlay","type":"libraryfunc","description":{"text":"Creates a coloured cross at the specified position for the specified time.","note":"This function will silently fail if the `developer` ConVar is set to `0`.  \nIt is not networked to clients, except for the listen server host.  \nIt will not work when the game is paused."},"realm":"Shared","args":{"arg":[{"text":"Position origin.","name":"position","type":"Vector"},{"text":"Size of the cross.","name":"size","type":"number"},{"text":"Number of seconds the cross will appear for.","name":"lifetime","type":"number","default":"1"},{"text":"The color of the cross.","name":"color","type":"Color","default":"Color( 255, 255, 255 )"},{"text":"If true, will draw on top of everything; ignoring the Z buffer.","name":"ignoreZ","type":"boolean","default":"false"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EntityTextAtPosition","parent":"debugoverlay","type":"libraryfunc","description":{"text":"Displays 2D text at the specified coordinates.","note":"This function will silently fail if the `developer` ConVar is set to `0`.  \nIt is not networked to clients, except for the listen server host.  \nIt will not work when the game is paused."},"realm":"Shared","args":{"arg":[{"text":"The position in 3D to display the text.","name":"pos","type":"Vector"},{"text":"Line of text, will offset text on the to display the new line unobstructed.","name":"line","type":"number"},{"text":"The text to display.","name":"text","type":"string"},{"text":"Number of seconds to appear.","name":"lifetime","type":"number","default":"1"},{"text":"The color of the box.","name":"color","type":"Color","default":"Color( 255, 255, 255 )"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Grid","parent":"debugoverlay","type":"libraryfunc","description":{"text":"Draws a 3D grid of limited size in given position.","note":"This function will silently fail if the `developer` ConVar is set to `0`.  \nIt is not networked to clients, except for the listen server host.  \nIt will not work when the game is paused."},"realm":"Shared","args":{"arg":{"name":"position","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Line","parent":"debugoverlay","type":"libraryfunc","description":{"text":"Displays a coloured line at the specified position.","note":"This function will silently fail if the `developer` ConVar is set to `0`.  \nIt is not networked to clients, except for the listen server host.  \nIt will not work when the game is paused."},"realm":"Shared","args":{"arg":[{"text":"First position of the line.","name":"pos1","type":"Vector"},{"text":"Second position of the line.","name":"pos2","type":"Vector"},{"text":"Number of seconds to appear.","name":"lifetime","type":"number","default":"1"},{"text":"The color of the line.","name":"color","type":"Color","default":"Color( 255, 255, 255 )"},{"text":"If true, will draw on top of everything; ignoring the Z buffer.","name":"ignoreZ","type":"boolean","default":"false"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ScreenText","parent":"debugoverlay","type":"libraryfunc","description":{"text":"Displays text triangle at the specified coordinates.","note":"This function will silently fail if the `developer` ConVar is set to `0`.  \nIt is not networked to clients, except for the listen server host.  \nIt will not work when the game is paused."},"realm":"Shared","args":{"arg":[{"text":"The position of the text, from 0 ( left ) to 1 ( right ).","name":"x","type":"number"},{"text":"The position of the text, from 0 ( top ) to 1 ( bottom ).","name":"y","type":"number"},{"text":"The text to display.","name":"text","type":"string"},{"text":"Number of seconds to appear.","name":"lifetime","type":"number","default":"1"},{"text":"The color of the box.","name":"color","type":"Color","default":"Color( 255, 255, 255 )"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Sphere","parent":"debugoverlay","type":"libraryfunc","description":{"text":"Displays a coloured sphere at the specified position.","note":"This function will silently fail if the `developer` ConVar is set to `0`.  \nIt is not networked to clients, except for the listen server host.  \nIt will not work when the game is paused."},"realm":"Shared","args":{"arg":[{"text":"Position origin.","name":"origin","type":"Vector"},{"text":"Size of the sphere.","name":"size","type":"number"},{"text":"Number of seconds to appear.","name":"lifetime","type":"number","default":"1"},{"text":"The color of the sphere.","name":"color","type":"Color","default":"Color( 255, 255, 255 )"},{"text":"If true, will draw on top of everything; ignoring the Z buffer.","name":"ignoreZ","type":"boolean","default":"false"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SweptBox","parent":"debugoverlay","type":"libraryfunc","description":{"text":"Displays \"swept\" box, two boxes connected with lines by their vertices.","note":"This function will silently fail if the `developer` ConVar is set to `0`.  \nIt is not networked to clients, except for the listen server host.  \nIt will not work when the game is paused."},"realm":"Shared","args":{"arg":[{"text":"The start position of the box.","name":"vStart","type":"Vector"},{"text":"The end position of the box.","name":"vEnd","type":"Vector"},{"text":"The \"minimum\" edge of the box.","name":"vMins","type":"Vector"},{"text":"The \"maximum\" edge of the box.","name":"vMaxs","type":"Vector"},{"text":"The angle to draw the box at.","name":"ang","type":"Angle"},{"text":"Number of seconds to appear.","name":"lifetime","type":"number","default":"1"},{"text":"The color of the box.","name":"color","type":"Color","default":"Color( 255, 255, 255 )"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Text","parent":"debugoverlay","type":"libraryfunc","description":{"text":"Displays text at the specified position.","note":"This function will silently fail if the `developer` ConVar is set to `0`.  \nIt is not networked to clients, except for the listen server host.  \nIt will not work when the game is paused."},"realm":"Shared","args":{"arg":[{"text":"Position origin.","name":"origin","type":"Vector"},{"text":"String message to display.","name":"text","type":"string"},{"text":"Number of seconds to appear.","name":"lifetime","type":"number","default":"1"},{"text":"Clip text that is obscured.","name":"viewCheck","type":"boolean","default":"false"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Triangle","parent":"debugoverlay","type":"libraryfunc","description":{"text":"Displays a colored triangle at the specified coordinates.","note":"This function will silently fail if the `developer` ConVar is set to `0`.  \nIt is not networked to clients, except for the listen server host.  \nIt will not work when the game is paused."},"realm":"Shared","args":{"arg":[{"text":"First point of the triangle.","name":"pos1","type":"Vector"},{"text":"Second point of the triangle.","name":"pos2","type":"Vector"},{"text":"Third point of the triangle.","name":"pos3","type":"Vector"},{"text":"Number of seconds to appear.","name":"lifetime","type":"number","default":"1"},{"text":"The color of the box.","name":"color","type":"Color","default":"Color( 255, 255, 255 )"},{"text":"If true, will draw on top of everything; ignoring the Z buffer.","name":"ignoreZ","type":"boolean","default":"false"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Controls","parent":"derma","type":"libraryfield","description":"This is NOT a function, it's a variable containing all derma controls, registered with derma.DefineControl.\n\nUse derma.GetControlList to retrieve this list.\n\nIt's a list of tables, each having 3 keys, all from derma.DefineControl arguments:\n* string ClassName - The class name of the panel.\n* string Description - The description of the panel.\n* string BaseClass - The base class of the panel.","realm":"Client and Menu","rets":{"ret":{"text":"The list of all registered derma controls.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SkinList","parent":"derma","type":"libraryfield","description":"This is NOT a function, it's a variable containing all registered via derma.DefineSkin derma skins.","realm":"Client and Menu","rets":{"ret":{"text":"The list of all registered derma skins.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Color","parent":"derma","type":"libraryfunc","description":"Gets the color from a Derma skin of a panel and returns default color if not found.","realm":"Client and Menu","file":{"text":"lua/derma/derma.lua","line":"222-L229"},"args":{"arg":[{"name":"name","type":"string"},{"name":"pnl","type":"Panel"},{"text":"The default Color in case of failure.","name":"default","type":"Color"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DefineControl","parent":"derma","type":"libraryfunc","description":"Defines a new Derma control with an optional base.\n\nThis calls vgui.Register internally, but also does the following:\n* Adds the control to derma.GetControlList\n* Adds a key \"Derma\" - This is returned by derma.GetControlList\n* Makes a global table with the name of the control (This is technically deprecated and should not be relied upon)\n* If reloading (i.e. called this function with name of an existing panel), updates all existing instances of panels with this name. (Updates functions, calls PANEL:PreAutoRefresh and PANEL:PostAutoRefresh, etc.)","realm":"Client and Menu","file":{"text":"lua/derma/derma.lua","line":"99-L127"},"args":{"arg":[{"text":"Name of the newly created control.","name":"name","type":"string"},{"text":"Description of the control.","name":"description","type":"string"},{"text":"Table containing control methods and properties.","name":"tab","type":"table"},{"text":"Derma control to base the new control off of.","name":"base","type":"string"}]},"rets":{"ret":{"text":"A table containing the new control's methods and properties.","name":"","type":"table"}}},"example":{"description":"Defines a new control based off of DTextEntry that prints to the console whenever it is changed.","code":"local PANEL = {}\n\nfunction PANEL:OnChange()\n    print(self:GetValue())\nend\n\nderma.DefineControl(\"MyTextEntry\", \"Printing text entry control\", PANEL, \"DTextEntry\")"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DefineSkin","parent":"derma","type":"libraryfunc","description":"Defines a new skin so that it is usable by Derma. The default skin can be found in `garrysmod/lua/skins/default.lua`.","realm":"Client and Menu","file":{"text":"lua/derma/derma.lua","line":"132-L149"},"args":{"arg":[{"text":"Name of the skin.","name":"name","type":"string"},{"text":"Description of the skin.","name":"descriptions","type":"string"},{"text":"Table containing skin data.","name":"skin","type":"table"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetControlList","parent":"derma","type":"libraryfunc","description":"Returns the derma.Controls table, a list of all derma controls registered with derma.DefineControl.","realm":"Client and Menu","file":{"text":"lua/derma/derma.lua","line":"90-L94"},"rets":{"ret":{"text":"A listing of all available derma-based controls. See derma.Controls for structure and contents.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDefaultSkin","parent":"derma","type":"libraryfunc","description":"Returns the default skin table, which can be changed with the hook GM:ForceDermaSkin.","realm":"Client and Menu","file":{"text":"lua/derma/derma.lua","line":"163-L178"},"rets":{"ret":{"text":"The default skin table.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetNamedSkin","parent":"derma","type":"libraryfunc","description":"Returns the skin table of the skin with the supplied name.","realm":"Client and Menu","file":{"text":"lua/derma/derma.lua","line":"183-L187"},"args":{"arg":{"text":"Name of skin.","name":"name","type":"string"}},"rets":{"ret":{"text":"The skin table.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSkinTable","parent":"derma","type":"libraryfunc","description":"Returns a copy of the table containing every Derma skin.","realm":"Client and Menu","file":{"text":"lua/derma/derma.lua","line":"154-L158"},"rets":{"ret":{"text":"Table of every Derma skin.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"RefreshSkins","parent":"derma","type":"libraryfunc","description":"Clears all cached panels so that they reassess which skin they should be using.","realm":"Client and Menu","file":{"text":"lua/derma/derma.lua","line":"243-L247"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SkinChangeIndex","parent":"derma","type":"libraryfunc","description":"Returns how many times derma.RefreshSkins has been called.","realm":"Client and Menu","file":{"text":"lua/derma/derma.lua","line":"234-L238"},"rets":{"ret":{"text":"Amount of times derma.RefreshSkins has been called.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SkinHook","parent":"derma","type":"libraryfunc","description":"Checks if a matching hook function exists in the skin _(based on the concatenation of type and name args)_, then calls it. \n\nThis function is used dynamically inside Global.Derma_Hook.","realm":"Client and Menu","file":{"text":"lua/derma/derma.lua","line":"187-L200"},"args":{"arg":[{"text":"The type of hook to run, usually `Paint`.","name":"type","type":"string"},{"text":"The name of the hook/panel to run. Example: `Button`.","name":"name","type":"string"},{"text":"The panel to call the hook for.","name":"panel","type":"Panel"},{"text":"First parameter for the panel hook. i.e. width of the panel for.Paint hooks.","name":"vararg1","type":"any","default":"nil"},{"text":"Second parameter for the panel hook. i.e. height of the panel for.Paint hooks.","name":"vararg2","type":"any","default":"nil"}]},"rets":{"ret":{"text":"The returned variable from the skin hook.","name":"","type":"any"}}},"example":{"name":"Basic Usage","description":"Example usage from `dbutton.lua`.","code":[{"text":"function PANEL:Paint( w, h )\n\tderma.SkinHook( \"Paint\", \"Button\", self, w, h )\n\t...\nend","name":"dbutton's paint function"},{"text":"function SKIN:PaintButton( panel, w, h )\n\t...\nend","name":"Resulting function call in default skin"}]},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SkinTexture","parent":"derma","type":"libraryfunc","description":"Returns a function to draw a specified texture of panels skin.\n\nThese are usually generated via GWEN.CreateTextureBorder and similar.","realm":"Client and Menu","file":{"text":"lua/derma/derma.lua","line":"207-L217"},"args":{"arg":[{"text":"The identifier of the texture.","name":"name","type":"string"},{"text":"Panel to get the skin of.","name":"pnl","type":"Panel"},{"text":"What to return if we failed to retrieve the texture.","name":"fallback","type":"function","alttype":"any","default":"nil"}]},"rets":{"ret":{"text":"A function that is created with the GWEN library to draw a texture.","name":"","type":"function","callback":{"arg":[{"text":"X coordinate for the box.","name":"x","type":"number"},{"text":"Y coordinate for the box.","name":"y","type":"number"},{"text":"Width of the box.","name":"w","type":"number"},{"text":"Height of the box.","name":"h","type":"number"},{"text":"Optional color, default is white.","name":"clr","type":"Color","default":"color_white"}]}}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CallReceiverFunction","parent":"dragndrop","type":"libraryfunc","description":{"text":"Calls the receiver function of hovered panel.","internal":""},"realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"175-L192"},"args":{"arg":[{"text":"true if the mouse was released, false if we right clicked.","name":"bDoDrop","type":"boolean"},{"text":"The command value. This should be the ID of the clicked dropdown menu ( if right clicked, or nil ).","name":"command","type":"number"},{"text":"The local to the panel mouse cursor X position when the click happened.","name":"mx","type":"number"},{"text":"The local to the panel  mouse cursor Y position when the click happened.","name":"my","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Clear","parent":"dragndrop","type":"libraryfunc","description":"Clears all the internal drag'n'drop variables.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"6-L19"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Drop","parent":"dragndrop","type":"libraryfunc","description":{"text":"Handles the drop action of drag'n'drop library.","internal":""},"realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"37-L76"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDroppable","parent":"dragndrop","type":"libraryfunc","description":"Returns a table of currently dragged panels.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"162-L173"},"args":{"arg":{"text":"If set, the function will return only the panels with this Panel:Droppable name.","name":"name","type":"string","default":"nil"}},"rets":{"ret":{"text":"A table of all panels that are being currently dragged, if any.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"HandleDroppedInGame","parent":"dragndrop","type":"libraryfunc","description":"Allows you to capture the panel that was dropped into the game (dropped onto the root panel). This function is meant to be overridden.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"29-L35"}},"example":{"code":"dragndrop.HandleDroppedInGame = function()\n\tprint(\"This panel was dropped inside the game:\", dragndrop.m_DraggingMain)\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"HoverThink","parent":"dragndrop","type":"libraryfunc","description":{"text":"Handles the hover think. Called from dragndrop.Think.","internal":""},"realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"557-L581"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsDragging","parent":"dragndrop","type":"libraryfunc","description":"Returns whether the user is dragging something with the drag'n'drop system.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"21-L27"},"rets":{"ret":{"text":"True if the user is dragging something with the drag'n'drop system.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"StartDragging","parent":"dragndrop","type":"libraryfunc","description":{"text":"Starts the drag'n'drop.","internal":""},"realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"78-L111"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"StopDragging","parent":"dragndrop","type":"libraryfunc","description":"Stops the drag'n'drop and calls dragndrop.Clear.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"113-L129"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Think","parent":"dragndrop","type":"libraryfunc","description":{"text":"Handles all the drag'n'drop processes. Calls dragndrop.UpdateReceiver and dragndrop.HoverThink.","internal":""},"realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"194-L231"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateReceiver","parent":"dragndrop","type":"libraryfunc","description":{"text":"Updates the receiver to drop the panels onto. Called from dragndrop.Think.","internal":""},"realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"131-L157"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DrawText","parent":"draw","type":"libraryfunc","description":{"text":"Simple draw text at position, but this will expand newlines and tabs.\n\n\n\nSee also MarkupObject for limited width and markup support.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu","file":{"text":"lua/includes/modules/draw.lua","line":"119-L160"},"args":{"arg":[{"text":"Text to be drawn.","name":"text","type":"string"},{"text":"Name of font to draw the text in. See surface.CreateFont to create your own, or Default Fonts for a list of default fonts.","name":"font","type":"string","default":"DermaDefault"},{"text":"The X Coordinate.","name":"x","type":"number","default":"0"},{"text":"The Y Coordinate.","name":"y","type":"number","default":"0"},{"text":"Color to draw the text in. Uses Color.","name":"color","type":"Color","default":"Color( 255, 255, 255, 255 )"},{"text":"Where to align the text horizontally. Uses the Enums/TEXT_ALIGN.","name":"xAlign","type":"number","default":"TEXT_ALIGN_LEFT"}]}},"example":{"description":"Makes a message saying `Hello there!` pop up in the center of your screen.","code":"hook.Add( \"HUDPaint\", \"HelloThere\", function() \n\tdraw.DrawText( \"Hello there!\", \"TargetID\", ScrW() * 0.5, ScrH() * 0.25, color_white, TEXT_ALIGN_CENTER )\nend )","output":"```\nHello there!\n```"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetFontHeight","parent":"draw","type":"libraryfunc","description":{"text":"Returns the height of the specified font in pixels. This is equivalent to the height of the character `W`. See surface.GetTextSize.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu","file":{"text":"lua/includes/modules/draw.lua","line":"33-L49"},"args":{"arg":{"text":"Name of the font to get the height of.","name":"font","type":"string"}},"rets":{"ret":{"text":"The font height.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"NoTexture","parent":"draw","type":"libraryfunc","description":{"text":"Sets drawing texture to a default white texture (vgui/white) via surface.SetMaterial. Useful for resetting the drawing texture.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu","file":{"text":"lua/includes/modules/draw.lua","line":"312-L314"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"RoundedBox","parent":"draw","type":"libraryfunc","description":{"text":"Draws a rounded rectangle.","note":"This function actually draws rectangles with 'gui/cornerX' textures applied to it's rounded corners. It means that this function will fail (or will be drawn not as expected) with any vertex operations, such as model matrices like cam.Start3D2D (corners would be pixelated) or stencil operations. Consider using surface.DrawPoly or mesh library","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu","file":{"text":"lua/includes/modules/draw.lua","line":"162-L171"},"args":{"arg":[{"text":"Radius of the rounded corners, works best with a multiple of 2.\n\nFor values 0 or below, surface.DrawRect will be used instead for performance.","name":"cornerRadius","type":"number"},{"text":"The x coordinate of the top left of the rectangle.","name":"x","type":"number"},{"text":"The y coordinate of the top left of the rectangle.","name":"y","type":"number"},{"text":"The width of the rectangle.","name":"width","type":"number"},{"text":"The height of the rectangle.","name":"height","type":"number"},{"text":"The color to fill the rectangle with. Uses the Color.","name":"color","type":"Color"}]}},"example":{"code":"hook.Add(\"HUDPaint\", \"DrawARoundedBox\", function()\n\tdraw.RoundedBox( 4, 50, 50, 100, 100, Color( 255, 255, 255 ) )\nend)"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"RoundedBoxEx","parent":"draw","type":"libraryfunc","description":{"text":"Draws a rounded rectangle. This function also lets you specify which corners are drawn rounded.","note":"This function actually draws rectangles with 'gui/cornerX' textures applied to it's rounded corners. It means that this function will fail (or will be drawn not as expected) with any vertex operations, such as model matrices like cam.Start3D2D (corners would be pixelated) or stencil operations. Consider using surface.DrawPoly or mesh library","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu","file":{"text":"lua/includes/modules/draw.lua","line":"173-L231"},"args":{"arg":[{"text":"Radius of the rounded corners, works best with a power of 2 number.","name":"cornerRadius","type":"number"},{"text":"The x coordinate of the top left of the rectangle.","name":"x","type":"number"},{"text":"The y coordinate of the top left of the rectangle.","name":"y","type":"number"},{"text":"The width of the rectangle.","name":"width","type":"number"},{"text":"The height of the rectangle.","name":"height","type":"number"},{"text":"The color to fill the rectangle with. Uses the Color.","name":"color","type":"Color"},{"text":"Whether the top left corner should be rounded.","name":"roundTopLeft","type":"boolean","default":"false"},{"text":"Whether the top right corner should be rounded.","name":"roundTopRight","type":"boolean","default":"false"},{"text":"Whether the bottom left corner should be rounded.","name":"roundBottomLeft","type":"boolean","default":"false"},{"text":"Whether the bottom right corner should be rounded.","name":"roundBottomRight","type":"boolean","default":"false"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SimpleText","parent":"draw","type":"libraryfunc","description":{"text":"Draws text on the screen.","note":"This function does not handle newlines properly. See draw.DrawText for a function that does.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu","file":{"text":"lua/includes/modules/draw.lua","line":"51-L94"},"args":{"arg":[{"text":"The text to be drawn.","name":"text","type":"string"},{"text":"The font. See surface.CreateFont to create your own, or see Default Fonts for a list of default fonts.","name":"font","type":"string","default":"DermaDefault"},{"text":"The X Coordinate.","name":"x","type":"number","default":"0"},{"text":"The Y Coordinate.","name":"y","type":"number","default":"0"},{"text":"The color of the text.","name":"color","type":"Color","default":"Color( 255, 255, 255, 255 )"},{"text":"The alignment of the X coordinate using Enums/TEXT_ALIGN.","name":"xAlign","type":"number","default":"TEXT_ALIGN_LEFT"},{"text":"The alignment of the Y coordinate using Enums/TEXT_ALIGN.","name":"yAlign","type":"number","default":"TEXT_ALIGN_TOP"}]},"rets":{"ret":[{"text":"The width of the text. Same value as if you were calling surface.GetTextSize.","name":"","type":"number"},{"text":"The height of the text. Same value as if you were calling surface.GetTextSize.","name":"","type":"number"}]}},"example":{"description":"Example usage:","code":"hook.Add( \"HUDPaint\", \"HelloThere\", function()\n\tdraw.SimpleText( \"Hello there!\", \"DermaDefault\", 50, 50, color_white )\nend )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SimpleTextOutlined","parent":"draw","type":"libraryfunc","description":{"text":"Creates a simple line of text that is outlined.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu","file":{"text":"lua/includes/modules/draw.lua","line":"96-L114"},"args":{"arg":[{"text":"The text to draw.","name":"Text","type":"string"},{"text":"The font name to draw with. See surface.CreateFont to create your own, or here for a list of default fonts.","name":"font","type":"string","default":"DermaDefault"},{"text":"The X Coordinate.","name":"x","type":"number","default":"0"},{"text":"The Y Coordinate.","name":"y","type":"number","default":"0"},{"text":"The color of the text.","name":"color","type":"Color","default":"Color( 255, 255, 255, 255 )"},{"text":"The alignment of the X Coordinate using Enums/TEXT_ALIGN.","name":"xAlign","type":"number","default":"TEXT_ALIGN_LEFT"},{"text":"The alignment of the Y Coordinate using Enums/TEXT_ALIGN.","name":"yAlign","type":"number","default":"TEXT_ALIGN_TOP"},{"text":"Width of the outline.","name":"outlinewidth","type":"number"},{"text":"Color of the outline. Uses the Color.","name":"outlinecolor","type":"Color","default":"Color( 255, 255, 255, 255 )"}]},"rets":{"ret":[{"text":"The width of the text. Same value as if you were calling surface.GetTextSize.","name":"","type":"number"},{"text":"The height of the text. Same value as if you were calling surface.GetTextSize.","name":"","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Text","parent":"draw","type":"libraryfunc","description":{"text":"Works like draw.SimpleText but uses a table structure instead.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu","file":{"text":"lua/includes/modules/draw.lua","line":"269-L273"},"args":{"arg":{"text":"The text properties. See the Structures/TextData","name":"textdata","type":"table"}},"rets":{"ret":[{"text":"Width of drawn text.","name":"","type":"number"},{"text":"Height of drawn text.","name":"","type":"number"}]}},"example":{"description":"Example usage","code":"hook.Add( \"HUDPaint\", \"drawTextExample\", function()\n\tdraw.Text( {\n\t\ttext = \"test\",\n\t\tpos = { 50, 50 }\n\t} )\nend )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"TextShadow","parent":"draw","type":"libraryfunc","description":{"text":"Works like draw.Text, but draws the text with a shadow.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu","file":{"text":"lua/includes/modules/draw.lua","line":"279-L295"},"args":{"arg":[{"text":"The text properties. See Structures/TextData.","name":"textdata","type":"table"},{"text":"How far away the shadow appears.","name":"distance","type":"number"},{"text":"How visible the shadow is (0-255).","name":"alpha","type":"number","default":"200"}]},"rets":{"ret":[{"text":"The width of drawn text.","name":"textWidth","type":"number"},{"text":"The height of drawn text.","name":"textHeight","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"TexturedQuad","parent":"draw","type":"libraryfunc","description":{"text":"Draws a texture with a table structure.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu","file":{"text":"lua/includes/modules/draw.lua","line":"302-L310"},"args":{"arg":{"text":"The texture properties. See Structures/TextureData.","name":"texturedata","type":"table"}}},"example":{"description":"Example usage with a random texture.","code":"local texturedQuadStructure = {\n\ttexture = surface.GetTextureID( \"phoenix_storms/amraam\" ),\n\tcolor   = Color( 255, 0, 255, 255 ),\n\tx \t= 0,\n\ty \t= 0,\n\tw \t= 512,\n\th \t= 512\n}\n\ndraw.TexturedQuad( texturedQuadStructure )","output":"Renders the texture."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"WordBox","parent":"draw","type":"libraryfunc","description":{"text":"Draws a rounded box with text in it.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu","file":{"text":"lua/includes/modules/draw.lua","line":"238-L263"},"args":{"arg":[{"text":"Size of border, should be multiple of 2. Ideally this will be 8 or 16.","name":"bordersize","type":"number"},{"text":"The X Coordinate.","name":"x","type":"number"},{"text":"The Y Coordinate.","name":"y","type":"number"},{"text":"Text to draw.","name":"text","type":"string"},{"text":"Font to draw in. See surface.CreateFont to create your own, or here for a list of default fonts.","name":"font","type":"string"},{"text":"The box color. Uses Color.","name":"boxcolor","type":"Color"},{"text":"The text color. Uses Color.","name":"textcolor","type":"Color"},{"text":"The alignment of the X coordinate using Enums/TEXT_ALIGN.","name":"xalign","type":"number","default":"TEXT_ALIGN_LEFT"},{"text":"The alignment of the Y coordinate using Enums/TEXT_ALIGN.","name":"yalign","type":"number","default":"TEXT_ALIGN_TOP"}]},"rets":{"ret":[{"text":"The width of the word box.","name":"","type":"number"},{"text":"The height of the word box.","name":"","type":"number"}]}},"example":{"description":"Draws several boxes showing the effect of the alignment arguments.","code":"hook.Add( \"HUDPaint\", \"HUDPaint_DrawABox2\", function()\n\n\tsurface.SetDrawColor( Color( 255, 255, 255 ) )\n\tsurface.DrawLine( 100, 50, 100, 250 )\n\n\tdraw.WordBox( 4, 100, 100, \"Example word box\", \"DermaDefault\", Color( 128, 128, 128 ), Color( 255, 255, 255 ) )\n\tdraw.WordBox( 4, 100, 150, \"Example word box\", \"DermaDefault\", Color( 128, 128, 128 ), Color( 255, 255, 255 ), TEXT_ALIGN_CENTER )\n\tdraw.WordBox( 4, 100, 200, \"Example word box\", \"DermaDefault\", Color( 128, 128, 128 ), Color( 255, 255, 255 ), TEXT_ALIGN_RIGHT )\n\n\tsurface.SetDrawColor( Color( 255, 255, 255 ) )\n\tsurface.DrawLine( 250, 150, 650, 150 )\n\n\tdraw.WordBox( 4, 300, 150, \"Example word box\", \"DermaDefault\", Color( 128, 128, 128 ), Color( 255, 255, 255 ), nil )\n\tdraw.WordBox( 4, 400, 150, \"Example word box\", \"DermaDefault\", Color( 128, 128, 128 ), Color( 255, 255, 255 ), nil, TEXT_ALIGN_CENTER )\n\tdraw.WordBox( 4, 500, 150, \"Example word box\", \"DermaDefault\", Color( 128, 128, 128 ), Color( 255, 255, 255 ), nil, TEXT_ALIGN_BOTTOM )\n\nend )","output":{"upload":{"src":"70c/8d934bcd64db30d.png","size":"23849","name":"image.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CalcView","parent":"drive","type":"libraryfunc","description":{"text":"Used internally to make DRIVE:CalcView work, called by default from `base` gamemode's GM:CalcView hook.","internal":""},"realm":"Shared","file":{"text":"lua/includes/modules/drive.lua","line":"154-L162"},"args":{"arg":[{"text":"The player.","name":"ply","type":"Player"},{"text":"The view, see Structures/ViewData.","name":"view","type":"table{ViewData}"}]},"rets":{"ret":{"text":"True if succeeded.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CreateMove","parent":"drive","type":"libraryfunc","description":{"text":"Clientside, the client creates the cmd (usercommand) from their input device (mouse, keyboard) and then it's sent to the server. Restrict view angles here.","internal":""},"realm":"Shared","file":{"text":"lua/includes/modules/drive.lua","line":"141-L149"},"args":{"arg":{"text":"The user command.","name":"cmd","type":"CUserCmd"}},"rets":{"ret":{"text":"True if succeeded.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DestroyMethod","parent":"drive","type":"libraryfunc","description":{"text":"Destroys players current driving method.","internal":""},"realm":"Shared","file":{"text":"lua/includes/modules/drive.lua","line":"103-L109"},"args":{"arg":{"text":"The player to affect.","name":"ply","type":"Player"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"End","parent":"drive","type":"libraryfunc","description":"Player has stopped driving the entity.","realm":"Shared","file":{"text":"lua/includes/modules/drive.lua","line":"214-L240"},"args":{"arg":[{"text":"The player.","name":"ply","type":"Player"},{"text":"The entity.","name":"ent","type":"Entity"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"FinishMove","parent":"drive","type":"libraryfunc","description":{"text":"The move is finished. Copy mv back into the target.","internal":""},"realm":"Shared","file":{"text":"lua/includes/modules/drive.lua","line":"196-L209"},"args":{"arg":[{"text":"The player.","name":"ply","type":"Player"},{"text":"The move data.","name":"mv","type":"CMoveData"}]},"rets":{"ret":{"text":"True if succeeded.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMethod","parent":"drive","type":"libraryfunc","description":{"text":"Returns ( or creates if inexistent ) a driving method.","internal":""},"realm":"Shared","file":{"text":"lua/includes/modules/drive.lua","line":"56-L101"},"args":{"arg":{"text":"The player.","name":"ply","type":"Player"}},"rets":{"ret":{"text":"A method object.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Move","parent":"drive","type":"libraryfunc","description":{"text":"The move is executed here.","internal":""},"realm":"Shared","file":{"text":"lua/includes/modules/drive.lua","line":"183-L191"},"args":{"arg":[{"text":"The player.","name":"ply","type":"Player"},{"text":"The move data.","name":"mv","type":"CMoveData"}]},"rets":{"ret":{"text":"True if succeeded.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayerStartDriving","parent":"drive","type":"libraryfunc","description":"Starts driving for the player.","realm":"Shared","file":{"text":"lua/includes/modules/drive.lua","line":"39-L48"},"args":{"arg":[{"text":"The player to affect.","name":"ply","type":"Player"},{"text":"The entity to drive.","name":"ent","type":"Entity"},{"text":"The driving mode.","name":"mode","type":"string"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayerStopDriving","parent":"drive","type":"libraryfunc","description":"Stops the player from driving anything. ( For example a prop in sandbox )","realm":"Shared","file":{"text":"lua/includes/modules/drive.lua","line":"50-L54"},"args":{"arg":{"text":"The player to affect.","name":"ply","type":"Player"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Register","parent":"drive","type":"libraryfunc","description":"Registers a new entity drive mode/method.","realm":"Shared","file":{"text":"lua/includes/modules/drive.lua","line":"14-L37"},"args":{"arg":[{"text":"The name of the drive mode/method.","name":"name","type":"string"},{"text":"The data required to create the drive mode/method. This includes the functions used by the drive. See DRIVE_Hooks.","name":"data","type":"table"},{"text":"The name of a drive mode/method to inherit code from.","name":"base","type":"string","default":"nil"}]}},"example":{"description":"Adds a noclip drive type.","code":"drive.Register( \"drive_noclip\", \n{\n\t--\n\t-- Called before each move. You should use your entity and cmd to \n\t-- fill mv with information you need for your move.\n\t--\n\tStartMove =  function( self, mv, cmd )\n\n\t\t--\n\t\t-- Update move position and velocity from our entity\n\t\t--\n\t\tmv:SetOrigin( self.Entity:GetNetworkOrigin() )\n\t\tmv:SetVelocity( self.Entity:GetAbsVelocity() )\n\n\tend,\n\n\t--\n\t-- Runs the actual move. On the client when there's \n\t-- prediction errors this can be run multiple times.\n\t-- You should try to only change mv.\n\t--\n\tMove = function( self, mv )\n\n\t\t--\n\t\t-- Set up a speed, go faster if shift is held down\n\t\t--\n\t\tlocal speed = 0.0005 * FrameTime()\n\t\tif ( mv:KeyDown( IN_SPEED ) ) then speed = 0.005 * FrameTime() end\n\n\t\t--\n\t\t-- Get information from the movedata\n\t\t--\n\t\tlocal ang = mv:GetMoveAngles()\n\t\tlocal pos = mv:GetOrigin()\n\t\tlocal vel = mv:GetVelocity()\n\n\t\t--\n\t\t-- Add velocities. This can seem complicated. On the first line\n\t\t-- we're basically saying get the forward vector, then multiply it\n\t\t-- by our forward speed (which will be > 0 if we're holding W, < 0 if we're\n\t\t-- holding S and 0 if we're holding neither) - and add that to velocity.\n\t\t-- We do that for right and up too, which gives us our free movement.\n\t\t--\n\t\tvel = vel + ang:Forward() * mv:GetForwardSpeed() * speed\n\t\tvel = vel + ang:Right() * mv:GetSideSpeed() * speed\n\t\tvel = vel + ang:Up() * mv:GetUpSpeed() * speed\n\n\t\t--\n\t\t-- We don't want our velocity to get out of hand so we apply\n\t\t-- a little bit of air resistance. If no keys are down we apply\n\t\t-- more resistance so we slow down more.\n\t\t--\n\t\tif ( math.abs(mv:GetForwardSpeed()) + math.abs(mv:GetSideSpeed()) + math.abs(mv:GetUpSpeed()) < 0.1 ) then\n\t\t\tvel = vel * 0.90\n\t\telse\n\t\t\tvel = vel * 0.99\n\t\tend\n\n\t\t--\n\t\t-- Add the velocity to the position (this is the movement)\n\t\t--\n\t\tpos = pos + vel\n\n\t\t--\n\t\t-- We don't set the newly calculated values on the entity itself\n\t\t-- we instead store them in the movedata. These get applied in FinishMove.\n\t\t--\n\t\tmv:SetVelocity( vel )\n\t\tmv:SetOrigin( pos )\n\n\tend,\n\n\t--\n\t-- The move is finished. Use mv to set the new positions\n\t-- on your entities/players.\n\t--\n\tFinishMove =  function( self, mv )\n\n\t\t--\n\t\t-- Update our entity!\n\t\t--\n\t\tself.Entity:SetNetworkOrigin( mv:GetOrigin() )\n\t\tself.Entity:SetAbsVelocity( mv:GetVelocity() )\n\t\tself.Entity:SetAngles( mv:GetMoveAngles() )\n\n\t\t--\n\t\t-- If we have a physics object update that too. But only on the server.\n\t\t--\n\t\tif ( SERVER && IsValid( self.Entity:GetPhysicsObject() ) ) then\n\n\t\t\tself.Entity:GetPhysicsObject():EnableMotion( true )\n\t\t\tself.Entity:GetPhysicsObject():SetPos( mv:GetOrigin() );\n\t\t\tself.Entity:GetPhysicsObject():Wake()\n\t\t\tself.Entity:GetPhysicsObject():EnableMotion( false )\n\n\t\tend\n\n\tend,\n\n\t--\n\t-- Calculates the view when driving the entity\n\t--\n\tCalcView =  function( self, view )\n\n\t\t--\n\t\t-- Use the utility method on drive_base.lua to give us a 3rd person view\n\t\t--\n\t\tlocal idealdist = math.max( 10, self.Entity:BoundingRadius() ) * 4\n\n\t\tself:CalcView_ThirdPerson( view, idealdist, 2, { self.Entity } )\n\n\tend,\n\n}, \"drive_base\" );"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Start","parent":"drive","type":"libraryfunc","description":"Called when the player first starts driving this entity.","realm":"Shared","file":{"text":"lua/includes/modules/drive.lua","line":"114-L134"},"args":{"arg":[{"text":"The player.","name":"ply","type":"Player"},{"text":"The entity.","name":"ent","type":"Entity"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"StartMove","parent":"drive","type":"libraryfunc","description":{"text":"The user command is received by the server and then converted into a move. This is also run clientside when in multiplayer, for prediction to work.","internal":""},"realm":"Shared","file":{"text":"lua/includes/modules/drive.lua","line":"169-L177"},"args":{"arg":[{"text":"The player.","name":"ply","type":"Player"},{"text":"The move data.","name":"mv","type":"CMoveData"},{"text":"The user command.","name":"cmd","type":"CUserCmd"}]},"rets":{"ret":{"text":"True if succeeded.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"BoneModifiers","parent":"duplicator","type":"libraryfield","description":"A list of all entity bone modifiers registered with duplicator.RegisterBoneModifier.","realm":"Shared","rets":{"ret":{"text":"The list of all entity bone modifiers.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ConstraintType","parent":"duplicator","type":"libraryfield","description":"A list of all constraints that can be duplicated. Registered with duplicator.RegisterConstraint.","realm":"Shared","rets":{"ret":{"text":"The list of all constraints that can be duplicated. Key = classname, Value = table.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EntityClasses","parent":"duplicator","type":"libraryfield","description":"A list of all entity classes have a custom duplication spawn function. Registered with duplicator.RegisterEntityClass.\n\nIf you wish to get a specific entity class table, use duplicator.FindEntityClass.","realm":"Shared","rets":{"ret":{"text":"The list of all entity classes with a custom duplication handler. Key = classname, Value = table.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EntityModifiers","parent":"duplicator","type":"libraryfield","description":"A list of all entity modifiers registered with duplicator.RegisterEntityModifier.","realm":"Shared","rets":{"ret":{"text":"The list of all entity modifiers.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Allow","parent":"duplicator","type":"libraryfunc","description":"Allow entities with given class name to be duplicated. See duplicator.Disallow for the opposite effect.\n\nduplicator.IsAllowed can be used to poll the status of a particular entity class. \n\n`duplicator.Allow` is automatically called by scripted_ents.Register and weapons.Register, unless the associated entity table has `ENT.DisableDuplicator` set to `true`.\n\nThis is also automatically called by duplicator.RegisterEntityClass.\n\nIn addition to that most spawnmenu content, such as engine weapons and pickup-ables, as well as most engine NPCs in Sandbox-derived gamemodes are also allowed by default.","realm":"Shared","file":{"text":"lua/includes/modules/duplicator.lua","line":"331-L335"},"args":{"arg":{"text":"An entity's classname to allow duplicating.","name":"classname","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ApplyBoneModifiers","parent":"duplicator","type":"libraryfunc","description":"Calls every function registered with duplicator.RegisterBoneModifier on each bone the ent has.","realm":"Server","file":{"text":"lua/includes/modules/duplicator.lua","line":"885-L912"},"args":{"arg":[{"text":"The player whose entity this is.","name":"ply","type":"Player"},{"text":"The entity in question.","name":"ent","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ApplyEntityModifiers","parent":"duplicator","type":"libraryfunc","description":"Calls every function registered with duplicator.RegisterEntityModifier on the entity.","realm":"Server","file":{"text":"lua/includes/modules/duplicator.lua","line":"865-L879"},"args":{"arg":[{"text":"The player whose entity this is.","name":"ply","type":"Player"},{"text":"The entity in question.","name":"ent","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ClearEntityModifier","parent":"duplicator","type":"libraryfunc","description":"Clears/removes the chosen entity modifier from the entity.","realm":"Server","file":{"text":"lua/includes/modules/duplicator.lua","line":"527-L534"},"args":{"arg":[{"text":"The entity the modification is stored on.","name":"ent","type":"Entity"},{"text":"The key of the stored entity modifier.","name":"key","type":"any"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Copy","parent":"duplicator","type":"libraryfunc","description":"Copies the entity, and all of its constraints and entities, then returns them in a table.","realm":"Server","file":{"text":"lua/includes/modules/duplicator.lua","line":"615-L645"},"args":{"arg":[{"text":"The entity to duplicate. The function will automatically copy all constrained entities.","name":"ent","type":"Entity"},{"text":"A preexisting table to add entities and constraints in from.\nUses the same table format as the table returned from this function.","name":"tableToAdd","type":"table","default":"{}"}]},"rets":{"ret":{"text":"A table containing duplication info which includes the following members:\n* table Entities\n* table Constraints\n* Vector Mins\n* Vector Maxs\n\nThe values of Mins & Maxs from the table are returned from duplicator.WorkoutSize.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"CopyEnts","parent":"duplicator","type":"libraryfunc","description":"Copies the passed table of entities to save for later.","realm":"Server","file":{"text":"lua/includes/modules/duplicator.lua","line":"647-L659"},"args":{"arg":{"text":"A table of entities to save/copy.","name":"ents","type":"table"}},"rets":{"ret":{"text":"A table containing duplication info which includes the following members:\n* table Entities\n* table Constraints\n* Vector Mins\n* Vector Maxs","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"CopyEntTable","parent":"duplicator","type":"libraryfunc","description":"Returns a table with some entity data that can be used to create a new entity with duplicator.CreateEntityFromTable.","realm":"Server","file":{"text":"lua/includes/modules/duplicator.lua","line":"558-L564"},"args":{"arg":{"text":"The entity table to save.","name":"ent","type":"Entity"}},"rets":{"ret":{"text":"See Structures/EntityCopyData.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"CreateConstraintFromTable","parent":"duplicator","type":"libraryfunc","description":{"text":"Creates a constraint from a saved/copied constraint table.","internal":""},"realm":"Server","file":{"text":"lua/includes/modules/duplicator.lua","line":"726-L791"},"args":{"arg":[{"text":"Saved/copied constraint table.","name":"constraint","type":"table"},{"text":"The list of entities that are to be constrained.","name":"entityList","type":"table"}]},"rets":{"ret":[{"text":"The newly created constraint entity, if any.\n\nFor example, an entity of class `phys_pulleyconstraint` or `phys_spring`, etc., the functional entity of the constraint.","type":"Entity"},{"text":"The second constraint related entity, if any.\n\nFor a most constraints, this would be a `keyframe_rope` for the visual part of a constraint.","type":"Entity"},{"text":"The third constraint related entity, if any.\n\nFor example, a Hydraulic constraint would return the `gmod_winch_controller` entity here. A pulley would have another `keyframe_rope`.","type":"Entity"},{"text":"The fourth constraint related entity, if any.\n\nFor example, a Hydraulic constraint would return the `phys_slideconstraint` entity here. A pulley would have yet another `keyframe_rope`.","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"CreateEntityFromTable","parent":"duplicator","type":"libraryfunc","description":"\"Create an entity from a table.\" \n\n\nThis creates an entity using the data in EntTable.\n\n\nIf an entity factory has been registered for the entity's Class, it will be called. \n\n\nOtherwise, duplicator.GenericDuplicatorFunction will be called instead.","realm":"Server","file":{"text":"lua/includes/modules/duplicator.lua","line":"664-L716"},"args":{"arg":[{"text":"The player who wants to create something.","name":"ply","type":"Player"},{"text":"The duplication data to build the entity with. See Structures/EntityCopyData.","name":"entTable","type":"table"}]},"rets":{"ret":{"text":"The newly created entity.","name":"","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Disallow","parent":"duplicator","type":"libraryfunc","description":"Disallow this entity to be duplicated. Opposite of duplicator.Allow.\n\nThis function is useful for temporarily disabling duplication of certain entity classes that may have been previously allowed.","realm":"Shared","added":"2023.08.08","file":{"text":"lua/includes/modules/duplicator.lua","line":"340-L344"},"args":{"arg":{"text":"An entity's classname to disallow duplicating.","name":"classname","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DoBoneManipulator","parent":"duplicator","type":"libraryfunc","description":"\"Restores the bone's data.\"\n\n\nLoops through Bones and calls Entity:ManipulateBoneScale, Entity:ManipulateBoneAngles and Entity:ManipulateBonePosition on ent with the table keys and the subtable values s, a and p respectively.","realm":"Server","file":{"text":"lua/includes/modules/duplicator.lua","line":"454-L467"},"args":{"arg":[{"text":"The entity to be bone manipulated.","name":"ent","type":"Entity"},{"text":"Table with a Structures/BoneManipulationData for every bone (that has manipulations applied) using the bone ID as the table index.","name":"bones","type":"table"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"DoFlex","parent":"duplicator","type":"libraryfunc","description":"Restores the flex data using Entity:SetFlexWeight and Entity:SetFlexScale.","realm":"Server","file":{"text":"lua/includes/modules/duplicator.lua","line":"436-L449"},"args":{"arg":[{"text":"The entity to restore the flexes on.","name":"ent","type":"Entity"},{"text":"The flexes to restore.","name":"flex","type":"table"},{"text":"The flex scale to apply. (Flex scale is unchanged if omitted)","name":"scale","type":"number","default":"nil"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"DoGeneric","parent":"duplicator","type":"libraryfunc","description":"\"Applies generic every-day entity stuff for ent from table data.\"\n\n\nDepending on the values of Model, Angle, Pos, Skin, Flex, Bonemanip, ModelScale, ColGroup, Name, and BodyG (table of multiple values) in the data table, this calls Entity:SetModel, Entity:SetAngles, Entity:SetPos, Entity:SetSkin, duplicator.DoFlex, duplicator.DoBoneManipulator, Entity:SetModelScale, Entity:SetCollisionGroup, Entity:SetName, Entity:SetBodygroup on ent.\n\n\nIf ent has a RestoreNetworkVars function, it is called with data.DT.","realm":"Server","file":{"text":"lua/includes/modules/duplicator.lua","line":"1044-L1048"},"args":{"arg":[{"text":"The entity to be applied upon.","name":"ent","type":"Entity"},{"text":"The data to be applied onto the entity.","name":"data","type":"table"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"DoGenericPhysics","parent":"duplicator","type":"libraryfunc","description":"\"Applies bone data, generically.\"\n\n\nIf data contains a PhysicsObjects table, it moves, re-angles and if relevent freezes all specified bones, first converting from local coordinates to world coordinates.","realm":"Server","file":{"text":"lua/includes/modules/duplicator.lua","line":"1036-L1042"},"args":{"arg":[{"text":"The entity to be applied upon.","name":"ent","type":"Entity"},{"text":"The player who owns the entity. Unused in function as of early 2013.","name":"ply","type":"Player","default":"nil"},{"text":"The data to be applied onto the entity.","name":"data","type":"table"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"FigureOutRequiredAddons","parent":"duplicator","type":"libraryfunc","description":"Checks the given duplication table and tries to figure out any addons that might be required to correctly spawn the duplication. Currently this is limited to models and material overrides saved in the duplication.","realm":"Shared","added":"2021.07.23","args":{"arg":{"text":"The duplication table to process, for example from duplicator.Copy.\n\nThe provided table will have `RequiredAddons` key added.","name":"dupe","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"FindEntityClass","parent":"duplicator","type":"libraryfunc","description":"Returns the entity class factory registered with duplicator.RegisterEntityClass.","realm":"Shared","file":{"text":"lua/includes/modules/duplicator.lua","line":"395-L400"},"args":{"arg":{"text":"The name of the entity class factory.","name":"name","type":"string"}},"rets":{"ret":{"text":"Is compromised of the following members:\n* function Func - The function that creates the entity.\n* table Args - Arguments to pass to the function.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GenericDuplicatorFunction","parent":"duplicator","type":"libraryfunc","description":"\"Generic function for duplicating stuff\" \n\n\nThis is called when duplicator.CreateEntityFromTable can't find an entity factory to build with. It calls duplicator.DoGeneric and duplicator.DoGenericPhysics to apply standard duplicator stored things such as the model and position.","realm":"Server","file":{"text":"lua/includes/modules/duplicator.lua","line":"472-L505"},"args":{"arg":[{"text":"The player who wants to create something.","name":"ply","type":"Player"},{"text":"The duplication data to build the entity with.","name":"data","type":"table"}]},"rets":{"ret":{"text":"The newly created entity.","name":"","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetAllConstrainedEntitiesAndConstraints","parent":"duplicator","type":"libraryfunc","description":{"text":"Fills entStorageTable with all of the entities in a group connected with constraints. Fills constraintStorageTable with all of the constraints constraining the group.","internal":""},"realm":"Server","file":{"text":"lua/includes/modules/duplicator.lua","line":"921-L969"},"args":{"arg":[{"text":"The entity to start from","name":"ent","type":"Entity"},{"text":"The table the entities will be inserted into.","name":"entStorageTable","type":"table"},{"text":"The table the constraints will be inserted into.","name":"constraintStorageTable","type":"table"}]},"rets":{"ret":[{"text":"entStorageTable","name":"","type":"table"},{"text":"constraintStorageTable","name":"","type":"table"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsAllowed","parent":"duplicator","type":"libraryfunc","description":"Returns whether the entity can be duplicated or not.","realm":"Shared","file":{"text":"lua/includes/modules/duplicator.lua","line":"349-L353"},"args":{"arg":{"text":"An entity's classname.","name":"classname","type":"string"}},"rets":{"ret":{"text":"Returns true if the entity can be duplicated (nil otherwise).","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Paste","parent":"duplicator","type":"libraryfunc","description":"\"Given entity list and constraint list, create all entities and return their tables\"\n\nCalls duplicator.CreateEntityFromTable on each sub-table of EntityList. If an entity is actually created, it calls ENTITY:OnDuplicated with the entity's duplicator data, then duplicator.ApplyEntityModifiers, duplicator.ApplyBoneModifiers and finally  ENTITY:PostEntityPaste is called.\n\nThe constraints are then created with duplicator.CreateConstraintFromTable.","realm":"Server","file":{"text":"lua/includes/modules/duplicator.lua","line":"769-L859"},"args":{"arg":[{"text":"The player who wants to create something.","name":"Player","type":"Player"},{"text":"A table of duplicator data to create the entities from.","name":"EntityList","type":"table"},{"text":"A table of duplicator data to create the constraints from.","name":"ConstraintList","type":"table"}]},"rets":{"ret":[{"text":"List of created entities.","name":"","type":"table"},{"text":"List of created constraints.","name":"","type":"table"}]}},"example":{"description":"Code used for a TOOL to copy duplication data on right click and paste it with its original info on left click.","code":"function TOOL:LeftClick( trace )\n\tif (SERVER) then\n\t\tduplicator.Paste(self:GetOwner(),Dupe.Entities,Dupe.Constraints)\n\t\tprint(\"PASTED\")\n\tend\n\treturn true\nend\n \nfunction TOOL:RightClick( trace )\n\tif (SERVER and IsValid(trace.Entity)) then\n\t\tDupe = duplicator.Copy(trace.Entity)\n\t\tprint(\"COPIED\")\n\tend\n\treturn true\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"RegisterBoneModifier","parent":"duplicator","type":"libraryfunc","description":{"text":"Registers a function to be called on each of an entity's bones when duplicator.ApplyBoneModifiers is called.","note":"This function is available to call on the client, but registered functions aren't used anywhere!"},"realm":"Shared","file":{"text":"lua/includes/modules/duplicator.lua","line":"405"},"args":{"arg":[{"text":"The type of the key doesn't appear to matter, but it is preferable to use a string.","name":"key","type":"any"},{"text":"Function called on each bone that an ent has. Called during duplicator.ApplyBoneModifiers.","name":"boneModifier","type":"function","callback":{"arg":[{"text":"The player that is spawning the entity.","type":"Player","name":"ply"},{"text":"The entity being spawned in.","type":"Entity","name":"ent"},{"type":"number","name":"boneID"},{"type":"PhysObj","name":"bone"},{"text":"What you pass to duplicator.StoreBoneModifier.","type":"table","name":"data"}]}}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RegisterConstraint","parent":"duplicator","type":"libraryfunc","description":"Register a function used for creating a duplicator-supported constraint.","realm":"Shared","file":{"text":"lua/includes/modules/duplicator.lua","line":"367-L374"},"args":{"arg":[{"text":"The unique name of the new constraint. It will be used to identify which constraint to apply on duplicator load.","name":"name","type":"string"},{"text":"Function to be called when this constraint is created.\n\nIt is a good idea to check constraint.CanConstrain before doing anything else.\n\n\nYou must also call constraint.AddConstraintTable if creating custom constraint entities.\n  * This is what stores the constraint for duplicator to save and load, as well as for constraint.GetTable.\n  * The constraint entity must have `Type` key on it. This means that a single entity can only represent one constraint.\n\nOptionally, the callback can return up to 4 entities, which are considered the \"constraint\" entities.\n* Each of those is added to `\"ropeconstraints\"` or `\"constraints\"` cleanup list based on entity's classname (Player:AddCleanup)\n* The first entity is added to the player's entity count (Player:AddCount) in Sandbox.\n* None of these entities **should** be the 2 entities being constraint (i.e. a `prop_physics`), but it can be one one of them if you know what you are doing.","name":"callback","type":"function"},{"text":"Arguments to be passed to the callback function when the constraint is created via duplicator.CreateConstraintFromTable.\n\nThe data would be taken the constraint entity table added via constraint.AddConstraintTable. All constraint library constraints call it on the appropriate entity for you. (Typically its the first entity returned by the callback)","name":"customData","type":"vararg"}]}},"example":{"description":"Example of how to define a custom constraint. You apply the constraint via the custom `constraint_MyCustomConstraint` function, and it will automatically support duplicator.","code":"function constraint_MyCustomConstraint( Ent1, Ent2, MyCoolData )\n\tif ( !IsValid( Ent1 ) ) then return end\n\tif ( !IsValid( Ent2 ) ) then return end\n\n\t-- Your custom constraint code here, you can use \"MyCoolData\" here, as well as any custom arguments\n\t-- Just make sure to save each custom argument in the Ent2 table below,\n\t-- and add them to duplicator.RegisterConstraint below as well\n\n\tconstraint.AddConstraintTable( Ent1, Ent2, Ent2 )\n\n\tEnt2:SetTable( {\n\t\tType = \"MyCustomConstraint\",\n\t\tEnt1 = Ent1,\n\t\tEnt2 = Ent2,\n\t\tMyCoolData = MyCoolData\n\t} )\n\n\treturn Ent2\nend\nduplicator.RegisterConstraint( \"MyCustomConstraint\", constraint_MyCustomConstraint, \"Ent1\", \"Ent2\", \"MyCoolData\" )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RegisterEntityClass","parent":"duplicator","type":"libraryfunc","description":{"text":"This allows you to specify a specific function to be run when your SENT is pasted with the duplicator, instead of relying on the generic automatic functions.","note":"Automatically calls duplicator.Allow for the entity class."},"realm":"Shared","file":{"text":"lua/includes/modules/duplicator.lua","line":"381-L390"},"args":{"arg":[{"text":"The ClassName of the entity you wish to register a factory for.","name":"name","type":"string"},{"text":"The factory function you want to have called.","name":"function","type":"function","callback":{"arg":[{"text":"The player that is spawning the entity.","type":"Player","name":"ply"},{"text":"Whatever arguments you request to be passed.","type":"vararg","name":"..."}],"ret":{"text":"It also should return the entity created, otherwise duplicator.Paste result will not include it!","type":"Entity","name":"ent"}}},{"text":"Strings of the names of arguments you want passed to function the from the Structures/EntityCopyData. As a special case, \"Data\" will pass the whole structure.","name":"args","type":"vararg"}]}},"example":{"description":"Prints the datatable and then lets the duplicator do it's job.","code":"duplicator.RegisterEntityClass(\"prop_physics\", function(ply, data)\n\tPrintTable(data)\n\treturn duplicator.GenericDuplicatorFunction(ply, data)\nend, \"Data\")","output":"```\nSkin = 0\nMins = -14.357550 -14.390250 -25.934851\nFlex:\n\tColGroup = 0\nPos = -292.415070 -157.575043 -12262.056641\nPhysicsObjects:\n\t0:\n\t\tFrozen = false\n\t\tPos = 13.750092 0.490356 -4.675781\n\t\tAngle = 0.057 87.808 -0.031\nClass = prop_physics\nFlexScale = 1\nMaxs = 14.438149 14.405550 25.995348\nModel = models/props_borealis/bluebarrel001.mdl\nAngle = 0.057 134.318 -0.031\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RegisterEntityModifier","parent":"duplicator","type":"libraryfunc","description":"This allows you to register tweaks to entities. For instance, if you were making an \"unbreakable\" addon, you would use this to enable saving the \"unbreakable\" state of entities between duplications.\n\nThis function registers a piece of generic code that is run on all entities with this modifier. In order to have it actually run, use duplicator.StoreEntityModifier.\n\nThis function does nothing when run clientside.","realm":"Shared","file":{"text":"lua/includes/modules/duplicator.lua","line":"406"},"args":{"arg":[{"text":"An identifier for your modification. This is not limited, so be verbose. `Person's 'Unbreakable' mod` is far less likely to cause conflicts than `unbreakable`.","name":"name","type":"string"},{"text":"The function to be called for your modification.","name":"func","type":"function","callback":{"arg":[{"text":"The player that is spawning the entity.","type":"Player","name":"ply"},{"text":"The entity being spawned in.","type":"Entity","name":"ent"},{"text":"What you pass to duplicator.StoreEntityModifier.","type":"table","name":"data"}]}}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RemoveMapCreatedEntities","parent":"duplicator","type":"libraryfunc","description":"Help to remove certain map created entities before creating the saved entities\nThis is obviously so we don't get duplicate props everywhere.\nIt should be called before calling Paste.","realm":"Server","file":{"text":"lua/includes/modules/duplicator.lua","line":"993-L1003"}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetLocalAng","parent":"duplicator","type":"libraryfunc","description":"\"When a copy is copied it will be translated according to these.\nIf you set them - make sure to set them back to 0 0 0!\"","realm":"Shared","file":{"text":"lua/includes/modules/duplicator.lua","line":"362"},"args":{"arg":{"text":"The angle to offset all pastes from.","name":"v","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetLocalPos","parent":"duplicator","type":"libraryfunc","description":"\"When a copy is copied it will be translated according to these.\nIf you set them - make sure to set them back to 0 0 0!\"","realm":"Shared","file":{"text":"lua/includes/modules/duplicator.lua","line":"361"},"args":{"arg":{"text":"The position to offset all pastes from.","name":"v","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"StoreBoneModifier","parent":"duplicator","type":"libraryfunc","description":"Stores bone mod data for a registered bone modification function.","realm":"Server","file":{"text":"lua/includes/modules/duplicator.lua","line":"539-L553"},"args":{"arg":[{"text":"The entity to add bone mod data to.","name":"ent","type":"Entity"},{"text":"The bone ID.\nSee Entity:GetPhysicsObjectNum.","name":"boneID","type":"number"},{"text":"The key for the bone modification.","name":"key","type":"any"},{"text":"The bone modification data that is passed to the bone modification function.","name":"data","type":"table"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"StoreEntityModifier","parent":"duplicator","type":"libraryfunc","description":"Stores an entity modifier into an entity for saving.","realm":"Server","file":{"text":"lua/includes/modules/duplicator.lua","line":"510-L522"},"args":{"arg":[{"text":"The entity to store modifier in.","name":"entity","type":"Entity"},{"text":"Unique modifier name as defined in duplicator.RegisterEntityModifier.","name":"name","type":"string"},{"text":"Modifier data.","name":"data","type":"table"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"WorkoutSize","parent":"duplicator","type":"libraryfunc","description":"Works out the AABB size of the duplication.","realm":"Server","file":{"text":"lua/includes/modules/duplicator.lua","line":"569-L609"},"args":{"arg":{"text":"A table of entity duplication datums.","name":"Ents","type":"table"}},"rets":{"ret":[{"text":"AABB mins vector.","name":"Mins","type":"Vector"},{"text":"AABB maxs vector.","name":"Maxs","type":"Vector"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"BeamRingPoint","parent":"effects","type":"libraryfunc","description":"Creates a \"beam ring point\" effect.","realm":"Shared","added":"2020.04.29","args":{"arg":[{"text":"The origin position of the effect.","name":"pos","type":"Vector"},{"text":"How long the effect will be drawing for, in seconds.","name":"lifetime","type":"number"},{"text":"Initial radius of the effect.","name":"startRad","type":"number"},{"text":"Final radius of the effect, at the end of the effect's lifetime.","name":"endRad","type":"number"},{"text":"How thick the beam should be.","name":"width","type":"number"},{"text":"How noisy the beam should be.","name":"amplitude","type":"number"},{"text":"Beam's Color.","name":"color","type":"Color"},{"text":"Extra info, all optional. A table with the following keys: (any combination)\n* number speed - ?\n* number spread - ?\n* number delay - Delay in seconds after which the effect should appear.\n* number flags- Beam flags.\n* number framerate - texture framerate.\n* string material - The material to use instead of the default one.","name":"extra","type":"table"}]}},"example":[{"code":"effects.BeamRingPoint( Entity(1):GetEyeTrace().HitPos + Vector( 0, 0, 10 ), 1, 0, 200, 10, 0, Color( 255, 255, 255 ) )","output":{"upload":{"src":"70c/8d7eac74df02356.png","size":"291360","name":"image.png"}}},{"code":"function ENT:DoExplosion()\n\t-- boom\n\tself:EmitSound(\"NPC_CombineBall.Explosion\")\n\tutil.ScreenShake(self:GetPos(), 20, 150, 1, 1250)\n\t\n\tlocal data = EffectData()\n\tdata:SetOrigin(self:GetPos())\n\tutil.Effect(\"cball_explode\",data)\n\t\n\teffects.BeamRingPoint(self:GetPos(), 0.2, 12, 1024, 64, 0, Color(255,255,225,32),{\n\t\tspeed=0,\n\t\tspread=0,\n\t\tdelay=0,\n\t\tframerate=2,\n\t\tmaterial=\"sprites/lgtning.vmt\"\n\t})\n\t-- Shockring\n\teffects.BeamRingPoint(self:GetPos(), 0.5, 12, 1024, 64, 0, Color(255,255,225,64),{\n\t\tspeed=0,\n\t\tspread=0,\n\t\tdelay=0,\n\t\tframerate=2,\n\t\tmaterial=\"sprites/lgtning.vmt\"\n\t})\n\tself:Remove()\nend","output":"Very closely emulates a Combine Ball explosion."}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Bubbles","parent":"effects","type":"libraryfunc","description":"Creates a bunch of bubbles inside a defined box.","realm":"Shared","added":"2020.04.29","args":{"arg":[{"text":"The lowest extents of the box.","name":"mins","type":"Vector"},{"text":"The highest extents of the box.","name":"maxs","type":"Vector"},{"text":"How many bubbles to spawn. There's a hard limit of 500 tempents at any time.","name":"count","type":"number"},{"text":"How high the bubbles can fly up before disappearing.","name":"height","type":"number"},{"text":"How quickly the bubbles move.","name":"speed","type":"number","default":"0"},{"text":"Delay in seconds after the function call and before the effect actually spawns.","name":"delay","type":"number","default":"0"}]}},"example":{"code":"concommand.Add( \"giveme_bubbles\", function( ply )\n\tlocal pos = ply:GetEyeTrace().HitPos\n\tlocal mins = Vector( 100, 100, 0 )\n\tlocal maxs = Vector( 100, 100, 100 )\n\n\teffects.Bubbles( pos - mins, pos + maxs, 100, 200, 0 )\nend )","output":{"upload":{"src":"70c/8dc3a0b60ed84f5.png","size":"1032297","name":"image.png"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"BubbleTrail","parent":"effects","type":"libraryfunc","description":"Creates a bubble trail effect, the very same you get when shooting underwater.","realm":"Shared","added":"2020.04.29","args":{"arg":[{"text":"The start position of the effect.","name":"startPos","type":"Vector"},{"text":"The end position of the effects.","name":"endPos","type":"Vector"},{"text":"How many bubbles to spawn. There's a hard limit of 500 tempents at any time.","name":"count","type":"number"},{"text":"How high the bubbles can fly up before disappearing.","name":"height","type":"number"},{"text":"How quickly the bubbles move.","name":"speed","type":"number","default":"0"},{"text":"Delay in seconds after the function call and before the effect actually spawns.","name":"delay","type":"number","default":"0"}]}},"example":{"description":"Mimics the effect of shooting underwater.","code":"effects.BubbleTrail( Entity(1):GetEyeTrace().HitPos, Entity(1):GetShootPos(), 100, 20 )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Create","parent":"effects","type":"libraryfunc","description":{"text":"Returns the table of the effect specified.","internal":"You are looking for util.Effect."},"realm":"Client","file":{"text":"lua/includes/modules/effects.lua","line":"51-L71"},"args":{"arg":{"text":"Effect name.","name":"name","type":"string"}},"rets":{"ret":{"text":"The effect table.","name":"","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetList","parent":"effects","type":"libraryfunc","description":{"text":"Returns a list of all Lua-defined effects.","internal":""},"realm":"Client","file":{"text":"lua/includes/modules/effects.lua","line":"73-L81"},"added":"2020.04.29","rets":{"ret":{"text":"The effects table.","name":"","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Register","parent":"effects","type":"libraryfunc","description":{"text":"Registers a new effect.","internal":""},"realm":"Client","file":{"text":"lua/includes/modules/effects.lua","line":"18-L45"},"args":{"arg":[{"text":"Effect table.","name":"effect_table","type":"table"},{"text":"Effect name.","name":"name","type":"string"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"TracerSound","parent":"effects","type":"libraryfunc","description":"Imitates the \"near miss\" tracer sound, with the ability to override the sound played.\n\nThe frequency of the sound is limited internally, as to not overwhelm the player. (same as normal tracers)","added":"2025.09.16","realm":"Client","args":{"arg":[{"text":"Start position of the tracer.","name":"start","type":"Vector"},{"text":"End position of the tracer.","name":"endpos","type":"Vector"},{"text":"Tracer type. Acceptable values are:\n* 1 - Normal bullet.\n* 2 - Gunship bullet.\n* 4 - Strider bullet.\n* 8 - Underwater bullet.\n\nThis affects the default sound, as well as the distance from which the sound can be heard compared to the closest point on the tracer line to the player.","name":"tracerType","type":"number","default":"1"},{"text":"If set, this sound will be played instead of the default sound.","name":"soundOverride","type":"string","default":"nil"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AbsoluteFrameTime","parent":"engine","type":"libraryfunc","description":"Returns non paused Global.FrameTime.","realm":"Shared","added":"2023.06.28","rets":{"ret":{"text":"Frame time.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ActiveGamemode","parent":"engine","type":"libraryfunc","description":"Returns the name of the currently running gamemode.","realm":"Shared and Menu","rets":{"ret":{"text":"The active gamemode's name. This is the name of the gamemode's folder.","name":"","type":"string"}}},"example":{"description":"Prints out the name of the active gamemode.","code":"print( engine.ActiveGamemode() )","output":"```\nsandbox\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"CloseServer","parent":"engine","type":"libraryfunc","description":"Closes the server and completely exits.\n\nTo enable this function for use on your server, add `-allowquit` to your commandline, which will make this function run `quit keep_players` when executed, this also does not forcibly disconnect players.\n\nThis is also available when running in server test mode (launch option `-systemtest`). Server test mode is used internally at Facepunch as part of the build process to make sure that the dedicated servers aren't crashing on startup.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetAddons","parent":"engine","type":"libraryfunc","description":"Returns a list of addons the player have subscribed to on the workshop.\n\nThis list will also include \"Floating\" .gma addons that are mounted by the game, but not the folder addons.","realm":"Shared and Menu","rets":{"ret":{"text":"A table of tables containing 8 keys (downloaded, models, title, file, mounted, wsid, size, updated).","name":"","type":"table"}}},"example":{"description":"Will return a list of all the workshop addons you have downloaded / are downloading.","code":"PrintTable( engine.GetAddons() )","output":"```\n1:\n\t\tdownloaded\t=\ttrue \n\t\tmodels\t\t=\t0 \n\t\ttitle\t\t=\tTitle of Addon \n\t\tfile\t\t=\taddons/title_of_addon_123456789.gma \n\t\tmounted\t\t=\ttrue\n\t\twsid\t\t=\t123456789\n\t\tsize\t\t= \t13379999\n\t\tupdated\t\t=\t37419284747\n\t\ttags\t\t=\n\t\ttimeadded\t=\t4157213484\n\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetDemoPlaybackStartTick","parent":"engine","type":"libraryfunc","description":"When starting playing a demo, engine.GetDemoPlaybackTick will be reset and its old value will be added to this functions return value.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDemoPlaybackTick","parent":"engine","type":"libraryfunc","description":"Current tick of currently loaded demo.\n\nIf not playing a demo, it will return amount of ticks since last demo playback.","realm":"Client and Menu","rets":{"ret":{"text":"The amount of ticks of currently loaded demo.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDemoPlaybackTimeScale","parent":"engine","type":"libraryfunc","description":"Returns time scale of demo playback.\n\nIf not during demo playback, returns 1.","realm":"Client and Menu","rets":{"ret":{"text":"The time scale of demo playback, value of demo_timescale console variable.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDemoPlaybackTotalTicks","parent":"engine","type":"libraryfunc","description":"Returns total amount of ticks of currently loaded demo.\n\nIf not playing a demo, returns 0 or the value of last played demo.","realm":"Client and Menu","rets":{"ret":{"text":"Total amount of ticks of currently loaded demo.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetGamemodes","parent":"engine","type":"libraryfunc","description":"Returns a table containing info for all installed gamemodes.","realm":"Shared and Menu","rets":{"ret":{"text":"The gamemodes.","name":"","type":"table"}}},"example":{"description":"Prints out a list of gamemodes and various info.","code":"PrintTable( engine.GetGamemodes() )","output":"```\n1:\n title = Base\n workshopid = \n menusystem = false\n maps = \n name = base\n2:\n title = Sandbox\n workshopid = \n menusystem = true\n maps = ^gm_| ^gmod_\n name = sandbox\n```\n\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetGames","parent":"engine","type":"libraryfunc","description":"Returns an array of tables corresponding to all games from which Garry's Mod supports mounting content.","realm":"Shared and Menu","rets":{"ret":{"text":"A table of tables containing all mountable games.","name":"","type":"table"}}},"example":{"description":"Prints out a list of games, their Steam AppIds, titles and status (owned, installed, mounted).","code":"PrintTable( engine.GetGames() )","output":"```\n1:\n depot = 220\n title = Half-Life 2\n owned = true\n folder = hl2\n mounted = true\n installed = true\n2:\n depot = 240\n title = Counter-Strike\n owned = false\n folder = cstrike\n mounted = false\n installed = false\n3:\n depot = 300\n title = Day of Defeat\n owned = false\n folder = dod\n mounted = false\n installed = false\n4:\n depot = 440\n title = Team Fortress 2\n owned = true\n folder = tf\n mounted = true\n installed = true\n```\n\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetUserContent","parent":"engine","type":"libraryfunc","description":{"text":"Returns the UGC (demos, saves and dupes) the player have subscribed to on the workshop.","deprecated":"Used internally for in-game menus, may be merged in the future into engine.GetAddons."},"realm":"Client and Menu","rets":{"ret":{"text":"Returns a table with 5 keys (title, type, tags, wsid, timeadded).","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsPlayingDemo","parent":"engine","type":"libraryfunc","description":"Returns true if we're currently playing a demo.\n\nYou will notice that there's no server-side version of this. That's because there is no server when playing a demo. Demos are both recorded and played back purely clientside.","realm":"Client and Menu","rets":{"ret":{"text":"Whether the game is currently playing a demo or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsRecordingDemo","parent":"engine","type":"libraryfunc","description":"Returns true if the game is currently recording a demo file (.dem) using gm_demo.","realm":"Client and Menu","rets":{"ret":{"text":"Whether the game is currently recording a demo or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"LightStyle","parent":"engine","type":"libraryfunc","description":{"text":"This is a direct binding to the function `engine->LightStyle`. This function allows you to change the default light style of the map - so you can make lighting lighter or darker. You’ll need to call render.RedownloadAllLightmaps clientside to refresh the lightmaps to this new color.","bug":{"text":"Calling this function with arguments 0 and \"a\" will cause dynamic lights such as those produced by the Light tool to stop working.","issue":"3626"}},"realm":"Server","args":{"arg":[{"text":"The lightstyle to edit. 0 to 63. If you want to edit map lighting, you want to set this to 0.","name":"lightstyle","type":"number"},{"text":"The pattern to change the lightstyle to. `a` is the darkest, `z` is the brightest. You can use stuff like \"abcxyz\" to make flashing patterns. The normal brightness for a map is `m`. Values over `z` are allowed, `~` for instance.","name":"pattern","type":"string"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OpenDupe","parent":"engine","type":"libraryfunc","description":"Loads a duplication from the local filesystem.","realm":"Client","args":{"arg":{"text":"Name of the file. (e.g, `engine.OpenDupe(\"dupes/8b809dd7a1a9a375e75be01cdc12e61f.dupe\")`).","name":"dupeName","type":"string"}},"rets":{"ret":{"text":"A table with a simple field:\n* string `data` - Compressed dupe data. Use util.JSONToTable to make it into a format useable by the duplicator tool.","name":"","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ServerFrameTime","parent":"engine","type":"libraryfunc","description":"Returns an estimate of the server's performance. Equivalent to calling Global.FrameTime from the server, according to source code.","realm":"Client","rets":{"ret":[{"text":"Frame time.","name":"","type":"number"},{"text":"Server framerate [standard deviation](https://en.wikipedia.org/wiki/Standard_deviation).","name":"","type":"number"}]}},"example":{"description":"Get the servers tickrate. Can be used to indicate lag.","code":"print( \"Server Tick: \" .. ( 1 / engine.ServerFrameTime() ) )","output":"```\nServer Tick: 66.666668156783\n```"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetMounted","parent":"engine","type":"libraryfunc","description":"Sets the mounting options for mountable content.","realm":"Menu","args":{"arg":[{"text":"The depot id of the game to mount.","name":"depotID","type":"string"},{"text":"The mount state, true to mount, false to unmount","name":"doMount","type":"boolean"}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"TickCount","parent":"engine","type":"libraryfunc","description":"Returns the number of ticks since the game server started.","realm":"Shared and Menu","rets":{"ret":{"text":"Number of ticks since the game server started.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"TickInterval","parent":"engine","type":"libraryfunc","description":"Returns the time interval between each game tick in seconds.\n\nThis function is useful for making animations (usually serverside, such as doors rotating) and similar things to be independent of the tickrate in hooks that run at the tick rate, such as GM:Tick.\n\nClientside you'd want to use Global.FrameTime for this purpose in hooks that run every frame.\n\nThe default tickrate is `66.6666`, aka `15` milliseconds interval between each game tick.  \nThe tickrate can be adjusted via the `-tickrate` [command line option](Command_Line_Parameters).","realm":"Shared and Menu","rets":{"ret":{"text":"Number of seconds between each gametick.","name":"","type":"number"}}},"example":{"code":"print(1 / engine.TickInterval())","output":"66.666668156783 (servertick is 66)"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"VideoSettings","parent":"engine","type":"libraryfunc","description":{"text":"Returns video recording settings set by video.Record. Used by Demo-To-Video feature.","internal":""},"realm":"Client","rets":{"ret":{"text":"The video recording settings, see Structures/VideoData.","name":"","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"WriteDupe","parent":"engine","type":"libraryfunc","description":{"text":"Saves a duplication as a file.","internal":"Do not use."},"realm":"Client","args":{"arg":[{"text":"Dupe table, encoded by util.TableToJSON and compressed by util.Compress.","name":"dupe","type":"string"},{"text":"The dupe icon, created by render.Capture.","name":"jpeg","type":"string"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"WriteSave","parent":"engine","type":"libraryfunc","description":{"text":"Stores savedata into the game. (can be loaded using the LoadGame menu)","internal":"Do not use."},"realm":"Client","args":{"arg":[{"text":"Data generated by gmsave.SaveMap, compressed by util.Compress.","name":"saveData","type":"string"},{"text":"Name the save will have.","name":"name","type":"string"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Create","parent":"ents","type":"libraryfunc","description":{"text":"Creates an entity. This function will fail and return `NULL` if the networked-edict limit is hit (around **8176**), or the provided entity class doesn't exist.","warning":"Do not use before GM:InitPostEntity has been called, otherwise the server will crash!\nIf you need to perform entity creation when the game starts, create a hook for GM:InitPostEntity and do it there."},"realm":"Server","args":{"arg":{"text":"The classname of the entity to create.","name":"class","type":"string"}},"rets":{"ret":{"text":"The created entity, or `NULL` if failed.","name":"","type":"Entity"}}},"example":[{"description":"Creates a gmod_button entity at `Vector(0, 0, 0)`.","code":"local button = ents.Create( \"gmod_button\" )\nbutton:SetModel( \"models/dav0r/buttons/button.mdl\" )\nbutton:SetPos( Vector( 0, 0, 0 ) )\nbutton:Spawn()"},{"description":"Make the Half Life Jeep appear where the player is looking.","code":"concommand.Add(\"spawn_vehicle_test\", function(pPlayer)\n    if not IsValid(pPlayer) or not pPlayer:IsSuperAdmin() then\n        return\n    end\n\n    local sClass = \"Jeep\"\n    local tData = list.Get(\"Vehicles\")[sClass] // Get the vehicle data from the list\n\n    local eVehicle = ents.Create(\"prop_vehicle_jeep\")\n    if not IsValid(eVehicle) then return end\n\n    eVehicle:SetModel(tData.Model) // Set the vehicle model\n    eVehicle:SetPos(pPlayer:GetEyeTrace().HitPos + Vector(0, 0, 10))\n    eVehicle:SetKeyValue(\"vehiclescript\", tData[\"KeyValues\"][\"vehiclescript\"]) // Set the vehicle script\n    eVehicle:Spawn()\n    eVehicle:Activate()\n\n\thook.Run(\"PlayerSpawnedVehicle\", pPlayer, eVehicle) // Call the hook for spawning a vehicle. This hook is used for all addons that wish to make modifications to the vehicle, such as adding a props to the vehicle.\n\nend)"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"CreateClientProp","parent":"ents","type":"libraryfunc","description":{"text":"Creates a clientside only prop with optional physics. See also Global.ClientsideModel if physics is not needed.\n\nFor physics to work you're expected to use the `model` argument. A simple Entity:SetModel will not be enough — the Entity:PhysicsInit* function will be needed.","bug":{"text":"Parented clientside prop will become detached if the parent entity leaves the PVS. **A workaround is available on its github page.**","issue":"861"}},"realm":"Client","args":{"arg":{"text":"The model for the entity to be created.","name":"model","type":"string","default":"models/error.mdl"}},"rets":{"ret":{"text":"Created entity (`C_PhysPropClientside`).","name":"","type":"Entity"}}},"example":[{"description":"Creates a clientside prop at the player location.","code":"function GhostBarrel( ply )\n\tlocal c_Model = ents.CreateClientProp()\n\tc_Model:SetPos( ply:GetPos() )\n\tc_Model:SetModel( \"models/props_borealis/bluebarrel001.mdl\" )\n\tc_Model:SetParent( ply )\n\tc_Model:Spawn()\nend"},{"description":"Creates a clientside prop with physics.","code":"concommand.Add( \"testent\", function( ply )\n\tlocal plyTr = ply:GetEyeTrace()\n\n\tlocal csEnt = ents.CreateClientProp( \"models/props_combine/combine_light001b.mdl\" )\n\tcsEnt:SetPos( plyTr.HitPos + plyTr.HitNormal * 24 )\n\tcsEnt:Spawn()\nend )"},{"description":"The same as previous, but physics is initialized manually.","code":"concommand.Add( \"testent\", function( ply )\n\tlocal plyTr = ply:GetEyeTrace()\n\n\tlocal csEnt = ents.CreateClientProp()\n\tcsEnt:SetPos( plyTr.HitPos + plyTr.HitNormal * 24 )\n\tcsEnt:SetModel( \"models/props_combine/combine_light001b.mdl\" )\n\tcsEnt:PhysicsInit( SOLID_VPHYSICS )\n\tcsEnt:Spawn()\n\n\tcsEnt:PhysWake()\nend )"}],"realms":["Client"],"type":"Function"},
{"function":{"name":"CreateClientRope","parent":"ents","type":"libraryfunc","description":{"text":"Creates a clientside only rope, similar to those used by the Dog and Fast Zombie models from Half-Life 2.\n\nCreated ropes will be automatically cleaned up when one of the attached entities is removed.","warning":"It doesn’t work exactly the same way as constraint.CreateKeyframeRope or constraint.Rope, you can see it when you try to use Slack with constraint.CreateKeyframeRope or addlength on constraint.Rope."},"realm":"Client","added":"2025.05.23","args":{"arg":[{"text":"The first entity to attach the rope to.","name":"ent1","type":"Entity"},{"text":"The attachment ID on the first entity to attach the rope to, or a local Vector relative to the first entity.","name":"ent1attach","type":"number|Vector"},{"text":"The second entity to attach the rope to.","name":"ent2","type":"Entity"},{"text":"The attachment ID on the second entity to attach the rope to, or a local Vector relative to the second entity.","name":"ent2attach","type":"number|Vector"},{"text":"Extra optional settings for the rope. Possible values are:\n* slack - How much extra rope to add to the length. (default: 0)\n* width - Width of the rope. (default: 2)\n* segments - How many segments the rope should have (default: 8, valid range is [2,10])\n* material - Which material should the rope have. (default: `\"cable/cable\"`)\n* nogravity - If set, the rope should have no gravity. (default: 0)","name":"extra","type":"table","default":"nil"}]},"rets":{"ret":{"text":"Created entity (`C_RopeKeyframe`).","name":"","type":"Entity"}}},"example":[{"description":"Sample usage, creates a clientside rope between the player entity, and the entity the player is looking at.","code":"concommand.Add( \"test_rope\", function( ply, cmd, args )\n    local ent = ply:GetEyeTrace().Entity\n    local ent2 = ply\n\n    local ropeEnt = ents.CreateClientRope( ent, 0, ent2, 1, { slack = tonumber( args[ 1 ] ) or 0, material =\"models/wireframe\" } )\n    print( ropeEnt )\nend )"},{"description":"Sample usage: stores the entity you’re looking at as the first endpoint, then on a second command creates a client-side rope like what we can got with constraint.CreateKeyframeRope or constraint.Rope server side.","code":"local firstEnt = nil\nlocal addlength = 100\nconcommand.Add( \"test_rope_first\", function( ply, cmd, args )\n    firstEnt = ply:GetEyeTrace().Entity\n    print(\"First entity: \",firstEnt)\nend)\n\nconcommand.Add( \"test_rope\", function( ply, cmd, args )\n    if not IsValid(firstEnt) then return end\n    local ent1 = firstEnt\n    local ent2 = ply:GetEyeTrace().Entity\n    local dist = ent1:GetPos():Distance(ent2:GetPos())\n\n    local ropeEnt = ents.CreateClientRope( ent1, 0, ent2, 1, { slack = dist+(addlength/2), material =\"models/wireframe\" } )\n    print(ropeEnt)\nend)"}],"realms":["Client"],"type":"Function"},
{"function":{"name":"CreateClientside","parent":"ents","type":"libraryfunc","description":"Creates a clientside only scripted entity. The scripted entity must be of \"anim\" type.","realm":"Client","args":{"arg":{"text":"The class name of the entity to create.","name":"class","type":"string"}},"rets":{"ret":{"text":"Created entity.","name":"","type":"Entity"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"FindAlongRay","parent":"ents","type":"libraryfunc","description":"Returns a table of all entities along the ray. The ray does not stop on collisions, meaning it will go through walls/entities.\n\nThis function is capable of detecting clientside only entities by default.\n\nThis internally uses [spatial partitioning](https://en.wikipedia.org/wiki/Space_partitioning) to avoid looping through all entities.","realm":"Shared","args":{"arg":[{"text":"The start position of the ray.","name":"start","type":"Vector"},{"text":"The end position of the ray.","name":"end","type":"Vector"},{"text":"The mins corner of the ray.","name":"mins","type":"Vector","default":"nil"},{"text":"The maxs corner of the ray.","name":"maxs","type":"Vector","default":"nil"}]},"rets":{"ret":{"text":"Table of the found entities. There's a limit of 1024 entities.","name":"","type":"table<Entity>"}}},"example":{"description":"Example usage of this function, as a \"trace\" of sorts.","code":"concommand.Add( \"test_trace\", function( ply )\n\tlocal plyTr = ply:GetEyeTrace()\n\t\n\tlocal ents = ents.FindAlongRay( plyTr.StartPos, plyTr.HitPos )\n\tPrintTable(ents)\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"FindByClass","parent":"ents","type":"libraryfunc","description":"Gets all entities with the given class, supports wildcards.\n\nThis function returns a sequential table, meaning it should be looped with Global.ipairs instead of Global.pairs for efficiency reasons.\n\nThis works internally by iterating over ents.GetAll. `ents.FindByClass` is always faster than ents.GetAll or ents.Iterator.","realm":"Shared","args":{"arg":{"text":"The class of the entities to find, supports wildcards.\n\nAsterisks (`*`) are the only wildcard supported.","name":"class","type":"string"}},"rets":{"ret":{"text":"A table containing all found entities.","name":"","type":"table<Entity>"}}},"example":{"description":"Prints the location of every prop on the map.","code":"for k, v in ipairs( ents.FindByClass( \"prop_*\" ) ) do\n\tprint( v:GetPos() )\nend","output":"The location of each prop on the map. In gm_construct, the output might be as follows:\n\n\n```\n-2936.288818 -1376.545532 -73.852913\n-2943.928467 -1375.800171 -84.964996\n-2932.637695 -1288.051636 -76.791924\n-2064.000000 -183.000000 -179.216003\n-2384.000000 -183.000000 -179.216003\n-2704.000000 -183.000000 -179.216003\n-1744.000000 -183.000000 -179.216003\n-1424.000000 -183.000000 -179.216003\n-3019.895020 -1095.824829 -78.900757\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"FindByClassAndParent","parent":"ents","type":"libraryfunc","description":"Finds all entities that are of given class and are children of given entity. This works internally by iterating over ents.FindByClass.","realm":"Shared","file":{"text":"lua/includes/extensions/ents.lua","line":"2-L26"},"args":{"arg":[{"text":"The class of entities to search for.","name":"class","type":"string"},{"text":"Parent of entities that are being searched for.","name":"parent","type":"Entity"}]},"rets":{"ret":{"text":"A table of found entities or nil if none are found.","name":"","type":"table<Entity>"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"FindByModel","parent":"ents","type":"libraryfunc","description":"Gets all entities with the given model, supports wildcards.\n\nThis works internally by iterating over ents.GetAll.","realm":"Shared","args":{"arg":{"text":"The model of the entities to find.","name":"model","type":"string"}},"rets":{"ret":{"text":"A table of all found entities.","name":"","type":"table<Entity>"}}},"example":{"description":"Print all entities with a female citizen model.","code":"for k, v in ipairs(ents.FindByModel(\"models/player/Group01/female_*\")) do\n\tprint(v)\nend","output":"```\n1       =       Player [1][Luiggi33]\n2       =       Entity [90][prop_ragdoll]\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"FindByName","parent":"ents","type":"libraryfunc","description":"Gets all entities with the given hammer targetname. This works internally by iterating over ents.GetAll.\n\nDoesn't do anything on client.","realm":"Shared","args":{"arg":{"text":"The targetname to look for.","name":"name","type":"string"}},"rets":{"ret":{"text":"A table of all found entities.","name":"","type":"table<Entity>"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"FindInBox","parent":"ents","type":"libraryfunc","description":{"text":"Returns all entities within the specified box.\n\nThis internally uses a Spatial Partition to avoid looping through all entities, so it is more efficient than using ents.GetAll for this purpose.","note":"Clientside entities will not be returned by this function. Serverside only entities without networked edicts (entity indexes), such as point logic or Constraints are not returned either"},"realm":"Shared","args":{"arg":[{"text":"The box minimum coordinates.","name":"boxMins","type":"Vector"},{"text":"The box maximum coordinates.","name":"boxMaxs","type":"Vector"}]},"rets":{"ret":{"text":"A table of all found entities.","name":"","type":"table<Entity>"}}},"example":{"description":"Returns a table of players in a box using ents.FindInBox.","code":"function ents.FindPlayersInBox( vCorner1, vCorner2 )\n\tlocal tEntities = ents.FindInBox( vCorner1, vCorner2 )\n\tlocal tPlayers = {}\n\tlocal iPlayers = 0\n\t\n\tfor i = 1, #tEntities do\n\t\tif ( tEntities[ i ]:IsPlayer() ) then\n\t\t\tiPlayers = iPlayers + 1\n\t\t\ttPlayers[ iPlayers ] = tEntities[ i ]\n\t\tend\n\tend\n\t\n\treturn tPlayers, iPlayers\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"FindInCone","parent":"ents","type":"libraryfunc","description":{"text":"Finds and returns all entities within the specified cone. Only entities whose Entity:WorldSpaceCenter is within the cone are considered to be in it.\n\nThe \"cone\" is actually a conical \"slice\" of an axis-aligned box (see: ents.FindInBox). The image to the right shows approximately how this function would look in 2D. Due to this, the entity may be farther than the specified range!","image":{"src":"ents.FindInCone.png","alt":"2D_visualization_of_the_actual_shape_of_the_cone,_click_to_enlarge"}},"realm":"Shared","args":{"arg":[{"text":"The tip of the cone.","name":"origin","type":"Vector"},{"text":"Direction of the cone.","name":"normal","type":"Vector"},{"text":"The range of the cone/box around the origin.","name":"range","type":"number","note":"The function internally adds 1 to this argument before using it."},{"text":"The cosine of the angle between the center of the cone to its edges, which is half the overall angle of the cone.\n\n1 makes a 0° cone, 0.707 makes approximately 90°, 0 makes 180°, and so on.","name":"angle_cos","type":"number"}]},"rets":{"ret":{"text":"A table of all found Entitys.","name":"","type":"table<Entity>"}}},"example":{"description":"Demonstrates how this function works.","code":"local size = 128\nlocal fov = 15\nlocal segments = 32\n\nlocal mat = Material(\"models/shiny\")\nmat:SetFloat(\"$alpha\", 0.25)\n\nhook.Add(\"PostDrawOpaqueRenderables\", \"ents.FindInCone demo\", function()\n\tlocal ply = LocalPlayer()\n\tif IsValid(ply) == false then return end\n\n\tlocal startPos = ply:EyePos()\n\n\tlocal dir = ply:GetAimVector()\n\tdir:Normalize()\n\n\tlocal angleCos = math.cos(math.rad(fov))\n\tlocal radius = math.tan(math.acos(angleCos)) * size\n\tlocal endPos = startPos + dir * size\n\n\trender.SetMaterial(mat)\n\trender.DrawSphere(startPos, size, 24, 16, color_white, true)\n\n\tlocal mins = Vector(-size, -size, -size)\n\tlocal maxs = Vector(size, size, size)\n\trender.DrawWireframeBox(startPos, angle_zero, mins, maxs, color_white, true)\n\trender.DrawBox(startPos, angle_zero, -mins, -maxs, color_white)\n\n\tlocal up = Vector(0, 0, 1)\n\tif math.abs(dir:Dot(up)) > 0.99 then\n\t\tup = Vector(1, 0, 0)\n\tend\n\n\tlocal right = dir:Cross(up)\n\tright:Normalize()\n\n\tup = right:Cross(dir)\n\tup:Normalize()\n\n\trender.SetColorMaterial()\n\n\tfor i = 0, segments - 1 do\n\t\tlocal a1 = (i / segments) * math.pi * 2\n\t\tlocal a2 = ((i + 1) / segments) * math.pi * 2\n\n\t\tlocal p1 = endPos + (right * math.cos(a1) + up * math.sin(a1)) * radius\n\t\tlocal p2 = endPos + (right * math.cos(a2) + up * math.sin(a2)) * radius\n\n\t\trender.DrawBeam(p1, p2, 2, 0, 1, Color(17, 163, 204, 50))\n\t\trender.DrawBeam(startPos, p1, 2, 0, 1, Color(0, 124, 158, 50))\n\tend\n\n\trender.DrawLine(startPos, endPos, Color(0, 255, 0), true)\n\n\tfor _, ent in ipairs(ents.FindInCone(startPos, dir, size, angleCos)) do\n\t\trender.DrawLine(\n\t\t\tstartPos,\n\t\t\tent:WorldSpaceCenter(),\n\t\t\tColor(255, 0, 0),\n\t\t\ttrue\n\t\t)\n\tend\nend)","output":{"upload":{"src":"70c/8de67522c81273a.mp4","size":"2636653","name":"iHREL89.mp4"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"FindInPVS","parent":"ents","type":"libraryfunc","description":{"text":"Finds all entities that lie within a [PVS (Potential Visibility Set)](https://developer.valvesoftware.com/wiki/PVS \"PVS - Valve Developer Community\").","note":"The function won't take in to account Global.AddOriginToPVS and the like."},"realm":"Server","args":{"arg":{"text":"Entity or Vector to find entities within the PVS of. If a player is given, this function will use the player's view entity.","name":"viewPoint","type":"Entity|Vector"}},"rets":{"ret":{"text":"The found Entitys.","name":"","type":"table<Entity>"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"FindInSphere","parent":"ents","type":"libraryfunc","description":"Gets all entities within the specified sphere.\n\nThis function internally calls util.IsBoxIntersectingSphere for every entity on the map based on their Orientated Bounding Box.","realm":"Shared","args":{"arg":[{"text":"Center of the sphere.","name":"origin","type":"Vector"},{"text":"Radius of the sphere.","name":"radius","type":"number"}]},"rets":{"ret":{"text":"A table of all found Entitys.","name":"","type":"table<Entity>"}}},"example":{"description":"Visualises the FindInSphere function when holding Use key, ignoring entities attached to the player.","code":"local entities  = {}\nlocal entities_sv  = {}\nlocal pos = Vector()\nlocal rad = 1000\n\nif ( SERVER ) then util.AddNetworkString( \"send_sv_ents\" ) end\n\nhook.Add( \"Think\", \"VisualizeFindInSphere\", function()\n\tlocal ply = Entity( 1 )\n\tif ( IsValid( ply ) and ply:KeyDown( IN_USE ) ) then\n\t\tpos = ply:GetPos()\n\t\tentities = ents.FindInSphere( pos, rad )\n\n\t\tlocal newTab = {}\n\t\tfor id, ent in pairs( entities ) do\n\t\t\tif ( ent:GetParent() == ply || ent == ply || ent:GetClass() == \"gmod_hands\" || ent:GetClass() == \"viewmodel\" ) then\n\t\t\t\t-- Ignore this entity\n\t\t\telse\n\t\t\t\tlocal entTable = { ent = ent, pos = ent:GetPos(), ang = ent:GetAngles(), mins = ent:OBBMins(), maxs = ent:OBBMaxs(), class = ent:GetClass() }\n\t\t\t\t-- spawnpoints have no size, so we fake it\n\t\t\t\tif ( ent:GetClass() == \"info_player_start\" ) then\n\t\t\t\t\tentTable.mins = ply:OBBMins()\n\t\t\t\t\tentTable.maxs = ply:OBBMaxs()\n\t\t\t\tend\n\t\t\t\ttable.insert( newTab, entTable )\n\t\t\tend\n\t\tend\n\t\tentities = newTab\n\n\t\tif ( SERVER ) then\n\t\t\tnet.Start( \"send_sv_ents\" )\n\t\t\t\tnet.WriteTable( entities )\n\t\t\tnet.Broadcast()\n\t\tend\n\tend\nend )\n\nnet.Receive( \"send_sv_ents\",function( len, ply )\n\tentities_sv = net.ReadTable()\nend )\n\nlocal function RenderEnts( enti, clr, isCl )\n\tfor id, tabl in pairs( enti ) do\n\t\tlocal ent = tabl.ent\n\n\t\tlocal test = \"NULL\"\n\t\tif ( IsValid( ent ) ) then test = ent:EntIndex() end\n\n\t\tdebugoverlay.EntityTextAtPosition( tabl.pos, isCl and 1 or 0, (isCl and \"CL \" or \"SV \") .. \"Entity \" .. test .. \" \" .. tabl.class, FrameTime() )\n\t\trender.DrawWireframeBox( tabl.pos, tabl.ang, tabl.mins, tabl.maxs, clr, true )\n\tend\nend\n\nlocal mat = Material( \"models/wireframe\" )\nhook.Add( \"PostDrawTranslucentRenderables\", \"VisualizeFindInSphere\", function()\n\n\trender.SetMaterial( mat )\n\trender.DrawSphere( pos, rad, 8, 8 )\n\trender.DrawSphere( pos, -rad, 8, 8 )\n\n\tlocal clr = Color( 255, 128, 0 )\n\tRenderEnts( entities, clr, true )\n\n\tclr = Color( 0, 128, 255 )\n\tRenderEnts( entities_sv, clr )\n\nend )","output":{"upload":{"src":"70c/8dd5b4059c0bef5.png","size":"1555311","name":"image.png"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"FireTargets","parent":"ents","type":"libraryfunc","description":"Fires a use event.","realm":"Server","args":{"arg":[{"text":"Name of the target entity.","name":"target","type":"string"},{"text":"Activator of the event.","name":"activator","type":"Entity"},{"text":"Caller of the event.","name":"caller","type":"Entity"},{"text":"Use type. See the Enums/USE.","name":"usetype","type":"number{USE}"},{"text":"This value is passed to ENTITY:Use, but isn't used by any default entities in the engine.","name":"value","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetAll","parent":"ents","type":"libraryfunc","description":"Returns a table of all existing entities.\n\nConsider using ents.Iterator instead for better performance.\n\nThis function returns a sequential table, meaning it should be looped with Global.ipairs instead of Global.pairs for efficiency reasons.","realm":"Shared","rets":{"ret":{"text":"Table of all existing Entitys.","name":"","type":"table<Entity>"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetByIndex","parent":"ents","type":"libraryfunc","description":"Returns an entity by its index. Same as Global.Entity.","realm":"Shared","args":{"arg":{"text":"The index of the entity.","name":"entIdx","type":"number"}},"rets":{"ret":{"text":"The entity if it exists, or `NULL` if it doesn't.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetCount","parent":"ents","type":"libraryfunc","description":"Gives you the amount of currently existing entities.\n\nSimilar to **#**ents.GetAll() but with better performance since the entity table doesn't have to be generated.  \nIf ents.GetAll is already being called for iteration, than using the **#** operator on the table will be faster than calling this function since it is JITted.","realm":"Shared","args":{"arg":{"text":"Include entities with the FL_KILLME flag. This will skip an internal loop, and the function will be more efficient as a byproduct.","name":"IncludeKillMe","type":"boolean","default":"false"}},"rets":{"ret":{"text":"Number of entities.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetEdictCount","parent":"ents","type":"libraryfunc","description":"Returns the amount of networked entities, which is limited to 8192.\n\nents.Create will fail somewhere between 8064 and 8176 - this can vary based on the amount of player slots on the server and other entities.\n\nSee also [MAX_EDICT_BITS](https://wiki.facepunch.com/gmod/Global_Variables#maxedictbits) global variable.","realm":"Server","rets":{"ret":{"text":"Number of networked entities.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetMapCreatedEntity","parent":"ents","type":"libraryfunc","description":"Returns entity that has given Entity:MapCreationID.\n\n\n\tThis works internally by iterating over ents.GetAll.","realm":"Shared","args":{"arg":{"text":"Entity's creation id.","name":"id","type":"number"}},"rets":{"ret":{"text":"Found entity, `nil` otherwise.","name":"","type":"Entity|nil"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Iterator","parent":"ents","type":"libraryfunc","description":{"text":"Returns a [Stateless Iterator](https://www.lua.org/pil/7.3.html) for all entities.\n\t\tIntended for use in [Generic For-Loops](https://www.lua.org/pil/4.3.5.html).  \n\t\tSee player.Iterator for a similar function for all players.","note":"Internally, this function uses cached values that are stored in Lua, as opposed to ents.GetAll, which is a C++ function.\n\t\tBecause a call operation from Lua to C++ *and* with a return back to Lua is quite costly, this function will be more efficient than ents.GetAll."},"added":"2023.10.13","realm":"Shared","file":{"text":"lua/includes/extensions/entity_iter.lua","line":"4-L11"},"rets":{"ret":[{"text":"The Iterator Function from ipairs.","name":"","type":"function"},{"text":"Table of all existing Entities.  This is a cached copy of ents.GetAll.","name":"","type":"table<Entity>","warning":"This table is intended to be read-only.\n\nModifying the return table will affect all subsequent calls to this function until the cache is refreshed, replacing all of your ents.GetAll usages may come with unintended side effects because of this."},{"text":"The starting index for the table of players.  \n\t\t\tThis is always `0` and is returned for the benefit of [Generic For-Loops](https://www.lua.org/pil/4.3.5.html).","name":"","type":"number"}]}},"example":{"description":"Deletes all physics props.","code":"for _, ent in ents.Iterator() do\n\tif ( ent:GetClass() == \"prop_physics\" ) then\n\t\tent:Remove()\n\tend\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Append","parent":"file","type":"libraryfunc","description":"Appends data to a file in the `data/` folder.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/file.lua","line":"31-L39"},"args":{"arg":[{"text":"The file's name.","name":"name","type":"string"},{"text":"The content which should be appended to the file.","name":"content","type":"string"}]},"rets":{"ret":{"text":"If the operation was successful.","name":"","type":"boolean","added":"2025.01.10"}}},"example":{"description":"Adds \"Append!\" to `helloworld.txt`, then prints it.","code":"file.Append( \"helloworld.txt\", \"Append!\" )\n\nprint( file.Read( \"helloworld.txt\", \"DATA\" ) )","output":"This is the content!Append!"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"AsyncRead","parent":"file","type":"libraryfunc","description":"Returns the content of a file asynchronously.\n\nAll limitations of file.Read also apply.","realm":"Shared","added":"2021.03.31","args":{"arg":[{"text":"The name of the file.","name":"fileName","type":"string"},{"text":"The path to look for the files and directories in. See this list for a list of valid paths.","name":"gamePath","type":"string"},{"text":"A callback function that will be called when the file read operation finishes.","name":"callback","type":"function","callback":{"arg":[{"text":"The `fileName` argument above.","type":"string","name":"fileName"},{"text":"The `gamePath` argument above.","type":"string","name":"gamePath"},{"text":"The status of the operation. The list can be found in Enums/FSASYNC.","type":"number","name":"status"},{"text":"The entirety of the data of the file.","type":"string","name":"data"}]}},{"text":"If `true` the file will be read synchronously.","name":"sync","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"FSASYNC_OK on success, FSASYNC_ERR_ on failure.","name":"status","type":"number{FSASYNC}"}}},"example":{"description":"Prints the SteamIDs of players who will be automatically assigned to a user group when they connect to a server (Sandbox gamemode and derived).","code":"file.AsyncRead( \"settings/users.txt\", \"GAME\", function( fileName, gamePath, status, data )\n\tif ( status == FSASYNC_OK ) then\n\t\tPrintTable( util.KeyValuesToTable( data ) )\n\tend\nend)","output":"```\nadmin:\n                garry   =       STEAM_0:1:7099\nsuperadmin:\n                garry   =       STEAM_0:1:7099\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CreateDir","parent":"file","type":"libraryfunc","description":"Creates a directory that is relative to the `data` folder.","realm":"Shared and Menu","args":{"arg":{"text":"The directory's name.","name":"name","type":"string"}}},"example":[{"description":"Creates a directory named `sample` in the `data` folder.","code":"file.CreateDir(\"sample\")"},{"description":"This function will create all subfolders you specify.","code":"file.CreateDir(\"a/b/c/d/e/f/g\")","output":"A folder named `a` is created in the data folder, which contains the folder named `b`, which contains a folder named `c`, etc."}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Delete","parent":"file","type":"libraryfunc","description":{"text":"Deletes a file or `empty` folder that is relative to the **data** folder. You can't remove any files outside of **data** folder.","note":"You are able to delete **any** file in the Menu state."},"realm":"Shared and Menu","args":{"arg":[{"text":"The file name.","name":"name","type":"string"},{"text":"The path to look for the files and directories in. See this list for a list of valid paths.","name":"path","type":"string","default":"DATA","note":"This is only available in the menu state."}]},"rets":{"ret":{"name":"success","type":"boolean","added":"2024.06.17"}}},"example":{"description":"Deletes **data/helloworld.txt** file.","code":"file.Delete( \"helloworld.txt\" )"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Exists","parent":"file","type":"libraryfunc","description":"Returns a boolean of whether the file or directory exists or not.    \n\t\tIf you want to check for a directory, file.IsDir will be faster since it won't check for files.","realm":"Shared and Menu","args":{"arg":[{"text":"The file or directory's name. ( You must include the file extension for files, for example \"data.txt\" )","name":"name","type":"string"},{"text":"The path to look for the files and directories in. See this list for a list of valid paths.","name":"gamePath","type":"string"}]},"rets":{"ret":{"text":"Returns `true` if the file exists and `false` if it does not.","name":"","type":"boolean"}}},"example":{"description":"Prints whether the `data` folder exists in the base directory.","code":"print( file.Exists( \"data\", \"GAME\" ) )","output":"```\ntrue\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Find","parent":"file","type":"libraryfunc","description":{"text":"Returns a list of files and directories inside a single folder.","warning":"It seems that paths with capital letters (e.g. lua/MyFolder/*) don't work as expected on Linux."},"realm":"Shared and Menu","args":{"arg":[{"text":"The wildcard to search for. `models/*.mdl` will list **.mdl** files in the `models/` folder.","name":"name","type":"string"},{"text":"The path to look for the files and directories in. See this list for a list of valid paths.","name":"path","type":"string"},{"text":"The sorting to be used, **optional**.\n\n* `nameasc` sort the files ascending by name.\n* `namedesc` sort the files descending by name.\n* `dateasc` sort the files ascending by date.\n* `datedesc` sort the files descending by date.","name":"sorting","type":"string","default":"nameasc"}]},"rets":{"ret":[{"text":"A table of found files, or `nil` if the path is invalid.","name":"","type":"table"},{"text":"A table of found directories, or `nil` if the path is invalid.","name":"","type":"table"}]}},"example":[{"description":"Prints the first file and the first directory in the `data` folder.","code":"local files, directories = file.Find( \"*\", \"DATA\" )\n\nprint( \"File: \" .. files[1], \"Folder: \" .. directories[1] )","output":"```\nFile: helloworld.txt\nFolder: ctp\n```"},{"description":"A poor-mans `whereis file` that can directly look inside a specific addon or all of them, recursively searches engine.GetAddons+addon titles for specific files inside them.","code":"local function recurseListContents(path, addon, direct, pattern)\n    local files, dirs = file.Find(path..\"*\", addon)\n    local matchedFiles = {}\n\n    for _, v in ipairs(files) do\n        local fullPath = path..v\n        if not pattern or string.match(fullPath, pattern) then\n            table.insert(matchedFiles, fullPath)\n        end\n    end\n    if direct then return matchedFiles end\n\n    for _, dir in ipairs(dirs) do\n        local subFiles = recurseListContents(path..dir..\"/\", addon, false, pattern)\n        for _, file in ipairs(subFiles) do\n            table.insert(matchedFiles, file)\n        end\n    end\n\n    return matchedFiles\nend\n\nfunction FindContentInAddon(the_special_content, in_a_specific_addon)\n    local addons = engine.GetAddons()\n\n    if not the_special_content then\n        for _, addon in ipairs(addons) do\n            local title = addon.title\n            print(\"\\nListing contents:\", title)\n            recurseListContents(\"\", title, false)\n        end\n        return\n    end\n\n    local found = {}\n    for _, addon in ipairs(addons) do\n        local title = in_a_specific_addon or addon.title\n        local path = addon.file\n        local pattern = the_special_content:gsub(\"%*\", \".*\")\n\n        local files = recurseListContents(\"\", title, false, pattern)\n        if #files > 0 then\n            table.insert(found, {title, files, path})\n        end\n\n        if in_a_specific_addon then break end\n    end\n\n    if #found > 0 then\n        for _, v in ipairs(found) do\n            local matches = #v[2]\n            print(matches..\" Match/es found in addon \\\"\"..v[1]..\"\\\" mounted at \"..v[3])\n            for _, filePath in ipairs(v[2]) do\n                print(\" - \"..filePath)\n            end\n        end\n    else\n        if in_a_specific_addon then\n            print(the_special_content..\" not found in \"..in_a_specific_addon..\"!\")\n        else\n            print(\" - \"..the_special_content..\" not found!\")\n        end\n    end\nend\nconcommand.Add(\"find_content\", function(ply, cmd, args) FindContentInAddon(args[1], args[2]) end)","output":"```\n] find_content *\n\t- lists all content in all addons, wildcards supported :)\n\n] find_content *.lua\n\t2 Match/es found in addon \"Extended Spawnmenu\" mounted at content/4000/104603291/104603291.gma\n\t\t- lua/autorun/rb655_extended_spawnmenu.lua\n\t\t- lua/autorun/rb655_legacy_addon_props.lua\n\t9 Match/es found in addon \"Seamless Portals\" mounted at content/4000/2773737445/gmpublisher.gma\n\t\t- lua/autorun/sh_detours.lua\n\t\t- lua/autorun/sh_portal_movement.lua\n\t\t- lua/autorun/client/cl_render_core.lua\n\t\t- lua/autorun/server/sv_portals_pvs.lua\n\t\t- lua/autorun/server/sv_prop_teleport.lua\n\t\t- lua/entities/seamless_portal.lua\n\t\t- lua/weapons/portal_gun.lua\n\t\t- lua/weapons/gmod_tool/stools/portal_creator_tool.lua\n\t\t- lua/weapons/gmod_tool/stools/portal_resizer_tool.lua\n\t7 Match/es found in addon \"Track Assembly Tool\" mounted at content/4000/287012681/TrackAssemblyTool.gma\n\t\t- lua/autorun/trackassembly_init.lua\n\t\t- lua/autorun/z_autorun_[shinji85_s_rails].lua\n\t\t- lua/entities/gmod_wire_expression2/core/custom/cl_trackasmlib_wire.lua\n\t\t- lua/entities/gmod_wire_expression2/core/custom/trackasmlib_wire.lua\n\t\t- lua/trackassembly/trackasmlib.lua\n\t\t- lua/vgui/dasminsliderbutton.lua\n\t\t- lua/weapons/gmod_tool/stools/trackassembly.lua\n\t1 Match/es found in addon \"Collision Resizer (ENHANCED)\" mounted at cache/workshop/217376234.gma\n\t\t- lua/weapons/gmod_tool/stools/advresizer.lua\n\t4 Match/es found in addon \"Advanced Material | REBORN\" mounted at content/4000/3118788923/gmpublisher.gma\n\t\t- lua/autorun/sh_mateditor_loader.lua\n\t\t- lua/mateditor/sh_advmat_footsteps.lua\n\t\t- lua/mateditor/sh_mateditor.lua\n\t\t- lua/weapons/gmod_tool/stools/advmat.lua\n\n] find_content m_anm.mdl\n1 Match/es found in addon \"[wOS] Animation Extension - Base (Full Version)\" mounted at content/4000/757604550/wiltos_animation_base.gma\n\t- models/m_anm.mdl\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsDir","parent":"file","type":"libraryfunc","description":"Returns whether the given file is a directory or not.","realm":"Shared and Menu","args":{"arg":[{"text":"The file or directory's name.","name":"fileName","type":"string"},{"text":"The path to look for the files and directories in. See this list for a list of valid paths.","name":"gamePath","type":"string"}]},"rets":{"ret":{"text":"`true` if the given path is a directory or `false` if it's a file.","name":"","type":"boolean"}}},"example":{"description":"Prints if `helloworld.txt` is a directory.","code":"print( file.IsDir( \"helloworld.txt\", \"DATA\" ) )","output":"```\nfalse\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Open","parent":"file","type":"libraryfunc","description":{"text":"Attempts to open a file with the given mode.","warning":"When trying to open files with the following characteristics, it returns nil:\n\nthe file extension is \".db; .mdmp; .dmp\" or \nthe file is \"server.cfg; autoexec.cfg; config.cfg; listenserver.cfg; mount.cfg\""},"realm":"Shared and Menu","args":{"arg":[{"text":"The files name. See file.Write for details on filename restrictions when writing to files.","name":"fileName","type":"string"},{"text":"The mode to open the file in. Possible values are:\n* **r** - read mode.\n* **w** - write mode.\n* **a** - append mode.\n* **rb** - binary read mode.\n* **wb** - binary write mode.\n* **ab** - binary append mode.","name":"fileMode","type":"string"},{"text":"The path to look for the files and directories in. See this list for a list of valid paths.","name":"gamePath","type":"string"}]},"rets":{"ret":{"text":"The opened file object, or `nil` if it failed to open due to it not existing or being used by another process.","name":"File","type":"file_class"}}},"example":{"description":"Open a file in read only mode, reads a line, tells where the current file pointer is at and then closes the file handle.","code":"local f = file.Open( \"cfg/mapcycle.txt\", \"r\", \"MOD\" )\nprint( f:ReadLine() )\nprint( f:ReadLine() )\nprint( f:Tell() )\nf:Close()","output":"```\n//\n// Default mapcycle file for Garry's Mod.\n45\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Read","parent":"file","type":"libraryfunc","description":{"text":"Returns the content of a file.","warning":"Beware of casing -- some filesystems are case-sensitive. SRCDS on Linux seems to force file/directory creation to lowercase, but will not modify read operations."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/file.lua","line":"4-L19"},"args":{"arg":[{"text":"The name of the file.","name":"fileName","type":"string"},{"text":"The path to look for the files and directories in. See this list for a list of valid paths.","name":"gamePath","type":"string","default":"DATA"}]},"rets":{"ret":{"text":"The data from the file as a string, or `nil` if the file isn't found.","name":"","type":"string"}}},"example":{"description":"Prints out the content of `helloworld.txt`.","code":"print( file.Read( \"helloworld.txt\", \"DATA\" ) )","output":"```\nThis is the content!\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Rename","parent":"file","type":"libraryfunc","description":"Attempts to rename a file with the given name to another given name.\n\nThis function is constrained to the `data/` folder.","realm":"Shared and Menu","args":{"arg":[{"text":"The original file or folder name. See file.Write for details on filename restrictions when writing to files.\n\n**This argument will be forced lowercase.**","name":"orignalFileName","type":"string"},{"text":"The target file or folder name. See file.Write for details on filename restrictions when writing to files.\n\n**This argument will be forced lowercase.**","name":"targetFileName","type":"string"}]},"rets":{"ret":{"text":"`true` on success, `false` otherwise.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Size","parent":"file","type":"libraryfunc","description":"Returns the file's size in bytes.","realm":"Shared and Menu","args":{"arg":[{"text":"The file's name.","name":"fileName","type":"string"},{"text":"The path to look for the files and directories in. See this list for a list of valid paths.","name":"gamePath","type":"string"}]},"rets":{"ret":{"text":"The file size in bytes, or `-1` if the file is not found.","name":"","type":"number"}}},"example":{"description":"Prints the size of `helloworld.txt`.","code":"print( file.Size(\"helloworld.txt\", \"DATA\") )","output":"8"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Time","parent":"file","type":"libraryfunc","description":"Returns when the file or folder was last modified in Unix time.","realm":"Shared and Menu","args":{"arg":[{"text":"The **file** or **folder** path.","name":"path","type":"string"},{"text":"The path to look for the files and directories in. See this list for a list of valid paths.","name":"gamePath","type":"string"}]},"rets":{"ret":{"text":"Seconds passed since Unix epoch, or `0` if the file is not found.","name":"","type":"number"}}},"example":[{"description":"Prints out the last modified date of **file** helloworld.txt.","code":"print( os.date(\"%d.%m.%Y\", file.Time(\"helloworld.txt\", \"DATA\") ) )","output":"04.08.2012"},{"description":"Prints out the last modified date of **folder** lua.","code":"print( os.date( \"%d.%m.%Y\", file.Time( \"lua\", \"GAME\" ) ) )","output":"31.01.2016"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Write","parent":"file","type":"libraryfunc","description":"Writes the given string to a file. Erases all previous data in the file. To add data without deleting previous data, use file.Append.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/file.lua","line":"21-L29"},"args":{"arg":[{"text":"The name of the file being written into. The path is relative to the `data/` folder.\n\nThis argument will be forced lowercase.\n\nThe filename **must** end with one of the following:\n* .txt\n* .dat\n* .json\n* .xml\n* .csv\n* .dem\n* .vcd\n* .gma\n* .mdl\n* .phy\n* .vvd\n* .vtx\n* .ani\n* .vtf\n* .vmt\n* .png\n* .jpg\n* .jpeg\n* .mp3\n* .wav\n* .ogg\n\nRestricted symbols are: `\":`, and multiple consecutive spaces, as well as pretty much every other non Latin (a-Z) character","name":"fileName","type":"string"},{"text":"The content that will be written into the file.","name":"content","type":"string"}]},"rets":{"ret":{"text":"If the operation was successful.","name":"","type":"boolean","added":"2025.01.10"}}},"example":{"description":"Writes to **data/helloworld.txt**.","code":"file.Write( \"helloworld.txt\", \"This is the content!\" )"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"AddFrame","parent":"frame_blend","type":"libraryfunc","description":{"text":"Adds a frame to the blend. Calls frame_blend.CompleteFrame once enough frames have passed since last frame_blend.CompleteFrame call.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"BlendFrame","parent":"frame_blend","type":"libraryfunc","description":{"text":"Blends the frame(s).","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"CompleteFrame","parent":"frame_blend","type":"libraryfunc","description":{"text":"Renders the frame onto internal render target.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawPreview","parent":"frame_blend","type":"libraryfunc","description":{"text":"Actually draws the frame blend effect.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsActive","parent":"frame_blend","type":"libraryfunc","description":"Returns whether frame blend post processing effect is enabled or not.","realm":"Client","rets":{"ret":{"text":"Is frame blend enabled or not.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsLastFrame","parent":"frame_blend","type":"libraryfunc","description":{"text":"Returns whether the current frame is the last frame?","internal":""},"realm":"Client","rets":{"ret":{"text":"Whether the current frame is the last frame?","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"RenderableFrames","parent":"frame_blend","type":"libraryfunc","description":{"text":"Returns amount of frames needed to render?","internal":""},"realm":"Client","rets":{"ret":{"text":"Amount of frames needed to render?","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ShouldSkipFrame","parent":"frame_blend","type":"libraryfunc","description":"Returns whether we should skip frame or not.","realm":"Client","rets":{"ret":{"text":"Should the frame be skipped or not.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddAmmoType","parent":"game","type":"libraryfunc","description":{"text":"Adds a new ammo type to the game.\n\nYou can find a list of default ammo types [here](https://wiki.facepunch.com/gmod/Default_Ammo_Types).","warning":"This function **must** be called on both the client and server in GM:Initialize or you will have unexpected problems.","note":"There is a limit of 256 ammo types, including the default ones."},"realm":"Shared","file":{"text":"lua/includes/extensions/game.lua","line":"2-L40"},"args":{"arg":{"text":"The attributes of the ammo. See the Structures/AmmoData.","name":"ammoData","type":"table{AmmoData}"}}},"example":{"description":"Add an ammo type.","code":"game.AddAmmoType( {\n\tname = \"BULLET_PLAYER_556MM\", -- Note that whenever picked up, the localization string will be '#BULLET_PLAYER_556MM_ammo'\n\tdmgtype = DMG_BULLET, \n\ttracer = TRACER_LINE,\n\tplydmg = 0, -- This can either be a number or a ConVar name.\n\tnpcdmg = 0, -- Ditto.\n\tforce = 2000,\n\tmaxcarry = 120, -- Ditto.\n\tminsplash = 10,\n\tmaxsplash = 5\n} )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddDecal","parent":"game","type":"libraryfunc","description":{"text":"Registers a new decal.","warning":"There's a rather low limit of around 256 for decal materials that may be registered and they are not cleared on map load."},"realm":"Shared","args":{"arg":[{"text":"The name of the decal.","name":"decalName","type":"string"},{"text":"The material to be used for the decal. May also be a list of material names, in which case a random material from that list will be chosen every time the decal is placed.","name":"materialName","type":"string"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddParticles","parent":"game","type":"libraryfunc","description":{"text":"Loads a particle file. Individual particle systems will still need to be precached with Global.PrecacheParticleSystem.","note":"You will still need to call this function clientside regardless if you create the particle effects serverside."},"realm":"Shared","args":{"arg":{"text":"The path of the file to add. Must be `(file).pcf`.","name":"particleFileName","type":"string"}}},"example":{"description":"Example usage of the function. Precaches `ExplosionCore_wall` particle from `particles/explosion.pcf`, a Team Fortress 2 particle file.\n\nYou can find a list of particles inside a .pcf file using the [Particle Editor Tool](https://developer.valvesoftware.com/wiki/Particle_Editor).","code":"game.AddParticles( \"particles/explosion.pcf\" )\n\nif ( SERVER ) then\n\t-- A test console command to see if the particle works, spawns the particle where the player is looking at. \n\tconcommand.Add( \"particleitup\", function( ply, cmd, args )\n\t\tPrecacheParticleSystem( \"ExplosionCore_wall\" )\n\t\tParticleEffect( \"ExplosionCore_wall\", ply:GetEyeTrace().HitPos, Angle( 0, 0, 0 ) )\n\tend )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"BuildAmmoTypes","parent":"game","type":"libraryfunc","description":{"text":"Called by the engine to retrieve the ammo types.","internal":"Consider using game.GetAmmoTypes and game.GetAmmoData instead."},"realm":"Shared","file":{"text":"lua/includes/extensions/game.lua","line":"46-L54"},"rets":{"ret":{"text":"All ammo types registered via game.AddAmmoType, sorted by its name value.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CleanUpMap","parent":"game","type":"libraryfunc","description":{"text":"Removes most entities, and then respawns entities created by the map, as if the map was just loaded.\n\nThere are certain exclusions, such as players or weapons held by players, soundscapes and others.  \nEFL_KEEP_ON_RECREATE_ENTITIES can be set on entities to preserve them through a map cleanup.\n\nOn the client it will remove decals, sounds, gibs, dead NPCs, and entities created via ents.CreateClientProp. This function is ran on all clients from server automatically, when it is called on the server.\n\nThis function calls GM:PreCleanupMap before cleaning up the map and GM:PostCleanupMap after cleaning up the map.\n\nBeware of calling this function in hooks that may be called on map clean up (such as ENTITY:StartTouch) to avoid infinite loops.","bug":[{"text":"Calling this destroys all BASS streams.","issue":"2874"},{"text":"The EFL_KEEP_ON_RECREATE_ENTITIES flag doesn't prevent an entity from being recreated, which means flagged entities will be duplicated since they are both kept and recreated.","issue":"6105"}]},"realm":"Shared","args":{"arg":[{"text":"If set to `true`, don't run this functions on all clients.","name":"dontSendToClients","type":"boolean","default":"false"},{"text":"Entity classes not to reset during cleanup.","name":"extraFilters","type":"table","default":"{}"},{"text":"If set, delays the map cleanup until the end of a server tick, allowing bypassing the entity limit on maps with large amounts of them. Otherwise the entities will not be cleaned up until the end of the server tick.\n\nThe callback function will be called after the map cleanup has been performed.","name":"callback","type":"function","default":"nil","added":"2024.01.04"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ConsoleCommand","parent":"game","type":"libraryfunc","description":{"text":"Runs a console command.\nMake sure to add a newline (\"\\n\") at the end of the command.","warning":"If you use data that were received from a client, you should avoid using this function because newline and semicolon (at least) allow the client to run arbitrary commands!\n\nFor safety, you are urged to prefer using Global.RunConsoleCommand in this case."},"realm":"Server","args":{"arg":{"text":"String containing the command and arguments to be ran.","name":"stringCommand","type":"string"}}},"example":{"description":"Changes the gravity to 400 (default 600).","code":"game.ConsoleCommand(\"sv_gravity 400\\n\")"},"realms":["Server"],"type":"Function"},
{"function":{"name":"Get3DSkyboxInfo","parent":"game","type":"libraryfunc","description":"Returns information about the currently active 3D skybox.","added":"2026.02.13","realm":"Shared","rets":{"ret":{"text":"The 3D skybox info, or `nil` if the map has no 3d skybox or the function is called too soon during server start up.","name":"sky3dparams","type":"table<Structures/Sky3DParams>"}}},"example":{"description":"Shows hit position of ray on world and 3d skybox.","code":"local color_green = Color( 0, 255, 0 )\n\nhook.Add( \"PostDrawTranslucentRenderables\", \"MySuper3DHook\", function()\n\tlocal sky3dparams = game.Get3DSkyboxInfo()\n\tif ( !sky3dparams ) then return end\n\n\tlocal skyboxOrigin = sky3dparams.origin\n\tlocal skyboxScale = sky3dparams.scale\n\n\tlocal client = LocalPlayer()\n\tlocal eyepos = client:EyePos()\n\n\tlocal dir = client:EyeAngles():Forward() * 100000000\n\n\tlocal tr = util.TraceLine({\n\t    start = eyepos;\n\t    endpos = eyepos + dir;\n\t    filter = {client:GetVehicle(), client:GetViewEntity() or client};\n\t    mask = MASK_BLOCKLOS_AND_NPCS;\n\t})\n\n\tlocal hitPos = tr.HitPos\n\tlocal hitSky = tr.HitSky\n\n\tif hitSky and GetConVar(\"r_3dsky\"):GetBool() == true then\n\t    local eye_sky = skyboxOrigin + eyepos / skyboxScale -- transform eyepos to 3d skybox space\n\n\t    local tr = util.TraceLine({\n\t\t    start = eye_sky;\n\t\t    endpos = eye_sky + dir;\n\t\t    mask = MASK_BLOCKLOS_AND_NPCS;\n\t\t})\n\n\t\thitPos = ( tr.HitPos - skyboxOrigin ) * skyboxScale -- transform hitpos from 3d skybox space to world space\n\tend\n\n\trender.SetColorMaterial()\n\trender.DrawSphere(hitPos, 64, 16, 16, color_green)\nend )","output":{"image":{"src":"b5f72/8de6ae3e1295671.gif","size":"2946269","name":"Sky3D.gif"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAmmoDamageType","parent":"game","type":"libraryfunc","description":"Returns the damage type of given ammo type.","realm":"Shared","args":{"arg":{"text":"Ammo ID to retrieve the damage type of. Starts from 1.","name":"id","type":"number"}},"rets":{"ret":{"text":"See Enums/DMG.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAmmoData","parent":"game","type":"libraryfunc","description":"Returns the Structures/AmmoData for given ID.","realm":"Shared","args":{"arg":{"text":"ID of the ammo type to look up the data for.","name":"id","type":"number"}},"rets":{"ret":{"text":"The Structures/AmmoData containing all ammo data.","name":"","type":"table{AmmoData}"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAmmoForce","parent":"game","type":"libraryfunc","description":"Returns the ammo bullet force that is applied when an entity is hit by a bullet of given ammo type.","realm":"Shared","args":{"arg":{"text":"Ammo ID to retrieve the force of. Starts from 1.","name":"id","type":"number"}},"rets":{"ret":{"text":"The ammo force.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAmmoID","parent":"game","type":"libraryfunc","description":"Returns the ammo type ID for given ammo type name.\n\nSee game.GetAmmoName for reverse.","realm":"Shared","args":{"arg":{"text":"Name of the ammo type to look up ID of.","name":"name","type":"string"}},"rets":{"ret":{"text":"The ammo type ID of given ammo type name, or -1 if not found.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAmmoMax","parent":"game","type":"libraryfunc","description":"Returns the real maximum amount of ammo of given ammo ID, regardless of the setting of `gmod_maxammo` convar.","realm":"Shared","args":{"arg":{"text":"Ammo type ID.","name":"id","type":"number"}},"rets":{"ret":{"text":"The maximum amount of reserve ammo a player can hold of this ammo type.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAmmoName","parent":"game","type":"libraryfunc","description":"Returns the ammo name for given ammo type ID.\n\nSee game.GetAmmoID for reverse.","realm":"Shared","args":{"arg":{"text":"Ammo ID to retrieve the name of. Starts from 1.","name":"id","type":"number"}},"rets":{"ret":{"text":"The name of given ammo type ID or nil if ammo type ID is invalid.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAmmoNPCDamage","parent":"game","type":"libraryfunc","description":"Returns the damage given ammo type should do to NPCs.","realm":"Shared","args":{"arg":{"text":"Ammo ID to retrieve the damage info of. Starts from 1.","name":"id","type":"number"}},"rets":{"ret":{"name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAmmoPlayerDamage","parent":"game","type":"libraryfunc","description":"Returns the damage given ammo type should do to players.","realm":"Shared","args":{"arg":{"text":"Ammo ID to retrieve the damage info of. Starts from 1.","name":"id","type":"number"}},"rets":{"ret":{"name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAmmoTypes","parent":"game","type":"libraryfunc","description":"Returns a list of all ammo types currently registered.","realm":"Shared","rets":{"ret":{"text":"A table containing all ammo types. The keys are ammo IDs, the values are the names associated with those IDs.","name":"","type":"table<number,string>"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGlobalCounter","parent":"game","type":"libraryfunc","description":"Returns the counter of a Global State.\n\nSee Global States for more information.","realm":"Server","args":{"arg":{"text":"The name of the Global State to set. \n\nIf the Global State by that name does not exist, it will be created.\n\nSee Global States for a list of default global states.","name":"name","type":"string"}},"rets":{"ret":{"text":"The value of the given Global State, 0 if the global state doesn't exist.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetGlobalState","parent":"game","type":"libraryfunc","description":"Returns whether a Global State is off, active or dead ( inactive ).\n\nSee Global States for more information.","realm":"Server","args":{"arg":{"text":"The name of the Global State to retrieve the state of. \n\nIf the Global State by that name does not exist, **GLOBAL_DEAD** will be returned.\n\nSee Global States for a list of default global states.","name":"name","type":"string"}},"rets":{"ret":{"text":"The state of the Global State. See Enums/GLOBAL.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetIPAddress","parent":"game","type":"libraryfunc","description":{"text":"Returns the public IP address and port of the current server. This will return the IP/port that you are connecting through when ran clientside.","note":"Returns \"loopback\" in singleplayer.","bug":{"text":"Returns \"0.0.0.0:`port`\" on the server when called too early, including in GM:Initialize and GM:InitPostEntity. This bug seems to only happen the first time a server is launched, and will return the correct value after switching maps.","issue":"3001"}},"realm":"Shared","rets":{"ret":{"text":"The IP address and port in the format \"x.x.x.x:x\".","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMap","parent":"game","type":"libraryfunc","description":{"text":"Returns the name of the current map, without a file extension.\nOn the menu state, returns \"menu\".","warning":"In Multiplayer this does not return the current map in the CLIENT realm before GM:Initialize."},"realm":"Shared and Menu","rets":{"ret":{"text":"The name of the current map, without a file extension.","name":"","type":"string"}}},"example":{"code":"print(game.GetMap())","output":"gm_flatgrass"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetMapChangeCount","parent":"game","type":"libraryfunc","description":"Returns the current map change count for the server.\n\nThis is useful to determine whether the current map is the initial map, or whether a `changelevel` (using `map` command is also detected) has occurred at any point in the server's session.","added":"2025.11.28","realm":"Server","rets":{"ret":{"text":"The current map change count. Will start at `1`.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetMapNext","parent":"game","type":"libraryfunc","description":"Returns the next map that would be loaded according to the file that is set by the mapcyclefile convar.","realm":"Server","rets":{"ret":{"text":"nextMap or nil if called too early.","name":"","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetMapVersion","parent":"game","type":"libraryfunc","description":"Returns the revision (Not to be confused with [VBSP Version](https://developer.valvesoftware.com/wiki/Source_BSP_File_Format#Versions)) and BSP version of the current map.\n\nMap revision is the amount of times the map file was saved in Hammer at the time of the map being compiled. This is useful to detect when a map has changed.","realm":"Server","rets":{"ret":[{"text":"Revision of the currently loaded map.","name":"","type":"number"},{"text":"BSP version.","name":"","type":"number","added":"2026.02.06"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetSkillLevel","parent":"game","type":"libraryfunc","description":{"text":"Returns the difficulty level of the game.\n\n**TIP:** You can use this function in your scripted NPCs or Nextbots to make them stronger, however, it is a good idea to lock powerful attacks behind the highest difficulty instead of just increasing the health.","note":"Internally this is tied to the gamerules entity, so you'll have to wait until GM:InitPostEntity is called to return the skill level."},"realm":"Shared","rets":{"ret":{"text":"The difficulty level, Easy (1), Normal (2), Hard (3).","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetTimeScale","parent":"game","type":"libraryfunc","description":"Returns the time scale set with game.SetTimeScale.\n\n\t\tIf you want to get the value of `host_timescale`, use:\n\t\t```lua\nlocal timescale = GetConVar( \"host_timescale\" ):GetFloat()\n\t\t```","realm":"Shared","rets":{"ret":{"text":"The time scale.","name":"","type":"number"}}},"example":{"description":"Printing the true timescale.","code":"-- getting the true timescale.\nlocal host_timescale = math.Round( GetConVar( \"host_timescale\" ):GetFloat(), 1 ) -- it will return 1.0000000149012 so we use math.Round\nlocal game_timescale = game.GetTimeScale()\nprint( \"True Timescale: \" .. host_timescale  * game_timescale )\n\n-- example of the true timescale\nif SERVER then\n\tRunConsoleCommand( \"host_timescale\", 0.2 ) -- we cannot use SetFloat on a ConVar not created by Lua.\n\tgame.SetTimeScale(5)\nend\n\nlocal host_timescale = math.Round( GetConVar( \"host_timescale\" ):GetFloat(), 1 ) -- it will return 0.20000000298023 so we use math.Round\nlocal game_timescale = game.GetTimeScale()\nprint( \"Host_TimeScale: \" .. host_timescale )\nprint( \"Game_TimeScale: \" .. game_timescale )\nprint( \"True Timescale: \" .. host_timescale  * game_timescale ) -- should be 1 because 0.2 * 5 is 1.","output":"```lua\nTrue Timescale: 1\n\nHost_TimeScale: 0.2\nGame_TimeScale: 5\nTrue Timescale: 1\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetWindSpeed","parent":"game","type":"libraryfunc","description":"Returns the wind's velocity at a given position, as influenced by current map's [env_wind](https://developer.valvesoftware.com/wiki/Env_wind) entities.","added":"2026.01.17","realm":"Shared","args":{"arg":{"text":"The point to get wind speed at.\n\nIf specified, wind controllers with `windradius` other than `-1` will be taken into account, if the point is within their radius.  \nIf omitted, only the global wind controller will be used (if one exists).","name":"pos","type":"Vector","default":"nil","note":"This argument will be ignored on the `CLIENT` realm and will be treated as `nil` because the position of `env_wind` is not currently networked to clients."}},"rets":{"ret":{"text":"`windDir * windSpeed` — the current wind direction multiplied by the current total wind speed.\n\nSee [env_wind_shared.cpp#L255-L258](https://github.com/ValveSoftware/source-sdk-2013/blob/master/src/game/shared/env_wind_shared.cpp#L255-L258) for how it's calculated.","name":"windVelocity","type":"Vector"}}},"example":{"description":"Visualizes the wind's speed and direction with a line in the center of the screen.","code":"local lineColor = Color( 175, 219, 245 )\n\nhook.Add( \"PostDrawTranslucentRenderables\", \"VisualizeWindVector\", function()\n\tlocal windCheckPos = LocalPlayer():EyePos() + LocalPlayer():EyeAngles():Forward() * 100\n\n\trender.DrawLine( windCheckPos, windCheckPos + game.GetWindSpeed( windCheckPos ), lineColor )\nend )","output":{"image":{"src":"b2b4c/8de5835cfe4c192.gif","size":"840549","name":"WindDirection.gif"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetWorld","parent":"game","type":"libraryfunc","description":"Returns the worldspawn entity.","realm":"Shared","rets":{"ret":{"text":"The world.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsDedicated","parent":"game","type":"libraryfunc","description":"Returns true if the server is a dedicated server, false if it is a listen server or a singleplayer game.","realm":"Shared","rets":{"ret":{"text":"Is the server dedicated or not.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"KickID","parent":"game","type":"libraryfunc","description":"Kicks a player from the server. This can be ran before the player has spawned.","realm":"Server","args":{"arg":[{"text":"UserID, SteamID or SteamID64 of the player to kick. Uses SteamID32 eg STEAM_0:0:00000000.","name":"id","type":"string"},{"text":"Reason to display to the player. This can span across multiple lines.","name":"reason","type":"string","default":"No reason given","warning":"This will be shortened to ~512 chars, though this includes the command itself and the player index so will realistically be more around ~483. It is recommended to avoid going near the limit to avoid truncation."}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"LoadNextMap","parent":"game","type":"libraryfunc","description":"Loads the next map according to the `nextlevel` convar, or from the current `mapcyclefile` set by the respective convar.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"MapLoadType","parent":"game","type":"libraryfunc","description":"Returns the map load type of the current map.\n\nAfter changing the map with the console command `changelevel`, \"newgame\" is returned. With `changelevel2` (single player only), \"transition\" is returned.","realm":"Server","rets":{"ret":{"text":"The load type. Possible values are: \"newgame\", \"loadgame\", \"transition\", \"background\".","name":"","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"MaxPlayers","parent":"game","type":"libraryfunc","description":"Returns the maximum amount of players (including bots) that the server can have.","realm":"Shared","rets":{"ret":{"text":"The maximum amount of players.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"MountGMA","parent":"game","type":"libraryfunc","description":{"text":"Mounts a GMA addon from the disk.\nCan be used with steamworks.DownloadUGC.","note":"Any error models currently loaded that the mounted addon provides will be reloaded.\n\n\nAny error materials currently loaded that the mounted addon provides will NOT be reloaded. That means that this cannot be used to fix missing map materials, as the map materials are loaded before you are able to call this."},"realm":"Shared","args":{"arg":{"text":"Location of the GMA file to mount, retrieved from steamworks.DownloadUGC or relative to the `garrysmod/` directory (ignores mounting). This file does not have to end with the .gma extension, but will be interpreted as a GMA.","name":"path","type":"string"}},"rets":{"ret":[{"text":"success.","name":"","type":"boolean"},{"text":"If successful, a table of files that have been mounted.","name":"","type":"table"}]}},"example":{"description":"Downloads the Playable Piano addon and mounts the content.","code":"steamworks.DownloadUGC( \"104548572\", function( path )\n\tgame.MountGMA( path )\nend)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RemoveRagdolls","parent":"game","type":"libraryfunc","description":"Removes all the clientside ragdolls. On server, it will remove all `prop_ragdolls` that have the `SF_RAGDOLLPROP_USE_LRU_RETIREMENT` (4096) spawnflag.","realm":"Shared"},"example":{"description":"This will remove all the client ragdolls every 3 seconds.","code":"timer.Create( \"removeRagdolls\", 3, 0, function() game.RemoveRagdolls() end )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetGlobalCounter","parent":"game","type":"libraryfunc","description":"Sets the counter of a Global State.\n\nSee Global States for more information.","realm":"Server","args":{"arg":[{"text":"The name of the Global State to set. \n\nIf the Global State by that name does not exist, it will be created.\n\nSee Global States for a list of default global states.","name":"name","type":"string"},{"text":"The value to set for that Global State.","name":"count","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetGlobalState","parent":"game","type":"libraryfunc","description":"Sets whether a Global State is off, active or dead ( inactive ).\n\nSee Global States for more information.","realm":"Server","args":{"arg":[{"text":"The name of the Global State to set. \n\nIf the Global State by that name does not exist, it will be created.\n\nSee Global States for a list of default global states.","name":"name","type":"string"},{"text":"The state of the Global State. See Enums/GLOBAL.","name":"state","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetSkillLevel","parent":"game","type":"libraryfunc","description":"Sets the difficulty level of the game, can be retrieved with game.GetSkillLevel.\n\nThis will automatically change whenever the \"skill\" convar is modified serverside.","realm":"Server","args":{"arg":{"text":"The difficulty level, Easy( 1 ), Normal( 2 ), Hard( 3 ).","name":"level","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetTimeScale","parent":"game","type":"libraryfunc","description":"Sets the time scale of the game logic.\n\nTo slow down or speed up the movement of a specific player, use Player:SetLaggedMovementValue instead.\n\nSee physenv.SetTimeScale if you wish to only scale the physics timescale.\n\nThis function is meant to remove the need of using the `host_timescale` convar, which is cheat protected.  \nThe true timescale will be `host_timescale` multiplied by game.GetTimeScale.\n\nLike `host_timescale`, this method does not affect sounds, if you wish to change that, look into GM:EntityEmitSound.","realm":"Server","args":{"arg":{"text":"The new timescale, minimum value is 0.001 and maximum is 5.","name":"timeScale","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SinglePlayer","parent":"game","type":"libraryfunc","description":"Returns whether the current session is a single player game.","realm":"Shared","rets":{"ret":{"text":"isSinglePlayer.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"StartSpot","parent":"game","type":"libraryfunc","description":"Returns the name of the entity that should be used as player start position.\n\nThis is not the same thing as spawn points (See GM:PlayerSelectSpawn for that), this is used to properly transit the player between maps, and therefore will only be set after a level change via `trigger_changelevel` entity in singleplayer.","realm":"Server","rets":{"ret":{"text":"The name of the entity that should be used as start position.","name":"","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Listen","parent":"gameevent","type":"libraryfunc","description":{"text":"Adds a [game event](gameevent) listener, creating a new hook using the hook library, which can be listened to via hook.Add with the given `eventName` as event.","note":"All gameevents are called in the **Menu State**, but if you want to use them you need to use some DLL(like [this](https://github.com/RaphaelIT7/gmod-gameevent) one) or you need to create your own."},"realm":"Shared","args":{"arg":{"text":"The event to listen to. List of valid events (with examples) can be found [here](gameevent).","name":"eventName","type":"string"}}},"example":{"description":"Example usage of this function. Listens to the player_disconnect game event and prints a message every time it is ran.","code":"gameevent.Listen( \"player_disconnect\" )\nhook.Add( \"player_disconnect\", \"my_player_disconnect_hook\", function( ... )\n\tprint( \"player_disconnect\", ... )\nend)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Call","parent":"gamemode","type":"libraryfunc","description":"Called by the engine to call a hook within the loaded gamemode.\n\nThe supplied event 'name' must be defined in the active gamemode. Otherwise, nothing will happen - not even hooks added with hook.Add will be called.\n\nThis is similar to hook.Run and hook.Call, except the hook library will call hooks created with hook.Add even if there is no corresponding gamemode function.","realm":"Shared","file":{"text":"lua/includes/modules/gamemode.lua","line":"74-L83"},"args":{"arg":[{"text":"The name of the hook to call.","name":"name","type":"string"},{"text":"The arguments.","name":"args","type":"vararg"}]},"rets":{"ret":{"text":"The result of the hook function - can be up to 6 values. Returns false if the gamemode function doesn't exist (i.e. nothing happened), but remember - a hook can also return false.","name":"","type":"any"}}},"example":{"description":"Shows a suicide death notice in Sandbox.","code":"local ply = Entity(1)\ngamemode.Call( \"AddDeathNotice\", ply:GetName(), ply:Team(), nil, ply:GetName(), ply:Team() )","output":{"image":{"src":"suidcide_death_notice.jpg"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Get","parent":"gamemode","type":"libraryfunc","description":{"text":"This returns the internally stored gamemode table.","internal":""},"realm":"Shared","file":{"text":"lua/includes/modules/gamemode.lua","line":"66-L68"},"args":{"arg":{"text":"The name of the gamemode you want to get.","name":"name","type":"string"}},"rets":{"ret":{"text":"The gamemode's table.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Register","parent":"gamemode","type":"libraryfunc","description":{"text":"Called by the engine when a gamemode is being loaded.","internal":""},"realm":"Shared","file":{"text":"lua/includes/modules/gamemode.lua","line":"20-L60"},"args":{"arg":[{"text":"Your GM table.","name":"gm","type":"table"},{"text":"Name of your gamemode, lowercase, no spaces.","name":"name","type":"string"},{"text":"The gamemode name that your gamemode is derived from.","name":"derived","type":"string"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGamemode","parent":"gmod","type":"libraryfunc","description":"Returns the GAMEMODE table.\n\nYou will want to wait until GM:OnGamemodeLoaded for it to return a valid value.","realm":"Shared","rets":{"ret":{"text":"The `GAMEMODE` table.","name":"","type":"table{GM}"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"LoadMap","parent":"gmsave","type":"libraryfunc","description":"Loads a saved map.","realm":"Server","file":{"text":"lua/includes/gmsave.lua","line":"11-L78"},"args":{"arg":[{"text":"The JSON encoded string containing all the map data.","name":"mapData","type":"string"},{"text":"The player to load positions for.","name":"ply","type":"Player","default":"NULL"},{"text":"A function to be called after all the entities have been placed.","name":"callback","type":"function","default":"nil"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerLoad","parent":"gmsave","type":"libraryfunc","description":"Sets player position and angles from supplied table.","realm":"Server","file":{"text":"lua/includes/gmsave/player.lua","line":"14-L22"},"args":{"arg":[{"text":"The player to \"load\" values for.","name":"ply","type":"Player"},{"text":"A table containing Origin and Angle keys for position and angles to set.","name":"data","type":"table"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSave","parent":"gmsave","type":"libraryfunc","description":"Returns a table containing player position and angles. Used by gmsave.SaveMap.","realm":"Server","file":{"text":"lua/includes/gmsave/player.lua","line":"2-L12"},"args":{"arg":{"text":"The player to \"save\".","name":"ply","type":"Player"}},"rets":{"ret":{"text":"A table containing player position ( Origin ) and angles ( Angle ).","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SaveMap","parent":"gmsave","type":"libraryfunc","description":"Saves the map.","realm":"Server","file":{"text":"lua/includes/gmsave.lua","line":"80-L108"},"args":{"arg":{"text":"The player, whose position should be saved for loading the save.","name":"ply","type":"Player"}},"rets":{"ret":{"text":"The encoded to JSON string containing save data.","name":"","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ShouldSaveEntity","parent":"gmsave","type":"libraryfunc","description":"Returns if we should save this entity in a duplication or a map save or not.","realm":"Server","file":{"text":"lua/includes/gmsave/entity_filters.lua","line":"49-L79"},"args":{"arg":[{"text":"The entity.","name":"ent","type":"Entity"},{"text":"A table containing classname key with entities classname.","name":"t","type":"table"}]},"rets":{"ret":{"text":"Should save entity or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ActivateGameUI","parent":"gui","type":"libraryfunc","description":"Opens the game main menu as if the player pressed their Escape key.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddCaption","parent":"gui","type":"libraryfunc","description":{"text":"Pushes text to the closed caption box.","warning":"The function will not work, if the console command variable `closecaption` is set to 0."},"realm":"Client","added":"2023.09.19","args":{"arg":[{"text":"The caption to emit. See [Closed Captions](https://developer.valvesoftware.com/wiki/Closed_Captions) for more info.\n\nNote the ability to add special commands to captions, such as `","name":"captionStream","type":"string","sfx":"` to mark the caption as a sound effect caption, which would be hidden if `cc_subtitles` is set to 1. (To only show dialogue subtitles)"},{"text":"How long the caption should stay for","name":"duration","type":"number"},{"text":"Is this caption coming from the player?\n\nThis is used to give different colors to the caption to differentiate, for example, whether the SMG is fired by the player or an NPC.","name":"fromPlayer","type":"boolean","default":"false"}]}},"example":{"description":"Prints \"Hello World\" in bold","code":{"text":"// For the sake of the test: activate the caption system.\n// You should not be forcing this option on players, it should be up to the player to choose whether they want to see captions or not.\nRunConsoleCommand( \"closecaption\", \"1\" )\n\n// Push a new caption text to the UI\ngui.AddCaption( \"","b":{"text":"Hello World!","b":"\", 5 )"}},"output":{"upload":{"src":"b58a0/8dda6157895b35e.png","size":"545375","name":"image.png"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"EnableScreenClicker","parent":"gui","type":"libraryfunc","description":{"text":"Enables the mouse cursor without restricting player movement, like using Sandbox's context menu. See vgui.CursorVisible for a function to see if the cursor is visible or not.","note":"Some CUserCmd functions will return incorrect values when this function is active because [the user input is getting overtaken by the vgui system](https://github.com/Facepunch/garrysmod-issues/issues/982#issuecomment-505671531)."},"realm":"Client","args":{"arg":{"text":"Whether the cursor should be enabled or not. (true = enable, false = disable)","name":"enabled","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"HideGameUI","parent":"gui","type":"libraryfunc","description":"Hides the game main menu if it is currently open.\n\nThis can only be ran a certain amount of times per second to prevent main menu being completely inaccessible by the player.\n\nUse GM:OnPauseMenuShow to prevent opening the main menu without a one frame flash.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InternalCursorMoved","parent":"gui","type":"libraryfunc","description":"Simulates a mouse move with the given deltas.","realm":"Client and Menu","args":{"arg":[{"text":"The movement delta on the x axis.","name":"deltaX","type":"number"},{"text":"The movement delta on the y axis.","name":"deltaY","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InternalKeyCodePressed","parent":"gui","type":"libraryfunc","description":"Simulates a key press for the given key.","realm":"Client and Menu","args":{"arg":{"text":"The key, see Enums/KEY.","name":"key","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InternalKeyCodeReleased","parent":"gui","type":"libraryfunc","description":"Simulates a key release for the given key.","realm":"Client and Menu","args":{"arg":{"text":"The key, see Enums/KEY.","name":"key","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InternalKeyCodeTyped","parent":"gui","type":"libraryfunc","description":"Simulates a key type typing to the specified key.","realm":"Client and Menu","args":{"arg":{"text":"The key, see Enums/KEY.","name":"key","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InternalKeyTyped","parent":"gui","type":"libraryfunc","description":"Simulates an ASCII symbol writing.\nUse to write text in the chat or in VGUI.\nDoesn't work while the main menu is open!","realm":"Client and Menu","args":{"arg":{"text":"ASCII code of symbol, see [this chart](https://files.facepunch.com/wiki/files/ab571/8dc389806d65b98.gif).","name":"code","type":"number"}}},"example":{"description":"Writes \"Hello\" every think.","code":"hook.Add(\"Think\",\"Example\",function()\n\tgui.InternalKeyTyped(72)\n\tgui.InternalKeyTyped(101)\n\tgui.InternalKeyTyped(108)\n\tgui.InternalKeyTyped(108)\n\tgui.InternalKeyTyped(111)\nend)"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InternalMouseDoublePressed","parent":"gui","type":"libraryfunc","description":"Simulates a double mouse key press for the given mouse key.","realm":"Client and Menu","args":{"arg":{"text":"The key, see Enums/MOUSE.","name":"key","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InternalMousePressed","parent":"gui","type":"libraryfunc","description":"Simulates a mouse key press for the given mouse key.","realm":"Client and Menu","args":{"arg":{"text":"The key, see Enums/MOUSE.","name":"key","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InternalMouseReleased","parent":"gui","type":"libraryfunc","description":"Simulates a mouse key release for the given mouse key.","realm":"Client and Menu","args":{"arg":{"text":"The key, see Enums/MOUSE.","name":"key","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InternalMouseWheeled","parent":"gui","type":"libraryfunc","description":"Simulates a mouse wheel scroll with the given delta.","realm":"Client and Menu","args":{"arg":{"text":"The amount of scrolling to simulate.","name":"delta","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsConsoleVisible","parent":"gui","type":"libraryfunc","description":"Returns whether the console is visible or not.","realm":"Client and Menu","rets":{"ret":{"text":"Whether the console is visible or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsGameUIVisible","parent":"gui","type":"libraryfunc","description":"Returns whether the game menu overlay ( main menu ) is open or not.","realm":"Client and Menu","rets":{"ret":{"text":"Whether the game menu overlay ( main menu ) is open or not","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MousePos","parent":"gui","type":"libraryfunc","description":{"text":"Returns the cursor's position on the screen, or 0, 0 if cursor is not visible.","deprecated":"Use input.GetCursorPos instead."},"realm":"Client and Menu","rets":{"ret":[{"text":"mouseX","name":"","type":"number"},{"text":"mouseY","name":"","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MouseX","parent":"gui","type":"libraryfunc","description":"Returns x component of the mouse position.","realm":"Client and Menu","rets":{"ret":{"text":"mouseX","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MouseY","parent":"gui","type":"libraryfunc","description":"Returns y component of the mouse position.","realm":"Client and Menu","rets":{"ret":{"text":"mouseY","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OpenURL","parent":"gui","type":"libraryfunc","description":{"text":"Opens specified URL in the steam overlay browser.","note":"When called clientside, user will be asked for confirmation before the website will open."},"realm":"Client and Menu","args":{"arg":{"text":"URL to open, it has to start with either `http://` or `https://`.","name":"url","type":"string"}}},"example":{"description":"Opens a page when a button is clicked.","code":"local button = vgui.Create( \"DButton\" )\nbutton:SetSize( 125, 90 )\nbutton:Center() \nbutton:SetText( \"Join our Discord!\" )\nbutton.DoClick = function()\n    gui.OpenURL( \"https://discord.gg/gmod\" )\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ScreenToVector","parent":"gui","type":"libraryfunc","description":"Converts the specified screen position to a **direction** vector local to the player's view. A related function is Vector:ToScreen, which translates a 3D position to a screen coordinate.\n\nutil.AimVector is a more generic version of this, using a custom view instead of the player's current view.","realm":"Client","args":{"arg":[{"text":"X coordinate on the screen.","name":"x","type":"number"},{"text":"Y coordinate on the screen.","name":"y","type":"number"}]},"rets":{"ret":{"text":"Direction","name":"","type":"Vector"}}},"example":[{"description":"This will do a trace from the mouse position to the world","code":"local tr = util.QuickTrace(LocalPlayer():GetShootPos(), gui.ScreenToVector(gui.MousePos()),LocalPlayer())\nprint(tr.HitPos)","output":"The worldpos the cursor is pointing at will be printed"},{"description":"Replacement for Player:GetAimVector","code":"print(gui.ScreenToVector(ScrW()/2, ScrH()/2))","output":"The player's current aimvector will be printed"}],"realms":["Client"],"type":"Function"},
{"function":{"name":"SetMousePos","parent":"gui","type":"libraryfunc","description":{"text":"Sets the cursor's position on the screen, relative to the topleft corner of the window","deprecated":"Use input.SetCursorPos instead."},"realm":"Client and Menu","args":{"arg":[{"text":"The X coordinate to move the cursor to.","name":"mouseX","type":"number"},{"text":"The Y coordinate to move the cursor to.","name":"mouseY","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ShowConsole","parent":"gui","type":"libraryfunc","description":"Shows console in the game UI.","realm":"Menu"},"example":{"description":"Example from `garrysmod\\lua\\menu\\mainmenu.lua` that initializes the game UI and shows console if activated.","code":"function PANEL:Init()\n\n\tself:Dock( FILL )\n\tself:SetKeyboardInputEnabled( true )\n\tself:SetMouseInputEnabled( true )\n\n\tself.HTML = vgui.Create( \"DHTML\", self )\n\n\tJS_Language( self.HTML )\n\tJS_Utility( self.HTML )\n\tJS_Workshop( self.HTML )\n\n\tself.HTML:Dock( FILL )\n\tself.HTML:OpenURL( \"asset://garrysmod/html/menu.html\" )\n\tself.HTML:SetKeyboardInputEnabled( true )\n\tself.HTML:SetMouseInputEnabled( true )\n\tself.HTML:SetAllowLua( true )\n\tself.HTML:RequestFocus()\n\n\tws_save.HTML = self.HTML\n\taddon.HTML = self.HTML\n\tdemo.HTML = self.HTML\n\n\tself:MakePopup()\n\tself:SetPopupStayAtBack( true )\n\t\n\t-- If the console is already open, we've got in its way.\n\tif ( gui.IsConsoleVisible() ) then\n\t\tgui.ShowConsole()\n\tend\n\nend"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"CreateTextureBorder","parent":"GWEN","type":"libraryfunc","description":"This is a utility function that generates a specialized drawing function to render scalable textured borders. This is done with [9-slice scaling](https://en.wikipedia.org/wiki/9-slice_scaling). This is used in derma skins to create a bordered rectangle drawing function from an image.\n\nThe texture is taken from `SKIN.GwenTexture` when the `material` argument is not supplied.","realm":"Client and Menu","file":{"text":"lua/derma/derma_gwen.lua","line":"6-L56"},"args":{"arg":[{"text":"The X coordinate on the texture.","name":"x","type":"number"},{"text":"The Y coordinate on the texture.","name":"y","type":"number"},{"text":"Width of the area on texture.","name":"w","type":"number"},{"text":"Height of the area on texture.","name":"h","type":"number"},{"text":"Left width of border.","name":"left","type":"number"},{"text":"Top width of border.","name":"top","type":"number"},{"text":"Right width of border.","name":"right","type":"number"},{"text":"Bottom width of border.","name":"bottom","type":"number"},{"text":"If set, given material will be used over the SKIN's default material, which is `SKIN.GwenTexture`.","name":"material","type":"IMaterial","default":"nil"}]},"rets":{"ret":{"text":"The drawing function.","name":"drawFunc","type":"function","callback":{"arg":[{"text":"X coordinate for the box.","name":"x","type":"number"},{"text":"Y coordinate for the box.","name":"y","type":"number"},{"text":"Width of the box.","name":"w","type":"number"},{"text":"Height of the box.","name":"h","type":"number"},{"text":"Optional color, default is color_white.","name":"clr","type":"Color","default":"color_white"}]}}}},"example":{"description":"Draws a bordered box in the top left corner of the screen using current skins texture.","code":"local paintBox = GWEN.CreateTextureBorder( 384, 32, 31, 31, 4, 4, 4, 4 )\nhook.Add( \"HUDPaint\", \"PaintStuff\", function()\n    paintBox( 0, 0, 100, 100 )\nend )","output":"If using default skin, it will be a 100x100px transparent blue box in top left corner with solid blue borders."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CreateTextureCentered","parent":"GWEN","type":"libraryfunc","description":"Used in derma skins to create a fixed scale rectangle drawing function from an image. it will be drawn in the center of the box.\n\nThe texture is taken from `SKIN.GwenTexture` when the `material` is not supplied.","realm":"Client and Menu","file":{"text":"lua/derma/derma_gwen.lua","line":"87-L119"},"args":{"arg":[{"text":"The X coordinate on the texture.","name":"x","type":"number"},{"text":"The Y coordinate on the texture.","name":"y","type":"number"},{"text":"Width of the area on texture.","name":"w","type":"number"},{"text":"Height of the area on texture.","name":"h","type":"number"},{"text":"If set, given material will be used over the SKIN's default material, which is `SKIN.GwenTexture`.","name":"material","type":"IMaterial","default":"nil"}]},"rets":{"ret":{"text":"The drawing function.","name":"","type":"function","callback":{"arg":[{"text":"X coordinate for the box.","name":"x","type":"number"},{"text":"Y coordinate for the box.","name":"y","type":"number"},{"text":"Width of the box.","name":"w","type":"number"},{"text":"Height of the box.","name":"h","type":"number"},{"text":"Optional color, default is white.","name":"clr","type":"Color","default":"color_white"}]}}}},"example":{"description":"Draws a box in the top left corner of the screen using current skins texture.","code":"local paintBox = GWEN.CreateTextureCentered( 384, 32, 32, 32 )\nhook.Add( \"HUDPaint\", \"PaintStuff\", function()\n    paintBox( 0, 0, 100, 100 )\nend )","output":"If using default skin, it will be 32x32 transparent blue box centered inside the 100x100 box."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CreateTextureNormal","parent":"GWEN","type":"libraryfunc","description":"Helper function that returns a specialized drawing function for rendering a texture that scales freely to fit the given area.\n\n\n\nThe texture is taken from `SKIN.GwenTexture` when the `material` is not supplied.","realm":"Client and Menu","file":{"text":"lua/derma/derma_gwen.lua","line":"58-L85"},"args":{"arg":[{"text":"The X coordinate on the texture.","name":"x","type":"number"},{"text":"The Y coordinate on the texture.","name":"y","type":"number"},{"text":"Width of the area on texture.","name":"w","type":"number"},{"text":"Height of the area on texture.","name":"h","type":"number"},{"text":"If set, given material will be used over the SKIN's default material, which is `SKIN.GwenTexture`.","name":"material","type":"IMaterial","default":"nil"}]},"rets":{"ret":{"text":"The drawing function.","name":"","type":"function","callback":{"arg":[{"text":"X coordinate for the box.","name":"x","type":"number"},{"text":"Y coordinate for the box.","name":"y","type":"number"},{"text":"Width of the box.","name":"w","type":"number"},{"text":"Height of the box.","name":"h","type":"number"},{"text":"Optional color, default is white.","name":"clr","type":"Color","default":"color_white"}]}}}},"example":{"description":"Draws a huge checked checkbox in the top left corner of the screen using current skins texture.","code":"local paintBox = GWEN.CreateTextureNormal( 448, 32, 15, 15 )\nhook.Add( \"HUDPaint\", \"PaintStuff\", function()\n    paintBox( 0, 0, 100, 100 )\nend )","output":"If using default skin, it will be a 100x100px checked checkbox in top left corner of the screen."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"TextureColor","parent":"GWEN","type":"libraryfunc","description":"Retrieves the color from a materials texture at the provided UV coordinates","realm":"Client and Menu","file":{"text":"lua/derma/derma_gwen.lua","line":"121-L127"},"args":{"arg":[{"text":"X position of the pixel to get the color from.","name":"x","type":"number"},{"text":"Y position of the pixel to get the color from.","name":"y","type":"number"}]},"rets":{"ret":{"text":"The color of the point on the skin.","name":"","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Add","parent":"halo","type":"libraryfunc","description":{"text":"Applies a halo glow effect to one or multiple entities. It is preferable to add them in GM:PreDrawHalos, but they can be added at any time.","note":"The ignoreZ parameter will cause the halos to draw over the player's viewmodel. You can work around this using render.DepthRange in the GM:PreDrawViewModel, GM:PostDrawViewModel, GM:PreDrawPlayerHands and GM:PostDrawPlayerHands hooks."},"realm":"Client","file":{"text":"lua/includes/modules/halo.lua","line":"13-L33"},"args":{"arg":[{"text":"A table of entities to add the halo effect to.","name":"entities","type":"table"},{"text":"The desired color of the halo.","name":"color","type":"Color"},{"text":"The strength of the halo's blur on the x axis.","name":"blurX","type":"number","default":"2"},{"text":"The strength of the halo's blur on the y axis.","name":"blurY","type":"number","default":"2"},{"text":"The number of times the halo should be drawn per frame. **Increasing this may hinder player FPS**.","name":"passes","type":"number","default":"1"},{"text":"Sets the render mode of the halo to additive.","name":"additive","type":"boolean","default":"true"},{"text":"Renders the halo through anything when set to `true`.","name":"ignoreZ","type":"boolean","default":"false"}]}},"example":[{"description":"Adds a halo around all props in the map using an O(n) operation and iterating through unseen objects which can be extremely expensive to process.","code":"local color_red = Color( 255, 0, 0 )\n\nhook.Add( \"PreDrawHalos\", \"AddPropHalos\", function()\n\thalo.Add( ents.FindByClass( \"prop_physics*\" ), color_red, 5, 5, 2 )\nend )","output":{"text":"All the props on the map will be rendered with a red halo, a blur amount of 5, and two passes.","image":{"src":"halo_example.png","alt":"_halo_example.png"}}},{"description":"Adds a green halo around all admins.","code":"local color_green = Color( 0, 255, 0 )\n\nhook.Add( \"PreDrawHalos\", \"AddStaffHalos\", function()\n\tlocal staff = {}\n\n\tfor _, ply in player.Iterator() do\n\t\tif ( ply:IsAdmin() ) then\n\t\t\tstaff[ #staff + 1 ] = ply\n\t\tend\n\tend\n\n\thalo.Add( staff, color_green, 0, 0, 2, true, true )\nend )"}],"realms":["Client"],"type":"Function"},
{"function":{"name":"Render","parent":"halo","type":"libraryfunc","description":{"text":"Renders a halo according to the specified table, only used internally, called from a GM:PostDrawEffects hook added by the halo library.","internal":""},"realm":"Client","file":{"text":"lua/includes/modules/halo.lua","line":"39-L145"},"args":{"arg":{"text":"Table with info about the halo to draw.","name":"entry","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"RenderedEntity","parent":"halo","type":"libraryfunc","description":"Returns the entity the halo library is currently rendering the halo for.\n\nThe main purpose of this function is to be used in ENTITY:Draw in order not to draw certain parts of the entity when the halo is being rendered, so there's no halo around unwanted entity parts, such as lasers, 3D2D displays, etc.","realm":"Client","file":{"text":"lua/includes/modules/halo.lua","line":"35-L37"},"rets":{"ret":{"text":"If set, the currently rendered entity by the halo library.","name":"","type":"Entity"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SendCommand","parent":"hammer","type":"libraryfunc","description":"Sends command to Hammer, if Hammer is running with the current map loaded.","realm":"Server","args":{"arg":{"text":"Command to send including arguments.\n\nAll commands are in the format \"command var1 var2 etc\".\n\nAll commands that pick an entity with x y z , must use the exact position including decimals (i.e. -354.4523 123.4). \n\n# List of commands\n| Command       | Description   |\n| ------------- | ------------- |\n| \"session_begin mapName mapVersion\" | Starts a hammer edit, locking the editor. mapName is the current map without path or suffix, mapVersion is the current version in the .vmf file |\n| \"session_end\" | Ends a hammer edit, unlocking the editor. |\n| \"map_check_version mapName mapVersion\" | This only works after session_begin, so you'd know the right version already and this only returns ok, this function is apparently useless. |\n| \"entity_create entityClass x y z\" | Creates an entity of entityClass at position x y z. |\n| \"entity_delete entityClass x y z\" | Deletes an entity of entityClass at position x y z. |\n| \"entity_set_keyvalue entityClass x y z \"key\" \"value\"\" | Set's the KeyValue pair of an entity of entityClass at x y z. The Key name and Value String must be in quotes. |\n| \"entity_rotate_incremental entityClass x y z incX incY incZ\" | Rotates an entity of entityClass at x y z by incX incY incZ. |\n| \"node_create nodeClass nodeID x y z\" | Creates an AI node of nodeClass with nodeID at x y z you should keep nodeID unique or you will have issues. |\n| \"node_delete nodeID\" | Deletes node(s) with nodeID, this will delete multiple nodes if they have the same nodeID. |\n| \"nodelink_create startNodeID endNodeID\" | Creates a link between AI nodes startNodeID and endNodeID. |\n| \"nodelink_delete startNodeID endNodeID\" | Removes a link between AI nodes startNodeID and endNodeID. |","name":"cmd","type":"string"}},"rets":{"ret":{"text":"Returns \"ok\" if command succeeded otherwise returns \"badcommand\"\n\n**All changes only happen in hammer, there is *NO* in game representation/feedback**","name":"","type":"string"}}},"example":{"description":"A hammer function library I wrote while testing all these functions.\n\nPlease feel free to use this library as-is or with modification.","code":"if ( !SERVER) then return end\n-- Hammer Editor Lua Library\n-- By Malcolm Greene Jr (Fantym420)\n \n-- Allows easy access to the hammer editor commands from lua code\n-- All commands return ok if they worked and badcommand if they don't\n-- All changes only show up in hammer, so if you want to see stuff in game you must\n-- write your own ghost entites and such.\n\nhammerLib = {}\nhammerLib.mapName = game.GetMap() -- Get the map name\nhammerLib.vBSPMapVer = game.GetMapVersion() -- This is the vbsp map version, we need the vmf map version\nhammerLib.mapVer = hammerLib.vBSPMapVer -- place holder value findGoodVer will find the current vmf version via trial and error\n\n-- returns a vector string with spaces the way hammer likes it\nfunction hammerLib.vectorToString(vec)\n\n\treturn tostring(vec.x) .. \" \" .. tostring(vec.y) .. \" \" .. tostring(vec.z)\n\nend\n\n-- tries to start a session using the current version, if it fails it tries the next\n-- if it can't find it in 20 tries you should probably compile your map before edititng more\nfunction hammerLib.findGoodVer()\n\t\n\tlocal verInc = 0\n\tlocal result = \"\"\n\t\n\tfor verInc = 0, 20 do \n\t\n\t\thammerLib.mapVer = hammerLib.vBSPMapVer + verInc\n\t\t\n\t\tresult = hammerLib.startSession()\n\t\t\n\t\tif result == \"ok\" then\n\t\t\tbreak\n\t\tend\n\t\t\n\t\tif verInc == 20 then\n\t\t\tprint(\"Good Version Not Found, Please Re-Compile your map!!!\")\n\t\tend\n\tend\n\t\n\thammerLib.endSession()\n\t\nend\n\n-- simple wrapper for hammer.SendCommand so that I could print the debug info\n-- un-comment the prints to see the command strings and results in console\nfunction hammerLib.runCommand(cmd)\n\t\n\tlocal result = \"\"\n\t--print(\"running \" .. cmd)\n\tresult = hammer.SendCommand(cmd)\n\t--print(cmd .. \" result: \" .. result)\n\treturn result\n\t\n\nend\n\n-- Always ran when starting an edit\n-- This locks hammer until you issue the session_end command\nfunction hammerLib.startSession()\n\t\n\tlocal cmd = \"session_begin \" .. hammerLib.mapName .. \" \" .. hammerLib.mapVer\n\t\n\treturn hammerLib.runCommand(cmd)\n\t\nend\n\n-- Ends the session unlocking hammer\nfunction hammerLib.endSession()\n\t\n\tlocal cmd = \"session_end\"\n\n\treturn hammer.SendCommand(cmd)\n\t\nend\n\n-- useless function, it will return ok if you give it a good name and version\n-- however to run it you must already have a good version because you ran session_start\n-- implemented here for thoroughness, if you give it no variables it will just use the stored info.\nfunction hammerLib.mapCheckVersion(mcName, mcVer)\n\t\n\tmcName = mcName or hammerLib.mapName\n\tmcVer = mcVer or hammerLib.mapVer\n\tlocal cmd = \"map_check_version \" .. mcName .. \" \" .. mcVer\n\tlocal result = \"\"\n\thammerLib.startSession()\n\tresult = hammerLib.runCommand(cmd)\n\thammerLib.endSession()\n\t\n\treturn result\n\t\nend\n\n-- this creates an entity of type entityClass at the given position\n--  I believe this only works with point entites seeing as there is no tie to brush command\nfunction hammerLib.entityCreate(entityClass, entityPos)\n\t\n\tif (entityClass == nil) or (entityPos == nil) then return end\n\tlocal cmd = \"entity_create \" .. entityClass .. \" \" .. hammerLib.vectorToString(entityPos)\n\tlocal result = \"\"\n\thammerLib.startSession()\n\tresult = hammerLib.runCommand(cmd)\n\thammerLib.endSession()\n\t\n\treturn result\n\t\nend\n\n-- this deletes an entity of type entityClass at entityPos\n-- NOTE: must be entities **EXACT** position, decimals and all or it fails\nfunction hammerLib.entityDelete(entityClass, entityPos)\n\t\n\tif (entityClass == nil) or (entityPos == nil) then return end\n\tlocal cmd = \"entity_delete \" .. entityClass .. \" \" .. hammerLib.vectorToString(entityPos)\n\tlocal result = \"\"\n\thammerLib.startSession()\n\tresult = hammerLib.runCommand(cmd)\n\thammerLib.endSession()\n\t\n\treturn result\n\t\nend\n\n-- Set's a Key/Value pair on entity of type entityClass at entityPos\n-- NOTE: must be entities **EXACT** position, decimals and all or it fails\nfunction hammerLib.entitySetKeyValue(entityClass, entityPos, key, value)\n\t\n\t\n\tif (entityClass == nil) or \n\t   (entityPos == nil) or\n\t   (key == nil) or\n\t   (value == nil) then return end\n\t   \n\tlocal cmd = \"entity_set_keyvalue \" .. entityClass .. \" \" .. hammerLib.vectorToString(entityPos) .. \" \\\"\" .. key .. \"\\\" \\\"\" .. value .. \"\\\"\"\n\tlocal result = \"\"\n\thammerLib.startSession()\n\tresult = hammerLib.runCommand(cmd)\n\thammerLib.endSession()\n\t\n\treturn result\n\t\nend\n-- this will rotate an entity of type entityClass(string) at entityPos(vector) by rotationInc(vector)\n-- NOTE: must be entities **EXACT** position, decimals and all or it fails\nfunction hammerLib.entityRotateIncremental(entityClass, entityPos, rotationInc)\n\t\n\tif (entityClass == nil) or (entityPos == nil) then return end\n\tlocal cmd = \"entity_rotate_incremental \" .. entityClass .. \" \" .. hammerLib.vectorToString(entityPos) .. \" \" .. hammerLib.vectorToString(rotationInc)\n\tlocal result = \"\"\n\thammerLib.startSession()\n\tresult = hammerLib.runCommand(cmd)\n\thammerLib.endSession()\n\t\n\treturn result\n\t\nend\n\n-- This creates a node of type nodeClass with an ID of nodeID at nodePos\n-- keep nodeID unique, if you don't and you use node_delete, it deletes all nodes with the given id\nfunction hammerLib.nodeCreate(nodeClass, nodeID, nodePos)\n\t\n\tif (nodeClass == nil) or (nodeID == nil) or (nodePos == nil) then return end\n\tlocal cmd = \"node_create \" .. nodeClass .. \" \" .. nodeID .. \" \" .. hammerLib.vectorToString(nodePos)\n\tlocal result = \"\"\n\thammerLib.startSession()\n\tresult = hammerLib.runCommand(cmd)\n\thammerLib.endSession()\n\t\n\treturn result\n\t\nend\n-- deletes node(s) with the given nodeID, however if there are more than one node with the nodeID all \n-- are deleted\nfunction hammerLib.nodeDelete(nodeID)\n\t\n\tif (nodeID == nil) then return end\n\tlocal cmd = \"node_delete \" .. nodeID\n\tlocal result = \"\"\n\thammerLib.startSession()\n\tresult = hammerLib.runCommand(cmd)\n\thammerLib.endSession()\n\t\n\treturn result\nend\n\n-- This creates a link between two nodes, not sure if there's a limit no number of links\n-- so far it does at least 2 per node\nfunction hammerLib.nodeLinkCreate(node1ID, node2ID)\n\t\n\tif (node1ID == nil) or (node2ID == nil) then return end\n\tlocal cmd = \"nodelink_create \" .. node1ID .. \" \" .. node2ID\n\tlocal result = \"\"\n\thammerLib.startSession()\n\tresult = hammerLib.runCommand(cmd)\n\thammerLib.endSession()\n\t\n\treturn result\n\t\nend\n\n-- This deletes a connection between two nodes\nfunction hammerLib.nodeLinkDelete(node1ID, node2ID)\n\t\n\tif (node1ID == nil) or (node2ID == nil) then return end\n\tlocal cmd = \"nodelink_delete \" .. node1ID .. \" \" .. node2ID\n\tlocal result = \"\"\n\thammerLib.startSession()\n\tresult = hammerLib.runCommand(cmd)\n\thammerLib.endSession()\n\t\n\treturn result\n\t\nend\n\n-- All loaded, run findGoodVer to store the current vmf version\nhammerLib.findGoodVer()"},"realms":["Server"],"type":"Function"},
{"function":{"name":"Add","parent":"hook","type":"libraryfunc","description":"Registers a function (or \"callback\") with the Hook system so that it will be called automatically whenever a specific event (or \"hook\") occurs.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/hook.lua","line":"23-L42"},"args":{"arg":[{"text":"The event to hook on to. This can be any GM hook, gameevent after using gameevent.Listen, or custom hook run with hook.Call or hook.Run.","name":"eventName","type":"string"},{"text":"The unique identifier, usually a string. This can be used elsewhere in the code to replace or remove the hook. The identifier **should** be unique so that you do not accidentally override some other mods hook, unless that's what you are trying to do.\n\n\t\t\tThe identifier can be either a string, or a table/object with an IsValid function defined such as an Entity or Panel. numbers and booleans, for example, are not allowed.\n\n\t\t\tIf the identifier is a table/object, it will be inserted in front of the other arguments in the callback and the hook will be called as long as it's valid. However, if IsValid( identifier ) returns false when **any** eventName hook is called, the hook will be removed.","name":"identifier","type":"any"},{"text":"The function to be called, arguments given to it depend on the identifier used.","name":"func","type":"function","warning":"Returning any value besides nil from the hook's function will stop other hooks of the same event down the loop from being executed. Only return a value when absolutely necessary and when you know what you are doing.\n\n\t\t\t\tIt will also prevent the associated `GM:*` hook from being called on the gamemode.\n\n\t\t\t\tIt WILL break other addons."}]}},"example":[{"description":"This will hook onto the \"Think\" event with the function onThink, printing to the console whenever the event occurs.","code":"local function onThink()\n\tprint( \"onThink has been called\" )\nend\n\nhook.Add( \"Think\", \"Some unique name\", onThink )","output":"\"onThink has been called\" repeating continuously."},{"description":"This works the same as above, but defines the function inside hook.Add rather than above it.","code":"hook.Add( \"Think\", \"Another unique name\", function()\n\tprint( \"Think has been called\" )\nend )","output":"\"Think has been called\" repeating continuously."},{"description":"This code demonstrates how you can add a table function with a 'self' argument, without the use of a wrapper function.","code":"local myTable = {}\nfunction myTable:IsValid()\n    return true\nend\n\nfunction myTable:PlayerInitialSpawn(ply)\n    print( \"CustomHook\", self, ply )\nend\n\nhook.Add( \"CustomHook\" , myTable , myTable.PlayerInitialSpawn )\nhook.Run( \"CustomHook\" )","output":"\"CustomHook table: 0x00000000  Player [1][PotatoMan]\""}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Call","parent":"hook","type":"libraryfunc","description":"Calls all hooks associated with the given event until one returns something other than `nil`, and then returns that data.\n\nIn almost all cases, you should use hook.Run instead - it calls hook.Call internally but supplies the gamemode table by itself, making your code neater.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/hook.lua","line":"74-L137"},"args":{"arg":[{"text":"The event to call hooks for.","name":"eventName","type":"string"},{"text":"If the gamemode is specified, the gamemode hook within will be called, otherwise not.","name":"gamemodeTable","type":"table","default":"nil"},{"text":"The arguments to be passed to the hooks.","name":"args","type":"vararg","default":"nil"}]},"rets":{"ret":{"text":"Return data from called hooks. Limited to **6** return values.","name":"","type":"vararg"}}},"example":[{"description":"Runs function `DoSomething`, which eventually calls the event `DoneDoingSomething`, triggering the hooked function `DoSomethingElse`.","code":"local function DoSomething()\n    -- Does something\n    hook.Call( \"DoneDoingSomething\" )\nend\n\nlocal function DoSomethingElse()\n    -- Does something else, once the hook \"DoneDoingSomething\" is called.\n    print( \"Done!\" )\nend\nhook.Add( \"DoneDoingSomething\", \"Does something else\", DoSomethingElse )\n\nDoSomething()","output":"```\nDone!\n```"},{"description":"You can also make custom functions controllable via hooks.","code":"local function MakeCheese()\n    local shouldMakeCheese = hook.Call( \"MakeCheezPleez\" )\n\n    if shouldMakeCheese then\n        print( \"yay\" )\n    else\n        print( \"nay\" )\n    end\nend\n\nlocal function MakeCheeseOrNot()\n    return player.GetCount() >= 1\nend\nhook.Add( \"MakeCheezPleez\", \"Does something else\", MakeCheeseOrNot )\n\nMakeCheese()","output":"If there is players in the server, we print `yay`. If there isn't, we print `nay`."},{"description":"Calls the event `DoneDoingSomething` with some arguments.","code":"hook.Add( \"DoneDoingSomething\", \"Does something else\", function( a, b )\n\tprint( a )\n\tprint( b )\nend )\n\nhook.Call( \"DoneDoingSomething\", nil, \"Hello\", \"Hey\" )","output":"```\nHello\nHey\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetTable","parent":"hook","type":"libraryfunc","description":"Returns a list of all the hooks registered with hook.Add.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/hook.lua","line":"15-L21"},"rets":{"ret":{"text":"A table of tables. See below for output example.","name":"","type":"table"}}},"example":{"description":"Example of output table structure.","code":"PrintTable( hook.GetTable() )","output":"```\nEntityNetworkedVarChanged:\n\tNetworkedVars\t=\tfunction: 0x1098ef38\nEntityRemoved:\n\tDoDieFunction\t=\tfunction: 0x253b2650\n\tnocollide_fix\t=\tfunction: 0x3f934a90\nInitPostEntity:\n\tPersistenceInit\t=\tfunction: 0x02b6e2c0\nLoadGModSave:\n\tLoadGModSave\t=\tfunction: 0x1098a680\nOnEntityCreated:\n\tmap_sethelinpcnode\t=\tfunction: 0x3ffe3568\nOnViewModelChanged:\n\tEntity [40][gmod_hands]\t=\tfunction: 0x403478a0\nPersistenceLoad:\n\tPersistenceLoad\t=\tfunction: 0x10961cd0\nPersistenceSave:\n\tPersistenceSave\t=\tfunction: 0x253d8f08\nPlayerInitialSpawn:\n\tPlayerAuthSpawn\t=\tfunction: 0x02b63398\nPlayerTick:\n\tTickWidgets\t=\tfunction: 0x10986c40\nPostDrawEffects:\n\tRenderWidgets\t=\tfunction: 0x10979af8\nShutDown:\n\tSavePersistenceOnShutdown\t=\tfunction: 0x10950c18\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Remove","parent":"hook","type":"libraryfunc","description":"Removes the hook with the supplied identifier from the given event.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/hook.lua","line":"45-L61"},"args":{"arg":[{"text":"The event name.","name":"eventName","type":"string"},{"text":"The unique identifier of the hook to remove, usually a string.","name":"identifier","type":"any"}]}},"example":{"description":"Darkens the player's screen for 15 seconds.","code":"hook.Add( \"HUDPaint\", \"my_hook_identifier\", function()\n\t\n\tsurface.SetDrawColor( 0, 0, 0, 150 )\n\tsurface.DrawRect( 0, 0, ScrW(), ScrH() )\n\t\nend )\n\ntimer.Simple( 15, function()\n\n\thook.Remove( \"HUDPaint\", \"my_hook_identifier\" )\n\nend )","output":"After the hook gets removed, the dark overlay doesn't appear anymore."},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Run","parent":"hook","type":"libraryfunc","description":{"text":"Calls all hooks associated with the given event **until** one returns something other than `nil` and then returns that data. If no hook returns any data, it will try to call the `GAMEMODE:","eventname":"` alternative, if one exists.\n\nThis function internally calls hook.Call.\n\nSee also: gamemode.Call - same as this, but does not call hooks if the gamemode hasn't defined the function."},"realm":"Shared and Menu","file":{"text":"lua/includes/modules/hook.lua","line":"64-L71"},"args":{"arg":[{"text":"The event to call hooks for.","name":"eventName","type":"string"},{"text":"The arguments to be passed to the hooks.","name":"args","type":"vararg"}]},"rets":{"ret":{"text":"Return data from called hooks. Limited to **6** return values.","name":"","type":"vararg"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Fetch","parent":"http","type":"libraryfunc","description":{"text":"Launches an asynchronous **GET** request to an HTTP server. Internally calls Global.HTTP.\n\nHTTP requests returning a status code >= `400` are still considered a success and will call the onSuccess callback.\n\nThe onFailure callback is usually only called on DNS or TCP errors (e.g. the website is unavailable or the domain does not exist).\n\nA rough overview of possible onFailure messages:\n* `invalid url` - Invalid/empty url. ( no request was attempted )\n* `invalid request` - Steam HTTP lib failed to create a HTTP request.\n* `error` - OnComplete callback's second argument, `bError`, is `true`.\n* `unsuccessful` - OnComplete's first argument, `pResult->m_bRequestSuccessful`, returned `false`.\n\n\n\n\n\n**Not all headers are allowed in the client realm, here is a list of known blacklisted headers inside the client realm:**\n```\nhost\nexpect\ncontent-length\nproxy-authenticate\naccept-charset\nconnection\naccept-encoding\norigin\ndate\n```","bug":{"text":"This cannot send or receive multiple headers with the same name.","issue":"2232"},"note":["HTTP-requests that respond with a large body may return an `unsuccessful` error. Try using the [Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range) header to download the file in chunks.","HTTP-requests to destinations on private networks (such as `192.168.0.1`, or `127.0.0.1`) won't work.\n\t\n\n\tTo enable HTTP-requests to destinations on private networks use Command Line Parameters `-allowlocalhttp`. (Dedicated servers only)"]},"realm":"Shared and Menu","file":{"text":"lua/includes/modules/http.lua","line":"18-L44"},"args":{"arg":[{"text":"The URL of the website to fetch.","name":"url","type":"string"},{"text":"Function to be called on success.","name":"onSuccess","type":"function","default":"nil","callback":{"arg":[{"type":"string","name":"body"},{"text":"equal to string.len(body).","type":"number","name":"size"},{"type":"table","name":"headers"},{"text":"The HTTP success code.","type":"number","name":"code"}]}},{"text":"Function to be called on failure.","name":"onFailure","type":"function","default":"nil","callback":{"arg":{"text":"The error message.","type":"string","name":"error"}}},{"text":"KeyValue table for headers.","name":"headers","type":"table","default":"{}"}]}},"example":{"description":"Shows the typical usage to get the HTML of a webpage.","code":"local theReturnedHTML = \"\" -- Blankness\n\nhttp.Fetch( \"https://www.google.com\",\n\t\n\t-- onSuccess function\n\tfunction( body, length, headers, code )\n\t\t-- The first argument is the HTML we asked for.\n\t\ttheReturnedHTML = body\n\tend,\n\n\t-- onFailure function\n\tfunction( message )\n\t\t-- We failed. =(\n\t\tprint( message )\n\tend,\n\n\t-- header example\n\t{ \n\t\t[\"accept-encoding\"] = \"gzip, deflate\",\n\t\t[\"accept-language\"] = \"fr\" \n\t}\n)","output":"If it successfully fetched the page, the variable `theReturnedHTML` should contain the returned HTML in plain text."},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Post","parent":"http","type":"libraryfunc","description":{"text":"Sends an asynchronous **POST** request to an HTTP server. Internally calls Global.HTTP.\n\nHTTP requests returning a status code >= `400` are still considered a success and will call the onSuccess callback.\n\nThe onFailure callback is usually only called on DNS or TCP errors (e.g. the website is unavailable or the domain does not exist).","bug":{"text":"This cannot send or receive multiple headers with the same name.","issue":"2232"},"note":["HTTP-requests that respond with a large body may return an `unsuccessful` error. Try using the [Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range) header to download the file in chunks.","HTTP-requests to destinations on private networks (such as `192.168.0.1`, or `127.0.0.1`) won't work.\n\t\n\n\tTo enable HTTP-requests to destinations on private networks use Command Line Parameters `-allowlocalhttp`. (Dedicated servers only)"]},"realm":"Shared and Menu","file":{"text":"lua/includes/modules/http.lua","line":"46-L73"},"args":{"arg":[{"text":"The url to of the website to post.","name":"url","type":"string"},{"text":"The post parameters (x-www-form-urlencoded) to be send to the server. **Keys and values must be strings**.","name":"parameters","type":"table"},{"text":"Function to be called on success.","name":"onSuccess","type":"function","default":"nil","callback":{"arg":[{"text":"The reponse body as a string.","type":"string","name":"body"},{"text":"equal to string.len(body).","type":"string","name":"size"},{"text":"The response headers as a table.","type":"table","name":"headers"},{"text":"The HTTP success code.","type":"number","name":"code"}]}},{"text":"Function to be called on failure.","name":"onFailure","type":"function","default":"nil","callback":{"arg":{"text":"The error message.","type":"string","name":"error"}}},{"text":"KeyValue table for headers.","name":"headers","type":"table","default":"{}"}]}},"example":{"description":"Write a file in PHP, and invoke it from Lua. The output below is written in the file, not in the console.\n\n```\n\n```","code":"http.Post( \"http://localhost/post.php\", { p = \"Gmod\", a = \"Test\" },\n\n\t-- onSuccess function\n\tfunction( body, length, headers, code )\n\t\tprint( \"Done!\" )\n\tend,\n\n\t-- onFailure function\n\tfunction( message )\n\t\tprint( message )\n\tend\n\n)","output":"```\nThis is a test. Gmod Test\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"CheckKeyTrapping","parent":"input","type":"libraryfunc","description":"Returns the last key captured by key trapping.","realm":"Client and Menu","rets":{"ret":{"text":"The key, see Enums/KEY.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetAnalogValue","parent":"input","type":"libraryfunc","description":"Returns the digital value of an analog stick on the current (set up via convars) controller.","realm":"Client and Menu","added":"2021.01.27","args":{"arg":{"text":"The analog axis to poll. See Enums/ANALOG.","name":"axis","type":"number{ANALOG}"}},"rets":{"ret":{"text":"The digital value.","name":"","type":"number","note":"A joystick axis returns `-32768` when it's pushed completely up/completely left, & returns `32767` when it's pushed completely down/completely right.\n\nA mouse wheel starts @ `0` & increases by `1` for every unit of scroll up/decreases by `1` for every unit of scroll down.\n\nA mouse axis is `0` when the arrow is @ the top or left of the screen; When the arrow is @ the bottom right of the screen, the mouse y axis is the height of the screen & the mouse x axis is the width of the screen (in pixels). Note that in game, the “arrow” stays near the middle of the screen.\n\nTrigger axis always return `0` (verify)."}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetCursorPos","parent":"input","type":"libraryfunc","description":{"text":"Returns the cursor's position on the screen.","bug":{"text":"On macOS, the cursor isn't locked on the middle of the screen which causes a significant offset of the positions returned by this function.","issue":"4964"}},"realm":"Client and Menu","rets":{"ret":[{"text":"The cursors position on the X axis.","name":"","type":"number"},{"text":"The cursors position on the Y axis.","name":"","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetKeyCode","parent":"input","type":"libraryfunc","description":"Gets the button code from a button name. This is opposite of input.GetKeyName.","realm":"Client and Menu","args":{"arg":{"text":"The internal button name, such as  or .","name":"button","type":"string","key":["E","SHIFT"]}},"rets":{"ret":{"text":"The button code, see Enums/BUTTON_CODE.","name":"","type":"number{BUTTON_CODE}"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetKeyName","parent":"input","type":"libraryfunc","description":{"text":"Gets the button name from a numeric button code. The name needs to be translated with language.GetPhrase before being displayed.","note":"Despite the name of the function, this also works for the full range of keys in Enums/BUTTON_CODE."},"realm":"Client and Menu","args":{"arg":{"text":"The button, see Enums/BUTTON_CODE.","name":"button","type":"number{BUTTON_CODE}"}},"rets":{"ret":{"text":"Button name.","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsButtonDown","parent":"input","type":"libraryfunc","description":"Gets whether the specified button code is down.\n\nUnlike input.IsKeyDown this can also detect joystick presses from Enums/JOYSTICK.","realm":"Client and Menu","args":{"arg":{"text":"The button, valid values are in the range of Enums/BUTTON_CODE.","name":"button","type":"number{BUTTON_CODE}"}},"rets":{"ret":{"text":"Is the button down?","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsControlDown","parent":"input","type":"libraryfunc","description":"Returns whether a control key is being pressed.","realm":"Client and Menu","rets":{"ret":{"text":"Is Ctrl key down or not?","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsKeyDown","parent":"input","type":"libraryfunc","description":"Gets whether a key is down.","realm":"Client and Menu","args":{"arg":{"text":"The key, see Enums/KEY.","name":"key","type":"number"}},"rets":{"ret":{"text":"Is the key down?","name":"","type":"boolean"}}},"example":{"description":{"text":"Show cursor if you press .","key":"ALT"},"code":"-- Note this may prevent the cursor from naturally appearing without alt\nhook.Add( \"Think\", \"BM_Clients_Key\", function()\n\tgui.EnableScreenClicker( input.IsKeyDown( KEY_LALT ) )\nend )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsKeyTrapping","parent":"input","type":"libraryfunc","description":"Returns whether key trapping is activate and the next key press will be captured.","realm":"Client and Menu","rets":{"ret":{"text":"Whether key trapping active or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsMouseDown","parent":"input","type":"libraryfunc","description":"Gets whether a mouse button is down.","realm":"Client and Menu","args":{"arg":{"text":"The key, see Enums/MOUSE.","name":"mouseKey","type":"number"}},"rets":{"ret":{"text":"Is the key down?","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsShiftDown","parent":"input","type":"libraryfunc","description":"Gets whether a shift key is being pressed","realm":"Client and Menu","rets":{"ret":{"text":"isDown","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"LookupBinding","parent":"input","type":"libraryfunc","description":"Returns the client's bound key for the specified console command. If the player has multiple keys bound to a single command, then the key with the lowest Enums/BUTTON_CODE will be returned.","realm":"Client and Menu","args":{"arg":[{"text":"The binding name","name":"binding","type":"string"},{"text":"True to disable automatic stripping of a single leading `+` character","name":"exact","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"The first key found with that binding or no value if no key with given binding was found.\n\nSee also input.GetKeyCode.","name":"","type":"string"}}},"example":{"description":"Demonstrates usage of this function and its arguments.","code":"print( input.LookupBinding( \"+use\" ) )\nprint( input.LookupBinding( \"use\" ) )\nprint( input.LookupBinding( \"+use\", true ) )\nprint( input.LookupBinding( \"use\", true ) )","output":"```\ne\ne\ne\nno value\n```"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"LookupKeyBinding","parent":"input","type":"libraryfunc","description":"Returns the bind string that the given key is bound to.","realm":"Client and Menu","args":{"arg":{"text":"Key from Enums/BUTTON_CODE","name":"key","type":"number{BUTTON_CODE}"}},"rets":{"ret":{"text":"The bind string of the given key.","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SelectWeapon","parent":"input","type":"libraryfunc","description":"Switches to the provided weapon on the next CUserCmd generation/CreateMove call. Direct binding to [CInput::MakeWeaponSelection](https://github.com/ValveSoftware/source-sdk-2013/blob/39f6dde8fbc238727c020d13b05ecadd31bda4c0/src/game/client/in_main.cpp#L989-L992).","realm":"Client","args":{"arg":{"text":"The weapon entity to switch to.","name":"weapon","type":"Weapon"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetCursorPos","parent":"input","type":"libraryfunc","description":"Sets the cursor's position on the screen, relative to the topleft corner of the window","realm":"Client and Menu","args":{"arg":[{"text":"X coordinate for mouse position","name":"mouseX","type":"number"},{"text":"Y coordinate for mouse position","name":"mouseY","type":"number"}]}},"example":{"description":"Makes the user's cursor circle their screen","code":"hook.Add( 'HUDPaint', 'CircleScreen', function()\n\tinput.SetCursorPos( ScrW() / 2 + math.sin(CurTime()) * ScrW() / 2, ScrH() / 2 + math.cos(CurTime()) * ScrH() / 2 )\nend)"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"StartKeyTrapping","parent":"input","type":"libraryfunc","description":"Begins waiting for a key to be pressed so we can save it for input.CheckKeyTrapping. Used by the DBinder.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"TranslateAlias","parent":"input","type":"libraryfunc","description":"Translates a console command alias, basically reverse of the `alias` console command.","realm":"Client and Menu","added":"2020.04.29","args":{"arg":{"text":"The alias to lookup.","name":"command","type":"string"}},"rets":{"ret":{"text":"The command(s) this alias will execute if ran, or nil if the alias doesn't exist.","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"WasKeyPressed","parent":"input","type":"libraryfunc","description":"Returns whether a key was initially pressed in the same frame this function was called.\n\nThis function only works in Move hooks, and will detect key presses even in main menu or when a typing in a text field.","realm":"Client and Menu","args":{"arg":{"text":"The key, see Enums/KEY.","name":"key","type":"number"}},"rets":{"ret":{"text":"True if the key was initially pressed the same frame that this function was called, false otherwise.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"WasKeyReleased","parent":"input","type":"libraryfunc","description":"Returns whether a key was released in the same frame this function was called.\n\nThis function only works in Move hooks, and will detect key releases even in main menu or when a typing in a text field.","realm":"Client and Menu","args":{"arg":{"text":"The key, see Enums/KEY.","name":"key","type":"number"}},"rets":{"ret":{"text":"True if the key was released the same frame that this function was called, false otherwise.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"WasKeyTyped","parent":"input","type":"libraryfunc","description":"Returns whether the key is being held down or not.\n\nThis function only works in Move hooks, and will detect key events even in main menu or when a typing in a text field.","realm":"Client and Menu","args":{"arg":{"text":"The key to test, see Enums/KEY","name":"key","type":"number"}},"rets":{"ret":{"text":"Whether the key is being held down or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"WasMouseDoublePressed","parent":"input","type":"libraryfunc","description":"Returns whether a mouse key was double pressed in the same frame this function was called.\n\n\nIf this function returns true, input.WasMousePressed will return false.\n\nThis function only works in Move hooks, and will detect mouse events even in main menu or when a typing in a text field.","realm":"Client and Menu","args":{"arg":{"text":"The mouse button to test, see Enums/MOUSE","name":"button","type":"number"}},"rets":{"ret":{"text":"Whether the mouse key was double pressed or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"WasMousePressed","parent":"input","type":"libraryfunc","description":"Returns whether a mouse key was initially pressed in the same frame this function was called.\n\n\nIf input.WasMouseDoublePressed returns true, this function will return false.\n\nThis function only works in Move hooks, and will detect mouse events even in main menu or when a typing in a text field.","realm":"Client and Menu","args":{"arg":{"text":"The key, see Enums/MOUSE","name":"key","type":"number"}},"rets":{"ret":{"text":"True if the mouse key was initially pressed the same frame that this function was called, false otherwise.","name":"","type":"boolean"}}},"example":{"description":"Example usage","code":"hook.Add( \"CreateMove\", \"fafawefafwf\", function()\n\tif ( input.WasMousePressed( MOUSE_LEFT ) ) then print( \"Left mouse button was pressed\" ) end\nend )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"WasMouseReleased","parent":"input","type":"libraryfunc","description":"Returns whether a mouse key was released in the same frame this function was called.\n\nThis function only works in Move hooks, and will detect mouse events even in main menu or when a typing in a text field.","realm":"Client and Menu","args":{"arg":{"text":"The key to test, see Enums/MOUSE","name":"key","type":"number"}},"rets":{"ret":{"text":"True if the mouse key was released the same frame that this function was called, false otherwise.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"opt.start","parent":"jit","type":"libraryfunc","description":"JIT compiler optimization control. The opt sub-module provides the backend for the -O command line LuaJIT option.\nYou can also use it programmatically, e.g.:\n\n```\njit.opt.start(2) -- same as -O2\njit.opt.start(\"-dce\")\njit.opt.start(\"hotloop=10\", \"hotexit=2\")\n```\n\n\tA list of LuaJIT -O command line options can be found here(a table of various optimization levels are displayed towards the bottom of the page along with exactly which optimization options are enabled for each level): http://luajit.org/running.html","realm":"Shared and Menu","args":{"arg":{"name":"args","type":"vararg"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"title":"util.funcbc","function":{"name":"util.funcbc","parent":"jit","type":"libraryfunc","description":{"text":"Returns bytecode of a function at a position.","note":"This function only works for Lua defined functions."},"realm":"Shared and Menu","args":{"arg":[{"text":"Function to retrieve bytecode from.","name":"func","type":"function"},{"text":"Position of the bytecode to retrieve.","name":"pos","type":"number"}]},"rets":{"ret":[{"text":"bytecode instruction","name":"","type":"number"},{"text":"bytecode opcode","name":"","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"util.funcinfo","parent":"jit","type":"libraryfunc","description":"Retrieves LuaJIT information about a given function, similarly to debug.getinfo. Possible table fields:\n* linedefined: as for debug.getinfo\n* lastlinedefined: as for debug.getinfo\n* params: the number of parameters the function takes\n* stackslots: the number of stack slots the function's local variable use\n* upvalues: the number of upvalues the function uses\n* bytecodes: the number of bytecodes it the compiled function\n* gcconsts: the number of garbage collectable constants\n* nconsts: the number of lua_Number (double) constants\n* children: Boolean representing whether the function creates closures\n* currentline: as for debug.getinfo\n* isvararg: if the function is a vararg function\n* source: as for debug.getinfo\n* loc: a string describing the source and currentline, like \"<source>:<line>\"\n* ffid: the fast function id of the function (if it is one). In this case only upvalues above and addr below are valid\n* addr: the address of the function (if it is not a Lua function). If it's a C function rather than a fast function, only upvalues above is valid*","realm":"Shared and Menu","args":{"arg":[{"text":"Function or Proto to retrieve info about.","name":"func","type":"function"},{"name":"pos","type":"number","default":"0"}]},"rets":{"ret":{"text":"Information about the supplied function/proto.","name":"","type":"table"}}},"example":{"description":"Demonstrates output of this function.","code":"PrintTable(jit.util.funcinfo(print))\n\nlocal print = print\n_G.print = function(...) print(...) end -- redefine print\n\nPrintTable(jit.util.funcinfo(print))","output":"```\n-- First PrintTable output:\naddr\t=\t1773317824\nffid\t=\t25\nupvalues\t=\t1\n\n-- Second PrintTable output:\nlinedefined\t=\t1\ncurrentline\t=\t1\nparams\t=\t0\nstackslots\t=\t2\nsource\t=\t@lua_run\nlastlinedefined\t=\t1\nchildren\t=\tfalse\nupvalues\t=\t1\nnconsts\t=\t0\nisvararg\t=\ttrue\nloc\t=\tlua_run:1\nbytecodes\t=\t5\ngcconsts\t=\t0\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"util.funck","parent":"jit","type":"libraryfunc","description":{"text":"Gets a constant at a certain index in a function.","deprecated":"This function was disabled due to security concerns.","warning":"This function isn't officially documented on LuaJIT wiki, use it at your own risk.","note":["Numbers constants goes from 0 (included) to n-1, n being the value of nconsts in jit.util.funcinfo in other words, the consts goes from (nconsts-1) to -n","This function only works for Lua defined functions."]},"realm":"Shared and Menu","args":{"arg":[{"text":"Function to get constant from","name":"func","type":"function"},{"text":"Constant index (counting down from the top of the function at -1)","name":"index","type":"number"}]},"rets":{"ret":{"text":"The constant found.","name":"","type":"any","note":"This will return a proto for functions that are created inside the target function - see Example 2."}}},"example":[{"description":"This code demonstrates how to get a constant in a function.","code":"function bob()\n    print(\"hi\")\nend\n\nprint(jit.util.funck(bob, -1))\nprint(jit.util.funck(bob, -2))","output":"```\nprint\nhi\n```"},{"description":"Demonstrates how a function created inside of the accessed function will be a protos when used with this function.","code":"local function foo()\n    local function bar()\n    end \nend\n\nprint( type( jit.util.funck( foo, -1 ) ) )","output":"```\nproto\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"util.funcuvname","parent":"jit","type":"libraryfunc","description":{"text":"Does the exact same thing as debug.getupvalue except it only returns the name, not the name and the object. The upvalue indexes also start at 0 rather than 1, so doing `jit.util.funcuvname(func, 0)` will get you the same name as `debug.getupvalue(func, 1)`","deprecated":"This function was disabled due to security concerns.","warning":"This function isn't officially documented on LuaJIT wiki, use it at your own risk."},"realm":"Shared and Menu","args":{"arg":[{"text":"Function to get the upvalue indexed from","name":"func","type":"function"},{"text":"The upvalue index, starting from 0","name":"index","type":"number"}]},"rets":{"ret":{"text":"The function returns nil if there is no upvalue with the given index, otherwise the name of the upvalue is returned","name":"","type":"string"}}},"example":{"description":"Get the name of the first upvalue in hook.Add","code":"local a = jit.util.funcuvname(hook.Add, 0)\nlocal b = debug.getupvalue(hook.Add, 1)\nprint(a)\nprint(a == b)","output":"```\nisfunction\ntrue\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"util.ircalladdr","parent":"jit","type":"libraryfunc","description":{"text":"Previously got the address of a function from a set list of functions, but now always returns `0` as it is deprecated.","deprecated":"This function was disabled due to security concerns."},"realm":"Shared and Menu","args":{"arg":{"text":"This argument is ignored.","name":"index","type":"number"}},"rets":{"ret":{"text":"Always returns `0`","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"util.traceexitstub","parent":"jit","type":"libraryfunc","description":{"text":"Grabs the address of a function based on it's trace exit number. Grabbed via jit.attach (with the texit event).","deprecated":"This function was disabled due to security concerns. It will always return 0."},"realm":"Shared and Menu","args":{"arg":{"text":"exit number to retrieve exit stub address from (gotten via jit.attach with the texit event)","name":"exitno","type":"number"}},"rets":{"ret":{"text":"exitstub trace address","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"util.traceinfo","parent":"jit","type":"libraryfunc","description":{"text":"Return table fields:\n* link (number): the linked trace (0 for link types: none, return, interpreter)\n* nk (number): the lowest IR constant (???)\n* nins (number): the next IR instruction (???)\n* linktype (string): the link type (none, root, loop, tail-recursion, up-recursion, down-recursion, interpreter, return)\n* nexit (number): number of snapshots (for use with jit.util.tracesnap)","deprecated":"This function was disabled due to security concerns."},"realm":"Shared and Menu","args":{"arg":{"text":"trace index to retrieve info for (gotten via jit.attach)","name":"trace","type":"number"}},"rets":{"ret":{"text":"trace info","name":"","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"util.traceir","parent":"jit","type":"libraryfunc","description":{"deprecated":"This function was disabled due to security concerns."},"realm":"Shared and Menu","args":{"arg":[{"name":"tr","type":"number"},{"name":"index","type":"number"}]},"rets":{"ret":[{"text":"m","name":"","type":"number"},{"text":"ot","name":"","type":"number"},{"text":"op1","name":"","type":"number"},{"text":"op2","name":"","type":"number"},{"text":"prev","name":"","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"util.tracek","parent":"jit","type":"libraryfunc","description":{"deprecated":"This function was disabled due to security concerns."},"realm":"Shared and Menu","args":{"arg":[{"name":"tr","type":"number"},{"name":"index","type":"number"}]},"rets":{"ret":[{"text":"k","name":"","type":"any"},{"text":"t","name":"","type":"number"},{"text":"slot; optional","name":"","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"util.tracemc","parent":"jit","type":"libraryfunc","description":{"deprecated":"This function was disabled due to security concerns. It will always return 3 `0`s."},"realm":"Shared and Menu","args":{"arg":{"name":"tr","type":"number"}},"rets":{"ret":[{"text":"mcode","name":"","type":"string"},{"text":"address","name":"","type":"number"},{"text":"loop","name":"","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"util.tracesnap","parent":"jit","type":"libraryfunc","description":{"text":"Return table fields:\n* 0 (ref) (number): first IR ref for the snapshot\n* 1 (nslots) (number): the number of valid slots \n* all indexes except first 2 and last (there might not be any of these): the snapshot map\n* last index in table (number): -16777216 (255 << 24)","deprecated":"This function was disabled due to security concerns."},"realm":"Shared and Menu","args":{"arg":[{"text":"trace index to retrieve snapshot for (gotten via jit.attach)","name":"tr","type":"number"},{"text":"snapshot index for trace (starting from 0 to nexit - 1, nexit gotten via jit.util.traceinfo)","name":"sn","type":"number"}]},"rets":{"ret":{"text":"snapshot","name":"","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"arch","parent":"jit","type":"libraryfield","description":"A variable containing the target architecture name: `x86`, `x64`, `arm`, `ppc`, `ppcspe`, or `mips`. This will be `x86` or `x64` in GMod.","realm":"Shared and Menu","rets":{"ret":{"text":"The system architecture.","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"os","parent":"jit","type":"libraryfield","description":"This is NOT a function, it's a variable containing the target OS name: `Windows`, `Linux`, `OSX`, `BSD`, `POSIX` or `Other`.","realm":"Shared and Menu","rets":{"ret":{"text":"The operating system.","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"version","parent":"jit","type":"libraryfield","description":"A variable containing the LuaJIT version string. This is `LuaJIT 2.0.4` in GMod, and `LuaJIT 2.1.0-beta3` on the x86-64 branch of GMod.","realm":"Shared and Menu","rets":{"ret":{"text":"The version string.","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"version_num","parent":"jit","type":"libraryfield","description":"A variable containing the version number of the LuaJIT core.","realm":"Shared and Menu","rets":{"ret":{"text":"The version number.  Version `xx.yy.zz` is represented by the decimal number `xxyyzz`. In GMod this is `20004`. On x86-64 branch it's `20100`.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"attach","parent":"jit","type":"libraryfunc","description":{"text":"You can attach callbacks to a number of compiler events with jit.attach. The callback can be called:\n\n* when a function has been compiled to bytecode (`\"bc\"`);\n* when trace recording starts or stops (`\"trace\"`);\n* as a trace is being recorded (`\"record\"`);\n* or when a trace exits through a side exit (`\"texit\"`).\n\nSet a callback with `jit.attach(callback, \"event\")` and clear the same callback with `jit.attach(callback)`.\nOnly one callback can be active per event.","deprecated":"This function was disabled due to security concerns.","warning":"This function isn't officially documented on LuaJIT wiki, use it at your own risk."},"realm":"Shared and Menu","args":{"arg":[{"text":"The callback function.\n\nThe arguments passed to the callback depend on the event being reported:\n\n* `\"bc\"`:\n  * function **func** - The function that's just been recorded\n* `\"trace\"`:\n  * string **what** - description of the trace event: \"flush\", \"start\", \"stop\", \"abort\". Available for all events.\n  * number **tr** - The trace number. Not available for flush.\n  * function **func** - The function being traced. Available for start and abort.\n  * number **pc** - The program counter - the bytecode number of the function being recorded (if this a Lua function). Available for start and abort.\n  * number **otr** - start: the parent trace number if this is a side trace, abort: abort code\n  * string **oex** - start: the exit number for the parent trace, abort: abort reason (string)\n* `\"record\"`:\n  * number **tr** - The trace number. Not available for flush.\n  * function **func** - The function being traced. Available for start and abort.\n  * number **pc** - The program counter - the bytecode number of the function being recorded (if this a Lua function). Available for start and abort.\n  * number **depth** - The depth of the inlining of the current bytecode.\n* `\"texit\"`:\n  * number **tr** - The trace number. Not available for flush.\n  * number **ex** - The exit number\n  * number **ngpr** - The number of general-purpose and floating point registers that are active at the exit.\n  * number **nfpr** - The number of general-purpose and floating point registers that are active at the exit.","name":"callback","type":"function"},{"text":"The event to hook into.","name":"event","type":"string"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"flush","parent":"jit","type":"libraryfunc","description":"Flushes the whole cache of compiled code.","realm":"Shared and Menu"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"off","parent":"jit","type":"libraryfunc","description":"Disables LuaJIT Lua compilation.","realm":"Shared and Menu"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"on","parent":"jit","type":"libraryfunc","description":"Enables LuaJIT Lua compilation.","realm":"Shared and Menu"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"status","parent":"jit","type":"libraryfunc","description":"Returns the status of the JIT compiler and the current optimizations enabled.","realm":"Shared and Menu","rets":{"ret":[{"text":"Is JIT enabled","name":"","type":"boolean"},{"text":"Strings for CPU-specific features and enabled optimizations","name":"","type":"any"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Add","parent":"killicon","type":"libraryfunc","description":"Creates new kill icon using a texture.","realm":"Client","file":{"text":"lua/includes/modules/killicon.lua","line":"30-L37"},"args":{"arg":[{"text":"Weapon or entity class.","name":"class","type":"string"},{"text":"Path to the texture.","name":"texture","type":"string"},{"text":"Color of the kill icon.","name":"color","type":"Color"}]}},"example":{"description":"Creates default killicon.","code":"killicon.Add( \"default\", \"HUD/killicons/default\", Color( 255, 80, 0, 255 ) )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddAlias","parent":"killicon","type":"libraryfunc","description":"Creates kill icon from existing one.","realm":"Client","file":{"text":"lua/includes/modules/killicon.lua","line":"39-L43"},"args":{"arg":[{"text":"New class of the kill icon.","name":"new_class","type":"string"},{"text":"Already existing kill icon class.","name":"existing_class","type":"string"}]}},"example":{"description":"Copies prop_physics kill icon to prop_ragdoll.","code":"killicon.AddAlias( \"prop_ragdoll\", \"prop_physics\" )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddFont","parent":"killicon","type":"libraryfunc","description":"Adds kill icon for given weapon/entity class using special font.","realm":"Client","file":{"text":"lua/includes/modules/killicon.lua","line":"20-L28"},"args":{"arg":[{"text":"Weapon or entity class.","name":"class","type":"string"},{"text":"Font to be used.","name":"font","type":"string"},{"text":"The symbol to be used.","name":"symbol","type":"string"},{"text":"Color of the killicon.","name":"color","type":"Color"},{"text":"Used internally to correct certain killicons to more closely match their visual size.","name":"heightScale ","type":"number","added":"2023.10.17","default":"1"}]}},"example":{"description":"Example of using the function. Adds pistol kill icon.","code":"killicon.AddFont( \"weapon_pistol\", \"HL2MPTypeDeath\", \"-\", Color( 255, 80, 0, 255 ) )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddTexCoord","parent":"killicon","type":"libraryfunc","description":"Creates new kill icon using a sub-rectangle of a texture.","realm":"Client","added":"2023.10.17","args":{"arg":[{"text":"Weapon or entity class this killicon is for.","name":"class","type":"string"},{"text":"Path to the texture.","name":"texture","type":"string"},{"text":"Color of the kill icon.","name":"color","type":"Color"},{"text":"The start position (X axis) of the rectangle on the given texture. This is in texture coordinates.","name":"x","type":"number"},{"text":"The start position (Y axis) of the rectangle on the given texture. This is in texture coordinates.","name":"y","type":"number"},{"text":"The width of the rectangle on the given texture. This is in texture coordinates.","name":"w","type":"number"},{"text":"The height of the rectangle on the given texture. This is in texture coordinates.","name":"h","type":"number"}]}},"example":{"description":"Creates a kill icon using TF2 kill icons image.","code":"killicon.AddTexCoord( \"heavy_punch\", \"hud/dneg_images\", color_white, 193, 449, 60, 30 )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Draw","parent":"killicon","type":"libraryfunc","description":{"text":"Draws a kill icon.","deprecated":"This function applies unpredictable vertical offsets, you should use killicon.Render instead, which does not suffer from this issue."},"realm":"Client","file":{"text":"lua/includes/modules/killicon.lua","line":"97-L135"},"args":{"arg":[{"text":"X coordinate of the icon.","name":"x","type":"number"},{"text":"Y coordinate of the icon.","name":"y","type":"number"},{"text":"Classname of the kill icon.","name":"name","type":"string"},{"text":"Alpha/transparency value ( 0 - 255 ) of the icon.","name":"alpha","type":"number","default":"255"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Exists","parent":"killicon","type":"libraryfunc","description":"Checks if kill icon exists for given class.","realm":"Client","file":{"text":"lua/includes/modules/killicon.lua","line":"45-L49"},"args":{"arg":{"text":"The class to test.","name":"class","type":"string"}},"rets":{"ret":{"text":"Returns true if kill icon exists.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetSize","parent":"killicon","type":"libraryfunc","description":"Returns the size of a kill icon.","realm":"Client","file":{"text":"lua/includes/modules/killicon.lua","line":"51-L95"},"args":{"arg":[{"text":"Classname of the kill icon.","name":"name","type":"string"},{"text":"If set to `true`, returns the real size of the kill icon, without trying to equalize the height to match the default kill icon font.","name":"dontEqualizeHeight","type":"boolean","default":"false","added":"2023.10.17"}]},"rets":{"ret":[{"text":"Width of the kill icon.","name":"","type":"number"},{"text":"Height of the kill icon.","name":"","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Render","parent":"killicon","type":"libraryfunc","description":"Renders a kill icon.","realm":"Client","added":"2023.10.17","file":{"text":"lua/includes/modules/killicon.lua","line":"196-L200"},"args":{"arg":[{"text":"X coordinate of the icon.","name":"x","type":"number"},{"text":"Y coordinate of the icon.","name":"y","type":"number"},{"text":"Classname of the kill icon.","name":"name","type":"string"},{"text":"Alpha/transparency value ( 0 - 255 ) of the icon.","name":"alpha","type":"number","default":"255"},{"text":"Do not rescale the icon to match the default kill icon font.","name":"dontEqualizeHeight","type":"number","default":"false"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Add","parent":"language","type":"libraryfunc","description":"Adds a language item. Language placeholders preceded with \"#\" are replaced with full text in Garry's Mod once registered with this function.","realm":"Client and Menu","args":{"arg":[{"text":"The key for this phrase, without the preceding \"#\".","name":"placeholder","type":"string"},{"text":"The phrase that should be displayed whenever this key is used.","name":"fulltext","type":"string"}]}},"example":{"description":"Small excerpt from a TOOL named `cooltool`. It has been registered as `cooltool`.","code":"language.Add(\"tool.cooltool.name\", \"The really cool tool\")\nlanguage.Add(\"tool.cooltool.desc\", \"Do some random cool stuff.\")\nlanguage.Add(\"tool.cooltool.0\", \"Left-click: Cool Stuff. Right-click: Nothing.\")\nlanguage.Add(\"Undone_cooltool\", \"Cool stuff has been undone.\")","output":"* When the player presses undo, `Cool stuff has been undone` will be shown.\n* The `cooltool`'s name will be `The really cool tool`.\n* Below that, where the description is shown, `Do some random cool stuff.` will be shown.\n* Below that, where the instructions or additional notes for the tool are shown, it will display `Left-click: Cool Stuff. Right-click: Nothing.`."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetPhrase","parent":"language","type":"libraryfunc","description":"Retrieves the translated version of inputted string. Useful for concentrating multiple translated strings.","realm":"Client and Menu","args":{"arg":{"text":"The phrase to translate","name":"phrase","type":"string"}},"rets":{"ret":{"text":"The translated phrase, or the input string if no translation was found. There is a limit of 4000 bytes for the returned string.","name":"","type":"string"}}},"example":{"description":"An example on usage of this function.","code":"print( \"Our phrase is: \" .. language.GetPhrase( \"limit_physgun\" ) )","output":"Our phrase is: Limited Physgun."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Add","parent":"list","type":"libraryfunc","description":"Adds an item to a named list.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/list.lua","line":"41-L45"},"args":{"arg":[{"text":"The list identifier.","name":"identifier","type":"string"},{"text":"The item to add to the list.","name":"item","type":"any"}]},"rets":{"ret":{"text":"The index at which the item was added.","type":"number"}}},"example":{"description":"From weapons/gmod_tool/stools/paint.lua","code":"list.Add( \"PaintMaterials\", \"Eye\" )\nlist.Add( \"PaintMaterials\", \"Smile\" )\nlist.Add( \"PaintMaterials\", \"Light\" )"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Contains","parent":"list","type":"libraryfunc","description":"Returns true if the list contains the value. (as a value - not a key)\n\nFor a function that looks for a key and not a value see list.HasEntry.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/list.lua","line":"47-L58"},"args":{"arg":[{"text":"List to search through.","name":"list","type":"string"},{"text":"The value to test.","name":"value","type":"any"}]},"rets":{"ret":{"text":"Returns true if the list contains the value, false otherwise.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Get","parent":"list","type":"libraryfunc","description":{"text":"Returns a copy of the list stored at identifier.\n\t\n\tWhere possible you should use the much faster helper functions:\n\t  list.Contains,\n\t  list.HasEntry, or\n\t  list.GetEntry.\n\n\tThere is also the more dangerous option of calling list.GetForEdit to get the unprotected list if you absolutely must iterate through it in a think hook.","warning":"This function uses table.Copy which can be very slow for larger lists. You should avoid calling it repeatedly or in performance sensitive hooks such as GM:Think."},"realm":"Shared and Menu","file":{"text":"lua/includes/modules/list.lua","line":"10-L14"},"args":{"arg":{"text":"The list identifier.","name":"identifier","type":"string"}},"rets":{"ret":{"text":"The copy of the list.","name":"","type":"table"}}},"example":{"description":"Get every available NPC from the client:","code":"PrintTable( list.Get( \"NPC\" ) )"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetEntry","parent":"list","type":"libraryfunc","description":"Returns a copy of the entry in the list `list` with key `key`.","added":"2025.05.09","realm":"Shared and Menu","file":{"text":"lua/includes/modules/list.lua","line":"16-L27"},"args":{"arg":[{"text":"List to search through.","name":"list","type":"string"},{"text":"The key to search for.","name":"key","type":"string"}]},"rets":{"ret":{"text":"Returns the  value if the list contains the key, nil otherwise.","name":"","type":"any|nil"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetForEdit","parent":"list","type":"libraryfunc","description":"Returns the actual table of the list stored at identifier. Modifying this will affect the stored list.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/list.lua","line":"16-L27"},"args":{"arg":[{"text":"The list identifier.","name":"identifier","type":"string"},{"text":"If the list at given identifier does not exist, do **not** create it.","name":"dontCreate","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"The actual list.","name":"","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetTable","parent":"list","type":"libraryfunc","description":"Returns a list of all lists currently in use.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/list.lua","line":"29-L33"},"added":"2020.10.14","rets":{"ret":{"text":"The list of all lists, i.e. a table containing names of all lists.","name":"","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"HasEntry","parent":"list","type":"libraryfunc","description":"Returns true if the list contains the given key.\n\nFor a function that looks for values and not keys see list.Contains.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/list.lua","line":"60-L66"},"args":{"arg":[{"text":"List to search through.","name":"list","type":"string"},{"text":"The key to test.","name":"key","type":"any"}]},"rets":{"ret":{"text":"Returns true if the list contains the key, false otherwise.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"RemoveEntry","parent":"list","type":"libraryfunc","description":"Removes a single entry from the list `list` with key `key`.\n\nThis is equivalent to `list.Set( myList, myKey, nil )`.","added":"2025.05.15","realm":"Shared and Menu","args":{"arg":[{"text":"List to remove an entry in.","name":"list","type":"string"},{"text":"The key for the entry to remove.","name":"key","type":"string"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Set","parent":"list","type":"libraryfunc","description":"Sets a specific position in the named list to a value.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/list.lua","line":"35-L39"},"args":{"arg":[{"text":"The list identifier.","name":"identifier","type":"string"},{"text":"The key in the list to set.","name":"key","type":"any"},{"text":"The item to set to the list as key.","name":"item","type":"any"}]}},"example":[{"description":"Adds an NPC to the spawnmenu NPC list with the name \"Fisherman\", classname of \"npc_fisherman\" and the default weapon of \"weapon_oldmanharpoon\".","code":"-- Lost Coast\nlist.Set(\"NPC\", \"npc_fisherman\", {\n\tName = \"Fisherman\",\n\tClass = \"npc_fisherman\",\n\tWeapons = { \"weapon_oldmanharpoon\" },\n\tCategory = Category\n})"},{"description":"Adds a new \"Desktop Widget\" to the Context Menu (C Menu). (This is how Player Model selection is added)","code":"list.Set( \"DesktopWindows\", \"My Custom Context Menu Icon\", {\n\ttitle = \"Context Menu Icon\",\n\ticon = \"icon64/icon.png\",\n\tinit = function( icon, window )\n\t\t--Your code here\n\tend\n} )"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Color","parent":"markup","type":"libraryfunc","description":"A convenience function that converts a Color into its markup ready string representation.","realm":"Client and Menu","added":"2021.12.15","file":{"text":"lua/includes/modules/markup.lua","line":"39-L46"},"args":{"arg":{"text":"The Color to convert.","name":"col","type":"Color"}},"rets":{"ret":{"text":"The markup color, for example `255,255,255`.","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Escape","parent":"markup","type":"libraryfunc","description":"Converts a string to its escaped, markup-safe equivalent.","realm":"Client and Menu","added":"2021.12.15","file":{"text":"lua/includes/modules/markup.lua","line":"279-L281"},"args":{"arg":{"text":"The string to sanitize.","name":"text","type":"string"}},"rets":{"ret":{"text":"The parsed markup object ready to be drawn.","name":"sanitizedText","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Parse","parent":"markup","type":"libraryfunc","description":{"text":"Parses markup into a MarkupObject. Currently, this only supports fonts and colors as demonstrated in the example.","warning":"This function is very slow! Always cache its result."},"realm":"Client and Menu","file":{"text":"lua/includes/modules/markup.lua","line":"295-L557"},"args":{"arg":[{"text":"The markup to be parsed.","name":"markup","type":"string"},{"text":"The max width of the output.","name":"maxWidth","type":"number","default":"nil"}]},"rets":{"ret":{"text":"The parsed markup object ready to be drawn via MarkupObject:Draw.","name":"","type":"MarkupObject"}}},"example":{"description":{"text":"Renders a markup string on the HUD.","note":{"text":"The the","colour":{"text":"tag can also be written as","color":{"text":", and the","font":{"text":"tag can also be written as","face":"."}}}}},"code":{"text":"local parsed = markup.Parse(\"\\n\")\n\nhook.Add(\"HUDPaint\", \"MarkupTest\", function()\n\tparsed:Draw(100, 100, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)\nend)","font":{"text":"changed font","default":"Default"},"colour":"changed colour"},"output":{"image":{"src":"Screenshot-2012-08-30_13.13.59.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InBack","parent":"math.ease","type":"libraryfunc","description":{"text":"Eases in by reversing the direction of the ease slightly before returning.","note":"This doesn't work properly when used with Global.Lerp as it clamps the fraction between 0 and 1. Using your own version of Global.Lerp that is unclamped would be necessary instead."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"128-L130"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"InBounce","parent":"math.ease","type":"libraryfunc","description":{"text":"Eases in like a bouncy ball.","note":"This doesn't work properly when used with Global.Lerp as it clamps the fraction between 0 and 1. Using your own version of Global.Lerp that is unclamped would be necessary instead."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"168-L170"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"InCirc","parent":"math.ease","type":"libraryfunc","description":"Eases in using a circular function.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"114-L116"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"InCubic","parent":"math.ease","type":"libraryfunc","description":"Eases in by cubing the fraction.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"61-L63"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"InElastic","parent":"math.ease","type":"libraryfunc","description":{"text":"Eases in like a rubber band.","note":"This doesn't work properly when used with Global.Lerp as it clamps the fraction between 0 and 1. Using your own version of Global.Lerp that is unclamped would be necessary instead."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"142-L148"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"InExpo","parent":"math.ease","type":"libraryfunc","description":"Eases in using an exponential equation with a base of 2 and where the fraction is used in the exponent.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"97-L99"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"InOutBack","parent":"math.ease","type":"libraryfunc","description":{"text":"Eases in and out by reversing the direction of the ease slightly before returning on both ends.","note":"This doesn't work properly when used with Global.Lerp as it clamps the fraction between 0 and 1. Using your own version of Global.Lerp that is unclamped would be necessary instead."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"136-L140"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"InOutBounce","parent":"math.ease","type":"libraryfunc","description":{"text":"Eases in and out like a bouncy ball.","note":"This doesn't work properly when used with Global.Lerp as it clamps the fraction between 0 and 1. Using your own version of Global.Lerp that is unclamped would be necessary instead."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"187-L191"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"InOutCirc","parent":"math.ease","type":"libraryfunc","description":"Eases in and out using a circular function.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"122-L126"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"InOutCubic","parent":"math.ease","type":"libraryfunc","description":"Eases in and out by cubing the fraction.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"69-L71"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"InOutElastic","parent":"math.ease","type":"libraryfunc","description":{"text":"Eases in and out like a rubber band.","note":"This doesn't work properly when used with Global.Lerp as it clamps the fraction between 0 and 1. Using your own version of Global.Lerp that is unclamped would be necessary instead."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"158-L166"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"InOutExpo","parent":"math.ease","type":"libraryfunc","description":"Eases in and out using an exponential equation with a base of 2 and where the fraction is used in the exponent.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"105-L112"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"InOutQuad","parent":"math.ease","type":"libraryfunc","description":"Eases in and out by squaring the fraction.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"57-L59"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"InOutQuart","parent":"math.ease","type":"libraryfunc","description":"Eases in and out by raising the fraction to the power of 4.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"81-L83"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"InOutQuint","parent":"math.ease","type":"libraryfunc","description":"Eases in and out by raising the fraction to the power of 5.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"93-L95"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"InOutSine","parent":"math.ease","type":"libraryfunc","description":"Eases in and out using math.sin.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"45-L47"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"InQuad","parent":"math.ease","type":"libraryfunc","description":"Eases in by squaring the fraction.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"49-L51"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"InQuart","parent":"math.ease","type":"libraryfunc","description":"Eases in by raising the fraction to the power of 4.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"73-L75"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"InQuint","parent":"math.ease","type":"libraryfunc","description":"Eases in by raising the fraction to the power of 5.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"85-L87"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"InSine","parent":"math.ease","type":"libraryfunc","description":"Eases in using math.sin.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"37-L39"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"example":{"description":"Calculates the easing of three situations","code":"print(math.ease.InSine(0.1))\nprint(math.ease.InSine(0.2))\nprint(math.ease.InSine(0.3))","output":"0.01231...\n0.04894...\n0.10899..."},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"OutBack","parent":"math.ease","type":"libraryfunc","description":{"text":"Eases out by reversing the direction of the ease slightly before finishing.","note":"This doesn't work properly when used with Global.Lerp as it clamps the fraction between 0 and 1. Using your own version of Global.Lerp that is unclamped would be necessary instead."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"132-L134"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"OutBounce","parent":"math.ease","type":"libraryfunc","description":{"text":"Eases out like a bouncy ball.","note":"This doesn't work properly when used with Global.Lerp as it clamps the fraction between 0 and 1. Using your own version of Global.Lerp that is unclamped would be necessary instead."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"172-L185"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"OutCirc","parent":"math.ease","type":"libraryfunc","description":"Eases out using a circular function.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"118-L120"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"OutCubic","parent":"math.ease","type":"libraryfunc","description":"Eases out by cubing the fraction.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"65-L67"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"OutElastic","parent":"math.ease","type":"libraryfunc","description":{"text":"Eases out like a rubber band.","note":"This doesn't work properly when used with Global.Lerp as it clamps the fraction between 0 and 1. Using your own version of Global.Lerp that is unclamped would be necessary instead."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"150-L156"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"OutExpo","parent":"math.ease","type":"libraryfunc","description":"Eases out using an exponential equation with a base of 2 and where the fraction is used in the exponent.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"101-L103"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"OutQuad","parent":"math.ease","type":"libraryfunc","description":"Eases out by squaring the fraction.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"53-L55"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"OutQuart","parent":"math.ease","type":"libraryfunc","description":"Eases out by raising the fraction to the power of 4.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"77-L79"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"OutQuint","parent":"math.ease","type":"libraryfunc","description":"Eases out by raising the fraction to the power of 5.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"89-L91"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"OutSine","parent":"math.ease","type":"libraryfunc","description":"Eases out using math.sin.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math/ease.lua","line":"41-L43"},"args":{"arg":{"text":"Fraction of the progress to ease, from 0 to 1","name":"fraction","type":"number"}},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"huge","parent":"math","type":"libraryfield","description":"A variable that effectively represents infinity, in the sense that in any numerical comparison every number will be less than this.\n\nFor example, if `x` is a number, `x > math.huge` will **NEVER** be `true` except in the case of overflow (see below).\n\nLua will consider any number greater than or equal to `2^1024` (the exponent limit of a [double](http://en.wikipedia.org/wiki/Double-precision_floating-point_format)) as `inf` and hence equal to this.","realm":"Shared and Menu","rets":{"ret":{"text":"The effective infinity.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"pi","parent":"math","type":"libraryfield","description":{"text":"A variable containing the mathematical constant pi. (`3.1415926535898`)\n\nSee also: Trigonometry","note":"It should be noted that due to the nature of floating point numbers, results of calculations with `math.pi` may not be what you expect. See second example below."},"realm":"Shared and Menu","rets":{"ret":{"text":"The mathematical constant, Pi.","name":"","type":"number"}}},"example":[{"code":"print( math.cos( math.pi ) )","output":"```\n-1\n```"},{"description":"`sin(π) = 0`, but because floating point precision is not unlimited it cannot be calculated as exactly `0`.","code":"print( math.sin( math.pi ), math.sin( math.pi ) == 0 )","output":"```\n1.2246467991474e-16 false\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"tau","parent":"math","type":"libraryfield","description":{"text":"A variable containing the mathematical constant tau, which is equivalent to 2*math.pi. (`6.28318530718`)\n\nSee also: Trigonometry","note":"It should be noted that due to the nature of floating point numbers, results of calculations with `math.tau` may not be what you expect. See the second example on math.pi page."},"added":"2023.11.28","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"4-L4"},"rets":{"ret":{"text":"The mathematical constant, Tau.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"abs","parent":"math","type":"libraryfunc","description":"Calculates the absolute value of a number (effectively removes any negative sign).","realm":"Shared and Menu","args":{"arg":{"text":"The number to get the absolute value of.","name":"x","type":"number"}},"rets":{"ret":{"text":"The absolute value.","name":"","type":"number"}}},"example":{"description":"Demonstrates what this function does.","code":"print( math.abs( 15 ) )\nprint( math.abs( -15 ) )","output":"```\n15\n15\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"acos","parent":"math","type":"libraryfunc","description":"Returns the [arccosine](https://en.wikipedia.org/wiki/Arccosine) of the given number.","realm":"Shared and Menu","args":{"arg":{"text":"Cosine value in range of -1 to 1.","name":"cos","type":"number"}},"rets":{"ret":{"text":"An angle in radians, between 0 and pi, which has the given cos value.\n\nnan if the argument is out of range.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"AngleDifference","parent":"math","type":"libraryfunc","description":"Calculates the difference between two angles.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"193-L201"},"args":{"arg":[{"text":"The first angle.","name":"a","type":"number"},{"text":"The second angle.","name":"b","type":"number"}]},"rets":{"ret":{"text":"The difference between the angles between -180 and 180","name":"","type":"number"}}},"example":{"description":"Find the angle difference between various angles","code":"print(\"Angle difference between 159 and 240 is \" .. math.AngleDifference(159, 240))\nprint(\"Angle difference between 240 and 159 is \" .. math.AngleDifference(240, 159))\nprint(\"Angle difference between 58 and 145 is \" .. math.AngleDifference(58, 145))","output":"Angle difference between 159 and 240 is -81\n\nAngle difference between 240 and 159 is 81\n\nAngle difference between 58 and 145 is -87"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Approach","parent":"math","type":"libraryfunc","description":"Gradually approaches the target value by the specified amount.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"173-L183"},"args":{"arg":[{"text":"The value we're currently at.","name":"current","type":"number"},{"text":"The target value. This function will never overshoot this value.","name":"target","type":"number"},{"text":"The amount that the current value is allowed to change by to approach the target. (It makes no difference whether this is positive or negative.)","name":"change","type":"number"}]},"rets":{"ret":{"text":"New current value, closer to the target than it was previously.","name":"","type":"number"}}},"example":[{"description":"Demonstrates what this function does","code":"print( math.Approach( 0, 5, 1 ) ) -- attempts to increment 0 by 1, 0 + 1 is less than 5 so returns 1\nprint( math.Approach( 4, 5, 3 ) ) -- attempts to increment 4 by 3, 4 + 3 = 7 is greater than 5 so returns 5","output":"```\n1\n5\n```"},{"description":"Common usage example of this function with a control variable.","code":"local MyNumber = 0\nlocal Target = 0\nlocal LastThink = 0\nlocal ChangeRate = 1\n\nhook.Add( \"Think\", \"math.Approach Example\", function()\n\tlocal now = CurTime()\n\tlocal timepassed = now - LastThink\n\tLastThink = now\n\n\tMyNumber = math.Approach( MyNumber, Target, ChangeRate * timepassed )\n\n\t-- Normally, you would use MyNumber in code that appears here.\nend )\n\n-- The following functions are for example only:\nfunction GetMyNumber()\n\treturn MyNumber\nend\n\nfunction SetMyNumberTarget( newtarget )\n\tTarget = newtarget\nend\n\nfunction SetMyNumberChangeRate( newrate )\n\tChangeRate = newrate\nend"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ApproachAngle","parent":"math","type":"libraryfunc","description":{"text":"Increments an angle towards another by specified rate.","note":"This function is for numbers representing angles (0-360), NOT Angle objects!"},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"1203-L205"},"args":{"arg":[{"text":"The current angle to increase","name":"currentAngle","type":"number"},{"text":"The angle to increase towards","name":"targetAngle","type":"number"},{"text":"The amount to approach the target angle by","name":"rate","type":"number"}]},"rets":{"ret":{"text":"Modified angle","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"asin","parent":"math","type":"libraryfunc","description":"Returns the [arcsine](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) of the given number.","realm":"Shared and Menu","args":{"arg":{"text":"Sine value in the range of -1 to 1.","name":"normal","type":"number"}},"rets":{"ret":{"text":"An angle in radians, in the range -pi/2 to pi/2, which has the given sine value.\n\nnan if the argument is out of range.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"atan","parent":"math","type":"libraryfunc","description":"Returns the [arctangent](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) of the given number.","realm":"Shared and Menu","args":{"arg":{"text":"Tangent value.","name":"normal","type":"number"}},"rets":{"ret":{"text":"An angle in radians, in the range -pi/2 to pi/2, which has the given tangent.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"atan2","parent":"math","type":"libraryfunc","description":{"text":"functions like math.atan(y / x), except it also takes into account the quadrant of the angle and so doesn't have a limited range of output.","note":"The Y argument comes first!"},"realm":"Shared and Menu","args":{"arg":[{"text":"Y coordinate.","name":"y","type":"number"},{"text":"X coordinate.","name":"x","type":"number"}]},"rets":{"ret":{"text":"The angle of the line from (0, 0) to (x, y) in radians, in the left-open interval (-pi, pi]","name":"","type":"number"}}},"example":[{"description":"atan( 1 ) and atan2( 1, 1 ) are both math.pi / 4\n\natan2( -1, -1 ) equals to ( (-3) * math.pi ) / 4","code":"print( atan( 1 ) )\nprint( atan2( 1, 1 ) )\nprint( atan2( -1, -1 ) )","output":"0.7853981633974483\n\n0.7853981633974483\n\n-2.356194490192345"},{"description":"Draws an icon in the center of the screen that rotates relative to the position of the cursor. **Note**: you might have to use Panel:LocalCursorPos if you want to draw this inside a panel.","code":"local icon = Material(\"icon16/emoticon_smile.png\", \"smooth\")\nlocal iconSize = 64\n\nhook.Add(\"HUDPaint\", \"Atan2Example\", function()\n\t-- The point relative to which the angle will be calculated\n\t-- We can assume that this is our \"zero\" coordinate\n\tlocal centerX, centerY = ScrW()/2, ScrH()/2\n\t-- The point for which we will look for the angle\n\tlocal mouseX, mouseY = input.GetCursorPos()\n\n\t-- Get the angle in radians\n\tlocal angle = math.atan2(\n\t\tcenterY - mouseY,\n\t\tmouseX - centerX\n\t)\n\t-- Convert to degrees\n\tlocal deg = math.deg(angle)\n\n\tsurface.SetDrawColor(255, 255, 255, 255)\n\tsurface.SetMaterial(icon)\n\tsurface.DrawTexturedRectRotated(centerX, centerY, iconSize, iconSize, deg)\n\n\t-- Just for debug\n\tdraw.SimpleText(deg, \"DermaDefault\", centerX, centerY + 40, color_white, TEXT_ALIGN_CENTER)\nend)"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"BinToInt","parent":"math","type":"libraryfunc","description":"Converts a binary string into a number.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"31-L33"},"args":{"arg":{"text":"Binary string to convert","name":"string","type":"string"}},"rets":{"ret":{"text":"Base 10 number.","name":"","type":"number"}}},"example":{"description":"Will print the string \"101010101\" as a number in console.","code":"print( math.BinToInt( \"101010101\" ) )","output":"341"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"BSplinePoint","parent":"math","type":"libraryfunc","description":"Basic code for Bézier-Spline algorithm.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"131-L142"},"args":{"arg":[{"text":"A number in the range `[0,fractionMax]` which controls which location along the spline's length should be evaluated as the return value.","name":"fraction","type":"number"},{"text":"A table of Vectors that form the spline.  \n\n\t\t\tThere must be **at least** 4 points.","name":"points","type":"table"},{"text":"The maximum value of the `fraction` argument.  \n\n\t\t\tThe most common value for this is `1`.","name":"fractionMax","type":"number"}]},"rets":{"ret":{"text":"The point on the Bézier curve that corresponds to the given `fraction` argument.","name":"","type":"Vector"}}},"example":[{"description":"Makes a black box that moves a Bézier curve made out of 4 points.","code":"local points = { \n\tVector( 100, 100, 0 ),\n\tVector( 200, 200, 0 ),\n\tVector( 300, 100, 0 ),\n\tVector( 400, 200, 0 )\n}\n\nhook.Add( \"HUDPaint\", \"BSplinePointExample\", function()\n\t-- Draw the points\n\tfor _, p in ipairs( points ) do\n\t\tdraw.RoundedBox( 0, p.x - 2, p.y - 2, 4, 4, color_white )\n\tend\n\n\t-- Draw the spline\n\tsurface.SetDrawColor( 255, 0, 0, 255 )\n\tlocal lastPos = math.BSplinePoint( 0, points, 1 )\n\tfor i=0, 10 do\n\t\tlocal pos = math.BSplinePoint( i / 10, points, 1 )\n\t\tsurface.DrawLine( lastPos.x, lastPos.y, pos.x, pos.y )\n\t\tlastPos = pos\n\tend\n\n\t-- Draw a point on the spline\n\tlocal pos = math.BSplinePoint( ( math.cos( CurTime() ) + 1 ) / 2, points, 1 )\n\tdraw.RoundedBox( 0, pos.x - 2, pos.y - 2, 4, 4, color_black )\n\nend )"},{"description":"Interactive demo","code":"local PANEL = {}\n\nPANEL.Init = function( panel )\n\tpanel:SetText( \"\" )\n\tpanel:SetSize( 24, 24 )\n\tpanel.Dragging = false\nend\nPANEL.OnCursorMoved = function( panel, x, y )\n\tif ( panel.Dragging ) then\n\t\tlocal x, y = input.GetCursorPos()\n\t\tpanel:SetPos( panel.StartPos.x + x - panel.CursorPos.x , panel.StartPos.y + y - panel.CursorPos.y )\n\tend\nend\nPANEL.OnMousePressed = function( panel, x, y )\n\tpanel.Dragging = true\n\tlocal x, y = input.GetCursorPos()\n\tpanel.CursorPos = { x = x, y = y }\n\tlocal x, y = panel:GetPos()\n\tpanel.StartPos = { x = x, y = y }\nend\n\nPANEL.OnMouseReleased = function( panel, x, y ) panel.Dragging = false end\nPANEL.OnCursorExited = PANEL.OnCursorMoved \n\nlocal MovableButton = vgui.RegisterTable( PANEL, \"DButton\" )\n\n\nlocal f = vgui.Create( \"DFrame\" )\nf:SetSize( 500, 500 )\nf:Center()\nf:MakePopup()\n\nlocal oldPaint = f.Paint\nf.Paint = function( pnl, w, h )\n\toldPaint( pnl, w, h )\n\n\tlocal points = {}\n\tfor k, pnl in ipairs( pnl:GetChildren() ) do\n\t\tlocal x, y = pnl:GetPos()\n\t\tif ( pnl.Dragging != nil ) then\n\t\t\ttable.insert( points, Vector( x, y, 0 ) )\n\t\t\tpnl:SetText( #points )\n\t\tend\n\tend\n\n\tsurface.SetDrawColor( 255, 0, 0, 255 )\n\tlocal lastPos = math.BSplinePoint( 0, points, 1 )\n\tfor i=0, 32 do\n\t\tlocal pos = math.BSplinePoint( i / 32, points, 1 )\n\t\tsurface.DrawLine( lastPos.x, lastPos.y, pos.x, pos.y )\n\t\tlastPos = pos\n\tend\nend\n\nvgui.CreateFromTable( MovableButton, f ):SetPos( 100, 100 )\nvgui.CreateFromTable( MovableButton, f ):SetPos( 200, 200 )\nvgui.CreateFromTable( MovableButton, f ):SetPos( 300, 100 )\nvgui.CreateFromTable( MovableButton, f ):SetPos( 400, 200 )\n\nlocal addBtn = vgui.Create( \"DButton\", f )\naddBtn:Dock( TOP )\naddBtn:SetText( \"Add point\" )\naddBtn.DoClick = function() vgui.CreateFromTable( MovableButton, f ):SetPos( VectorRand( 20, 450 ):Unpack() ) end"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"calcBSplineN","parent":"math","type":"libraryfunc","description":{"text":"Basic code for Bezier-Spline algorithm, helper function for math.BSplinePoint.","internal":"Use math.BSplinePoint instead."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"100-L129"},"args":{"arg":[{"name":"i","type":"number"},{"name":"k","type":"number","bug":{"text":"Sending in a value < 1 will result in an infinite loop.","pull":"1477"}},{"name":"t","type":"number"},{"name":"tinc","type":"number"}]},"rets":{"ret":{"name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ceil","parent":"math","type":"libraryfunc","description":"Ceils or rounds a number up.\n\n\tSee math.floor for the inverse of this function.","realm":"Shared and Menu","args":{"arg":{"text":"The number to be rounded up.","name":"number","type":"number"}},"rets":{"ret":{"text":"ceiled numbers","name":"","type":"number"}}},"example":{"description":"Round pi.","code":"print(math.ceil(math.pi))","output":"4"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"CHSpline","parent":"math","type":"libraryfunc","description":"Cubic Hermite spline algorithm.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"148-L159"},"added":"2023.08.08","args":{"arg":[{"text":"From 0 to 1, where alongside the spline the point will be.","name":"frac","type":"number"},{"text":"First point for the spline.","name":"point0","type":"Vector"},{"text":"Tangent for the first point for the spline.","name":"tan0","type":"Vector"},{"text":"Second point for the spline.","name":"point1","type":"Vector"},{"text":"Tangent for the second point for the spline.","name":"tan1","type":"Vector"}]},"rets":{"ret":{"text":"Point on the cubic Hermite spline, at given fraction.","name":"","type":"Vector"}}},"example":{"code":"local points = {\n\tVector( 128, 128 ), -- point 1\n\tVector( 384, 128 ), -- tangent pos 1\n\tVector( 128, 384 ), -- point 2\n\tVector( 384, 384 ) -- tangent pos 2\n}\n\nhook.Add( \"HUDPaint\", \"math.BezierLerp\", function()\n\tlocal frac = RealTime() % 1\n\tlocal point = math.CHSpline( frac, unpack( points ) )\n\n\tsurface.SetDrawColor( 255, 255, 0 )\n\tsurface.DrawRect( point.x - 4, point.y - 4, 8, 8 )\n\n\tsurface.DrawRect( points[1].x - 4, points[1].y - 4, 8, 8 )\n\tsurface.DrawRect( points[3].x - 4, points[3].y - 4, 8, 8 )\n\tsurface.SetDrawColor( 255, 0, 0 )\n\tsurface.DrawRect( points[2].x - 4, points[2].y - 4, 8, 8 )\n\tsurface.DrawRect( points[4].x - 4, points[4].y - 4, 8, 8 )\n\t\n\t-- Draw the spline\n\tfor i=0,20 do\n\t\n\t\tlocal point = math.CHSpline( i / 20, unpack( points ) )\n\n\t\tsurface.SetDrawColor( 0, 255, 0 )\n\t\tsurface.DrawRect( point.x - 2, point.y - 2, 4, 4 )\n\tend\nend )","output":{"upload":{"src":"70c/8db983d5bad2ef0.png","size":"28227","name":"image.png"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Clamp","parent":"math","type":"libraryfunc","description":"Clamps a number between a minimum and maximum value.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"53-L55"},"args":{"arg":[{"text":"The number to clamp.","name":"input","type":"number"},{"text":"The minimum value.","name":"min","type":"number"},{"text":"The maximum value, this function will **never** return a number greater than this.","name":"max","type":"number"}]},"rets":{"ret":{"text":"The clamped value.","name":"","type":"number"}}},"example":[{"description":"Demonstrates what this function does.","code":"print( math.Clamp( 10, 0, 5 ) ) -- 10 is greater than 5 so returns 5\nprint( math.Clamp( 3, 0, 5 ) ) -- 3 is greater than 0 and less than 5, so returns 3\nprint( math.Clamp( -1, 0, 5 ) ) -- -1 is less than 0, so returns 0\nprint( math.Clamp( 20, 50, 10 ) ) -- 20 is greater than 10 so returns 10, even though min arg is 50","output":"```\n5\n3\n0\n10\n```"},{"description":"Heals player by 10, but won't let their health go above 100.","code":"ply:SetHealth( math.Clamp( ply:Health() + 10, 0, 100 ) )"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"cos","parent":"math","type":"libraryfunc","description":"Returns the [cosine](https://en.wikipedia.org/wiki/Trigonometric_functions#cos) of given angle.","realm":"Shared and Menu","args":{"arg":{"text":"Angle in radians","name":"number","type":"number"}},"rets":{"ret":{"text":"Cosine of given angle in the range (-1, 1)","name":"","type":"number"}}},"example":{"description":"Prints the cosine of 3.14159265 (Pi)","code":"print( math.cos( 3.14159265 ) )","output":"-1"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"cosh","parent":"math","type":"libraryfunc","description":"Returns the [hyperbolic cosine](https://en.wikipedia.org/wiki/Cosh_(mathematical_function)) of the given angle.","realm":"Shared and Menu","args":{"arg":{"text":"Angle in radians.","name":"number","type":"number"}},"rets":{"ret":{"text":"The hyperbolic cosine of the given angle.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"CubicBezier","parent":"math","type":"libraryfunc","description":"Lerp point between 4 control points with cubic bezier.\n\nSee math.QuadraticBezier for a similar function which works with 3 control points.","realm":"Shared and Menu","added":"2023.08.08","file":{"text":"lua/includes/extensions/math.lua","line":"220-L226"},"args":{"arg":[{"text":"The fraction for finding the result. This number is clamped between 0 and 1.","name":"frac","type":"number"},{"text":"First control point","name":"p0","type":"Vector"},{"text":"First tangent","name":"p1","type":"Vector"},{"text":"Second tangent","name":"p2","type":"Vector"},{"text":"Second control point","name":"p3","type":"Vector"}]},"rets":{"ret":{"text":"Point between control points at the specified fraction","name":"","type":"Vector"}}},"example":{"description":"Demonstrates the use of this function.","code":"local points = {\n\tVector( 128, 128 ),\n\tVector( 384, 128 ),\n\tVector( 384, 384 ),\n\tVector( 128, 384 )\n}\n\nhook.Add( \"HUDPaint\", \"math.CubicBezier\", function()\n\tlocal frac = RealTime() % 1\n\tlocal point = math.CubicBezier( frac, points[1], points[2], points[3], points[4] )\n\n\tsurface.SetDrawColor( 255, 255, 0 )\n\tsurface.DrawRect( point.x - 4, point.y - 4, 8, 8 )\n\n\tsurface.DrawRect( points[1].x - 4, points[1].y - 4, 8, 8 )\n\tsurface.DrawRect( points[2].x - 4, points[2].y - 4, 8, 8 )\n\tsurface.DrawRect( points[3].x - 4, points[3].y - 4, 8, 8 )\n\tsurface.DrawRect( points[4].x - 4, points[4].y - 4, 8, 8 )\nend )","output":{"image":{"src":"ab571/8dc38952f5e0f29.gif","alt":"Cubic bezier demonstration"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"deg","parent":"math","type":"libraryfunc","description":"Converts radians to degrees.","realm":"Shared and Menu","args":{"arg":{"text":"Value to be converted to degrees.","name":"radians","type":"number"}},"rets":{"ret":{"text":"degrees","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Dist","parent":"math","type":"libraryfunc","description":{"text":"Returns the difference between two points in 2D space. Alias of math.Distance.","deprecated":"You should use math.Distance instead"},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"20-L24"},"args":{"arg":[{"text":"X position of first point","name":"x1","type":"number"},{"text":"Y position of first point","name":"y1","type":"number"},{"text":"X position of second point","name":"x2","type":"number"},{"text":"Y position of second point","name":"y2","type":"number"}]},"rets":{"ret":{"text":"Distance between the two points.","name":"","type":"number"}}},"example":{"description":"Demonstrates the use of this function.","code":"print( math.Distance( 1, 2, 5, 6 ) ) -- distance bet","output":"5.6568542494924"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Distance","parent":"math","type":"libraryfunc","description":"Returns the difference between two points in 2D space.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"20-L24"},"args":{"arg":[{"text":"X position of first point","name":"x1","type":"number"},{"text":"Y position of first point","name":"y1","type":"number"},{"text":"X position of second point","name":"x2","type":"number"},{"text":"Y position of second point","name":"y2","type":"number"}]},"rets":{"ret":{"text":"Distance between the two points","name":"","type":"number"}}},"example":{"description":"Demonstrates the use of this function.","code":"print( math.Distance( 1, 2, 5, 6 ) ) -- distance bet","output":"5.6568542494924"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"DistanceSqr","parent":"math","type":"libraryfunc","description":"Returns the squared difference between two points in 2D space. This is computationally faster than math.Distance.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"10-L14"},"args":{"arg":[{"text":"X position of first point","name":"x1","type":"number"},{"text":"Y position of first point","name":"y1","type":"number"},{"text":"X position of second point","name":"x2","type":"number"},{"text":"Y position of second point","name":"y2","type":"number"}]},"rets":{"ret":{"text":"The squared distance between the two points.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"EaseInOut","parent":"math","type":"libraryfunc","description":"Calculates the progress of a value fraction, taking in to account given easing fractions","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"74-L98"},"args":{"arg":[{"text":"Fraction of the progress to ease, from 0 to 1.","name":"progress","type":"number"},{"text":"Fraction of how much easing to begin with, from 0 to 1.","name":"easeIn","type":"number","default":"0"},{"text":"Fraction of how much easing to end with, from 0 to 1.","name":"easeOut","type":"number","default":"1"}]},"rets":{"ret":{"text":"\"Eased\" Value, from 0 to 1","name":"","type":"number"}}},"example":[{"description":"Calculates the easing of three situations","code":"print(math.EaseInOut(0.1, 0.1, 0.1))\nprint(math.EaseInOut(0.2, 0.1, 0.1))\nprint(math.EaseInOut(0.3, 0.1, 0.1))","output":"0.055555...\n0.166666...\n0.277777..."},{"description":"Interactive preview of the curve this function can generate.","code":"local f = vgui.Create( \"DFrame\" )\nf:SetSize( 500, 500 )\nf:Center()\nf:MakePopup()\n\nlocal sliderIn = vgui.Create( \"DNumSlider\", f )\nsliderIn:Dock( TOP )\nsliderIn:SetMinMax( 0, 4 )\nsliderIn:SetText( \"Ease In\" )\n\nlocal sliderOut = vgui.Create( \"DNumSlider\", f )\nsliderOut:Dock( TOP )\nsliderOut:SetMinMax( 0, 4 )\nsliderOut:SetText( \"Ease Out\" )\n\nlocal sliderMax = vgui.Create( \"DNumSlider\", f )\nsliderMax:Dock( TOP )\nsliderMax:SetMinMax( 1, 2 )\nsliderMax:SetValue( 1 )\nsliderMax:SetText( \"Value Range Max\" )\n\nlocal quality = 128\n\nlocal oldPaint = f.Paint\nf.Paint = function( pnl, w, h )\n\toldPaint( pnl, w, h )\n\n\tsurface.SetDrawColor( 255, 0, 0, 255 )\n\tlocal lastPos = { x = 0, y = 0 }\n\tfor i=0, quality do\n\t\tlocal pos = { x = i / quality * pnl:GetWide(), y = math.EaseInOut( math.Remap( i / quality, 0, 1, 0, sliderMax:GetValue() ), sliderIn:GetValue(), sliderOut:GetValue() ) * pnl:GetTall() }\n\t\tsurface.DrawLine( lastPos.x, lastPos.y, pos.x, pos.y )\n\t\tlastPos = pos\n\tend \n\n\tlocal frac = CurTime() % 1\n\tlocal easeVal = math.EaseInOut( math.Remap( frac, 0, 1, 0, sliderMax:GetValue() ), sliderIn:GetValue(), sliderOut:GetValue() )\n\tsurface.DrawCircle( frac * pnl:GetWide(), easeVal * pnl:GetTall(), 4, 255, 255, 255 )\n\n\tsurface.SetDrawColor( 255, 255, 255, easeVal * 255 )\n\tsurface.DrawRect( 10, pnl:GetTall() - 10 - 48, 48, 48 )\nend","output":{"upload":{"src":"70c/8dcc90cd6ec7ec8.gif","size":"25530","name":"August30-494-hl2.gif"}}}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"exp","parent":"math","type":"libraryfunc","description":"Returns e to the power of the input.","realm":"Shared and Menu","args":{"arg":{"text":"The exponent for the function.","name":"exponent","type":"number"}},"rets":{"ret":{"text":"e to the specified power","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Factorial","parent":"math","type":"libraryfunc","description":"Simple function that calculates [factorial](https://en.wikipedia.org/wiki/Factorial) of a whole number.","realm":"Shared and Menu","added":"2023.11.14","file":{"text":"lua/includes/extensions/math.lua","line":"248-L261"},"args":{"arg":{"text":"An whole number to get a factorial of. Decimal numbers will be treated as whole numbers.","name":"val_in","type":"number"}},"rets":{"ret":{"text":"The factorial of given number.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"floor","parent":"math","type":"libraryfunc","description":"Floors or rounds a number down.\n\n\tSee math.ceil for the inverse of this function.","realm":"Shared and Menu","args":{"arg":{"text":"The number to be rounded down.","name":"number","type":"number"}},"rets":{"ret":{"text":"floored numbers","name":"","type":"number"}}},"example":[{"description":"Round pi.","code":"print(math.floor(math.pi))","output":"3"},{"description":"Demonstrates the difference between math.Round and math.floor.","code":"local value = 3.6\n\nprint( math.Round( value ), math.floor( value ) )","output":"4 3"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"fmod","parent":"math","type":"libraryfunc","description":"Returns the modulus of the specified values.\n\nWhile this is similar to the `%` operator, **it will return a negative value if the first argument is negative**, whereas the % operator will return a **positive** value **even if the first operand is negative**.\n\nThis function is also slower than the `%` operator.","realm":"Shared and Menu","args":{"arg":[{"text":"The base value.","name":"base","type":"number"},{"text":"The modulator.","name":"modulator","type":"number"}]},"rets":{"ret":{"text":"The calculated modulus.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"frexp","parent":"math","type":"libraryfunc","description":"**Lua reference description**: Returns `m` and `e` such that `x = m2e`, `e` is an integer and the absolute value of `m` is in the range ((0.5, 1) (or zero when x is zero).\n\nUsed to split the number value into a normalized fraction and an exponent. Two values are returned: the first is a multiplier in the range `1/2` (**inclusive**) to `1` (**exclusive**) and the second is an integer exponent.\n\nThe result is such that `x = m*2^e`.","realm":"Shared and Menu","args":{"arg":{"text":"The value to get the normalized fraction and the exponent from.","name":"x","type":"number"}},"rets":{"ret":[{"text":"m, multiplier - between `0.5` and `1`.","name":"","type":"number"},{"text":"e, exponent - **always** an integer.","name":"","type":"number"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IntToBin","parent":"math","type":"libraryfunc","description":"Converts an integer to a binary (base-2) string.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"44-L47"},"args":{"arg":{"text":"Number to be converted.","name":"int","type":"number"}},"rets":{"ret":{"text":"Binary number string. The length of this will always be a multiple of 3.","name":"","type":"string"}}},"example":{"description":"Prints the binary representation of 4","code":"print(math.IntToBin(4))","output":"100"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsNearlyEqual","parent":"math","type":"libraryfunc","description":"Checks if two floating point numbers are nearly equal.\n\nThis is useful to mitigate  [accuracy issues in floating point numbers](https://en.wikipedia.org/wiki/Floating-point_arithmetic#Accuracy_problems). See examples below.","realm":"Shared and Menu","added":"2025.01.22","file":{"text":"lua/includes/extensions/math.lua","line":"267-L273"},"args":{"arg":[{"text":"The first number to compare.","name":"a","type":"number"},{"text":"The second number to compare.","name":"b","type":"number"},{"text":"The maximum difference between the two numbers to consider them equal.","name":"tolerance","type":"number","default":"1e-8"}]},"rets":{"ret":{"text":"True if the difference between the two numbers is less than or equal to the tolerance.","name":"","type":"boolean"}}},"example":[{"description":"Shows the problem known as a [floating-point error](https://en.wikipedia.org/wiki/Floating-point_arithmetic#Accuracy_problems), due to the limited precision of decimal numbers in hardware.","code":"print( 0.1 + 0.2 == 0.3 ) -- Which is mathematically true.\nprint( string.format( \"%.32f\", 0.1 + 0.2 ) ) -- Outputs the result with up to 32 decimal numbers.","output":"```\nfalse\n0.30000000000000004440892098500626\n```"},{"description":"Shows the workaround using `math.IsNearlyEqual()`.","code":"print( math.IsNearlyEqual( 0.1 + 0.2, 0.3 ) )\nprint( string.format( \"%.32f\", 0.1 + 0.2 ) )","output":"```\ntrue\n0.30000000000000004440892098500626\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ldexp","parent":"math","type":"libraryfunc","description":"Takes a normalised number and returns the floating point representation.\n\nEffectively it returns the result of `normalizedFraction * 2.0 ^ exponent`. math.frexp is the opposite function.","realm":"Shared and Menu","args":{"arg":[{"text":"The value to get the normalized fraction and the exponent from.","name":"normalizedFraction","type":"number"},{"text":"The value to get the normalized fraction and the exponent from.","name":"exponent","type":"number"}]},"rets":{"ret":{"text":"result","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"log","parent":"math","type":"libraryfunc","description":"With one argument, return the natural logarithm of x (to base e).\n\nWith two arguments, return the logarithm of x to the given base, calculated as log(x)/log(base).","realm":"Shared and Menu","args":{"arg":[{"text":"The value to get the base from exponent from.","name":"x","type":"number"},{"text":"The logarithmic base.","name":"base","type":"number","default":"e"}]},"rets":{"ret":{"text":"Logarithm of x to the given base","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"log10","parent":"math","type":"libraryfunc","description":"Returns the base-10 logarithm of x. This is usually more accurate than math.log(x, 10).","realm":"Shared and Menu","args":{"arg":{"text":"The value to get the base from exponent from.","name":"x","type":"number"}},"rets":{"ret":{"text":"The result.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"max","parent":"math","type":"libraryfunc","description":"Returns the largest value of all arguments.","realm":"Shared and Menu","args":{"arg":{"text":"Numbers to get the largest from","name":"numbers","type":"vararg"}},"rets":{"ret":{"text":"The largest number","name":"","type":"number"}}},"example":[{"description":"Get the largest number of a group.","code":"print( math.max( 464, 654698468, 1, 3, 2 ) )","output":"```\n654698468\n```"},{"description":"Prevent a value from falling under a certain minimum. A one-sided version of math.Clamp.","code":"local minimumValue = 5\n\nfunction lowClamp(num)\n\n     return math.max( minimumValue, num )\n\nend\n\nprint( lowClamp( 0.1 ) )\nprint( lowClamp( -6 ) )\nprint( lowClamp( 5 ) )\nprint( lowClamp( 8 ) )\nprint( lowClamp( 24 ) )","output":"```\n5\n5\n5\n8\n24\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"min","parent":"math","type":"libraryfunc","description":"Returns the smallest value of all arguments.","realm":"Shared and Menu","args":{"arg":{"text":"Numbers to get the smallest from.","name":"numbers","type":"vararg"}},"rets":{"ret":{"text":"The smallest number","name":"","type":"number"}}},"example":{"description":"Get the smallest number of a group.","code":"print( math.min( 1, 2, -3, 464, 654698468 ) )","output":"-3"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"mod","parent":"math","type":"libraryfunc","description":{"text":"Returns the modulus of the specified values. Same as math.fmod.","deprecated":"This is removed in Lua versions later than what GMod is currently using. You should use the % operator or math.fmod instead."},"realm":"Shared and Menu","args":{"arg":[{"text":"The base value","name":"base","type":"number"},{"text":"Modulator","name":"modulator","type":"number"}]},"rets":{"ret":{"text":"The calculated modulus","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"modf","parent":"math","type":"libraryfunc","description":"Returns the integral and fractional component of the modulo operation.","realm":"Shared and Menu","args":{"arg":{"text":"The base value.","name":"base","type":"number"}},"rets":{"ret":[{"text":"The integral component.","name":"","type":"number"},{"text":"The fractional component.","name":"","type":"number"}]}},"example":{"description":"Finds the integral and fractional components of 5.6.","code":"print( math.modf( 5.6 ) )","output":"```\n5\t0.6\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"NormalizeAngle","parent":"math","type":"libraryfunc","description":"Normalizes angle, so it returns value between -180 and 180.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"189-L191"},"args":{"arg":{"text":"The angle to normalize, in degrees.","name":"angle","type":"number"}},"rets":{"ret":{"text":"The normalized angle, in the range of -180 to 180 degrees.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"pow","parent":"math","type":"libraryfunc","description":"Returns x raised to the power y.\nIn particular, math.pow(1.0, x) and math.pow(x, 0.0) always return 1.0, even when x is a zero or a nan. If both x and y are finite, x is negative, and y is not an integer then math.pow(x, y) is undefined.","realm":"Shared and Menu","args":{"arg":[{"text":"Base.","name":"x","type":"number"},{"text":"Exponent.","name":"y","type":"number"}]},"rets":{"ret":{"text":"y power of x","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"QuadraticBezier","parent":"math","type":"libraryfunc","description":"Lerp point between 3 control points with quadratic bezier.\n\nSee math.CubicBezier for a function which works with 4 control points.","realm":"Shared and Menu","added":"2023.08.08","file":{"text":"lua/includes/extensions/math.lua","line":"232-L238"},"args":{"arg":[{"text":"The fraction for finding the result.","name":"frac","type":"number"},{"text":"First control point","name":"p0","type":"Vector"},{"text":"Tangent","name":"p1","type":"Vector"},{"text":"Second control point","name":"p2","type":"Vector"}]},"rets":{"ret":{"text":"Point between control points at the specified fraction","name":"","type":"Vector"}}},"example":{"description":"Demonstrates the use of this function.","code":"local points = {\n\tVector( 128, 128 ),\n\tVector( 384, 128 ),\n\tVector( 384, 384 )\n}\n\nhook.Add( \"HUDPaint\", \"math.QuadraticBezier\", function()\n\tlocal frac = RealTime() % 1\n\tlocal point = math.QuadraticBezier( frac, unpack( points ) )\n\n\tsurface.SetDrawColor( 255, 255, 0 )\n\tsurface.DrawRect( point.x - 4, point.y - 4, 8, 8 )\n\n\tsurface.DrawRect( points[1].x - 4, points[1].y - 4, 8, 8 )\n\tsurface.DrawRect( points[2].x - 4, points[2].y - 4, 8, 8 )\n\tsurface.DrawRect( points[3].x - 4, points[3].y - 4, 8, 8 )\nend )","output":{"image":{"src":"ab571/8dc389558600250.gif","alt":"Quadratic Bezier demonstration"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"rad","parent":"math","type":"libraryfunc","description":"Converts an angle in degrees to it's equivalent in radians.","realm":"Shared and Menu","args":{"arg":{"text":"The angle measured in degrees.","name":"degrees","type":"number"}},"rets":{"ret":{"text":"radians","name":"","type":"number"}}},"example":{"description":"Convert various angles in degrees to their equivalent in radians.","code":"print( \"Degrees: 360, Radians: \" .. math.rad( 360 ) ) -- 2*pi\nprint( \"Degrees: 180, Radians: \" .. math.rad( 180 ) ) -- pi\nprint( \"Degrees: 90, Radians: \" .. math.rad( 90 ) ) -- pi/2\nprint( \"Degrees: 1, Radians: \" .. math.rad( 1 ) ) -- pi/180","output":"Degrees: 360, Radians: 6.2831853071796\n\n\nDegrees: 180, Radians: 3.1415926535898\n\n\nDegrees: 90, Radians: 1.5707963267949\n\n\nDegrees: 1, Radians: 0.017453292519943"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Rand","parent":"math","type":"libraryfunc","description":"Returns a random float between min and max.\n\nSee also math.random","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"61-L63"},"args":{"arg":[{"text":"The minimum value.","name":"min","type":"number"},{"text":"The maximum value.","name":"max","type":"number"}]},"rets":{"ret":{"text":"Random float between min and max.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"text":"---","function":{"name":"random","parent":"math","type":"libraryfunc","description":"When called without arguments, returns a uniform pseudo-random real number in the range 0 to 1 which includes 0 but excludes 1.\n\nWhen called with an integer number m, returns a uniform pseudo-random integer in the range 1 to m inclusive.\n\nWhen called with two integer numbers m and n, returns a uniform pseudo-random integer in the range m to n inclusive.\n\nSee also math.Rand","realm":"Shared and Menu","args":{"arg":[{"text":"If m is the only parameter: upper limit.\n\nIf n is also provided: lower limit.\n\nIf provided, this must be an integer.","name":"m","type":"number","default":"nil"},{"text":"Upper limit.\n\nIf provided, this must be an integer.","name":"n","type":"number","default":"nil"}]},"rets":{"ret":{"text":"Random value","name":"","type":"number"}}},"example":[{"name":"Random in Range","description":"Generate a random number between 1 and 400 with both math.random and math.Rand.","code":"print( 'Random Integer [ 1 , 400 ) :' , math.random( 1 , 400 ) )","output":"```\nRandom Integer [ 1 , 400 ) : 317\n```"},{"name":"Random Table Key","description":"Select a random key from a table, where the keys have a different probability of being selected.","code":"function GetWeightedRandomKey( tab )\n\tlocal sum = 0\n\n\tfor _, chance in pairs( tab ) do\n\t\tsum = sum + chance\n\tend\n\n\tlocal select = math.random() * sum\n\n\tfor key, chance in pairs( tab ) do\n\t\tselect = select - chance\n\t\tif select < 0 then return key end\n\tend\nend\n\n-- Example usage:\nlocal fruit = {\n\tGrape = 4.5,\n\tOrange = 20,\n\tBanana = 3.14\n}\n\nfor i = 1, 5 do\n\tprint( GetWeightedRandomKey( fruit ) )\nend","output":"```\nBanana\nGrape\nBanana\nOrange\nOrange\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"randomseed","parent":"math","type":"libraryfunc","description":{"text":"Seeds the random number generator. The same seed will guarantee the same sequence of numbers each time with math.random.\n\nFor shared random values across predicted realms, use util.SharedRandom.","warning":"Usage of this function affects **ALL** random numbers in the game. This means that improper use (such as setting the seed to a static value that doesn't change with time) can negatively affect other addons or the base game.\n\nIt is a good idea to set the seed back to at least something like Global.SysTime in those cases."},"realm":"Shared and Menu","args":{"arg":{"text":"The new seed","name":"seed","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Remap","parent":"math","type":"libraryfunc","description":"Remaps the value from one range to another","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"211-L213"},"args":{"arg":[{"text":"The value","name":"value","type":"number"},{"text":"The minimum of the initial range","name":"inMin","type":"number"},{"text":"The maximum of the initial range","name":"inMax","type":"number"},{"text":"The minimum of new range","name":"outMin","type":"number"},{"text":"The maximum of new range","name":"outMax","type":"number"}]},"rets":{"ret":{"text":"The number in the new range","name":"","type":"number"}}},"example":{"description":"Example usage, converts a value from range 0-1, to range 0-255.","code":"print( math.Remap( 0.5, 0, 1, 0, 255 ) )","output":"127.5"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Round","parent":"math","type":"libraryfunc","description":"Rounds the given value to the nearest whole number or to the given decimal places.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"162-L165"},"args":{"arg":[{"text":"The value to round.","name":"value","type":"number"},{"text":"The decimal places to round to.","name":"decimals","type":"number","default":"0"}]},"rets":{"ret":{"text":"The rounded value.","name":"","type":"number"}}},"example":[{"description":"Rounds a number to the nearest whole number.","code":"print(math.Round(104.6256712))","output":"105"},{"description":"Rounds the number to two decimal places.","code":"print(math.Round(104.6256712, 2))","output":"104.63"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Sign","parent":"math","type":"libraryfunc","description":"Returns the mathematical negative/positive sign of the input number.","realm":"Shared and Menu","added":"2026.05.25","file":{"text":"lua/includes/extensions/math.lua","line":"185-L187"},"args":{"arg":{"text":"The input number.","name":"value","type":"number"}},"rets":{"ret":{"text":"`-1` for inputs of less than 0, `0` if given a 0, `1` for inputs above 0.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"sin","parent":"math","type":"libraryfunc","description":"Returns the [sine](https://en.wikipedia.org/wiki/Trigonometric_functions) of given angle.","realm":"Shared and Menu","args":{"arg":{"text":"Angle in radians","name":"number","type":"number"}},"rets":{"ret":{"text":"Sine for given angle in the range (-1, 1)","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"sinh","parent":"math","type":"libraryfunc","description":"Returns the [hyperbolic sine](https://en.wikipedia.org/wiki/Hyperbolic_functions) of the given angle.","realm":"Shared and Menu","args":{"arg":{"text":"Angle in radians.","name":"number","type":"number"}},"rets":{"ret":{"text":"The hyperbolic sine of the given angle.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SnapTo","parent":"math","type":"libraryfunc","description":"Snaps a number to the closest multiplicative of given number. See also Angle:SnapTo.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"216-L218"},"added":"2022.06.08","args":{"arg":[{"text":"The number to snap.","name":"input","type":"number"},{"text":"What to snap the input number to.","name":"snapTo","type":"number"}]},"rets":{"ret":{"text":"The clamped value.","name":"","type":"number"}}},"example":{"description":"Example usage","code":"print( math.SnapTo( 0, 15 ) )\nprint( math.SnapTo( 10, 15 ) )\nprint( math.SnapTo( 20, 15 ) )\nprint( math.SnapTo( 22.2, 15 ) )\nprint( math.SnapTo( 22.5, 15 ) )\nprint( math.SnapTo( 43, 15 ) )","output":"```\n0\n15\n15\n15\n30\n45\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"sqrt","parent":"math","type":"libraryfunc","description":"Returns the square root of the number.","realm":"Shared and Menu","args":{"arg":{"text":"Value to get the square root of.","name":"value","type":"number"}},"rets":{"ret":{"text":"squareRoot","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"tan","parent":"math","type":"libraryfunc","description":"Returns the tangent of the given angle.","realm":"Shared and Menu","args":{"arg":{"text":"Angle in radians","name":"value","type":"number"}},"rets":{"ret":{"text":"The tangent of the given angle.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"tanh","parent":"math","type":"libraryfunc","description":"Returns the [hyperbolic tangent](https://en.wikipedia.org/wiki/Hyperbolic_functions) of the given number.","realm":"Shared and Menu","args":{"arg":{"text":"Angle in radians.","name":"number","type":"number"}},"rets":{"ret":{"text":"The hyperbolic tangent of the given angle.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"TimeFraction","parent":"math","type":"libraryfunc","description":"Returns the fraction of where the current time is relative to the start and end times","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"207-L209"},"args":{"arg":[{"text":"Start time in seconds","name":"start","type":"number"},{"text":"End time in seconds","name":"end","type":"number"},{"text":"Current time in seconds","name":"current","type":"number"}]},"rets":{"ret":{"text":"Fraction","name":"","type":"number"}}},"example":{"description":"Prints the time fraction of 5 between 0 and 10","code":"print(math.TimeFraction(0, 10, 5))","output":"0.5"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Truncate","parent":"math","type":"libraryfunc","description":"Trim unwanted decimal places.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/math.lua","line":"168-L171"},"args":{"arg":[{"text":"The number to truncate","name":"num","type":"number"},{"text":"The amount of digits to keep after the point.","name":"digits","type":"number","default":"0"}]},"rets":{"ret":{"text":"The result.","name":"","type":"number"}}},"example":{"description":"Demonstrates the use of this function.","code":"local num = 54.59874\n\nprint( math.Truncate( num, 2 ) ) -- 54.59\nprint( math.Round( num, 2 ) ) -- 54.6","output":"```\n54.59\n54.6\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ActiveList","parent":"matproxy","type":"libraryfield","description":{"text":"A list of all **active** material proxies.","internal":""},"realm":"Client","rets":{"ret":{"text":"The list of all active material proxies.","name":"","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ProxyList","parent":"matproxy","type":"libraryfield","description":"A list of all material proxies registered with matproxy.Add.","realm":"Client","rets":{"ret":{"text":"The list of all material proxies.","name":"","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Add","parent":"matproxy","type":"libraryfunc","description":{"text":"Register a material proxy. See matproxy for more general explanation of what they are.","note":"The `bind` function is required. The `init` function won't run without it set."},"realm":"Client","file":{"text":"lua/includes/modules/matproxy.lua","line":"20-L45"},"args":{"arg":{"text":"The information about the proxy. See Structures/MatProxyData","name":"matProxyData","type":"table"}}},"example":[{"description":"Adds `PlayerColor` proxy. Example taken from `lua/matproxy/player_color.lua`.","code":"matproxy.Add( {\n    name = \"PlayerColor\", \n    init = function( self, mat, values )\n        -- Store the name of the variable we want to set\n        self.ResultTo = values.resultvar\n    end,\n    bind = function( self, mat, ent )\n        -- If the target ent has a function called GetPlayerColor then use that\n        -- The function SHOULD return a Vector with the chosen player's colour.\n\n        -- In sandbox this function is created as a network function, \n        -- in player_sandbox.lua in SetupDataTables\n       if ( ent.GetPlayerColor ) then\n           mat:SetVector( self.ResultTo, ent:GetPlayerColor() )\n       end\n   end \n} )","output":"Adds PlayerColor proxy."},{"description":"Material proxy values are stored like this:\n\n* In the `.vmt`:\n\n```\nProxies {\n    PlayerColor {\n       resultVar $color2\n       myVariable $color\n    }\n}\n```\n\n\n* In Lua ( The **Init** function of Structures/MatProxyData )","code":"values = {\n    resultvar = \"$color2\"\n    myvariable = \"$color\"\n}"}],"realms":["Client"],"type":"Function"},
{"function":{"name":"Call","parent":"matproxy","type":"libraryfunc","description":{"text":"Called by the engine from `OnBind`. Calls bind method of the Lua material proxy.","internal":""},"realm":"Client","file":{"text":"lua/includes/modules/matproxy.lua","line":"50-L58"},"args":{"arg":[{"text":"The material proxy name.","name":"uname","type":"string"},{"text":"The material the proxy is being applied to.","name":"mat","type":"IMaterial"},{"text":"The entity the material is applied to.","name":"ent","type":"Entity"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Init","parent":"matproxy","type":"libraryfunc","description":{"text":"Called by the engine from `OnBind`. Calls init method of the Lua material proxy.","internal":""},"realm":"Client","file":{"text":"lua/includes/modules/matproxy.lua","line":"63-L79"},"args":{"arg":[{"text":"Name of the material proxy.","name":"name","type":"string"},{"text":"Name for the active material proxy instance.","name":"uname","type":"string"},{"text":"Material the material proxy is applied to.","name":"mat","type":"IMaterial"},{"text":"`.vmt` shader parameters of the material.","name":"values","type":"table"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ShouldOverrideProxy","parent":"matproxy","type":"libraryfunc","description":{"text":"Called by engine to determine if a certain material proxy is registered in Lua.","internal":""},"realm":"Client","file":{"text":"lua/includes/modules/matproxy.lua","line":"11-L15"},"args":{"arg":{"text":"The name of proxy in question","name":"name","type":"string"}},"rets":{"ret":{"text":"Whether the material proxy of given name is registered.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"RecordFrame","parent":"menu","type":"libraryfunc","description":{"text":"Used by \"Demo to Video\" to record the frame.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Init","parent":"menubar","type":"libraryfunc","description":"Creates the menu bar ( The bar at the top of the screen when holding C or Q in sandbox ) and docks it to the top of the screen. It will not appear.\n\n\nCalling this multiple times will **NOT** remove previous panel.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsParent","parent":"menubar","type":"libraryfunc","description":"Checks if the supplied panel is parent to the menubar","realm":"Client","args":{"arg":{"text":"The panel to check","name":"pnl","type":"Panel"}},"rets":{"ret":{"text":"Is parent or not","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ParentTo","parent":"menubar","type":"libraryfunc","description":"Parents the menubar to the panel and displays the menubar.","realm":"Client","args":{"arg":{"text":"The panel to parent to","name":"pnl","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AdvanceVertex","parent":"mesh","type":"libraryfunc","description":"Pushes the currently set vertex data (via other `mesh.*` functions) into the mesh stack. See example on mesh.Begin.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Begin","parent":"mesh","type":"libraryfunc","description":"Begins creating or modifying a 3D mesh constructed from a given quantity and type of primitive 3D shapes such as triangles and quads.\n\n\t\tThe resulting mesh can be stored in an IMesh if it is intended to be drawn multiple times or on multiple frames.","realm":"Client","args":[{"name":"Building an IMesh","arg":[{"text":"The IMesh that the created mesh will be stored in.\n\t\t\t\n\t\t\tIf the mesh has already been built, it will instead have its existing vertices modified but cannot have the quantity of vertices changed.","name":"mesh","type":"IMesh"},{"text":"An enum that indicates what the format of the mesh's primitives will be.  \n\t\t\tFor a full list of the available options, see the Enums/MATERIAL.","name":"primitiveType","type":"number"},{"text":"The quantity of primitives this mesh will contain as a whole integer number.\n\n\t\t\tThe total number of vertices must not exceed the limit of `65535`.  \n\t\t\tThe number of vertices created by each primitive will depend on the type of primitive used to construct the mesh.\n\n\t\t\tThe expected value of this argument is dependent on the primitive type used.  \n\t\t\tFor a full list of the primitive counts expected by each primitive type, see Enums/MATERIAL.","name":"primitiveCount","type":"number"}]},{"name":"Building a Dynamic Mesh","arg":[{"text":"An enum that indicates what the format of the mesh's primitives will be.  \n\t\t\tFor a full list of the available options, see the Enums/MATERIAL.","name":"primitiveType","type":"number"},{"text":"The quantity of primitives this mesh will contain as a whole integer number.\n\n\t\t\tThe total number of vertices must not exceed the limit of `65535`.  \n\t\t\tThe number of vertices created by each primitive will depend on the type of primitive used to construct the mesh.\n\n\t\t\tThe expected value of this argument is dependent on the primitive type used.  \n\t\t\tFor a full list of the primitive counts expected by each primitive type, see Enums/MATERIAL.","name":"primitiveCount","type":"number"}]}]},"example":[{"description":"Draws a triangle near Vector( 0, 0, 0 ) in the map using a dynamic mesh, a dynamic mesh is good for animated meshes, or otherwise frequently changed rendered meshes.","code":"local mat = Material( \"editor/wireframe\" ) -- The material (a wireframe)\n\nlocal verts = { -- A table of 3 vertices that form a triangle\n\t{ pos = Vector( 0,  0,  0 ), u = 0, v = 0 }, -- Vertex 1\n\t{ pos = Vector( 10, 0,  0 ), u = 1, v = 0 }, -- Vertex 2\n\t{ pos = Vector( 10, 10, 0 ), u = 1, v = 1 }, -- Vertex 3\n}\n\nhook.Add( \"PostDrawOpaqueRenderables\", \"MeshLibTest\", function()\n\n\trender.SetMaterial( mat ) -- Apply the material\n\tmesh.Begin( MATERIAL_TRIANGLES, 1 ) -- Begin writing to the dynamic mesh\n\tfor i = 1, #verts do\n\t\tmesh.Position( verts[i].pos ) -- Set the position\n\t\tmesh.TexCoord( 0, verts[i].u, verts[i].v ) -- Set the texture UV coordinates\n\t\tmesh.AdvanceVertex() -- Write the vertex\n\tend\n\tmesh.End() -- Finish writing the mesh and draw it\nend )"},{"description":"Draws a triangle near Vector( 0, 0, 0 ) in the map using a static mesh, that is, a mesh that is only created once, which is good for performance.","code":"local mat = Material( \"editor/wireframe\" ) -- The material (a wireframe)\nlocal obj = Mesh() -- Create the IMesh object\n\nlocal verts = { -- A table of 3 vertices that form a triangle\n\t{ pos = Vector( 0,  0,  0 ), u = 0, v = 0 }, -- Vertex 1\n\t{ pos = Vector( 10, 0,  0 ), u = 1, v = 0 }, -- Vertex 2\n\t{ pos = Vector( 10, 10, 0 ), u = 1, v = 1 }, -- Vertex 3\n}\n\nmesh.Begin( obj, MATERIAL_TRIANGLES, 1 ) -- Begin writing to the static mesh\nfor i = 1, #verts do\n\tmesh.Position( verts[i].pos ) -- Set the position\n\tmesh.TexCoord( 0, verts[i].u, verts[i].v ) -- Set the texture UV coordinates\n\tmesh.AdvanceVertex() -- Write the vertex\nend\nmesh.End() -- Finish writing to the IMesh\n\nhook.Add( \"PostDrawOpaqueRenderables\", \"MeshLibTest\", function()\n\n\trender.SetMaterial( mat ) -- Apply the material\n\tobj:Draw() -- Draw the mesh\nend )"}],"realms":["Client"],"type":"Function"},
{"function":{"name":"BoneData","parent":"mesh","type":"libraryfunc","description":"Sets the bone matrix ID and bone weight to be used for the next vertex. See mesh.Begin.","realm":"Client","added":"2026.02.25","args":{"arg":[{"text":"The slot index for the vertex, either 0 or 1.","type":"number","name":"index"},{"text":"The matrix index for the vertex, in the range of 0 -> 52. This is the index into IMesh:DrawSkinned's ``bones`` argument, minus 1.","type":"number","name":"matrixId"},{"text":"How much influence that matrix will have on this vertex, in the range of 0 -> 1.","type":"number","name":"weight"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Color","parent":"mesh","type":"libraryfunc","description":"Sets the color to be used for the next vertex. This is `COLOR0` semantic of \nVertex Shader. See mesh.Begin.","realm":"Client","args":{"arg":[{"text":"Red component.","name":"r","type":"number"},{"text":"Green component.","name":"g","type":"number"},{"text":"Blue component.","name":"b","type":"number"},{"text":"Alpha component.","name":"a","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"End","parent":"mesh","type":"libraryfunc","description":"Ends the mesh (Started with mesh.Begin) and renders it.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Normal","parent":"mesh","type":"libraryfunc","description":"Sets the normal to be used for the next vertex. See mesh.Begin.","realm":"Client","args":[{"arg":{"text":"The normal of the vertex.","name":"normal","type":"Vector"}},{"name":"Direct numbers input","arg":[{"text":"The X part of the vertex normal.","name":"x","type":"number"},{"text":"The Y part of the vertex normal.","name":"y","type":"number"},{"text":"The Z part of the vertex normal.","name":"z","type":"number"}]}]},"realms":["Client"],"type":"Function"},
{"function":{"name":"Position","parent":"mesh","type":"libraryfunc","description":"Sets the position to be used for the next vertex. See mesh.Begin.","realm":"Client","args":[{"arg":{"text":"The position of the vertex.","name":"position","type":"Vector"}},{"name":"Direct numbers input","arg":[{"text":"The X position of the vertex.","name":"x","type":"number"},{"text":"The Y position of the vertex.","name":"y","type":"number"},{"text":"The Z position of the vertex.","name":"z","type":"number"}]}]},"realms":["Client"],"type":"Function"},
{"function":{"name":"Quad","parent":"mesh","type":"libraryfunc","description":"Adds a quad (4 vertices) to the currently built mesh. See mesh.Begin.","realm":"Client","args":{"arg":[{"text":"The first vertex.","name":"vertex1","type":"Vector"},{"text":"The second vertex.","name":"vertex2","type":"Vector"},{"text":"The third vertex.","name":"vertex3","type":"Vector"},{"text":"The fourth vertex.","name":"vertex4","type":"Vector"},{"text":"The Color for the vertices.","name":"color","type":"Color"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"QuadEasy","parent":"mesh","type":"libraryfunc","description":"Adds a quad (4 vertices) to the currently built mesh, by using position, normal and sizes. See mesh.Begin.\n\nSee also mesh.Quad.","realm":"Client","args":{"arg":[{"text":"The center of the quad.","name":"position","type":"Vector"},{"text":"The normal of the quad.","name":"normal","type":"Vector"},{"text":"X size in pixels.","name":"sizeX","type":"number"},{"text":"Y size in pixels.","name":"sizeY","type":"number"},{"text":"The Color for the vertices.","name":"color","type":"Color"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Specular","parent":"mesh","type":"libraryfunc","description":"Sets the specular map values. This is `COLOR1` semantic of Vertex Shader. Allows to blend textures of [Lightmapped_4WayBlend](https://developer.valvesoftware.com/wiki/Lightmapped_4WayBlend). Requires the `VERTEX_SPECULAR` flag to be set in the C++ code of a shader.","realm":"Client","args":{"arg":[{"text":"The red channel multiplier of the specular map.","name":"r","type":"number"},{"text":"The green channel multiplier of the specular map.","name":"g","type":"number"},{"text":"The blue channel multiplier of the specular map.","name":"b","type":"number"},{"text":"The alpha channel multiplier of the specular map.","name":"a","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"TangentS","parent":"mesh","type":"libraryfunc","description":"Sets the `S` tangent to be used, also known as \"binormal\".\n\nTangents and binormals are using in bumpmap rendering.\n\nSee also mesh.TangentT and mesh.Begin.","realm":"Client","args":[{"arg":{"text":"The S tangent.","name":"tangentS","type":"Vector"}},{"name":"Direct numbers input","arg":[{"text":"The X part of the vertex' tangent S.","name":"x","type":"number"},{"text":"The Y part of the vertex' tangent S.","name":"y","type":"number"},{"text":"The Z part of the vertex' tangent S.","name":"z","type":"number"}]}]},"realms":["Client"],"type":"Function"},
{"function":{"name":"TangentT","parent":"mesh","type":"libraryfunc","description":"Sets the `T` tangent to be used.\n\nTangents and binormals are using in bumpmap rendering.\n\nSee also mesh.TangentS and mesh.Begin.","realm":"Client","args":[{"arg":{"text":"The T tangent.","name":"tangentT","type":"Vector"}},{"name":"Direct numbers input","arg":[{"text":"The X part of the vertex' tangent T.","name":"x","type":"number"},{"text":"The Y part of the vertex' tangent T.","name":"y","type":"number"},{"text":"The Z part of the vertex' tangent T.","name":"z","type":"number"}]}]},"realms":["Client"],"type":"Function"},
{"function":{"name":"TexCoord","parent":"mesh","type":"libraryfunc","description":"Sets the texture coordinates for the next vertex for the current mesh. (See mesh.Begin)","realm":"Client","args":{"arg":[{"text":"The texture coordinate set, 0 to 7.\n\nNon-zero values require the currently bound material to support it. For example, any `LightmappedGeneric` material supports sets 1 and 2 (lightmap texture coordinates and bump map texture coords?).","name":"set","type":"number"},{"text":"S coordinate.","name":"s","type":"number"},{"text":"T coordinate. Will be optional in the next update.","name":"t","type":"number"},{"text":"U coordinate.","name":"u","type":"number","default":"nil","added":"2025.08.25"},{"text":"V coordinate.","name":"v","type":"number","default":"nil","added":"2025.08.25"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"UserData","parent":"mesh","type":"libraryfunc","description":"A set of four numbers that can be used for arbitrary purposes by Material shaders.  \n\t\tThis is most commonly used to provide tangent information about each vertex to the Material's shader.","realm":"Client","args":{"arg":[{"name":"tangentX","type":"number"},{"name":"tangentY","type":"number"},{"name":"tangentZ","type":"number"},{"name":"tangentHandedness","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"VertexCount","parent":"mesh","type":"libraryfunc","description":"Returns the amount of vertices that have been pushed via mesh.AdvanceVertex.","realm":"Client","rets":{"ret":{"text":"The amount of vertices.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"BuildSkeleton","parent":"motionsensor","type":"libraryfunc","description":{"text":"Called to build the skeleton. See Using The Kinect and Kinect developing.","internal":""},"realm":"Shared","file":{"text":"lua/includes/extensions/motionsensor.lua","line":"221-L260"},"args":{"arg":[{"text":"`list.Get( \"SkeletonConvertor\" )` and motionsensor.ChooseBuilderFromEntity.","name":"translator","type":"table"},{"text":"The player to get motion sensor positions from.","name":"player","type":"Player"},{"text":"Global rotation of the player?","name":"rotation","type":"Angle"}]},"rets":{"ret":[{"text":"Position","name":"","type":"Vector"},{"text":"Angles","name":"","type":"Angle"},{"text":"Sensor","name":"","type":"table"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ChooseBuilderFromEntity","parent":"motionsensor","type":"libraryfunc","description":"","realm":"Shared","file":{"text":"lua/includes/extensions/motionsensor.lua","line":"46-L58"},"args":{"arg":{"text":"Entity to choose builder for","name":"ent","type":"Entity"}},"rets":{"ret":{"text":"Chosen builder. The builders are stored in `list.Get( \"SkeletonConvertor\" )`","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetColourMaterial","parent":"motionsensor","type":"libraryfunc","description":"Returns the depth map material.","realm":"Client and Menu","rets":{"ret":{"text":"The material","name":"","type":"IMaterial"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSkeleton","parent":"motionsensor","type":"libraryfunc","description":"Returns players skeletal data if they are using Kinect. See Using The Kinect and Kinect developing.","realm":"Client","rets":{"ret":{"text":"The skeleton data.","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsActive","parent":"motionsensor","type":"libraryfunc","description":"Return whether a kinect is connected - and active (ie - Start has been called).","realm":"Client","rets":{"ret":{"text":"Connected and active or not","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsAvailable","parent":"motionsensor","type":"libraryfunc","description":"Returns true if we have detected that there's a kinect connected to the PC","realm":"Client and Menu","rets":{"ret":{"text":"Connected or not","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ProcessAngle","parent":"motionsensor","type":"libraryfunc","description":{"text":"Used internally by motionsensor.ProcessAnglesTable. See Using The Kinect and Kinect developing.","internal":""},"realm":"Shared","file":{"text":"lua/includes/extensions/motionsensor.lua","line":"60-L121"},"args":{"arg":[{"name":"translator","type":"table"},{"name":"sensor","type":"table"},{"name":"pos","type":"Vector"},{"name":"ang","type":"Angle"},{"name":"special_vectors","type":"table"},{"name":"boneid","type":"number"},{"name":"v","type":"table"}]},"rets":{"ret":{"text":"Return nil on failure","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ProcessAnglesTable","parent":"motionsensor","type":"libraryfunc","description":{"text":"Used internally by motionsensor.BuildSkeleton. See Using The Kinect and Kinect developing.","internal":""},"realm":"Shared","file":{"text":"lua/includes/extensions/motionsensor.lua","line":"126-L190"},"args":{"arg":[{"name":"translator","type":"table"},{"name":"sensor","type":"table"},{"name":"pos","type":"Vector"},{"name":"rotation","type":"Angle"}]},"rets":{"ret":{"text":"Ang. If `!translator.AnglesTable` then `return {}`","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ProcessPositionTable","parent":"motionsensor","type":"libraryfunc","description":{"text":"Used internally by motionsensor.BuildSkeleton. See Using The Kinect and Kinect developing.","internal":""},"realm":"Shared","file":{"text":"lua/includes/extensions/motionsensor.lua","line":"195-L216"},"args":{"arg":[{"name":"translator","type":"table"},{"name":"sensor","type":"table"}]},"rets":{"ret":{"text":"Positions. if `!translator.PositionTable` then return - `{}`","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Start","parent":"motionsensor","type":"libraryfunc","description":"This starts access to the kinect sensor. Note that this usually freezes the game for a couple of seconds.","realm":"Client and Menu","rets":{"ret":{"text":"`true` if the access has been started","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Stop","parent":"motionsensor","type":"libraryfunc","description":"Stops the motion capture.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddWalkableSeed","parent":"navmesh","type":"libraryfunc","description":"Add this position and normal to the list of walkable positions, used before map generation with navmesh.BeginGeneration","realm":"Server","args":{"arg":[{"text":"The terrain position.","name":"pos","type":"Vector"},{"text":"The normal of this terrain position.","name":"dir","type":"Vector"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"BeginGeneration","parent":"navmesh","type":"libraryfunc","description":{"text":"Starts the generation of a new navmesh.","note":"This process is highly resource intensive and it's not wise to use during normal gameplay"},"realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"ClearWalkableSeeds","parent":"navmesh","type":"libraryfunc","description":"Clears all the walkable positions, used before calling navmesh.BeginGeneration.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"CreateNavArea","parent":"navmesh","type":"libraryfunc","description":"Creates a new CNavArea.","realm":"Server","args":{"arg":[{"text":"The first corner of the new CNavArea","name":"corner","type":"Vector"},{"text":"The opposite (diagonally) corner of the new CNavArea","name":"opposite_corner","type":"Vector"}]},"rets":{"ret":{"text":"The new CNavArea or nil if we failed for some reason.","name":"","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"CreateNavLadder","parent":"navmesh","type":"libraryfunc","description":"Creates a new CNavLadder.","realm":"Server","added":"2023.09.16","args":{"arg":[{"text":"The top position of the ladder.","name":"top","type":"Vector"},{"text":"The bottom position of the ladder.","name":"bottom","type":"Vector"},{"text":"Width for the new ladder.","name":"width","type":"number"},{"text":"Directional vector in which way the ladder should be facing. Please note that ladders can only face in the 4 cardinal directions - NORTH, SOUTH, WEST, EAST.","name":"dir","type":"Vector"},{"text":"If above 0, will limit how much the top of the ladder can be adjusted to the closest CNavArea when automatically connecting the newly created ladder to pre-existing nav areas.","name":"maxHeightAboveTopArea","type":"number","default":"0"}]},"rets":{"ret":{"text":"The new CNavLadder or nil if we failed for some reason.","name":"","type":"CNavLadder"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Find","parent":"navmesh","type":"libraryfunc","description":"Returns a list of areas within distance, used to find hiding spots by NextBots for example.","realm":"Server","args":{"arg":[{"text":"The position to search around. This position will be used to find the closest area to search from.","name":"pos","type":"Vector"},{"text":"Radius to search within","name":"radius","type":"number"},{"text":"Maximum step up height allowed","name":"stepHeight","type":"number"},{"text":"Maximum step down (fall distance) allowed","name":"dropHeight","type":"number"}]},"rets":{"ret":{"text":"A list of found CNavAreas.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"FindInBox","parent":"navmesh","type":"libraryfunc","description":"Returns a list of CNavAreas overlapping the given cube extents.","realm":"Server","added":"2023.10.25","args":{"arg":[{"text":"The start position of the cube to search in.","name":"pos1","type":"Vector"},{"text":"The \"end\" position of the cube to search in. This is the opposite corner of the cube, diagonally.","name":"pos2","type":"Vector"}]},"rets":{"ret":{"text":"A list of found CNavAreas.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetAllNavAreas","parent":"navmesh","type":"libraryfunc","description":"Returns an integer indexed table of all CNavAreas on the current map. If the map doesn't have a navmesh generated then this will return an empty table.","realm":"Server","rets":{"ret":{"text":"A table of all the CNavAreas on the current map.","name":"","type":"table<CNavArea>"}}},"example":{"description":"Visualizes the entire navmesh and light intensities of each area via the debugoverlay library.","code":"if SERVER then\n\n\tlocal nav_visualize = CreateConVar( \"nav_visualize\", \"0\", 0, \"Visualize navmesh\" )\n\tlocal LastNavmeshViz = 0\n\thook.Add(\"Think\", \"navmesh_visualize\", function()\n\t\tif ( !nav_visualize:GetBool() ) then return end\n\n\t\tif ( CurTime() - LastNavmeshViz < 0.1 ) then return end\n\t\tlocal time = math.min( CurTime() - LastNavmeshViz + 0.02, 1 )\n\t\tLastNavmeshViz = CurTime()\n\n\t\tfor id, navArea in pairs( navmesh.GetAllNavAreas() ) do\n\t\t\tlocal color = Color( 255, 255, 255, 40 + (1-navArea:GetLightIntensity() )* 200 )\n\t\t\tcolor:SetBrightness( navArea:GetLightIntensity() )\n\n\t\t\tlocal ignoreDepth = nav_visualize:GetInt() > 1 && Entity(1):GetPos():Distance(navArea:GetCenter()) < 1000\n\n\t\t\t-- Raise the corners up a bit to avoid z fighting with the ground\n\t\t\tlocal corner1 = navArea:GetCorner( 0 ) + Vector( 0, 0, 1 )\n\t\t\tlocal corner2 = navArea:GetCorner( 1 ) + Vector( 0, 0, 1 )\n\t\t\tlocal corner3 = navArea:GetCorner( 2 ) + Vector( 0, 0, 1 )\n\t\t\tlocal corner4 = navArea:GetCorner( 3 ) + Vector( 0, 0, 1 )\n\t\t\tdebugoverlay.Triangle( corner3, corner2, corner1, time, color, ignoreDepth )\n\t\t\tdebugoverlay.Triangle( corner1, corner4, corner3, time, color, ignoreDepth )\n\t\tend\n\tend)\nend","output":{"upload":{"src":"70c/8dedb655ee8e294.png","size":"4234386","name":"image.png"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetBlockedAreas","parent":"navmesh","type":"libraryfunc","description":"Returns a table of all blocked CNavAreas on the current map. See CNavArea:MarkAsBlocked.","realm":"Server","added":"2023.10.05","rets":{"ret":{"text":"A table of all the blocked CNavAreas on the current map.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetEditCursorPosition","parent":"navmesh","type":"libraryfunc","description":"Returns the position of the edit cursor when nav_edit is set to 1.","realm":"Server","rets":{"ret":{"text":"The position of the edit cursor.","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetGroundHeight","parent":"navmesh","type":"libraryfunc","description":{"text":"Finds the closest standable ground at, above, or below the provided position.","note":"The ground must have at least 32 units of empty space above it to be considered by this function, unless 16 layers are tested without finding valid ground."},"realm":"Server","args":{"arg":{"text":"Position to find the closest ground for.","name":"pos","type":"Vector"}},"rets":{"ret":[{"text":"The height of the ground layer.","name":"","type":"number"},{"text":"The normal of the ground layer.","name":"","type":"Vector"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetMarkedArea","parent":"navmesh","type":"libraryfunc","description":"Returns the currently marked CNavArea, for use with editing console commands.","realm":"Server","rets":{"ret":{"text":"The currently marked CNavArea.","name":"","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetMarkedLadder","parent":"navmesh","type":"libraryfunc","description":"Returns the currently marked CNavLadder, for use with editing console commands.","realm":"Server","rets":{"ret":{"text":"The currently marked CNavLadder.","name":"","type":"CNavLadder"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetNavArea","parent":"navmesh","type":"libraryfunc","description":"Returns the Nav Area contained in this position that also satisfies the elevation limit.\n\nThis function will properly see blocked CNavAreas. See navmesh.GetNearestNavArea.","realm":"Server","args":{"arg":[{"text":"The position to search for.","name":"pos","type":"Vector"},{"text":"The elevation limit at which the Nav Area will be searched.","name":"beneathLimit","type":"number"}]},"rets":{"ret":{"text":"The nav area.","name":"","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetNavAreaByID","parent":"navmesh","type":"libraryfunc","description":{"text":"Returns a CNavArea by the given ID.","note":"Avoid calling this function every frame, as internally it does a lookup trough all the CNavAreas, call this once and store the result"},"realm":"Server","args":{"arg":{"text":"ID of the CNavArea to get. Starts with 1.","name":"id","type":"number"}},"rets":{"ret":{"text":"The CNavArea with given ID.","name":"","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetNavAreaCount","parent":"navmesh","type":"libraryfunc","description":"Returns the total count of nav areas on the map. If you want to get all nav areas, use navmesh.GetAllNavAreas instead as nav areas IDs are not always sequential.","realm":"Server","rets":{"ret":{"text":"The total count of nav areas on the map.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetNavLadderByID","parent":"navmesh","type":"libraryfunc","description":"Returns a CNavLadder by the given ID.","realm":"Server","args":{"arg":{"text":"ID of the CNavLadder to get. Starts with 1.","name":"id","type":"number"}},"rets":{"ret":{"text":"The CNavLadder with given ID.","name":"","type":"CNavLadder"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetNearestNavArea","parent":"navmesh","type":"libraryfunc","description":"Returns the closest CNavArea to given position at the same height, or beneath it.\n\nThis function will ignore blocked CNavAreas. See navmesh.GetNavArea for a function that does see blocked areas.","realm":"Server","args":{"arg":[{"text":"The position to look from","name":"pos","type":"Vector"},{"text":"This argument is ignored and has no effect","name":"anyZ","type":"boolean","default":"false"},{"text":"This is the maximum distance from the given position that the function will look for a CNavArea","name":"maxDist","type":"number","default":"10000"},{"text":"If this is set to true then the function will internally do a util.TraceLine from the starting position to each potential CNavArea with a [MASK_NPCSOLID_BRUSHONLY](https://wiki.facepunch.com/gmod/Enums/MASK). If the trace fails then the CNavArea is ignored.\n\nIf this is set to false then the function will find the closest CNavArea through anything, including the world.","name":"checkLOS","type":"boolean","default":"false"},{"text":"If checkGround is true then this function will internally call navmesh.GetNavArea to check if there is a CNavArea directly below the position, and return it if so, before checking anywhere else.","name":"checkGround","type":"boolean","default":"true"},{"text":"This will internally call CNavArea:IsBlocked to check if the target CNavArea is not to be navigated by the given team. Currently this appears to do nothing.","name":"team","type":"number","default":"TEAM_ANY=-2"}]},"rets":{"ret":{"text":"The closest CNavArea found with the given parameters, or a NULL CNavArea if one was not found.","name":"","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetPlayerSpawnName","parent":"navmesh","type":"libraryfunc","description":"Returns the classname of the player spawn entity.","realm":"Server","rets":{"ret":{"text":"The classname of the spawn point entity. By default returns \"info_player_start\"","name":"","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsGenerating","parent":"navmesh","type":"libraryfunc","description":"Whether we're currently generating a new navmesh with navmesh.BeginGeneration.","realm":"Server","rets":{"ret":{"text":"Whether we're generating a nav mesh or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsLoaded","parent":"navmesh","type":"libraryfunc","description":"Returns true if a navmesh has been loaded when loading the map.","realm":"Server","rets":{"ret":{"text":"Whether a navmesh has been loaded when loading the map.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Load","parent":"navmesh","type":"libraryfunc","description":{"text":"Loads a new navmesh from the .nav file for current map discarding any changes made to the navmesh previously.","warning":"Calling this function too soon, causes the Server to crash!"},"realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"Reset","parent":"navmesh","type":"libraryfunc","description":"Deletes every CNavArea and CNavLadder on the map **without saving the changes**.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"Save","parent":"navmesh","type":"libraryfunc","description":"Saves any changes made to navmesh to the .nav file.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetMarkedArea","parent":"navmesh","type":"libraryfunc","description":"Sets the CNavArea as marked, so it can be used with editing console commands.","realm":"Server","args":{"arg":{"text":"The CNavArea to set as the marked area.","name":"area","type":"CNavArea"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetMarkedLadder","parent":"navmesh","type":"libraryfunc","description":"Sets the CNavLadder as marked, so it can be used with editing console commands.","realm":"Server","args":{"arg":{"text":"The CNavLadder to set as the marked ladder.","name":"area","type":"CNavLadder"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetPlayerSpawnName","parent":"navmesh","type":"libraryfunc","description":"Sets the classname of the default spawn point entity, used before generating a new navmesh with navmesh.BeginGeneration.","realm":"Server","args":{"arg":{"text":"The classname of what the player uses to spawn, automatically adds it to the walkable positions during map generation.","name":"spawnPointClass","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ReadVars","parent":"net","type":"libraryfield","description":{"text":"A list of types that can be sent over the network via net.ReadType.","internal":""},"realm":"Shared","rets":{"ret":{"text":"Key = type ID (Global.TypeID), Value = function to send the data over the net.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Receivers","parent":"net","type":"libraryfield","description":{"text":"This is NOT a function, it's a table used internally by the net library to store net receivers added with net.Receive.\n\nThe key is the lowercase net message name and the value is the message's callback function.","internal":"","note":"Modifying net.Receivers won't affect the net string pool used in util.AddNetworkString."},"realm":"Shared","rets":{"ret":{"text":"The list of all registered net receivers.","name":"","type":"table"}}},"example":{"description":"Disables a net message by removing its function in net.Receivers.","code":"function net.Remove( name )\n\tnet.Receivers[ name ] = nil\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteVars","parent":"net","type":"libraryfield","description":{"text":"A list of types that can be sent over the network via net.WriteType.","internal":""},"realm":"Shared","rets":{"ret":{"text":"Key = type ID (Global.TypeID), Value = function to send the data over the net.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Abort","parent":"net","type":"libraryfunc","description":"Cancels a net message started by net.Start, so you can immediately start a new one without any errors.","realm":"Shared","added":"2023.12.11"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Broadcast","parent":"net","type":"libraryfunc","description":"Sends the currently built net message (see net.Start) to all connected players.\nMore information can be found in Net Library Usage.","realm":"Server"},"example":{"description":"Sends a packet to all players.","code":"net.Start( \"MyNetworkString\" )\n    net.WriteString( \"some text\" )\nnet.Broadcast()"},"realms":["Server"],"type":"Function"},
{"function":{"name":"BytesLeft","parent":"net","type":"libraryfunc","description":{"text":"Returns the amount of data left to read in the current message. Does nothing when sending data.","note":"This will include 6 extra bits (or 1 byte rounded-up) used by the engine internally."},"realm":"Shared","rets":{"ret":[{"text":"The amount of data left to read in the current net message in **bytes**.\nReturns `nil` if no net message has been started.","name":"","type":"number"},{"text":"The amount of data left to read in the current net message in **bits**.\nReturns `nil` if no net message has been started.","name":"","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"BytesWritten","parent":"net","type":"libraryfunc","description":{"text":"Returns the size of the current message.","note":"This will include 3 extra bytes (24 bits) used by the engine internally to send the data over the network."},"realm":"Shared","rets":{"ret":[{"text":"The amount of **bytes** written to the current net message.\nReturns `nil` if no net message has been started.","name":"","type":"number"},{"text":"The amount of **bits** written to the current net message.\nReturns `nil` if no net message has been started.","name":"","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Incoming","parent":"net","type":"libraryfunc","description":{"text":"Function called by the engine to tell the Lua state a message arrived.","internal":"You may be looking for net.Receive."},"realm":"Shared","file":{"text":"lua/includes/extensions/net.lua","line":"23-L40"},"args":{"arg":[{"text":"The message length, in **bits**.","name":"length","type":"number"},{"text":"The player that sent the message. This will be `nil` in the client state.","name":"client","type":"Player"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadAngle","parent":"net","type":"libraryfunc","description":{"text":"Reads an angle from the received net message.","warning":"You **must** read information in same order as you write it."},"realm":"Shared","rets":{"ret":{"text":"The read angle, or `Angle( 0, 0, 0 )` if no angle could be read","name":"","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadBit","parent":"net","type":"libraryfunc","description":{"text":"Reads a bit from the received net message.","warning":"You **must** read information in same order as you write it."},"realm":"Shared","rets":{"ret":{"text":"`0` or `1`, or `0` if the bit could not be read.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadBool","parent":"net","type":"libraryfunc","description":{"text":"Reads a boolean from the received net message.","warning":"You **must** read information in same order as you write it."},"realm":"Shared","file":{"text":"lua/includes/extensions/net.lua","line":"47-L51"},"rets":{"ret":{"text":"`true` or `false`, or `false` if the bool could not be read.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadColor","parent":"net","type":"libraryfunc","description":{"text":"Reads a Color from the current net message.","warning":"You **must** read information in same order as you write it."},"realm":"Shared","file":{"text":"lua/includes/extensions/net.lua","line":"118-L131"},"args":{"arg":{"text":"If the color has alpha written or not. **Must match what was given to net.WriteColor.**","name":"hasAlpha","type":"boolean","default":"true"}},"rets":{"ret":{"text":"The Color read from the current net message, or `Color( 0, 0, 0, 0 )` if the color could not be read.","name":"","type":"Color"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadData","parent":"net","type":"libraryfunc","description":{"text":"Reads pure binary data from the message.","warning":"You **must** read information in same order as you write it."},"realm":"Shared","args":{"arg":{"text":"The length of the data to be read, in **bytes**.","name":"length","type":"number"}},"rets":{"ret":{"text":"The binary data read, or a string containing one character with a byte of `0` if no data could be read.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadDouble","parent":"net","type":"libraryfunc","description":{"text":"Reads a double-precision number from the received net message.","warning":"You **must** read information in same order as you write it."},"realm":"Shared","rets":{"ret":{"text":"The double-precision number, or `0` if no number could be read.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadEntity","parent":"net","type":"libraryfunc","description":{"text":"Reads an entity from the received net message. You should always check if the specified entity exists as it may have been removed and therefore `NULL` if it is outside of the players [PVS (Potential Visibility Set)](https://developer.valvesoftware.com/wiki/PVS \"PVS - Valve Developer Community\") or was already removed.","warning":"You **must** read information in same order as you write it."},"realm":"Shared","file":{"text":"lua/includes/extensions/net.lua","line":"66-L73"},"rets":{"ret":{"text":"The entity, or `nil` if no entity could be read.","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadFloat","parent":"net","type":"libraryfunc","description":{"text":"Reads a floating point number from the received net message.","warning":"You **must** read information in same order as you write it."},"realm":"Shared","rets":{"ret":{"text":"The floating point number, or `0` if no number could be read.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadHeader","parent":"net","type":"libraryfunc","description":{"text":"Reads a word, basically unsigned short. This is used internally to read the \"header\" of the message which is an unsigned short which can be converted to the corresponding message name via util.NetworkIDToString.","internal":""},"realm":"Shared","rets":{"ret":{"text":"The header number","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadInt","parent":"net","type":"libraryfunc","description":{"text":"Reads an integer from the received net message.","warning":"You **must** read information in same order as you write it."},"realm":"Shared","args":{"arg":{"text":"The amount of bits to be read.\n\nThis must be set to what you set to net.WriteInt. Read more information at net.WriteInt.","name":"bitCount","type":"number"}},"rets":{"ret":{"text":"The read integer number, or `0` if no integer could be read.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadMatrix","parent":"net","type":"libraryfunc","description":{"text":"Reads a VMatrix from the received net message.","warning":"You **must** read information in same order as you write it."},"realm":"Shared","rets":{"ret":{"text":"The matrix, or an empty matrix if no matrix could be read.","name":"","type":"VMatrix"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadNormal","parent":"net","type":"libraryfunc","description":{"text":"Reads a normal vector from the net message.","warning":"You **must** read information in same order as you write it."},"realm":"Shared","rets":{"ret":{"text":"The normalized vector ( length = `1` ), or `Vector( 0, 0, 1 )` if no normal could be read.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadPlayer","parent":"net","type":"libraryfunc","description":{"text":"Reads a player entity that was written with net.WritePlayer from the received net message.\n\nYou should always check if the specified entity exists as it may have been removed and therefore `NULL` if it is outside of the local players [PVS](https://developer.valvesoftware.com/wiki/PVS) or was already removed.","warning":"You **must** read information in same order as you write it."},"realm":"Shared","file":{"text":"lua/includes/extensions/net.lua","line":"89-L97"},"added":"2023.10.06","rets":{"ret":{"text":"The player, or `Entity(0)` if no entity could be read.","name":"","type":"Player"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadString","parent":"net","type":"libraryfunc","description":{"text":"Reads a [null-terminated string](https://en.wikipedia.org/wiki/Null-terminated_string) from the net stream. The size of the string is 8 bits plus 8 bits for every ASCII character in the string.","warning":"You **must** read information in same order as you write it."},"realm":"Shared","rets":{"ret":{"text":"The read string, or a string with `0` length if no string could be read.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadTable","parent":"net","type":"libraryfunc","description":{"text":"Reads a table from the received net message.\n\nSee net.WriteTable for extra info.","note":"Sometimes when sending a table through the net library, the order of the keys may be switched. So be cautious when comparing (See example 1).\n\nYou may get `net.ReadType: Couldn't read type X` during the execution of the function, the problem is that you are sending objects that **cannot** be serialized/sent over the network.","warning":"You **must** read information in same order as you write it."},"realm":"Shared","file":{"text":"lua/includes/extensions/net.lua","line":"156-L183"},"args":{"arg":{"text":"Set to `true` if the input table is sequential. This saves on bandwidth.","name":"sequential","type":"boolean","default":"false","added":"2023.09.06"}},"rets":{"ret":{"text":"Table received via the net message, or a blank table if no table could be read.","name":"","type":"table"}}},"example":{"description":"This is an example of how the keys order may be switched:","code":"if ( CLIENT ) then\n\tlocal tbl = {\n\t\tType = \"Dining\",\n\t\tLegs = \"4\",\n\t\tMaterial = \"Wood\"\n\t}\n\n\tnet.Start( \"TableSend\" )\n\t\tnet.WriteTable( tbl )\n\tnet.SendToServer()\n\n\n\tPrintTable( tbl ) -- Prints the order client-side.\nend\n\nif ( SERVER ) then\n\tnet.Receive( \"TableSend\", function( len, ply )\n\t     PrintTable( net.ReadTable() ) -- Prints the order server-side.\n\tend )\nend","output":"Client:\n```\nType     = \"Dining\"\nLegs     = 4\nMaterial = \"Wood\"\n```\n\nServer:\n```\nLegs     = 4\nMaterial = \"Wood\"\nType     = \"Dining\"\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadType","parent":"net","type":"libraryfunc","description":{"text":"Reads a value from the net message with the specified type, written by net.WriteType.","internal":"Used internally by net.ReadTable.","warning":"You **must** read information in same order as you write it."},"realm":"Shared","file":{"text":"lua/includes/extensions/net.lua","line":"229-L238"},"args":{"arg":{"text":"The type of value to be read, using Enums/TYPE.","name":"typeID","type":"number","default":"net.ReadUInt(8)"}},"rets":{"ret":{"text":"The value, or the respective blank value based on the type you're reading if the value could not be read.","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadUInt","parent":"net","type":"libraryfunc","description":{"text":"Reads an unsigned integer with the specified number of bits from the received net message.","warning":"You **must** read information in same order as you write it."},"realm":"Shared","args":{"arg":{"text":"The size of the integer to be read, in bits.\n\nThis must be set to what you set to net.WriteUInt. Read more information at net.WriteUInt.","name":"bitCount","type":"number"}},"rets":{"ret":{"text":"The unsigned integer read, or `0` if the integer could not be read.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadUInt64","parent":"net","type":"libraryfunc","description":{"text":"Reads a unsigned integer with 64 bits from the received net message.","warning":"You **must** read information in same order as you write it."},"realm":"Shared","added":"2023.08.30","rets":{"ret":{"text":"The uint64 number.","name":"","type":"string","note":"Since Lua cannot store full 64-bit integers, this function returns a string. It is mainly aimed at usage with Player:SteamID64."}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadVector","parent":"net","type":"libraryfunc","description":{"text":"Reads a vector from the received net message. Vectors sent by this function are **compressed**, which may result in precision loss. See net.WriteVector for more information.","warning":"You **must** read information in same order as you write it."},"realm":"Shared","rets":{"ret":{"text":"The read vector, or `Vector( 0, 0, 0 )` if no vector could be read.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Receive","parent":"net","type":"libraryfunc","description":{"text":"Adds a net message handler. Only one receiver can be used to receive the net message.\n\nYou can use the `net.Read*` functions within the message handler callback.","warning":"You **should** put this function **outside** of any other function or hook for it to work properly unless you know what you are doing!\n\nYou **must** read information in the same order as you write it.\n\nEach net message has a length limit of **64KB**!"},"realm":"Shared","file":{"text":"lua/includes/extensions/net.lua","line":"14-L18"},"args":{"arg":[{"text":"The message name to hook to.","name":"messageName","type":"string","note":"The message-name is converted to lower-case so the message-names \"`BigBlue`\" and \"`bigblue`\" would be equal."},{"text":"The function to be called if the specified message was received.","name":"callback","type":"function","callback":{"arg":[{"text":"Length of the message, in bits.","type":"number","name":"len"},{"text":"The player that sent the message, works **only** server-side.","type":"Player","name":"ply"}]}}]}},"example":[{"description":"An example with receiving message clientside, when sent from the server.","code":"if ( SERVER ) then\n\tutil.AddNetworkString( \"message_to_clients\" )\n\n\tconcommand.Add( \"send_message\", function( ply, cmd, args )\n\t\tnet.Start( \"message_to_clients\" )\n\t\tnet.WriteString( args[ 1 ] or \"my very cool message, yeah!\" )\n\t\tnet.WriteUInt( 1337, 16 )\n\t\tnet.Broadcast()\n\tend )\nelse\n\tnet.Receive( \"message_to_clients\", function( len, ply )\n\t\tprint( \"Message from server received. Its length is \" .. len .. \".\" )\n\n\t\t-- We read in the same order as we written\n\t\tlocal message = net.ReadString()\n\t\tlocal myCoolNumber = net.ReadUInt( 16 )\n\t\tprint( \"The message was: \", message )\n\t\tprint( \"The cool number was: \", myCoolNumber )\n\tend )\nend","output":"```\n] send_message test\nMessage from server received. Its length is 56.\nThe message was: \ttest\nThe cool number was: \t1337\n```"},{"description":"An example with receiving message serverside, when sent from a client.","code":"if ( SERVER ) then\n\tutil.AddNetworkString( \"message_to_server\" )\n\n\tnet.Receive( \"message_to_server\", function( len, ply )\n\t\tprint( \"Message from \" .. ply:Nick() .. \" received. Its length is \" .. len .. \".\" )\n\n\t\t-- We read in the same order as we written\n\t\tlocal message = net.ReadString()\n\t\tlocal myCoolNumber = net.ReadUInt( 16 )\n\t\tprint( \"The message was: \", message )\n\t\tprint( \"The cool number was: \", myCoolNumber )\n\tend )\nelse\n\tconcommand.Add( \"send_message_to_server\", function( ply, cmd, args )\n\t\tnet.Start( \"message_to_server\" )\n\t\tnet.WriteString( args[ 1 ] or \"my very cool message, yeah!\" )\n\t\tnet.WriteUInt( 1337, 16 )\n\t\tnet.SendToServer()\n\tend )\nend","output":"```\n] send_message_to_server test\nMessage from Rubat received. Its length is 56.\nThe message was: \ttest\nThe cool number was: \t1337\n```"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Send","parent":"net","type":"libraryfunc","description":"Sends the current net message to the specified player(s)","realm":"Server","args":[{"name":"Send to Single Player","arg":{"text":"The player to send the message to.","name":"ply","type":"Player"}},{"name":"Send to Multiple Players","arg":{"text":"A table of players to send the message to.","name":"plys","type":"table<Player>"}},{"name":"Send using Filter","arg":{"text":"A recipient filter specifying message targets.","name":"filter","type":"CRecipientFilter"}}]},"realms":["Server"],"type":"Function"},
{"function":{"name":"SendOmit","parent":"net","type":"libraryfunc","description":"Sends the current message (see net.Start) to all except the player or players specified.","realm":"Server","args":[{"name":"Ommit Single Player","arg":{"text":"The player to **NOT** send the message to.","name":"ply","type":"Player"}},{"name":"Ommit Multiple Players","arg":{"text":"A table of players to **NOT** send the message to.","name":"plys","type":"table<Player>"}}]},"realms":["Server"],"type":"Function"},
{"function":{"name":"SendPAS","parent":"net","type":"libraryfunc","description":"Sends current net message (see net.Start) to all players that are in the same [Potentially Audible Set (PAS)](https://developer.valvesoftware.com/wiki/PAS) as the position, or simply said, it adds all players that can potentially hear sounds from this position.","realm":"Server","args":{"arg":{"text":"PAS position.","name":"position","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SendPVS","parent":"net","type":"libraryfunc","description":"Sends current net message (see net.Start) to all players in the [PVS (Potential Visibility Set)](https://developer.valvesoftware.com/wiki/PVS \"PVS - Valve Developer Community\") of the position, or, more simply said, sends the message to players that can potentially see this position.","realm":"Server","args":{"arg":{"text":"Position that must be in players' visibility set.","name":"position","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SendToServer","parent":"net","type":"libraryfunc","description":{"text":"Sends the current net message (see net.Start) to the server. The player object must exist on the server for the net message to be received successfully by the server.","warning":"Each net message has a length limit of 65,533 bytes (approximately 64 KiB) and your net message will error and fail to send if it is larger than this.\n\nThe message name must be pooled with util.AddNetworkString beforehand!"},"realm":"Client"},"example":{"description":"Sends a simple `hello_world` message with the string `Hi` to the server as soon as possible after joining the game.","code":"if ( SERVER ) then\n\tutil.AddNetworkString( \"hello_world\" )\n\tnet.Receive( \"hello_world\", function( len, ply )\n\t\tprint( len, ply, net.ReadString() )\n\tend )\nelse\n\n\thook.Add(\"OnEntityCreated\", \"SendMessageToServer\", function(ent)\n\t\tif ( ent != LocalPlayer() ) then return end\n\t\tnet.Start( \"hello_world\" )\n\t\t\tnet.WriteString( \"Hi\" )\n\t\tnet.SendToServer()\n\t\thook.Remove( \"OnEntityCreated\", \"SendMessageToServer\" )\n\tend)\n\nend","output":"The network message `hello_world` is sent to the server. The server can handle this with net.Receive.\n\nRemember that **any** client has the potential to send any net message at any time. **Don't trust the client-side!** On your server-side net.Receive, make sure to verify the message sender's permissions whenever you can and prevent expensive functions from being run too often."},"realms":["Client"],"type":"Function"},
{"function":{"name":"Start","parent":"net","type":"libraryfunc","description":{"text":"Begins a new net message. If another net message is already started and hasn't been sent yet, it will be discarded.\n\nAfter calling this function, you will want to call `net.Write` functions to write your data, if any, and then finish with a call to one of the following functions:\n* net.Send\n* net.SendOmit\n* net.SendPAS\n* net.SendPVS\n* net.Broadcast\n* net.SendToServer","warning":"Each net message has a length limit of 65,533 bytes (approximately 64 KiB) and your net message will error and fail to send if it is larger than this.\n\nThe net library has an internal buffer that sent messages are added to that is capable of holding roughly 256 kb at a time. Trying to send more will lead to the client being kicked because of a buffer overflow. More information on net library limits can be found here.\n\nThe message name must be pooled with util.AddNetworkString beforehand!\n\nNet messages will not reliably reach the client until the client's GM:InitPostEntity hook is called."},"realm":"Shared","args":{"arg":[{"text":"The name of the message to send","name":"messageName","type":"string"},{"text":"If set to `true`, the message is not guaranteed to reach its destination","name":"unreliable","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"`true` if the message has been started.","name":"","type":"boolean"}}},"example":{"description":"Adds a console command that sends a message to all clients.","code":"if ( SERVER ) then\n\n\tutil.AddNetworkString( \"my_message\" )\n\tconcommand.Add( \"send_msg\", function( ply, cmd, args, str )\n\t\tif ( str == \"\" ) then str = \"No message given\" end\n\n\t\tnet.Start( \"my_message\" )\n\t\t\tnet.WriteString( str )\n\t\t\tnet.WriteColor( ply:GetColor(), false )\n\t\tnet.Broadcast()\n\tend )\n\nelse\n\n\tnet.Receive( \"my_message\", function( len, ply )\n\n\t\t-- Important: reading in the same order as we write!\n\t\tlocal message = net.ReadString()\n\t\tlocal color = net.ReadColor( false )\n\n\t\tprint( \"Message from server received.\" )\n\t\tMsgC( color, message )\n\n\tend )\n\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteAngle","parent":"net","type":"libraryfunc","description":"Writes an angle to the current net message.","realm":"Shared","args":{"arg":{"text":"The angle to be sent.","name":"angle","type":"Angle"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteBit","parent":"net","type":"libraryfunc","description":"Appends a boolean (as `1` or `0`) to the current net message.\n\nPlease note that the bit is written here from a boolean (`true/false`) but net.ReadBit returns a number.","realm":"Shared","args":{"arg":{"text":"Bit status (false = `0`, true = `1`).","name":"boolean","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteBool","parent":"net","type":"libraryfunc","description":"Appends a boolean to the current net message. Alias of net.WriteBit.","realm":"Shared","file":{"text":"lua/includes/extensions/net.lua","line":"41-L41"},"args":{"arg":{"text":"Boolean value to write.","name":"boolean","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteColor","parent":"net","type":"libraryfunc","description":"Appends a Color to the current net message.","realm":"Shared","file":{"text":"lua/includes/extensions/net.lua","line":"103-L116"},"args":{"arg":[{"text":"The Color you want to append to the net message.","name":"Color","type":"Color"},{"text":"If we should write the alpha of the color or not.","name":"writeAlpha","type":"boolean","default":"true"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteData","parent":"net","type":"libraryfunc","description":"Writes a chunk of binary data to the message.","realm":"Shared","args":{"arg":[{"text":"The binary data to be sent.","name":"binaryData","type":"string"},{"text":"The length of the binary data to be sent, in bytes.","name":"length","type":"number","default":"#binaryData"}]}},"example":{"description":{"text":"Sends a message to the server without using WriteString.","note":"You don't need to use net.WriteUInt if you **only use this function once** in the net message.  \n\t\t\tYou can get the bytes amount by dividing the message length by 8. **Like this:**\n\t\t\t```lua\n\t\t\t\tlocal compressed_message = net.ReadData( len / 8 ) -- Converts the length from Bits to Bytes.\n\t\t\t```"},"code":"if ( CLIENT ) then\n\tlocal message = \"This is a cool message\"\n\tlocal compressed_message = util.Compress( message )\n\tlocal bytes_amount = #compressed_message\n\n\tconcommand.Add( \"send_message_data\", function( ply, cmd, args )\n\t\tnet.Start( \"SendMessage\" )\n\t\t\tnet.WriteUInt( bytes_amount, 16 ) -- Writes the amount of bytes we have. Needed to read the data\n\t\t\tnet.WriteData( compressed_message, bytes_amount ) -- Writes the datas\n\t\tnet.SendToServer()\n\tend )\nend\n\nif ( SERVER ) then\n\tutil.AddNetworkString( \"SendMessage\" )\n\n\tnet.Receive( \"SendMessage\", function( len, ply )\n\t\tlocal bytes_amount = net.ReadUInt( 16 ) -- Gets back the amount of bytes our data has\n\t\tlocal compressed_message = net.ReadData( bytes_amount ) -- Gets back our compressed message\n\t\tlocal message = util.Decompress( compressed_message ) -- Decompresses our message\n\n\t\tprint( message )\n\tend)\nend","output":"```\nThis is a cool message\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteDouble","parent":"net","type":"libraryfunc","description":"Appends a double-precision number to the current net message.","realm":"Shared","args":{"arg":{"text":"The double to be sent","name":"double","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteEntity","parent":"net","type":"libraryfunc","description":"Appends an entity to the current net message using its Entity:EntIndex.\n\nSee net.ReadEntity for the function to read the entity.","realm":"Shared","file":{"text":"lua/includes/extensions/net.lua","line":"56-L64"},"args":{"arg":{"text":"The entity to be sent.","name":"entity","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteFloat","parent":"net","type":"libraryfunc","description":"Appends a float (number with decimals) to the current net message.","realm":"Shared","args":{"arg":{"text":"The float to be sent.","name":"float","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteInt","parent":"net","type":"libraryfunc","description":"Appends a signed integer - a whole number, positive/negative - to the current net message. Can be read back with net.ReadInt on the receiving end.\n\nUse net.WriteUInt to send an unsigned number (that you know will **never** be negative). Use net.WriteFloat for a non-whole number (e.g. `2.25`).","realm":"Shared","args":{"arg":[{"text":"The integer to be sent.","name":"integer","type":"number"},{"text":"The amount of bits the number consists of. This must be **32** or less.\n\nIf you are unsure what to set, just set it to `32`.\n\nConsult the table below to determine the bit count you need:\n\n| Bit Count |  Minimum value |  Maximum value |\n|-----------|:--------------:|:--------------:|\n| 3 | -4 | 3 |\n| 4 | -8 | 7 |\n| 5 | -16 | 15 |\n| 6 | -32 | 31 |\n| 7 | -64 | 63 |\n| 8 | -128 | 127 |\n| 9 | -256 | 255 |\n| 10 | -512 | 511 |\n| 11 | -1,024 | 1,023 |\n| 12 | -2,048 | 2,047 |\n| 13 | -4,096 | 4,095 |\n| 14 | -8,192 | 8,191 |\n| 15 | -16,384 | 16,383 |\n| 16 | -32,768 | 32,767 |\n| 17 | -65,536 | 65,535 |\n| 18 | -131,072 | 131,071 |\n| 19 | -262,144 | 262,143 |\n| 20 | -524,288 | 524,287 |\n| 21 | -1,048,576 | 1,048,575 |\n| 22 | -2,097,152 | 2,097,151 |\n| 23 | -4,194,304 | 4,194,303 |\n| 24 | -8,388,608 | 8,388,607 |\n| 25 | -16,777,216 | 16,777,215 |\n| 26 | -33,554,432 | 33,554,431 |\n| 27 | -67,108,864 | 67,108,863 |\n| 28 | -134,217,728 | 134,217,727 |\n| 29 | -268,435,456 | 268,435,455 |\n| 30 | -536,870,912 | 536,870,911 |\n| 31 | -1,073,741,824 | 1,073,741,823 |\n| 32 | -2,147,483,648 | 2,147,483,647 |","name":"bitCount","type":"number"}]}},"example":{"description":"Sends the server the client's age.","code":"-- Client\nnet.Start( \"SendAge\" )\n\tnet.WriteInt( 3, 3 ) -- Only 2 bits are needed to store the number \"3\", but we add one because of the rule.\nnet.SendToServer()\n\n-- Server\nutil.AddNetworkString( \"SendAge\" )\n\nnet.Receive( \"SendAge\", function( len, ply )\n     local age = net.ReadInt( 3 ) -- use the same number of bits that were written.\n\n     print(\"Player \" .. ply:Nick() .. \" is \" .. age .. \" years old.\")\nend )","output":{"text":"Player `","name":"` is 3 years old."}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteMatrix","parent":"net","type":"libraryfunc","description":"Writes a VMatrix to the current net message.","realm":"Shared","args":{"arg":{"text":"The matrix to be sent.","name":"matrix","type":"VMatrix"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteNormal","parent":"net","type":"libraryfunc","description":"Writes a normalized/direction vector ( Vector with length of 1 ) to the net message.\n\nThis function uses less bandwidth compared to net.WriteVector and will not send vectors with length of > 1 properly.","realm":"Shared","args":{"arg":{"text":"The normalized/direction vector to be send.","name":"normal","type":"Vector"}}},"example":{"description":"Showcases the difference between this function and net.WriteVector.","code":"if ( SERVER ) then\n\tutil.AddNetworkString( \"test1\" )\n\tutil.AddNetworkString( \"test2\" )\n\t\n\ttimer.Simple( 1, function()\n\t\tnet.Start( \"test1\" )\n\t\t\tnet.WriteVector( Vector( 1.23456789, 2.3456789, 3.456789 ) )\n\t\tnet.Broadcast()\n\t\n\t\tnet.Start( \"test2\" )\n\t\t\tnet.WriteNormal( Vector( 1.23456789, 2.3456789, 3.456789 ) )\n\t\tnet.Broadcast()\n\n\t\tnet.Start( \"test2\" )\n\t\t\tnet.WriteNormal( Vector( 1.23456789, 2.3456789, 3.456789 ):GetNormalized() )\n\t\tnet.Broadcast()\n\t\n\t\tnet.Start( \"test2\" )\n\t\t\tnet.WriteNormal( Vector( 0.5, -0.5, 0.23 ) )\n\t\tnet.Broadcast()\n\tend )\nelse\n\tnet.Receive( \"test1\", function( ... )\n\t\tprint( ... ) \n\t\tprint( net.ReadVector() ) \n\tend )\n\t\n\tnet.Receive( \"test2\", function( ... )\n\t\tprint( ... ) \n\t\tprint( net.ReadNormal() ) \n\tend )\nend","output":"```\n69\tnil\n1.218750 2.343750 3.437500\n27\tnil\n1.000000 1.000000 0.000000\n27\tnil\n0.283341 0.538349 0.793661\n27\tnil\n0.499756 -0.499756 0.707452\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WritePlayer","parent":"net","type":"libraryfunc","description":"Appends a player entity to the current net message using its Entity:EntIndex. This saves a small amount of network bandwidth over net.WriteEntity.\n\nSee net.ReadPlayer for the function to read the entity.","realm":"Shared","file":{"text":"lua/includes/extensions/net.lua","line":"76-L87"},"added":"2023.10.06","args":{"arg":{"text":"The player to be sent.","name":"ply","type":"Player"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteString","parent":"net","type":"libraryfunc","description":"Appends a string to the current net message. The size of the written data is 8 bits for every ASCII character in the string + 8 bits for the null terminator.\n\nThe maximum allowed length of a single written string is **65532 characters**. (aka the limit of the net message itself)","realm":"Shared","args":{"arg":{"text":"The string to be sent.\n\nThe input will be terminated at the first null byte if one is present. See net.WriteData if you wish to write binary data.","name":"string","type":"string"}}},"example":{"description":"Sends a message to all the clients.","code":"-- Server\nutil.AddNetworkString( \"SendMessage\" )\n\nnet.Start( \"SendMessage\" )\n\tnet.WriteString( \"Hello World!\" )\nnet.Broadcast()\n\n-- Client\nnet.Receive( \"SendMessage\", function( len )\n     local message = net.ReadString()\n\n     chat.AddText( color_white, message )\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteTable","parent":"net","type":"libraryfunc","description":{"text":"Appends a table to the current net message. Adds **16 extra bits** per key/value pair, so you're better off writing each individual key/value as the exact type if possible.","warning":"All net messages have a **64kb** buffer. This function will not check or error when that buffer is overflown. You might want to consider using util.TableToJSON and util.Compress and send the resulting string in **60kb** chunks, doing the opposite on the receiving end."},"realm":"Shared","file":{"text":"lua/includes/extensions/net.lua","line":"127-L154"},"args":{"arg":[{"text":"The table to be sent.","name":"table","type":"table","warning":{"text":"If the table contains a `nil` key the table may not be read correctly.\n\nNot all objects can be sent over the network. Things like functions, IMaterials, etc will cause errors when reading the table from a net message.\n\nEach element is also limited by the constraint of the `net.Write","luatype":"` function for the element type."}},{"text":"Set to `true` if the input table is sequential. This saves on bandwidth, adding **8 extra bits** per key/value pair instead of 16 bits.","name":"sequential","type":"boolean","default":"false","added":"2023.09.06","note":"To read the table you need to give net.ReadTable the same value!"}]}},"example":{"description":"This is an example of how the keys order may be switched:","code":"if ( CLIENT ) then\n\tlocal tbl = {\n\t\tType = \"Dining\",\n\t\tLegs = \"4\",\n\t\tMaterial = \"Wood\"\n\t}\n\n\tnet.Start( \"TableSend\" )\n\t\tnet.WriteTable( tbl )\n\tnet.SendToServer()\n\n\n\tPrintTable( tbl ) -- Prints the order client-side.\nend\n\nif ( SERVER ) then\n\tnet.Receive( \"TableSend\", function( len, ply )\n\t     PrintTable( net.ReadTable() ) -- Prints the order server-side.\n\tend )\nend","output":"Client:\n```\nType     = \"Dining\"\nLegs     = 4\nMaterial = \"Wood\"\n```\n\nServer:\n```\nLegs     = 4\nMaterial = \"Wood\"\nType     = \"Dining\"\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteType","parent":"net","type":"libraryfunc","description":{"text":"Appends any type of value to the current net message.","internal":"Used internally by net.WriteTable.","note":"An additional 8-bit unsigned integer indicating the type will automatically be written to the packet before the value, in order to facilitate reading with net.ReadType. If you know the data type you are writing, use a function meant for that specific data type to reduce amount of data sent."},"realm":"Shared","file":{"text":"lua/includes/extensions/net.lua","line":"199-L213"},"args":{"arg":{"text":"The data to be sent.","name":"Data","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteUInt","parent":"net","type":"libraryfunc","description":{"text":"Appends an unsigned integer with the specified number of bits to the current net message.\n\nUse net.WriteInt if you want to send negative and positive numbers. Use net.WriteFloat for a non-whole number (e.g. `2.25`).","note":"Unsigned numbers **do not** support negative numbers."},"realm":"Shared","args":{"arg":[{"text":"The unsigned integer to be sent.","name":"unsignedInteger","type":"number"},{"text":"The size of the integer to be sent, in bits. Acceptable values range from any number `1` to `32` inclusive.\n\nFor reference: `1` = bit, `4` = nibble, `8` = byte, `16` = short, `32` = long.\n\nConsult the table below to determine the bit count you need. The minimum value for all bit counts is `0`.\n\n| Bit Count |  Maximum value |\n|-----------|:--------------:|\n| 1 | 1  |\n| 2 | 3  |\n| 3 | 7  |\n| 4 | 15 |\n| 5 | 31 |\n| 6 | 63 |\n| 7 | 127 |\n| 8 | 255 |\n| 9 | 511 |\n| 10 | 1,023 |\n| 11 | 2,047 |\n| 12 | 4,095 |\n| 13 | 8,191 |\n| 14 | 16,383 |\n| 15 | 32,767 |\n| 16 | 65,535 |\n| 17 | 131,071 |\n| 18 | 262,143 |\n| 19 | 524,287  |\n| 20 | 1,048,575  |\n| 21 | 2,097,151  |\n| 22 | 4,194,303  |\n| 23 | 8,388,607  |\n| 24 | 16,777,215  |\n| 25 | 33,554,431  |\n| 26 | 67,108,863  |\n| 27 | 134,217,727  |\n| 28 | 268,435,455  |\n| 29 | 536,870,911  |\n| 30 | 1,073,741,823 |\n| 31 | 2,147,483,647 |\n| 32 | 4,294,967,295 |","name":"bitCount","type":"number"}]}},"example":{"description":"Sends the server the client's age.","code":"if CLIENT then\n\tnet.Start( \"SendAge\" )\n\t\tnet.WriteUInt( 3, 2 ) -- Only 2 bits are needed to store the number \"3\".\n\tnet.SendToServer()\nend\n\nif SERVER then\n\tutil.AddNetworkString( \"SendAge\" )\n\n\tnet.Receive( \"SendAge\", function( len, ply )\n\t     local age = net.ReadUInt( 2 ) -- use the same number of bits that were written.\n\n\t     print(\"Player \" .. ply:Nick() .. \" is \" .. age .. \" years old.\")\n\tend )\nend","output":{"text":"```\nPlayer","name":"is 3 years old.\n```"}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteUInt64","parent":"net","type":"libraryfunc","description":"Appends an unsigned integer with 64 bits to the current net message.\n\n\t\tThe limit for an uint64 is 18'446'744'073'709'551'615.  \n\t\tEverything above the limit will be set to the limit.  \n\n\t\tUnsigned numbers **do not** support negative numbers.","realm":"Shared","added":"2023.08.30","args":{"arg":{"text":"The 64 bit value to be sent. Can be a number.","name":"uint64","type":"string","warning":"Since Lua cannot store full 64-bit integers, this function takes a string. It is mainly aimed at usage with Player:SteamID64.\n\n\t\t\t\tIf your input is a number and not a string, it won't be networked correctly as soon as it has more than 13 digits.  \n\t\t\t\tThis is because Lua represents numbers over 13 digits as `1e+14`(`100 000 000 000 000`)  \n\t\t\t\tYou can do something like this to convert it to a string: `string.format(\"%.0f\", number)`.  \n\t\t\t\tIf you try to use Global.tostring it will fail because it will create a result something like `1e+14` which doesn't work."}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteVector","parent":"net","type":"libraryfunc","description":"Appends a vector to the current net message.\nVectors sent by this function are compressed, which may result in precision loss. XYZ components greater than `16384` or less than `-16384` are irrecoverably altered (most significant bits are trimmed) and precision after the decimal point is 1 digit (5 bits).","realm":"Shared","args":{"arg":{"text":"The vector to be sent.","name":"vector","type":"Vector"}}},"example":{"description":"Create a server-side command to send a vector to all clients, and a function to receive the vector on the client-side. This example displays the vector compression discussed above.","code":"if SERVER then\n\n    util.AddNetworkString( \"testingvecs\" )\n\n    concommand.Add( \"dovectest\", function()\n        net.Start( \"testingvecs\" )\n        \tnet.WriteVector( Vector( 10000, 20000, -20000.123456789 ) )\n        net.Broadcast()\n\tend )\n\nelseif CLIENT then\n\n    net.Receive( \"testingvecs\", function( len )\n        print( \"RECV: vec = \" .. tostring( net.ReadVector() ) .. \"\\n\" )\n\tend )\n\nend","output":"```\nRECV: vec = 10000.000000 3616.000000 -3616.093750\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddLegacy","parent":"notification","type":"libraryfunc","description":"Adds a standard notification to your screen.","realm":"Client","file":{"text":"lua/includes/modules/notification.lua","line":"66-L85"},"args":{"arg":[{"text":"The text to display.","name":"text","type":"string"},{"text":"Determines the notification method (e.g. icon) for displaying the notification. See the Enums/NOTIFY.","name":"type","type":"number"},{"text":"The number of seconds to display the notification for.","name":"length","type":"number"}]}},"example":{"description":"Adds a prop undo notification to the screen, like in Sandbox.","code":"notification.AddLegacy( \"Undone Prop\", NOTIFY_UNDO, 2 )\nsurface.PlaySound( \"buttons/button15.wav\" )\nMsg( \"Prop undone\\n\" )","output":{"text":"Adds a notice that says `Undone Prop`, plays the undo sound, and adds a message to the console.","upload":{"src":"adcc2/8d9fd6e327b5068.png","size":"94521","name":"image.png"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddProgress","parent":"notification","type":"libraryfunc","description":"Adds a notification with an animated progress bar.","realm":"Client","file":{"text":"lua/includes/modules/notification.lua","line":"26-L55"},"args":{"arg":[{"text":"Can be any type. It's used as an index.","name":"id","type":"any"},{"text":"The text to show","name":"strText","type":"string"},{"text":"If set, overrides the progress bar animation with given percentage. Range is 0 to 1.","name":"frac","type":"number","default":"nil"}]}},"example":{"description":"Add a notification that says \"Downloading file...\", and remove after three seconds.","code":"notification.AddProgress(\"FileDownload\", \"Downloading file...\")\ntimer.Simple(3, function()\n\tnotification.Kill(\"FileDownload\")\nend)","output":{"text":"Adds a progress notification that says `Downloading file...`","upload":{"src":"adcc2/8da06a2ec212781.png","size":"101380","name":"image.png"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Kill","parent":"notification","type":"libraryfunc","description":"Removes the notification after 0.8 seconds.","realm":"Client","file":{"text":"lua/includes/modules/notification.lua","line":"57-L64"},"args":{"arg":{"text":"The unique ID of the notification","name":"uid","type":"any"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Activate","parent":"numpad","type":"libraryfunc","description":"Activates numpad key owned by the player","realm":"Server","file":{"text":"lua/includes/modules/numpad.lua","line":"96-L117"},"args":{"arg":[{"text":"The player whose numpad should be simulated","name":"ply","type":"Player"},{"text":"The key to press, see Enums/KEY","name":"key","type":"number"},{"text":"Should this keypress pretend to be a from a `gmod_button`? (causes numpad.FromButton to return `true`)","name":"isButton","type":"boolean","default":"false"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Deactivate","parent":"numpad","type":"libraryfunc","description":"Deactivates numpad key owned by the player","realm":"Server","file":{"text":"lua/includes/modules/numpad.lua","line":"122-L140"},"args":{"arg":[{"text":"The player whose numpad should be simulated","name":"ply","type":"Player"},{"text":"The key to press, corresponding to Enums/KEY","name":"key","type":"number"},{"text":"Should this keypress pretend to be a from a `gmod_button`? (causes numpad.FromButton to return `true`)","name":"isButton","type":"boolean","default":"false"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"FromButton","parent":"numpad","type":"libraryfunc","description":"Returns true during a function added with numpad.Register when the third argument to numpad.Activate is true.\n\nThis is caused when a numpad function is triggered by a button SENT being used.","realm":"Server","file":{"text":"lua/includes/modules/numpad.lua","line":"30-L34"},"rets":{"ret":{"text":"wasButton","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnDown","parent":"numpad","type":"libraryfunc","description":"Calls a function registered with numpad.Register when a player presses specified key.\n\nSee for key released action: numpad.OnUp","realm":"Server","file":{"text":"lua/includes/modules/numpad.lua","line":"174-L187"},"args":{"arg":[{"text":"The player whose numpad should be watched","name":"ply","type":"Player"},{"text":"The key, corresponding to Enums/KEY","name":"key","type":"number"},{"text":"The name of the function to run, corresponding with the one used in numpad.Register","name":"name","type":"string"},{"text":"Arguments to pass to the function passed to numpad.Register.","name":"...","type":"vararg"}]},"rets":{"ret":{"text":"The impulse ID","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnUp","parent":"numpad","type":"libraryfunc","description":"Calls a function registered with numpad.Register when a player releases specified key.\n\nSee for key pressed action: numpad.OnDown","realm":"Server","file":{"text":"lua/includes/modules/numpad.lua","line":"192-L205"},"args":{"arg":[{"text":"The player whose numpad should be watched","name":"ply","type":"Player"},{"text":"The key, corresponding to Enums/KEY","name":"key","type":"number"},{"text":"The name of the function to run, corresponding with the one used in numpad.Register","name":"name","type":"string"},{"text":"Arguments to pass to the function passed to numpad.Register.","name":"...","type":"vararg"}]},"rets":{"ret":{"text":"The impulse ID","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Register","parent":"numpad","type":"libraryfunc","description":"Registers a numpad library action for use with numpad.OnDown and numpad.OnUp","realm":"Server","file":{"text":"lua/includes/modules/numpad.lua","line":"241-L245"},"args":{"arg":[{"text":"The unique id of your action.","name":"id","type":"string"},{"text":"The function to be executed.","name":"func","type":"function","callback":{"arg":[{"text":"The player who pressed the button","type":"Player","name":"ply"},{"text":"The 4th and all subsequent arguments passed from numpad.OnDown and/or numpad.OnUp.","type":"vararg","name":"data"}],"ret":{"text":"Returning `false` in this function will remove the listener which triggered this function\n\n(example: return `false` if one of your varargs is an entity which is no longer valid)","type":"boolean","name":"data","default":"nil"}}}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Remove","parent":"numpad","type":"libraryfunc","description":"Removes a function added by either numpad.OnUp or numpad.OnDown","realm":"Server","file":{"text":"lua/includes/modules/numpad.lua","line":"229-L236"},"args":{"arg":{"text":"The impulse ID returned by numpad.OnUp or numpad.OnDown","name":"ID","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Toggle","parent":"numpad","type":"libraryfunc","description":"Either runs numpad.Activate or numpad.Deactivate depending on the key's current state","realm":"Server","file":{"text":"lua/includes/modules/numpad.lua","line":"145-L154"},"args":{"arg":[{"text":"The player whose numpad should be simulated","name":"ply","type":"Player"},{"text":"The key to press, corresponding to Enums/KEY","name":"key","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"clock","parent":"os","type":"libraryfunc","description":{"text":"Returns the approximate cpu time the application ran.\nSee also Global.SysTime","note":"This function has different precision on Linux (1/100)."},"realm":"Shared and Menu","rets":{"ret":{"text":"runtime","name":"","type":"number"}}},"example":{"description":"Prints the amount of time since Garry's Mod has been open to the console.","code":"print(os.clock())"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"date","parent":"os","type":"libraryfunc","description":"Returns the date/time as a formatted string or in a table.","realm":"Shared and Menu","args":{"arg":[{"text":"The format string.\n\nIf this is equal to `*t` or `!*t` then this function will return a Structures/DateData, otherwise it will return a string.\n\nIf this starts with an `!`, the returned data will use the UTC timezone rather than the local timezone.\n\nSee http://www.mkssoftware.com/docs/man3/strftime.3.asp for available format flags.\n\n\n\nKnown formats that work on all platforms:\n\n| Format | Description | Example of the output |\n|:------:|:-----------:|:---------------------:|\n| `%a` | Abbreviated weekday name | `Wed` |\n| `%A` | Full weekday name | `Wednesday` |\n| `%b` | Abbreviated month name | `Sep` |\n| `%B` | Full month name | `September` |\n| `%c` | Locale-appropriate date and time | Varies by platform and language settings |\n| `%d` | Day of the month [01-31] | `16` |\n| `%H` | Hour, using a 24-hour clock [00-23] | `23` |\n| `%I` | Hour, using a 12-hour clock [01-12] | `11` |\n| `%j` | Day of the year [001-365] | `259` |\n| `%m` | Month [01-12] | `09` |\n| `%M` | Minute [00-59] | `48` |\n| `%p` | Either `am` or `pm` | `pm` |\n| `%S` | Second [00-60] | `10` |\n| `%w` | Weekday [0-6 = Sunday-Saturday] | `3` |\n| `%W` | Week of the year [00-53] | `37` |\n| `%x` | Date (Same as `%m/%d/%y`) | `09/16/98` |\n| `%X` | Time (Same as `%H:%M:%S`) | `23:48:10` |\n| `%y` | Two-digit year [00-99] | `98` |\n| `%Y` | Full year | `1998` |\n| `%z` | Timezone | `-0300` |\n| `%%` | A percent sign | `%` |","name":"format","type":"string","bug":{"text":"**Not all flags are available on all operating systems** and the result of using an invalid flag is undefined. This currently crashes the game on Windows. Most or all flags are available on OS X and Linux but considerably fewer are available on Windows. See http://msdn.microsoft.com/en-us/library/fe06s4ak.aspx for a list of available flags on Windows. Note that the **#** flags also crashes the game on Windows.","issue":"329"}},{"text":"Time to use for the format.","name":"time","type":"number","default":"os.time()"}]},"rets":{"ret":{"text":"Formatted date","name":"","type":"string","note":"This will be a Structures/DateData if the first argument equals to `*t` or `!*t`"}}},"example":{"description":"This will use the os.time() function, and return it in a friendly way.\nos.time() is useful for storing as a date stamp but needs this to make it readable.","code":"local Timestamp = os.time()\nlocal TimeString = os.date( \"%H:%M:%S - %d/%m/%Y\" , Timestamp )\nprint( \"Timestamp:\", Timestamp )\nprint( \"TimeString:\", TimeString )","output":"````\nTimestamp:\t1584402168\nTimeString:\t23:42:48 - 16/03/2020\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"difftime","parent":"os","type":"libraryfunc","description":"Subtracts the second from the first value and rounds the result.","realm":"Shared and Menu","args":{"arg":[{"text":"The first value.","name":"timeA","type":"number"},{"text":"The value to subtract.","name":"timeB","type":"number"}]},"rets":{"ret":{"text":"diffTime","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"time","parent":"os","type":"libraryfunc","description":"Returns the system time in seconds past the unix epoch. If a table is supplied, the function attempts to build a system time with the specified table members.","realm":"Shared and Menu","args":{"arg":{"text":"Table to generate the time from. This table's data is interpreted as being in the local timezone. See Structures/DateData","name":"dateData","type":"table","default":"nil"}},"rets":{"ret":{"text":"Seconds passed since Unix epoch","name":"","type":"number"}}},"example":{"description":"Prints out the current time, in seconds past the unix epoch.","code":"print( os.time() )","output":"1581691801"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"loaded","parent":"package","type":"libraryfield","description":"A list of all loaded packages.","realm":"Shared and Menu","rets":{"ret":{"text":"The list of all loaded packages.","name":"","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"seeall","parent":"package","type":"libraryfunc","description":"Sets a metatable for module with its __index field referring to the global environment, so that this module inherits values from the global environment. To be used as an option to Global.module.","realm":"Shared and Menu","args":{"arg":{"text":"The module table to be given a metatable","name":"module","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"AskToConnect","parent":"permissions","type":"libraryfunc","description":"Requests the player to connect to a specified server. The player will be prompted with a confirmation window.","realm":"Client","args":{"arg":{"text":"The address to ask to connect to. If a port is not given, the default `:27015` port will be added.","name":"address","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Connect","parent":"permissions","type":"libraryfunc","description":"Connects player to the server. This is what permissions.AskToConnect uses internally.","realm":"Menu","args":{"arg":{"text":"IP address to connect.","name":"ip","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"EnableVoiceChat","parent":"permissions","type":"libraryfunc","description":"Activates player's microphone as if they pressed the speak button themself. The player will be prompted with a confirmation window which grants permission temporarily/permanently(depending on checkbox state) for the connected server (revokable). \nThis is used for TTT's traitor voice channel.","realm":"Client","args":{"arg":{"text":"Enable or disable voice activity. `true` will run `+voicerecord` command, anything else `-voicerecord`.","name":"enable","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetAll","parent":"permissions","type":"libraryfunc","description":"Returns all permissions per server. Permanent permissions are stored in `settings/permissions.bin`.","realm":"Menu","rets":{"ret":{"text":"A table of permanent and temporary permissions granted for servers.\n\n\t\tExample structure:\n```lua\npermanent = {\n\t[\"123.123.123.123\"] = \"connect\" -- this server has a permission to connect player to any server even after restarting the game\n},\ntemporary = {\n\t[\"111.111.111.111\"] = \"voicerecord\" -- this server can enable voice activity on player during this game session\n}\n```","name":"permissions","type":"table<string,table>"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"Grant","parent":"permissions","type":"libraryfunc","description":"Grants permission to the current connected server.","realm":"Menu","args":{"arg":[{"text":"Permission to grant for the server the player is currently connected.","name":"permission","type":"string"},{"text":"`true` if the permission should be granted temporary.","name":"temporary","type":"boolean"}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"IsGranted","parent":"permissions","type":"libraryfunc","description":"Returns whether the player has granted the current server a specific permission.","added":"2021.06.09","realm":"Client and Menu","args":{"arg":{"text":"The permission to poll. Currently only 2 permission are valid:\n* `\"connect\"`\n* `\"voicerecord\"`","name":"permission","type":"string"}},"rets":{"ret":{"text":"Whether the permission is granted or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Revoke","parent":"permissions","type":"libraryfunc","description":"Revokes permission from the server.","realm":"Menu","args":{"arg":[{"text":"Permission to revoke from the server.","name":"permission","type":"string"},{"text":"IP of the server.","name":"ip","type":"string"}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"AddSurfaceData","parent":"physenv","type":"libraryfunc","description":{"text":"Adds a [material surface property](https://developer.valvesoftware.com/wiki/Material_surface_properties) type to the game's physics environment.\n\nSee util.GetSurfaceData for the opposite function.","bug":{"text":"The game has a limit of 128 surface properties - this includes properties loaded automatically from [surfaceproperties.txt](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/scripts/surfaceproperties.txt). Due to this, there's only a small amount of open slots that can be registered with GMod's provided surfaceproperties.txt.\n\nDoes nothing on `x86-64` beta.","issue":"2604"}},"realm":"Shared","args":{"arg":{"text":"The properties to add. Each one should include `\"base\"` or the game will crash due to some values being missing.","name":"properties","type":"string"}}},"example":{"description":"Adds the \"scout_baseball\" surface property from TF2.","code":"physenv.AddSurfaceData([[\"scout_baseball\"\n{\n\t\"base\"\t\t\"rubber\"\n\n\t\"bulletimpact\"\t\"Weapon_Baseball.HitWorld\"\n\t\"scraperough\"\t\"Grenade.ScrapeRough\"\n\t\"scrapesmooth\"\t\"Grenade.ScrapeSmooth\"\n\t\"impacthard\"\t\"Weapon_Baseball.HitWorld\"\n\t\"impactsoft\"\t\"Weapon_Baseball.HitWorld\"\n\t\"rolling\"\t\"Grenade.Roll\"\n}]])"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAirDensity","parent":"physenv","type":"libraryfunc","description":{"text":"Returns the air density used to calculate drag on physics objects.","validate":"The unit is in `kg/m³`."},"realm":"Shared","rets":{"ret":{"text":"Default value is 2.","name":"airDensity","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetGravity","parent":"physenv","type":"libraryfunc","description":"Gets the gravitational acceleration used for physics objects in `source_unit/s^2`.","realm":"Shared","rets":{"ret":{"text":"Gravity direction and strength.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetLastSimulationTime","parent":"physenv","type":"libraryfunc","description":"Returns the last simulation duration of the in-game physics.","realm":"Shared","added":"2023.01.25","rets":{"ret":{"text":"The last simulation duration of the in-game physics in seconds","name":"","type":"number"}}},"example":{"description":"Prints a message when physics lag of over 100ms is detected","code":"hook.Add(\"Think\", \"LagDetector\", function ()\n\tif physenv.GetLastSimulationTime() * 1000 > 100 then\n\t\tprint(\"Physics lag detected!\")\n\tend\nend)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPerformanceSettings","parent":"physenv","type":"libraryfunc","description":"Gets the current performance settings in table form.","realm":"Shared","rets":{"ret":{"text":"Performance settings or nil if called too early. See Structures/PhysEnvPerformanceSettings","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPhysicsPaused","parent":"physenv","type":"libraryfunc","description":"Returns the pause status of global physics simulation. See physenv.SetPhysicsPaused for the setter.","realm":"Shared","added":"2024.12.12","rets":{"ret":{"text":"`true` if paused.","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"parent":"physenv","name":"GetTimeScale","type":"libraryfunc","description":"Returns the physics time scale set with physenv.SetTimeScale.","added":"2026.05.05","realm":"Shared","rets":{"ret":{"text":"The current physics time scale.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetAirDensity","parent":"physenv","type":"libraryfunc","description":"Sets the air density.","realm":"Shared","args":{"arg":{"text":"The new air density.","name":"airDensity","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetGravity","parent":"physenv","type":"libraryfunc","description":"Sets the gravitational acceleration used for physics objects. Does not affect players.","realm":"Shared","args":{"arg":{"text":"The new gravity in `source_unit/s^2`.","name":"gravAccel","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetPerformanceSettings","parent":"physenv","type":"libraryfunc","description":"Sets the performance settings.","realm":"Shared","args":{"arg":{"text":"The new performance settings. See Structures/PhysEnvPerformanceSettings","name":"performanceSettings","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetPhysicsPaused","parent":"physenv","type":"libraryfunc","description":"Pauses or unpauses the physics simulation globally. See physenv.GetPhysicsPaused for the getter.","realm":"Shared","added":"2024.12.12","args":{"arg":{"text":"`true` to pause, `false` to unpause.","name":"pause","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetTimeScale","parent":"physenv","type":"libraryfunc","description":"Sets the time scale of the physics simulation.\n\nThis will affect serverside-only physics if called on server, and clientside-only physics if used on the client.\n\nSee game.SetTimeScale for a function that also affects all game logic.\n\nThe true timescale will be `phys_timescale` (`cl_phys_timescale` on client) multiplied by physenv.GetTimeScale.","added":"2026.05.05","realm":"Shared","args":{"arg":{"text":"The new timescale, minimum value is 0.001 and maximum is 5.","name":"timeScale","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CreateNextBot","parent":"player","type":"libraryfunc","description":{"text":"Similar to the serverside command \"bot\", this function creates a new Player bot with the given name. This bot will not obey to the usual `bot_*` commands, and it's the same bot base used in TF2 and CS:S.\n\nThe best way to control the behaviour of a Player bot right now is to use the GM:StartCommand hook and modify its input serverside.","note":["Despite this Player being fake, it has to be removed from the server by using Player:Kick and **NOT** Entity:Remove.\nAlso keep in mind that these bots still use player slots, so you won't be able to spawn them in singleplayer!","Any Bot created using this method will be considered UnAuthed by Garry's Mod"]},"realm":"Server","args":{"arg":{"text":"The name of the bot, using an already existing name will append brackets at the end of it with a number pertaining it.\n\nExample: \"Bot name test\", \"Bot name test(1)\".","name":"botName","type":"string"}},"rets":{"ret":{"text":"The newly created Player bot. Returns NULL if there's no Player slots available to host it.","name":"","type":"Player"}}},"example":{"description":"Create a bot if that is possible.","code":{"text":"local listBots = {}\n\nfunction CreateBot()\n\n    if ( !game.SinglePlayer() && player.GetCount()","game.maxplayers":{"then":"","local":"","num":["#listBots",""],"listbots":"","player.createnextbotbot_":"","return":"","else":"","print":"","cant":"","create":"","bot":"","end":"","ode":"ode"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetAll","parent":"player","type":"libraryfunc","description":{"text":"Gets all the current players in the server (not including connecting clients).\n\nThis function returns bots as well as human players. See player.GetBots and  player.GetHumans.","note":"This function returns a sequential table, meaning it should be looped with Global.ipairs instead of Global.pairs for efficiency reasons."},"realm":"Shared","rets":{"ret":{"text":"All Players currently in the server.","name":"","type":"table<Player>"}}},"example":[{"description":"Prints all the players currently in the server.","code":"PrintTable( player.GetAll() )","output":"```\n1 = [Player][1][Player1]\n2 = [Player][2][Bot01]\n3 = [Player][3][Bot02]\n```"},{"description":"Prints the number of players in the server. The same output can be achieved more efficiently with player.GetCount.","code":"print(#player.GetAll())","output":"```\n3\n```"},{"description":"The output of the players name in the console.","code":"for i, v in ipairs( player.GetAll() ) do\n    print( v:Nick() )\nend","output":"```\nPlayer1\nPlayer2\nPlayer3\n```"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBots","parent":"player","type":"libraryfunc","description":"Returns a table of all bots on the server.","realm":"Shared","rets":{"ret":{"text":"A table only containing bots ( AI / non human players )","name":"","type":"table<Player>"}}},"example":{"description":"Kicks all bots from the server.","code":"for _, bot in ipairs(player.GetBots()) do\n\tbot:Kick(\"Bot's not allowed\")\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetByAccountID","parent":"player","type":"libraryfunc","description":{"text":"Tried to get the player with the specified Player:AccountID.","warning":"Internally this function iterates over all players in the server, meaning it can be quite expensive in a performance-critical context."},"realm":"Shared","file":{"text":"lua/includes/extensions/player.lua","line":"265-L274"},"args":{"arg":{"text":"The Player:AccountID to find the player by.","name":"accountID","type":"number"}},"rets":{"ret":{"text":"Player if one is found, `false` otherwise.","name":"","type":"Player|boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetByID","parent":"player","type":"libraryfunc","description":"Gets the player with the specified connection ID.\n\nConnection ID can be retrieved via gameevent.Listen events.\n\nFor a function that returns a player based on their Entity:EntIndex, see Global.Entity.\n\n\nFor a function that returns a player based on their Player:UserID, see Global.Player.","realm":"Shared","args":{"arg":{"text":"The connection ID to find the player by.","name":"connectionID","type":"number"}},"rets":{"ret":{"text":"Player if one is found, `NULL` otherwise.","name":"","type":"Player|NULL"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBySteamID","parent":"player","type":"libraryfunc","description":{"text":"Gets the player with the specified SteamID.","warning":"Internally this function iterates over all players in the server, meaning it can be quite expensive in a performance-critical context."},"realm":"Shared","file":{"text":"lua/includes/extensions/player.lua","line":"287-L297"},"args":{"arg":{"text":"The Player:SteamID to find the player by.","name":"steamID","type":"string"}},"rets":{"ret":{"text":"Player if one is found, `false` otherwise.","name":"","type":"Player|boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetBySteamID64","parent":"player","type":"libraryfunc","description":{"text":"Gets the player with the specified SteamID64.","warning":"Internally this function iterates over all players in the server, meaning it can be quite expensive in a performance-critical context."},"realm":"Shared","file":{"text":"lua/includes/extensions/player.lua","line":"299-L308"},"args":{"arg":{"text":"The Player:SteamID64 to find the player by.","name":"steamID64","type":"string"}},"rets":{"ret":{"text":"Player if one is found, `false` otherwise.","name":"","type":"Player|boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetByUniqueID","parent":"player","type":"libraryfunc","description":{"text":"Gets the player with the specified uniqueID (not recommended way to identify players).","deprecated":"Use player.GetBySteamID64, player.GetBySteamID or player.GetByAccountID to get a player by a unique identifier instead.","warning":["It is highly recommended to use player.GetByAccountID, player.GetBySteamID or player.GetBySteamID64 instead as this function can have collisions ( be same for different people ) while SteamID is guaranteed to unique to each player.","Internally this function iterates over all players in the server, meaning it can be quite expensive in a performance-critical context."]},"realm":"Shared","file":{"text":"lua/includes/extensions/player.lua","line":"276-L285"},"args":{"arg":{"text":"The Player:UniqueID to find the player by.","name":"uniqueID","type":"string"}},"rets":{"ret":{"text":"Player if one is found, `false` otherwise.","name":"","type":"Player|boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetCount","parent":"player","type":"libraryfunc","description":{"text":"Returns the active player count.","note":["Similar to **#**player.GetAll() but with better performance since the player table doesn't have to be generated. If player.GetAll is already being called for iteration, then using the **#** operator on the table will be faster than calling this function since it is JITted.","Players who are currently connecting to the server will not be counted. See function: player.GetCountConnecting"]},"realm":"Shared","rets":{"ret":{"text":"Number of players.","name":"","type":"number"}}},"example":{"description":"Sending message in chat every 300 secs.","code":"timer.Create(\"CountAdvert\", 300, 0, function()\n    local playerCount = player.GetCount() -- Getting the number of players on the server\n    local message = \"There are currently \" .. playerCount .. \" people playing on the server.\" -- Our message\n\n    -- Send in chat for everyone\n    for _, ply in player.Iterator() do\n        ply:ChatPrint(message)\n    end\nend)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetCountConnecting","parent":"player","type":"libraryfunc","description":"Returns the amount of players connecting to the server, but not yet spawned in.\n\n`player.GetCountConnecting() + player.GetCount()` would result in the total player count on this server.","added":"2025.06.04","realm":"Server","rets":{"ret":{"text":"Number of players still connecting.","name":"","type":"number"}}},"example":{"description":"Track how many players are connecting on the client.","code":"local PlayerCountConnecting = 0\nhook.Add(\"PlayerConnect\", \"PlayerGetCountConnecting\", function()\n    PlayerCountConnecting = PlayerCountConnecting + 1\nend)\n\ngameevent.Listen(\"player_disconnect\")\nhook.Add(\"player_disconnect\", \"PlayerGetCountConnecting\", function()\n    PlayerCountConnecting = math.max(0, PlayerCountConnecting - 1)\nend)\n\ngameevent.Listen(\"player_activate\")\nhook.Add(\"player_activate\", \"PlayerGetCountConnecting\", function()\n    PlayerCountConnecting = math.max(0, PlayerCountConnecting - 1)\nend)\n\nconcommand.Add(\"player_count_connecting\", function(ply)\n    print(\"Players currently connecting: \" .. PlayerCountConnecting)\nend)"},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetHumans","parent":"player","type":"libraryfunc","description":{"text":"Returns a table containing all human players (non-bot/AI).\n\nUnlike player.GetAll, this does not include bots.","note":"This function returns a sequential table, meaning it should be looped with Global.ipairs instead of Global.pairs for efficiency reasons."},"realm":"Shared","rets":{"ret":{"text":"A table containing all human (non-bot/AI) players.","name":"","type":"table<Player>"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Iterator","parent":"player","type":"libraryfunc","description":{"text":"Returns a [Stateless Iterator](https://www.lua.org/pil/7.3.html) for all players on the server.\n\t\tIntended for use in [Generic For-Loops](https://www.lua.org/pil/4.3.5.html).  \n\t\tSee ents.Iterator for a similar function for all entities.","note":"Internally, this function uses cached values that are stored in Lua, as opposed to player.GetAll, which is a C++ function.\n\t\tBecause a call operation from Lua to C++ *and* with a return back to Lua is quite costly, this function will be more efficient than player.GetAll."},"added":"2023.10.13","realm":"Shared","file":{"text":"lua/includes/extensions/entity_iter.lua","line":"13-L20"},"rets":{"ret":[{"text":"The Iterator Function from ipairs.","name":"","type":"function"},{"text":"Table of all existing Players.  This is a cached copy of player.GetAll.","name":"","type":"table<Player>","warning":"This table is intended to be read-only.\n\nModifying the return table will affect all subsequent calls to this function until the cache is refreshed, replacing all of your player.GetAll usages may come with unintended side effects because of this.\n\nAn example:\n```\n-- Bad code.\nlocal scan_ents = select( 2, player.Iterator() )\ntable.Add( scan_ents, ents.FindByClass( \"ttt_decoy\" ) )\n\n-- Fine code. A copy of the table is being made and used.\nlocal scan_ents = table.Copy( select( 2, player.Iterator() ) )\ntable.Add( scan_ents, ents.FindByClass( \"ttt_decoy\" ) )\n```"},{"text":"The starting index for the table of players.  \n\t\t\tThis is always `0` and is returned for the benefit of [Generic For-Loops](https://www.lua.org/pil/4.3.5.html).","name":"","type":"number"}]}},"example":{"description":"Prints out all players to the console.","code":"for _, ply in player.Iterator() do\n\tprint( ply )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddValidHands","parent":"player_manager","type":"libraryfunc","description":"Assigns view model hands to player model.","realm":"Shared","file":{"text":"lua/includes/modules/player_manager.lua","line":"27-L34"},"args":{"arg":[{"text":"Player model name.","name":"name","type":"string"},{"text":"Hands model.","name":"model","type":"string"},{"text":"Skin to apply to the hands.","name":"skin","type":"number","default":"0"},{"text":"Bodygroups to apply to the hands. See Entity:SetBodyGroups for help with the format.","name":"bodygroups","type":"string","default":"0000000"},{"text":"If set to `true`, the skin of the hands will be set to the skin of the playermodel. \n This is useful when player models have multiple user-selectable skins.","name":"matchBodySkin","type":"boolean","default":"false"}]}},"example":{"description":"Adds CS:S hands for hostage playermodels.","code":"player_manager.AddValidHands( \"hostage01\", \"models/weapons/c_arms_cstrike.mdl\", 0, \"10000000\" )\nplayer_manager.AddValidHands( \"hostage02\", \"models/weapons/c_arms_cstrike.mdl\", 0, \"10000000\" )\nplayer_manager.AddValidHands( \"hostage03\", \"models/weapons/c_arms_cstrike.mdl\", 0, \"10000000\" )\nplayer_manager.AddValidHands( \"hostage04\", \"models/weapons/c_arms_cstrike.mdl\", 0, \"10000000\" )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddValidModel","parent":"player_manager","type":"libraryfunc","description":"Associates a simplified name with a path to a valid player model.\n\n\nOnly used internally.","realm":"Shared","file":{"text":"lua/includes/modules/player_manager.lua","line":"17-L25"},"args":{"arg":[{"text":"Simplified name.","name":"name","type":"string"},{"text":"Valid PlayerModel path.","name":"model","type":"string"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AllValidModels","parent":"player_manager","type":"libraryfunc","description":"Returns the entire list of valid player models.","realm":"Shared","file":{"text":"lua/includes/modules/player_manager.lua","line":"36-L41"},"rets":{"ret":{"text":"List of all valid player models.","name":"","type":"table"}}},"example":{"description":"Store the list of valid player models in a local variable, and print the valid model path for \"Alyx\".","code":"local models = player_manager.AllValidModels()\nprint(models[\"alyx\"])","output":"Console outputs: \"models/player/alyx.mdl\""},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ClearPlayerClass","parent":"player_manager","type":"libraryfunc","description":"Clears a player's class association by setting their ClassID to 0.","realm":"Shared","file":{"text":"lua/includes/modules/player_manager.lua","line":"399-L403"},"args":{"arg":{"text":"Player to clear class from.","name":"ply","type":"Player"}}},"example":{"description":"Source for player_manager.ClearPlayerClass. (from lua/includes/modules/player_manager.lua)","code":"function ClearPlayerClass( ply )\n\n\tply:SetClassID( 0 )\n\nend","output":""},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPlayerClass","parent":"player_manager","type":"libraryfunc","description":"Gets a players class.","realm":"Shared","file":{"text":"lua/includes/modules/player_manager.lua","line":"390-L397"},"args":{"arg":{"text":"Player to get class.","name":"ply","type":"Player"}},"rets":{"ret":{"text":"The players class.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPlayerClasses","parent":"player_manager","type":"libraryfunc","description":"Retrieves a copy of all registered player classes.","realm":"Shared","file":{"text":"lua/includes/modules/player_manager.lua","line":"300-L304"},"added":"2020.10.14","rets":{"ret":{"text":"A copy of all registered player classes.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPlayerClassTable","parent":"player_manager","type":"libraryfunc","description":"Gets a players' class table.","realm":"Shared","added":"2024.07.09","args":{"arg":{"text":"Player to get class of.","name":"ply","type":"Player"}},"rets":{"ret":{"text":"The players class table.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OnPlayerSpawn","parent":"player_manager","type":"libraryfunc","description":"Applies basic class variables when the player spawns.\n\nCalled from GM:PlayerSpawn in the base gamemode.","realm":"Shared","file":{"text":"lua/includes/modules/player_manager.lua","line":"433-L457"},"args":{"arg":[{"text":"Player to setup.","name":"ply","type":"Player"},{"text":"If true, the player just spawned from a map transition. You probably want to not touch player's weapons or position if this is set to `true`.","name":"transition","type":"boolean"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RegisterClass","parent":"player_manager","type":"libraryfunc","description":"Register a class metatable to be assigned to players later.","realm":"Shared","file":{"text":"lua/includes/modules/player_manager.lua","line":"350-L375"},"args":{"arg":[{"text":"Class name.","name":"name","type":"string"},{"text":"Class metatable, see Structures/PLAYER.","name":"table","type":"table"},{"text":"Base class name.","name":"base","type":"string","default":"nil"}]}},"example":[{"description":"A quick look at registering a class table.","code":"local PLAYER = {}\n\nPLAYER.DisplayName = \"Default Class\"\n\n-- ...\n\nplayer_manager.RegisterClass( \"player_default\", PLAYER, nil )"},{"description":"You can retrieve the data you've set when registering the table using baseclass.Get( \"<classname>\" ).","code":"PrintTable( baseclass.Get( \"player_default\" ) )","output":"```\nWalkspeed = 300\nRunSpeed = 500\nCalcView = function: 0x00665988\nUseVMHands = true\n--- etc...\n```"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RunClass","parent":"player_manager","type":"libraryfunc","description":"Execute a named function within the player's set class.","realm":"Shared","file":{"text":"lua/includes/modules/player_manager.lua","line":"405-L415"},"args":{"arg":[{"text":"Player to execute function on.","name":"ply","type":"Player"},{"text":"Name of function.","name":"funcName","type":"string"},{"text":"Optional arguments. Can be of any type.","name":"arguments","type":"vararg"}]},"rets":{"ret":{"text":"The values returned by the called function.","name":"","type":"vararg"}}},"example":[{"description":"Run the player's class 'Loadout' function when PlayerLoadout is called.","code":"function GM:PlayerLoadout( ply )\n\n\tplayer_manager.RunClass( ply, \"Loadout\" )\n \nend","output":"The player's class 'Loadout' function is executed."},{"description":"Call a greeting function within the playerclass system.","code":"local PLAYER = {}\nPLAYER.DisplayName = \"Hooman\"\nPLAYER.WalkSpeed = 200\nPLAYER.greet = function( tbl ) // create a function named 'greet'\n// the first argument passed is the source table\n// which includes the classID, the player entity, and the function itself\n\tlocal ply = tbl.Player // here we extract the player entity from the table\n    ply:ChatPrint(\"Hello \"..ply:Nick()..\" !\") // tell the player\nend\n\n// link it to the spawn hook, so each time a player (re-)spawns, he will be greeted with a hello\nhook.Add(\"PlayerSpawn\",\"greet\",function(ply)\n\tplayer_manager.RunClass( ply, \"greet\" )\nend)","output":"Hello Flowx !"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetPlayerClass","parent":"player_manager","type":"libraryfunc","description":"Sets a player's class.","realm":"Shared","file":{"text":"lua/includes/modules/player_manager.lua","line":"377-L388"},"args":{"arg":[{"text":"Player to set class.","name":"ply","type":"Player"},{"text":"Name of class to set.","name":"className","type":"string"}]}},"example":{"description":"Sets the player's class to 'player_default' every time they spawn.","code":"function GM:PlayerSpawn( ply )\n\tplayer_manager.SetPlayerClass(ply, \"player_default\")\nend","output":""},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"TranslatePlayerHands","parent":"player_manager","type":"libraryfunc","description":{"text":"Retrieves correct hands for given player model. By default returns citizen hands.","note":"See player_manager.AddValidHands for defining/linking hands to a model - this must be defined somewhere otherwise the model will return citizen hands here."},"realm":"Shared","file":{"text":"lua/includes/modules/player_manager.lua","line":"69-L79"},"args":{"arg":{"text":"Player model name.","name":"name","type":"string"}},"rets":{"ret":{"text":"A table with following contents:\n* string model - Model of hands.\n* number skin - Skin of hands.\n* string body - Bodygroups of hands.\n* boolean matchBodySkin - Use player skinIndex.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"TranslatePlayerModel","parent":"player_manager","type":"libraryfunc","description":"Returns the valid model path for a simplified name.","realm":"Shared","file":{"text":"lua/includes/modules/player_manager.lua","line":"44-L55"},"args":{"arg":{"text":"The short name of the model.","name":"shortName","type":"string"}},"rets":{"ret":{"text":"The valid model path for the short name.","name":"","type":"string"}}},"example":{"description":"Print the valid model path for \"Alyx\".","code":"print(player_manager.TranslatePlayerModel(\"alyx\"))","output":"Console outputs: \"models/player/alyx.mdl\""},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"TranslateToPlayerModelName","parent":"player_manager","type":"libraryfunc","description":"Returns the simplified name for a valid model path of a player model.\n\nOpposite of player_manager.TranslatePlayerModel.","realm":"Shared","file":{"text":"lua/includes/modules/player_manager.lua","line":"57-L67"},"args":{"arg":{"text":"The model path to a player model.","name":"model","type":"string"}},"rets":{"ret":{"text":"The simplified name for that model.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Add","parent":"presets","type":"libraryfunc","description":"Adds preset to a preset group.","realm":"Client","file":{"text":"lua/includes/modules/presets.lua","line":"33-L46"},"args":{"arg":[{"text":"The preset group name, usually it's tool class name.","name":"groupname","type":"string"},{"text":"Preset name, must be unique.","name":"name","type":"string"},{"text":"A table of preset console commands.","name":"values","type":"table"}]}},"example":{"description":"A simple faceposer preset.","code":"presets.Add( \"face\", \"Open Eyes\", {\n\tfaceposer_flex0\t= \"1\",\n\tfaceposer_flex1\t= \"1\",\n\tfaceposer_flex2\t= \"0\",\n\tfaceposer_flex3\t= \"0\",\n\tfaceposer_flex4\t= \"0\",\n\tfaceposer_flex5\t= \"0\",\n\tfaceposer_flex6\t= \"0\",\n\tfaceposer_flex7\t= \"0\",\n\tfaceposer_flex8\t= \"0\",\n\tfaceposer_flex9\t= \"0\"\n} )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"BadNameAlert","parent":"presets","type":"libraryfunc","description":{"text":"Used internally to tell the player that the name they tried to use in their preset is not acceptable.","internal":""},"realm":"Client","file":{"text":"lua/includes/modules/presets.lua","line":"81-L85"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Exists","parent":"presets","type":"libraryfunc","description":"Returns whether a preset with given name exists or not","realm":"Client","file":{"text":"lua/includes/modules/presets.lua","line":"20-L31"},"args":{"arg":[{"text":"The preset group name, usually it's tool class name.","name":"type","type":"string"},{"text":"Name of the preset to test","name":"name","type":"string"}]},"rets":{"ret":{"text":"true if the preset does exist","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTable","parent":"presets","type":"libraryfunc","description":"Returns a table with preset names and values from a single preset group.","realm":"Client","file":{"text":"lua/includes/modules/presets.lua","line":"8-L18"},"args":{"arg":{"text":"Preset group name.","name":"groupname","type":"string"}},"rets":{"ret":{"text":"All presets in specified group.","name":"","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OverwritePresetPrompt","parent":"presets","type":"libraryfunc","description":{"text":"Used internally to ask the player if they want to override an already existing preset.","internal":""},"realm":"Client","file":{"text":"lua/includes/modules/presets.lua","line":"87-L91"},"args":{"arg":{"name":"callback","type":"function"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Remove","parent":"presets","type":"libraryfunc","description":"Removes a preset entry from a preset group.","realm":"Client","file":{"text":"lua/includes/modules/presets.lua","line":"65-L78"},"args":{"arg":[{"text":"Preset group to remove from","name":"groupname","type":"string"},{"text":"Name of preset to remove","name":"name","type":"string"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Rename","parent":"presets","type":"libraryfunc","description":"Renames preset.","realm":"Client","file":{"text":"lua/includes/modules/presets.lua","line":"48-L63"},"args":{"arg":[{"text":"Preset group name","name":"groupname","type":"string"},{"text":"Old preset name","name":"oldname","type":"string"},{"text":"New preset name","name":"newname","type":"string"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"List","parent":"properties","type":"libraryfield","description":"A list of all properties registered with properties.Add.","realm":"Shared","rets":{"ret":{"text":"The list of all properties. The keys will be the first argument passed to properties.Add, the values will be the second argument.","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Add","parent":"properties","type":"libraryfunc","description":"Add properties to the properties module. Properties can be blocked via GM:CanProperty.","realm":"Shared","file":{"text":"lua/includes/modules/properties.lua","line":"28-L36"},"args":{"arg":[{"text":"A unique name used to identify the property","name":"name","type":"string"},{"text":"A table that defines the property. Uses the Structures/PropertyAdd.","name":"propertyData","type":"table"}]}},"example":{"description":"Defines a property that can be used to ignite entities (from Sandbox)","code":"properties.Add( \"ignite\", {\n\tMenuLabel = \"#ignite\", -- Name to display on the context menu\n\tOrder = 999, -- The order to display this property relative to other properties\n\tMenuIcon = \"icon16/fire.png\", -- The icon to display next to the property\n\n\tFilter = function( self, ent, ply ) -- A function that determines whether an entity is valid for this property\n\t\tif ( !IsValid( ent ) ) then return false end\n\t\tif ( ent:IsPlayer() ) then return false end\n\t\tif ( !CanEntityBeSetOnFire( ent ) ) then return false end\n\t\tif ( !gamemode.Call( \"CanProperty\", ply, \"ignite\", ent ) ) then return false end\n\n\t\treturn !ent:IsOnFire() \n\tend,\n\tAction = function( self, ent ) -- The action to perform upon using the property ( Clientside )\n\n\t\tself:MsgStart()\n\t\t\tnet.WriteEntity( ent )\n\t\tself:MsgEnd()\n\n\tend,\n\tReceive = function( self, length, ply ) -- The action to perform upon using the property ( Serverside )\n\t\tlocal ent = net.ReadEntity()\n\n\t\tif ( !properties.CanBeTargeted( ent, ply ) ) then return end\n\t\tif ( !self:Filter( ent, ply ) ) then return end\n\n\t\tent:Ignite( 360 )\n\tend \n} )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CanBeTargeted","parent":"properties","type":"libraryfunc","description":"Returns true if given entity can be targeted by the player via the properties system.\n\nThis should be used serverside in your properties to prevent abuse by clientside scripting.","realm":"Shared","file":{"text":"lua/includes/modules/properties.lua","line":"104-L120"},"args":{"arg":[{"text":"The entity to test","name":"ent","type":"Entity"},{"text":"If given, will also perform a distance check based on the entity's Orientated Bounding Box.","name":"ply","type":"Player"}]},"rets":{"ret":{"text":"True if entity can be targeted, false otherwise","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetHovered","parent":"properties","type":"libraryfunc","description":"Returns an entity player is hovering over with their cursor.","realm":"Client","file":{"text":"lua/includes/modules/properties.lua","line":"122-L156"},"args":{"arg":[{"text":"Eye position of local player, Entity:EyePos","name":"pos","type":"Vector"},{"text":"Aim vector of local player, Player:GetAimVector","name":"aimVec","type":"Vector"}]},"rets":{"ret":{"text":"The hovered entity","name":"","type":"Entity"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnScreenClick","parent":"properties","type":"libraryfunc","description":"Checks if player hovers over any entities and open a properties menu for it.","realm":"Shared","file":{"text":"lua/includes/modules/properties.lua","line":"93-L100"},"args":{"arg":[{"text":"The eye pos of a player","name":"eyepos","type":"Vector"},{"text":"The aim vector of a player","name":"eyevec","type":"Vector"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OpenEntityMenu","parent":"properties","type":"libraryfunc","description":"Opens properties menu for given entity.","realm":"Shared","file":{"text":"lua/includes/modules/properties.lua","line":"74-L91"},"args":{"arg":[{"text":"The entity to open menu for","name":"ent","type":"Entity"},{"text":"The trace that is passed as second argument to Action callback of a property","name":"tr","type":"table"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Remove","parent":"properties","type":"libraryfunc","description":"Remove an entity right-click property. See properties.Add for details.","realm":"Shared","added":"2024.09.12","args":{"arg":{"text":"A unique name used to identify the property to be removed.","name":"name","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddBeam","parent":"render","type":"libraryfunc","description":"Adds a Beam Segment to the Beam started by render.StartBeam.\n\n\t\tFor more detailed information on Beams, as well as usage examples, see the Beams Render Reference.","realm":"Client","args":{"arg":[{"text":"Beam start position.","name":"startPos","type":"Vector"},{"text":"The width of the beam.","name":"width","type":"number"},{"text":"The end coordinate of the texture used.","name":"textureEnd","type":"number"},{"text":"The color to be used.","name":"color","type":"Color"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"BlurRenderTarget","parent":"render","type":"libraryfunc","description":{"text":"Blurs the render target ( or a given texture ).","warning":"Calling this on a RenderTarget created with TEXTUREFLAGS_POINTSAMPLE will result in strange visual glitching."},"realm":"Client","file":{"text":"lua/includes/extensions/client/render.lua","line":"88-L107"},"args":{"arg":[{"text":"The texture to blur.","name":"rendertarget","type":"ITexture"},{"text":"Horizontal amount of blur.","name":"blurx","type":"number"},{"text":"Vertical amount of blur.","name":"blury","type":"number"},{"text":"Amount of passes to go through.","name":"passes","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"BrushMaterialOverride","parent":"render","type":"libraryfunc","description":"This function overrides the brush material for next render operations. It can be used with Entity:DrawModel.","realm":"Client","args":{"arg":{"name":"mat","type":"IMaterial","default":"nil"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Capture","parent":"render","type":"libraryfunc","description":{"text":"Captures a part of the current render target and returns the data as a binary string in the given format.\n\nSince the pixel buffer clears itself every frame, this will return a black screen outside of render hooks. To capture the user's final view, use GM:PostRender. This will not capture the Steam overlay or third-party injections (such as the Discord overlay, Overwolf, and advanced cheats) on the user's screen.","warning":["In PNG mode, this function can produce unexpected result where foreground is rendered as transparent.\nThis is caused by render.SetWriteDepthToDestAlpha set to `true` when doing most of render operations, including rendering in `_rt_fullframefb`. If you want to capture render target's content as PNG image only for output quality, set Structures/RenderCaptureData's `alpha` to `false` when capturing render targets with render.SetWriteDepthToDestAlpha set to `true`.","This function will return nil if escape menu is open"]},"realm":"Client","args":{"arg":{"text":"Parameters of the capture. See Structures/RenderCaptureData.","name":"captureData","type":"table"}},"rets":{"ret":{"text":"The binary data.","name":"","type":"string"}}},"example":{"description":"How you could use this to save a picture of your screen.","code":"local ScreenshotRequested = false\nfunction RequestAScreenshot()\n\tgui.HideGameUI()\n\tScreenshotRequested = true\nend\n\n-- For the sake of this example, we use a console command to request a screenshot\nconcommand.Add( \"make_screenshot\", RequestAScreenshot )\n\nhook.Add( \"PostRender\", \"example_screenshot\", function()\n\tif ( !ScreenshotRequested ) then return end\n\tScreenshotRequested = false\n\n\tlocal data = render.Capture( {\n\t\tformat = \"png\",\n\t\tx = 0,\n\t\ty = 0,\n\t\tw = ScrW(),\n\t\th = ScrH(),\n        alpha = false -- only needed for the png format to prevent the depth buffer leaking in, see BUG\n\t} )\n\n\tfile.Write( \"image.png\", data )\nend )","output":"You should now have `image.png` in your `garrysmod/data` folder, containing a screenshot."},"realms":["Client"],"type":"Function"},
{"function":{"name":"CapturePixels","parent":"render","type":"libraryfunc","description":{"text":"Dumps the current render target and allows the pixels to be accessed by render.ReadPixel. \n\n\tCapturing outside a render hook will return an image filled with `0 0 0 255`.\n\n\tSee also render.Capture.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Clear","parent":"render","type":"libraryfunc","description":{"text":"Clears the current render target and the specified buffers.","bug":{"text":"This sets the alpha incorrectly for surface draw calls for render targets.","issue":"2085"}},"realm":"Client and Menu","args":{"arg":[{"text":"Red component to clear to.","name":"r","type":"number"},{"text":"Green component to clear to.","name":"g","type":"number"},{"text":"Blue component to clear to.","name":"b","type":"number"},{"text":"Alpha component to clear to.","name":"a","type":"number"},{"text":"Clear the depth.","name":"clearDepth","type":"boolean","default":"false"},{"text":"Clear the stencil.","name":"clearStencil","type":"boolean","default":"false"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ClearBuffersObeyStencil","parent":"render","type":"libraryfunc","description":{"text":"Tests every pixel of the active Render Target against the current Stencil configuration and sets the Color Channel values and, optionally, the Depth Buffer values for every pixel that passes.\n\n\t\tFor more detailed information on the Stencil system, including usage examples, see the Stencils Render Reference page","note":"This function does **not** clear the Stencil Buffer on its own.  \n\t\t\tIf you would like to clear the Stencil Buffer, you can use render.ClearStencil"},"realm":"Client and Menu","args":{"arg":[{"text":"The red Color Channel value for each pixel that is cleared.  \n\t\t\tMust be an integer value in the range 0-255 (`byte`).","name":"red","type":"number"},{"text":"The green Color Channel value for each pixel that is cleared.  \n\t\t\tMust be an integer value in the range 0-255 (`byte`).","name":"green","type":"number"},{"text":"The blue Color Channel value for each pixel that is cleared.  \n\t\t\tMust be an integer value in the range 0-255 (`byte`).","name":"blue","type":"number"},{"text":"The alpha (translucency) Color Channel value for each pixel that is cleared.  \n\t\t\tMust be an integer value in the range 0-255 (`byte`).","name":"alpha","type":"number"},{"text":"If true, reset the Depth Buffer values.","name":"clearDepth","type":"boolean"}]}},"example":{"description":"Clearing a section of the screen via the stencil buffer (from \n[Lex's Stencil Tutorial](https://github.com/Lexicality/stencil-tutorial)).","code":"hook.Add( \"PostDrawOpaqueRenderables\", \"Stencil Tutorial Example\", function()\n\t-- Reset everything to known good\n\trender.SetStencilWriteMask( 0xFF )\n\trender.SetStencilTestMask( 0xFF )\n\trender.SetStencilReferenceValue( 0 )\n\trender.SetStencilCompareFunction( STENCIL_ALWAYS )\n\trender.SetStencilPassOperation( STENCIL_KEEP )\n\trender.SetStencilFailOperation( STENCIL_KEEP )\n\trender.SetStencilZFailOperation( STENCIL_KEEP )\n\trender.ClearStencil()\n\n\t-- Enable stencils\n\trender.SetStencilEnable( true )\n\t-- Set the reference value to 1. This is what the compare function tests against\n\trender.SetStencilReferenceValue( 1 )\n\t-- Refuse to write things to the screen unless that pixel's value is 1\n\trender.SetStencilCompareFunction( STENCIL_EQUAL )\n\t-- Write a 1 to the centre third of the screen. Because we cleared it earlier, everything is currently 0\n\tlocal w, h = ScrW() / 3, ScrH() / 3\n\tlocal x_start, y_start = w, h\n\tlocal x_end, y_end = x_start + w, y_start + h\n\trender.ClearStencilBufferRectangle( x_start, y_start, x_end, y_end, 1 )\n\n\t-- Tell the render library to clear the screen, but obeying the stencil test function.\n\t-- This means it will only clear the centre third.\n\trender.ClearBuffersObeyStencil( 0, 148, 133, 255, false )\n\n\t-- Let everything render normally again\n\trender.SetStencilEnable( false )\nend )","output":{"image":{"src":"clearbuffersobeystencil.jpg","alt":"800px"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ClearDepth","parent":"render","type":"libraryfunc","description":"Resets the depth buffer.","realm":"Client and Menu","args":{"arg":{"text":"Whether to also clear the stencil buffer.","type":"boolean","name":"clearStencil","default":"true"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ClearRenderTarget","parent":"render","type":"libraryfunc","description":"Clears a render target.\n\nIt uses render.Clear then render.SetRenderTarget on the modified render target.","realm":"Client","file":{"text":"lua/includes/extensions/client/render.lua","line":"27-L39"},"args":{"arg":[{"name":"texture","type":"ITexture"},{"text":"The color.","name":"color","type":"color"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ClearStencil","parent":"render","type":"libraryfunc","description":"Sets the Stencil Buffer value to `0` for all pixels in the currently active Render Target.\n\t\t\n\t\tFor more detailed information on the Stencil system, including usage examples, see the Stencils Render Reference page.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ClearStencilBufferRectangle","parent":"render","type":"libraryfunc","description":"Sets the Stencil Buffer value for every pixel in a given rectangle to a given value.\n\nThis is **not** affected by render.SetStencilWriteMask.\n\nFor more detailed information on the Stencil system, including usage examples, see the Stencils Render Reference page.","realm":"Client and Menu","args":{"arg":[{"text":"The X coordinate of the top left corner of the rectangle to be cleared.","name":"startX","type":"number"},{"text":"The Y coordinate of the top left corner of the rectangle to be cleared.","name":"startY","type":"number"},{"text":"The X coordinate of the bottom right corner of the rectangle to be cleared.  \n\t\t\t**Note:** Unlike some other rectangle-based functions, this is **not** the width of the rectangle.","name":"endX","type":"number"},{"text":"The Y coordinate of the bottom right corner of the rectangle to be cleared.  \n\t\t\t**Note:** Unlike some other rectangle-based functions, this is **not** the height of the rectangle.","name":"endY","type":"number"},{"text":"The Stencil Buffer value that all pixels within the rectangle will be set to.","name":"stencilBufferValue","type":"number"}]}},"example":{"name":"Horizontal Wipe","description":"This example demonstrates using this function to perform a \"wipe\" transition between two drawn elements.","code":"local COLOR_BLUE = Color( 65, 98, 214 )\nlocal COLOR_RED = Color( 214, 44, 100 )\n\nlocal colorMaterial = Material( \"color\" )\n\nhook.Add( \"PostDrawTranslucentRenderables\", \"StencilExampleClearStencilBufferRectangle\", function()\n\n    -- Reset the Stencil system's settings\n    render.SetStencilTestMask( 255 )\n    render.SetStencilWriteMask( 255 )\n    render.SetStencilFailOperation( STENCILOPERATION_KEEP )\n    render.SetStencilPassOperation( STENCILOPERATION_KEEP )\n    render.SetStencilZFailOperation( STENCILOPERATION_KEEP )\n\n    -- Reset all Stencil Buffer values to 0\n    render.ClearStencil()\n\n    -- Only pass pixels whose Stencil Buffer value equals the Stencil Reference value\n    render.SetStencilCompareFunction( STENCILCOMPARISONFUNCTION_EQUAL )\n\n    -- We're going to mask everything to the left and right of this X coordinate\n    -- It starts at the middle of the screen and moves back and forth thanks to math.sin\n    local verticalSplitX = ScrW()/2 + math.sin( CurTime() ) * ScrW()/8\n\n    -- Set the Stencil Buffer value for all pixels on the left side of the vertical split to 1\n    render.ClearStencilBufferRectangle( 0, 0, verticalSplitX, ScrH(), 1 )\n\n    -- Set the Stencil Buffer value for all pixels on the right side of the vertical split to 2\n    render.ClearStencilBufferRectangle( verticalSplitX, 0, ScrW(), ScrH(), 2 )\n\n    cam.Start2D()\n    render.SetStencilEnable( true )\n\n    -- Only render on pixels whose Stencil Buffer value equals 1 (The left side)\n    render.SetStencilReferenceValue( 1 )\n\n    -- Draw a rectangle in the center of the screen, which will be masked to only the left half of the screen\n    surface.SetDrawColor( COLOR_BLUE )\n    surface.SetMaterial( colorMaterial )\n    surface.DrawTexturedRectRotated( ScrW()/2, ScrH()/2, ScrW()/8, ScrW()/8, math.sin( CurTime() ) * 360 )\n\n    -- Only render on pixels whose Stencil Buffer value equals 2 (The right side)\n    render.SetStencilReferenceValue( 2 )\n\n    -- Draw a rectangle in the center of the screen, which will be masked to only the right half of the screen\n    surface.SetDrawColor( COLOR_RED )\n    surface.DrawTexturedRectRotated( ScrW()/2, ScrH()/2, ScrW()/8, ScrW()/8, math.cos( CurTime() ) * 360 )\n\n    render.SetStencilEnable( false )\n    cam.End2D()\nend )","output":{"text":"In the image below you can see the vertical split moving across the center of the screen revealing and hiding the two rectangles that are both being drawn in the same position.","image":{"src":"b2b4c/8dc4e65bb50b87e.gif","size":"11711390","name":"HorizontalWipeExample.gif"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ComputeDynamicLighting","parent":"render","type":"libraryfunc","description":"Calculates the lighting caused by dynamic lights (such as Global.DynamicLight and the Light Sandbox tool) for the specified surface. This will not include map ambient light.\n\nSee also render.ComputeLighting for a function that also includes map's ambient lighting.","realm":"Client","args":{"arg":[{"text":"The position to sample from.","name":"position","type":"Vector"},{"text":"The normal of the surface.","name":"normal","type":"Vector"}]},"rets":{"ret":{"text":"A vector representing the light at that point.","name":"","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ComputeLighting","parent":"render","type":"libraryfunc","description":"Calculates the light color at a certain position.\n\nThis includes both ambient light and dynamic light.\n\nSee render.ComputeDynamicLighting for dynamic light only.\n\nSee render.GetAmbientLightColor for map-wide ambient color.","realm":"Client","args":{"arg":[{"text":"The position to get the light at.","name":"position","type":"Vector"},{"text":"The direction of an imaginary surface to get the light at.\n\nPointing away from walls will get the lighting the wall receives. Pointing towards walls will not.","name":"normal","type":"Vector"}]},"rets":{"ret":{"text":"A vector representing the light at that point.","name":"","type":"Vector"}}},"example":{"description":"Visualizes light level at the spot player is looking at.","code":"hook.Add( \"HUDPaint\", \"test_navmesh\", function()\n\tlocal ply = LocalPlayer()\n\tlocal tr = ply:GetEyeTrace()\n\n\tlocal startPos = tr.HitPos\n\n\tlocal color = render.ComputeLighting( startPos, tr.HitNormal )\n\tlocal colorDyn = render.ComputeDynamicLighting( startPos, tr.HitNormal )\n\tlocal colorAmbi = color - colorDyn\n\n\tlocal pos2D = startPos:ToScreen()\n\tpos2D.x = pos2D.x + 30\n\n\tdraw.RoundedBox( 4, pos2D.x - 25, pos2D.y - 5, 250, 60, Color(0,0,0, 200 ) )\n\n\tdraw.SimpleText( \"Color: \" .. tostring(color), \"Default\", pos2D.x, pos2D.y, color_white )\n\tdraw.SimpleText( \"Dynamic Color: \" .. tostring(colorDyn), \"Default\", pos2D.x, pos2D.y + 20, color_white )\n\tdraw.SimpleText( \"Ambient Color: \" .. tostring(colorAmbi), \"Default\", pos2D.x, pos2D.y + 40, color_white )\n\n\tdraw.RoundedBox( 4, pos2D.x - 20, pos2D.y, 10, 10, Color( color.x * 255, color.y * 255, color.z * 255 ) )\n\tdraw.RoundedBox( 4, pos2D.x - 20, pos2D.y + 20, 10, 10, Color( colorDyn.x * 255, colorDyn.y * 255, colorDyn.z * 255 ) )\n\tdraw.RoundedBox( 4, pos2D.x - 20, pos2D.y + 40, 10, 10, Color( colorAmbi.x * 255, colorAmbi.y * 255, colorAmbi.z * 255 ) )\nend )","output":{"upload":{"src":"70c/8ded78d9538dee7.gif","size":"3507824","name":"July01-2855-gmod_win64.gif"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ComputePixelDiameterOfSphere","parent":"render","type":"libraryfunc","description":{"text":"Calculates diameter of a 3D sphere on a 2D screen.","rendercontext":{"hook":"false","type":"3D"}},"realm":"Client","added":"2023.09.06","args":{"arg":[{"text":"The position of the sphere in 3D space.","name":"point","type":"Vector"},{"text":"The radius of the sphere in 3D space.","name":"radius","type":"number"}]},"rets":{"ret":{"text":"The diameter of the sphere in 2D screen space.","type":"number"}}},"example":{"code":"hook.Add( \"HUDPaint\", \"HUDPaint_PixelDiameterOfSphereExample\", function()\n\n\tlocal point = Vector( 0, 0, 0 )\n\t\n\tcam.Start3D()\n\tlocal diameter = render.ComputePixelDiameterOfSphere( point, 10 ) \n\tcam.End3D()\n\n\tlocal pos2D = point:ToScreen()\t\n\tsurface.DrawCircle( pos2D.x, pos2D.y, diameter / 2, Color( 255, 120, 0 ) )\n\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"CopyRenderTargetToTexture","parent":"render","type":"libraryfunc","description":{"text":"Copies the currently active Render Target to the specified texture.","warning":"This does not copy the Depth buffer, no method for that is known at this moment so a common workaround is to store the source texture somewhere else, perform your drawing operations, save the result somewhere else and reapply the source texture."},"realm":"Client","args":{"arg":{"text":"The texture to copy to.","name":"Target","type":"ITexture"}}},"example":{"description":"This is how it's used in render.CopyTexture.","code":"function render.CopyTexture( from, to )\n\n\tlocal OldRT = render.GetRenderTarget()\n\n\t\trender.SetRenderTarget( from )\n\t\trender.CopyRenderTargetToTexture( to )\n\n\trender.SetRenderTarget( OldRT )\n\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"CopyTexture","parent":"render","type":"libraryfunc","description":{"text":"Copies the contents of one texture to another. Only works with rendertargets.","warning":"This does not copy the Depth buffer, no method for that is known at this moment so a common workaround is to store the source texture somewhere else, perform your drawing operations, save the result somewhere else and reapply the source texture."},"realm":"Client","file":{"text":"lua/includes/extensions/client/render.lua","line":"61-L70"},"args":{"arg":[{"text":"The texture to copy from.","name":"texture_from","type":"ITexture"},{"text":"The texture being copied to.","name":"texture_to","type":"ITexture"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"CullMode","parent":"render","type":"libraryfunc","description":"Sets the cull mode. The culling mode defines how back faces are culled when rendering geometry.","realm":"Client and Menu","args":{"arg":{"text":"Cullmode, see Enums/MATERIAL_CULLMODE.","name":"cullMode","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DepthRange","parent":"render","type":"libraryfunc","description":"Set's the depth range of the upcoming render.","realm":"Client","args":{"arg":[{"text":"The minimum depth of the upcoming render. `0.0` = render normally; `1.0` = render nothing.","name":"depthmin","type":"number"},{"text":"The maximum depth of the upcoming render. `0.0` = render everything (through walls); `1.0` = render normally.","name":"depthmax","type":"number"}]}},"example":[{"description":"Perform a downward screen wipe effect on all opaque objects once the client connects.","code":"local depthmin = 1.0\n\nhook.Add( \"PreDrawOpaqueRenderables\", \"simple_effect\", function( bDrawingDepth, bDrawingSkybox )\n\trender.DepthRange( depthmin, 1.0 )\n\t\n\tif ( depthmin > 0.0 ) then\n\t\tdepthmin = depthmin - 0.001\n\tend\nend )"},{"description":"Same effect as above but with a dark shadow skin present where the model is being drawn.","code":"local depthmin = 1.0\nlocal spawn_copies = {}\t-- The shadow copies\nlocal custom_white_color = Color( 255, 255, 255, 92 )\n\nhook.Add( \"PreDrawOpaqueRenderables\", \"advanced_effect\", function( bDrawingDepth, bDrawingSkybox )\n\trender.DepthRange( depthmin, 1.0 )\n\t\n\tif ( !spawn_copies ) then return false end\n\t\n\tif ( depthmin > 0.0 ) then\n\t\tdepthmin = depthmin - 0.001\n\telse\n\t\tlocal alpha = 0\n\t\tlocal valid_copies = 0\n\t\t\n\t\t-- Fade out the shadow copies and remove them.\n\t\tfor _, spawncopy in ipairs(spawn_copies) do\n\t\t\tif ( IsValid( spawncopy ) ) then\n\t\t\t\talpha = spawncopy:GetColor().a\n\n\t\t\t\tif ( alpha > 0 ) then\n\t\t\t\t\tspawncopy:SetColor( Color( 255, 255, 255, alpha - 1 ) )\n\t\t\t\telse\n\t\t\t\t\tspawncopy:Remove()\n\t\t\t\tend\n\n\t\t\t\tvalid_copies = valid_copies + 1\n\t\t\tend\n\t\tend\n\t\t\n\t\t-- Nullify table since we aren't using it anymore.\n\t\tif ( valid_copies == 0 ) then\n\t\t\tspawn_copies = nil\n\t\tend\t\n\tend\nend )\n\nhook.Add( \"OnEntityCreated\", \"advanced_effect\", function( ent )\n\tif ( !spawn_copies ) then return end\n\t\n\t-- Prevents infinite loop and other errors.\n\tif ( ent:GetClass() ~= \"class C_BaseFlex\" and\n\t\tent:GetRenderGroup() == RENDERGROUP_OPAQUE and\n\t\tent:GetClass() ~= \"gmod_hands\" ) then\n\t\n\t\tlocal mdl = ent:GetModel()\n\t\t\n\t\t-- Check that the entity is a model and not a brush.\n\t\tif ( string.EndsWith( mdl, \".mdl\" ) ) then\n\t\t\tlocal spawncopy = ClientsideModel( mdl )\n\t\t\t\n\t\t\t-- A material with $ignorez set to 1 works best here.\n\t\t\tspawncopy:SetMaterial( \"models/overlay_rendertarget\" )\n\t\t\tspawncopy:AddEffects( EF_BONEMERGE )\n\t\t\tspawncopy:SetParent( ent )\n\t\t\tspawncopy:SetRenderMode( RENDERMODE_TRANSALPHA )\n\t\t\tspawncopy:SetColor( custom_white_color )\n\n\t\t\ttable.insert( spawn_copies, spawncopy )\n\t\tend\n\tend\nend )","output":{"upload":{"src":"DepthRange_example.webm","name":"DepthRange_example.webm"}}}],"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawBeam","parent":"render","type":"libraryfunc","description":{"text":"Draws a single-segment Beam made out of a textured, billboarded quad stretching between two points.\n\n\t\tFor more detailed information, including usage examples, see the Beams Render Reference.","rendercontext":{"hook":"false","type":"3D"}},"realm":"Client","args":{"arg":[{"text":"The Beam's start position.","name":"startPos","type":"Vector"},{"text":"The Beam's end position.","name":"endPos","type":"Vector"},{"text":"The width of the Beam.","name":"width","type":"number"},{"text":"The starting coordinate of the Beam's texture.","name":"textureStart","type":"number"},{"text":"The end coordinate of the Beam's texture.","name":"textureEnd","type":"number"},{"text":"What Color to tint the Beam.","name":"color","type":"Color","default":"Color( 255, 255, 255 )"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawBox","parent":"render","type":"libraryfunc","description":{"text":"Draws a box in 3D space.","rendercontext":{"hook":"false","type":"3D"}},"realm":"Client","args":{"arg":[{"text":"Origin of the box.","name":"position","type":"Vector"},{"text":"Orientation of the box.","name":"angles","type":"Angle"},{"text":"Start position of the box, relative to origin.","name":"mins","type":"Vector"},{"text":"End position of the box, relative to origin.","name":"maxs","type":"Vector"},{"text":"The color of the box.","name":"color","type":"Color","default":"Color( 255, 255, 255 )"}]}},"example":{"description":"Draws a white box at the position you are looking.","code":"local x = Vector( 5, 5, 5 )\n\nhook.Add( \"PostDrawTranslucentRenderables\", \"Boxxie\", function()\n    local pos = LocalPlayer():GetEyeTrace().HitPos -- position to render box at\n\n    render.SetColorMaterial() -- white material for easy coloring\n\n    cam.IgnoreZ( true ) -- makes next draw calls ignore depth and draw on top\n    render.DrawBox( pos, angle_zero, x, -x, color_white ) -- draws the box \n    cam.IgnoreZ( false ) -- disables previous call\nend )","output":{"upload":{"src":"22674/8d9d79b16d43f75.png","size":"860258","name":"image.png"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawLine","parent":"render","type":"libraryfunc","description":{"text":"Draws a line in 3D space.","rendercontext":{"hook":"false","type":"3D"}},"realm":"Client","args":{"arg":[{"text":"Line start position in world coordinates.","name":"startPos","type":"Vector"},{"text":"Line end position in world coordinates.","name":"endPos","type":"Vector"},{"text":"The color to be used. Uses Color.","name":"color","type":"Color","default":"Color( 255, 255, 255 )"},{"text":"Whether or not to consider the Z buffer. If false, the line will be drawn over everything currently drawn, if true, the line will be drawn with depth considered, as if it were a regular object in 3D space.","name":"writeZ","type":"boolean","default":"false","bug":{"text":"Enabling this option will cause the line to ignore the color's alpha.","issue":"1086"}}]}},"example":{"description":"A Simple Line of code drawing a line starting for the eyes of the player and going forward.","code":"local color_red = Color(255, 0, 0)\n\nhook.Add( \"PostDrawTranslucentRenderables\", \"MySuper3DRenderingHook\", function()\n\tlocal eyePos = LocalPlayer():EyePos()\n\n    render.DrawLine( eyePos, eyePos + LocalPlayer():EyeAngles():Forward() * 100, color_red )\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawQuad","parent":"render","type":"libraryfunc","description":{"text":"Draws 2 connected triangles. Expects material to be set by render.SetMaterial.","rendercontext":{"hook":"false","type":"3D"}},"realm":"Client","args":{"arg":[{"text":"First vertex.","name":"vert1","type":"Vector"},{"text":"The second vertex.","name":"vert2","type":"Vector"},{"text":"The third vertex.","name":"vert3","type":"Vector"},{"text":"The fourth vertex.","name":"vert4","type":"Vector"},{"text":"The color of the quad.","name":"color","type":"Color","default":"Color( 255, 255, 255 )"}]}},"example":{"description":"Draw a red half transparent quad facing upwards 150 units below the 0,0,0 of gm_construct.","code":"local ourMat = Material( \"vgui/white\" ) -- Calling Material() every frame is quite expensive\nhook.Add( \"PostDrawTranslucentRenderables\", \"DrawQuad_Example\", function()\n\n\trender.SetMaterial( ourMat ) -- If you use Material, cache it!\n\trender.DrawQuad( Vector( 0, 0, -150 ), Vector( 0, 100, -150 ),Vector( 100, 100, -150 ), Vector( 100, 0, -150 ), Color( 255, 0, 0, 128 ) )\n\nend)"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawQuadEasy","parent":"render","type":"libraryfunc","description":{"text":"Draws a quad. Expects material to be set by render.SetMaterial.","rendercontext":{"hook":"false","type":"3D"}},"realm":"Client","args":{"arg":[{"text":"Origin of the sprite.","name":"position","type":"Vector"},{"text":"The face direction of the quad.","name":"normal","type":"Vector"},{"text":"The width of the quad.","name":"width","type":"number"},{"text":"The height of the quad.","name":"height","type":"number"},{"text":"The color of the quad.","name":"color","type":"Color"},{"text":"The rotation of the quad counter-clockwise in degrees around the normal axis. In other words, the quad will always face the same way but this will rotate its corners.","name":"rotation","type":"number","default":"0"}]}},"example":{"description":"Example usage of this function.","code":"local mat = Material( \"sprites/sent_ball\" )\nlocal mat2 = Material( \"models/wireframe\" )\nhook.Add(\"PostDrawTranslucentRenderables\", \"DrawQuadEasyExample\", function()\n\n\t-- Draw a rotating circle under local player\n\trender.SetMaterial( mat )\n\tlocal pos = LocalPlayer():GetPos()\n\trender.DrawQuadEasy( pos + Vector( 0, 0, 1 ), Vector( 0, 0, 1 ), 64, 64, Color( 255, 255, 255, 200 ), ( CurTime() * 50 ) % 360 )\n\n\t-- Draw 3 rotating wireframe quads where local player is looking at\n\trender.SetMaterial( mat2 )\n\tlocal tr = LocalPlayer():GetEyeTrace()\n\trender.DrawQuadEasy( tr.HitPos + tr.HitNormal, tr.HitNormal, 64, 64, Color( 255, 255, 255 ), ( CurTime() * 50 ) % 360 )\n\n\tlocal dir = tr.HitNormal:Angle()\n\tdir:RotateAroundAxis( tr.HitNormal, ( CurTime() * 50 ) % 360 )\n\tdir = dir:Up()\n\n\t-- We need to call this function twice, once for each side\n\trender.DrawQuadEasy( tr.HitPos + tr.HitNormal * 32, dir, 64, 64, Color( 255, 255, 255 ), 0 )\n\trender.DrawQuadEasy( tr.HitPos + tr.HitNormal * 32, -dir, 64, 64, Color( 255, 255, 255 ), 0 )\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawScreenQuad","parent":"render","type":"libraryfunc","description":{"text":"Draws the current material set by render.SetMaterial to the whole screen. The color cannot be customized.\n\nSee also render.DrawScreenQuadEx.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client","args":{"arg":{"text":"If set to true, when rendering a poster the quad will be properly drawn in parts in the poster. This is used internally by some Post Processing effects. Certain special textures (frame buffer like textures) do not need this adjustment.","name":"applyPoster","default":"false","type":"boolean","added":"2020.06.24"}}},"example":{"description":"Example usage, draws a wireframe texture onto the entire screen.","code":"local ourMat = Material( \"models/wireframe\" )\n\nhook.Add( \"HUDPaint\", \"example_hook\", function()\n\trender.SetMaterial( ourMat )\n\trender.DrawScreenQuad()\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawScreenQuadEx","parent":"render","type":"libraryfunc","description":{"text":"Draws the current material set by render.SetMaterial to the area specified. Color cannot be customized.\n\nSee also render.DrawScreenQuad.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client","args":{"arg":[{"text":"X start position of the rect.","name":"startX","type":"number"},{"text":"Y start position of the rect.","name":"startY","type":"number"},{"text":"Width of the rect.","name":"width","type":"number"},{"text":"Height of the rect.","name":"height","type":"number"}]}},"example":{"description":"Example usage, draws a 256x256 rectangle with the wireframe material.","code":"local ourMat = Material( \"models/wireframe\" )\nhook.Add( \"HUDPaint\", \"example_hook\", function()\n\trender.SetMaterial( ourMat )\n\trender.DrawScreenQuadEx( 100, 100, 256, 256 )\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawSphere","parent":"render","type":"libraryfunc","description":{"text":"Draws a sphere in 3D space. The material previously set with render.SetMaterial will be applied the sphere's surface.\n\nSee also render.DrawWireframeSphere for a wireframe equivalent.","rendercontext":{"hook":"false","type":"3D"}},"realm":"Client","args":{"arg":[{"text":"Position of the sphere.","name":"position","type":"Vector"},{"text":"Radius of the sphere. Negative radius will make the sphere render inwards rather than outwards.","name":"radius","type":"number"},{"text":"The number of longitude steps. This controls the quality of the sphere. Higher quality will lower performance significantly. 50 is a good number to start with.","name":"longitudeSteps","type":"number"},{"text":"The number of latitude steps. This controls the quality of the sphere. Higher quality will lower performance significantly. 50 is a good number to start with.","name":"latitudeSteps","type":"number"},{"text":"The color of the sphere.","name":"color","type":"Color","default":"Color( 255, 255, 255 )"}]}},"example":{"description":"This will draw a blue, half-translucent sphere (force field) at the position local player is looking.","code":"hook.Add( \"PostDrawTranslucentRenderables\", \"test\", function()\n\n\t--[[\n\t\twhen you draw a sphere, you have to specify what material the sphere is\n\t\tgoing to have before rendering it, render.SetColorMaterial()\n\t\tjust sets it to a white material so we can recolor it easily.\n\t--]]\n\trender.SetColorMaterial()\n\n\t-- The position to render the sphere at, in this case, the looking position of the local player\n\tlocal pos = LocalPlayer():GetEyeTrace().HitPos\n\n\t-- Draw the sphere!\n\trender.DrawSphere( pos, 50, 30, 30, Color( 0, 175, 175, 100 ) )\n\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawSprite","parent":"render","type":"libraryfunc","description":{"text":"Draws a sprite in 3D space.","rendercontext":{"hook":"false","type":"3D"}},"realm":"Client","args":{"arg":[{"text":"Position of the sprite.","name":"position","type":"Vector"},{"text":"Width of the sprite.","name":"width","type":"number"},{"text":"Height of the sprite.","name":"height","type":"number"},{"text":"Color of the sprite.","name":"color","type":"Color","default":"Color( 255, 255, 255 )"}]}},"example":[{"description":"Draw a sprite at the center of the map.","code":"local pos, material = Vector( 0, 0, 0 ), Material( \"sprites/splodesprite\" ) --Define this sort of stuff outside of loops to make more efficient code.\nhook.Add( \"HUDPaint\", \"paintsprites\", function()\n\tcam.Start3D() -- Start the 3D function so we can draw onto the screen.\n\t\trender.SetMaterial( material ) -- Tell render what material we want, in this case the flash from the gravgun\n\t\trender.DrawSprite( pos, 16, 16, color_white ) -- Draw the sprite in the middle of the map, at 16x16 in it's original colour with full alpha.\n\tcam.End3D()\nend )","output":"An orange star appears at 0,0,0 on the map."},{"description":"Function that displays a sprite at the given position, without the need of a specific rendering context.\n\n`draw.VectorSprite`( Vector position, number size, Color color, boolean constantSize )","code":"local toDraw3d = {}\nlocal sprites3d = 0\n\nlocal toDraw2d = {}\nlocal sprites2d = 0\n\nlocal material = Material( \"sprites/light_ignorez\" )\n\nfunction draw.VectorSprite( position, size, color, constantSize )\n\tif ( not isvector( position ) ) then\n\t\terror( \"bad argument #1 to draw.DrawVectorSprite (Vector expected, got \" .. type( position ) .. \")\" )\n\tend\n\n\tif ( not isnumber( size ) ) then\n\t\terror( \"bad argument #2 to draw.DrawVectorSprite (number expected, got \" .. type( size ) .. \")\" )\n\tend\n\n\tif ( not IsColor( color ) ) then\n\t\terror( \"bad argument #3 to draw.DrawVectorSprite (Color expected, got \" .. type( color ) .. \")\" )\n\tend\n\n\tlocal tbl = { position, size, color }\n\n\tif ( constantSize ) then\n\t\tsprites2d = sprites2d + 1\n\t\ttoDraw2d[sprites2d] = tbl\n\telse\n\t\tsprites3d = sprites3d + 1\n\t\ttoDraw3d[sprites3d] = tbl\n\tend\nend\n\nlocal render_SetMaterial = render.SetMaterial\nlocal render_DrawSprite = render.DrawSprite\nhook.Add( \"PreDrawEffects\", \"draw.VectorSprite\", function()\n\tif ( sprites3d ~= 0 ) then\n\t\trender_SetMaterial( material )\n\n\t\tfor i = 1, sprites3d do\n\t\t\tlocal info = toDraw3d[i]\n\t\t\ttoDraw3d[i] = nil -- Clear the table every frame\n\n\t\t\trender_DrawSprite(info[1], info[2], info[2], info[3])\n\t\tend\n\n\t\tsprites3d = 0\n\tend\nend )\n\nlocal surface_SetMaterial = surface.SetMaterial\nlocal surface_SetDrawColor = surface.SetDrawColor\nlocal surface_DrawTexturedRect = surface.DrawTexturedRect\nhook.Add( \"DrawOverlay\", \"draw.VectorSprite\", function()\n\tif ( sprites2d ~= 0 ) then\n\t\tsurface_SetMaterial( material )\n\n\t\tfor i = 1, sprites2d do\n\t\t\tlocal info = toDraw2d[i]\n\t\t\ttoDraw2d[i] = nil\n\n\t\t\tlocal pos2d = info[1]:ToScreen()\n\n\t\t\tif pos2d.visible then\n\t\t\t\tsurface_SetDrawColor( info[3] )\n\t\t\t\tsurface_DrawTexturedRect( pos2d.x, pos2d.y, info[2], info[2] )\n\t\t\tend\n\t\tend\n\n\t\tsprites2d = 0\n\tend\nend )"}],"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawTextureToScreen","parent":"render","type":"libraryfunc","description":{"text":"Draws a texture over the whole screen.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client","file":{"text":"lua/includes/extensions/client/render.lua","line":"148-L156"},"args":{"arg":{"text":"The texture to draw.","name":"tex","type":"ITexture"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawTextureToScreenRect","parent":"render","type":"libraryfunc","description":{"text":"Draws a textured rectangle.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client","file":{"text":"lua/includes/extensions/client/render.lua","line":"158-L166"},"args":{"arg":[{"text":"The texture to draw.","name":"tex","type":"ITexture"},{"text":"The x coordinate of the rectangle to draw.","name":"x","type":"number"},{"text":"The y coordinate of the rectangle to draw.","name":"y","type":"number"},{"text":"The width of the rectangle to draw.","name":"width","type":"number"},{"text":"The height of the rectangle to draw.","name":"height","type":"number"}]}},"example":{"summary":"Draws the water reflection and water refractions textures in top corners of the screen.","code":"local mat = CreateMaterial( \"testHackTexture\", \"UnlitGeneric\", {\n\t[\"$basetexture\"] = \"_rt_WaterRefraction\",\n} )\n\nlocal refractTex = mat:GetTexture( \"$basetexture\" )\nmat:SetTexture( \"$basetexture\", \"_rt_WaterReflection\" )\nlocal reflectTex = mat:GetTexture( \"$basetexture\" )\n\nhook.Add( \"HUDPaint\", \"drawWaterReflectRefract\", function()\n\trender.DrawTextureToScreenRect( refractTex, 0, 0, ScrW() / 3, ScrH() / 3 )\n\trender.DrawTextureToScreenRect( reflectTex, ScrW() / 3 * 2, 0, ScrW() / 3, ScrH() / 3 )\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawWireframeBox","parent":"render","type":"libraryfunc","description":{"text":"Draws a wireframe box in 3D space.","rendercontext":{"hook":"false","type":"3D"}},"realm":"Client","args":{"arg":[{"text":"Position of the box.","name":"position","type":"Vector"},{"text":"Angles of the box.","name":"angle","type":"Angle"},{"text":"The lowest corner of the box.","name":"mins","type":"Vector"},{"text":"The highest corner of the box.","name":"maxs","type":"Vector"},{"text":"The color of the box.","name":"color","type":"Color","default":"Color( 255, 255, 255 )"},{"text":"Sets whenever to write to the zBuffer.","name":"writeZ","type":"boolean","default":"false"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawWireframeSphere","parent":"render","type":"libraryfunc","description":{"text":"Draws a wireframe sphere in 3d space.","rendercontext":{"hook":"false","type":"3D"}},"realm":"Client","args":{"arg":[{"text":"Position of the sphere.","name":"position","type":"Vector"},{"text":"The size of the sphere.","name":"radius","type":"number"},{"text":"The amount of longitude steps. \nThe larger this number is, the smoother the sphere is.","name":"longitudeSteps","type":"number"},{"text":"The amount of latitude steps. \nThe larger this number is, the smoother the sphere is.","name":"latitudeSteps","type":"number"},{"text":"The color of the wireframe.","name":"color","type":"Color","default":"Color( 255, 255, 255 )"},{"text":"Whether or not to consider the Z buffer. If false, the wireframe will be drawn over everything currently drawn. If true, it will be drawn with depth considered, as if it were a regular object in 3D space.","name":"writeZ","type":"boolean","default":"false"}]}},"example":{"description":"Draws a wireframe sphere over a normal sphere for an artistic effect.","code":"hook.Add( \"PostDrawTranslucentRenderables\", \"test\", function()\n\n\t-- Set the draw material to solid white\n\trender.SetColorMaterial()\n\n\t-- The position to render the sphere at, in this case, the looking position of the local player\n\tlocal pos = LocalPlayer():GetEyeTrace().HitPos\n\n\tlocal radius = 50\n\tlocal wideSteps = 10\n\tlocal tallSteps = 10\n\n\t-- Draw the sphere!\n\trender.DrawSphere( pos, radius, wideSteps, tallSteps, Color( 0, 175, 175, 100 ) )\n\n\t-- Draw the wireframe sphere!\n\trender.DrawWireframeSphere( pos, radius, wideSteps, tallSteps, Color( 255, 255, 255, 255 ) )\n\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"EnableClipping","parent":"render","type":"libraryfunc","description":{"text":"Sets the status of the clip renderer, returning previous state.","warning":"To prevent unintended rendering behavior of other mods/the game, you must reset the clipping state to its previous value."},"realm":"Client and Menu","args":{"arg":{"text":"New clipping state.","name":"state","type":"boolean"}},"rets":{"ret":{"text":"Previous clipping state.","name":"","type":"boolean"}}},"example":[{"description":"Properly using the function.","code":"-- Inside some rendering hook\n\nlocal oldclip = render.EnableClipping( true )\n\n-- Your code here\n\nrender.EnableClipping( oldclip )"},{"description":"Clips the lower half of your custom entity","code":"function ENT:Draw()\n    local normal = self:GetUp() -- Everything \"behind\" this normal will be clipped\n    local position = normal:Dot( self:GetPos() ) -- self:GetPos() is the origin of the clipping plane\n\n    local oldEC = render.EnableClipping( true )\n    render.PushCustomClipPlane( normal, position )\n\n    self:DrawModel()\n\n    render.PopCustomClipPlane()\n    render.EnableClipping( oldEC )\nend"}],"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"EndBeam","parent":"render","type":"libraryfunc","description":"Ends the beam mesh of a beam started with render.StartBeam.\n\t\t\n\t\tFor more detailed information on Beams, as well as usage examples, see the Beams Render Reference.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"FogColor","parent":"render","type":"libraryfunc","description":"Sets the color of the fog.","realm":"Client","args":{"arg":[{"text":"Red channel of the fog color, 0 - 255.","name":"red","type":"number"},{"text":"Green channel of the fog color, 0 - 255.","name":"green","type":"number"},{"text":"Blue channel of the fog color, 0 - 255.","name":"blue","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"FogEnd","parent":"render","type":"libraryfunc","description":"Sets the at which the fog reaches its max density.","realm":"Client","args":{"arg":{"text":"The distance at which the fog reaches its max density.","name":"distance","type":"number","note":"If used in GM:SetupSkyboxFog, this value **must** be scaled by the first argument of the hook"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"FogMaxDensity","parent":"render","type":"libraryfunc","description":"Sets the maximum density of the fog.","realm":"Client","args":{"arg":{"text":"The maximum density of the fog, 0-1.","name":"maxDensity","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"FogMode","parent":"render","type":"libraryfunc","description":"Sets the mode of fog.","realm":"Client","args":{"arg":{"text":"Fog mode, see Enums/MATERIAL_FOG.","name":"fogMode","type":"number{MATERIAL_FOG}"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"FogStart","parent":"render","type":"libraryfunc","description":"Sets the distance at which the fog starts showing up.","realm":"Client","args":{"arg":{"text":"The distance at which the fog starts showing up.","name":"fogStart","type":"number","note":"If used in GM:SetupSkyboxFog, this value **must** be scaled by the first argument of the hook"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetAmbientLightColor","parent":"render","type":"libraryfunc","description":"Returns the ambient color intensity of the map, basically the color the sky emits.\n\nThis is used by the engine to calculate shadow color using the following formula: `ambientLight * 3 + Vector( 0.3, 0.3, 0.3 )`\n\nSee also render.ComputeLighting.","realm":"Client","rets":{"ret":{"text":"The ambient color intensity of the map.\n\nThis is computed at map compile time and is stored in \"linear color space\".","name":"","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetBlend","parent":"render","type":"libraryfunc","description":"Returns the current alpha blending.","realm":"Client","rets":{"ret":{"text":"Current alpha blending in range 0 to 1.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetBloomTex0","parent":"render","type":"libraryfunc","realm":"Client","description":{"text":"Returns the Render Target texture that is used internally for the Bloom Post Processing effect.","internal":"You can use Global.GetRenderTargetEx if you need to create a Render Target"},"rets":{"ret":{"text":"The render target texture named `s_pBloomTex0`.","name":"","type":"ITexture"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetBloomTex1","parent":"render","type":"libraryfunc","realm":"Client","description":{"text":"Returns the Render Target texture used internally for the Blur Post Processing effect.\n\nDespite its name, this function is not used for the Bloom effect.","internal":"You probably want to just use a custom render target. See Global.GetRenderTargetEx."},"rets":{"ret":{"text":"The render target texture named `s_pBloomTex1`.","name":"","type":"ITexture"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetColorModulation","parent":"render","type":"libraryfunc","description":"Returns the current color modulation values as normals.","realm":"Client","rets":{"ret":[{"text":"Red part of the color.","name":"","type":"number"},{"text":"Green part of the color.","name":"","type":"number"},{"text":"Blue part of the color.","name":"","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetDXLevel","parent":"render","type":"libraryfunc","description":"Returns the maximum available directX version.","realm":"Client and Menu","rets":{"ret":{"text":"The directX version.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetFogColor","parent":"render","type":"libraryfunc","description":"Returns the current fog color.","realm":"Client","rets":{"ret":[{"text":"Red part of the color.","name":"","type":"number"},{"text":"Green part of the color","name":"","type":"number"},{"text":"Blue part of the color","name":"","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetFogDistances","parent":"render","type":"libraryfunc","description":"Returns the fog start and end distance.","realm":"Client","rets":{"ret":[{"text":"Fog start distance set by render.FogStart.","name":"","type":"number"},{"text":"For end distance set by render.FogEnd.","name":"","type":"number"},{"text":"Fog Z distance set by render.SetFogZ.","name":"","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetFogMaxDensity","parent":"render","type":"libraryfunc","description":"Get the maximum density of the fog.","realm":"Client","added":"2025.10.08","rets":{"ret":{"text":"The maximum density of the fog, 0-1.","name":"maxDensity","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetFogMode","parent":"render","type":"libraryfunc","description":"Returns the current fog mode.","realm":"Client","rets":{"ret":{"text":"Fog mode, see Enums/MATERIAL_FOG.\n\n\t\t\tIn 2D post-processing hooks, starting with GM:PreDrawEffects, this will always return MATERIAL_FOG_NONE","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetFullScreenDepthTexture","parent":"render","type":"libraryfunc","description":{"text":"Returns the full screen depth texture.","deprecated":"Alias of render.GetPowerOfTwoTexture in practice."},"realm":"Client","rets":{"ret":{"text":"The `_rt_FullFrameDepth` texture, which is an alias of `_rt_PowerOfTwoFB` on PC.","name":"","type":"ITexture"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetHDREnabled","parent":"render","type":"libraryfunc","description":"Returns whether HDR is currently enabled or not. This takes into account hardware support, current map and current client settings.","realm":"Client and Menu","added":"2020.10.14","rets":{"ret":{"text":"`true` if the player currently has HDR enabled.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetLightColor","parent":"render","type":"libraryfunc","description":{"text":"Gets the light exposure on the specified position.\n\nThis is effectively the same as render.ComputeLighting without the `normal` argument provided.","deprecated":"Same as render.ComputeLighting without the `normal` argument provided, so just use that"},"realm":"Client","args":{"arg":{"text":"The position of the surface to get the light from.","name":"position","type":"Vector"}},"rets":{"ret":{"text":"The light color.","name":"","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetMoBlurTex0","parent":"render","type":"libraryfunc","realm":"Client","description":{"text":"Returns the first render target texture that is used internally for Motion Blur and Frame Blend post processing effects.","internal":"You probably want to just use a custom render target. See Global.GetRenderTargetEx."},"rets":{"ret":{"text":"The render target named `s_pMoBlurTex0`.","name":"","type":"ITexture"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetMoBlurTex1","parent":"render","type":"libraryfunc","realm":"Client","description":{"text":"Returns the second render target texture that is used internally for Motion Blur and Frame Blend post processing effects.","internal":"You probably want to just use a custom render target. See Global.GetRenderTargetEx."},"rets":{"ret":{"text":"The render target named `s_pMoBlurTex1`.","name":"","type":"ITexture"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetMorphTex0","parent":"render","type":"libraryfunc","realm":"Client","description":{"text":"Returns the first render target texture that was used internally for Morph post processing effect\n\nThe post processing effect was removed from the base game at some point during development of Garry's Mod 13, but can still be found as a community mod: https://steamcommunity.com/sharedfiles/filedetails/?id=501088470","internal":"You probably want to just use a custom render target. See Global.GetRenderTargetEx."},"rets":{"ret":{"text":"The render target texture named `s_pMorphTexture0`.","name":"","type":"ITexture"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetMorphTex1","parent":"render","type":"libraryfunc","realm":"Client","description":{"text":"Returns the second render target texture that was used internally for Morph post processing effect.\n\nSee render.GetMorphTex0 for more information..","internal":"You probably want to just use a custom render target. See Global.GetRenderTargetEx."},"rets":{"ret":{"text":"The render target texture named `s_pMorphTexture1`.","name":"","type":"ITexture"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetPowerOfTwoTexture","parent":"render","type":"libraryfunc","description":"Returns the Power Of Two Frame Buffer texture.","realm":"Client","rets":{"ret":{"text":"The power of two texture, which is `_rt_PowerOfTwoFB` by default.","name":"","type":"ITexture"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetRefractTexture","parent":"render","type":"libraryfunc","description":{"text":"Alias of render.GetPowerOfTwoTexture.","deprecated":"Alias of render.GetPowerOfTwoTexture."},"realm":"Client","rets":{"ret":{"text":"The render.GetPowerOfTwoTexture.","name":"","type":"ITexture"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetRenderTarget","parent":"render","type":"libraryfunc","description":"Returns the currently active render target.\n\nInstead of saving the current render target using this function and restoring to it later, it is generally better practice to use render.PushRenderTarget and render.PopRenderTarget.","realm":"Client","rets":{"ret":{"text":"The currently active Render Target.","name":"","type":"ITexture"}}},"example":{"description":"Render something to a different render target, then restore the old render target.","code":"local w, h = ScrW(), ScrH()\nlocal customRt = GetRenderTarget( \"some_unique_render_target_nameeeee\", w, h, true )\n\nrender.PushRenderTarget( customRt )\n    render.Clear( 0, 0, 255, 255, true ) -- fill the background with blue!\n\n    -- draw all props on the blue background!\n    for key, prop in ipairs( ents.FindByClass( \"prop_physics\" ) ) do\n        prop:DrawModel()\n    end\n\n    -- save the picture to the garrysmod/data folder.  ~format=\"jpg\" will not work.\n    local data = render.Capture({ format = \"jpeg\", quality = 70, x = 0, y = 0, h = h, w = w })\t\n    local pictureFile = file.Open( \"RenderTargetsAreAwesome.jpg\", \"wb\", \"DATA\" )\t\n    pictureFile:Write( data )\n    pictureFile:Close()\nrender.PopRenderTarget()"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetResolvedFullFrameDepth","parent":"render","type":"libraryfunc","description":"Returns the `_rt_ResolvedFullFrameDepth` texture for SSAO depth. It will only be updated if GM:NeedsDepthPass returns true. Depth is written using the Shaders/DepthWrite by rendering scene a second time, using [SSAO_DepthPass function](https://github.com/ValveSoftware/source-sdk-2013/blob/11a677c349b149b2f77184dc903e6bb17f8df69b/src/game/client/viewrender.cpp#L5576).","realm":"Client","rets":{"ret":{"text":"The depth texture.","name":"","type":"ITexture"}}},"example":[{"description":"Render the depth pass to the screen.","code":"local function MyNeedsDepthPass()\n    return true\nend\n\n-- Add hook so that the _rt_ResolvedFullFrameDepth texture is updated\nhook.Add( \"NeedsDepthPass\", \"MyNeedsDepthPass\", MyNeedsDepthPass )\n\n\nlocal function RenderSSAOdepth()\n    -- call render.GetResolvedFullFrameDepth() and draw the resulting itexture to the screen\n\n    local texture = render.GetResolvedFullFrameDepth()\n    render.DrawTextureToScreen( texture )\n\nend\n\n-- Add hook to render pass to screen\nhook.Add( \"RenderScreenspaceEffects\", \"RenderSSAOdepth\", RenderSSAOdepth )","output":{"upload":{"src":"ab571/8dc388e4e483f90.png","size":"146994","name":"depth_example.png"}}},{"name":"Depth buffer upgrade","description":"This method allows you to increase the bit depth of the depth buffer.","code":"IMAGE_FORMAT_R32F = 27 -- Single-channel 32-bit floating point\n\nGetRenderTargetEx( \"_rt_resolvedfullframedepth\", 1, 1,\n    RT_SIZE_FULL_FRAME_BUFFER,\n    MATERIAL_RT_DEPTH_SHARED,\n    bit.bor( 4, 8, 256, 512 ),\n    0,\n    IMAGE_FORMAT_R32F\n)"}],"realms":["Client"],"type":"Function"},
{"function":{"name":"GetScreenEffectTexture","parent":"render","type":"libraryfunc","description":"Obtain an ITexture of the screen. You must call render.UpdateScreenEffectTexture in order to update this texture with the currently rendered scene.\n\nThis texture is mainly used within GM:RenderScreenspaceEffects.","realm":"Client","args":{"arg":{"text":"Max index is 3, but engine only creates the first two for you.","name":"textureIndex","type":"number","default":"0"}},"rets":{"ret":{"text":"The requested texture.","name":"","type":"ITexture"}}},"example":{"description":"Print the texture name of the returned textures.","code":"print(render.GetScreenEffectTexture(0):GetName())\nprint(render.GetScreenEffectTexture(1):GetName())","output":"```\n_rt_fullframefb\n_rt_fullframefb1\n```"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetSmallTex0","parent":"render","type":"libraryfunc","realm":"Client","description":"Returns the first quarter sized frame buffer texture.","rets":{"ret":{"text":"The render target texture named `_rt_SmallFB0`.","name":"","type":"ITexture"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetSmallTex1","parent":"render","type":"libraryfunc","realm":"Client","description":"Returns the second quarter sized frame buffer texture.","rets":{"ret":{"text":"The render target texture named `_rt_SmallFB1`.","name":"","type":"ITexture"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetSuperFPTex","parent":"render","type":"libraryfunc","description":{"text":"Returns a floating point texture (RGBA16161616F format) the same resolution as the screen.","note":"The gmodscreenspace doesn't behave as expected when drawing a floating-point texture to an integer texture (e.g. the default render target). Use an UnlitGeneric material instead"},"realm":"Client","rets":{"ret":{"text":"Render target named `__rt_SuperTexture1`.","name":"","type":"ITexture"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetSuperFPTex2","parent":"render","type":"libraryfunc","description":"See render.GetSuperFPTex.","realm":"Client","rets":{"ret":{"text":"Render target named `__rt_SuperTexture2`.","name":"","type":"ITexture"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetSurfaceColor","parent":"render","type":"libraryfunc","description":"Performs a render trace and returns the color of the surface hit, this uses a low res version of the texture.","realm":"Client","args":{"arg":[{"text":"The start position to trace from.","name":"startPos","type":"Vector"},{"text":"The end position of the trace.","name":"endPos","type":"Vector"}]},"rets":{"ret":{"text":"The surface color.","name":"","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetToneMappingScaleLinear","parent":"render","type":"libraryfunc","description":"Returns a vector representing linear tone mapping scale. See render.SetToneMappingScaleLinear for details.","realm":"Client","rets":{"ret":{"text":"The tonemapping scales.\n* X - Output scale.\n* Y - Lightmap scale.\n* Z - Reflection map scale.","name":"scales","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetViewSetup","parent":"render","type":"libraryfunc","description":"Returns the current view setup.","realm":"Client","args":{"arg":{"text":"If `true`, returns the `view->GetViewSetup`, if `false` - returns `view->GetPlayerViewSetup`.","name":"noPlayer","type":"boolean","default":"false"}},"rets":{"ret":{"text":"Current current view setup. See Structures/ViewSetup.","name":"","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsTakingScreenshot","parent":"render","type":"libraryfunc","description":"Lets you know when a screenshot is being taken during rendering hooks.\n\nThis is useful to hide certain visual elements from screenshots, such as debug overlays, helper objects, etc.","realm":"Client","added":"2025.12.01","rets":{"ret":{"text":"Returns `true` when a screenshot is being taken.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"MaterialOverride","parent":"render","type":"libraryfunc","description":{"text":"Sets the render material override for all next calls of Entity:DrawModel. Also overrides render.MaterialOverrideByIndex.\n\nSee render.WorldMaterialOverride, render.BrushMaterialOverride and render.ModelMaterialOverride for similar functions.","warning":"In certain scenarios such as during entity's shadow pass, using this function can cause unexpected side effects. See example below on how to deal with this."},"realm":"Client","args":{"arg":{"text":"The material to use as override, use `nil` to disable.","name":"material","type":"IMaterial|nil","default":"nil"}}},"example":{"description":"Deal with shadow passes during entity rendering. This usually only applies to opaque renders (so not to `ENT:DrawTranslucent`).","code":"local matForOverride = Material( \"phoenix_storms/stripes\" )\n\nfunction ENT:Draw( flags )\n\t-- If the model is currently rendering in the shadow pass, do not overwrite any materials and just render the model(s) normally.\n\t-- In this case we just render the model without any material overrides and returning early.\n\tif ( ( bit.band( flags, STUDIO_SSAODEPTHTEXTURE ) != 0 || bit.band( flags, STUDIO_SHADOWDEPTHTEXTURE ) != 0 ) ) then\n\t\tself:DrawModel( flags )\n\t\treturn\n\tend\n\n\t-- The rest of your code. For example:\n\trender.MaterialOverride( matForOverride )\n\t\tself:DrawModel( flags )\n\trender.MaterialOverride()\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"MaterialOverrideByIndex","parent":"render","type":"libraryfunc","description":"Similar to render.MaterialOverride, but overrides the materials per index. For simple entities you may want to just use Entity:SetSubMaterial.\n\nrender.MaterialOverride overrides effects of this function.","realm":"Client","args":{"arg":[{"text":"The index of the material to override, in range of 0 to 31. `nil` will reset all overrides.","name":"index","type":"number","default":"nil"},{"text":"The material to override with, `nil` will reset the override for given index.","name":"material","type":"IMaterial","default":"nil"}]}},"example":{"description":"Example on overwriting only one of the model's materials.","code":"function ENT:Initialize()\n\n\tif ( CLIENT ) then return end\n\n\t-- Set the model to one with multiple materials.\n\tself:SetModel( \"models/props_phx/construct/windows/window1x1.mdl\" )\n\nend\n\nlocal matForOverride = Material( \"phoenix_storms/stripes\" )\n\nfunction ENT:Draw( flags )\n\n\t-- Override only a certain submaterial (the glass texture)\n\trender.MaterialOverrideByIndex( 3, matForOverride )\n\n\t\t-- Draw the model as usual\n        self:DrawModel( flags )\n\n\t-- Reset all material overrides\n\trender.MaterialOverrideByIndex()\nend","output":{"upload":{"src":"70c/8de3368f02b0ec2.png","size":"814014","name":"image.png"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"MaxTextureHeight","parent":"render","type":"libraryfunc","description":"Returns the maximum texture height the renderer can handle.","realm":"Client and Menu","rets":{"ret":{"text":"The max height.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MaxTextureWidth","parent":"render","type":"libraryfunc","description":"Returns the maximum texture width the renderer can handle.","realm":"Client and Menu","rets":{"ret":{"text":"The max width.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Model","parent":"render","type":"libraryfunc","description":{"text":"Creates a new Global.ClientsideModel, renders it at the specified pos/ang, and removes it. Can also be given an existing CSEnt to reuse instead.","note":"This function is only meant to be used in a single render pass kind of scenario, if you need to render a model continuously, use a cached Global.ClientsideModel and provide it as a second argument.","bug":{"text":"Using this with a map model (game.GetWorld():GetModel()) crashes the game.","issue":"2688"}},"realm":"Client","file":{"text":"lua/includes/extensions/client/render.lua","line":"175-L199"},"args":{"arg":[{"text":"Requires:\n* string model - The model to draw.\n* Vector pos - The position to draw the model at.\n* Angle angle - The angles to draw the model at.","name":"settings","type":"table"},{"text":"If provided, this entity will be reused instead of creating a new one with Global.ClientsideModel. Note that the ent's model, position and angles will be changed, and Entity:SetNoDraw will be set to true.","name":"ent","type":"CSEnt","default":"nil"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ModelMaterialOverride","parent":"render","type":"libraryfunc","description":{"text":"Forces all future draw operations to use a specific IMaterial.  \n\t\t\n\t\tBecause this is independent of a specific Entity, it can be used to change materials on static models that are part of maps.","warning":"In certain scenarios such as during entity's shadow pass, using this function can cause unexpected side effects. See example on render.MaterialOverride about dealing with this."},"realm":"Client","args":{"arg":{"text":"The IMaterial that will be used for all upcoming draw operations, or `nil` to stop overriding.","name":"material","type":"IMaterial","default":"nil"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OverrideAlphaWriteEnable","parent":"render","type":"libraryfunc","description":{"text":"Overrides the write behaviour of all next rendering operations towards the alpha channel of the current render target.\n\nSee also render.OverrideBlend.","note":"Doing surface draw calls with alpha set to 0 is a no-op and will never have any effect."},"realm":"Client and Menu","args":{"arg":[{"text":"Enable or disable the override.","name":"enable","type":"boolean"},{"text":"If the previous argument is true, sets whether the next rendering operations should write to the alpha channel or not. Has no effect if the previous argument is false.","name":"shouldWrite","type":"boolean","default":"nil"}]}},"example":{"description":"Shows how you can use alpha channel with render targets.","code":"render.PushRenderTarget( texture )\nrender.OverrideAlphaWriteEnable( true, true )\n\nrender.ClearDepth()\nrender.Clear( 0, 0, 0, 0 )\n\nrender.OverrideAlphaWriteEnable( false )\nrender.PopRenderTarget()"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OverrideBlend","parent":"render","type":"libraryfunc","description":"Overrides the way that the final color and alpha is calculated for each pixel affected by upcoming draw operations.\n\nWhen a draw operation is performed, the rendering system examines each pixel that is affected by the draw operation and determines its new color by combining (or \"Blending\") the pixel's current color (Called the \"Destination\" or \"Dst\" color) with the new color produced by the draw operation (Called the \"Source\" or \"Src\" color.)\n\nThis function allows you to control the way that those two colors (The Source and Destination) are combined to produce the final pixel color.\n\nIt's important to know that while Colors use values in the range `(0-255)`, the color and alpha values used here are normalized to the range `(0-1)` so that they can be multiplied together to produce a value that is still in the range `(0-1)`.","realm":"Client and Menu","args":[{"name":"Combined Color and Alpha Blending","arg":[{"text":"Set to `true` to enable Blend Overrides.","name":"enabled","type":"boolean"},{"text":"This determines which value each affected pixel's **Source color and alpha** will be multiplied by before they are sent to the Blending Function.  \n\t\t\tOne of the Enums/BLEND enums.","name":"sourceMultiplier","type":"number{BLEND}"},{"text":"This determines which value each affected pixel's **Destination color and alpha** will be multiplied by before they are sent to the Blending Function.  \n\t\t\tOne of the Enums/BLEND enums.","name":"destinationMultiplier","type":"number{BLEND}"},{"text":"After the Source and Destination color and alpha have been multiplied against their corresponding multipliers, they are passed to the Blending Function which combines them into the final color and alpha for the pixel.  \n\t\t\tOne of the Enums/BLENDFUNC enums.","name":"blendingFunction","type":"number{BLENDFUNC}"}]},{"name":"Separate Color and Alpha Blending","arg":[{"text":"Set to `true` to enable Blend Overrides.","name":"enabled","type":"boolean"},{"text":"This determines which value each affected pixel's **Source color** will be multiplied by before they are sent to the Color Blending Function.  \n\t\t\tOne of the Enums/BLEND enums.","name":"sourceColorMultiplier","type":"number{BLEND}"},{"text":"This determines which value each affected pixel's **Destination color** will be multiplied by before they are sent to the Color Blending Function.  \n\t\t\tOne of the Enums/BLEND enums.","name":"destinationColorMultiplier","type":"number{BLEND}"},{"text":"After the Source and Destination colors have been multiplied against their corresponding multipliers, they are passed to the Color Blending Function which combines them into the final color and alpha for the pixel.  \n\t\t\tOne of the Enums/BLENDFUNC enums.","name":"colorBlendingFunction","type":"number{BLENDFUNC}"},{"text":"This determines which value each affected pixel's **Source alpha** will be multiplied by before they are sent to the Alpha Blending Function.  \n\t\t\tOne of the Enums/BLEND enums.","name":"sourceAlphaMultiplier","type":"number{BLEND}","default":"none"},{"text":"This determines which value each affected pixel's **Destination alpha** will be multiplied by before they are sent to the Alpha Blending Function.  \n\t\t\tOne of the Enums/BLEND enums.","name":"destinationAlphaMultiplier","type":"number{BLEND}","default":"none"},{"text":"After the Source and Destination alphas have been multiplied against their corresponding multipliers, they are passed to the Alpha Blending Function which combines them into the final alpha for the pixel.","name":"alphaBlendingFunction","type":"number{BLENDFUNC}","default":"none"}]},{"name":"Disabling Blend Overrides","arg":{"text":"Set to `false` to disable blend overrides.","name":"enabled","type":"boolean"}}]},"example":{"description":{"text":"In this example we draw a lightning bolt over our player's head.\n\nWe shouldn't really draw the lightning in the PreDrawTranslucentRenderables hook as this causes issues rendering transparent objects behind the lightning, but it's a quick example of how the function works. Normally it should be drawn in a custom lua effect's EFFECT:Render.","bug":{"text":"This override might not work properly on Linux","issue":"5693"}},"code":"-- Our sprite texture to render. Rendering this texture without\n-- render.OverrideBlendFunc will result in black borders around the lightning beam.\nlocal lightningMaterial = Material(\"sprites/lgtning\")\n\nhook.Add( \"PreDrawTranslucentRenderables\", \"LightningExample\", function(isDrawingDepth, isDrawingSkybox)\n\n\tif isDrawingDepth or isDrawSkybox then return end\n\n\tlocal ply = Entity(1)\n\n\tif !IsValid(ply) then return end\n\n\t-- Calculate a random UV to use for the lightning to give it some movement\n\tlocal uv = math.Rand(0, 1)\n\n\t-- Enable blend override to interpret the color and alpha from the texture.\n\trender.OverrideBlend( true, BLEND_SRC_COLOR, BLEND_SRC_ALPHA, BLENDFUNC_ADD, BLEND_ONE, BLEND_ZERO, BLENDFUNC_ADD )\n\n\trender.SetMaterial(lightningMaterial)\n\n\t-- Render a lightning beam along points randomly offset from a line above the player.\n\trender.StartBeam(5)\n\trender.AddBeam(ply:GetPos() + Vector(0,0,035), 20, uv, Color(255,255,255,255))\n\trender.AddBeam(ply:GetPos() + Vector(0,0,135) + Vector(math.Rand(-20,20),math.Rand(-20,20),0), 20, uv*2, Color(255,255,255,255))\n\trender.AddBeam(ply:GetPos() + Vector(0,0,235) + Vector(math.Rand(-20,20),math.Rand(-20,20),0), 20, uv*3, Color(255,255,255,255))\n\trender.AddBeam(ply:GetPos() + Vector(0,0,335) + Vector(math.Rand(-20,20),math.Rand(-20,20),0), 20, uv*4, Color(255,255,255,255))\n\trender.AddBeam(ply:GetPos() + Vector(0,0,435) + Vector(math.Rand(-20,20),math.Rand(-20,20),0), 20, uv*5, Color(255,255,255,255))\n\trender.EndBeam()\n\n\t -- Disable blend override\n\trender.OverrideBlend( false )\n\nend )","output":{"image":{"src":"overrideblendfunc_example.png","alt":"_overrideblendfunc_example.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OverrideBlendFunc","parent":"render","type":"libraryfunc","description":{"text":"Overrides the internal graphical functions used to determine the final color and alpha of a rendered texture.\n\nSee also render.OverrideAlphaWriteEnable.","deprecated":"Use render.OverrideBlend instead.","note":"Doing surface draw calls with alpha set to 0 is a no-op and will never have any effect."},"realm":"Client and Menu","args":{"arg":[{"text":"true to enable, false to disable. No other arguments are required when disabling.","name":"enabled","type":"boolean"},{"text":"The source color blend function Enums/BLEND. Determines how a rendered texture's final color should be calculated.","name":"srcBlend","type":"number"},{"name":"destBlend","type":"number"},{"text":"The source alpha blend function Enums/BLEND. Determines how a rendered texture's final alpha should be calculated.","name":"srcBlendAlpha","type":"number","default":"nil"},{"name":"destBlendAlpha","type":"number","default":"nil"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OverrideColorWriteEnable","parent":"render","type":"libraryfunc","description":"Overrides the write behaviour of all next rendering operations towards the color channel of the current render target.","realm":"Client and Menu","args":{"arg":[{"text":"Enable or disable the override.","name":"enable","type":"boolean"},{"text":"If the previous argument is true, sets whether the next rendering operations should write to the color channel or not. Anything drawn after will still write to depth if enabled and shouldWrite is false.","name":"shouldWrite","type":"boolean"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OverrideDepthEnable","parent":"render","type":"libraryfunc","description":"Overrides the write behaviour of all next rendering operations towards the depth buffer.","realm":"Client and Menu","args":{"arg":[{"text":"Enable or disable the override.","name":"enable","type":"boolean"},{"text":"If the previous argument is true, sets whether the next rendering operations should write to the depth buffer or not. Has no effect if the previous argument is false.","name":"shouldWrite","type":"boolean"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PerformFullScreenStencilOperation","parent":"render","type":"libraryfunc","description":"Performs a Stencil operation on every pixel in the active Render Target without performing a draw operation.\n\n\t\tFor more detailed information on the Stencil system, including usage examples, see the Stencils Render Reference page.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PopCustomClipPlane","parent":"render","type":"libraryfunc","description":"Removes the current active clipping plane from the clip plane stack.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PopFilterMag","parent":"render","type":"libraryfunc","description":"Pops (Removes) the texture filter most recently pushed (Added) onto the magnification texture filter stack.  \n\t\t\n\t\tThis function should only be called *after* a magnification filter has been pushed via render.PushFilterMag.\n\n\t\tFor more detailed information and a usage example, see the texture minification and magnification render reference.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PopFilterMin","parent":"render","type":"libraryfunc","description":"Pops (Removes) the texture filter most recently pushed (Added) onto the minification texture filter stack.  \n\t\t\n\t\tThis function should only be called *after* a minification filter has been pushed via render.PushFilterMin().\n\n\t\tFor more detailed information and a usage example, see the texture minification and magnification render reference.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PopFlashlightMode","parent":"render","type":"libraryfunc","description":"Pops the current flashlight mode from the flashlight mode stack.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PopRenderTarget","parent":"render","type":"libraryfunc","description":"Pops the last render target and viewport from the RT stack and sets them as the current render target and viewport.\n\nThis is should be called to restore the previous render target and viewport after a call to render.PushRenderTarget.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PushCustomClipPlane","parent":"render","type":"libraryfunc","description":{"text":"Pushes a new clipping plane of the clip plane stack and sets it as active.","bug":{"text":"A max of 2 clip planes are supported on Linux/POSIX, and 6 on Windows.","issue":"2687"}},"realm":"Client and Menu","args":{"arg":[{"text":"The normal of the clipping plane.","name":"normal","type":"Vector"},{"text":"The distance of the plane from the world origin. You can use Vector:Dot between the normal and any point on the plane to find this.","name":"distance","type":"number"}]}},"example":{"description":"Clips the lower half of your custom entity.","code":"function ENT:Draw()\n    local normal = self:GetUp() -- Everything \"behind\" this normal will be clipped\n    local position = normal:Dot( self:GetPos() ) -- self:GetPos() is the origin of the clipping plane\n\n    local oldEC = render.EnableClipping( true )\n    render.PushCustomClipPlane( normal, position )\n\n    self:DrawModel()\n\n    render.PopCustomClipPlane()\n    render.EnableClipping( oldEC )\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PushFilterMag","parent":"render","type":"libraryfunc","description":"Pushes (Adds) a texture filter onto the magnification texture filter stack.  \n\t\tThis will modify how textures are stretched to sizes larger than their native resolution for upcoming rendering and drawing operations.  \n\t\tFor a version of this same function that modifies filtering for texture sizes smaller than their native resolution, see render.PushFilterMin\n\n\t\tAlways be sure to call render.PopFilterMag afterwards to avoid texture filtering problems.\n\n\t\tFor more detailed information and a usage example, see the texture minification and magnification render reference.\n\nIf current texture has more than 1 mipmap, this also sets the mipmap filter.","realm":"Client and Menu","args":{"arg":{"text":"The texture filter to use. For available options, see Enums/TEXFILTER.","name":"texFilterType","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PushFilterMin","parent":"render","type":"libraryfunc","description":"Pushes (Adds) a texture filter onto the minification texture filter stack.  \n\t\tThis will modify how textures are compressed to a lower resolution than their native resolution for upcoming rendering and drawing operations.  \n\t\tFor a version of this same function that modifies filtering for texture sizes larger than their native resolution, see render.PushFilterMag()\n\n\t\tAlways be sure to call render.PopFilterMin() afterwards to avoid texture filtering problems.\n\n\t\tFor more detailed information and a usage example, see the texture minification and magnification render reference.","realm":"Client and Menu","args":{"arg":{"text":"The texture filter to use. For available options, see Enums/TEXFILTER.","name":"texFilterType","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PushFlashlightMode","parent":"render","type":"libraryfunc","description":{"text":"Enables the flashlight projection for the upcoming rendering.","deprecated":"This will leave models lit under specific conditions. You should use render.RenderFlashlights which is meant as a direct replacement for this function."},"realm":"Client","args":{"arg":{"text":"Whether the flashlight mode should be enabled or disabled.","name":"enable","type":"boolean","default":"false"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PushRenderTarget","parent":"render","type":"libraryfunc","description":{"text":"Pushes the current render target and viewport to the RT stack then sets a new current render target and viewport. If the viewport is not specified, the dimensions of the render target are used instead.\n\nThis is similar to a call to render.SetRenderTarget and render.SetViewPort where the current render target and viewport have been saved beforehand, except the viewport isn't clipped to screen bounds.\n\nSee also render.PopRenderTarget.","note":["If you want to render to the render target in 2d mode and it is not the same size as the screen, use cam.Start2D and cam.End2D.","If the render target is bigger than the screen, rendering done with the surface library will be clipped to the screen bounds unless you call Global.DisableClipping"]},"realm":"Client","args":{"arg":[{"text":"The new render target to be used.  \n\t\t\tCan be set to `nil` to push the main game frame buffer.","name":"texture","type":"ITexture","default":"nil"},{"text":"X origin of the viewport.","name":"x","type":"number","default":"0"},{"text":"Y origin of the viewport.","name":"y","type":"number","default":"0"},{"text":"Width of the viewport.","name":"w","type":"number","default":"texture:Width()"},{"text":"Height of the viewport.","name":"h","type":"number","default":"texture:Height()"}]}},"example":[{"description":"Shows how to create a material which uses a custom created Render Target texture.","code":"-- Create render target\nlocal exampleRT = GetRenderTarget( \"example_rt\", 1024, 1024 )\n\n-- Draw to the render target\nrender.PushRenderTarget( exampleRT )\n\tcam.Start2D()\n\t\t-- Draw background\n\t\tsurface.SetDrawColor( 0, 0, 0, 255 )\n\t\tsurface.DrawRect( 0, 0, 1024, 1024 )\n\n\t\t-- Draw some foreground stuff\n\t\tsurface.SetDrawColor( 255, 0, 0, 255 )\n\t\tsurface.DrawRect( 0, 0, 256, 256 )\n\tcam.End2D()\nrender.PopRenderTarget()\n\nlocal customMaterial = CreateMaterial( \"example_rt_mat\", \"UnlitGeneric\", {\n\t[\"$basetexture\"] = exampleRT:GetName(), -- You can use \"example_rt\" as well\n\t[\"$translucent\"] = 1,\n\t[\"$vertexcolor\"] = 1\n} )\n\nhook.Add( \"HUDPaint\", \"ExampleDraw\", function()\n\tsurface.SetDrawColor( 255, 255, 255, 255 )\n\tsurface.SetMaterial( customMaterial )\n\tsurface.DrawTexturedRect( 0, 0, customMaterial:GetTexture( \"$basetexture\" ):Width(), customMaterial:GetTexture( \"$basetexture\" ):Height() )\nend )","output":"A black 1024x1024 render target with a 256x256 red square in top left corner drawn in your top left corner."},{"description":"Shows how you can use alpha channel with render targets.","code":"render.PushRenderTarget( texture )\nrender.OverrideAlphaWriteEnable( true, true )\n\nrender.ClearDepth()\nrender.Clear( 0, 0, 0, 0 )\n\n-- Draw stuff here\n\nrender.OverrideAlphaWriteEnable( false )\nrender.PopRenderTarget()"}],"realms":["Client"],"type":"Function"},
{"function":{"name":"ReadPixel","parent":"render","type":"libraryfunc","description":"Reads the color of the specified pixel from the RenderTarget sent by render.CapturePixels","realm":"Client","args":{"arg":[{"text":"The x coordinate.","name":"x","type":"number"},{"text":"The y coordinate.","name":"y","type":"number"}]},"rets":{"ret":[{"text":"The red channel value.","name":"r","type":"number"},{"text":"The green channel value.","name":"g","type":"number"},{"text":"The blue channel value.","name":"b","type":"number"},{"text":"The alpha channel value or no value if the render target has no alpha channel.","name":"a","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"RedownloadAllLightmaps","parent":"render","type":"libraryfunc","description":"This applies the changes made to map lighting using engine.LightStyle.","realm":"Client","args":{"arg":[{"text":"When true, this will also apply lighting changes to static props. This is really slow on large maps.","name":"DoStaticProps","type":"boolean","default":"false"},{"text":"Forces all props to update their static lighting. Can be slow.","name":"UpdateStaticLighting","type":"boolean","default":"false"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"RenderFlashlights","parent":"render","type":"libraryfunc","description":"Renders additive flashlights on an IMesh, a direct replacement for render.PushFlashlightMode.","realm":"Client","added":"2023.06.28","args":{"arg":{"text":"The function that renders the IMesh, or a model.","name":"renderFunc","type":"function"}}},"example":{"description":"Shows an example usage of this function.","code":"function ENT:CreateMesh()\n\t-- Destroy any previous meshes\n\tif ( self.Mesh ) then self.Mesh:Destroy() end\n\n\t-- Get a list of all meshes of a model\n\tlocal visualMeshes = util.GetModelMeshes( \"models/combine_helicopter/helicopter_bomb01.mdl\" )\n\n\t-- Check if the model even exists\n\tif ( !visualMeshes ) then return end\n\n\t-- Select the first mesh\n\tlocal visualMesh = visualMeshes[ 1 ]\n\n\t-- Set the material to draw the mesh with from the model data\n\tself.myMaterial = Material( visualMesh.material )\n\n\t-- You can apply any changes to visualMesh.trianges table here, distorting the mesh\n\t-- or any other changes you can come up with\n\n\t-- Create and build the mesh\n\tself.Mesh = Mesh( visualMesh.material )\n\tself.Mesh:BuildFromTriangles( visualMesh.triangles )\nend\n\nfunction ENT:DrawModelOrMesh()\n\t-- Move the mesh to the entity's position for upcoming drawing operation\n\tcam.PushModelMatrix( self:GetWorldTransformMatrix() )\n\n\t-- The material to render our mesh with\n\trender.SetMaterial( self.myMaterial )\n\n\t-- Draw our mesh\n\tself.Mesh:Draw()\n\n\t-- Undo the cam.PushModelMatrix call above\n\tcam.PopModelMatrix()\nend\n\nfunction ENT:Draw()\n\n\n\tif ( !self.Mesh ) then return self:CreateMesh() end\n\n\n\t-- Draw the mesh normally\n\tself:DrawModelOrMesh()\n\n\t-- Draw the additive flashlight layers\n\trender.RenderFlashlights( function() self:DrawModelOrMesh() end )\n\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"RenderHUD","parent":"render","type":"libraryfunc","description":"Renders the HUD on the screen.","realm":"Client","args":{"arg":[{"text":"X position for the HUD draw origin.","name":"x","type":"number"},{"text":"Y position for the HUD draw origin.","name":"y","type":"number"},{"text":"Width of the HUD draw.","name":"w","type":"number"},{"text":"Height of the HUD draw.","name":"h","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"RenderView","parent":"render","type":"libraryfunc","description":{"text":"Renders the scene with the specified viewData to the current active render target.","bug":[{"text":"Static props and LODs are rendered improperly due to incorrectly perceived distance.","issue":"1330"},"Using render.RenderView on a RenderTarget texture in a 3d context like SWEP:PostDrawViewModel() while drawing the RenderTarget texture causes screen flickers."]},"realm":"Client","args":{"arg":{"text":"The view data to be used in the rendering. See Structures/ViewData. Any missing value is assumed to be that of the current view. Similarly, you can make a normal render by simply not passing this table at all.","name":"view","type":"table","default":"nil"}}},"example":{"description":"How you could use this to draw the view on a derma panel.","code":"local frame = vgui.Create( \"DFrame\" )\nframe:SetSize( ScrW() - 100, ScrH() - 100 )\nframe:Center()\nframe:MakePopup()\n\nfunction frame:Paint( w, h )\n\n\tlocal x, y = self:GetPos()\n\n\tlocal old = DisableClipping( true ) -- Avoid issues introduced by the natural clipping of Panel rendering\n\trender.RenderView( {\n\t\torigin = Vector( 0, 0, 0 ),\n\t\tangles = Angle( 0, 0, 0 ),\n\t\tx = x, y = y,\n\t\tw = w, h = h\n\t} )\n\tDisableClipping( old )\n\nend","output":{"image":{"src":"RenderViewResult.jpg","alt":"300px"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ResetModelLighting","parent":"render","type":"libraryfunc","description":"Resets the model lighting to the specified color.\n\nCalls render.SetModelLighting for every direction with given color.","realm":"Client","args":{"arg":[{"text":"The red part of the color, 0-1.","name":"r","type":"number"},{"text":"The green part of the color, 0-1.","name":"g","type":"number"},{"text":"The blue part of the color, 0-1.","name":"b","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ResetToneMappingScale","parent":"render","type":"libraryfunc","description":"Resets the HDR tone multiplier to the specified value.\n\nThis will only work on HDR maps, and the value will automatically fade to what it was ( or whatever render.SetGoalToneMappingScale is ) if called only once.","realm":"Client","args":{"arg":{"text":"The value which should be used as multiplier.","name":"scale","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetAmbientLight","parent":"render","type":"libraryfunc","description":"Sets the ambient lighting for any upcoming render operation.","realm":"Client","args":{"arg":[{"text":"The red part of the color, 0-1.","name":"r","type":"number"},{"text":"The green part of the color, 0-1.","name":"g","type":"number"},{"text":"The blue part of the color, 0-1.","name":"b","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetBlend","parent":"render","type":"libraryfunc","description":{"text":"Sets the alpha blending (or transparency) for upcoming render operations.\n\t\nSee render.SetColorModulation for the function to affect RGB color channels.\n\nBy itself, this will cause visible overlapping on parts of a model that are in front of other parts of the same model.  \nFor a solution to this, see the examples below.","bug":{"text":"This does not affect non-model `render.Draw*` functions.","issue":"3166"},"note":"If a material has the [$alphatest](https://developer.valvesoftware.com/wiki/$alphatest) flag enabled then this function might not behave as expected because alpha will be binary, this has a default cutoff of `0.7`."},"realm":"Client","args":{"arg":{"text":"The alpha (transparency) for upcoming draw operations.  \n\t\t\tA value in the range `(0-1)` where `0` is fully transparent, `0.5` is 50% visible, and `1` is fully opaque.","name":"blending","type":"number"}}},"example":[{"name":"Basic Usage (With overlaps)","description":"This example demonstrates the basic usage of render.SetBlend and the overlapping effect mentioned above.","code":"-- Draw at a 75% opacity, so it's mostly opaque.\nrender.SetBlend( 0.75 )\n\n-- Draw the model using the blend we just set.\nself:DrawModel()\n\n-- Draw at a normal opacity again.\nrender.SetBlend( 1 )","output":{"image":{"src":"b2b4c/8dc575936095ba3.png","size":"436279","name":"WithoutDepthExample.png"}}},{"name":"Avoiding Overlap Issues","description":"This example demonstrates how the overlapping effect can be avoided with the use of render.OverrideColorWriteEnable.","code":"-- Prevent drawing to the Color Channel of the currently active Render Target so\n-- that when we draw the model, it only sets the Depth Buffer values.\nrender.OverrideColorWriteEnable( true, false )\n\n-- Draw the model to set the Depth Buffer values\nself:DrawModel()\n\n-- Start drawing normally again\nrender.OverrideColorWriteEnable( false, false )\n\n-- Draw at a 75% opacity, so it's mostly opaque.\nrender.SetBlend( 0.75 )\n\n-- Draw the model using the blend we just set.\n-- Because we previously set the Depth Buffer values by drawing the model, and\n-- because pixels are only drawn when the pixel's current Depth Buffer value is \n-- less-than or equal-to the draw operation's new Depth value, only the parts of \n-- the model that are closest to the player's view will be drawn.  \n-- This will prevent the overlapping that normally happens.\nself:DrawModel()\n\n-- Draw at a normal opacity again.\nrender.SetBlend( 1 )","output":{"image":{"src":"b2b4c/8dc57594556b659.png","size":"431723","name":"WithDepthExample.png"}}}],"realms":["Client"],"type":"Function"},
{"function":{"name":"SetColorMaterial","parent":"render","type":"libraryfunc","description":"Sets the current drawing material to \"color\".\n\nThe material is defined as:\n```\n\n \"UnlitGeneric\"\n {\n \t\"$basetexture\" \"color/white\"\n \t\"$model\" \t\t1\n \t\"$translucent\" \t1\n \t\"$vertexalpha\" \t1\n \t\"$vertexcolor\" \t1\n }\n```","realm":"Client","file":{"text":"lua/includes/extensions/client/render.lua","line":"74-L76"}},"example":{"description":"Equivalent of this function. Internally, the material used is cached so it is not created every frame like the code below implies.","code":"render.SetMaterial( Material( \"color\" ) )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetColorMaterialIgnoreZ","parent":"render","type":"libraryfunc","description":"Sets the current drawing material to `color_ignorez`.\n\nThe material is defined as:\n```\n\n \"UnlitGeneric\"\n {\n \t\"$basetexture\" \"color/white\"\n  \t\"$model\" \t\t1\n \t\"$translucent\" \t1\n \t\"$vertexalpha\" \t1\n \t\"$vertexcolor\" \t1\n \t\"$ignorez\"\t\t1\n }\n```","realm":"Client","file":{"text":"lua/includes/extensions/client/render.lua","line":"80-L82"}},"example":{"description":"Equivalent of this function. Internally, the material used is cached so it is not created every frame like the code below implies.","code":"render.SetMaterial( Material( \"color_ignorez\" ) )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetColorModulation","parent":"render","type":"libraryfunc","description":"Sets the color modulation for upcoming render operations, such as rendering models.\n\nThe values can exceed 1 for stronger effect.\n\nSee render.SetBlend for the function to affect alpha channel.","realm":"Client","args":{"arg":[{"text":"The red channel multiplier normal ranging from 0-1.","name":"r","type":"number"},{"text":"The green channel multiplier normal ranging from 0-1.","name":"g","type":"number"},{"text":"The blue channel multiplier normal ranging from 0-1.","name":"b","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetFogZ","parent":"render","type":"libraryfunc","description":"If the fog mode is set to MATERIAL_FOG_LINEAR_BELOW_FOG_Z, the fog will only be rendered below the specified height.","realm":"Client","args":{"arg":{"text":"The fog Z.","name":"fogZ","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetGoalToneMappingScale","parent":"render","type":"libraryfunc","description":"Sets the goal HDR tone mapping scale.\n\nUse this in a rendering/think hook as it is reset every frame.","realm":"Client","args":{"arg":{"text":"The target scale.","name":"scale","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetLightingMode","parent":"render","type":"libraryfunc","description":{"text":"Sets lighting mode when rendering something.","note":"**Do not forget to restore the default value** to avoid unexpected behavior, like the world and the HUD/UI being affected."},"realm":"Client","args":{"arg":{"text":"Lighting render mode.\n\nPossible values are:\n* 0 - Default.\n* 1 - Total fullbright, similar to `mat_fullbright 1` but excluding some weapon view models.\n* 2 - Increased brightness(?), models look fullbright.","name":"Mode","type":"number"}}},"example":[{"description":"Draws a fullbright quad on 2D skybox.","code":"local MATERIAL = Material(\"skybox/trainup\")\n\nhook.Add(\"PostDraw2DSkyBox\", \"Quaddrawer\", function()\n\trender.OverrideDepthEnable( true, false )\n\trender.SetLightingMode(2)\n\n\tcam.Start3D(Vector(0, 0, 0), EyeAngles())\n\t\trender.SetMaterial(MATERIAL)\n\t\trender.DrawQuadEasy(Vector(200,0,0), Vector(-1,0,0), 64, 64, Color(255,255,255), 180)\n\tcam.End3D()\n\n\trender.OverrideDepthEnable( false, false )\n\trender.SetLightingMode(0)\nend)"},{"description":"Display everything the same way as when you set `mat_fullbright` to 1.","code":"local LightingModeChanged = false\nhook.Add( \"PreRender\", \"fullbright\", function()\n\trender.SetLightingMode( 1 )\n\tLightingModeChanged = true\nend )\n\nlocal function EndOfLightingMod()\n\tif LightingModeChanged then\n\t\trender.SetLightingMode( 0 )\n\t\tLightingModeChanged = false\n\tend\nend\nhook.Add( \"PostRender\", \"fullbright\", EndOfLightingMod )\nhook.Add( \"PreDrawHUD\", \"fullbright\", EndOfLightingMod )"}],"realms":["Client"],"type":"Function"},
{"function":{"name":"SetLightingOrigin","parent":"render","type":"libraryfunc","description":"Sets lighting origin for the current model.","realm":"Client","args":{"arg":{"text":"The position which will be used to calculate lighting for the current model.","name":"lightingOrigin","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetLightmapTexture","parent":"render","type":"libraryfunc","description":"Sets the texture to be used as the lightmap in upcoming rendering operations. This is required when rendering meshes using a material with a lightmapped shader such as `LightmappedGeneric`.","realm":"Client","args":{"arg":{"text":"The texture to be used as the lightmap.","name":"tex","type":"ITexture"}}},"example":{"description":"Creates a mesh with LightmappedGeneric material on it.","code":"-- LightmappedGeneric material that we'll use for our mesh\nlocal meshMat = Material( \"concrete/concretefloor001a\" )\n\n-- Mesh vertices (notice that it's not MeshVertex structure format, just something similar)\n-- Notice that we have 2 UV coordinates channels, one for texture, one for lightmap\nlocal meshVertices = {\n\n\t{ pos = Vector( 0, 0, 0 ), u0 = 0, v0 = 0, u1 = 0, v1 = 0, n = Vector( 1, 0, 0 ) },\n\t{ pos = Vector( 0, 100, 0 ), u0 = 1, v0 = 0, u1 = 3, v1 = 0, n = Vector( 1, 0, 0 ) },\n\t{ pos = Vector( 0, 100, -100 ), u0 = 1, v0 = 1, u1 = 3, v1 = 3, n = Vector( 1, 0, 0 ) },\n\t{ pos = Vector( 0, 0, -100 ), u0 = 0, v0 = 1, u1 = 0, v1 = 3, n = Vector( 1, 0, 0 ) },\n}\n\n-- Run this command while ingame to create the mesh at map origin\nconcommand.Add( \"meshtest\", function()\n\n\t-- Creating a render target to be used as lightmap texture\n\tmeshLightmap = GetRenderTarget( \"test_mesh_lightmap\", 128, 128, false )\n\n\t-- Filling the lightmap texture with some stuff for visualization\n\trender.PushRenderTarget( meshLightmap )\n\n\t\tcam.Start2D()\n\n\t\t\t-- Resetting lightmap to be monotone gray\n\t\t\trender.Clear( 128, 128, 128, 255 )\n\n\t\t\t-- Drawing a dark rectangle\n\t\t\trender.SetColorMaterial()\n\t\t\tsurface.SetDrawColor( 80, 80, 80, 255 )\n\t\t\tsurface.DrawRect( 32, 32, 64, 64 )\n\n\t\t\t-- And some color text, why not! Lightmaps support RGB color\n\t\t\tdraw.SimpleText( \"This is lightmap\", \"DermaDefault\", 64, 64, Color( 255, 0, 0, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )\n\n\t\tcam.End2D()\n\n\trender.PopRenderTarget()\n\n\t-- Creating the mesh. Don't forget to pass the material you're gonna use with it!\n\t-- Shader of the material defines some features of the mesh, vertex structure\n\t-- specifically (LightmappedGeneric requires each vertex to store 2 UV channels,\n\t-- for instance. This is important in this case)\n\tmyTestMesh = Mesh( meshMat )\n\n\t-- Creating the mesh\n\tmesh.Begin( myTestMesh, MATERIAL_QUADS, 1 )\n\n\t\tfor i, vertex in pairs( meshVertices ) do\n\n\t\t\tmesh.Position( vertex.pos )\n\n\t\t\t-- Texture coordinates go to channel 0\n\t\t\tmesh.TexCoord( 0, vertex.u0, vertex.v0 )\n\n\t\t\t-- Lightmap texture coordinates go to channel 1\n\t\t\tmesh.TexCoord( 1, vertex.u1, vertex.v1 )\n\n\t\t\tmesh.Normal( vertex.n )\n\t\t\tmesh.AdvanceVertex()\n\t\tend\n\n\tmesh.End()\nend )\n\nhook.Add( \"PostDrawOpaqueRenderables\", \"LightmappedMeshTest\", function()\n\n\tif myTestMesh and myTestMesh ~= NULL then\n\n\t\trender.SetMaterial( meshMat )\n\t\trender.SetLightmapTexture( meshLightmap )\n\n\t\tmyTestMesh:Draw()\n\tend\nend )","output":{"image":{"src":"LightmappedGenericMeshPreview.jpeg","alt":"512px|thumb"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetLocalModelLights","parent":"render","type":"libraryfunc","description":"Sets up the local lighting for any upcoming render operation. Up to 4 local lights can be defined, with one of three different types (point, directional, spot).\n\nDisables all local lights if called with no arguments.","realm":"Client","args":{"arg":{"text":"A table containing up to 4 tables for each light source that should be set up. Each of these tables should contain the properties of its associated light source, see Structures/LocalLight.","name":"lights","type":"table","default":"{}"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetMaterial","parent":"render","type":"libraryfunc","description":"Sets the material to be used in any upcoming render operation using the render.\n\nNot to be confused with surface.SetMaterial.","realm":"Client","args":{"arg":{"text":"The material to be used.","name":"mat","type":"IMaterial"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetModelLighting","parent":"render","type":"libraryfunc","description":"Sets up the ambient lighting for any upcoming render operation. Ambient lighting can be seen as a cube enclosing the object to be drawn, each of its faces representing a directional light source that shines towards the object. Thus, there is a total of six different light sources that can be configured separately.\n\nLight color components are not restricted to a specific range (i.e. 0-255), instead, higher values will result in a brighter light.","realm":"Client","args":{"arg":[{"text":"The light source to edit, see Enums/BOX.","name":"lightDirection","type":"number{BOX}"},{"text":"The red component of the light color.","name":"red","type":"number"},{"text":"The green component of the light color.","name":"green","type":"number"},{"text":"The blue component of the light color.","name":"blue","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetRenderTarget","parent":"render","type":"libraryfunc","description":"Sets the render target to the specified rt.","realm":"Client","args":{"arg":{"text":"The new render target to be used.","name":"texture","type":"ITexture"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetRenderTargetEx","parent":"render","type":"libraryfunc","description":{"text":"Sets the render target with the specified index of `COLOR[n]` to the specified rt, allowing you to work with [Multiple Render Targets (MRT)](https://learn.microsoft.com/en-us/windows/win32/direct3d9/multiple-render-targets). Since standard shaders don't use MRT, you might find this useful at Shaders/screenspace_general.","note":"MRT doesn't work with 2D render functions like render.DrawScreenQuad. Instead, you can render a render.DrawQuad using cam.Start2D.","warning":"If you try to render with MSAA and set the main RenderTarget with another RenderTarget, nothing will be rendered.\n\n[Link to Direct3D 9 documentation on MRT](https://learn.microsoft.com/en-us/windows/win32/direct3d9/multiple-render-targets#:~:text=No%20antialiasing%20is%20supported)\n\n`Multiple render targets have the following restrictions:`\n* *No antialiasing is supported.*"},"realm":"Client","args":{"arg":[{"text":"The index of output `COLOR[n]` [semantics](https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics) from pixel-shader. Min: `0`, max: `3`.","name":"rtIndex","type":"number"},{"text":"The new render target to be used.","name":"texture","type":"ITexture","default":"nil"}]}},"example":{"description":"Multiple Render Targets in a 2D context:","code":"local w, h = ScrW(), ScrH()\nlocal tex0 = GetRenderTarget( \"ExampleRT0\", w, h )\nlocal tex1 = GetRenderTarget( \"ExampleRT1\", w, h )\n\nlocal mat = Material(\"pp/ssao\") -- your material with custom shader and COLOR0, COLOR1 output\n-- See https://github.com/meetric1/gmod_shader_guide/tree/main?tab=readme-ov-file#example-8---multi-render-targets for details\n\nlocal quad = {\n    vector_origin,\n    Vector(w, 0),\n    Vector(w, h),\n    Vector(0, h),\n}\n\nlocal function DrawScreenQuadMRT() \n    cam.Start2D()\n        cam.IgnoreZ( true )\n        render.DrawQuad(\n            quad[1],\n            quad[2],\n            quad[3],\n            quad[4]\n        )\n        cam.IgnoreZ( false )\n    cam.End2D()\nend\n\nhook.Add( \"RenderScreenspaceEffects\", \"2DMRT\", function()\n\trender.SetRenderTargetEx(0, tex0)\n\trender.SetRenderTargetEx(1, tex1)\n\n\trender.SetMaterial(mat)\n\tDrawScreenQuadMRT()\n\n\trender.SetRenderTargetEx(1)\n\trender.SetRenderTargetEx(0)\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetScissorRect","parent":"render","type":"libraryfunc","description":"Sets a scissoring rectangle which limits the drawing area. (otherwise known as clipping)","realm":"Client and Menu","args":{"arg":[{"text":"X start coordinate of the scissor rectangle in screen-space coordinates.","name":"startX","type":"number"},{"text":"Y start coordinate of the scissor rectangle in screen-space coordinates.","name":"startY","type":"number"},{"text":"X end coordinate of the scissor rectangle in screen-space coordinates.","name":"endX","type":"number"},{"text":"Y end coordinate of the scissor rectangle in screen-space coordinates.","name":"endY","type":"number"},{"text":"Enable or disable the scissor rect.","name":"enable","type":"boolean"}]}},"example":[{"description":"Shows how to use this function. This will cut the white rectangle from full screen to 512x512 box in top left corner.","code":"render.SetScissorRect( 0, 0, 512, 512, true ) -- Enable the rect\n\tdraw.RoundedBox( 4, 0, 0, ScrW(), ScrH(), color_white ) -- Draw a white rectangle over the whole screen\nrender.SetScissorRect( 0, 0, 0, 0, false ) -- Disable after you are done"},{"description":"Draws a fake circle + cut it to look like a progress bar.","code":"local function draw_circle( x, y, radius, color, percent )\n    percent = percent or 1\n\n    render.SetScissorRect( x - radius, y - radius + radius * 2 * ( 1 - percent ), x + radius, y + radius * 2, true )\n        draw.RoundedBox( radius, x - radius, y - radius, radius * 2, radius * 2, color or color_white )\n    render.SetScissorRect( 0, 0, 0, 0, false )\nend\n\nhook.Add( \"HUDPaint\", \"GMod:Wiki\", function()\n    local w, h = ScrW(), ScrH()\n\tlocal radius = h * 0.1\n\n\t-- Filled circle\n    draw_circle( w / 2, h * 0.25, radius, Color( 255, 0, 0 ), 1 )\n\n\t-- Filled circle + quarter circle\n\tdraw_circle( w / 2, h / 2, radius, Color( 255, 0, 0 ), 1 )\n\tdraw_circle( w / 2, h / 2, radius, Color( 0, 255, 0 ), 0.25 )\n\n\t-- Half circle\n\tdraw_circle( w / 2, h * 0.75, radius, Color( 0, 0, 255 ), 0.5 )\nend )"}],"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetShadowColor","parent":"render","type":"libraryfunc","description":"Sets the shadow color.","realm":"Client","args":{"arg":[{"text":"The red channel of the shadow color.","name":"red","type":"number"},{"text":"The green channel of the shadow color.","name":"green","type":"number"},{"text":"The blue channel of the shadow color.","name":"blue","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetShadowDirection","parent":"render","type":"libraryfunc","description":"Sets the shadow projection direction.","realm":"Client","args":{"arg":{"text":"The new shadow direction.","name":"shadowDirections","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetShadowDistance","parent":"render","type":"libraryfunc","description":"Sets the maximum shadow projection range.","realm":"Client","args":{"arg":{"text":"The new maximum shadow distance.","name":"shadowDistance","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetShadowsDisabled","parent":"render","type":"libraryfunc","description":{"text":"Sets whether all shadow rendering should be disabled.\n\nInternally sets `r_shadows_gamecontrol` convar, exactly like `shadow_control` does via its `SetShadowsDisabled` input.","bug":"Currently broken due to internal bug. Will be fixed in the next update, as of 15 Sept 2025."},"realm":"Client","args":{"arg":{"text":"`true` to disable shadows, `false` to enable.","name":"disable","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetStencilCompareFunction","parent":"render","type":"libraryfunc","description":"Sets the Compare Function that all pixels affected by a draw operation will have their Stencil Buffer value tested against.  \n\nWhen not set to a static value like NEVER or ALWAYS, the Stencil Buffer value corresponding to each affected pixel will be compared against the current Reference Value.\n\nPixels that **Pass** the Compare Function check move on to the Depth Test, which determines if the draw operation will ultimately be allowed to overwrite the pixel's Color Channel, Stencil Buffer, and Depth Buffer values.\n\nPixels that **Fail** the Compare Function check have the Fail Operation performed on their Stencil Buffer value and do **not** have any of their Render Target layers modified by the draw operation.\n\nFor more detailed information on the Stencil system, including usage examples, see the Stencils Render Reference page.","realm":"Client and Menu","args":{"arg":{"text":"The Compare Function that each affected pixel's Stencil Buffer value will be evaluated against during a draw operation.","name":"compareFunction","type":"number{STENCILCOMPARISONFUNCTION}"}}},"upload":{"src":"b2b4c/8dc4ead6a5336e3.png","size":"77526","name":"CompareFunctionFlowChart.png"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetStencilEnable","parent":"render","type":"libraryfunc","description":{"text":"Enables or disables the Stencil system for future draw operations.\n\nWhile enabled, all pixels affected by draw operations will have their corresponding values in the active Render Target Stencil Buffer compared against the current Reference Value and their current Depth Buffer value compared against the depth of the corresponding pixel from the draw operation.  \nDepending on the outcomes of these comparisons, one of either the Pass, Fail, or Z-Fail operations is performed on the pixel's Stencil Buffer value.  \nA pixel will only be updated in the active Render Target if the Pass Operation is performed.\n\nFor more detailed information on the Stencil system, including usage examples, see the Stencils Render Reference page.","note":"The Stencil system's configuration does **not** reset automatically.  \nTo prevent unexpected behavior, always manually ensure that the Stencil system is configured appropriately for your use-case after enabling it."},"realm":"Client and Menu","args":{"arg":{"text":"The new state.","name":"newState","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetStencilFailOperation","parent":"render","type":"libraryfunc","description":"Sets the Stencil Operation that will be performed on the Stencil Buffer values of pixels affected by draw operations if the Compare Function did **not** Pass the pixel.  \n\n\t\tFor more detailed information on the Stencil system, including usage examples, see the Stencils Render Reference page.","realm":"Client and Menu","args":{"arg":{"text":"The Stencil Operation to be performed if the Compare Function does not Pass a pixel.","name":"failOperation","type":"number{STENCILOPERATION}"}}},"image":{"src":"b2b4c/8dc4ea6db700938.png","size":"76553","name":"FailOperationFlowChart.png"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetStencilPassOperation","parent":"render","type":"libraryfunc","description":"Sets the Stencil Operation that will be performed on the Stencil Buffer values of pixels affected by draw operations if the Compare Function Passes the pixel.  \n\n\t\tFor more detailed information on the Stencil system, including usage examples, see the Stencils Render Reference page.","realm":"Client and Menu","args":{"arg":{"text":"The Stencil Operation to be performed if the Compare Function Passes a pixel.","name":"passOperation","type":"number{STENCILOPERATION}"}}},"image":{"src":"b2b4c/8dc4ea87ccd484a.png","size":"77518","name":"PassOperationFlowChart.png"},"example":{"description":"This uses the pass operation to blank out everything but what we just drew (from \n[Lex's Stencil Tutorial](https://github.com/Lexicality/stencil-tutorial)).","code":"hook.Add( \"PostDrawOpaqueRenderables\", \"Stencil Tutorial Example\", function()\n\t-- Reset everything to known good\n\trender.SetStencilWriteMask( 0xFF )\n\trender.SetStencilTestMask( 0xFF )\n\trender.SetStencilReferenceValue( 0 )\n\trender.SetStencilCompareFunction( STENCIL_ALWAYS )\n\trender.SetStencilPassOperation( STENCIL_KEEP )\n\trender.SetStencilFailOperation( STENCIL_KEEP )\n\trender.SetStencilZFailOperation( STENCIL_KEEP )\n\trender.ClearStencil()\n\n\t-- Enable stencils\n\trender.SetStencilEnable( true )\n\t-- Set the reference value to 1. This is what the compare function tests against\n\trender.SetStencilReferenceValue( 1 )\n\t-- Only draw things if their pixels are NOT 1. Currently this is everything.\n\trender.SetStencilCompareFunction( STENCIL_NOTEQUAL )\n\t-- If something draws to the screen, set the pixels it draws to 1\n\trender.SetStencilPassOperation( STENCIL_REPLACE )\n\n\t-- Draw our entities. They will draw as normal\n\tfor _, ent in ipairs( ents.FindByClass( \"prop_physics\" ) ) do\n\t\tent:DrawModel()\n\tend\n\n\t-- At this point, we cannot draw on top of anything that we have already drawn.\n\t-- So, if we flush the screen, our entities will still be there.\n\trender.ClearBuffersObeyStencil( 0, 148, 133, 255, false )\n\n\t-- Let everything render normally again\n\trender.SetStencilEnable( false )\nend )","output":{"image":{"src":"basic_pass_operation.jpg","alt":"800px"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetStencilReferenceValue","parent":"render","type":"libraryfunc","description":"Sets the Stencil system's Reference Value which is compared against each pixel's corresponding Stencil Buffer value in the Compare Function and can be used to modify the Stencil Buffer value of those same pixels in the Pass, Fail, and Z Fail operations.\n\t\t\n\t\tFor more detailed information on the Stencil system, including usage examples, see the Stencils Render Reference page.","realm":"Client and Menu","args":{"arg":{"text":"The value that the Compare function and the pass, fail, and z-fail operations will use.  \n\t\t\tThis is an 8-bit (`byte`) unsigned integer value in the range [`0-255`].","name":"referenceValue","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetStencilTestMask","parent":"render","type":"libraryfunc","description":"Sets the unsigned 8-bit (`byte`) bitflag mask that will be bitwise ANDed with all values as they are read (tested) from the Stencil Buffer\n\n\t\tThis can be considered a \"niche\" Stencil function as it is not required for many Stencil use-cases.\n\n\t\tThis is a companion function to render.SetStencilWriteMask which modifies Stencil Buffer values as they are written.\n\n\t\tFor more detailed information on the Stencil system, including usage examples, see the Stencils Render Reference page.","realm":"Client and Menu","args":{"arg":{"text":"The 8-bit (`byte`) mask.  \n\t\t\tSet to `255` to make no change to read Stencil Buffer values.","name":"bitMask","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetStencilWriteMask","parent":"render","type":"libraryfunc","description":"Sets the unsigned 8-bit (`byte`) bitflag mask that will be bitwise ANDed with all values as they are written to the Stencil Buffer\n\n\t\tThis can be considered a \"niche\" Stencil function as it is not required for many Stencil use-cases.\n\n\t\tThis is a companion function to render.SetStencilTestMask which modifies Stencil Buffer values as they are read.\n\n\t\tFor more detailed information on the Stencil system, including usage examples, see the Stencils Render Reference page.","realm":"Client and Menu","args":{"arg":{"text":"The 8-bit (`byte`) mask.  \n\t\t\tSet to `255` to make no change to written Stencil Buffer values.","name":"bitMask","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetStencilZFailOperation","parent":"render","type":"libraryfunc","description":"Sets the Stencil Operation that will be performed on the Stencil Buffer values of pixels affected by draw operations if the Compare Function Passed a given pixel, but it did **not** Pass the Depth Test.\n\n\t\tFor more detailed information on the Stencil system, including usage examples, see the Stencils Render Reference page.","realm":"Client and Menu","args":{"arg":{"text":"The Stencil Operation to be performed if the Compare Function Passes a pixel, but the pixel fails the Depth Test.","name":"zFailOperation","type":"number{STENCILOPERATION}"}}},"image":{"src":"b2b4c/8dc4ea9609eac76.png","size":"77491","name":"ZFailOperationFlowChart.png"},"example":{"description":"This shows how to reveal hidden sections of entities, wallhack style (from \n[Lex's Stencil Tutorial](https://github.com/Lexicality/stencil-tutorial)).","code":"hook.Add( \"PostDrawOpaqueRenderables\", \"Stencil Tutorial Example\", function()\n\t-- Reset everything to known good\n\trender.SetStencilWriteMask( 0xFF )\n\trender.SetStencilTestMask( 0xFF )\n\trender.SetStencilReferenceValue( 0 )\n\trender.SetStencilCompareFunction( STENCIL_ALWAYS )\n\trender.SetStencilPassOperation( STENCIL_KEEP )\n\trender.SetStencilFailOperation( STENCIL_KEEP )\n\trender.SetStencilZFailOperation( STENCIL_KEEP )\n\trender.ClearStencil()\n\n\t-- Enable stencils\n\trender.SetStencilEnable( true )\n\t-- Set the reference value to 1. This is what the compare function tests against\n\trender.SetStencilReferenceValue( 1 )\n\t-- Always draw everything\n\trender.SetStencilCompareFunction( STENCIL_ALWAYS )\n\t-- If something would draw to the screen but is behind something, set the pixels it draws to 1\n\trender.SetStencilZFailOperation( STENCIL_REPLACE )\n\n\t-- Draw our entities. They will draw as normal\n\tfor _, ent in ipairs( ents.FindByClass( \"prop_physics\" ) ) do\n\t\tent:DrawModel()\n\tend\n\n\t-- Now, only draw things that have their pixels set to 1. This is the hidden parts of the stencil tests.\n\trender.SetStencilCompareFunction( STENCIL_EQUAL )\n\t-- Flush the screen. This will draw teal over all hidden sections of the stencil tests\n\trender.ClearBuffersObeyStencil( 0, 148, 133, 255, false )\n\n\t-- Let everything render normally again\n\trender.SetStencilEnable( false )\nend )","output":{"image":{"src":"basic_zfail_operation.jpg","alt":"800px"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetToneMappingScaleLinear","parent":"render","type":"libraryfunc","realm":"Client","description":"Sets the tone mapping scale for upcoming rendering operations.","args":{"arg":{"text":"The tonemapping scales.\n* X - Output scale.\n* Y - Lightmap scale.\n* Z - Reflection map scale.","name":"scales","type":"Vector"}}},"example":{"description":"This disables HDR bloom effect for the rendering inside the block.","code":"local tune_nohdr = Vector( 0.80, 0, 0 )\n\nlocal oldtune = render.GetToneMappingScaleLinear()\nrender.SetToneMappingScaleLinear( tune_nohdr ) -- Turns off hdr\n   \n-- render your stuff\n\nrender.SetToneMappingScaleLinear( oldtune ) -- Resets hdr"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetViewPort","parent":"render","type":"libraryfunc","description":{"text":"Changes the view port position and size. The values will be clamped to the game's screen resolution.\n\nIf you are looking to render something to a texture (render target), you should use render.PushRenderTarget.","note":"This function will override values of Global.ScrW and Global.ScrH with the ones you set."},"realm":"Client and Menu","args":{"arg":[{"text":"X origin of the view port.","name":"x","type":"number"},{"text":"Y origin of the view port.","name":"y","type":"number"},{"text":"Width of the view port.","name":"w","type":"number"},{"text":"Height of the view port.","name":"h","type":"number"}]}},"example":{"description":"Renders a screen with a dimension of 32 X 32 and resets the render system to normal.","code":"local oldW, oldH = ScrW(), ScrH()\n\nrender.PushRenderTarget( RTName )\nrender.Clear( 0, 0, 0, 255 )\n\nrender.SetViewPort( 0, 0, 32, 32 )\n\trender.RenderView( CamData )\nrender.SetViewPort( 0, 0, oldW, oldH )\n\nrender.PopRenderTarget()"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetWriteDepthToDestAlpha","parent":"render","type":"libraryfunc","description":"Sets the internal parameter **INT_RENDERPARM_WRITE_DEPTH_TO_DESTALPHA**.","realm":"Client","args":{"arg":{"name":"enable","type":"boolean"}}},"example":{"description":"Draws a \"masked\" texture.","code":"-- Give the RT a size\nlocal TEX_SIZE = 512\n\n-- Create the RT\nlocal tex = GetRenderTargetEx( \"ExampleMaskRT\", TEX_SIZE, TEX_SIZE, RT_SIZE_OFFSCREEN,\n\t\t MATERIAL_RT_DEPTH_SHARED --[[IMPORTANT]], 0, 0, IMAGE_FORMAT_RGBA8888 )\n\n-- Create a translucent render-able material for our render target\nlocal myMat = CreateMaterial( \"ExampleMaskRTMat\", \"UnlitGeneric\", {\n\t[\"$basetexture\"] = tex:GetName(), -- Make the material use our render target texture\n\t[\"$translucent\"] = \"1\" -- make the drawn material transparent\n} )\n\nlocal txBackground = Material( \"models/weapons/v_toolgun/screen_bg\" )\nlocal mask = Material( \"gui/gradient_down\" )\n\n--[[\nA few words on the mask image. When creating a custom mask image, it must have an alpha channel which dictates\nwhat pixels to draw and which not to. The visual color should be all white for this example to work.\nHaving lets say a red color mask would tint the final image red.\n]]\n\nfunction RenderMaskedRT()\n-- Draw the \"background\" image\n\tsurface.SetDrawColor( color_white )\n\tsurface.SetMaterial( txBackground )\n\tsurface.DrawTexturedRect( 0, 0, TEX_SIZE, TEX_SIZE )\n\t-- Animate the background for fun\n\tsurface.DrawTexturedRectRotated( TEX_SIZE / 2, TEX_SIZE / 2, TEX_SIZE, TEX_SIZE, CurTime() * 20 )\n\n-- Draw the actual mask\nrender.SetWriteDepthToDestAlpha( false )\n\trender.OverrideBlend( true, BLEND_SRC_COLOR, BLEND_SRC_ALPHA, BLENDFUNC_MIN )\n\t\tsurface.SetMaterial( mask )\n\t\tsurface.DrawTexturedRect( 0, 0, TEX_SIZE, TEX_SIZE )\n\trender.OverrideBlend( false )\nrender.SetWriteDepthToDestAlpha( true )\nend\n\n-- Draw it on screen\nhook.Add( \"HUDPaint\", \"DrawExampleMaskMat\", function()\n\t-- Render animated stuff to the render target\n\trender.PushRenderTarget( tex )\n\tcam.Start2D()\n\t\trender.Clear( 0, 0, 0, 0 )\n\t\tRenderMaskedRT()\n\tcam.End2D()\n\trender.PopRenderTarget()\n\n\t-- This is just for debugging, to see what it looks like without the mask\n\t-- RenderMaskedRT()\n\n\t-- Actually draw the Render Target to see the final result.\n\tsurface.SetDrawColor( color_white )\n\tsurface.SetMaterial( myMat )\n\tsurface.DrawTexturedRect( 520, 0, TEX_SIZE, TEX_SIZE )\nend )","output":{"upload":{"src":"70c/8d7ba1c1119faa7.png","size":"226575","name":"image.png"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Spin","parent":"render","type":"libraryfunc","description":"Swaps the frame buffers/cycles the frame. In other words, this updates the screen.\n\nIf you take a really long time during a single frame render, it is a good idea to use this and let the user know that the game isn't stuck.","realm":"Client"},"example":{"description":"Code from [Super DOF](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/lua/postprocess/super_dof.lua#L219-L236); Push the current progress of rendering onto the screen and display a percentage of completion near the bottom right.","code":"-- Restore RT\nrender.SetRenderTarget( OldRT )\n\n-- Render our result buffer to the screen\nmatFSB:SetFloat( \"$alpha\", 1 )\nmatFSB:SetTexture( \"$basetexture\", texFSB )\n\nrender.SetMaterial( matFSB )\nrender.DrawScreenQuad()\n\ncam.Start2D()\n\tlocal add = ( i / ( math.pi*2 ) ) * ( 1 / passes )\n\tlocal percent = string.format( \"%.1f\", ( mul - ( 1 / passes ) + add ) * 100 )\n\tdraw.DrawText( percent .. \"%\", \"GModWorldtip\", view.w - 100, view.h - 100, Color( 0, 0, 0, 255 ), TEXT_ALIGN_CENTER )\n\tdraw.DrawText( percent .. \"%\", \"GModWorldtip\", view.w - 101, view.h - 101, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )\ncam.End2D()\n\nrender.Spin()","output":{"image":{"src":"Super_DoF_Render_Spin.gif"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"StartBeam","parent":"render","type":"libraryfunc","description":{"text":"Begin drawing a multi-segment Beam.\n\n\t\t\tFor more detailed information on Beams, as well as usage examples, see the Beams Render Reference.","rendercontext":{"hook":"false","type":"3D"}},"realm":"Client","args":{"arg":{"text":"The number of Beam Segments that this multi-segment Beam will contain.","name":"segmentCount","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SupportsHDR","parent":"render","type":"libraryfunc","description":"Returns whether the player's hardware supports HDR. (High Dynamic Range) HDR can still be disabled by the `mat_hdr_level` console variable or just not be supported by the map.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/render.lua","line":"47-L53"},"rets":{"ret":{"text":"`true` if the player's hardware supports HDR.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SupportsPixelShaders_1_4","parent":"render","type":"libraryfunc","description":"Returns if the current settings and the system allow the usage of pixel shaders 1.4.","realm":"Client and Menu","rets":{"ret":{"text":"Whether Pixel Shaders 1.4 are supported or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SupportsPixelShaders_2_0","parent":"render","type":"libraryfunc","description":"Returns if the current settings and the system allow the usage of pixel shaders 2.0.","realm":"Client and Menu","rets":{"ret":{"text":"Whether Pixel Shaders 2.0 are supported or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SupportsVertexShaders_2_0","parent":"render","type":"libraryfunc","description":"Returns if the current settings and the system allow the usage of vertex shaders 2.0.","realm":"Client and Menu","rets":{"ret":{"text":"Whether Vertex Shaders 2.0 are supported or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SuppressEngineLighting","parent":"render","type":"libraryfunc","description":{"text":"Suppresses or enables any engine lighting for any upcoming render operation.","bug":{"text":"This does not affect IMeshes.","issue":"4070"}},"realm":"Client","args":{"arg":{"text":"True to suppress false to enable.","name":"suppressLighting","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"TurnOnToneMapping","parent":"render","type":"libraryfunc","description":"Enables HDR tone mapping which influences the brightness.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"UpdateFullScreenDepthTexture","parent":"render","type":"libraryfunc","description":"Updates the texture returned by render.GetFullScreenDepthTexture.\n\nSilently fails if render.SupportsPixelShaders_2_0 returns false.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"UpdatePowerOfTwoTexture","parent":"render","type":"libraryfunc","description":"Updates the power of two texture.","realm":"Client","rets":{"ret":{"text":"The render.GetPowerOfTwoTexture.","name":"","type":"ITexture"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"UpdateRefractTexture","parent":"render","type":"libraryfunc","description":"Pretty much alias of render.UpdatePowerOfTwoTexture but does not return the texture.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"UpdateScreenEffectTexture","parent":"render","type":"libraryfunc","description":"Copies the entire screen to the screen effect texture, which can be acquired via render.GetScreenEffectTexture. This function is mainly intended to be used in GM:RenderScreenspaceEffects.","realm":"Client","args":{"arg":{"text":"Texture index to update. Max index is 3, but engine only creates the first two for you.","name":"textureIndex","type":"number","default":"0"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"WorldMaterialOverride","parent":"render","type":"libraryfunc","description":"This function overrides all map materials for one frame.","realm":"Client","args":{"arg":{"name":"mat","type":"IMaterial","default":"nil"}}},"example":{"description":"\n","code":"local X = Material( \"CONCRETE/CONCRETEFLOOR026A\" )\nhook.Add( \"RenderScene\", \"\", function() render.WorldMaterialOverride( X ) end )","output":"![](https://files.facepunch.com/rubat/1b2311b1/J6RKLesbNH.jpg)"},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddFile","parent":"resource","type":"libraryfunc","description":{"text":"Adds the specified and all related files to the list of files the client should download from the server.\n\nFor convenience, this function will automatically add any other files that are related to the selected one, and throw an error if it can't find them. For example, a `.vmt` file will automatically add the `.vtf` with the same name, and a `.mdl` file will automatically add all `.vvd`, `.ani`, `.dx80.vtx`, `.dx90.vtx` and `.phy` files with the same name, with a separate error for each missing file.\n\nIf you do not want it to do this, use resource.AddSingleFile.\n\nSee also Serving Content","warning":"There's a 8192 downloadable file limit. If you need more, consider using Workshop addons - resource.AddWorkshop. You should also consider the fact that you have way too many downloads. This limit is shared among all `resource.Add*` functions.","note":"The file must exist on the server it will not be added to the downloadables list!"},"realm":"Server","args":{"arg":{"text":"**Virtual path** of the file to be added, relative to `garrysmod/`.  \nDo not add `.bz2` to the filepath.  \nDo not add `gamemodes/*gamemodename*/content/` or `addons/*addonname*/` to the path, since those paths are mounted virtually as if they are in the root `garrysmod/`.","name":"path","type":"string"}}},"example":{"description":"Example of usage.","code":"resource.AddFile( \"materials/my/material.vmt\" ) -- Automatically adds materials/my/material.vtf\nresource.AddFile( \"models/my/model.mdl\" ) -- Automatically adds models/my/model.vtx and the rest\nresource.AddFile( \"sound/my/sound.wav\" ) -- Be careful, there's no S in the sound."},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddSingleFile","parent":"resource","type":"libraryfunc","description":{"text":"Adds the specified file to the files the client should download from the server.\n\nIf you wish to add textures or models, consider using resource.AddFile to add all the files required for a texture/model.\n\n\n\n\n\nSee also Serving Content","warning":"There's a 8192 downloadable file limit. If you need more, consider using Workshop addons - resource.AddWorkshop. You should also consider the fact that you have way too many downloads. This limit is shared among all `resource.Add*` functions.","note":"The file must exist on the server or players will not download it!"},"realm":"Server","args":{"arg":{"text":"Path of the file to be added, relative to garrysmod/","name":"path","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddWorkshop","parent":"resource","type":"libraryfunc","description":{"text":"Adds a workshop addon for the client to download before entering the server. This will not \"install\" the addon on your server, see Workshop for Dedicated Servers for installing Steam Workshop addons onto your servers.\n\nHaving the raw files from a workshop item does not count as having already downloaded it.\n\nSo players who previously downloaded a map through [FastDL](Serving_Content) will have to re-download it if it is part of a workshop addon.\n\nYou should try to only add addons that have custom content (models, sounds, etc). Lua files are not considered content, and are handled by a separate system. Adding workshop addons that only have Lua files is a waste, it will do nothing.\n\nGamemodes that are workshop enabled and the current map are automatically added to this list, if they come from the servers' workshop collection - so there's no need to manually add them.\n\n\n\nSee also Serving Content","warning":"There's a 8192 downloadable file limit. If you need more, consider the fact that you have way too many downloads. This limit is shared among all `resource.Add*` functions."},"realm":"Server","args":{"arg":{"text":"The workshop id of the file. This cannot be a collection.","name":"workshopid","type":"string"}}},"example":{"description":"Adds the Achievement Viewer addon (workshop id `104606562`). Any clients that join will download this addon if they haven't previously downloaded it from the workshop or from the server (via the workshop).\n\nYou get the ID from the URL of the workshop addon. For example, here's the URL of the Achievement Viewer addon's page: https://steamcommunity.com/sharedfiles/filedetails/?id=104606562","code":"resource.AddWorkshop( \"104606562\" )","output":"Players joining the server will now be forced to download the Achievement Viewer addon."},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddRestoreHook","parent":"saverestore","type":"libraryfunc","description":"Adds a restore/load hook for the Half-Life 2 save system.","realm":"Shared","file":{"text":"lua/includes/modules/saverestore.lua","line":"371-L378"},"args":{"arg":[{"text":"The unique identifier for this hook.","name":"identifier","type":"string"},{"text":"The function to be called when an engine save is being loaded.\n\n\n\nYou can also use those functions to read data:\n* saverestore.ReadVar\n* saverestore.ReadTable\n* saverestore.LoadEntity","name":"callback","type":"function","callback":{"arg":{"text":"The restore object to be used to read data from save file that is being loaded.","type":"IRestore","name":"save"}}}]}},"example":{"description":"Example usage.","code":"saverestore.AddRestoreHook( \"HookNameHere\", function( save )\n\tPrintTable( saverestore.ReadTable( save ) )\nend )","output":"If you used example from saverestore.AddSaveHook\n\n```\n1 = Test\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddSaveHook","parent":"saverestore","type":"libraryfunc","description":"Adds a save hook for the Half-Life 2 save system. You can use this to carry data through level transitions in Half-Life 2.","realm":"Shared","file":{"text":"lua/includes/modules/saverestore.lua","line":"357-L364"},"args":{"arg":[{"text":"The unique identifier for this hook.","name":"identifier","type":"string"},{"text":"The function to be called when an engine save is being saved.\n\n\n\nYou can also use those functions to save data:\n* saverestore.WriteVar\n* saverestore.WriteTable\n* saverestore.SaveEntity","name":"callback","type":"function","callback":{"arg":{"text":"The save object to be used to write data to the save file that is being saved.","type":"ISave","name":"save"}}}]}},"example":{"description":"Example usage.","code":"saverestore.AddSaveHook( \"HookNameHere\", function( save )\n\tsaverestore.WriteTable( { \"test\" }, save )\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"LoadEntity","parent":"saverestore","type":"libraryfunc","description":"Loads Entity:GetTable from the save game file that is being loaded and merges it with the given entitys Entity:GetTable.","realm":"Shared","file":{"text":"lua/includes/modules/saverestore.lua","line":"334-L350"},"args":{"arg":[{"text":"The entity which will receive the loaded values from the save.","name":"ent","type":"Entity"},{"text":"The restore object to read the Entity:GetTable from.","name":"save","type":"IRestore"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"LoadGlobal","parent":"saverestore","type":"libraryfunc","description":{"text":"Called by engine when a save is being loaded.\n\nThis handles loading gamemode and calls all of the hooks added with saverestore.AddRestoreHook.","internal":""},"realm":"Shared","file":{"text":"lua/includes/modules/saverestore.lua","line":"408-L434"},"args":{"arg":{"text":"The restore object to read data from the save file with.","name":"save","type":"IRestore"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PreRestore","parent":"saverestore","type":"libraryfunc","description":{"text":"Called by the engine just before saverestore.LoadGlobal is.","internal":""},"realm":"Shared","file":{"text":"lua/includes/modules/saverestore.lua","line":"55-L60"}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PreSave","parent":"saverestore","type":"libraryfunc","description":{"text":"Called by the engine just before saverestore.SaveGlobal is.","internal":""},"realm":"Shared","file":{"text":"lua/includes/modules/saverestore.lua","line":"48-L53"}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadTable","parent":"saverestore","type":"libraryfunc","description":"Reads a table from the save game file that is being loaded.","realm":"Shared","file":{"text":"lua/includes/modules/saverestore.lua","line":"271-L313"},"args":{"arg":{"text":"The restore object to read the table from.","name":"save","type":"IRestore"}},"rets":{"ret":{"text":"The table that has been read, if any","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ReadVar","parent":"saverestore","type":"libraryfunc","description":"Loads a variable from the save game file that is being loaded.\n\nVariables will be read in the save order you have saved them.","realm":"Shared","file":{"text":"lua/includes/modules/saverestore.lua","line":"185-L214"},"args":{"arg":{"text":"The restore object to read variables from.","name":"save","type":"IRestore"}},"rets":{"ret":{"text":"The variable that was read, if any.","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SaveEntity","parent":"saverestore","type":"libraryfunc","description":"Saves entitys Entity:GetTable to the save game file that is being saved.","realm":"Shared","file":{"text":"lua/includes/modules/saverestore.lua","line":"320-L328"},"args":{"arg":[{"text":"The entity to save Entity:GetTable of.","name":"ent","type":"Entity"},{"text":"The save object to save Entity:GetTable to.","name":"save","type":"ISave"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SaveGlobal","parent":"saverestore","type":"libraryfunc","description":{"text":"Called by engine when a save is being saved.\n\nThis handles saving gamemode and calls all of the hooks added with saverestore.AddSaveHook.","internal":""},"realm":"Shared","file":{"text":"lua/includes/modules/saverestore.lua","line":"385-L401"},"args":{"arg":{"text":"The save object to write data into the save file.","name":"save","type":"ISave"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WritableKeysInTable","parent":"saverestore","type":"libraryfunc","description":"Returns how many writable keys are in the given table.","realm":"Shared","file":{"text":"lua/includes/modules/saverestore.lua","line":"132-L144"},"args":{"arg":{"text":"The table to test.","name":"table","type":"table"}},"rets":{"ret":{"text":"The number of keys that can be written with saverestore.WriteTable.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteTable","parent":"saverestore","type":"libraryfunc","description":"Write a table to a save game file that is being saved.","realm":"Shared","file":{"text":"lua/includes/modules/saverestore.lua","line":"220-L265"},"args":{"arg":[{"text":"The table to write","name":"table","type":"table"},{"text":"The save object to write the table to.","name":"save","type":"ISave"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"WriteVar","parent":"saverestore","type":"libraryfunc","description":"Writes a variable to the save game file that is being saved.","realm":"Shared","file":{"text":"lua/includes/modules/saverestore.lua","line":"151-L178"},"args":{"arg":[{"text":"The value to save.\n\nIt can be one of the following types: number, boolean, string, Entity, Angle, Vector or table.","name":"value","type":"any"},{"text":"The save object to write the variable to.","name":"save","type":"ISave"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Alias","parent":"scripted_ents","type":"libraryfunc","file":{"text":"lua/includes/modules/scripted_ents.lua","line":"256-L260"},"description":"Defines an alias string that can be used to refer to another classname","realm":"Shared","args":{"arg":[{"text":"A new string which can be used to refer to another classname","name":"alias","type":"string"},{"text":"The classname the alias should refer to","name":"classname","type":"string"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Get","parent":"scripted_ents","type":"libraryfunc","file":{"text":"lua/includes/modules/scripted_ents.lua","line":"159-L193"},"description":{"text":"Returns a copy of the ENT table for a class, including functions defined by the base class","internal":""},"realm":"Shared","args":{"arg":{"text":"The classname of the ENT table to return, can be an alias","name":"classname","type":"string"}},"rets":{"ret":{"text":"entTable","name":"","type":"table"}}},"example":{"description":"Use of PrintTable function to print the contents of base_entity SENT table.","code":"PrintTable(scripted_ents.Get(\"base_entity\"))","output":"```\nAdminOnly\t=\tfalse\nBase\t=\tbase_entity\nClassName\t=\tbase_entity\nFolder\t=\tentities/base_entity\nInitialize\t=\tfunction: 0x2a205b50\nOnRestore\t=\tfunction: 0x2a6d4b90\nSpawnable\t=\tfalse\nThink\t=\tfunction: 0x2a153780\nType\t=\tanim\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetList","parent":"scripted_ents","type":"libraryfunc","file":{"text":"lua/includes/modules/scripted_ents.lua","line":"228-L236"},"description":"Returns a copy of the list of all ENT tables registered","realm":"Shared","rets":{"ret":{"text":"A table of all SENTs where the key is the classname and the value is a table where:\n* table **t** — The ENT table associated with the entity\n* boolean **isBaseType** — Unused. Always `true`\n* string **Base** — The entity base\n* string **type** — The entity type","name":"","type":"table<string, table>"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMember","parent":"scripted_ents","type":"libraryfunc","file":{"text":"lua/includes/modules/scripted_ents.lua","line":"262-L278"},"description":"Retrieves a member of entity's table.","realm":"Shared","args":{"arg":[{"text":"Entity's class name","name":"class","type":"string"},{"text":"Name of member to retrieve","name":"name","type":"string"}]},"rets":{"ret":{"text":"The member or nil if failed","name":"","type":"any"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSpawnable","parent":"scripted_ents","type":"libraryfunc","file":{"text":"lua/includes/modules/scripted_ents.lua","line":"238-L254"},"description":"Returns a list of all ENT tables which contain ENT.Spawnable","realm":"Shared","rets":{"ret":{"text":"A table of Structures/ENTs","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetStored","parent":"scripted_ents","type":"libraryfunc","description":"Returns the actual ENT table for a class. Modifying functions/variables in this table will change newly spawned entities","realm":"Shared","file":{"text":"lua/includes/modules/scripted_ents.lua","line":"220-L222"},"args":{"arg":{"text":"The classname of the ENT table to return","name":"classname","type":"string"}},"rets":{"ret":{"text":"entTable","name":"","type":"table"}}},"example":{"description":"Modifies all newly spawned gmod_button's to print a message on use","code":"local ENT = scripted_ents.GetStored(\"gmod_button\").t\nlocal oldUse = ENT.Use\nfunction ENT:Use(activator, caller, type, value)\n print(tostring(self.Entity)..\" just got pressed!\")\n oldUse(self,activator, caller, type, value)\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetType","parent":"scripted_ents","type":"libraryfunc","file":{"text":"lua/includes/modules/scripted_ents.lua","line":"195-L214"},"description":"Returns the 'type' of a class, this will one of the following: 'anim', 'ai', 'brush', 'point'.","realm":"Shared","args":{"arg":{"text":"The classname to check","name":"classname","type":"string"}},"rets":{"ret":{"text":"type","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsBasedOn","parent":"scripted_ents","type":"libraryfunc","file":{"text":"lua/includes/modules/scripted_ents.lua","line":"44-L51"},"description":"Checks if name is based on base","realm":"Shared","args":{"arg":[{"text":"Entity's class name to be checked","name":"name","type":"string"},{"text":"Base class name to be checked","name":"base","type":"string"}]},"rets":{"ret":{"text":"Returns true if class name is based on base, else false.","name":"","type":"boolean"}}},"example":{"description":"See if gmod_hands is based on base_anim.","code":"print(scripted_ents.IsBasedOn(\"gmod_hands\", \"base_anim\"))","output":"true"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OnLoaded","parent":"scripted_ents","type":"libraryfunc","file":{"text":"lua/includes/modules/scripted_ents.lua","line":"144-L157"},"description":{"text":"Called after all ENTS have been loaded and runs baseclass.Set on each one.\n\nYou can retrieve all the currently registered ENTS with scripted_ents.GetList.","internal":"","note":"This is not called after an ENT auto refresh, and thus the inherited baseclass functions retrieved with baseclass.Get will not be updated"},"realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Register","parent":"scripted_ents","type":"libraryfunc","file":{"text":"lua/includes/modules/scripted_ents.lua","line":"53-L139"},"description":{"text":"Registers an ENT table with a classname. Reregistering an existing classname will automatically update the functions of all existing entities of that class.","bug":{"text":"Sub-tables provided in the first argument will not carry over their metatable, and will receive a BaseClass key if the table was merged with the base's. Userdata references, which includes Vectors, Angles, Entities, etc. will not be copied.","pull":"1300"}},"realm":"Shared","args":{"arg":[{"text":"The ENT table to register.  \n\t\t\tFor the table's format and available options see the Structures/ENT page.","name":"ENT","type":"table"},{"text":"The classname to register.","name":"classname","type":"string"}]}},"example":{"code":"local ENT = scripted_ents.Get( \"gmod_button\" )\nlocal oldUse = ENT.Use\n\nfunction ENT:Use( activator, caller, type, value )\n\tprint( tostring( self.Entity ) .. \" just got pressed!\" )\n\toldUse( self, activator, caller, type, value )\nend\n\nscripted_ents.Register( ENT, \"gmod_button\" )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddProvider","parent":"search","type":"libraryfunc","description":"Adds a search result provider. For examples, see [gamemodes/sandbox/gamemode/cl_search_models.lua](https://github.com/Facepunch/garrysmod/blob/7c23addd2c35d3d046c80e3d0cb6052055eca3e2/garrysmod/gamemodes/sandbox/gamemode/cl_search_models.lua)","realm":"Client","file":{"text":"lua/includes/modules/search.lua","line":"6-L18"},"args":{"arg":[{"text":"Provider function.","name":"provider","type":"function","callback":{"arg":{"text":"The search query user has inputed.","type":"string","name":"searchQuery"},"ret":{"text":"You must return a list of tables structured like this:\n  * string text - Text to \"Copy to clipboard\"\n  * function func - Function to use/spawn the item\n  * Panel icon - A panel to add to spawnmenu\n  * table words - A table of words?","type":"table","name":"data"}}},{"text":"If provided, ensures that only one provider exists with the given ID at a time.","name":"id","type":"string","default":"nil"}]}},"example":{"description":"Model search from gamemodes/sandbox/gamemode/cl_search_models.lua with added comments","code":"--\n-- Model Search\n--\nlocal model_list = nil\nsearch.AddProvider( function( str )\n\n\tif ( model_list == nil ) then\n\n\t\tmodel_list = {}\n\t\tGetAllFiles( model_list, \"models/\", \".mdl\", \"GAME\" )\n\n\tend\n\n\tlocal models = {}\n\n\tfor k, v in pairs( model_list ) do\n\n\t\t-- Don't search in the models/ and .mdl bit of every model, because every model has this bit, unless they are looking for direct model path\n\t\tlocal modelpath = v\n\t\tif ( modelpath:StartWith( \"models/\" ) && modelpath:EndsWith( \".mdl\" ) && !str:EndsWith( \".mdl\" ) ) then modelpath = modelpath:sub( 8, modelpath:len() - 4 ) end\n\n\t\tif ( modelpath:find( str, nil, true ) ) then\n\n\t\t\tif ( IsUselessModel( v ) ) then continue end\n\n\t\t\tlocal entry = {\n\t\t\t\ttext = v:GetFileFromFilename(), -- Text to \"Copy to clipboard\"\n\t\t\t\tfunc = function() RunConsoleCommand( \"gm_spawn\", v ) end, -- Function to use/spawn the item\n\t\t\t\ticon = spawnmenu.CreateContentIcon( \"model\", g_SpawnMenu.SearchPropPanel, { model = v } ), -- A panel to add to spawnmenu\n\t\t\t\twords = { v } -- A table of words?\n\t\t\t}\n\n\t\t\ttable.insert( models, entry )\n\n\t\tend\n\n\t\tif ( #models >= sbox_search_maxresults:GetInt() / 2 ) then break end\n\n\tend\n\n\treturn models\n\nend, \"props\" ) -- ID: \"props\""},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetResults","parent":"search","type":"libraryfunc","description":"Retrieves search results.","realm":"Client","file":{"text":"lua/includes/modules/search.lua","line":"20-L49"},"args":{"arg":[{"text":"Search query","name":"query","type":"string"},{"text":"If set, only searches given provider type(s), instead of everything. For example `\"tool\"` will only search tools in Sandbox. Can be a table for multiple types.","name":"types","type":"string","default":"nil"},{"text":"How many results to stop at","name":"maxResults","type":"number","default":"1024"}]},"rets":{"ret":{"text":"A table of results","name":"","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddCurrentServerToFavorites","parent":"serverlist","type":"libraryfunc","description":{"text":"Adds current server the player is on to their favorites.","internal":""},"args":{"arg":{"text":"`true` if to add, or `false` if to remove from favorites.","name":"addOrRemove","type":"boolean"}},"realm":"Menu"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"AddServerToFavorites","parent":"serverlist","type":"libraryfunc","description":"Adds the given server address to their favorites.","args":{"arg":{"text":"Server Address. **IP:Port like \"127.0.0.1:27015\"**","name":"address","type":"string"}},"realm":"Menu"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"IsCurrentServerFavorite","parent":"serverlist","type":"libraryfunc","description":"Returns true if the current server address is in their favorites.","rets":{"ret":{"text":"true if the current server is in their favorites","name":"favorite","type":"boolean"}},"realm":"Menu"},"example":{"description":"Adds an Address to the Favorites and checks if it has been added.","code":"serverlist.AddCurrentServerToFavorites()\nprint( serverlist.IsCurrentServerFavorite() )","output":"true"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"IsServerFavorite","parent":"serverlist","type":"libraryfunc","description":"Returns true if the given server address is in their favorites.","args":{"arg":{"text":"Server Address. **IP:Port like \"127.0.0.1:27015\"**","name":"address","type":"string"}},"rets":{"ret":{"text":"true if the server address is in their favorites","name":"favorite","type":"boolean"}},"realm":"Menu"},"example":{"description":"Adds an Address to the Favorites and checks if it has been added.","code":"serverlist.AddServerToFavorites( \"127.0.0.1:27015\" )\nprint( serverlist.IsServerFavorite( \"127.0.0.1:27015\" ) )","output":"true"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"PingServer","parent":"serverlist","type":"libraryfunc","description":"Queries a server for its information/ping.","realm":"Menu","added":"2021.01.27","args":{"arg":[{"text":"The IP address of the server, including the port.","name":"ip","type":"string"},{"text":"The function to be called if and when the request finishes.\n\nCallback has arguments described here: Structures/ServerQueryData.","name":"callback","type":"function"}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"PlayerList","parent":"serverlist","type":"libraryfunc","description":"Queries a server for its player list.","realm":"Menu","args":{"arg":[{"text":"The IP address of the server, including the port.","name":"ip","type":"string"},{"text":"The function to be called if and when the request finishes.","name":"callback","type":"function","callback":{"arg":{"text":"A list of players and their info. Each entry has the following fields:\n  * number **time** - The amount of time the player is playing on the server, in seconds\n  * string **name** - The player name\n  * number **score** - The players score","type":"table","name":"data"}}}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"Query","parent":"serverlist","type":"libraryfunc","description":"Queries the master server for server list.","realm":"Menu","args":{"arg":{"text":"The information about what kind of servers we want. See Structures/ServerQueryData","name":"data","type":"table"}}},"example":{"name":"Setting up this function","description":"Showcasing how to utilize this function","code":"local data = {\n        Type = \"internet\",\n        GameDir = \"garrysmod\",\n        AppID = 4000,\n        Callback = function(ping,name,desc,map,players,maxplayers,botplayers,pass,lastplayed,address,gamemode,workshopid,isanon,version,localization,gmcategory)\n            print(\"Callback worked\")\n        end,\n        CallbackFailed = function (address)\n            print(\"callback failed\")\n        end,\n        Finished = function ()\n            print(\"Finished\")\n        end,\n}\n\nserverlist.Query(data)","output":"console will print either the \"worked\" callback function or the \"failed\" callback function"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"RemoveServerFromFavorites","parent":"serverlist","type":"libraryfunc","description":"Removes the given server address from their favorites.","args":{"arg":{"text":"Server Address. **IP:Port like \"127.0.0.1:27015\"**","name":"address","type":"string"}},"realm":"Menu"},"example":{"description":"Adds a server address to their favorites and removes it.","code":"serverlist.AddServerToFavorites( \"127.0.0.1:27015\" )\nprint( serverlist.IsServerFavorite( \"127.0.0.1:27015\" ) )\nserverlist.RemoveServerFromFavorites( \"127.0.0.1:27015\" )\nprint( serverlist.IsServerFavorite( \"127.0.0.1:27015\" ) )","output":"```lua\ntrue\nfalse\n```"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"Add","parent":"sound","type":"libraryfunc","description":"Creates a [sound scripts](https://developer.valvesoftware.com/wiki/Soundscripts). It can also override sounds, which seems to only work when set on the server.\n\nYou can find a list of common sound scripts that are shipped with the game by default here: Common Sounds.\n\nA list of sound scripts can be retrieved with sound.GetTable.","realm":"Shared","args":{"arg":{"text":"The sounds properties. See Structures/SoundData","name":"soundData","type":"table{SoundData}"}}},"example":{"description":"Creates a sound script. It will automatically vary in pitch and be played in a given audio channel to better control which sounds mix with which sounds and how.\n\nIn this example, the file location could be: (Choose one)\n* garrysmod/sound/`phx/explode03.wav`\n* garrysmod/gamemodes/MyCoolGameMode/content/sound/`phx/explode03.wav`\n* garrysmod/addons/myCoolAddon/sound/`phx/explode03.wav`\n* garrysmod/addons/myCoolAddon/gamemodes/MyCoolGameMode/content/sound/`phx/explode03.wav`","code":"sound.Add( {\n\tname = \"big_explosion\",\n\tchannel = CHAN_STATIC,\n\tvolume = 1.0,\n\tlevel = 80,\n\tpitch = {95, 110},\n\tsound = \"phx/explode03.wav\"\n} )","output":"You can now play your custom **sound script** with Entity:EmitSound like so:\n\n```\nEntity( 1 ):EmitSound( \"big_explosion\" )\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AddSoundOverrides","parent":"sound","type":"libraryfunc","description":"Overrides [sound scripts](https://developer.valvesoftware.com/wiki/Soundscripts) defined inside of a `.txt` file; typically used for adding map-specific sounds.","realm":"Shared","args":{"arg":{"text":"Path to the script file to load.","name":"filepath","type":"string"}}},"example":{"description":"Adds and overrides all sounds defined in scripts/override_test.txt","code":"sound.AddSoundOverrides(\"scripts/override_test.txt\")","output":"```\nSoundEmitter:  adding map sound overrides from scripts/override_test.txt [1 total, 1 replacements, 0 duplicated replacements]\n```\n\n(Displayed in the console)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EmitHint","parent":"sound","type":"libraryfunc","description":"Emits a sound hint to the game elements to react to, for example to repel or attract antlions.","realm":"Server","added":"2020.10.14","args":{"arg":[{"text":"The hint to emit. This can be a bit flag. See Enums/SOUND","name":"hint","type":"number"},{"text":"The position to emit the hint at","name":"pos","type":"Vector"},{"text":"The volume or radius of the hint","name":"volume","type":"number"},{"text":"The duration of the hint in seconds","name":"duration","type":"number"},{"text":"If set, the sound hint will be ignored/deleted when the given entity is destroyed.","name":"owner","type":"Entity","default":"NULL"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Generate","parent":"sound","type":"libraryfunc","description":"Creates a sound from a function.","realm":"Client","args":{"arg":[{"text":"A unique identifier for the sound.","name":"identifier","type":"string","warning":"You cannot override already existing ones."},{"text":"The sample rate of the sound. Must be `11025`, `22050` or `44100`.","name":"samplerate","type":"number"},{"text":"The length in seconds of the sound to generate.","name":"length","type":"number"},{"text":"A function which will be called to generate every sample on the sound. \n\n\t\t\t\n\n\t\tThis argument can also be given a table of samples, where values must range from `-1` to `1`.  \n\t\tThis argument can also be a string of raw 16bit binary data, (each sample is unsigned short).","name":"callbackOrData","type":"function","alttype":"table","callback":{"arg":{"text":"The current sample number.","type":"number","name":"sampleIndex"},"ret":{"text":"The return value must be between `-1.0` and `1.0`.  \n\t\t\tOther values will wrap back to the -1 to 1 range and basically clip.  \n\t\t\tThere are **65535** possible quantifiable values between `-1` and `1`.","type":"number","name":"sampleValue"}}},{"text":"Sample ID of the loop start. If given, the sound will be looping and will restart playing at given position after reaching its end.","name":"loopStart","type":"number","default":"nil","added":"2024.06.04"}]}},"example":{"description":"Plays a 2000 Hz sine wave at maximum volume.","code":"local frequency = 2000 -- Hz\nlocal samplerate = 44100\n\nlocal function data( t )\n    return math.sin( t * math.pi * 2 / samplerate * frequency )\nend\n\ntest_sound_id = test_sound_id and test_sound_id + 1 or 10\n\nsound.Generate( \"testgen\" .. test_sound_id, samplerate, 2, data )\nsurface.PlaySound( \"testgen\" .. test_sound_id )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetLoudestSoundHint","parent":"sound","type":"libraryfunc","description":"Returns the most dangerous/closest sound hint based on given location and types of sounds to sense.","realm":"Server","added":"2021.06.09","args":{"arg":[{"text":"The types of sounds to choose from. See SOUND_ enums.","name":"types","type":"number"},{"text":"The position to sense sounds at.","name":"pos","type":"Vector"}]},"rets":{"ret":{"text":"A table with SoundHintData structure or `nil` if no sound hints are nearby.","name":"","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetProperties","parent":"sound","type":"libraryfunc","description":"Returns properties of a [sound script](https://developer.valvesoftware.com/wiki/Soundscripts).","realm":"Shared","args":{"arg":{"text":"The name of the sound script","name":"name","type":"string"}},"rets":{"ret":{"text":"The properties of the soundscript. See Structures/SoundData","name":"","type":"table{SoundData}"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetTable","parent":"sound","type":"libraryfunc","description":"Returns a list of all registered [sound scripts](https://developer.valvesoftware.com/wiki/Soundscripts).\n\nNew ones can be registered using sound.Add, and detailed information about each one can be retrieved via sound.GetProperties.","realm":"Shared","rets":{"ret":{"text":"The list/array of all registered sound scripts ( No other information is provided )","name":"","type":"table<string>"}}},"example":{"description":"Writes all the sound scripts to a file in the data folder for easy searching.","code":"file.Write(\"soundscripts.txt\",table.concat(sound.GetTable(),\"\\n\"))","output":"data/soundscripts.txt:\n\n\n```\n...\nEvent.HostageKilled\nPhxMetal.ImpactHard\nPhxMetal.ImpactSoft\nEpicMetal.ImpactHard\nEpicMetal.ImpactSoft\nEpicMetal_Heavy.ImpactHard\nEpicMetal_Heavy.ImpactSoft\nEgg.Crack\nPhx.HoverLight\nPhx.HoverStandard\nPhx.HoverHeavy\nPhx.Afterburner1\nPhx.Afterburner2\nPhx.Afterburner3\nPhx.Afterburner4\nPhx.Afterburner5\nPhx.Turbine\nPhx.Alien1\nPhx.Alien2\nPhx.Jet1\nPhx.Jet2\nPhx.Jet3\nPhx.Jet4\nPhx_Rubber_Tire.Strain\nExplo.ww2bomb\nAI_BaseNPC.BodyDrop_Heavy\nAI_BaseNPC.BodyDrop_Light\nAI_BaseNPC.SwishSound\nAI_BaseNPC.SentenceStop\nBaseCombatCharacter.CorpseGib\nBaseCombatCharacter.StopWeaponSounds\nBaseCombatCharacter.AmmoPickup\n...\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Play","parent":"sound","type":"libraryfunc","description":"Plays a sound from the specified position in the world.\nIf you want to play a sound without a position, such as a UI sound, use surface.PlaySound instead.\n\nThis function is similar to Global.EmitSound, but with less options.","realm":"Shared","args":{"arg":[{"text":"The sound to play. This should either be a sound script name (sound.Add) or a file path relative to the `sound/` folder. (Make note that it's not sound**s**)","name":"snd","type":"string"},{"text":"Where the sound should play.","name":"pos","type":"Vector"},{"text":"Sound level in decibels. 75 is normal. Ranges from 20 to 180, where 180 is super loud. This affects how far away the sound will be heard, see Enums/SNDLVL.","name":"level","type":"number","default":"75"},{"text":"The sound pitch. Range is from 0 to 255. 100 is normal pitch.","name":"pitch","type":"number","default":"100"},{"text":"Output volume of the sound in range 0 to 1.","name":"volume","type":"number","default":"1"},{"text":"The DSP preset for this sound. DSP Presets","name":"dsp","type":"number","added":"2024.02.26","default":"0"}]}},"example":{"description":"Plays an explosion sound at the (0, 0, 0) map coordinates.","code":"sound.Play( \"ambient/explosions/exp1.wav\", Vector(0, 0, 0) )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayFile","parent":"sound","type":"libraryfunc","description":{"text":"Plays a file from GMod directory. You can find a list of all error codes [here](http://www.un4seen.com/doc/#bass/BASS_ErrorGetCode.html)\n\nFor external file/stream playback, see sound.PlayURL.","bug":[{"text":"This fails for looping .wav files in 3D mode.","issue":"1752"},{"text":"This fails with unicode file names.","issue":"2304"}]},"realm":"Client","args":{"arg":[{"text":"The path to the file to play.\n\nUnlike other sound functions and structures, the path is relative to `garrysmod/` instead of `garrysmod/sound/`","name":"path","type":"string"},{"text":"Flags for the sound. Can be one or more of following, separated by a space (\" \"):\n* 3d - Makes the sound 3D, so you can set its position\n* mono - Forces the sound to have only one channel\n* noplay - Forces the sound not to play as soon as this function is called\n* noblock - Disables streaming in blocks. It is more resource-intensive, but it is required for IGModAudioChannel:SetTime.\n\nIf you don't want to use any of the above, you can just leave it as \"\".","name":"flags","type":"string"},{"text":"Callback function that is called as soon as the the stream is loaded.","name":"callback","type":"function","callback":{"arg":[{"text":"The sound channel. Will be nil if an error occurred.","type":"IGModAudioChannel","name":"channel"},{"text":"ID of an error if an error has occurred. Will be nil, otherwise.","type":"number","name":"errorID"},{"text":"Name of an error if an error has occurred. Will be nil, otherwise.","type":"string","name":"errorName"}]}}]}},"example":{"description":"Plays a piece of music from Half-Life 2.","code":"sound.PlayFile( \"sound/music/hl2_song12_long.mp3\", \"noplay\", function( station, errCode, errStr )\n\tif ( IsValid( station ) ) then\n\t\tstation:Play()\n\telse\n\t\tprint( \"Error playing sound!\", errCode, errStr )\n\tend\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PlayURL","parent":"sound","type":"libraryfunc","description":{"text":"Allows you to play external sound files, as well as online radio streams.\nYou can find a list of all error codes [here](http://www.un4seen.com/doc/#bass/BASS_ErrorGetCode.html)\n\nFor offline file playback, see sound.PlayFile.","bug":{"text":"Due to a bug with [BASS](http://www.un4seen.com/), AAC codec streams cannot be played in 3D mode.","issue":"2296"}},"realm":"Client","args":{"arg":[{"text":"The URL of the sound to play","name":"url","type":"string"},{"text":"Flags for the sound. Can be one or more of following, separated by a space (`\" \"`):\n* 3d - Makes the sound 3D, so you can set its position\n* mono - Forces the sound to have only one channel\n* noplay - Forces the sound not to play as soon as this function is called\n* noblock - Disables streaming in blocks. It is more resource-intensive, but it is required for IGModAudioChannel:SetTime.\n\nIf you don't want to use any of the above, you can just leave it as `\"\"`.","name":"flags","type":"string"},{"text":"Callback function that is called as soon as the the stream is loaded.","name":"callback","type":"function","callback":{"arg":[{"text":"The sound channel. Will be nil if an error occurred.","type":"IGModAudioChannel","name":"channel"},{"text":"ID of an error if an error has occurred. Will be nil, otherwise.","type":"number","name":"errorID"},{"text":"Name of an error if an error has occurred. Will be nil, otherwise.","type":"string","name":"errorName"}]}}]}},"example":{"description":"Example usage of the function.","code":"local g_station = nil\nsound.PlayURL( \"https://radio.plaza.one/mp3\", \"3d\", function( station, errCode, errStr )\n\tif ( IsValid( station ) ) then\n\n\t\tstation:SetPos( LocalPlayer():GetPos() )\n\t\n\t\tstation:Play()\n\n\t\t-- Keep a reference to the audio object, so it doesn't get garbage collected which will stop the sound\n\t\tg_station = station\n\t\n\telse\n\n\t\tprint( \"Error playing sound!\", errCode, errStr )\n\n\tend\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetActorGender","parent":"sound","type":"libraryfunc","description":{"text":"Sets the gender of a specific actor (model). This is a system from [base Half-Life 2](https://developer.valvesoftware.com/wiki/Global_actors) - `global_actors.txt`.\n\nThis will affect what voice lines `npc_citizen` will use when they have the given model set.\n\nIt is not limited to `npc_citizens` - any sound played on any entity with given model can have gender specific sounds playing, including soundscripts, by including `$gender` token in the sound file path.","warning":"Internally the gender is stored by model file name only (i.e. `models/alyx.mdl` would be stored as `alyx`), not the full path! Be aware of potential collisions."},"added":"2024.12.12","realm":"Shared","args":{"arg":[{"text":"Path to the model file to set the gender of.","name":"modelPath","type":"string"},{"text":"Gender to set. Only 2 options are permitted: `female` and `male`. Any other option will be ignored.","name":"gender","type":"string"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ActivateTool","parent":"spawnmenu","type":"libraryfunc","description":"Activates a tool, opens context menu and brings up the tool gun.","realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"101-L129"},"args":{"arg":[{"text":"Tool class/file name","name":"tool","type":"string"},{"text":"Should we activate this tool in the menu only or also the toolgun? `true` = menu only,`false` = toolgun aswell","name":"menu_only","type":"boolean","default":"false"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ActivateToolPanel","parent":"spawnmenu","type":"libraryfunc","description":"Activates tools context menu in specified tool tab.","realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"81-L98"},"args":{"arg":[{"text":"The tabID of the tab to open the context menu in","name":"tab","type":"number"},{"text":"The control panel to open","name":"cp","type":"Panel"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ActiveControlPanel","parent":"spawnmenu","type":"libraryfunc","description":"Returns currently opened control panel of a tool, post process effect or some other menu in spawnmenu.","realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"24-L26"},"rets":{"ret":{"text":"The currently opened control panel, if any.","name":"","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddContentType","parent":"spawnmenu","type":"libraryfunc","description":"Registers a new content type that is saveable into spawnlists.\nCreated/called by spawnmenu.CreateContentIcon.","realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"285-L287"},"args":{"arg":[{"text":"An unique name of the content type.","name":"name","type":"string"},{"text":"A function that is called whenever we need create a new panel for this content type.","name":"constructor","type":"function","callback":{"arg":[{"text":"The container/parent of the new panel from spawnmenu.CreateContentIcon","type":"Panel","name":"container"},{"text":"Data for the content type passed from spawnmenu.CreateContentIcon.","type":"table","name":"data"}],"ret":{"text":"The created panel","type":"Panel","name":"pnl"}}}]}},"example":{"description":"A simple header content type.","code":"spawnmenu.AddContentType( \"header\", function( container, obj )\n\n\tif ( !obj.text or type(obj.text) != \"string\" ) then return end\n\n\tlocal label = vgui.Create( \"ContentHeader\", container )\n\tlabel:SetText( obj.text )\n\t\n\tcontainer:Add( label )\n\t\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddCreationTab","parent":"spawnmenu","type":"libraryfunc","description":"Inserts a new tab into the CreationMenus table, which will be used by the creation menu to generate its tabs (Spawnlists, Weapons, Entities, etc.)","realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"182-L190"},"args":{"arg":[{"text":"What text will appear on the tab (i.e Spawnlists).","name":"name","type":"string"},{"text":"The function called to generate the content of the tab.","name":"function","type":"function","callback":{"ret":{"text":"A container panel that holds all of the content for the new tab.","type":"Panel","name":"content"}}},{"text":"Path to the material that will be used as an icon on the tab. Should be a `.png` file. See Silkicons.","name":"material","type":"string","default":"icon16/exclamation.png"},{"text":"The order in which this tab should be shown relative to the other tabs on the creation menu.","name":"order","type":"number","default":"1000"},{"text":"The tooltip to be shown for this tab.","name":"tooltip","type":"string","default":"nil"}]}},"example":{"description":"An excerpt from the Dupe creation menu tab.","code":"spawnmenu.AddCreationTab( \"#spawnmenu.category.dupes\", function()\n\n    HTML = vgui.Create( \"DHTML\" );\n        JS_Language( HTML )\n        HTML:SetAllowLua( true );\n        HTML:OpenURL( \"asset://garrysmod/html/dupes.html\" );\n        HTML:Call( \"SetDupeSaveState( \" .. tostring( DupeInClipboard ).. \" );\" );        \n\n    return HTML\n\nend, \"icon16/control_repeat_blue.png\", 200 )","output":"A new tab named \"Dupes\" will be placed in the creation menu."},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddPropCategory","parent":"spawnmenu","type":"libraryfunc","description":{"text":"Used to add addon spawnlists to the spawnmenu tree. This function should be called within SANDBOX:PopulatePropMenu.\n\nAddon spawnlists will not save to disk if edited.","warning":"You should never try to modify player customized spawnlists!"},"realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"224-L237"},"args":{"arg":[{"text":"A unique classname of the list.","name":"classname","type":"string"},{"text":"The name of the category displayed to the player, e.g. `Comic Props`.","name":"name","type":"string"},{"text":"A table of entries for the spawn menu. It must be numerically indexed.\n\nEach member of the table is a sub-table containing a type member, and other members depending on the type.\n\nNew content types can be added via spawnmenu.AddContentType.\n\n| string type | Description | Other members |\n| ------------- | ---------- | ----------------- |\n| \"header\" | a simple header for organization | string text - The text that the header will display |\n| \"model\" | spawns a model where the player is looking | string model - The path to the model file \n\t number skin - The skin for the model to use (optional) \n string body - The bodygroups for the model (optional) \n number wide - The width of the spawnicon (optional) \n number tall - The height of the spawnicon (optional) |\n| \"entity\" | spawns an entity where the player is looking\n(appears in the Entities tab by default) | string spawnname - The filename of the entity, for example \"sent_ball\" \n string nicename - The name of the entity to display \n string material - The icon to display, this should be set to `entities/[sent_name].png` \n\tboolean admin - Whether the entity is only spawnable by admins (optional) |\n| \"vehicle\" | spawns a vehicle where the player is looking \n (appears in the Vehicles tab by default) | string spawnname - The filename of the vehicle \n string nicename - The name of the vehicle to display \n string material - The icon to display \n boolean admin - Whether the vehicle is only spawnable by admins (optional) |\n| \"npc\" | spawns an NPC where the player is looking \n (appears in the NPCs tab by default) | string spawnname - The spawn name of the NPC \n\tstring nicename - The name to display \n string material - The icon to display \n table weapon - A table of potential weapons (each a string) to give to the NPC.\n When spawned, one of these will be chosen randomly each time. \n boolean admin - Whether the NPC is only spawnable by admins (optional) |\n| \"weapon\" | When clicked, gives the player a weapon; \n When middle-clicked, spawns a weapon where the player is looking \n (appears in the Weapons tab by default) |string spawnname - The spawn name of the weapon \n string nicename - The name to display \n string material - The icon to display \n boolean admin - Whether the weapon is only spawnable by admins (optional) |","name":"contents","type":"table"},{"text":"The icon to use in the tree.","name":"icon","type":"string"},{"text":"The unique ID number for the spawnlist category. Used to make sub categories. See \"parentID\" parameter below. If not set, it will be automatically set to ever increasing number, starting with 1000.","name":"id","type":"number","default":"1000"},{"text":"The unique ID of the parent category. This will make the created category a subcategory of category with given unique ID. `0` makes this a base category (such as `Builder`).","name":"parentID","type":"number","default":"0"},{"text":"The needed game for this prop category, if one is needed. If the specified game is not mounted, the category isn't shown. This uses the shortcut name, e.g. `cstrike`, and not the Steam AppID.","name":"needsApp","type":"string","default":""}]}},"example":{"description":"Create a spawn menu with two icons for each type","code":"hook.Add(\"PopulatePropMenu\", \"Add Two Of Each\", function()\n\t\n\tlocal contents = {}\n\t\n\t-- Props\n\ttable.insert( contents, {\n\t\ttype = \"header\",\n\t\ttext = \"Props\"\n\t} )\n\ttable.insert( contents, {\n\t\ttype = \"model\",\n\t\tmodel = \"models/props_c17/oildrum001.mdl\"\n\t} )\n\ttable.insert( contents, {\n\t\ttype = \"model\",\n\t\tmodel = \"models/props_wasteland/cargo_container01.mdl\",\n\t\tskin = 1,\n\t\twide = 128,\n\t\ttall = 64\n\t} )\n\n\t-- Entities\n\ttable.insert( contents, {\n\t\ttype = \"header\",\n\t\ttext = \"Entities\"\n\t} )\n\ttable.insert( contents, {\n\t\ttype = \"entity\",\n\t\tspawnname = \"sent_ball\",\n\t\tnicename = \"Bouncy Ball\",\n\t\tmaterial = \"entities/sent_ball.png\"\n\t} )\n\ttable.insert( contents, {\n\t\ttype = \"entity\",\n\t\tspawnname = \"combine_mine\",\n\t\tnicename = \"Hopper Mine\",\n\t\tmaterial = \"entities/combine_mine.png\"\n\t} )\n\n\t-- Vehicles\n\ttable.insert( contents, {\n\t\ttype = \"header\",\n\t\ttext = \"Vehicles\"\n\t} )\n\ttable.insert( contents, {\n\t\ttype = \"vehicle\",\n\t\tspawnname = \"Airboat\",\n\t\tnicename = \"Half-Life 2 Airboat\",\n\t\tmaterial = \"entities/Airboat.png\"\n\t} )\n\ttable.insert( contents, {\n\t\ttype = \"vehicle\",\n\t\tspawnname = \"Chair_Office2\",\n\t\tnicename = \"Executive's Chair\",\n\t\tmaterial = \"entities/Chair_Office2.png\"\n\t} )\n\n\t-- NPCs\n\ttable.insert( contents, {\n\t\ttype = \"header\",\n\t\ttext = \"NPCs\"\n\t} )\n\ttable.insert( contents, {\n\t\ttype = \"npc\",\n\t\tspawnname = \"npc_citizen\",\n\t\tnicename = \"A random citizen\",\n\t\tmaterial = \"entities/npc_citizen.png\",\n\t\tweapon = { \"weapon_smg1\", \"weapon_crowbar\" }\n\t} )\n\ttable.insert( contents, {\n\t\ttype = \"npc\",\n\t\tspawnname = \"npc_headcrab\",\n\t\tnicename = \"Headhumper\",\n\t\tmaterial = \"entities/npc_headcrab.png\"\n\t} )\n\n\t-- Weapons\n\ttable.insert( contents, {\n\t\ttype = \"header\",\n\t\ttext = \"Weapons\"\n\t} )\n\ttable.insert( contents, {\n\t\ttype = \"weapon\",\n\t\tspawnname = \"weapon_crowbar\",\n\t\tnicename = \"Crowbar\",\n\t\tmaterial = \"entities/weapon_crowbar.png\",\n\t} )\n\ttable.insert( contents, {\n\t\ttype = \"weapon\",\n\t\tspawnname = \"weapon_smg1\",\n\t\tnicename = \"SMG\",\n\t\tmaterial = \"entities/weapon_smg1.png\",\n\t} )\n\n\tspawnmenu.AddPropCategory( \"TwoOfEach\", \"Two of each type\", contents, \"icon16/box.png\" )\nend )","output":{"image":{"src":"AddPropCategory_Two_of_each.jpeg"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddToolCategory","parent":"spawnmenu","type":"libraryfunc","description":"Used to create a new category in the list inside of a spawnmenu Tool Tab.\n\nYou must call this function from SANDBOX:AddToolMenuCategories for it to work properly.\n\nSee spawnmenu.AddToolTab to add new tool tabs.  \nSee spawnmenu.AddToolMenuOption to add new sub options to a newly created tool category.","realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"131-L145"},"args":{"arg":[{"text":"The internal tool tab name, as created with spawnmenu.AddToolTab.\n\nYou can also use the default Tool Tab names `\"Main\"` and `\"Utilities\"`.","name":"tabName","type":"string"},{"text":"The unique identifier name, which will be used to add tool option to this category.","name":"className","type":"string"},{"text":"The nice name to be displayed to the player. See Addon Localization.","name":"printName","type":"string"}]}},"example":[{"description":"Adds the Constraints category to the Main ToolTab. See `lua\\includes\\modules\\spawnmenu.lua`.","code":"hook.Add( \"AddToolMenuTabs\", \"myHookName\", function()\n\tspawnmenu.AddToolCategory( \"Main\", \"Constraints\", \"#spawnmenu.tools.constraints\" )\nend )"},{"description":"Adds the User category to the Utilities ToolTab. See `lua\\autorun\\utilities_menu.lua`.","code":"hook.Add( \"AddToolMenuTabs\", \"myHookName2\", function()\n\tspawnmenu.AddToolCategory( \"Utilities\", \"User\", \"#spawnmenu.utilities.user\" )\nend )"}],"realms":["Client"],"type":"Function"},
{"function":{"name":"AddToolMenuOption","parent":"spawnmenu","type":"libraryfunc","description":"Adds an option to the right side of the spawnmenu.\n\nSee spawnmenu.AddToolTab to add new right-side tabs. See spawnmenu.AddToolCategory to add new categories.","realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"147-L175"},"args":{"arg":[{"text":"The internal name of the spawnmenu tab to add into (for example \"Utilities\")","name":"tab","type":"string"},{"text":"The internal name of the category within the tab to add into (for example \"Admin\")","name":"category","type":"string"},{"text":"Unique internal identifier of the new option. This is used to reference this option by other code.","name":"class","type":"string"},{"text":"The nice name of item to show to the player. See Addon Localization.","name":"name","type":"string"},{"text":"Console command to execute when the item is selected.","name":"cmd","type":"string","default":"nil"},{"text":"Config name, used in older versions to load tool settings UI from a file.","name":"config","type":"string","default":"nil","deprecated":{"text":"Legacy argument, no longer works.","notag":"true"}},{"text":"A function to build the context panel.","name":"cpanel","type":"function","callback":{"arg":{"text":"A DForm that will be shown in the context menu","type":"Panel","name":"pnl"}}},{"text":"Allows to override the table that will be added to the tool list. Some of the fields will be overwritten by this function.","name":"table","type":"table","default":"{}"}]}},"example":[{"description":"Adds a new option to the menu with a slider to change the gravity","code":"hook.Add( \"AddToolMenuCategories\", \"CustomCategory\", function()\n\tspawnmenu.AddToolCategory( \"Utilities\", \"Stuff\", \"#Stuff\" )\nend )\n\nhook.Add( \"PopulateToolMenu\", \"CustomMenuSettings\", function()\n\tspawnmenu.AddToolMenuOption( \"Utilities\", \"Stuff\", \"Custom_Menu\", \"#My Custom Menu\", \"\", \"\", function( panel )\n\t\tpanel:NumSlider( \"Gravity\", \"sv_gravity\", 0, 600 )\n\t\t-- Add stuff here\n\tend )\nend )","output":{"image":{"src":"70c/8de155504a2ff1c.png"}}},{"description":"Example on how to add a custom tool tab with a custom tool category and a tool option.","code":"language.Add( \"MyCoolTab.Title\", \"My Cool Tab\" )\nlanguage.Add( \"MyCoolTab.Category\", \"My Cool Category\" )\nlanguage.Add( \"MyCoolTab.ToolOption\", \"My Cool Menu Option\" )\n\nhook.Add( \"AddToolMenuTabs\", \"myHookClass\", function()\n\tspawnmenu.AddToolTab( \"Internal_MyCoolTab\", \"#MyCoolTab.Title\", \"icon16/monkey.png\" )\n\n\tspawnmenu.AddToolCategory( \"Internal_MyCoolTab\", \"Internal_MyCoolCategory\", \"#MyCoolTab.Category\" )\nend )\n\nhook.Add( \"PopulateToolMenu\", \"CustomMenuSettings\", function()\n\tspawnmenu.AddToolMenuOption( \"Internal_MyCoolTab\", \"Internal_MyCoolCategory\", \"Internal_MyCustomMenu\", \"#MyCoolTab.ToolOption\", \"\", \"\", function( panel )\n\t\tpanel:NumSlider( \"Gravity\", \"sv_gravity\", 0, 600 )\n\tend )\nend )","output":{"upload":{"src":"70c/8de1555db093d85.png","size":"39520","name":"image.png"}}}],"realms":["Client"],"type":"Function"},
{"function":{"name":"AddToolTab","parent":"spawnmenu","type":"libraryfunc","description":"Adds a new tool tab to the right side of the spawnmenu. (usually via the SANDBOX:AddToolMenuTabs hook)\n\nSee spawnmenu.GetToolMenu for a function to retrieve existing tool tabs.\n\nSee spawnmenu.AddCreationTab for tabs on the left side of the spawnmenu.\n\nSee spawnmenu.AddToolCategory to add new categories to the newly created tool tab.  \nSee spawnmenu.AddToolMenuOption to add new options to the categories within a tool tab.","realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"66-L70"},"args":{"arg":[{"text":"The internal name of the tab. This is used for sorting, as well as adding categories, so it should be unique.","name":"name","type":"string"},{"text":"The 'nice' name of the tab that is displayed to the player. See Addon Localization.","name":"label","type":"string","default":"name"},{"text":"The file path to the icon of the tab. Should be a `.png` file. See Silkicons.","name":"icon","type":"string","default":"icon16/wrench.png"}]}},"example":{"description":"Creates a new tab named, \"Tab name!\" with a unique name and a wrench icon.","code":"hook.Add( \"AddToolMenuTabs\", \"myHookClass\", function()\n\tspawnmenu.AddToolTab( \"Tab name!\", \"#Unique_Name\", \"icon16/wrench.png\" )\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"ClearToolMenus","parent":"spawnmenu","type":"libraryfunc","description":"Clears all the tools from the different tool categories and the categories itself, if ran at the correct place.\n\nSeems to only work when ran at initialization.","realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"60-L64"}},"example":{"description":"Clear the tool menu completely, after populating it:","code":"hook.Run( \"PopulateToolMenu\" )\n\nspawnmenu.ClearToolMenus()"},"realms":["Client"],"type":"Function"},
{"function":{"name":"CreateContentIcon","parent":"spawnmenu","type":"libraryfunc","description":"Creates a new ContentIcon previously defined via spawnmenu.AddContentType.","realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"301-L306"},"args":{"arg":[{"text":"The type of the content icon.\n\nDefault content types are:\n* model\n\nSandbox only content types:\n* tool\n* header\n* entity\n* vehicle\n* npc\n* weapon\n* postprocess","name":"type","type":"string"},{"text":"The parent to add the ContentIcon to.","name":"parent","type":"Panel","default":"nil"},{"text":"The data to send to the content icon in spawnmenu.AddContentType. Data required will depend on the content type.","name":"data","type":"table"}]},"rets":{"ret":{"text":"The created ContentIcon, if it was returned by spawnmenu.AddContentType.","name":"","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"DoSaveToTextFiles","parent":"spawnmenu","type":"libraryfunc","description":{"text":"Calls spawnmenu.SaveToTextFiles.","internal":""},"realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"260-L264"},"args":{"arg":{"text":"A table containing spawnlists.","name":"spawnlists","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetContentType","parent":"spawnmenu","type":"libraryfunc","description":"Returns the function to create an vgui element for a specified content type, previously defined by spawnmenu.AddContentType.\n\nIf a content type doesn't exist, a dummy function will be returned, and a warning printed to the console.\n\nYou probably want to use spawnmenu.CreateContentIcon to create icons.","realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"289-L299"},"args":{"arg":{"text":"The content type name.","name":"contentType","type":"string"}},"rets":{"ret":{"text":"The panel creation function.","name":"","type":"function","callback":{"arg":[{"text":"The container panel to parent the created icon to.","type":"Panel","name":"container"},{"text":"Data for the content type passed from spawnmenu.CreateContentIcon.","type":"table","name":"data"}],"ret":{"text":"The created panel","type":"Panel","name":"pnl"}}}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetCreationTabs","parent":"spawnmenu","type":"libraryfunc","description":"Returns the list of Creation tabs. Creation tabs are added via spawnmenu.AddCreationTab.","realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"192-L196"},"rets":{"ret":{"text":"The list of Creation tabs. See the Structures/CreationMenus.","name":"","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetCustomPropTable","parent":"spawnmenu","type":"libraryfunc","description":"Similar to spawnmenu.GetPropTable, but only returns spawnlists created by addons via spawnmenu.AddPropCategory.\n\nThese spawnlists are shown in a separate menu in-game.","realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"218-L222"},"rets":{"ret":{"text":"See spawnmenu.GetPropTable for table format.","name":"","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetPropTable","parent":"spawnmenu","type":"libraryfunc","description":"Returns a table of all prop categories and their props in the spawnmenu.\n\nNote that if the spawnmenu has not been populated, this will return an empty table.\n\nThis will not return spawnlists created by addons, see  spawnmenu.GetCustomPropTable for that.","realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"212-L216"},"rets":{"ret":{"text":"Table of all the prop categories and props in the following format:\n\n```\n{\n\t[\"settings/spawnlist/001-construction props.txt\"] = {\n\t\tname = \"Construction Props\",\n\t\ticon = \"icon16/page.png\",\n\t\tid = 1,\n\t\tparentid = 0,\n\t\tneedsapp = \"\",\n\t\tcontents = {\n\t\t\t{\n\t\t\t\tmodel = \"models/Cranes/crane_frame.mdl\",\n\t\t\t\ttype = \"model\"\n\t\t\t}\n\t\t\t-- etc.\n\t\t},\n\t}\n\t-- etc.\n}\n```","name":"","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetToolMenu","parent":"spawnmenu","type":"libraryfunc","description":"Returns an existing tool tab by name from the right side of the spawnmenu (usually during the SANDBOX:AddToolMenuTabs hook)\n\nIf the requested tooltab does not exist, it will be added. See also spawnmenu.AddToolTab.","realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"32-L58"},"args":{"arg":[{"text":"The internal name of the tab. This is used for sorting.","name":"name","type":"string"},{"text":"The 'nice' name of the tab","name":"label","type":"string","default":"name"},{"text":"The file path to the icon of the tab. Should be a `.png` file. See Silkicons.","name":"icon","type":"string","default":"icon16/wrench.png"}]},"rets":{"ret":{"text":"A table of tables representing categories and items in the left part of the tab. See example below to example structure.","name":"","type":"table"}}},"example":{"description":"Prints out the contents of the default Tool Tab.","code":"PrintTable( spawnmenu.GetToolMenu( \"Main\" ) )","output":"```\n1:\n\t\t1:\n\t\t\t\tCPanelFunction\t=\tfunction: 0x48a60408\n\t\t\t\tCommand\t=\tgmod_tool axis\n\t\t\t\tControls\t=\taxis\n\t\t\t\tItemName\t=\taxis\n\t\t\t\tText\t=\t#tool.axis.name\n\t\t2:\n\t\t\t\tCPanelFunction\t=\tfunction: 0x48a6b218\n\t\t\t\tCommand\t=\tgmod_tool ballsocket\n\t\t\t\tControls\t=\tballsocket\n\t\t\t\tItemName\t=\tballsocket\n\t\t\t\tText\t=\t#tool.ballsocket.name\n\t\t3:\n\t\t\t\tCPanelFunction\t=\tfunction: 0x48a8be48\n\t\t\t\tCommand\t=\tgmod_tool elastic\n\t\t\t\tControls\t=\telastic\n\t\t\t\tItemName\t=\telastic\n\t\t\t\tText\t=\t#tool.elastic.name\n\t\t4:\n\t\t\t\tCPanelFunction\t=\tfunction: 0x48ab5998\n\t\t\t\tCommand\t=\tgmod_tool hydraulic\n\t\t\t\tControls\t=\thydraulic\n\t\t\t\tItemName\t=\thydraulic\n\t\t\t\tText\t=\t#tool.hydraulic.name\n...\n\t\tItemName\t=\tConstraints\n\t\tText\t=\t#spawnmenu.tools.constraints\n2:\n\t\t1:\n\t\t\t\tCPanelFunction\t=\tfunction: 0x3a4235c8\n\t\t\t\tCommand\t=\tgmod_tool balloon\n\t\t\t\tControls\t=\tballoon\n\t\t\t\tItemName\t=\tballoon\n\t\t\t\tText\t=\t#tool.balloon.name\n...\n\t\tItemName\t=\tConstruction\n\t\tText\t=\t#spawnmenu.tools.construction\n...\n```"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTools","parent":"spawnmenu","type":"libraryfunc","description":"Gets a table of tools on the client.","realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"28-L30"},"rets":{"ret":{"text":"A table with groups of tools, along with information on each tool.","name":"","type":"table"}}},"example":{"description":"Prints the output","code":"PrintTable( spawnmenu.GetTools() )","output":"```\n1:\n        Icon    =   icon16/wrench.png\n        Items:\n                1:\n                        1:\n                                CPanelFunction  =   function: 0x341391a8\n                                Command =   gmod_tool axis\n                                Controls    =   axis\n                                ItemName    =   axis\n                                Text    =   #tool.axis.name\n                        2:\n                                CPanelFunction  =   function: 0x341c7368\n                                Command =   gmod_tool ballsocket\n                                Controls    =   ballsocket\n                                ItemName    =   ballsocket\n                                Text    =   #tool.ballsocket.name\n                        3:\n                                CPanelFunction  =   function: 0x343826e8\n                                Command =   gmod_tool elastic\n                                Controls    =   elastic\n                                ItemName    =   elastic\n                                Text    =   #tool.elastic.name\n                        ...\n                        ItemName    =   Constraints\n                        Text    =   #spawnmenu.tools.constraints\n                2:\n                        1:\n                                CPanelFunction  =   function: 0x342138f0\n                                Command =   gmod_tool balloon\n                                Controls    =   balloon\n                                ItemName    =   balloon\n                                Text    =   #tool.balloon.name\n                        2:\n                                CPanelFunction  =   function: 0x340d7628\n                                Command =   gmod_tool button\n                                Controls    =   button\n                                ItemName    =   button\n                                Text    =   #tool.button.name\n                        3:\n                                CPanelFunction  =   function: 0x34302670\n                                Command =   gmod_tool duplicator\n                                Controls    =   duplicator\n                                ItemName    =   duplicator\n                                Text    =   #tool.duplicator.name\n                        ...\n                        ItemName    =   Construction\n                        Text    =   #spawnmenu.tools.construction\n               ...\n        Label   =   #spawnmenu.tools_tab\n        Name    =   AAAAAAA_Main\n2:\n        Icon    =   icon16/page_white_wrench.png\n        Items:\n                1:\n                        1:\n                                CPanelFunction  =   function: 0x34236090\n                                Command =   \n                                Controls    =   \n                                ItemName    =   User_Cleanup\n                                Text    =   #spawnmenu.utilities.cleanup\n                        2:\n                                CPanelFunction  =   function: 0x34236418\n                                Command =   \n                                Controls    =   \n                                ItemName    =   PhysgunSettings\n                                Text    =   #spawnmenu.utilities.physgunsettings\n                        3:\n                                CPanelFunction  =   function: 0x34232640\n                                Command =   \n                                Controls    =   \n                                ItemName    =   Undo\n                                Text    =   #spawnmenu.utilities.undo\n                        ItemName    =   User\n                        Text    =   #spawnmenu.utilities.user\n               ...\n        Label   =   #spawnmenu.utilities_tab\n        Name    =   Utilities\n```"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PopulateFromEngineTextFiles","parent":"spawnmenu","type":"libraryfunc","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"240-L257"},"description":{"text":"Calls spawnmenu.PopulateFromTextFiles.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PopulateFromTextFiles","parent":"spawnmenu","type":"libraryfunc","description":{"text":"Loads spawnlists from text files. You probably are looking for spawnmenu.AddPropCategory.","internal":""},"realm":"Client","args":{"arg":{"text":"The function to call.","name":"callback","type":"function","callback":{"arg":[{"text":"The file name for the spawnlist.","type":"string","name":"strFilename"},{"text":"The \"nice\" title for the spawnlist.","type":"string","name":"strName"},{"text":"The list of contents for this spawnlist.","type":"table","name":"tabContents"},{"text":"Path to an `.png` icon of the spawnlist, should be 16x16 image.","type":"string","name":"icon"},{"text":"Unique ID of the spawnlist","type":"number","name":"id"},{"text":"UniqueID of the parents spawnlist ID","type":"number","name":"parentid"},{"text":"If not empty, the internal folder name of an mountable game that is required for this spawnlist to show up.","type":"string","name":"needsapp"}]}}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SaveToTextFiles","parent":"spawnmenu","type":"libraryfunc","description":{"text":"Saves a table of spawnlists to files.","internal":""},"realm":"Client","args":{"arg":{"text":"A table containing spawnlists.","name":"spawnlists","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetActiveControlPanel","parent":"spawnmenu","type":"libraryfunc","description":{"text":"Sets currently active control panel to be returned by spawnmenu.ActiveControlPanel.","internal":""},"realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"20-L22"},"args":{"arg":{"text":"The panel to set.","name":"pnl","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SwitchCreationTab","parent":"spawnmenu","type":"libraryfunc","description":"Switches the creation tab (left side of the spawnmenu) on the spawnmenu to the given tab.","realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"198-L205"},"added":"2021.12.15","args":{"arg":{"text":"The tab ID to open","name":"id","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SwitchToolTab","parent":"spawnmenu","type":"libraryfunc","description":"Opens specified tool tab in spawnmenu.","realm":"Client","file":{"text":"lua/includes/modules/spawnmenu.lua","line":"72-L79"},"args":{"arg":{"text":"The tab ID to open","name":"id","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Begin","parent":"sql","type":"libraryfunc","description":"Tells the engine a set of queries is coming. Will wait until sql.Commit is called to run them.\n\nThis is most useful when you run more than 100+ queries.\n\nThis is equivalent to :\n```\nsql.Query( \"BEGIN;\" )\n```","realm":"Shared and Menu","file":{"text":"lua/includes/util/sql.lua","line":"87-L93"}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Commit","parent":"sql","type":"libraryfunc","description":"Tells the engine to execute a series of queries queued for execution, must be preceded by sql.Begin.\n\nThis is equivalent to `sql.Query( \"COMMIT;\" )`.","realm":"Shared and Menu","file":{"text":"lua/includes/util/sql.lua","line":"96-L101"}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IndexExists","parent":"sql","type":"libraryfunc","description":"Returns true if the index with the specified name exists.","realm":"Shared and Menu","file":{"text":"lua/includes/util/sql.lua","line":"41-L50"},"args":{"arg":{"text":"The name of the index to check.","name":"indexName","type":"string"}},"rets":{"ret":{"text":"exists","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"LastError","parent":"sql","type":"libraryfunc","description":"Returns the last error from a SQLite query.","realm":"Shared and Menu","file":{"text":"lua/includes/util/sql.lua","line":"104-L109"},"rets":{"ret":{"text":"Last error from SQLite database.","name":"","type":"string"}}},"example":{"description":"Reports all SQL errors into console automatically. Can help on debugging or testing.","code":"sql.m_strError = nil -- This is required to invoke __newindex\n\nsetmetatable( sql, { __newindex = function( table, k, v )\n\tif ( k == \"m_strError\" and v and #v > 0 ) then\n\t\tprint(\"[SQL Error] \" .. v )\n\tend\nend } )","output":"After running `sql.Query(\"SELECT\")` will print `[SQL Error] incomplete input` in the console."},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Query","parent":"sql","type":"libraryfunc","description":{"text":"Performs a query on the local SQLite database, returns a table as result set, nil if result is empty and false on error.","warning":"To run SQL queries with this function safely, it is crucial to ensure that the concatenated variables in the query string are safe to avoid vulnerabilities like SQL injections. For this, it is recommended to use the sql.SQLStr, which allows arguments to be escaped correctly.\n\nIt's best to just use sql.QueryTyped instead if possible."},"realm":"Shared and Menu","args":{"arg":{"text":"The query to execute.","name":"query","type":"string"}},"rets":{"ret":{"text":"`false` is returned if there is an error, `nil` if the query returned no data.","name":"","type":"table|boolean|nil"}}},"example":{"description":"Functions that are examples of saving and creating information into the database.","code":"function CreateTable()\n\tsql.Query(\"CREATE TABLE IF NOT EXISTS player_data ( SteamID64 INTEGER PRIMARY KEY, Money INTEGER )\")\nend\n\nfunction SavePlayerToDataBase(ply, money)\n\tsql.Query(\"INSERT OR REPLACE INTO player_data ( SteamID64, Money ) VALUES ( \" ..  ply:SteamID64() .. \", \" .. money .. \" )\")\nend\n\nfunction LoadPlayerFromDataBase(ply)\n\treturn sql.QueryValue(\"SELECT Money FROM player_data WHERE SteamID64 = \" .. ply:SteamID64())\nend"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"QueryRow","parent":"sql","type":"libraryfunc","description":"Performs the sql.Query and returns the n'th row.\n\nThis function is equivalent to safely returning\n```lua\nsql.Query(query)[row]\n```","realm":"Shared and Menu","file":{"text":"lua/includes/util/sql.lua","line":"52-L66"},"args":{"arg":[{"text":"The query as used in sql.Query","name":"query","type":"string"},{"text":"The row number.","name":"row","type":"number","default":"1"}]},"rets":{"ret":{"text":"The returned row.","name":"","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"QueryTyped","parent":"sql","type":"libraryfunc","description":{"text":"Performs a query on the local SQLite database with proper type handling and parameter binding, returns a table as result set, empty table if no results, and false on error. Unlike sql.Query, this function properly handles SQLite data types and allows safe parameter binding to prevent SQL injection attacks.","warning":"* This function only executes a single SQL statement, unlike sql.Query which can execute multiple statements separated by semicolons.\n\n* Large INTEGER values (beyond ±9,007,199,254,740,991) are returned as strings to preserve exact values. This is because Lua represents all numbers as doubles, which lose precision for integers larger than 2⁵³-1. Returning them as strings prevents data corruption from rounding errors."},"added":"2025.05.29","realm":"Shared and Menu","args":{"arg":[{"text":"The query to execute with optional `?` parameter placeholders.","name":"query","type":"string","warning":"* Always use parameter binding with `?` placeholders instead of string concatenation to prevent SQL injection vulnerabilities."},{"text":"Parameters to bind to the query placeholders. Supports nil, boolean, number, and string types.\n\nThe number of query parameters must match the number of `?` placeholders, or the query will fail. See examples.","name":"queryParams","type":"vararg"}]},"rets":{"ret":{"text":"`false` is returned if there is an error (See sql.LastError), otherwise a table with properly typed column values (empty table if no results).","name":"","type":"table|boolean"}}},"example":{"description":"Direct usage examples demonstrating typed queries with parameter binding for all SQLite data types.","code":"-- Create table with all SQLite data types\nsql.Query([[CREATE TABLE IF NOT EXISTS test_table (\n\tid INTEGER PRIMARY KEY,\n\tbig_number BIGINT,\n\tsmall_number INTEGER,\n\tdecimal_value DOUBLE,\n\tfloat_value REAL,\n\tis_enabled BOOLEAN,\n\thas_feature BOOL,\n\tuser_name TEXT,\n\tbinary_data BLOB,\n\tnill TEXT\n)]])\n\n-- Insert data with direct parameter binding\nsql.QueryTyped([[INSERT INTO test_table (\n\tbig_number, small_number, decimal_value, float_value,\n\tis_enabled, has_feature, user_name, binary_data, nill\n) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? )]],\n\t\"76561198261855442\", -- BIGINT as string (large Steam ID)\n\t12345,               -- INTEGER\n\t999.99,              -- DOUBLE\n\t3.14159,             -- REAL\n\ttrue,                -- BOOLEAN (stored as 1)\n\tfalse,               -- BOOL (stored as 0)\n\t\"Player Name\",       -- TEXT\n\t\"binary\\0data\\0here\",-- BLOB (binary string with null bytes)\n\tnil                   -- NULLABLE TEXT\n)\n\n-- Query with parameter binding\nlocal results = sql.QueryTyped(\"SELECT * FROM test_table WHERE big_number = ?\", \"76561198261855442\")\nPrintTable(results)"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"QueryValue","parent":"sql","type":"libraryfunc","description":"Performs the query like sql.QueryRow, but returns the first value found.","realm":"Shared and Menu","file":{"text":"lua/includes/util/sql.lua","line":"68-L85"},"args":{"arg":{"text":"The input query.","name":"query","type":"string"}},"rets":{"ret":{"text":"The returned value.","name":"","type":"string"}}},"example":{"description":"Functions that are examples of saving and creating information into the database.","code":"function CreateTable()\n\tsql.Query(\"CREATE TABLE IF NOT EXISTS player_data ( SteamID64 INTEGER PRIMARY KEY, Money INTEGER )\")\nend\n\nfunction SavePlayerToDataBase(ply, money)\n\tsql.Query(\"INSERT OR REPLACE INTO player_data ( SteamID64, Money ) VALUES ( \" ..  ply:SteamID64() .. \", \" .. money .. \" )\")\nend\n\nfunction LoadPlayerFromDataBase(ply)\n\treturn sql.QueryValue(\"SELECT Money FROM player_data WHERE SteamID64 = \" .. ply:SteamID64())\nend"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SQLStr","parent":"sql","type":"libraryfunc","description":{"text":"Escapes dangerous characters and symbols from user input used in an SQLite SQL Query.\n\nIf possible, it is recommended to use sql.QueryTyped instead.","warning":"Do not use this function with external database engines such as `MySQL`. `MySQL` and `SQLite` use different escape sequences that are incompatible with each other! Escaping strings with inadequate functions is dangerous and will lead to SQL injection vulnerabilities."},"realm":"Shared and Menu","file":{"text":"lua/includes/util/sql.lua","line":"6-L27"},"args":{"arg":[{"text":"The string to be escaped.","name":"string","type":"string"},{"text":"Set this as `true`, and the function will not wrap the input string in apostrophes.","name":"bNoQuotes","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"The escaped input.","name":"","type":"string"}}},"example":{"description":"Example usage of this function.","code":"sql.Query( \"INSERT OR REPLACE INTO cookies ( key, value ) VALUES ( \" .. sql.SQLStr( k ) .. \", \" .. sql.SQLStr( v ) .. \" )\" )"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"TableExists","parent":"sql","type":"libraryfunc","description":"Returns true if the table with the specified name exists.","realm":"Shared and Menu","file":{"text":"lua/includes/util/sql.lua","line":"30-L39"},"args":{"arg":{"text":"The name of the table to check.","name":"tableName","type":"string"}},"rets":{"ret":{"text":"exists","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ApplyAddons","parent":"steamworks","type":"libraryfunc","description":"Refreshes clients addons.","realm":"Menu"},"example":{"description":"Subscribes to gm_construct_beta and reloads addons.","code":"steamworks.Subscribe( 21197 )\nsteamworks.ApplyAddons()"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"Download","parent":"steamworks","type":"libraryfunc","description":{"text":"Downloads a file from the supplied addon and saves it as a `.cache` file in `garrysmod/cache/` folder.\n\nThis is mostly used to download the preview image of the addon.\n\nIn case the retrieved file is an image and you need the IMaterial, use Global.AddonMaterial with the path supplied from the callback.","note":"You really should be using steamworks.DownloadUGC when downloading Steam Workshop items. This is a legacy function for preview images."},"realm":"Client and Menu","args":{"arg":[{"text":"The Preview ID of workshop item.","name":"workshopPreviewID","type":"string"},{"text":"Whether to uncompress the file or not, assuming it was compressed with LZMA.\n\nYou will usually want to set this to true.","name":"uncompress","type":"boolean"},{"text":"The function to process retrieved data.","name":"resultCallback","type":"function","callback":{"arg":{"text":"Path to the downloaded file.","type":"string","name":"path"}}}]}},"example":{"description":"Downloads and saves icon of `Gm_construct_Beta` Steam Workshop addon, then draws it on screen.","code":"local mat = nil\nsteamworks.FileInfo( 21197, function( result )\n\tsteamworks.Download( result.previewid, true, function( name )\n\t\tprint( name )\n\t\tmat = AddonMaterial( name )\n\tend)\nend)\n\nhook.Add( \"HUDPaint\", \"PutAUniqueHookNameHere\", function()\n\tif ( !mat ) then return end -- TODO: Draw some loading placeholder\n\n\tsurface.SetDrawColor( 255, 255, 255, 255 ) -- Set the drawing color\n\tsurface.SetMaterial( mat ) -- Use our cached material\n\tsurface.DrawTexturedRect( 0, 0, 512, 512 ) -- Actually draw the rectangle\nend )","output":{"image":{"src":"70c/8dc59784d06be97.png","size":"569647","name":"image.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DownloadUGC","parent":"steamworks","type":"libraryfunc","realm":"Client and Menu","args":{"arg":[{"text":"The ID of workshop item to download. **NOT** a file ID.","name":"workshopID","type":"string"},{"text":"The function to process retrieved data.","name":"resultCallback","type":"function","callback":{"arg":[{"text":"Contains a path to the saved file, or nil if the download failed for any reason.","type":"string","name":"path"},{"text":"A file object pointing to the downloaded .gma file. The file handle will be closed after the function exits.","type":"file_class","name":"file"}]}}]}},"example":{"description":"Downloads the Fire Extinguisher addon from Steam Workshop prints path to its .gma file to be used with game.MountGMA.","code":"steamworks.DownloadUGC( \"104607228\", function( path, file )\n\tprint( path, file )\nend)"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"FileInfo","parent":"steamworks","type":"libraryfunc","description":"Retrieves info about supplied Steam Workshop addon.","realm":"Shared and Menu","args":{"arg":[{"text":"The ID of Steam Workshop item.","name":"workshopItemID","type":"string"},{"text":"The function to process retrieved data.","name":"resultCallback","type":"function","callback":{"arg":{"text":"The data about the item, if the request succeeded, `nil` otherwise. See Structures/UGCFileInfo.","type":"table","name":"data"}}},{"text":"If set, the function will retrieve more info about the workshop item, such as longer description and additional preview images. Only use this if absolutely necessary.","name":"extraInfo","type":"boolean","default":"false","added":"2026.06.25"}]}},"example":{"description":"Retrieves all info of the [Wiremod](https://steamcommunity.com/sharedfiles/filedetails/?id=160250458) Steam Workshop addon.","code":"steamworks.FileInfo( 160250458, function( result ) PrintTable( result ) end)","output":"```\nbanned\t=\tfalse\nchildren = {}\ncreated\t=\t1373845248\ndescription\t=\t\"A collection of entities connectable by data wires...\"\ndisabled\t=\tfalse\nfileid\t=\t763849701485673437\nid\t=\t160250458\ninstalled\t=\tfalse\nowner\t=\t76561198096613988\nownername\t=\tWireTeam\npreviewid\t=\t597008945885476119\npreviewsize\t=\t36221\nsize\t=\t7375691\ntags\t=\tAddon,tool,Build,Fun\ntitle\t=\tWiremod\nupdated\t=\t1571560576\n\nscore\t=\t0.92941749095917\ntotal\t=\t49119\nup\t=\t45695\ndown\t=\t3424\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetList","parent":"steamworks","type":"libraryfunc","description":"Retrieves a customized list of Steam Workshop addons.","realm":"Shared and Menu","args":{"arg":[{"text":"The type of items to retrieve. Possible values include:\n* popular (All invalid options will equal to this)\n* trending\n* latest\n* friends\n* followed - Items of people the player is following on Steam\n* friend_favs - Favorites of player's friends\n* favorite - Player's favorites","name":"type","type":"string"},{"text":"A table of tags to match.","name":"tags","type":"table"},{"text":"How much of results to skip from first one. This is useful for pagination. Negative values are invalid.","name":"offset","type":"number"},{"text":"How many items to retrieve, up to `50` at a time. Negative values are invalid.","name":"numRetrieve","type":"number"},{"text":"When getting `popular` or `trending` content from Steam, this determines a time period, in range of days from `0` to `365`. ( `7` = most popular addons in last 7 days, `30` = most popular addons in the last month, etc ). If given a zero, will automatically choose a value, which is `7` for `trending`.","name":"days","type":"number"},{"text":"`\"0\"` to retrieve all addons, `\"1\"` to retrieve addons only published by you, or a valid SteamID64 of a user to get workshop items of.","name":"userID","type":"string","default":"0"},{"text":"The function to process retrieved data.","name":"resultCallback","type":"function","callback":{"arg":{"text":"The list of items, or nil in case of error.","type":"table","name":"data"}}},{"text":"If given, will use the text to filter results.","name":"searchText","type":"string","default":"nil","added":"2026.05.28"}]}},"example":{"description":"Retrieves top 10 of Steam Workshop addons.","code":"steamworks.GetList( \"popular\", nil, 0, 10, 7, 0, function( data ) PrintTable( data ) end )","output":"```\ntotalresults = 1748\nnumresults = 10\nresults:\n1 = 21197\n2 = 72122655\n3 = 68207248\n4 = 71921341\n5 = 79927494\n6 = 12692\n7 = 21174\n8 = 72145362\n9 = 16221\n10 = 22104\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetPlayerName","parent":"steamworks","type":"libraryfunc","description":{"text":"Retrieves players name by their 64bit SteamID.\n\nYou must call steamworks.RequestPlayerInfo a decent amount of time before calling this function.","deprecated":"You should use the callback of steamworks.RequestPlayerInfo instead."},"realm":"Client and Menu","args":{"arg":{"text":"The 64bit Steam ID ( aka Community ID ) of the player","name":"steamID64","type":"string"}},"rets":{"ret":{"text":"The name of that player","name":"","type":"string"}}},"example":{"description":"Retrieves name of local player.","code":"steamworks.RequestPlayerInfo( LocalPlayer():SteamID64() )\ntimer.Simple( 1, function() -- this is not instant!\n\tprint( steamworks.GetPlayerName( LocalPlayer():SteamID64() ) )\nend )","output":"A name of local player is printed into console."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsSubscribed","parent":"steamworks","type":"libraryfunc","description":"Returns whenever the client is subscribed to the specified Steam Workshop item.","realm":"Client and Menu","args":{"arg":{"text":"The ID of the Steam Workshop item.","name":"workshopItemID","type":"string"}},"rets":{"ret":{"text":"Is the client subscribed to the addon or not.","name":"","type":"boolean"}}},"example":{"description":"Checks if client is subscribed to Gm_construct_Beta Steam Workshop addon.","code":"print( steamworks.IsSubscribed( 21197 ) )","output":"If client is subscribed true is printed into console, false otherwise."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OpenWorkshop","parent":"steamworks","type":"libraryfunc","description":"Opens the workshop website in the steam overlay browser.","realm":"Client and Menu"},"example":{"description":"An alternative to this function.","code":"gui.OpenURL( \"http://steamcommunity.com/app/4000/workshop/\" )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Publish","parent":"steamworks","type":"libraryfunc","description":{"text":"Publishes dupes, saves or demos to workshop.","internal":""},"realm":"Menu","args":{"arg":[{"text":"Path to the file to upload","name":"filename","type":"string"},{"text":"Path to the image to use as icon","name":"image","type":"string"},{"text":"Name of the Workshop submission","name":"name","type":"string"},{"text":"Description of the Workshop submission","name":"desc","type":"string"},{"text":"The workshop tags to apply","name":"tags","type":"table"},{"text":"Callback for when the publishing process finishes.","name":"callback","type":"function","callback":{"arg":[{"text":"If success, file id of the published item.","type":"number","name":"fileID"},{"text":"On failure, the error message.","type":"string","name":"error"}]}},{"text":"If set, the file ID to update","name":"fileid","type":"number","default":"nil"},{"text":"List of changes when updating an item.","name":"changelist","type":"string","default":"None given."}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"RequestPlayerInfo","parent":"steamworks","type":"libraryfunc","description":"Requests information of the player with SteamID64 for later use with steamworks.GetPlayerName.","realm":"Client and Menu","args":{"arg":[{"text":"The 64bit Steam ID of player.","name":"steamID64","type":"string"},{"text":"A callback function with the data when it arrives.","name":"callback","type":"function","callback":{"arg":{"text":"The player's name.","type":"string","name":"name"}}}]}},"example":{"description":"Gets and prints the steam name of the local player.","code":"steamworks.RequestPlayerInfo( LocalPlayer():SteamID64(), function( steamName )\n\tprint( steamName )\nend )","output":"The local player's name."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetFileCompleted","parent":"steamworks","type":"libraryfunc","description":"Sets the workshop item as \"completed\" by the player. There will be a visual indicator on the Steam Workshop for completed items.","realm":"Menu","args":{"arg":{"text":"The Steam Workshop item id","name":"workshopid","type":"string"}},"rets":{"ret":{"text":"Whatever you have put in as first argument","name":"","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"SetFilePlayed","parent":"steamworks","type":"libraryfunc","description":{"text":"Sets whether you have played this addon or not. This will be shown to the user in the Steam Workshop itself:","image":{"src":"steamworksSetFilePlayedExample.png"}},"realm":"Menu","args":{"arg":{"text":"The Steam Workshop item ID","name":"workshopid","type":"string"}},"rets":{"ret":{"text":"Whatever you have put in as first argument","name":"","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"SetShouldMountAddon","parent":"steamworks","type":"libraryfunc","description":"Sets if an addon should be enabled or disabled. Call steamworks.ApplyAddons afterwards to update.","realm":"Menu","args":{"arg":[{"text":"The ID of the Steam Workshop item we should enable/disable","name":"workshopItemID","type":"string"},{"text":"true to enable the item, false to disable.","name":"shouldMount","type":"boolean"}]}},"example":{"description":"Enables the Gm_construct_Beta Steam Workshop addon and reloads addons afterwards","code":"steamworks.SetShouldMountAddon( 21197, true )\nsteamworks.ApplyAddons()","output":"Enabled the gm_construct_beta addon, if installed."},"realms":["Menu"],"type":"Function"},
{"function":{"name":"ShouldMountAddon","parent":"steamworks","type":"libraryfunc","description":"Returns whenever the specified Steam Workshop addon will be mounted or not.","realm":"Client and Menu","args":{"arg":{"text":"The ID of the Steam Workshop","name":"workshopItemID","type":"string"}},"rets":{"ret":{"text":"Will the workshop item be mounted or not","name":"","type":"boolean"}}},"example":{"description":"Checks if the client has enabled Gm_construct_Beta Steam Workshop addon.","code":"print( steamworks.ShouldMountAddon( 21197 ) )","output":"If client has enabled the addon true is printed into console, false otherwise."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Subscribe","parent":"steamworks","type":"libraryfunc","description":{"text":"Subscribes to the specified workshop addon. Call steamworks.ApplyAddons afterwards to update.","internal":""},"realm":"Menu","args":{"arg":{"text":"The ID of the Steam Workshop item we should subscribe to","name":"workshopItemID","type":"string"}}},"example":{"description":"Subscribes to the Gm_construct_Beta Steam Workshop addon and reloads addons afterwards","code":"steamworks.Subscribe( \"21197\" )\nsteamworks.ApplyAddons()","output":"Subscribes to gm_construct_beta addon, if not already."},"realms":["Menu"],"type":"Function"},
{"function":{"name":"Unsubscribe","parent":"steamworks","type":"libraryfunc","description":{"text":"Unsubscribes to the specified workshop addon. Call steamworks.ApplyAddons afterwards to update.\n\nThis function should `never` be called without a user's consent and should not be called if the addon is currently in use (aka: the user is not in the main menu) as it may result in unexpected behaviour.","internal":""},"realm":"Menu","args":{"arg":{"text":"The ID of the Steam Workshop item we should unsubscribe from.","name":"workshopItemID","type":"string"}}},"example":{"description":"Unsubscribes from the Gm_construct_Beta Steam Workshop addon, if subscribed, and reloads addons afterwards","code":"steamworks.Unsubscribe( 21197 )\nsteamworks.ApplyAddons()","output":"Unsubscribes from the gm_construct_beta addon, if subscribed."},"realms":["Menu"],"type":"Function"},
{"function":{"name":"ViewFile","parent":"steamworks","type":"libraryfunc","description":"Opens the workshop website for specified Steam Workshop item in the Steam overlay browser.","realm":"Client and Menu","args":{"arg":{"text":"The ID of workshop item.","name":"workshopItemID","type":"string"}}},"example":{"description":"Opens web page of Gm_construct_Beta Steam Workshop addon in Steam overlay browser.","code":"steamworks.ViewFile( 21197 )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Vote","parent":"steamworks","type":"libraryfunc","description":{"text":"Makes the user vote for the specified addon","internal":""},"realm":"Menu","args":{"arg":[{"text":"The ID of workshop item.","name":"workshopItemID","type":"string"},{"text":"Sets if the user should vote up/down. True makes them upvote, false down","name":"upOrDown","type":"boolean"}]}},"example":{"description":"Give the Gm_construct_Beta Steam Workshop item a thumbs up.","code":"steamworks.Vote( 21197, true )"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"VoteInfo","parent":"steamworks","type":"libraryfunc","description":{"text":"Retrieves vote info of supplied addon.","deprecated":"Use data steamworks.FileInfo instead."},"realm":"Client and Menu","args":{"arg":[{"text":"The ID of workshop item.","name":"workshopItemID","type":"string"},{"text":"The function to process retrieved data.","name":"resultCallback","type":"function","callback":{"arg":{"text":"The vote information. See Structures/UGCFileInfo.","type":"table","name":"data"}}}]}},"example":{"description":"Retrieves vote info of Gm_construct_Beta Steam Workshop addon.","code":"steamworks.VoteInfo( 21197, function( result ) PrintTable( result ) end)","output":"```\nscore = 0.97182178497314\ntotal = 2952\ndown = 36\nup = 2916\n```"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"byte","parent":"string","type":"libraryfunc","description":{"text":"Returns the given string's characters in their numeric ASCII representation.","warning":"This function will throw an error if the slice length is greater than 8000 characters."},"realm":"Shared and Menu","args":{"arg":[{"text":"The string to get the chars from.","name":"string","type":"string"},{"text":"The first character of the string to get the byte of.","name":"startPos","type":"number","default":"1"},{"text":"The last character of the string to get the byte of.","name":"endPos","type":"number","default":"startPos"}]},"rets":{"ret":{"text":"Numerical bytes","name":"","type":"vararg"}}},"example":{"description":"Prints the first 4 numerical bytes from the string \"Hello, World!\"","code":"print(string.byte(\"Hello, World!\", 1, 4))","output":"72\n101\n108\n108"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"CardinalToOrdinal","parent":"string","type":"libraryfunc","description":"Converts a cardinal (`111`) number to its [ordinal/sequential variation](https://en.wikipedia.org/wiki/Ordinal_numeral) (`111th`).\n\nSee also Global.STNDRD for a function that returns just the suffix.","added":"2023.10.13","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"385-L411"},"args":{"arg":{"text":"A number to convert to ordinal.","name":"input","type":"number"}},"rets":{"ret":{"text":"The ordinal numeral.","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"char","parent":"string","type":"libraryfunc","description":"Takes the given numerical bytes and converts them to a string.","realm":"Shared and Menu","args":{"arg":{"text":"The bytes to create the string from.","name":"bytes","type":"vararg"}},"rets":{"ret":{"text":"String built from given bytes","name":"","type":"string"}}},"example":[{"description":"Prints a string consisting of the bytes 72, 101, 108, 108, 111","code":"print( string.char( 72, 101, 108, 108, 111 ) )","output":"```\nHello\n```"},{"description":"Helper function to create a random string.","code":"function string.Random( length )\n\n\tlocal length = tonumber( length )\n\n    if length < 1 then return end\n\n    local result = {} -- The empty table we start with\n\n    for i = 1, length do\n\n        result[i] = string.char( math.random(32, 126) )\n\n    end\n\n    return table.concat(result)\n\nend\n\nprint( string.Random( 10 ) )","output":"```\noEjkv2?h:T\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Comma","parent":"string","type":"libraryfunc","description":"Inserts commas for every third digit of a given number.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"357-L371"},"args":{"arg":[{"text":"The input number to commafy","name":"value","type":"number"},{"text":"An optional string that will be used instead of the default comma.","name":"separator","type":"string","default":","}]},"rets":{"ret":{"text":"The commafied string","name":"","type":"string"}}},"example":[{"description":"Demonstrates the use of string.Comma","code":"print( string.Comma( 123456789 ) )","output":"```\n123,456,789\n```"},{"description":"Demonstrates the use of the 2nd argument (separator)","code":"print( \"$\" .. string.Comma( 987654321, \".\" ) )","output":"```\n$987.654.321\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"dump","parent":"string","type":"libraryfunc","description":{"text":"Returns the binary bytecode of the given function.","note":"This does not work with functions created in C/C++. An error will be thrown if it is"},"realm":"Shared and Menu","args":{"arg":[{"text":"The function to get the bytecode of","name":"func","type":"function"},{"text":"True to strip the debug data, false to keep it","name":"stripDebugInfo","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"Bytecode","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"EndsWith","parent":"string","type":"libraryfunc","description":"Returns whether or not the second passed string matches the end of the first.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"331-L335"},"args":{"arg":[{"text":"The string whose end is to be checked.","name":"str","type":"string"},{"text":"The string to be matched with the end of the first.","name":"end","type":"string"}]},"rets":{"ret":{"text":"`true` if the first string ends with the second, or the second is empty, otherwise `false`.","name":"","type":"boolean"}}},"example":{"description":"Looks for arguments at the end of a string.","code":"local endswith = string.EndsWith(\"Supercalifragilisticexpialidocious\", \"docious\")\nif endswith then\n\tprint(\"Marry Poppins\")\nend","output":"```\nMarry Poppins\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Explode","parent":"string","type":"libraryfunc","description":"Splits a string up wherever it finds the given separator.\n\nThe function string.Split is an alias of this function, except that function doesn't support using patterns.\n\nSee string.Implode for the reverse operation of this function.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"83-L104"},"args":{"arg":[{"text":"The string will be separated wherever this sequence is found.","name":"separator","type":"string"},{"text":"The string to split up.","name":"str","type":"string"},{"text":"Set this to true if your separator is a pattern.","name":"withpattern","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"Exploded string as a numerical sequential table.","name":"","type":"table<string>"}}},"example":[{"description":"Splits a sentence into a table of the words in it.","code":"local sentence = \"hello there my name is Player1\"\nlocal words = string.Explode( \" \", sentence )\nPrintTable( words )","output":"```\n1 = hello\n2 = there\n3 = my\n4 = name\n5 = is\n6 = Player1\n```"},{"description":"Uses Explode to sort through words that a player says.","code":"hook.Add( \"PlayerSay\", \"GiveHealth\", function( ply, text )\n\tlocal playerInput = string.Explode( \" \", text )\n\n\tif ( playerInput[1] == \"!givehealth\" ) then \n\n\t\tif ( tonumber( playerInput[2] ) ) then\n\n\t\t\tply:SetHealth( tonumber( playerInput[2] ) )\n\n\t\t\tprint( ply:Nick() .. \" set their health to \" .. playerInput[2] )\n\n\t\tend\n\n\tend\n\nend)","output":"```\nPlayer1 set their health to 100.\n```"},{"description":"Splits a sentence into a table at every digit.","code":"local sentence = \"Separated 4 every digit like 1 and 2\"\nlocal words = string.Explode(\"%d\", sentence, true)\nPrintTable( words )","output":"```\n1\t=\tSeparated \n2\t=\t every digit like \n3\t=\t and \n4\t=\t\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"find","parent":"string","type":"libraryfunc","description":{"text":"Attempts to find the specified substring in a string.","warning":"This function uses Lua Patterns by default."},"realm":"Shared and Menu","args":{"arg":[{"text":"The string to search in.","name":"haystack","type":"string"},{"text":"The string to find, can contain patterns if enabled.","name":"needle","type":"string"},{"text":"The position to start the search from, can be negative start position will be relative to the end position.","name":"startPos","type":"number","default":"1"},{"text":"Disable patterns.","name":"noPatterns","type":"boolean","default":"false"}]},"rets":{"ret":[{"text":"Starting position of the found text, or nil if the text wasn't found","name":"","type":"number"},{"text":"Ending position of found text, or nil if the text wasn't found","name":"","type":"number"},{"text":"Matched text for each group if patterns are enabled and used, or nil if the text wasn't found","name":"","type":"string"}]}},"example":{"description":"Change the word \"heck\" to \"****\" in chat messages","code":"hook.Add( \"PlayerSay\", \"NoHeckHere\", function( ply, text)\n    local swear = \"heck\"\n\tif ( string.find( text:lower(), swear)) then    \t\n\t\treturn string.gsub(text,  swear, \"****\")\n\tend\nend )"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"format","parent":"string","type":"libraryfunc","description":"Formats the specified values into the string given.","realm":"Shared and Menu","args":{"arg":[{"text":"The string to be formatted.\n\nFollows this format: http://www.cplusplus.com/reference/cstdio/printf/\n\nThe following features are not supported in Lua:\n* The `n` specifier\n* The `*` width modifier\n* The `.*` precision modifier\n* All length modifiers\n\nThe following specifiers are exclusive to LuaJIT:\n\n| Format | Description | Example of the output |\n|:------:|:-----------:|:---------------------:|\n| %p | Returns pointer to supplied structure (table/function) | `0xf20a8968` |\n| %q | Formats a string between double quotes, using escape sequences when necessary to ensure that it can safely be read back by the Lua interpreter | `\"test\\1\\2test\"` |","name":"format","type":"string"},{"text":"Values to be formatted into the string.","name":"formatParameters","type":"vararg"}]},"rets":{"ret":{"text":"The formatted string","name":"","type":"string"}}},"example":{"description":"Example showing the different types of format codes.","code":"local s = \"Hello, world!\"\n \n// string\nprint(string.format(\"here's a string: %s\", s))\n \n// string with quotes\nprint(string.format(\"here's a quoted string: %q\", s))\n \n// characters from numeric values\nprint(string.format(\"%c%c%c\", 65, 66, 67))\n \n// number with an exponent\nprint(string.format(\"%e, %E\", math.pi, math.pi))\n \n// float and compact float\nprint(string.format(\"%f, %G\", math.pi, math.pi))\n \n// signed, signed, and unsigned int\nprint(string.format(\"%d, %i, %u\", -100, -100, -100))\n \n// octal, hex, and uppercase hex\nprint(string.format(\"%o, %x, %X\", -100, -100, -100))","output":"```\nhere's a string: Hello, world!\n\nhere's a quoted string: \"Hello, world!\"\n\nABC\n\n3.141593e+000, 3.141593E+000\n\n3.141593, 3.14159\n\n-100, -100, 4294967196\n\n37777777634, ffffff9c, FFFFFF9C\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"FormattedTime","parent":"string","type":"libraryfunc","description":"Returns the time as a formatted string or as a table if no format is given.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"186-L198"},"args":{"arg":[{"text":"The time in seconds to format.","name":"float","type":"number"},{"text":"An optional formatting to use. If no format it specified, a table will be returned instead.","name":"format","type":"string","default":"nil"}]},"rets":{"ret":{"text":"Returns the time as a formatted string only if a format was specified.\n\nReturns a table if no format was specified.","name":"","type":"string|table{FormattedTime}"}}},"example":[{"description":"Formats the time in seconds","code":"local time = string.FormattedTime( 90, \"%02i:%02i:%02i\" )\nprint( time )","output":"01:30:00"},{"description":"Returns a table with the time separated by units.","code":"local time = string.FormattedTime( 90 )\nPrintTable( time )","output":"```\nms = 0\nm = 1\ns = 30\nh = 0\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"FromColor","parent":"string","type":"libraryfunc","description":"Creates a string from a Color variable.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"337-L341"},"args":{"arg":{"text":"The Color to put in the string.","name":"color","type":"Color"}},"rets":{"ret":{"text":"Output","name":"","type":"string"}}},"example":{"description":"Demonstrates the use of string.FromColor","code":"MsgN(string.FromColor(Color(255, 0, 255, 125)))","output":"\"255 0 255 125\""},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetChar","parent":"string","type":"libraryfunc","description":{"text":"Returns char value from the specified index in the supplied string.","deprecated":"Use either string.sub(str, index, index) or str[index]."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"305-L309"},"args":{"arg":[{"text":"The string that you will be searching with the supplied index.","name":"str","type":"string"},{"text":"The index's value of the string to be returned.","name":"index","type":"number"}]},"rets":{"ret":{"text":"str","name":"","type":"string"}}},"example":{"description":"Looks index in the supplied string and returns value of that index.","code":"local char = \"ABC\"\nprint(string.GetChar(char, 2))","output":"B"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetExtensionFromFilename","parent":"string","type":"libraryfunc","description":{"text":"Returns extension of the file.\n\nSee string.StripExtension for a function to remove the extension.  \nSee string.GetFileFromFilename and string.GetPathFromFilename for related functions.","note":"Make sure there are no trailing whitespaces in your `path` argument"},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"124"},"args":{"arg":{"text":"The string eg. file-path to get the file extension from.","name":"path","type":"string"}},"rets":{"ret":{"text":"File extension or `nil`.","name":"","type":"string"}}},"example":{"description":"Prints the extension of the file.","code":"print(string.GetExtensionFromFilename(\"garrysmod/lua/modules/string.lua\"))","output":"lua"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetFileFromFilename","parent":"string","type":"libraryfunc","description":"Returns file name and extension.\n\nSee string.GetPathFromFilename for the opposite function.  \nSee string.GetExtensionFromFilename for the file extension version.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"166-L173"},"args":{"arg":{"text":"The string eg. file-path to get the file-name from.","name":"path","type":"string"}},"rets":{"ret":{"text":"File name or unmodified string.","name":"","type":"string"}}},"example":{"description":"Returns the file name.","code":"print( string.GetFileFromFilename( \"garrysmod/lua/modules/string.lua\" ) )","output":"string.lua"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetPathFromFilename","parent":"string","type":"libraryfunc","description":"Returns the path part of a full file path.\n  \nSee string.GetFileFromFilename for the opposite function.  \nSee string.GetExtensionFromFilename for thefile extension version.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"152"},"args":{"arg":{"text":"The string eg. file-path to get the path from.","name":"path","type":"string"}},"rets":{"ret":{"text":"Path or empty string.","name":"","type":"string"}}},"example":{"description":"Demonstrates the use of string.GetPathFromFilename","code":"MsgN(string.GetPathFromFilename(\"garrysmod/lua/modules/string.lua\"))","output":"\"garrysmod/lua/modules/\""},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"gfind","parent":"string","type":"libraryfunc","description":{"text":"Returns an iterator function that is called for every complete match of the pattern, all sub matches will be passed as to the loop.","deprecated":"This function is removed in Lua versions later than what GMod is currently using. Use string.gmatch instead."},"realm":"Shared and Menu","args":{"arg":[{"text":"The string to search in","name":"data","type":"string"},{"text":"The pattern to search for","name":"pattern","type":"string"}]},"rets":{"ret":{"text":"The iterator function that can be used in a for-in loop","name":"","type":"function"}}},"example":{"description":"Example usage of the function","code":"local s = \"my awesome stuff 12\"\nfor w in string.gfind(s, \"(%a)\") do\n    Msg(w)\nend","output":"In your console:\nmyawesomestuff"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"gmatch","parent":"string","type":"libraryfunc","description":"Using Patterns, returns an iterator which will return either one value if no capture groups are defined, or any capture group matches.","realm":"Shared and Menu","args":{"arg":[{"text":"The string to search in","name":"data","type":"string"},{"text":"The pattern to search for","name":"pattern","type":"string"}]},"rets":{"ret":{"text":"The iterator function that can be used in a for-in loop","name":"","type":"function"}}},"example":{"description":"Explodes the string for each space and comma in the string","code":"str = \"qwe,a cde\"\nfor s in string.gmatch(str, \"[^%s,]+\") do\n    print(s)\nend","output":"```\nqwe\na\ncde\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"gsub","parent":"string","type":"libraryfunc","description":"This functions main purpose is to replace certain character sequences in a string using Patterns.","realm":"Shared and Menu","args":{"arg":[{"text":"String which should be modified.","name":"string","type":"string"},{"text":"The pattern that defines what should be matched and eventually be replaced.","name":"pattern","type":"string"},{"text":"In case of a string the matched sequence will be replaced with it.\n\nIn case of a table, the matched sequence will be used as key and the table will tested for the key, if a value exists it will be used as replacement.\n\nIn case of a function all matches will be passed as parameters to the function, the return value(s) of the function will then be used as replacement.","name":"replacement","type":"string"},{"text":"Maximum number of replacements to be made.","name":"maxReplaces","type":"number","default":"nil"}]},"rets":{"ret":[{"text":"replaceResult","name":"","type":"string"},{"text":"replaceCount","name":"","type":"number"}]}},"example":{"description":"Replaces \"hello\" with \"hi\" in the string \"hello there!\"","code":"string.gsub(\"hello there!\", \"hello\", \"hi\")","output":"hi there!"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Implode","parent":"string","type":"libraryfunc","description":{"text":"Joins the values of a table together to form a string.\n\nThis is the reverse of string.Explode and is functionally identical to table.concat, but with less features.","deprecated":"You really should just use table.concat."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"115-L117"},"args":{"arg":[{"text":"The separator to insert between each piece.","name":"separator","type":"string","default":""},{"text":"The table of pieces to concatenate. The keys for these must be numeric and sequential.","name":"pieces","type":"table"}]},"rets":{"ret":{"text":"Imploded pieces","name":"","type":"string"}}},"example":{"description":"Joins all values of a table with a space","code":"local tab = { \"one\", \"two\", \"three\" }\n\nprint( string.Implode( \" \", tab ) )","output":"```\none two three\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Interpolate","parent":"string","type":"libraryfunc","added":"2023.01.25","description":"Interpolates a given string with the given table. This is useful for formatting localized strings.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"379-L383"},"args":{"arg":[{"text":"The string that should be interpolated.","name":"str","type":"string"},{"text":"The table to search in.","name":"lookuptable","type":"table"}]},"rets":{"ret":{"text":"The modified string.","name":"","type":"string"}}},"example":{"description":"Example on how to use this function.","code":"local tbl = {\n\t[\"Name\"]= \"Jerry\"\n}\nprint( string.Interpolate( \"Hello {Name}!\", tbl ) )","output":"```\nHello Jerry!\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"JavascriptSafe","parent":"string","type":"libraryfunc","description":"Escapes special characters for JavaScript in a string, making the string safe for inclusion in to JavaScript strings.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"42-L52"},"args":{"arg":{"text":"The string that should be escaped.","name":"str","type":"string"}},"rets":{"ret":{"text":"The escaped string.","name":"","type":"string"}}},"example":{"description":"Executes JavaScript on a panel using user input safely.","code":"local user_input = \"The user's input lives in this variable\"\n\nlocal Panel = vgui.Create( \"DHTML\" )\nPanel:SetURL( \"example.com/something.html\" )\nPanel:Center()\nPanel:SetSize( 100, 100 )\nPanel:RunJavascript( \"MyJavaScriptFunction('\" .. string.JavascriptSafe( user_input ) .. \"')\" )"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Left","parent":"string","type":"libraryfunc","description":"Returns everything left of supplied place of that string.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"244"},"args":{"arg":[{"text":"The string to extract from.","name":"str","type":"string"},{"text":"Amount of chars relative to the beginning (starting from 1).","name":"num","type":"number"}]},"rets":{"ret":{"text":"Returns a string containing a specified number of characters from the left side of a string.","name":"","type":"string"}}},"example":{"description":"Extracts \"garry\" from \"garrys mod\" string.","code":"local text = \"garrys mod\"\nprint(string.Left(text, 5))","output":"garry"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"len","parent":"string","type":"libraryfunc","description":"Counts the number of characters in the string (length). This is equivalent to using the length operator (#).","realm":"Shared and Menu","args":{"arg":{"text":"The string to find the length of.","name":"str","type":"string"}},"rets":{"ret":{"text":"Length of the string","name":"","type":"number"}}},"example":{"description":"Demonstrates the use of this function.","code":"print( string.len( \"hi\" ) )\nprint( string.len( \"drakehawke\" ) )\nprint( string.len( \"\" ) )\nprint( string.len( \"test\" ) == #\"test\" )","output":"2\n\n10\n\n0\n\ntrue"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"lower","parent":"string","type":"libraryfunc","description":{"text":"Changes any upper-case letters in a string to lower-case letters.","note":"This function doesn't work on special non-English UTF-8 characters."},"realm":"Shared and Menu","args":{"arg":{"text":"The string to convert.","name":"str","type":"string"}},"rets":{"ret":{"text":"A string representing the value of a string converted to lower-case.","name":"","type":"string"}}},"example":[{"description":"Demonstrates the use of this function.","code":"print( string.lower( \"ABCDEFG\" ) )\nprint( string.lower( \"AbCdefG\" ) )\nprint( string.lower( \"abcdefg\" ) )\nprint( string.lower( \"1234567890\" ) )","output":"```\nabcdefg\nabcdefg\nabcdefg\n1234567890\n```"},{"description":"Demonstrates a common use for string.lower - case-insensitive user input.","code":"-- All keys in this table must be lowercase:\nlocal products = {}\nproducts.apple = \"Buy an apple!\"\nproducts.banana = \"Buy a bunch of bananas!\"\nproducts.tomato = \"There's also tomatoes.\"\n\n-- This function is case-insensitive, meaning \"APPLE\", \"apple\", and \"APPle\" are all the same.\nfunction GetProduct( userinput )\n\n\treturn userinput, products[ string.lower( userinput ) ]\n\nend\n\n-- Demonstration:\nprint( GetProduct( \"apple\" ) )\nprint( GetProduct( \"Apple\" ) )\nprint( GetProduct( \"APPLE\" ) )\nprint()\nprint( GetProduct( \"banana\" ) )\nprint( GetProduct( \"BaNaNa\" ) )","output":"```\napple\tBuy an apple!\nApple\tBuy an apple!\nAPPLE\tBuy an apple!\n\nbanana\tBuy a bunch of bananas!\nBaNaNa\tBuy a bunch of bananas!\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"match","parent":"string","type":"libraryfunc","description":"Finds a Pattern in a string.","realm":"Shared and Menu","args":{"arg":[{"text":"String which should be searched in for matches.","name":"string","type":"string"},{"text":"The pattern that defines what should be matched.","name":"pattern","type":"string"},{"text":"The start index to start the matching from, can be negative to start the match from a position relative to the end.","name":"startPosition","type":"number","default":"1"}]},"rets":{"ret":{"text":"Matched text(s)","name":"","type":"vararg"}}},"example":{"code":"local toMatch = \"this is a sample text\"\nprint( string.match( toMatch, \"sample\" ) )\n-- patterns work\nprint( string.match( toMatch, \"^[a-z]\" ) )\nprint( string.match( toMatch, \"^this\" ) )\nprint( string.match( toMatch, \"^..is\" ) )\nprint( string.match( toMatch, \"text$\" ) )\n-- entire string\nprint( string.match( toMatch, \"^.*$\" ) )\n-- multiple return values\nprint( string.match( toMatch, \"(this) is a (%w+)\" ) )\n-- nil\nprint( string.match( toMatch, \"this$\" ) )\nprint( string.match( toMatch, \"nil\" ) )","output":"```\nsample  \nt  \nthis  \nthis  \ntext  \nthis is a sample text  \nthis\tsample  \nnil  \nnil\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"NiceName","parent":"string","type":"libraryfunc","description":"Converts a `\"string_likeThis\"` to a more human-friendly `\"String like This\"`.\n\nThis is used internally by Faceposer and other code to transform flex and bodygroup names to a more friendly format.","added":"2024.06.28","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"413-L451"},"args":{"arg":{"text":"The name to transform.","name":"text","type":"string"}},"rets":{"ret":{"text":"The more human-friendly version of the input text.","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"NiceSize","parent":"string","type":"libraryfunc","description":"Converts a digital filesize to human-readable text.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"283-L294"},"args":{"arg":{"text":"The filesize in bytes.","name":"bytes","type":"number"}},"rets":{"ret":{"text":"The human-readable filesize, in Bytes/KB/MB/GB (whichever is appropriate).","name":"","type":"string"}}},"example":{"description":"Example output of this function.","code":"print(string.NiceSize(64512))","output":"63 KB"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"NiceTime","parent":"string","type":"libraryfunc","description":"Formats the supplied number (in seconds) to the highest possible time unit.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"210-L242"},"args":{"arg":{"text":"The number to format, in seconds.","name":"num","type":"number"}},"rets":{"ret":{"text":"A nicely formatted time string.","name":"","type":"string"}}},"example":{"code":"print(string.NiceTime(600))\nprint(string.NiceTime(630))\nprint(string.NiceTime(660))\nprint(string.NiceTime(4356))\nprint(string.NiceTime(43545456))","output":"```\n10 minutes\n10 minutes\n11 minutes\n1 hour\n1 year\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"PatternSafe","parent":"string","type":"libraryfunc","description":"Escapes all special characters within a string, making the string safe for inclusion in a Lua pattern.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"58-L76"},"args":{"arg":{"text":"The string to be sanitized","name":"str","type":"string"}},"rets":{"ret":{"text":"The string that has been sanitized for inclusion in Lua patterns","name":"","type":"string"}}},"example":{"description":"Replaces all occurrences of \"100%\" in a string with \"0%\" and prints it.\n\nWe call string.PatternSafe here as '%' is a special character when used in Lua patterns.","code":"local result = string.gsub( \"You scored 100%!\", \n\t\t\t\t\t\t\tstring.PatternSafe( \"100%\" ), \n\t\t\t\t\t\t\tstring.PatternSafe( \"0%\" ) )\n\nprint( result )","output":"You scored 0%!"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"rep","parent":"string","type":"libraryfunc","description":"Repeats a string by the provided number, with an optional separator.","realm":"Shared and Menu","args":{"arg":[{"text":"The string to convert.","name":"str","type":"string"},{"text":"Times to repeat, this value gets rounded internally.","name":"repetitions","type":"number"},{"text":"String that will separate the repeated piece. Notice that it doesn't add this string to the start or the end of the result, only between the repeated parts.","name":"separator","type":"string","default":""}]},"rets":{"ret":{"text":"Repeated string.","name":"","type":"string"}}},"example":[{"description":"Repeating \"abc\" 5 times.","code":"print(string.rep(\"abc\", 5))","output":"abcabcabcabcabc"},{"description":"Repeating \"hello world\" 3 times, with the separator \" \" (space).","code":"print(string.rep(\"hello world\", 3, \" \"))","output":"hello world hello world hello world"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Replace","parent":"string","type":"libraryfunc","description":"Replaces all occurrences of the supplied second string.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"247-L251"},"args":{"arg":[{"text":"The string we are seeking to replace an occurrence(s).","name":"str","type":"string"},{"text":"What we are seeking to replace.","name":"find","type":"string"},{"text":"What to replace find with.","name":"replace","type":"string"}]},"rets":{"ret":{"text":"The processed string with replacements.","name":"","type":"string"}}},"example":{"description":"Replaces the word \"Garrys\" with \"Hers\".","code":"local text = \"Garrys Mod\"\nprint(string.Replace(text, \"Garrys\", \"Hers\"))","output":"Hers Mod"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"reverse","parent":"string","type":"libraryfunc","description":"Reverses a string.","realm":"Shared and Menu","args":{"arg":{"text":"The string to be reversed.","name":"str","type":"string"}},"rets":{"ret":{"text":"reversed string","name":"","type":"string"}}},"example":{"description":"Reverse \"abcdef\".","code":"print( string.reverse( \"abcdef\" ) )","output":"fedcba"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Right","parent":"string","type":"libraryfunc","description":"Returns the last n-th characters of the string.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"245"},"args":{"arg":[{"text":"The string to extract from.","name":"str","type":"string"},{"text":"Amount of chars relative to the end (starting from 1).","name":"num","type":"number"}]},"rets":{"ret":{"text":"Returns a string containing a specified number of characters from the right side of a string.","name":"","type":"string"}}},"example":{"description":"Extracts \"mod\" from \"garrys mod\" string.","code":"local text = \"garrys mod\"\nprint( string.Right( text, 3 ) )","output":"mod"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SetChar","parent":"string","type":"libraryfunc","description":"Sets the character at the specific index of the string.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"299-L303"},"args":{"arg":[{"text":"The input string","name":"InputString","type":"string"},{"text":"The character index, 1 is the first from left.","name":"Index","type":"number"},{"text":"String to replace with.","name":"ReplacementChar","type":"string"}]},"rets":{"ret":{"text":"ModifiedString","name":"","type":"string"}}},"example":{"description":"Demonstrates the use of SetChar","output":"\"Apgles\"","code":"local str = \"Apples\"\nMsgN(string.SetChar(str, 3, \"g\"))"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Split","parent":"string","type":"libraryfunc","description":"Splits the string into a table of strings, separated by the second argument.\n\nThis is an alias of string.Explode, but with flipped arguments.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"106-L108"},"args":{"arg":[{"text":"String to split","name":"input","type":"string"},{"text":"Character(s) to split with.","name":"separator","type":"string"}]},"rets":{"ret":{"text":"Split table","name":"","type":"table<string>"}}},"example":{"description":"Demonstrates the use of this function.","code":"local mystring = \"This is some text\"\nPrintTable( string.Split( mystring, \" \" ) )","output":"```\n1 = This\n2 = is\n3 = some\n4 = text\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"StartsWith","parent":"string","type":"libraryfunc","added":"2023.01.25","description":"Returns whether or not the first string starts with the second.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"324-L329"},"args":{"arg":[{"text":"String to check.","name":"inputStr","type":"string"},{"text":"String to check with.","name":"start","type":"string"}]},"rets":{"ret":{"text":"Whether the first string starts with the second.","name":"","type":"boolean"}}},"example":{"description":"Demonstrates the use of string.StartsWith","output":"true","code":"print(string.StartsWith(\"hello there\", \"hell\"))"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"StartWith","parent":"string","type":"libraryfunc","description":{"text":"Returns whether or not the first string starts with the second. This is a alias of string.StartsWith.","deprecated":"Use string.StartsWith."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"324-L328"},"args":{"arg":[{"text":"String to check.","name":"inputStr","type":"string"},{"text":"String to check with.","name":"start","type":"string"}]},"rets":{"ret":{"text":"Whether the first string starts with the second.","name":"","type":"boolean"}}},"example":{"description":"Demonstrates the use of string.StartWith","output":"true","code":"print(string.StartWith(\"hello there\", \"hell\"))"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"StripExtension","parent":"string","type":"libraryfunc","description":"Removes the extension of a path.\n\nSee string.GetExtensionFromFilename for a function to retrieve the extension instead.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"137-L145"},"args":{"arg":{"text":"The string eg. file-path to strip the extension.","name":"path","type":"string"}},"rets":{"ret":{"text":"File-path without extension or unmodified string.","name":"","type":"string"}}},"example":{"description":"Demonstrates the use of string.StripExtension","code":"MsgN(string.StripExtension(\"garrysmod/lua/modules/string.lua\"))","output":"\"garrysmod/lua/modules/string\""},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"sub","parent":"string","type":"libraryfunc","description":"Returns a sub-string, starting from the character at position `StartPos` of the string (inclusive), and optionally ending at the character at position `EndPos` of the string (also inclusive). If EndPos is not given, the rest of the string is returned.","realm":"Shared and Menu","args":{"arg":[{"text":"The string you'll take a sub-string out of.","name":"string","type":"string"},{"text":"The position of the first character that will be included in the sub-string. It can be negative to count from the end.","name":"StartPos","type":"number"},{"text":"The position of the last character to be included in the sub-string. It can be negative to count from the end.","name":"EndPos","type":"number","default":"nil"}]},"rets":{"ret":{"text":"The substring.","name":"","type":"string"}}},"example":{"description":"Demonstrates the use of this function.","code":"local mystring = \"Some random text\"\nprint( string.sub( mystring, 1, 4 ) )","output":"Some"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ToColor","parent":"string","type":"libraryfunc","description":"Fetches a Color type from a string.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"343-L355"},"args":{"arg":{"text":"The string to convert from.","name":"Inputstring","type":"string"}},"rets":{"ret":{"text":"The output Color","name":"","type":"Color"}}},"example":{"description":"Demonstrates the use of string.ToColor","code":"PrintTable( string.ToColor( \"255 0 255 125\" ) )","output":"```\nr = 255\ng = 0\nb = 255\na = 125\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ToMinutesSeconds","parent":"string","type":"libraryfunc","description":"Returns given time in \"MM:SS\" format.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"204"},"args":{"arg":{"text":"Time in seconds","name":"time","type":"number"}},"rets":{"ret":{"text":"Formatted time","name":"","type":"string"}}},"example":{"description":"Example of using this function","code":"print( string.ToMinutesSeconds( 61 ) )","output":"01:01"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ToMinutesSecondsMilliseconds","parent":"string","type":"libraryfunc","description":"Returns given time in \"MM:SS:MS\" format.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"203"},"args":{"arg":{"text":"Time in seconds","name":"time","type":"number"}},"rets":{"ret":{"text":"Formatted time","name":"","type":"string"}}},"example":{"description":"Example of using this function","code":"print( string.ToMinutesSecondsMilliseconds( 61.128 ) )","output":"01:01:13"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ToTable","parent":"string","type":"libraryfunc","description":{"text":"Splits the string into characters and creates a sequential table of characters.","warning":"As a result of the  encoding, non-ASCII characters will be split into more than one character in the output table. Each character value in the output table will always be 1 byte."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"8-L19"},"args":{"arg":{"text":"The string you'll turn into a table.","name":"str","type":"string"}},"rets":{"ret":{"text":"A sequential table where each value is a character from the given string","name":"","type":"table"}}},"example":[{"description":"Demonstrates the use of this function.","code":"local mystring = \"text\"\nPrintTable( string.ToTable( mystring ) )","output":"```\n1 = t\n2 = e\n3 = x\n4 = t\n```"},{"description":"Demonstrates how this function behaves with non-ASCII characters - in this case, Greek letters.","code":"for k, v in ipairs( string.ToTable( \"abcd αβγδ\" ) ) do\n\tprint( k, bit.tohex( string.byte( v ) ), v )\nend","output":"```\n1\t00000061\ta\n2\t00000062\tb\n3\t00000063\tc\n4\t00000064\td\n5\t00000020\t \n6\t000000ce\t?\n7\t000000b1\t?\n8\t000000ce\t?\n9\t000000b2\t?\n10\t000000ce\t?\n11\t000000b3\t?\n12\t000000ce\t?\n13\t000000b4\t?\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Trim","parent":"string","type":"libraryfunc","description":"Removes leading and trailing matches of a string.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"258-L261"},"args":{"arg":[{"text":"The string to trim.","name":"Inputstring","type":"string"},{"text":"String to match - can be multiple characters. Matches spaces by default.","name":"Char","type":"string","default":"%s"}]},"rets":{"ret":{"text":"Modified string","name":"","type":"string"}}},"example":[{"description":"Demonstrates the use of string. Trim without second argument.","code":"MsgN(string.Trim(\" hi whatsup \"))","output":"\"hi whatsup\""},{"description":"Trim with longer strings as second argument.","code":"MsgN(string.Trim(\"you cant be serious ,you\", \"you\"))","output":"\" cant be serious ,\""}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"TrimLeft","parent":"string","type":"libraryfunc","description":"Removes leading spaces/characters from a string.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"278-L281"},"args":{"arg":[{"text":"String to trim","name":"str","type":"string"},{"text":"Custom character to remove","name":"char","type":"string","default":"%s"}]},"rets":{"ret":{"text":"Trimmed string","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"TrimRight","parent":"string","type":"libraryfunc","description":"Removes trailing spaces/passed character from a string.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/string.lua","line":"268-L271"},"args":{"arg":[{"text":"String to remove from","name":"str","type":"string"},{"text":"Custom character to remove, default is a space","name":"char","type":"string","default":"%s"}]},"rets":{"ret":{"text":"Trimmed string","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"upper","parent":"string","type":"libraryfunc","description":{"text":"Changes any lower-case letters in a string to upper-case letters.","note":"This function doesn't work on special non-English UTF-8 characters."},"realm":"Shared and Menu","args":{"arg":{"text":"The string to convert.","name":"str","type":"string"}},"rets":{"ret":{"text":"A string representing the value of a string converted to upper-case.","name":"","type":"string"}}},"example":{"description":"Demonstrates the use of this function.","code":"print( string.upper( \"ABCDEFG\" ) )\nprint( string.upper( \"AbCdefG\" ) )\nprint( string.upper( \"abcdefg\" ) )\nprint( string.upper( \"1234567890\" ) )","output":"```\nABCDEFG\n\nABCDEFG\n\nABCDEFG\n\n1234567890\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"CreateFont","parent":"surface","type":"libraryfunc","description":{"text":"Creates a new font.\n\nTo prevent the font from displaying incorrectly when using the `outline` setting, set `antialias` to false. This will ensure the text properly fills out the entire outline.\n\nBe sure to check the List of Default Fonts first! Those fonts can be used without using this function.\n\nSee Also: Finding the Font Name.","warning":"Due to the static nature of fonts, do **NOT** create the font more than once. You should only be creating them once, it is recommended to create them at the top of your script. Do not use this function within GM:HUDPaint or any other hook!\n\nDefine fonts that you will actually use, as fonts are very taxing on performance and will cause crashes! Do not create fonts for every size."},"realm":"Client and Menu","args":{"arg":[{"text":"The new font name.","name":"fontName","type":"string"},{"text":"The font properties. See the Structures/FontData.","name":"fontData","type":"table{FontData}"}]}},"example":{"description":"Creates a font with all the defaults showing (any of the fields could be left out for an equivalent font)","code":"surface.CreateFont( \"TheDefaultSettings\", {\n\tfont = \"Arial\", -- On Windows/macOS, use the font-name which is shown to you by your operating system Font Viewer. On Linux, the font-name *may* work, but using the file name is more reliable\n\textended = false,\n\tsize = 13,\n\tweight = 500,\n\tblursize = 0,\n\tscanlines = 0,\n\tantialias = true,\n\tunderline = false,\n\titalic = false,\n\tstrikeout = false,\n\tsymbol = false,\n\trotary = false,\n\tshadow = false,\n\tadditive = false,\n\toutline = false,\n} )\n\nhook.Add( \"HUDPaint\", \"HelloThere\", function()\n\tdraw.SimpleText( \"Hello there!\", \"TheDefaultSettings\", ScrW() * 0.5, ScrH() * 0.25, color_white, TEXT_ALIGN_CENTER )\nend )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DisableClipping","parent":"surface","type":"libraryfunc","description":{"text":"Enables or disables the clipping used by the VGUI that limits the drawing operations to a panels bounds.\n\nIdentical to Global.DisableClipping. See also Panel:NoClipping.","deprecated":"Alias of Global.DisableClipping so use that instead."},"realm":"Client and Menu","args":{"arg":{"text":"True to disable, false to enable the clipping","name":"disable","type":"boolean"}},"rets":{"ret":{"text":"Whether the clipping was enabled or not before this function call","name":"oldState","type":"boolean","added":"2020.03.17"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DrawCircle","parent":"surface","type":"libraryfunc","description":{"text":"Draws a hollow circle, made of lines. For a filled circle, see examples for surface.DrawPoly.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu","args":[{"arg":[{"text":"The center x integer coordinate.","name":"originX","type":"number"},{"text":"The center y integer coordinate.","name":"originY","type":"number"},{"text":"The radius of the circle.","name":"radius","type":"number"},{"text":"The red value of the color to draw the circle with.","name":"r","type":"number"},{"text":"The green value of the color to draw the circle with.","name":"g","type":"number"},{"text":"The blue value of the color to draw the circle with.","name":"b","type":"number"},{"text":"The alpha value of the color to draw the circle with.","name":"a","type":"number","default":"255"}]},{"name":"Use color object","arg":[{"text":"The center x integer coordinate.","name":"originX","type":"number"},{"text":"The center y integer coordinate.","name":"originY","type":"number"},{"text":"The radius of the circle.","name":"radius","type":"number"},{"text":"A Color object/table to read the color from.","name":"color","type":"Color"}]}]},"example":{"description":"Example usage. Draws an orange circle at position 500, 500 with a varying/animated radius of 50 to 150.","code":"hook.Add( \"HUDPaint\", \"DrawCircleExample\", function()\n\n\tsurface.DrawCircle( 500, 500, 100 + math.sin( CurTime() ) * 50, Color( 255, 120, 0 ) )\n\nend )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DrawLine","parent":"surface","type":"libraryfunc","description":{"text":"Draws a line from one point to another.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu","args":{"arg":[{"text":"The start x float coordinate.","name":"startX","type":"number"},{"text":"The start y float coordinate.","name":"startY","type":"number"},{"text":"The end x float coordinate.","name":"endX","type":"number"},{"text":"The end y float coordinate.","name":"endY","type":"number"}]}},"example":{"description":"This example will draw a pixel perfect circle in the middle of your screen.","code":"hook.Add( \"HUDPaint\", \"Circle\", function()\n\tlocal center = Vector( ScrW() / 2, ScrH() / 2, 0 )\n\tlocal scale = Vector( 100, 100, 0 )\n\tlocal segmentdist = 360 / ( 2 * math.pi * math.max( scale.x, scale.y ) / 2 )\n\tsurface.SetDrawColor( 255, 0, 0, 255 )\n \n\tfor a = 0, 360 - segmentdist, segmentdist do\n\t\tsurface.DrawLine( center.x + math.cos( math.rad( a ) ) * scale.x, center.y - math.sin( math.rad( a ) ) * scale.y, center.x + math.cos( math.rad( a + segmentdist ) ) * scale.x, center.y - math.sin( math.rad( a + segmentdist ) ) * scale.y )\n\tend\nend )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DrawOutlinedRect","parent":"surface","type":"libraryfunc","description":{"text":"Draws a hollow box with a given border width.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu","args":{"arg":[{"text":"The start x integer coordinate.","name":"x","type":"number"},{"text":"The start y integer coordinate.","name":"y","type":"number"},{"text":"The integer width.","name":"w","type":"number"},{"text":"The integer height.","name":"h","type":"number"},{"text":"The thickness of the outlined box border.","name":"thickness","type":"number","default":"1"}]}},"example":{"description":"Draws a 100x100 outlined rectangle in top left corner of which the outline thickness pulses from 5 to 15 indefinitely.","code":"hook.Add( \"HUDPaint\", \"DrawOutlinedRect\", function()\n\tsurface.SetDrawColor( 255, 255, 255, 128 )\n\tsurface.DrawOutlinedRect( 25, 25, 100, 100, math.floor( math.sin( CurTime() * 5 ) * 5 ) + 10 )\nend )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DrawPoly","parent":"surface","type":"libraryfunc","description":{"text":"Draws a textured polygon (secretly a triangle fan) with a maximum of 4096 vertices.\nOnly works properly with convex polygons. You may try to render concave polygons, but there is no guarantee that things wont get messed up.\n\nUnlike most surface library functions, non-integer coordinates are not rounded.","warning":"You must reset the drawing color and texture before calling the function to ensure consistent results. See examples below.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu","args":{"arg":{"text":"A table containing integer vertices. See the Structures/PolygonVertex.\n\n**The vertices must be in clockwise order.**","name":"vertices","type":"table"}}},"example":[{"description":"Draws a red triangle in the top left corner of the screen.","code":"local triangle = {\n\t{ x = 100, y = 200 },\n\t{ x = 150, y = 100 },\n\t{ x = 200, y = 200 }\n}\n\nhook.Add(\"HUDPaint\", \"PolygonTest\", function()\n\t\n\tsurface.SetDrawColor( 255, 0, 0, 255 )\n\tdraw.NoTexture()\n\tsurface.DrawPoly( triangle )\n\nend )","output":{"image":{"src":"draw_poly.png"}}},{"description":"Draws a yellow polygon in the top left corner of the screen.","code":"local triangle = {\n\t{ x = 100, y = 200 },\n\n\t{ x = 150, y = 100 },\n\t{ x = 200, y = 200 },\n\t{ x = 150, y = 300 },\n\t{ x = 100, y = 300 },\n}\n\nhook.Add(\"HUDPaint\", \"PolygonExample\", function()\n\n\tsurface.SetDrawColor( 255, 255, 0, 255 )\n\tdraw.NoTexture()\n\tsurface.DrawPoly( triangle )\n\nend )","output":{"upload":{"src":"70c/8d8323cd4ef9932.png","size":"48448","name":"drawpoly_example.png"}}},{"description":"A helper function to draw a circle using surface.DrawPoly.","code":"function draw.Circle( x, y, radius, seg )\n\tlocal cir = {}\n\n\ttable.insert( cir, { x = x, y = y, u = 0.5, v = 0.5 } )\n\tfor i = 0, seg do\n\t\tlocal a = math.rad( ( i / seg ) * -360 )\n\t\ttable.insert( cir, { x = x + math.sin( a ) * radius, y = y + math.cos( a ) * radius, u = math.sin( a ) / 2 + 0.5, v = math.cos( a ) / 2 + 0.5 } )\n\tend\n\n\tlocal a = math.rad( 0 ) -- This is needed for non absolute segment counts\n\ttable.insert( cir, { x = x + math.sin( a ) * radius, y = y + math.cos( a ) * radius, u = math.sin( a ) / 2 + 0.5, v = math.cos( a ) / 2 + 0.5 } )\n\n\tsurface.DrawPoly( cir )\nend\n\nhook.Add(\"HUDPaint\", \"PolygonCircleTest\", function()\n\t\n\tsurface.SetDrawColor( 0, 0, 0, 200)\n\tdraw.NoTexture()\n\tdraw.Circle( ScrW() / 2, ScrH() / 2, 200, math.sin( CurTime() ) * 20 + 25 )\n\n\t--Usage:\n\t--draw.Circle( x, y, radius, segments )\n\nend )"}],"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DrawRect","parent":"surface","type":"libraryfunc","description":{"text":"Draws a solid rectangle on the screen.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu","args":{"arg":[{"text":"The X integer co-ordinate.","name":"x","type":"number"},{"text":"The Y integer co-ordinate.","name":"y","type":"number"},{"text":"The integer width of the rectangle.","name":"width","type":"number"},{"text":"The integer height of the rectangle.","name":"height","type":"number"}]}},"example":{"description":"Draws a white 100 by 100 rectangle, 25 pixels from the top left of the screen.","code":"hook.Add(\"HUDPaint\", \"MyRect\", function()\n    surface.SetDrawColor(255,255,255,255)\n    surface.DrawRect(25, 25, 100, 100)\nend)","output":{"image":{"src":"surface_drawrect.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DrawText","parent":"surface","type":"libraryfunc","description":{"text":"Draw the specified text on the screen, using the previously set [position](surface.SetTextPos), [font](surface.SetFont) and [color](surface.SetTextColor). This function does **not** handle newlines.\n\nThis function moves the [text position](surface.SetTextPos) by the length of the drawn text - this can be used to change text properties (such as font or color) without having to manually recalculate the text position. See example #2 for example use of this behavior.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu","args":{"arg":[{"text":"The text to be rendered.","name":"text","type":"string"},{"text":"`true` to force text to render additive, `false` to force not additive, `nil` to use font's value.\n\nWhen additive rendering is enabled, the rendered text pixels will be added to the existing screen pixels, rather than replacing them outright. This means black text will be invisible, and drawing on a pure white background will be impossible.","name":"forceAdditive","type":"boolean","default":"nil","upload":{"src":"70c/8db6ce804200a43.png","size":"21270","name":"image.png"}}]}},"example":[{"description":"Draws `Hello World` on the screen. All functions in this example must be called for the rendering to work flawlessly every time.","code":"hook.Add( \"HUDPaint\", \"drawsometext\", function()\n\tsurface.SetFont( \"Default\" )\n\tsurface.SetTextColor( 255, 255, 255 )\n\tsurface.SetTextPos( 128, 128 ) \n\tsurface.DrawText( \"Hello World\" )\nend )"},{"description":"Draws rainbow text without using surface.GetTextSize and surface.SetTextPos for every character (more efficient).","code":"local text = \"~Rainbow~\"\nhook.Add( \"HUDPaint\", \"drawsometext\", function()\n\tsurface.SetFont( \"DermaLarge\" )\n\tsurface.SetTextPos( 400, 128 )\n\tfor char = 1, #text do\n\t\tlocal col = HSVToColor( ( ( RealTime() * 100 ) - char * 15 ) % 360, 1, 1 )\n\t\tsurface.SetTextColor( col.r, col.g, col.b )\t\t\t-- Providing 3 numbers to surface.SetTextColor rather  \n\t\tsurface.DrawText( string.sub( text, char, char ) )\t-- than a single color is faster\n\tend\nend )"}],"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DrawTexturedRect","parent":"surface","type":"libraryfunc","description":{"text":"Draw a textured rectangle with the given position and dimensions on the screen, using the current active texture set with surface.SetMaterial. It is also affected by surface.SetDrawColor.\n\nSee also render.SetMaterial and render.DrawScreenQuadEx.  \nSee also surface.DrawTexturedRectUV and surface.DrawTexturedRectRotated.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu","args":{"arg":[{"text":"The X integer co-ordinate.","name":"x","type":"number"},{"text":"The Y integer co-ordinate.","name":"y","type":"number"},{"text":"The integer width of the rectangle.","name":"width","type":"number"},{"text":"The integer height of the rectangle.","name":"height","type":"number"}]}},"example":{"description":"Draws a 512x512 textured rectangle with the wireframe texture.","code":"-- Calling Material() every frame is quite expensive\n-- So we call it once, outside of any hooks, and cache the result in a local variable\nlocal ourMat = Material( \"models/wireframe\" )\n\nhook.Add( \"HUDPaint\", \"PutAUniqueHookNameHere\", function()\n\tsurface.SetDrawColor( 255, 255, 255, 255 ) -- Set the drawing color\n\tsurface.SetMaterial( ourMat ) -- Use our cached material\n\tsurface.DrawTexturedRect( 0, 0, 512, 512 ) -- Actually draw the rectangle\nend )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DrawTexturedRectRotated","parent":"surface","type":"libraryfunc","description":{"text":"Draw a textured rotated rectangle with the given position and dimensions and angle on the screen, using the current active texture.\n\nSee also surface.DrawTexturedRectUV and surface.DrawTexturedRect.","rendercontext":{"hook":"false","type":"2D"}},"realm":"Client and Menu","args":{"arg":[{"text":"The X integer co-ordinate, representing the center of the rectangle.","name":"x","type":"number"},{"text":"The Y integer co-ordinate, representing the center of the rectangle.","name":"y","type":"number"},{"text":"The integer width of the rectangle.","name":"width","type":"number"},{"text":"The integer height of the rectangle.","name":"height","type":"number"},{"text":"The rotation of the rectangle, in degrees.","name":"rotation","type":"number"}]}},"example":[{"description":"A function that allows you to override the origin of rotation.\n\nx0 and y0 are relative to the center of the rectangle.","code":"function surface.DrawTexturedRectRotatedPoint( x, y, w, h, rot, x0, y0 )\n\t\n\tlocal c = math.cos( math.rad( rot ) )\n\tlocal s = math.sin( math.rad( rot ) )\n\t\n\tlocal newx = y0 * s - x0 * c\n\tlocal newy = y0 * c + x0 * s\n\t\n\tsurface.DrawTexturedRectRotated( x + newx, y + newy, w, h, rot )\n\t\nend"},{"description":"Draws a simple red forever rotating box.","code":"function draw.RotatedBox( x, y, w, h, ang, color )\n\tdraw.NoTexture()\n\tsurface.SetDrawColor( color or color_white )\n\tsurface.DrawTexturedRectRotated( x, y, w, h, ang )\nend\n\nhook.Add( \"HUDPaint\", \"my_rotated_box\", function()\n\tdraw.RotatedBox( 100, 100, 100, 100, CurTime() % 360, Color( 255, 0, 0) )\nend )"}],"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DrawTexturedRectUV","parent":"surface","type":"libraryfunc","description":{"text":"Draws a textured rectangle with a repeated or partial texture.\n\n`u` and `v` refer to texture coordinates.\n* (u, v) = (0, 0) is the top left\n* (u, v) = (1, 0) is the top right\n* (u, v) = (1, 1) is the bottom right\n* (u, v) = (0, 1) is the bottom left\n\nUsing a start point of (1, 0) and an end point to (0, 1), you can draw an image flipped horizontally, same goes with other directions. Going above 1 will tile the texture. Negative values are allowed as well.\n\nHere's a helper image:\n\n\nSee also surface.DrawTexturedRect and surface.DrawTexturedRectRotated.","upload":{"src":"70c/8d7bba248dc08bd.png","size":"183359","name":"image.png"},"note":["If you are using a .png image, you need supply the \"noclamp\" flag as second parameter for Global.Material if you intend to use tiling.","If you find that `surface.DrawTexturedRectUV` is getting your texture coordinates (u0, v0), (u1, v1) wrong and you're rendering with a material created with Global.CreateMaterial, try adjusting them with the following code:\n\n```\nlocal du = 0.5 / 32 -- half pixel anticorrection\nlocal dv = 0.5 / 32 -- half pixel anticorrection\nlocal u0, v0 = (u0 - du) / (1 - 2 * du), (v0 - dv) / (1 - 2 * dv)\nlocal u1, v1 = (u1 - du) / (1 - 2 * du), (v1 - dv) / (1 - 2 * dv)\n```\n\n\n**Explanation:**\n`surface.DrawTexturedRectUV` tries to correct the texture coordinates by half a pixel (something to do with sampling) and computes the correction using `IMaterial::GetMappingWidth()`/`GetMappingHeight()`. If the material was created without a `$basetexture`, then `GetMappingWidth()`/`GetMappingHeight()` uses the width and height of the error material (which is 32x32)."],"rendercontext":{"hook":"false","type":"2D"},"bug":{"text":"The UV offsets might require (sub-)pixel correction for accurate tiling results.","issue":"3173"}},"realm":"Client and Menu","args":{"arg":[{"text":"The X integer coordinate.","name":"x","type":"number"},{"text":"The Y integer coordinate.","name":"y","type":"number"},{"text":"The integer width of the rectangle.","name":"width","type":"number"},{"text":"The integer height of the rectangle.","name":"height","type":"number"},{"text":"The U texture mapping of the rectangle origin.","name":"startU","type":"number"},{"text":"The V texture mapping of the rectangle origin.","name":"startV","type":"number"},{"text":"The U texture mapping of the rectangle end.","name":"endU","type":"number"},{"text":"The V texture mapping of the rectangle end.","name":"endV","type":"number"}]}},"example":[{"description":"Demonstrates the function usage.","code":"local mat = Material( \"gui/tool.png\" )\nhook.Add( \"HUDPaint\", \"DrawTexturedRectUV_example1\", function()\n\tsurface.SetDrawColor( color_white )\n\tsurface.SetMaterial( mat )\n\n\tsurface.DrawTexturedRect( 25, 25, 100, 100 )\n\tsurface.DrawTexturedRectUV( 25, 130, 100, 100, 0, 0, 1, 1 ) -- Exactly same as above line\n\n\t-- Draws right half of the texture\n\t-- Note that we also change the width of the rectangle to avoid stretcing of the texture\n\t-- This is for demonstration purposes, you can do whatever it is you need\n\tsurface.DrawTexturedRectUV( 130, 130, 50, 100, 0.5, 0, 1, 1 )\nend )"},{"description":"Paints repeated texture over a panel","code":"local mat = Material( \"icon16/box.png\", \"noclamp\" )\nfunction PANEL:Paint( w, h )\n\t-- Size of your texture, texW - width, texH - height\n\tlocal texW = 16\n\tlocal texH = 16\n\n\tsurface.SetMaterial( mat )\n\tsurface.SetDrawColor( color_white )\n\tsurface.DrawTexturedRectUV( 0, 0, w, h, 0, 0, w / texW, h / texH )\nend"}],"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetAlphaMultiplier","parent":"surface","type":"libraryfunc","description":"Returns the current alpha multiplier affecting drawing operations. This is set by surface.SetAlphaMultiplier or by the game engine in certain other cases.","realm":"Client and Menu","rets":{"ret":{"text":"The multiplier ranging from 0 to 1.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDrawColor","parent":"surface","type":"libraryfunc","description":"Returns the current color affecting draw operations.","realm":"Client and Menu","rets":{"ret":{"text":"The color that drawing operations will use.","name":"","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetHUDTexture","parent":"surface","type":"libraryfunc","description":"Returns the [HUD icon](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/scripts/hud_textures.txt) TextureID of a texture with the specified name.\n\nYou probably want to use Global.Material and surface.SetMaterial.","realm":"Client","args":{"arg":{"text":"The name of the texture.","name":"name","type":"string"}},"rets":{"ret":{"text":"The texture ID, for use with surface.SetTexture.","name":"texID","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetPanelPaintState","parent":"surface","type":"libraryfunc","description":"Retrieves the position and ScissorRect information for the Panel that is currently being drawn.\n\nWhen using the surface library (and, by extension, the draw library) inside of the PANEL:Paint function, the origin (The on-screen position of `(0,0)`) is automatically shifted to the top-left corner of the panel to make it easier to draw the panel's contents.  Additionally, render.SetScissorRect is used to clip (or \"mask\") all drawn content to within the boundaries of the panel.  This function returns the information used by the surface library about the current panel's origin and ScissorRect.","added":"2024.09.13","realm":"Client","rets":{"ret":{"text":"A table containing the position and ScissorRect boundaries for the Panel currently being drawn.\n\n\t\t\tFor the table's format and available options see the Structures/PanelPaintState page.","type":"table{PanelPaintState}"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetScissorRect","parent":"surface","type":"libraryfunc","description":"Retrieves the currently active scissor rect for the surface library. A faster, narrower version of surface.GetPanelPaintState.\n\nUseful for panel retrieving current panel's culling from PANEL:Paint.\n\nThis does **NOT** return values set by render.SetScissorRect.","added":"2026.02.26","realm":"Client","rets":{"ret":[{"text":"Whether the scissor rect is active or not. If `false`, the following values should be ignored.","type":"boolean"},{"text":"Left edge of the scissor rect.","type":"number"},{"text":"Top edge of the scissor rect.","type":"number"},{"text":"Right edge of the scissor rect.","type":"number"},{"text":"Bottom edge of the scissor rect.","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTextColor","parent":"surface","type":"libraryfunc","description":"Returns the current color affecting text draw operations.","realm":"Client and Menu","rets":{"ret":{"text":"The color that text drawing operations will use.","name":"","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTextPos","parent":"surface","type":"libraryfunc","description":"Returns the X and Y co-ordinate that has been set with surface.SetTextPos or changed by surface.DrawText.","realm":"Client and Menu","added":"2023.06.28","rets":{"ret":[{"text":"The X integer co-ordinate.","name":"x","type":"number"},{"text":"The Y integer co-ordinate.","name":"y","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTextSize","parent":"surface","type":"libraryfunc","description":{"text":"Returns the width and height (in pixels) of the given text with the font that has been set with surface.SetFont.","note":"Takes into account new lines, the returned height is for the entire text, but surface.DrawText does not!"},"realm":"Client and Menu","args":{"arg":{"text":"The string to check the size of.","name":"text","type":"string"}},"rets":{"ret":[{"text":"Width of the provided text.","name":"","type":"number"},{"text":"Height of the provided text.","name":"","type":"number"}]}},"example":[{"description":"Prints out the size of `Hello World` in the Trebuchet24 font.","code":"surface.SetFont( \"Trebuchet24\" )\n\nlocal text = \"Hello World\"\nlocal width, height = surface.GetTextSize( text )\n\nprint(\"Text width: \" .. width .. \", text height: \" .. height)","output":"```\nText width: 100, text height: 24\n```"},{"description":"Get text height very quickly. No tables or spare variables used.","code":"surface.SetFont( \"Trebuchet24\" )\n\nlocal text = \"Hello World\"\nlocal height = select( 2, surface.GetTextSize( text ) )\n\nprint( height )","output":"```\n24\n```"}],"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTextureID","parent":"surface","type":"libraryfunc","description":{"text":"Returns the texture id of the material with the given name/path, for use with surface.SetTexture.\n\nOpposite version of this function is surface.GetTextureNameByID.","note":"This function will not work with .png or .jpg images. For that, see Global.Material. You will probably want to use it regardless."},"realm":"Client and Menu","args":{"arg":{"text":"Name or path of the texture. The path must be to a `.vmt` file (a material), not to `.vtf` (a texture)!","name":"name/path","type":"string"}},"rets":{"ret":{"text":"The texture ID","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTextureNameByID","parent":"surface","type":"libraryfunc","description":"Returns name/path of texture by ID. Opposite version of this function is surface.GetTextureID.","realm":"Client and Menu","added":"2023.01.25","args":{"arg":{"text":"ID of texture.","name":"id","type":"number"}},"rets":{"ret":{"text":"Returns name/path of texture.","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTextureSize","parent":"surface","type":"libraryfunc","description":"Returns the size of the texture with the associated texture ID.\n\nFor `.png/.jpg` textures loaded with Global.Material you can use the `$realheight` and `$realwidth` material parameters (IMaterial:GetInt) to get the size of the image.","realm":"Client and Menu","args":{"arg":{"text":"The texture ID, returned by surface.GetTextureID.","name":"textureID","type":"number"}},"rets":{"ret":[{"text":"The texture width.","name":"","type":"number"},{"text":"The texture height.","name":"","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PlaySound","parent":"surface","type":"libraryfunc","description":{"text":"Play a sound file directly on the client (such as UI sounds, etc).","note":"Valid sample rates: **11025 Hz, 22050 Hz and 44100 Hz**, otherwise you may see this kind of message:\n\n`Unsupported 32-bit wave file your_sound.wav` and \n`Invalid sample rate (48000) for sound 'your_sound.wav'`"},"realm":"Client and Menu","args":{"arg":{"text":"The path to the sound file.\n\nThis should either be a sound script name (sound.Add) or a file path relative to the `sound/` folder. (Make note that it's not sound**s**)","name":"soundfile","type":"string"}}},"example":{"description":"Plays a sound with a given name. The game will look for the file in following places in that order:\n* garrysmod/addons/myaddon/sound/`mysound.wav`\n* garrysmod/gamemodes/mygamemode/content/sound/`mysound.wav`\n* garrysmod/sound/`mysound.wav`","code":"surface.PlaySound( \"mysound.wav\" )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ScreenHeight","parent":"surface","type":"libraryfunc","description":{"text":"Returns the height of the current client's screen.","deprecated":"You should use Global.ScrH instead."},"realm":"Client and Menu","rets":{"ret":{"text":"screenHeight","name":"","type":"number"}}},"example":{"description":"Prints out the current height of the screen.","code":"MsgN(\"Screen height: \" .. surface.ScreenHeight())","output":"Screen height: 1080"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ScreenWidth","parent":"surface","type":"libraryfunc","description":{"text":"Returns the width of the current client's screen.","deprecated":"You should use Global.ScrW instead."},"realm":"Client and Menu","rets":{"ret":{"text":"screenWidth","name":"","type":"number"}}},"example":{"description":"Prints out the current width of the screen.","code":"MsgN(\"Screen width: \" .. surface.ScreenWidth())","output":"Screen width: 1920"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetAlphaMultiplier","parent":"surface","type":"libraryfunc","description":"Sets the alpha multiplier that will influence all upcoming drawing operations.\nSee also render.SetBlend.","realm":"Client and Menu","args":{"arg":{"text":"The multiplier ranging from 0 to 1.","name":"multiplier","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDrawColor","parent":"surface","type":"libraryfunc","description":{"text":"Set the color of any future shapes to be drawn, can be set by either using R, G, B, A as separate values or by a Color.","note":["The alpha value may not work properly if you're using a material without `$vertexalpha`.","Due to post processing and gamma correction the color you set with this function may appear differently when rendered. This problem does not occur on materials drawn with surface.DrawTexturedRect."]},"realm":"Client and Menu","args":[{"arg":[{"text":"The red value of color.","name":"r","type":"number"},{"text":"The green value of color.","name":"g","type":"number"},{"text":"The blue value of color.","name":"b","type":"number"},{"text":"The alpha value of color.","name":"a","type":"number","default":"255"}]},{"name":"Use color object","arg":{"text":"A Color object/table to read the color from. This is slower than providing four numbers. You could use Color:Unpack to address this. You should also cache your color objects if you wish to use them, for performance reasons.","name":"color","type":"Color"}}]},"example":{"description":"Draws a 512x512 textured rectangle with the wireframe material.","code":"local myMaterial = Material( \"models/wireframe\" ) -- Calling Material() every frame is quite expensive\n\nhook.Add( \"HUDPaint\", \"example_hook\", function()\n\tsurface.SetDrawColor( 255, 0, 0 ) -- Set the color to red\n\tsurface.SetMaterial( myMaterial ) -- If you use Material, cache it!\n\tsurface.DrawTexturedRect( 0, 0, 512, 512 )\nend )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetFont","parent":"surface","type":"libraryfunc","description":"Set the current font to be used for text operations later.\n\nThe fonts must first be created with surface.CreateFont or be one of the Default Fonts.","realm":"Client and Menu","args":{"arg":{"text":"The name of the font to use.","name":"fontName","type":"string"}}},"example":{"description":"Draws 'Hello World' on the screen, with the 'Default' font.","code":"hook.Add( \"HUDPaint\", \"HUDPaint_DrawABox\", function()\n\tsurface.SetDrawColor( 0, 0, 0, 128 ) -- Set color for background\n\tsurface.DrawRect( 100, 100, 128, 20 ) -- Draw background\n\n\tsurface.SetTextColor( 255, 255, 255 ) -- Set text color\n\tsurface.SetTextPos( 136, 104 ) -- Set text position, top left corner\n\tsurface.SetFont( \"Default\" ) -- Set the font\n\tsurface.DrawText( \"Hello World\" ) -- Draw the text\nend )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMaterial","parent":"surface","type":"libraryfunc","description":{"text":"Sets the material to be used in all upcoming draw operations using the surface library.\n\nNot to be confused with render.SetMaterial.\n\nIf you need to unset the texture, use the draw.NoTexture convenience function.","warning":"Global.Material function calls are expensive to be done inside this function or inside rendering context, you should be caching the results of Global.Material calls"},"realm":"Client and Menu","args":{"arg":{"text":"The material to be used.","name":"material","type":"IMaterial","note":"When using render.PushRenderTarget or render.SetRenderTarget, the material should have the `$ignorez` flag set to make it visible. If the material is not used in 3D rendering, it is probably safe to add it with this code:\n```lua\nmaterial:SetInt( \"$flags\", bit.bor( material:GetInt( \"$flags\" ), 32768 ) )\n```\n\nIf using Global.Material, simply use the `ignorez` parameter."}}},"example":{"description":"Example usage of this function in conjunction with Material. Note how the Material function will only be called once and its output is cached for performance.\n\nIn this example the `.png` file is located in `materials/gui/ContentIcon-normal.png`.","code":"local wave = Material( \"gui/ContentIcon-normal.png\", \"noclamp smooth\" )\n\nhook.Add( \"HUDPaint\", \"HUDPaint_DrawATexturedBox\", function()\n\tsurface.SetMaterial( wave )\n\tsurface.SetDrawColor( color_white )\n\tsurface.DrawTexturedRect( 50, 50, 128, 128 )\nend )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTextColor","parent":"surface","type":"libraryfunc","description":"Set the color of any future text to be drawn, can be set by either using R, G, B, A as separate numbers or by providing a Color.","realm":"Client and Menu","args":[{"arg":[{"text":"The red value of color.","name":"r","type":"number"},{"text":"The green value of color","name":"g","type":"number"},{"text":"The blue value of color","name":"b","type":"number"},{"text":"The alpha value of color","name":"a","type":"number","default":"255"}]},{"name":"Use color object","arg":{"text":"A Color object/table to read the color from. This is slower than providing four numbers. You could use Color:Unpack to address this. You should also cache your color objects if you wish to use them, for performance reasons.","name":"color","type":"Color"}}]},"example":{"description":"Draws 'Hello World', in white, near the top left of the screen.","code":"hook.Add( \"HUDPaint\", \"HUDPaint_DrawABox\", function()\n\tsurface.SetDrawColor( 0, 0, 0, 128 ) -- Set color for background\n\tsurface.DrawRect( 100, 100, 128, 20 ) -- Draw background\n\n\tsurface.SetTextColor( 255, 255, 255 ) -- Set text color\n\tsurface.SetTextPos( 136, 104 ) -- Set text position, top left corner\n\tsurface.SetFont( \"Default\" ) -- Set the font\n\tsurface.DrawText( \"Hello World\" ) -- Draw the text\nend )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTextPos","parent":"surface","type":"libraryfunc","description":"Set the top-left position to draw any future text at.","realm":"Client and Menu","args":{"arg":[{"text":"The X integer co-ordinate.","name":"x","type":"number"},{"text":"The Y integer co-ordinate.","name":"y","type":"number"}]}},"example":{"description":"Draws 'Hello World' on the screen, around top-left of the screen.","code":"hook.Add( \"HUDPaint\", \"HUDPaint_DrawABox\", function()\n\tsurface.SetDrawColor( 0, 0, 0, 128 ) -- Set color for background\n\tsurface.DrawRect( 100, 100, 128, 20 ) -- Draw background\n\n\tsurface.SetTextColor( 255, 255, 255 ) -- Set text color\n\tsurface.SetTextPos( 136, 104 ) -- Set text position, top left corner\n\tsurface.SetFont( \"Default\" ) -- Set the font\n\tsurface.DrawText( \"Hello World\" ) -- Draw the text\nend )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTexture","parent":"surface","type":"libraryfunc","description":"Sets the texture to be used in all upcoming draw operations using the surface library.\n\nThis is a legacy method, and should probably not be used, see surface.SetMaterial and IMaterial for a better alternative.","realm":"Client and Menu","args":{"arg":{"text":"The ID of the texture to draw with returned by surface.GetTextureID.","name":"textureID","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AppTime","parent":"system","type":"libraryfunc","description":{"text":"Returns the total uptime of the current application as reported by Steam.\n\nThis will return a similar value to Global.SysTime.","note":"This function does not work on Dedicated Servers and will instead return no value."},"realm":"Shared and Menu","rets":{"ret":{"text":"Seconds of game uptime as an integer.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"BatteryPower","parent":"system","type":"libraryfunc","description":"Returns the current battery power.","realm":"Shared and Menu","rets":{"ret":{"text":"0-100 if a battery (laptop, UPS, etc) is present.\n\nWill instead return 255 if plugged in without a battery.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"FlashWindow","parent":"system","type":"libraryfunc","description":"Flashes the window, turning the border to white briefly","realm":"Client and Menu"},"warning":"Currently works only on Windows.","realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetCountry","parent":"system","type":"libraryfunc","description":{"text":"Returns the country code of this computer, determined by the IP of the client. Uses the steamworks API function `SteamUtils()->GetIPCountry()`.","note":"This function does not work on Dedicated Servers and will instead return no value."},"realm":"Shared and Menu","rets":{"ret":{"text":"Two-letter country code, using [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) standard.","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"HasFocus","parent":"system","type":"libraryfunc","description":{"text":"Returns whether or not the game window has focus.","note":"This function does not work on dedicated servers and will instead return no value."},"realm":"Shared and Menu","rets":{"ret":{"text":"Whether or not the game window has focus.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsLinux","parent":"system","type":"libraryfunc","description":"Returns whether the current OS is Linux.","realm":"Shared and Menu","rets":{"ret":{"text":"Whether or not the game is running on Linux.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsOSX","parent":"system","type":"libraryfunc","description":"Returns whether the current OS is OSX.","realm":"Shared and Menu","rets":{"ret":{"text":"Whether or not the game is running on OSX.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsWindowed","parent":"system","type":"libraryfunc","description":{"text":"Returns whether the game is being run in a window or in fullscreen (you can change this by opening the menu, clicking 'Options', then clicking the 'Video' tab, and changing the Display Mode using the dropdown menu):","image":{"src":"DisplayModeDropdown.jpeg"}},"realm":"Client and Menu","info":"Returns true if the game is currently running windowed, false if it is fullscreen.","rets":{"ret":{"text":"Is the game running in a window?","name":"","type":"boolean"}}},"example":{"description":"If the game is windowed, then the game window will flash","code":"if system.IsWindowed() then\n\tsystem.FlashWindow()\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsWindows","parent":"system","type":"libraryfunc","description":"Returns whether the current OS is Windows.","realm":"Shared and Menu","rets":{"ret":{"text":"Whether the system the game runs on is Windows or not.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SteamTime","parent":"system","type":"libraryfunc","description":{"text":"Returns the synchronized Steam time. This is the number of seconds since the [Unix epoch](http://en.wikipedia.org/wiki/Unix_time).","note":"This function does not work on Dedicated Servers and will instead return no value."},"realm":"Shared and Menu","rets":{"ret":{"text":"Current Steam-synchronized Unix time.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"UpTime","parent":"system","type":"libraryfunc","description":{"text":"Returns the amount of seconds since the Steam user last moved their mouse.\n\nThis is a direct binding to ISteamUtils->GetSecondsSinceComputerActive, and is most likely related to Steam's automatic \"Away\" online status.","note":"This function does not work on Dedicated Servers and will instead return no value."},"realm":"Shared and Menu","rets":{"ret":{"text":"The amount of seconds since the Steam user last moved their mouse.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Add","parent":"table","type":"libraryfunc","description":"Adds all values from `source` table into the `target` table. This is most useful for sequential tables, not \"dictionary\" or \"map\" tables. See table.Merge if you want to merge 2 tables into one.\n\nSee table.insert for a function that adds a single value, and table.Inherit for a function that inherits keys from one table to another.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"116-L129"},"args":{"arg":[{"text":"The table to insert the new values into.","name":"target","type":"table"},{"text":"The table to retrieve the values from.","name":"source","type":"table"}]},"rets":{"ret":{"text":"The target table.","name":"","type":"table"}}},"example":{"description":"Demonstrates the use of this function. Note that duplicate values will be added.","code":"local Test1 = {\"One\",\"Two\",\"Three\", \"Four\"}\nlocal Test2 = {\"Four\", \"Five\", \"Six\"}\ntable.Add( Test1, Test2 )\nprint( table.concat(Test1, \" \") )","output":"```One Two Three Four Four Five Six```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ClearKeys","parent":"table","type":"libraryfunc","description":"Changes all keys to sequential integers. This creates a new table object and does not affect the original.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"501-L514"},"args":{"arg":[{"text":"The original table to modify.","name":"table","type":"table"},{"text":"Save the keys within each member table. This will insert a new field `__key` into each value, and should not be used if the table contains non-table values.","name":"saveKeys","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"Table with integer keys.","name":"","type":"table"}}},"example":[{"description":"Changes all the table's keys to integer values","code":"local Table = {One = \"A\", Two = \"B\", Three = \"C\"}\nlocal Table2 = table.ClearKeys(Table)\nPrintTable(Table2)","output":"1 = A\n\n\n2 = C\n\n\n3 = B"},{"description":"Clears a table of its keys, and preserves the old key names within each member.","code":"local tbl = {\n\tFirstMember = { Name = \"John Smith\", Age  = 25 },\n\tSecondMember = { Name = \"Jane Doe\", Age = 42 },\n\tThirdMember = { Name = \"Joe Bloggs\", Age = 39 }\n}\nprint( \"===== Before =====\" )\nPrintTable( tbl )\nlocal tbl2 = table.ClearKeys( tbl, true )\nprint( \"===== After =====\" )\nPrintTable( tbl2 )","output":"```\n===== Before =====\nFirstMember:\n\t\tName\t=\tJohn Smith\n\t\tAge\t=\t25\nSecondMember:\n\t\tName\t=\tJane Doe\n\t\tAge\t=\t42\nThirdMember:\n\t\tName\t=\tJoe Bloggs\n\t\tAge\t=\t39\n===== After =====\n1:\n\t\tAge\t=\t25\n\t\tName\t=\tJohn Smith\n\t\t__key\t=\tFirstMember\n2:\n\t\tAge\t=\t39\n\t\tName\t=\tJoe Bloggs\n\t\t__key\t=\tThirdMember\n3:\n\t\tAge\t=\t42\n\t\tName\t=\tJane Doe\n\t\t__key\t=\tSecondMember\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"CollapseKeyValue","parent":"table","type":"libraryfunc","description":"Collapses a table with keyvalue structure","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"477-L495"},"args":{"arg":{"text":"Input table","name":"input","type":"table"}},"rets":{"ret":{"text":"Output table","name":"","type":"table"}}},"example":{"description":"Example usage","code":"local output = table.CollapseKeyValue( {\n\t{ Key = \"mykey1\", Value = \"myvalue1\" },\n\t{ Key = 123, Value = 1345 },\n\t{ Key = 1345, Value = \"myvalue1\" },\n} )","output":"```\nlocal output = {\n\t[ \"mykey1\" ] = \"myvalue1\",\n\t[ 123 ] = 1345,\n\t[ 1345 ] = \"myvalue1\",\n}\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"concat","parent":"table","type":"libraryfunc","description":"Concatenates the contents of a table to a string.","realm":"Shared and Menu","args":{"arg":[{"text":"The table to concatenate.","name":"tbl","type":"table"},{"text":"A separator to insert between strings","name":"concatenator","type":"string","default":"\\"},{"text":"The key to start at","name":"startPos","type":"number","default":"1"},{"text":"The key to end at","name":"endPos","type":"number","default":"#tbl"}]},"rets":{"ret":{"text":"Concatenated values","name":"","type":"string"}}},"example":{"description":"Demonstrates the use of this function.","code":"local Table = { \"A\", \"simple\", \"table.concat\", \"test\" }\nprint( table.concat( Table ) )\nprint( table.concat( Table, \" \" ) )\nprint( table.concat( Table, \" \", 3, 4 ) )","output":"```\nAsimpletable.concattest\nA simple table.concat test\ntable.concat test\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Copy","parent":"table","type":"libraryfunc","description":{"text":"Creates a deep copy and returns that copy.","warning":["This function is very slow! If you know the table structure, it is better to write your own copying mechanism","This function does NOT copy userdata, such as Vectors and Angles!"]},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"22-L47"},"args":{"arg":{"text":"The table to be copied.","name":"originalTable","type":"table"}},"rets":{"ret":{"text":"A deep copy of the original table","name":"","type":"table"}}},"example":{"description":"Creates a deep copy of table Fruit","code":"local Fruit = {\"Orange\", \"Apple\", \"Banana\"}\nlocal FruitCopy = table.Copy(Fruit)\n\nPrintTable(FruitCopy)","output":"```\n1\tOrange\n2\tApple\n3\tBanana\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"CopyFromTo","parent":"table","type":"libraryfunc","description":"Empties the target table, and merges all values from the source table into it.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"71-L79"},"args":{"arg":[{"text":"The table to copy from.","name":"source","type":"table"},{"text":"The table to write to.","name":"target","type":"table"}]}},"example":{"description":"Demonstrates the use of this function.","code":"local Test1 = {A = \"String keys\", B = \"Table 1\"}\nlocal Test2 = {\"Numeric keys\", \"Table 2\"}\ntable.CopyFromTo( Test2, Test1 )\nPrintTable( Test1 )","output":"```\n1 = Numeric keys\n2 = Table 2\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Count","parent":"table","type":"libraryfunc","description":"Counts the amount of keys in a table. This should only be used when a table is not numerically and sequentially indexed. For those tables, consider the length (**#**) operator.\n\nIf you only want to test if the table is empty or not, use table.IsEmpty instead as it is a lot faster.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"158-L166"},"args":{"arg":{"text":"The table to count the keys of.","name":"tbl","type":"table"}},"rets":{"ret":{"text":"The number of keyvalue pairs. This includes non-numeric and non-sequential keys, unlike the length (**#**) operator.","name":"","type":"number"}}},"example":[{"description":"There are 4 keys in this table. So it will output \"4\"","code":"local Table = { A = \"1\", B = \"2\", C = \"3\", D = \"4\" }\n\nprint( table.Count( Table ) )","output":"```\n4\n```"},{"description":"Difference between the length (**#**) operator and this function.\n\nThe length (**#**) operator is generally considered faster, but has limitations.","code":"local Table = { A = \"1\", B = \"2\", C = \"3\", D = \"4\" }\n\nprint( table.Count( Table ), #Table ) -- #Table will return 0 because the table contains no numeric keys\n\nlocal Table2 = { \"test1\", \"test2\", \"test3\" } -- 1 = \"test1\", 2 = \"test2\"\n\nprint( table.Count( Table2 ), #Table2 ) -- Both will be 3\n\nTable2[ 5 ] = \"test5\" -- Insert a new value at index 5, so index 4 does not exist\n\n-- table.Count here will return correct value, #Table2 will return 3 because\n-- the new value is non sequential ( there is nothing at index 4 )\nprint( table.Count( Table2 ), #Table2 )","output":"```\n4 0\n3 3\n4 3\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"DeSanitise","parent":"table","type":"libraryfunc","description":"Converts a table that has been sanitised with table.Sanitise back to its original form","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"346-L393"},"args":{"arg":{"text":"Table to be de-sanitised","name":"tbl","type":"table"}},"rets":{"ret":{"text":"De-sanitised table","name":"","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Empty","parent":"table","type":"libraryfunc","description":"Removes all values from a table. If your table is not a metatable, it is almost always better to use `tab = {}` to preserve performance.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"53-L57"},"args":{"arg":{"text":"The table to empty.","name":"tbl","type":"table"}}},"example":{"description":"Demonstrates the use of this function.","code":"local Table = {\"String Value\", \"Another value\", Var = \"Non-integer key\"}\ntable.Empty(Table)\nprint( table.Count(Table) )","output":"0"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"FindNext","parent":"table","type":"libraryfunc","description":{"text":"Returns the value positioned after the supplied value in a table. If it isn't found then the first element in the table is returned","deprecated":"Instead, iterate the table using ipairs or increment from the previous index using Global.next. Non-numerically indexed tables are not ordered."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"659-L667"},"args":{"arg":[{"text":"Table to search","name":"tbl","type":"table"},{"text":"Value to return element after","name":"value","type":"any"}]},"rets":{"ret":{"text":"Found element","name":"","type":"any"}}},"example":{"description":"Print the next element after the \"b\" value of the table","code":"local tbl = {\"a\", \"b\", \"c\"}\n\nprint(table.FindNext(tbl, \"b\"))","output":"c in console"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"FindPrev","parent":"table","type":"libraryfunc","description":{"text":"Returns the value positioned before the supplied value in a table. If it isn't found then the last element in the table is returned","deprecated":"Instead, iterate your table with ipairs, storing the previous value and checking for the target. Non-numerically indexed tables are not ordered."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"669-L679"},"args":{"arg":[{"text":"Table to search","name":"tbl","type":"table"},{"text":"Value to return element before","name":"value","type":"any"}]},"rets":{"ret":{"text":"Found element","name":"","type":"any"}}},"example":{"description":"Print the previous item the value \"b\" of the table","code":"local tbl = {\"a\", \"b\", \"c\"}\n\nprint(table.FindPrev(tbl, \"b\"))","output":"a in console"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Flip","parent":"table","type":"libraryfunc","description":{"text":"Flips key-value pairs of each element within a table, so that each value becomes the key, and each key becomes the value.","warning":"Take care when using this function, as a Lua table cannot contain multiple instances of the same key. As such, data loss is possible when using this function on tables with duplicate values.\n\n```\nlocal test = { test = 1, test2 = 1 }\nlocal f = table.Flip( test )\nPrintTable( f )\n-- Outputs \"1\t=\ttest2\"\n```"},"realm":"Shared and Menu","added":"2023.08.08","file":{"text":"lua/includes/extensions/table.lua","line":"766-L776"},"args":{"arg":{"text":"The table to flip items of.","name":"input","type":"table"}},"rets":{"ret":{"text":"The flipped table.","name":"","type":"table"}}},"example":{"code":"local productIngredients = { \"Cocoa Mass\", \"Cocoa Butter\", \"Vanilla\", \"Cocoa Solids: 70% min\" }\n\nlocal flipped = table.Flip( productIngredients )\n \nPrintTable( flipped )","output":"```\nCocoa Butter\t=\t2\nCocoa Mass\t=\t1\nCocoa Solids: 70% min\t=\t4\nVanilla\t=\t3\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ForceInsert","parent":"table","type":"libraryfunc","description":"Inserts a value in to the given table even if the table is non-existent","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"393-L401"},"args":{"arg":[{"text":"Table to insert value in to","name":"tab","type":"table","default":"{}"},{"text":"Value to insert","name":"value","type":"any"}]},"rets":{"ret":{"text":"The supplied or created table","name":"","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ForEach","parent":"table","type":"libraryfunc","description":{"text":"Iterates for each key-value pair in the table, calling the function with the key and value of the pair. If the function returns anything, the loop is broken.\n\nThe GLua interpretation of this is table.ForEach.","deprecated":"This was deprecated in Lua 5.1 and removed in 5.2. You should use Global.pairs instead."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"747-L753"},"args":{"arg":[{"text":"The table to iterate over.","name":"tbl","type":"table"},{"text":"The function to run for each key and value.","name":"callback","type":"function","callback":{"arg":[{"text":"The key of a key-value pair for this iteration.","name":"key","type":"any"},{"text":"The value of a key-value pair for this iteration.","name":"val","type":"any"}]}}]}},"example":[{"description":"Demonstrates the use of this function.","code":"local food = { \"Cake\", \"Pies\", Delicious = \"Cookies\", Awesome = \"Pizza\" }\n\ntable.foreach( food, function( key, value )\n\tprint( tostring(key) .. \" \" .. value)\nend)","output":"```\n1 Cake\n2 Pies\nAwesome Pizza\nDelicious Cookies\n```"},{"description":"Demonstrates the breaking effect if the callback returns a value.","code":"local tbl = { \"One\", \"Two\", \"Three\", \"Four\" }\n\ntable.foreach( tbl, function( key, value )\n\tprint( key, value )\n\tif key == 2 then return true end\nend)","output":"```\n1    One\n2    Two\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"foreachi","parent":"table","type":"libraryfunc","description":{"text":"Iterates for each numeric index in the table in order.\n\nThis is inherited from the original Lua implementation and is deprecated in Lua as of 5.1; see [here](http://lua-users.org/wiki/TableLibraryTutorial). You should use Global.ipairs() instead.","deprecated":"This was deprecated in Lua 5.1 and removed in 5.2. You should use Global.ipairs() instead."},"realm":"Shared and Menu","args":{"arg":[{"text":"The table to iterate over.","name":"table","type":"table"},{"text":"The function to run for each index.","name":"func","type":"function"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetFirstKey","parent":"table","type":"libraryfunc","description":{"text":"Returns the first key found in the given table","deprecated":"Instead, expect the first key to be 1.\n\nNon-numerically indexed tables are not ordered and do not have a first key."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"636-L642"},"args":{"arg":{"text":"Table to retrieve key from","name":"tab","type":"table"}},"rets":{"ret":{"text":"Key","name":"","type":"any"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetFirstValue","parent":"table","type":"libraryfunc","description":{"text":"Returns the first value found in the given table","deprecated":"Instead, index the table with a key of 1.\n\nNon-numerically indexed tables are not ordered and do not have a first key."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"644-L647"},"args":{"arg":{"text":"Table to retrieve value from","name":"tab","type":"table"}},"rets":{"ret":{"text":"Value","name":"","type":"any"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetKeys","parent":"table","type":"libraryfunc","description":"Returns all keys of a table.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"755-L767"},"args":{"arg":{"text":"The table to get keys of","name":"tabl","type":"table"}},"rets":{"ret":{"text":"Table of keys","name":"","type":"table"}}},"example":{"description":"Example usage","code":"local tabl = {\none = \"A\",\ntwo = \"B\",\n}\nPrintTable( table.GetKeys( tabl ) )","output":"```\n1\t=\tone\n2\t=\ttwo\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetLastKey","parent":"table","type":"libraryfunc","description":{"text":"Returns the last key found in the given table","deprecated":"Instead, use the result of the length (#) operator, ensuring it is not zero. Non-numerically indexed tables are not ordered and do not have a last key."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"649-L652"},"args":{"arg":{"text":"Table to retrieve key from","name":"tab","type":"table"}},"rets":{"ret":{"text":"Key","name":"","type":"any"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetLastValue","parent":"table","type":"libraryfunc","description":{"text":"Returns the last value found in the given table","deprecated":"Instead, index the table with the result of the length (#) operator, ensuring it is not zero. Non-numerically indexed tables are not ordered and do not have a last key."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"651-L654"},"args":{"arg":{"text":"Table to retrieve value from","name":"tab","type":"table"}},"rets":{"ret":{"text":"Value","name":"","type":"any"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"getn","parent":"table","type":"libraryfunc","description":{"text":"Returns the length of the table.","deprecated":"This function was deprecated in Lua 5.1 and is removed in 5.2. Use the length (#) operator instead."},"realm":"Shared and Menu","args":{"arg":{"text":"The table to check.","name":"tbl","type":"table"}},"rets":{"ret":{"text":"Sequential length.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetWinningKey","parent":"table","type":"libraryfunc","description":"Returns a key of the supplied table with the highest number value.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"678-L692"},"args":{"arg":{"text":"The table to search in.","name":"inputTable","type":"table"}},"rets":{"ret":{"text":"winningKey","name":"","type":"any"}}},"example":[{"description":"Code that looks up the most favourite fruit from a table where the fruit's name is the key, and it's number value determines how much favourite it is (the higher value, the better).","code":"favouriteFruit = { banana = 4, strawberry = 4, blueberry = 2, apple = 6 }\nprint(table.GetWinningKey(favouriteFruit))","output":"apple"},{"description":"A code that demonstrates a situation where there are two keys with the same value in the supplied table. String keys in the table represent the fruit name, and their number values determine how favourite it is (the higher value, the better).","code":"favouriteFruit = { apple = 1, banana = 7, strawberry = 3, blueberry = 7 }\nprint(table.GetWinningKey(favouriteFruit))","output":"banana"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"HasValue","parent":"table","type":"libraryfunc","description":{"text":"Checks if a table has a value.","warning":"This function is **very inefficient for large tables** (O(n)) and should probably not be called in things that run each frame. Instead, consider a table structure such as example 2 below. Also see: Tables: Bad Habits","note":"For optimization, functions that look for a value by sorting the table should never be needed if you work on a table that you built yourself."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"105-L110"},"args":{"arg":[{"text":"Table to check","name":"tbl","type":"table"},{"text":"Value to search for","name":"value","type":"any"}]},"rets":{"ret":{"text":"Returns true if the table has that value, false otherwise","name":"","type":"boolean"}}},"example":[{"description":"Creates a table with values \"123\" and \"test\" and checks to see it the table holds value \"apple\"","code":"local mytable = {\"123\", \"test\"}\nprint(table.HasValue(mytable, \"apple\"), table.HasValue(mytable, \"test\"))","output":"false\ttrue"},{"description":"Example usage of O(1) associative array structure","code":"local mytable = { [\"123\"] = true, test = true }\nprint(mytable[\"apple\"], mytable[\"test\"])","output":"nil\ttrue"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Inherit","parent":"table","type":"libraryfunc","description":{"text":"Copies any missing data from `base` to `target`, and sets the `target`'s `BaseClass` member to the `base` table's pointer.\n\nSee table.Merge, which overrides existing values and doesn't add a BaseClass member.\n\n\nSee also table.Add, which simply adds values of one table to another.","bug":{"text":"Sub-tables aren't inherited. The target's table value will take priority.","pull":"1304"}},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"10-L20"},"args":{"arg":[{"text":"Table to copy data to","name":"target","type":"table"},{"text":"Table to copy data from","name":"base","type":"table"}]},"rets":{"ret":{"text":"Target","name":"","type":"table"}}},"example":{"description":"Example of how this function works.","code":"local table1 = { \"A\", \"Golden\" }\nlocal table2 = { \"Two\", \"Orange\", \"Apple\" }\ntable.Inherit( table1, table2 )\nPrintTable( table1 )","output":"```\n1\t=\tA\n2\t=\tGolden\n3\t=\tApple\nBaseClass:\n\t\t1\t=\tTwo\n\t\t2\t=\tOrange\n\t\t3\t=\tApple\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"insert","parent":"table","type":"libraryfunc","description":{"text":"Inserts a value into a table at the end of the table or at the given position.","note":"This function does not call the `__newindex` [metamethod](Metamethods)."},"realm":"Shared and Menu","args":{"arg":[{"text":"The table to insert the variable into.","name":"tbl","type":"table"},{"text":"The position in the table to insert the variable. If the third argument is nil this argument becomes the value to insert at the end of given table.","name":"position","type":"number"},{"text":"The variable to insert into the table.","name":"value","type":"any"}]},"rets":{"ret":{"text":"The index the object was placed at.","name":"","type":"number"}}},"example":{"description":"Demonstrates the use of this function.","code":"sentence = { \"hello\", \"there\", \"my\", \"name\", \"is\", \"drakehawke\" }\ntable.insert( sentence, \"lol\" )\ntable.insert( sentence, 6, \"not\" )\n\nPrintTable( sentence )","output":"```\n1\t=\thello\n2\t=\tthere\n3\t=\tmy\n4\t=\tname\n5\t=\tis\n6\t=\tnot\n7\t=\tdrakehawke\n8\t=\tlol\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsEmpty","parent":"table","type":"libraryfunc","description":"Returns whether or not the given table is empty.\n\nThis works on both sequential and non-sequential tables, and is a lot faster for non-sequential tables than `table.Count(tbl) == 0`.\n\nFor sequential tables it is better to use `tab[1] == nil`.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"63-L65"},"args":{"arg":{"text":"Table to check.","name":"tab","type":"table"}},"rets":{"ret":{"text":"Is empty?","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsSequential","parent":"table","type":"libraryfunc","description":"Returns whether or not the table's keys are sequential","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"196-L203"},"args":{"arg":{"text":"Table to check","name":"tab","type":"table"}},"rets":{"ret":{"text":"Is sequential","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"KeyFromValue","parent":"table","type":"libraryfunc","description":"Returns the first key found to be containing the supplied value","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"697-L701"},"args":{"arg":[{"text":"Table to search","name":"tab","type":"table"},{"text":"Value to search for","name":"value","type":"any"}]},"rets":{"ret":{"text":"Key","name":"","type":"any"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"KeysFromValue","parent":"table","type":"libraryfunc","description":"Returns a table of keys containing the supplied value","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"715-L621"},"args":{"arg":[{"text":"Table to search","name":"tab","type":"table"},{"text":"Value to search for","name":"value","type":"any"}]},"rets":{"ret":{"text":"Keys","name":"","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"LowerKeyNames","parent":"table","type":"libraryfunc","description":"Returns a copy of the input table with all string keys converted to be lowercase recursively","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"445-L469"},"args":{"arg":{"text":"Table to convert","name":"tbl","type":"table"}},"rets":{"ret":{"text":"New table","name":"","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"maxn","parent":"table","type":"libraryfunc","description":"Returns the highest numerical key.","realm":"Shared and Menu","args":{"arg":{"text":"The table to search.","name":"tbl","type":"table"}},"rets":{"ret":{"text":"The highest numerical key.","name":"","type":"number"}}},"example":{"description":"Demonstrates how this differs from the **#** operator.","code":"local tbl = {\"One\", \"Two\", [6] = \"Six\", [42] = \"Answer to life, the universe, and everything\"}\n\nPrintTable(tbl)\nprint(\"\\n\" .. #tbl)\nprint(table.maxn(tbl))","output":"```\n1\t=\tOne\n2\t=\tTwo\n6\t=\tSix\n42\t=\tAnswer to life, the universe, and everything\n\n2\n42\n```\n\nWhereas the length operator (**#**) returns the highest `sequential` index, this returns the value of the highest `numeric` index."},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"MemberValuesFromKey","parent":"table","type":"libraryfunc","description":"Returns an array of values of given with given key from each table of given table.\n\nSee also table.KeysFromValue.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"723-L729"},"added":"2021.12.15","args":{"arg":[{"text":"The table to search in.","name":"inputTable","type":"table"},{"text":"The key to lookup.","name":"keyName","type":"any"}]},"rets":{"ret":{"text":"A list of found values, or an empty table.","name":"","type":"table"}}},"example":{"code":"PrintTable( table.MemberValuesFromKey( engine.GetAddons(), \"wsid\" ) )","output":"```\n1\t=\t1524511793\n2\t=\t242776816\n3\t=\t1452613192\n4\t=\t196980498\n5\t=\t210637861\n6\t=\t180495527\n7\t=\t708804738\n8\t=\t603034140\n9\t=\t526098847\n10\t=\t457478322\n11\t=\t497881072\n12\t=\t635999365\n...\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Merge","parent":"table","type":"libraryfunc","description":{"text":"Recursively merges the key-value pairs of the `source` table with the key-value pairs in the `destination` table.\n\nSee table.Inherit, which doesn't override existing values.\n\n\nSee also table.Add, which simply adds values of one table to another.","note":"This function can cause a stack overflow under certain circumstances."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"85-L99"},"args":{"arg":[{"text":"The table you want the source table to merge with.","name":"destination","type":"table"},{"text":"The table you want to merge with the destination table.","name":"source","type":"table"},{"text":"If `true`, does not recursively merge sub-tables, and simply replaces them.","name":"forceOverride","type":"boolean","added":"2023.11.28","default":"false"}]},"rets":{"ret":{"text":"Destination table","name":"","type":"table"}}},"example":{"description":"\"Merges\" the content of the second table with the first one, overwriting any matching key/value pairs in the destination with the source's version and prints the resulting merge.","code":"local destination = {[1] = \"A\", [2] = \"Golden\", [3] = \"Apple\"}\nlocal source = {[1] = \"Two\", [2] = \"Orange\"}\ntable.Merge( destination, source )\nPrintTable( destination )","output":"```\n1\t=\tTwo\n2\t=\tOrange\n3\t=\tApple\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"move","parent":"table","type":"libraryfunc","description":"Moves elements from one part of a table to another part a given table. This is similar to assigning elements from the source table to the destination table in multiple assignments.","realm":"Shared and Menu","added":"2023.11.28","file":{"text":"lua/includes/extensions/table.lua","line":"781-L802"},"args":{"arg":[{"text":"The source table from which the elements are to be moved.","name":"sourceTbl","type":"table"},{"text":"The start index of the source range from which the elements are to be moved.","name":"from","type":"number"},{"text":"The end index of the source range until which the elements are to be moved.","name":"to","type":"number"},{"text":"The index within the destination table where the moved elements should be inserted.","name":"dest","type":"number"},{"text":"The destination table to which the elements are to be moved. By default, this is the same as the source table.","name":"destTbl","type":"table","default":"sourceTbl"}]},"rets":{"ret":{"text":"The modified destination table.","name":"","type":"table"}}},"example":{"description":"Example of the this can be used.","code":"local source = { \"a\", \"b\", \"c\", \"d\", \"e\" }\nlocal dest = { \"f\", \"g\", \"h\", \"i\", \"j\" }\n\ntable.move( source, 3, 5, 1, dest )\n\nPrintTable( source )\nprint( \"\\n\" )\nPrintTable( dest )","output":"```\n1\t=\ta\n2\t=\tb\n3\t=\tc\n4\t=\td\n5\t=\te\n\n\n1\t=\tc\n2\t=\td\n3\t=\te\n4\t=\ti\n5\t=\tj\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Pack","parent":"table","type":"libraryfunc","description":"Packs a set of items into a table and returns the new table. It is meant as an alternative implementation of `table.pack` from newer versions of Lua.","realm":"Shared and Menu","added":"2023.08.08","file":{"text":"lua/includes/extensions/table.lua","line":"2-L4"},"args":{"arg":{"text":"The items to pack into a table.","name":"items","type":"vararg"}},"rets":{"ret":[{"text":"A table containing the `items`.","name":"","type":"table"},{"text":"The amount of items that were added to the table.","name":"","type":"number"}]}},"example":{"code":"local productID =  234 \nlocal productName = \"Dark Chocolate\"\nlocal productIngredients = { \"Cocoa Mass\", \"Cocoa Butter\", \"Vanilla\", \"Cocoa Solids: 70% min\" }\n\nlocal darkChocolateTable = table.Pack( productID, productName, productIngredients )\n \nPrintTable( darkChocolateTable )","output":"```\n1\t=\t234\n2\t=\tDark Chocolate\n3:\n\t\t1\t=\tCocoa Mass\n\t\t2\t=\tCocoa Butter\n\t\t3\t=\tVanilla\n\t\t4\t=\tCocoa Solids: 70% min\n\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Random","parent":"table","type":"libraryfunc","description":{"text":"Returns a random value from the supplied table.","warning":"This function iterates over the given table **twice**, therefore with sequential tables you should instead use following:\n\n```\nmytable[ math.random( #mytable ) ]\n```"},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"172-L179"},"args":{"arg":{"text":"The table to choose from.","name":"haystack","type":"table"}},"rets":{"ret":[{"text":"A random value from the table.","name":"","type":"any"},{"text":"The key associated with the random value.","name":"","type":"any"}]}},"example":[{"description":"A simple example of this function using two tables.","code":"local color = { \"green\", \"red\", \"blue\", \"yellow\" }\nlocal object = { \"car\", \"house\", \"bike\" }\n\nprint( \"I have a \" .. table.Random( color ) .. \" \" .. table.Random( object ) .. \".\" )","output":"I have a green house."},{"description":"Example of using the alternative with sequential tables for performance reasons.","code":"local websites = {\"facepunch.com\", \"google.com\", \"steampowered.com\"}\nprint(\"I think the best website ever is \" .. websites[math.random(1, #websites)] .. \".\")","output":"I think the best website ever is google.com."}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"remove","parent":"table","type":"libraryfunc","description":{"text":"Removes a value from a table and shifts any other values down to fill the gap.","note":"Does nothing if index is less than 1 or greater than `#tbl`"},"realm":"Shared and Menu","args":{"arg":[{"text":"The table to remove the value from.","name":"tbl","type":"table"},{"text":"The index of the value to remove.","name":"index","type":"number","default":"#tbl"}]},"rets":{"ret":{"text":"The value that was removed.","name":"","type":"any"}}},"example":{"description":"Demonstrates the use of this function.","code":"sentence = { \"hello\", \"there\", \"my\", \"name\", \"is\", \"Player1\" }\nprint( table.remove( sentence ) ) -- Using no second arg removes the last value\nprint( table.remove( sentence, 2 ) )\nPrintTable( sentence )","output":"```\nPlayer1\nthere\n1 = hello\n2 = my\n3 = name\n4 = is\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"RemoveByValue","parent":"table","type":"libraryfunc","description":{"text":"Removes the first instance of a given value from the specified table with table.remove, then returns the key that the value was found at.","warning":"Avoid usage of this function. It does not remove all instances of given value in the table, only the first found, and it does not work with non sequential tables!"},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"700-L713"},"args":{"arg":[{"text":"The table that will be searched.","name":"tbl","type":"table"},{"text":"The value to find within the table.","name":"val","type":"any"}]},"rets":{"ret":{"text":"The key at which the value was found, or false if the value was not found.","name":"","type":"any"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Reverse","parent":"table","type":"libraryfunc","description":"Returns a reversed copy of a sequential table. Any non-sequential and non-numeric keyvalue pairs will not be copied.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"731-L742"},"args":{"arg":{"text":"Table to reverse.","name":"tbl","type":"table"}},"rets":{"ret":{"text":"A reversed copy of the table.","name":"","type":"table"}}},"example":{"description":"Creates a table and reverses it.","code":"local tbl = { \"One\", \"Two\", \"Three\", four = 4, [5] = \"5\" }\n\nPrintTable(tbl)\nprint(\"\")\nPrintTable(table.Reverse(tbl))","output":"```\n1\t=\tOne\n2\t=\tTwo\n3\t=\tThree\nfour\t=\t4\n5\t=\t5\n\n1\t=\tThree\n2\t=\tTwo\n3\t=\tOne\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Sanitise","parent":"table","type":"libraryfunc","description":"Converts Vectors, Angles and booleans to be able to be converted to and from key-values via util.TableToKeyValues.\n\ntable.DeSanitise performs the opposite transformation.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"284-L338"},"args":{"arg":{"text":"Table to sanitise","name":"tab","type":"table"}},"rets":{"ret":{"text":"Sanitised table","name":"","type":"table"}}},"example":{"description":"Example of what this function does.","code":"local table1 = { \"A\", \"Golden\", Angle( 1, 2, 3 ), Vector( 1, 2, 3 ) }\n\nPrintTable( table.Sanitise( table1 ) )","output":"```\n1\t=\tA\n2\t=\tGolden\n3:\n\t\t__type\t=\tAngle\n\t\tp\t=\t1\n\t\tr\t=\t3\n\t\ty\t=\t2\n4:\n\t\t__type\t=\tVector\n\t\tx\t=\t1\n\t\ty\t=\t2\n\t\tz\t=\t3\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Shuffle","parent":"table","type":"libraryfunc","description":"Performs an inline [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle) on the table in `O(n)` time","realm":"Shared and Menu","added":"2021.12.15","file":{"text":"lua/includes/extensions/table.lua","line":"185-L191"},"args":{"arg":{"text":"The table to shuffle.","name":"target","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"sort","parent":"table","type":"libraryfunc","description":{"text":"Sorts a sequential table either ascending or by the given sort function.","note":"This function modifies the table you give to it and internally uses the [quick sort algorithm](http://www.lua.org/source/5.2/ltablib.c.html#sort)."},"realm":"Shared and Menu","args":{"arg":[{"text":"The table to sort.","name":"tbl","type":"table"},{"text":"If specified, the sorting function.","name":"sorter","type":"function","default":"nil","callback":{"arg":[{"text":"Item A to test.","name":"a","type":"any"},{"text":"Item B to test.","name":"b","type":"any"}],"ret":{"text":"Result of the comparison. Return true in this function if you want the first parameter to come first in the sorted array.","name":"result","type":"boolean"}}}]}},"example":[{"description":"Sorting table by an integer","code":"local tbl = {\n\t{ \"Jeff\", 8 },\n\t{ \"Peter\", 17 },\n\t{ \"Shay\", 11 },\n\t{ \"Janine\", 1 }\n}\n\ntable.sort( tbl, function(a, b) return a[2] > b[2] end )","output":"Table going from highest number to lowest (1: Peter, 2: Shay, 3: Jeff, 4: Janine)"},{"description":"Sorting a player table by a NWInt","code":"local plys = player.GetAll()\n\ntable.sort( plys, function(a, b) return a:GetNWInt(\"Score\") > b:GetNWInt(\"Score\") end )","output":"Player table sorted by score going from highest to lowest"},{"description":"Sort the table by string keys. We cannot sort non-numeric keys in `ages`, because they are contained in a hash part whose order is undefined.","code":"local ages = {\n    [ \"Jeff\" ] = 8,\n    [ \"Peter\" ] = 17,\n    [ \"Shay\" ] = 11,\n    [ \"Janine\" ] = 1,\n}\n\nlocal names = table.GetKeys( ages )\ntable.sort( names )\nfor _, name in ipairs( names ) do\n    print( name, ages[ name ] )\nend","output":"Janine  1\nJeff    8\nPeter   17\nShay    11"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SortByKey","parent":"table","type":"libraryfunc","description":"Returns a list of keys sorted based on values of those keys.\n\nFor normal sorting see table.sort.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"141-L154"},"args":{"arg":[{"text":"Table to sort. All values of this table must be of same type.","name":"tab","type":"table"},{"text":"Should the order be descending?","name":"descending","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"A table of keys sorted by values from supplied table.","name":"","type":"table"}}},"example":{"description":"Example usage of the function.","code":"local t = {}\nt['h'] = 2 -- Lowest value\nt['a'] = 150 -- Highest value\nt['x'] = 30\n\nPrintTable( table.SortByKey( t ) )\nPrintTable( table.SortByKey( t , true ) )","output":"```\n1 = a\n2 = x\n3 = h\n```\n\n\n\n```\n1 = h\n2 = x\n3 = a\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SortByMember","parent":"table","type":"libraryfunc","description":"Sorts a table by a named member.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"407-L439"},"args":{"arg":[{"text":"Table to sort.","name":"tab","type":"table"},{"text":"The key used to identify the member.","name":"memberKey","type":"any"},{"text":"Whether or not the order should be ascending.","name":"ascending","type":"boolean","default":"false"}]}},"example":{"description":"Orders a table by a member and prints it.","code":"local tab = {\n    { Name = \"Bill\", Age = 13 },\n    { Name = \"Jill\", Age = 14 },\n    { Name = \"Phil\", Age = 8 }\n}\n\ntable.SortByMember( tab, \"Age\" )\n\nfor _, v in ipairs( tab ) do\n    print( v.Name )\nend","output":"Jill\nBill\nPhil"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SortDesc","parent":"table","type":"libraryfunc","description":{"text":"Sorts a table in reverse order from table.sort.","note":"This function modifies the table you give to it. Like table.sort, it does not return anything."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"133-L135"},"args":{"arg":{"text":"The table to sort in descending order.","name":"tbl","type":"table"}}},"example":{"description":"","code":"local tbl = {\n    20,\n    10,\n    50,\n    30,\n    40,\n}\n\ntable.SortDesc(tbl)\nPrintTable(tbl)","output":"```\n1\t=\t50\n2\t=\t40\n3\t=\t30\n4\t=\t20\n5\t=\t10\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ToString","parent":"table","type":"libraryfunc","description":"Converts a table into a string","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/table.lua","line":"271-L278"},"args":{"arg":[{"text":"The table to iterate over.","name":"tbl","type":"table"},{"text":"A name for the table.","name":"displayName","type":"string","default":"nil"},{"text":"Adds new lines and tabs to the string.","name":"niceFormatting","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"The table formatted as a string.","name":"","type":"string"}}},"example":{"description":"Demonstrates the use of this function.","code":"local Table = { Red = \"Apple\", Green = \"Celery\", Yellow = \"Banana\"}\nlocal String = table.ToString( Table, \"Fruit and Vegetable\", true )\nprint( String )","output":"```\nFruit and Vegetable\t=\t{\n\t\tRed\t=\t\"Apple\",\n\t\tGreen\t=\t\"Celery\",\n\t\tYellow\t=\t\"Banana\",\n}\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"AddScore","parent":"team","type":"libraryfunc","description":"Increases the score of the given team","file":{"text":"lua/includes/modules/team.lua","line":"184-L188"},"realm":"Shared","args":{"arg":[{"text":"Index of the team","name":"index","type":"number"},{"text":"Amount to increase the team's score by","name":"increment","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"BestAutoJoinTeam","parent":"team","type":"libraryfunc","description":"Returns the team index of the team with the least players. Falls back to TEAM_UNASSIGNED","file":{"text":"lua/includes/modules/team.lua","line":"190-L211"},"realm":"Shared","rets":{"ret":{"text":"Team index","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAllTeams","parent":"team","type":"libraryfunc","description":"Returns the real table consisting of information on every defined team","file":{"text":"lua/includes/modules/team.lua","line":"34-L38"},"realm":"Shared","rets":{"ret":{"text":"Team info","name":"","type":"table"}}},"example":{"description":"Prints all Jobs/Teams on the server. The list in printed from lowest to highest. Information about join able to the player, the score of the team and the colors.","code":"PrintTable( team.GetAllTeams() )","output":"```\n0:\n\t\tColor:\n\t\t\t\ta\t=\t255\n\t\t\t\tb\t=\t100\n\t\t\t\tg\t=\t255\n\t\t\t\tr\t=\t255\n\t\tJoinable\t=\tfalse\n\t\tName\t=\tJoining/Connecting\n\t\tScore\t=\t0\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetClass","parent":"team","type":"libraryfunc","description":"Returns the selectable classes for the given team. This can be added to with team.SetClass","file":{"text":"lua/includes/modules/team.lua","line":"98-L103"},"realm":"Shared","args":{"arg":{"text":"Index of the team","name":"index","type":"number"}},"rets":{"ret":{"text":"Selectable classes","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetColor","parent":"team","type":"libraryfunc","description":"Returns the team's color.","file":{"text":"lua/includes/modules/team.lua","line":"171-L176"},"realm":"Shared","args":{"arg":{"text":"The team index.","name":"teamIndex","type":"number"}},"rets":{"ret":{"text":"The team's color as a Color.","name":"","type":"Color"}}},"example":{"description":"( Clientside Example ) Draws a box with the LocalPlayer team's color in the top left corner of the screen.","code":"hook.Add( \"HUDPaint\", \"WikiTeamGetColorExample\", function()\n\tsurface.SetDrawColor( team.GetColor( LocalPlayer():Team() ) )\n\tsurface.DrawRect( 0, 0, 150, 150 )\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetName","parent":"team","type":"libraryfunc","description":"Returns the name of the team.","file":{"text":"lua/includes/modules/team.lua","line":"155-L160"},"realm":"Shared","args":{"arg":{"text":"The team index.","name":"teamIndex","type":"number"}},"rets":{"ret":{"text":"The team name. If the team is not defined, returns an empty string.","name":"","type":"string"}}},"example":{"description":"Returns the teams name as a string.","code":"print(team.GetName(Entity(1):Team()))"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPlayers","parent":"team","type":"libraryfunc","description":{"text":"Returns a table with all player of the specified team.","note":"This function returns a sequential table, meaning it should be looped with Global.ipairs instead of Global.pairs for efficiency reasons."},"file":{"text":"lua/includes/modules/team.lua","line":"135-L147"},"realm":"Shared","args":{"arg":{"text":"The team index.","name":"teamIndex","type":"number"}},"rets":{"ret":{"text":"A sequential table of Players that belong to the requested team.","name":"","type":"table"}}},"example":[{"description":"Prints all the players in a player's team.","code":"PrintTable(team.GetPlayers(ply:Team()))","output":"List of players."},{"description":"Heals all the players in a player's team.","code":"for _, teammate in ipairs(team.GetPlayers(ply:Team())) do\n   \tteammate:SetHealth(teammate:GetMaxHealth())\nend"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetScore","parent":"team","type":"libraryfunc","description":"Returns the score of the team.","file":{"text":"lua/includes/modules/team.lua","line":"149-L153"},"realm":"Shared","args":{"arg":{"text":"The team index.","name":"teamIndex","type":"number"}},"rets":{"ret":{"text":"score","name":"","type":"number"}}},"example":{"description":"Get's the teams score, can be a number 1 or 2 depending on how many teams you've set up.","code":"print(team.GetScore(ply:Team()),team.GetScore(1))","output":"1"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSpawnPoint","parent":"team","type":"libraryfunc","description":"Returns a table of valid spawnpoint classes the team can use. These are set with team.SetSpawnPoint.","file":{"text":"lua/includes/modules/team.lua","line":"54-L59"},"realm":"Shared","args":{"arg":{"text":"Index of the team","name":"index","type":"number"}},"rets":{"ret":{"text":"Valid spawnpoint classes","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSpawnPoints","parent":"team","type":"libraryfunc","description":"Returns a table of valid spawnpoint entities the team can use. These are set with  team.SetSpawnPoint.","file":{"text":"lua/includes/modules/team.lua","line":"61-L78"},"realm":"Shared","args":{"arg":{"text":"Index of the team","name":"index","type":"number"}},"rets":{"ret":{"text":"Valid spawnpoint entities","name":"","type":"table"}}},"example":{"description":"Prints a random spawnpoint entity for TEAM_RED","code":"print(table.Random(team.GetSpawnPoints(TEAM_RED)))","output":"Spawnpoint Entity"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Joinable","parent":"team","type":"libraryfunc","description":"Returns if a team is joinable or not. This is set in team.SetUp.","file":{"text":"lua/includes/modules/team.lua","line":"47-L52"},"realm":"Shared","args":{"arg":{"text":"The index of the team.","name":"index","type":"number"}},"rets":{"ret":{"text":"True if the team is joinable. False otherwise.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"NumPlayers","parent":"team","type":"libraryfunc","description":"Returns the amount of players in a team.","file":{"text":"lua/includes/modules/team.lua","line":"129-L133"},"realm":"Shared","args":{"arg":{"text":"The team index.","name":"teamIndex","type":"number"}},"rets":{"ret":{"text":"playerCount","name":"","type":"number"}}},"example":{"description":"Prints the amount of players in a player's team","code":"print(team.NumPlayers(ply:Team()))","output":"The number of players in ply's team."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetClass","parent":"team","type":"libraryfunc","description":"Sets valid classes for use by a team. Classes can be created using player_manager.RegisterClass","file":{"text":"lua/includes/modules/team.lua","line":"89-L96"},"realm":"Shared","args":{"arg":[{"text":"Index of the team","name":"index","type":"number"},{"text":"A class ID or table of class IDs","name":"classes","type":"any"}]}},"example":{"description":"Allows TEAM_RED to access the \"Soldier\" class","code":"team.SetClass( TEAM_RED, {\"Soldier\"} )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetColor","parent":"team","type":"libraryfunc","description":"Sets the team's color.","file":{"text":"lua/includes/modules/team.lua","line":"162-L169"},"realm":"Shared","args":{"arg":[{"text":"The team index.","name":"teamIndex","type":"number"},{"text":"The team's new color as a Color.","name":"color","type":"Color"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetScore","parent":"team","type":"libraryfunc","description":"Sets the score of the given team","file":{"text":"lua/includes/modules/team.lua","line":"178-L182"},"realm":"Shared","args":{"arg":[{"text":"Index of the team","name":"index","type":"number"},{"text":"The team's new score","name":"score","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetSpawnPoint","parent":"team","type":"libraryfunc","description":{"text":"Sets valid spawnpoint classes for use by a team.","note":"GM.TeamBased must be set to true for this to work"},"file":{"text":"lua/includes/modules/team.lua","line":"80-L87"},"realm":"Shared","args":{"arg":[{"text":"Index of the team","name":"index","type":"number"},{"text":"A spawnpoint classname or table of spawnpoint classnames","name":"classes","type":"any"}]}},"example":{"description":"Allows TEAM_BLUE to spawn at terrorist spawn points","code":"team.SetSpawnPoint( TEAM_BLUE, {\"info_player_terrorist\"} )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetUp","parent":"team","type":"libraryfunc","description":"Creates a new team. See GM:CreateTeams for the hook to call this in.","file":{"text":"lua/includes/modules/team.lua","line":"25-L31"},"realm":"Shared","args":{"arg":[{"text":"The team index.","name":"teamIndex","type":"number"},{"text":"The team name.","name":"teamName","type":"string"},{"text":"The team color. Uses the Color.","name":"teamColor","type":"Color"},{"text":"Whether the team is joinable or not.","name":"isJoinable","type":"boolean","default":"true"}]}},"example":{"description":"Create team 2 with name `Mingebags` and color red","code":"team.SetUp(2, \"Mingebags\", Color(255, 0, 0))"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"TotalDeaths","parent":"team","type":"libraryfunc","description":"Returns the total number of deaths of all players in the team.","file":{"text":"lua/includes/modules/team.lua","line":"105-L115"},"realm":"Shared","args":{"arg":{"text":"The team index.","name":"index","type":"number"}},"rets":{"ret":{"text":"Total deaths in team.","name":"","type":"number"}}},"example":{"description":"Outputs the name and total deaths of all existing teams.","code":"for k, v in ipairs( team.GetAllTeams() ) do\n\tprint( v.Name, team.TotalDeaths( k ) )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"TotalFrags","parent":"team","type":"libraryfunc","description":"Get's the total frags in a team.","file":{"text":"lua/includes/modules/team.lua","line":"117-L127"},"realm":"Shared","args":{"arg":{"text":"Entity or number.","name":"Entity or number","type":"Entity"}},"rets":{"ret":{"text":"index","name":"","type":"number"}}},"example":{"description":"Get's the total frags in a team.","code":"print(team.TotalFrags(ply:Team()),team.TotalFrags(1))","output":"1"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Valid","parent":"team","type":"libraryfunc","description":"Returns true if the given team index is valid","file":{"text":"lua/includes/modules/team.lua","line":"40-L45"},"realm":"Shared","args":{"arg":{"text":"Index of the team","name":"index","type":"number"}},"rets":{"ret":{"text":"Is valid","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Adjust","parent":"timer","type":"libraryfunc","description":"Adjusts a previously created (timer.Create) timer with the given identifier.","realm":"Shared and Menu","args":{"arg":[{"text":"Identifier of the timer to adjust.","name":"identifier","type":"any"},{"text":"The delay interval in seconds. **Must be specified.**","name":"delay","type":"number"},{"text":"Repetitions. Use `0` for infinite or `nil` to keep previous value.","name":"repetitions","type":"number","default":"nil"},{"text":"The new function. Use `nil` to keep previous value.","name":"func","type":"function","default":"nil"}]},"rets":{"ret":{"text":"`true` if succeeded.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Check","parent":"timer","type":"libraryfunc","description":{"text":"This function does nothing.","deprecated":"If you want to check if whether or not a timer exists, use timer.Exists."},"realm":"Shared and Menu"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Create","parent":"timer","type":"libraryfunc","description":{"text":"Creates a new timer that will repeat its function given amount of times.\nThis function also requires the timer to be named, which allows you to control it after it was created via the timer.\n\nFor a simple one-time timer with no identifiers, see timer.Simple.","warning":"Timers use Global.CurTime internally. Due to this, they won't advance while the client is timing out from the server or on an empty dedicated server due to hibernation. (unless `sv_hibernate_think` is set to `1` or `delay` is set to `0` )."},"realm":"Shared and Menu","args":{"arg":[{"text":"Identifier of the timer to create. Must be unique. If a timer already exists with the same identifier, that timer will be updated to the new settings and reset.","name":"identifier","type":"string"},{"text":"The delay interval in seconds. If the delay is too small, the timer will fire on the next GM:Tick.","name":"delay","type":"number"},{"text":"The number of times to repeat the timer. Enter `0` or any value below `0` for infinite repetitions.","name":"repetitions","type":"number"},{"text":"Function called when timer has finished the countdown.","name":"func","type":"function"}]}},"example":[{"description":"Creates a timer that has a 1 second delay and is only ran once (`UniqueName1`), a timer that has a 2 second delay and is ran continuously (`UniqueName2`), etc.\n\nThis shows the different ways you can interact with functions.","code":"local function PrintSomething( text )\n\tprint( text )\nend\n\nlocal function PrintNoArguments()\n\tprint( \"fun with timers!\" )\nend\n\nlocal function CreateSomeTimers( )\n\ttimer.Create( \"UniqueName1\", 1, 1, function() print( \"inside\" ) end )\n\ttimer.Create( \"UniqueName2\", 2, 0, function() PrintSomething( \"outside\" ) end )\n\ttimer.Create( \"UniqueName3\", 5, 1, PrintNoArguments )\nend\nhook.Add( \"Initialize\", \"Timer Example\", CreateSomeTimers )","output":"```\ninside -- 1 second\n\noutside -- 2 seconds\n\noutside -- 4 seconds\n\nfun with timers! -- 5 seconds\n\noutside -- 6 seconds\n\noutside -- 8 seconds\n```"},{"description":"Creates a timer that has 0.01 second delay, to demonstrate that the \"minimum\" delay of a timer is locked at the tickrate period (1/66 seconds).\n\nAs the example below shows, by setting the delay rate to 1/100 (0.01 seconds), the difference in time between the iterations of the timer should be 0.01 seconds, but instead, it is 0.0149 (1/66) seconds.","code":"local tick = {} \nlocal tick_key = 1 \n\nlocal function MinimumTimerDelay()\n\tlocal current_time = CurTime()\n\n\tif tick_key > 1 then\n\t\tprint( \"Timer Iteration #\" .. tick_key - 1 .. \" had a delay of \" .. current_time - tick[ tick_key - 1 ] )\n\tend\n\n\ttick[ tick_key ] = current_time\n\ttick_key = tick_key + 1\nend\n\nlocal function Timer()\n\ttimer.Create( \"Timer Delay\", ( 1 / 100 ), 10, MinimumTimerDelay ) \nend\n\nhook.Add( \"Initialize\", \"Commence Timers\", Timer )","output":"```\nTimer Iteration #1 had a delay of 0.014999389648438\n\nTimer Iteration #2 had a delay of 0.014999389648438\n\nTimer Iteration #3 had a delay of 0.014999389648438\n\nTimer Iteration #4 had a delay of 0.0150146484375\n\nTimer Iteration #5 had a delay of 0.014999389648438\n\nTimer Iteration #6 had a delay of 0.014999389648438\n\nTimer Iteration #7 had a delay of 0.014999389648438\n\nTimer Iteration #8 had a delay of 0.014999389648438\n\nTimer Iteration #9 had a delay of 0.014999389648438\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Destroy","parent":"timer","type":"libraryfunc","description":{"text":"Stops and destroys the given timer. Alias of timer.Remove.","deprecated":"You should be using timer.Remove instead."},"realm":"Shared and Menu","args":{"arg":{"text":"Identifier of the timer to destroy.","name":"identifier","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Exists","parent":"timer","type":"libraryfunc","description":"Returns whenever the given timer exists or not.\n\nFor debugging purposes you can use the following commands:\n* `lua_dumptimers_cl`\n* `lua_dumptimers_sv`\n* `lua_dumptimers_menu`\n\nThese will list all active timers in each realm.","realm":"Shared and Menu","args":{"arg":{"text":"Identifier of the timer.","name":"identifier","type":"string"}},"rets":{"ret":{"text":"Returns true if the timer exists, false if it doesn't","name":"","type":"boolean"}}},"example":{"description":"Checks it the timer exists","code":"if ( timer.Exists( \"TimerName\" ) ) then\n\n\t-- The timer exists\n\tprint( \"The timer exists\" )\n\t\nelse\n\t-- The timer doesn't exist\n\tprint( \"The timer does not exist!\" )\n\n\t-- Create a timer\n\ttimer.Create( \"TimerName\", 1, 0, function() print( \"I'm a Timer\" ) end)\nend","output":"```\nThe timer does not exist!\nI'm a Timer\nI'm a Timer\nI'm a Timer\nI'm a Timer\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsPaused","parent":"timer","type":"libraryfunc","description":"Returns whenever the given timer is paused or not. (timer.Pause)","added":"2026.06.25","realm":"Shared and Menu","args":{"arg":{"text":"Identifier of the timer. (timer.Create)","name":"identifier","type":"string"}},"rets":{"ret":{"text":"Returns true if the timer is paused, false if it isn't, `nil` if it doesn't exist.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Pause","parent":"timer","type":"libraryfunc","description":"Pauses the given timer.","realm":"Shared and Menu","args":{"arg":{"text":"Identifier of the timer.","name":"identifier","type":"any"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Remove","parent":"timer","type":"libraryfunc","description":{"text":"Stops and removes a timer created by timer.Create.","warning":"The timers are removed in the next frame! Keep this in mind when storing identifiers in variables."},"realm":"Shared and Menu","args":{"arg":{"text":"Identifier of the timer to remove.","name":"identifier","type":"string"}}},"example":{"description":"Creates a timer and then removes it","code":"-- create timer\ntimer.Create( \"UniqueName1\", 5, 1, function() print(\"inside\") end )\n\n-- remove timer\ntimer.Remove( \"UniqueName1\" )"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"RepsLeft","parent":"timer","type":"libraryfunc","description":"Returns amount of repetitions/executions left before the timer destroys itself.","realm":"Shared and Menu","args":{"arg":{"text":"Identifier of the timer.","name":"identifier","type":"any"}},"rets":{"ret":{"text":"The amount of executions left.","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Simple","parent":"timer","type":"libraryfunc","description":{"text":"Creates a simple timer that runs the given function after a specified delay.\n\nFor a more advanced version that you can control after creation, see timer.Create.","warning":["Timers use Global.CurTime internally. Due to this, they won't advance while the client is timing out from the server or on an empty dedicated server due to hibernation. (unless `sv_hibernate_think` is set to `1`).","A previous message on this page stated that a delay of 0 would run the function on the next tick. This was partially an invalid assumption, and the true behavior is dependent on where `timer.Simple(0, func)` is called relative to `GarrysMod::Lua::Libraries::Timer::DoSimpleTimers`.\n\n\n\n- If called *before* `DoSimpleTimers`, the callback will be executed on the same frame.\n\n- If called *during* `DoSimpleTimers`, the callback will be executed on the same frame. **Note that calling timer.Simple(0, func) recursively (ie. a function that calls **`timer.simple(0, itself)`**) can lead to a hang!**\n\n- If called *after* `DoSimpleTimers`, the callback will be executed on the next frame.\n\nFor more information on hook execution order, see Lua Hooks Order.\n\nAs of a commit on [2026.1.5](https://commits.facepunch.com/574654), simple timers are queued to the next frame.\n\nAs of a commit on [2026.1.8](https://commits.facepunch.com/575132), only timers with the same callback function are queued to the next frame. [Source](https://github.com/Facepunch/garrysmod-issues/issues/6668#issuecomment-3725044829)"]},"realm":"Shared and Menu","args":{"arg":[{"text":"How long until the function should be ran (in seconds). A value of `0` differs in behavior, depending on where you're calling this function.","name":"delay","type":"number"},{"text":"The function to run after the specified delay.","name":"func","type":"function"}]}},"example":[{"description":"Print `Hello World` after 5 seconds.","code":"timer.Simple( 5, function() print( \"Hello World\" ) end )","output":"```\nHello World\n```"},{"description":"Spawns 5 zombies and creates a timer.Simple that removes them in 11, 12, 13, 14, and 15 seconds.","code":"for i = 1, 5 do\n\tlocal zombie = ents.Create( \"npc_zombie\" )\n\tzombie:SetPos( Vector( i * 40, 0, 250 ) )\n\tzombie:Spawn()\n\n\ttimer.Simple( 10 + i, function() \n\t\tif !IsValid( zombie ) then return end\n\n\t\tzombie:Remove()\n\t\t-- essentially you could skip doing manual validations by doing SafeRemoveEntity(zombie)\n\tend )\nend","output":"```\n-- 11 seconds into game 1st zombie disappears\n\n-- 12 seconds into game 2nd zombie disappears\n\netc.\n```"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Start","parent":"timer","type":"libraryfunc","description":{"text":"Restarts the given timer.","warning":"Timers won't advance while the client is timing out from the server."},"realm":"Shared and Menu","args":{"arg":{"text":"Identifier of the timer.","name":"identifier","type":"any"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Stop","parent":"timer","type":"libraryfunc","description":"Stops the given timer and rewinds it.","realm":"Shared and Menu","args":{"arg":{"text":"Identifier of the timer.","name":"identifier","type":"any"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"TimeLeft","parent":"timer","type":"libraryfunc","description":{"text":"Returns amount of time left (in seconds) before the timer executes its function.","note":"If the timer is paused, the amount will be negative."},"realm":"Shared and Menu","args":{"arg":{"text":"Identifier of the timer.","name":"identifier","type":"any"}},"rets":{"ret":{"text":"The amount of time left (in seconds).","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Toggle","parent":"timer","type":"libraryfunc","description":"Runs either timer.Pause or timer.UnPause based on the timer's current status.","realm":"Shared and Menu","args":{"arg":{"text":"Identifier of the timer.","name":"identifier","type":"any"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"UnPause","parent":"timer","type":"libraryfunc","description":"Unpauses the timer.","realm":"Shared and Menu","args":{"arg":{"text":"Identifier of the timer.","name":"identifier","type":"any"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Angle","parent":"umsg","type":"libraryfunc","description":{"text":"Writes an angle to the usermessage.","deprecated":"You should be using the net instead"},"realm":"Server","args":{"arg":{"text":"The angle to be sent.","name":"angle","type":"Angle"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Bool","parent":"umsg","type":"libraryfunc","description":{"text":"Writes a bool to the usermessage.","deprecated":"You should be using the net instead"},"realm":"Server","args":{"arg":{"text":"The bool to be sent.","name":"bool","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Char","parent":"umsg","type":"libraryfunc","description":{"text":"Writes a signed char to the usermessage.","deprecated":"You should be using the net instead"},"realm":"Server","args":{"arg":{"text":"The char to be sent.","name":"char","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"End","parent":"umsg","type":"libraryfunc","description":{"text":"Dispatches the usermessage to the client(s).","deprecated":"You should be using the net instead"},"realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"Entity","parent":"umsg","type":"libraryfunc","description":{"text":"Writes an entity object to the usermessage. (As an entity handle, which means the entity index + its serial number)","deprecated":"You should be using the net instead"},"realm":"Server","args":{"arg":{"text":"The entity to be sent.","name":"entity","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Float","parent":"umsg","type":"libraryfunc","description":{"text":"Writes a float to the usermessage.","deprecated":"You should be using the net instead"},"realm":"Server","args":{"arg":{"text":"The float to be sent.","name":"float","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Long","parent":"umsg","type":"libraryfunc","description":{"text":"Writes a signed int (32 bit) to the usermessage.","deprecated":"You should be using the net instead"},"realm":"Server","args":{"arg":{"text":"The int to be sent.","name":"int","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PoolString","parent":"umsg","type":"libraryfunc","description":{"text":"The string specified will be networked to the client and receive a identifying number, which will be sent instead of the string to optimize networking.","deprecated":"Inferior version of util.AddNetworkString"},"realm":"Server","args":{"arg":{"text":"The string to be pooled.","name":"string","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Short","parent":"umsg","type":"libraryfunc","description":{"text":"Writes a signed short (16 bit) to the usermessage.","deprecated":"You should be using the net instead"},"realm":"Server","args":{"arg":{"text":"The short to be sent.","name":"short","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Start","parent":"umsg","type":"libraryfunc","description":{"text":"Starts a new usermessage.","deprecated":"You should be using net instead","warning":"Usermessages have a limit of only 256 bytes!"},"realm":"Server","args":{"arg":[{"text":"The name of the message to be sent.","name":"name","type":"string"},{"text":"If passed a player object, it will only be sent to the player, if passed a CRecipientFilter of players, it will be sent to all specified players, if passed `nil` (or another invalid value), the message will be sent to all players.","name":"filter","type":"Player","default":"nil"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"String","parent":"umsg","type":"libraryfunc","description":{"text":"Writes a null terminated string to the usermessage.","deprecated":"You should be using the net instead"},"realm":"Server","args":{"arg":{"text":"The string to be sent.","name":"string","type":"string"}}},"example":{"description":"An easy way to send any string to the client or clients","code":"umsg.Start(\"Example_SendString\") -- With umsg.Start(\"Example_SendString\",pl) Must get pl value the player entity.\n\tumsg.String(\"Custom Text\")\numsg.End()"},"realms":["Server"],"type":"Function"},
{"function":{"name":"Vector","parent":"umsg","type":"libraryfunc","description":{"text":"Writes a Vector to the usermessage.","deprecated":"You should be using the net instead"},"realm":"Server","args":{"arg":{"text":"The vector to be sent.","name":"vector","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"VectorNormal","parent":"umsg","type":"libraryfunc","description":{"text":"Writes a vector normal to the usermessage.","deprecated":"You should be using the net instead"},"realm":"Server","args":{"arg":{"text":"The vector normal to be sent.","name":"normal","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddEntity","parent":"undo","type":"libraryfunc","description":"Adds an entity to the current undo block","realm":"Server","file":{"text":"lua/includes/modules/undo.lua","line":"237-L244"},"args":{"arg":{"text":"The entity to add","name":"ent","type":"Entity"}}},"example":{"description":"This example creates a prop_physics, and adds it to the players undo list.","code":"prop = ents.Create(\"prop_physics\")\nprop:SetModel(\"models/props_junk/wood_crate001a.mdl\")\nprop:Spawn()\n\nundo.Create(\"prop\")\n\tundo.AddEntity(prop)\n\tundo.SetPlayer(Player)\nundo.Finish()"},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddFunction","parent":"undo","type":"libraryfunc","description":"Adds a function to call when the current undo block is undone. Note that if an undo has a function, the player will always be notified when this undo is performed, even if the entity it is meant to undo no longer exists.","realm":"Server","file":{"text":"lua/includes/modules/undo.lua","line":"249-L256"},"args":{"arg":[{"text":"The function to call.","name":"func","type":"function","callback":{"arg":[{"text":"See Undo Structure.","type":"table","name":"undo"},{"text":"What was passed after the function callback argument.","type":"vararg","name":"..."}],"ret":{"text":"Returning `false` will mark execution of this function as \"failed\", meaning that the undo might be skipped if no other entities are removed by it. This is useful when for example an entity you want to access is removed therefore there's nothing to do.","type":"boolean","name":"result","default":"nil"}}},{"text":"Arguments to pass to the function (after the undo info table)","name":"arguments","type":"vararg"}]}},"example":{"description":"This example creates a prop_physics, and adds it to the players undo list. A message will be printed to console about it.","code":"prop = ents.Create(\"prop_physics\")\nprop:SetModel(\"models/props_junk/wood_crate001a.mdl\")\nprop:Spawn()\n\nundo.Create(\"prop\")\n\tundo.AddEntity(prop)\n\tundo.AddFunction(function( tab, arg2 )\n\t\tprint( tab.Owner:GetName() .. \" removed prop \" .. tab.Entities[1]:GetModel() .. \", code: \" .. arg2 )\n\tend, 556 )\n\tundo.SetPlayer(ply)\nundo.Finish()","output":"```\nPlayerName removed prop models/props_junk/wood_crate001a.mdl, code: 556\n```\nwill be printed"},"realms":["Server"],"type":"Function"},
{"function":{"name":"Create","parent":"undo","type":"libraryfunc","description":"Begins a new undo entry","realm":"Server","file":{"text":"lua/includes/modules/undo.lua","line":"213-L221"},"args":{"arg":{"text":"Name of the undo message to show to players","name":"name","type":"string"}}},"example":[{"description":"This example creates a prop_physics, and adds it to Player's undo list.","code":"prop = ents.Create(\"prop_physics\")\nprop:SetModel(\"models/props_junk/wood_crate001a.mdl\")\nprop:Spawn()\nundo.Create(\"prop\")\n undo.AddEntity(prop)\n undo.SetPlayer(Player)\nundo.Finish()"},{"description":"When you need to override the undo messages for a spawnable entity inside [`ENT:SpawnFunction(user, trace)`](https://wiki.facepunch.com/gmod/ENTITY:SpawnFunction) and apply a custom text, calling `undo.Create()` will not work and will in fact double the undo entries in the list pointing to the same entity created. Otherwise you will see `Scripted Entity (entity_class)` when you create it. This is defined in [commands.lua](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/gamemodes/sandbox/gamemode/commands.lua) and you must return `nil`, then add the remaining hooks and function calls to account for the missing stuff:","code":"local prop = ents.Create(\"prop_physics\")\nif ( prop:IsValid() ) then\n  -- This will update your custom undo message by returning `nil`\n  -- Otherwise the undo message will be `Scripted Entity (prop_physics)`\n  undo.Create(\"Test [\"..prop:EntIndex()..\"]\")\n    undo.AddEntity(prop) -- Add out custom prop\n    undo.SetPlayer(user) -- Apply undo for the player\n  undo.Finish() -- Make your custom undo\n\n  gamemode.Call(\"PlayerSpawnedSENT\", user, prop) -- Account for missing hook\n\n  user:AddCount(\"sents\", prop) -- Add to the SENTs count ( ownership )\n  user:AddCount(\"my_props\", prop) -- Add count to our personal count\n  user:AddCleanup(\"sents\", prop) -- Add item to the sents cleanup\n  user:AddCleanup(\"my_props\", prop) -- Add item to the cleanup\nend\n\nreturn nil -- Return nil, so the game will not create undo entry"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"Do_Undo","parent":"undo","type":"libraryfunc","description":"Processes an undo block (in table form). This is used internally by the undo manager when a player presses Z.\n\nYou should use `gmod_undo` or `gmod_undonum *num*` console commands instead of calling this function directly.","realm":"Server","file":{"text":"lua/includes/modules/undo.lua","line":"368-L414"},"args":{"arg":{"text":"The undo block to process as an Structures/Undo","name":"tab","type":"table{Undo}"}},"rets":{"ret":{"text":"Number of removed entities","name":"","type":"number"}}},"example":{"description":"This example removes two entities, and informs player 1 that they just \"Undone Prop!\"","code":"local tab = {}\ntab.Owner = Entity(1)\ntab.Name = \"prop\"\ntab.Entities = {Entity(56),Entity(57)}\nundo.Do_Undo(tab)"},"realms":["Server"],"type":"Function"},
{"function":{"name":"Finish","parent":"undo","type":"libraryfunc","description":"Completes an undo entry, and registers it with the player's client","realm":"Server","file":{"text":"lua/includes/modules/undo.lua","line":"329-L363"},"args":{"arg":{"text":"Text that appears in the player's undo history. If unset, is set to undo's name.","name":"NiceText","type":"string","default":"nil"}}},"example":{"description":"This example creates a prop_physics, and adds it to the players undo list.","code":"local prop = ents.Create( \"prop_physics\" )\nprop:SetModel( \"models/props_junk/wood_crate001a.mdl\" )\nprop:Spawn()\n\nundo.Create( \"prop\" )\n\tundo.AddEntity( prop )\n\tundo.SetPlayer( Player )\nundo.Finish( \"Prop (\" .. prop:GetModel() .. \")\" )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetTable","parent":"undo","type":"libraryfunc","description":{"text":"Serverside, returns a table containing all undo blocks of all players. Clientside, returns a table of the local player's undo blocks.","note":"Serverside, this table's keys use Player:UniqueID to store a player's undo blocks."},"realm":"Shared","file":{"text":"lua/includes/modules/undo.lua","line":"187-L189"},"rets":{"ret":{"text":"The undo table.","name":"","type":"table<table{Undo}>"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"MakeUIDirty","parent":"undo","type":"libraryfunc","description":{"text":"Makes the UI dirty - it will re-create the controls the next time it is viewed.","internal":""},"realm":"Client","file":{"text":"lua/includes/modules/undo.lua","line":"116-L120"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ReplaceEntity","parent":"undo","type":"libraryfunc","description":"Replaces any instance of the \"from\" reference with the \"to\" reference, in any existing undo block.\n\nYou very likely want to call cleanup.ReplaceEntity with the same entities as well.","realm":"Server","file":{"text":"lua/includes/modules/undo.lua","line":"261-L282"},"args":{"arg":[{"text":"The old entity","name":"from","type":"Entity"},{"text":"The new entity to replace the old one. Can also be a `NULL` to remove the entity from the undo system.","name":"to","type":"Entity|nil"}]},"rets":{"ret":{"text":"Whether the entity was replaced","name":"","type":"boolean"}}},"example":{"description":"When an entity is ragdolled, this will replace any instances of the entity with it's ragdoll.","code":"function GM:CreateEntityRagdoll( entity, ragdoll )\n\t// Replace the entity with the ragdoll in cleanups etc\n\tundo.ReplaceEntity( entity, ragdoll )\n\tcleanup.ReplaceEntity( entity, ragdoll )\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetCustomUndoText","parent":"undo","type":"libraryfunc","description":"Sets a custom undo text for the current undo block","realm":"Server","file":{"text":"lua/includes/modules/undo.lua","line":"226-L232"},"args":{"arg":{"text":"The text to display when the undo block is undone","name":"customText","type":"string"}}},"example":{"description":"This example creates a prop_physics, adds it to the players undo list, and sets a custom undo text","code":"local prop = ents.Create( \"prop_physics\" )\nprop:SetModel( \"models/props_junk/wood_crate001a.mdl\" )\nprop:Spawn()\nundo.Create( \"prop\" )\n undo.AddEntity( prop )\n undo.SetPlayer( Player )\n undo.SetCustomUndoText(\"Undone a crate prop\")\nundo.Finish()"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetPlayer","parent":"undo","type":"libraryfunc","description":"Sets the player which the current undo block belongs to","realm":"Server","file":{"text":"lua/includes/modules/undo.lua","line":"288-L295"},"args":{"arg":{"text":"The player responsible for undoing the block","name":"ply","type":"Player"}}},"example":{"description":"This example creates a prop_physics, and adds it to the players undo list.","code":"prop = ents.Create(\"prop_physics\")\nprop:SetModel(\"models/props_junk/wood_crate001a.mdl\")\nprop:Spawn()\nundo.Create(\"prop\")\n undo.AddEntity(prop)\n undo.SetPlayer(ply)\nundo.Finish()"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetupUI","parent":"undo","type":"libraryfunc","description":{"text":"Adds a hook (CPanelPaint) to the control panel paint function so we can determine when it is being drawn.","internal":""},"realm":"Client","file":{"text":"lua/includes/modules/undo.lua","line":"149-L160"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTable","parent":"usermessage","type":"libraryfunc","description":{"text":"Returns a table of every usermessage hook","deprecated":"You should be using net instead"},"realm":"Shared","file":{"text":"lua/includes/modules/usermessage.lua","line":"53-L57"},"rets":{"ret":{"text":"User message hooks","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Hook","parent":"usermessage","type":"libraryfunc","description":{"text":"Sets a hook for the specified to be called when a usermessage with the specified name arrives.","deprecated":"You should be using net instead","warning":"Usermessages have a limit of only 256 bytes!"},"realm":"Shared","file":{"text":"lua/includes/modules/usermessage.lua","line":"63-L70"},"args":{"arg":[{"text":"The message name to hook to.","name":"name","type":"string"},{"text":"The function to be called if the specified message was received.","name":"callback","type":"function","callback":{"arg":[{"text":"The object to read your custom data from.","type":"bf_read","name":"msg"},{"type":"vararg","name":"preArgs"}]}},{"text":"Arguments that are passed to the callback function when the hook is called.","name":"preArgs","type":"vararg","default":"nil"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IncomingMessage","parent":"usermessage","type":"libraryfunc","description":{"text":"Called by the engine when a usermessage arrives, this method calls the hook function specified by usermessage.Hook if any.","internal":""},"realm":"Shared","file":{"text":"lua/includes/modules/usermessage.lua","line":"76-L87"},"args":{"arg":[{"text":"The message name.","name":"name","type":"string"},{"text":"The message.","name":"msg","type":"bf_read"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"charpattern","parent":"utf8","type":"libraryfield","description":"This is NOT a function, it's a pattern (a string, not a function) which matches exactly one UTF-8 byte sequence, assuming that the subject is a valid UTF-8 string.","realm":"Client and Menu","rets":{"ret":{"text":"```\n\"[%z\\x01-\\x7F\\xC2-\\xF4][\\x80-\\xBF]*\"\n```","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"char","parent":"utf8","type":"libraryfunc","description":"Receives zero or more integers, converts each one to its corresponding UTF-8 byte sequence and returns a string with the concatenation of all these sequences.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/utf8.lua","line":"95-L144"},"args":{"arg":{"text":"Unicode code points to be converted in to a UTF-8 string.","name":"codepoints","type":"vararg"}},"rets":{"ret":{"text":"UTF-8 string generated from given arguments.","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"codepoint","parent":"utf8","type":"libraryfunc","description":"Returns the codepoints (as numbers) from all characters in the given string that start between byte position startPos and endPos. It raises an error if it meets any invalid byte sequence. This functions similarly to string.byte.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/utf8.lua","line":"175-L200"},"args":{"arg":[{"text":"The string that you will get the code(s) from.","name":"string","type":"string"},{"text":"The starting byte of the string to get the codepoint of.","name":"startPos","type":"number","default":"1"},{"text":"The ending byte of the string to get the codepoint of.","name":"endPos","type":"number","default":"1"}]},"rets":{"ret":{"text":"The codepoint number(s).","name":"","type":"vararg"}}},"example":{"description":"Demonstrates usage of the function.","code":"print( utf8.codepoint( \"Мёнём\", 1, -1 ) )","output":"1052\t1105\t1085\t1105\t1084"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"codes","parent":"utf8","type":"libraryfunc","description":"Returns an iterator (like string.gmatch) which returns both the position and codepoint of each utf8 character in the string. It raises an error if it meets any invalid byte sequence.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/utf8.lua","line":"146-L173"},"args":{"arg":{"text":"The string that you will get the codes from.","name":"string","type":"string"}},"rets":{"ret":{"text":"The iterator (to be used in a for loop).","name":"","type":"function"}}},"example":[{"description":"Demonstrates usage of the function.","code":"for p, c in utf8.codes(\"( ͡° ͜ʖ ͡°)\") do\n    print(p,c)\nend","output":"```\n1    40    \n2    32    \n3    865    \n5    176    \n7    32    \n8    860    \n10    662    \n12    32    \n13    865    \n15    176    \n17    41\n```"},{"description":"Text animation in DLabel. Works faster than utf8.sub","code":"local str = \"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Кириллица. Nam vel nunc quis nisl convallis ultrices. Suspendisse potenti. Quisque feugiat tincidunt aliquet. Curabitur id purus id nisi bibendum laoreet eu a lacus. Sed vel sollicitudin lorem.\"\n\nlocal frame = vgui.Create(\"DFrame\")\nframe:SetSize(ScrW() * 0.4, ScrH() * 0.4)\nframe:SetTitle(\"utf8.codes example\")\nframe:Center()\n\nlocal label = vgui.Create(\"DLabel\", frame)\nlabel:Dock(TOP)\nlabel:SetWrap(true)\nlabel:SetFont(\"ChatFont\")\n\nlabel.symbolsToProcess = 0\nlabel.Think = function(self)\n    -- Table that will contain the characters from `str`\n    local characters = {}\n    -- How many characters we have at the moment. Used to insert new characters\n    local curLen = 0\n\n    -- How many symbols we need to process\n    -- Will match the length of the text on the current Think()\n    self.symbolsToProcess = self.symbolsToProcess + 1\n    for _, code in utf8.codes(str) do\n        if curLen >= self.symbolsToProcess then\n            break\n        end\n\n        curLen = curLen + 1\n        characters[curLen] = utf8.char(code)\n    end\n\n    self:SetText(table.concat(characters))\n    -- Update the height of the DLabel, assuming that we may have new lines\n    self:SizeToContentsY(0)\nend","output":{"upload":{"src":"afa74/8db166d9ac7fb40.gif","size":"499662","name":"utf8_codes_example.gif"}}}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"force","parent":"utf8","type":"libraryfunc","description":"Forces a string to contain only valid UTF-8 data. Invalid sequences are replaced with U+FFFD (the Unicode replacement character).\n\nThis is a lazy way for users to ensure a string contains only valid UTF-8 data.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/utf8.lua","line":"303-L338"},"args":{"arg":{"text":"The string that will become a valid UTF-8 string.","name":"string","type":"string"}},"rets":{"ret":{"text":"The UTF-8 string.","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetChar","parent":"utf8","type":"libraryfunc","description":"A UTF-8 compatible version of string.GetChar.","realm":"Shared and Menu","added":"2020.06.24","file":{"text":"lua/includes/modules/utf8.lua","line":"352-L362"},"args":{"arg":[{"text":"The string that you will be searching with the supplied index.","name":"str","type":"string"},{"text":"The index's value of the string to be returned.","name":"index","type":"number"}]},"rets":{"ret":{"text":"str","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"len","parent":"utf8","type":"libraryfunc","description":"Returns the number of UTF-8 sequences in the given string between positions startPos and endPos (both inclusive). If it finds any invalid UTF-8 byte sequence, returns false as well as the position of the first invalid byte.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/utf8.lua","line":"202-L229"},"args":{"arg":[{"text":"The string to calculate the length of.","name":"string","type":"string"},{"text":"The starting position to get the length from.","name":"startPos","type":"number","default":"1"},{"text":"The ending position to get the length from.","name":"endPos","type":"number","default":"-1"}]},"rets":{"ret":[{"text":"The number of UTF-8 characters in the string. If there are invalid bytes, this will be false.","name":"","type":"number"},{"text":"The position of the first invalid byte. If there were no invalid bytes, this will be nil.","name":"","type":"number"}]}},"example":{"description":"Demonstrates output of this function compared to string.len when given a string that contains Russian text.","code":"print( string.len( \"Мёнём\" ) )\nprint( utf8.len( \"Мёнём\" ) )","output":"```\n11\n5\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"offset","parent":"utf8","type":"libraryfunc","description":"Returns the byte-index of the n'th UTF-8-character after the given startPos (nil if none). startPos defaults to 1 when n is positive and -1 when n is negative. If n is zero, this function instead returns the byte-index of the UTF-8-character startPos lies within.","realm":"Shared and Menu","file":{"text":"lua/includes/modules/utf8.lua","line":"231-L301"},"args":{"arg":[{"text":"The string that you will get the byte position from.","name":"string","type":"string"},{"text":"The position to get the beginning byte position from.","name":"n","type":"number"},{"text":"The offset for n.","name":"startPos","type":"number","default":"1 when n>=0, -1 otherwise"}]},"rets":{"ret":{"text":"Starting byte-index of the given position.","name":"","type":"number"}}},"example":[{"description":"Returns the byte-index where the character at the 5th byte begins.","code":"print(utf8.offset(\"( ͡° ͜ʖ ͡°)\", 5))","output":"7"},{"description":"Safely truncates the string that may contain UTF-8 characters. The first print demonstrates the problem of string.sub","code":"local s = 'Текст - Cyrillic text example'\nprint(string.sub(s,1,5))\nprint(string.sub(s,1,utf8.offset(s,5)))","output":"Те?\nТекст"}],"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"sub","parent":"utf8","type":"libraryfunc","description":{"text":"A UTF-8 compatible version of string.sub.","warning":"Avoid using this function on large strings every tick/frame, as it may cause lags."},"realm":"Shared and Menu","added":"2020.06.24","file":{"text":"lua/includes/modules/utf8.lua","line":"364-L377"},"args":{"arg":[{"text":"The string you'll take a sub-string out of.","name":"string","type":"string"},{"text":"The position of the first character that will be included in the sub-string.","name":"StartPos","type":"number"},{"text":"The position of the last character to be included in the sub-string. It can be negative to count from the end.","name":"EndPos","type":"number","default":"nil"}]},"rets":{"ret":{"text":"The substring.","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"worldpicker.Active","parent":"util","type":"libraryfunc","description":"Returns if the user is currently picking an entity.","realm":"Client","file":{"text":"lua/includes/extensions/util/worldpicker.lua","line":"37"},"rets":{"ret":{"text":"Is world picking","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"worldpicker.Finish","parent":"util","type":"libraryfunc","description":{"text":"Finishes the world picking. This is called when a user presses their mouse after calling util.worldpicker.Start.","internal":""},"realm":"Client","file":{"text":"lua/includes/extensions/util/worldpicker.lua","line":"29-L35"},"args":{"arg":{"text":"Structures/TraceResult from the mouse press","name":"tr","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"worldpicker.Start","parent":"util","type":"libraryfunc","description":"Starts picking an entity in the world. This will suppress the next mouse click, and instead use it as a direction in the trace sent to the callback.","realm":"Client","file":{"text":"lua/includes/extensions/util/worldpicker.lua","line":"18-L24"},"args":{"arg":{"text":"Function to call after an entity choice has been made.","name":"callback","type":"function","callback":{"arg":{"text":"TraceResult from the mouse press. `tr.Entity` will return the entity clicked","type":"table","name":"tr"}}}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddNetworkString","parent":"util","type":"libraryfunc","description":{"text":"Adds the specified string to a string table, which will cache it and network it to all clients automatically.\n\nWhenever you want to create a net message with net.Start, you must add the name of that message as a networked string via this function.\n\nIf the passed string already exists, nothing will happen and the ID of the existing item will be returned.","note":{"text":"Each unique network name needs to be pooled once - do not put this function call into any other functions if you're using a constant string. Preferable place for this function is in a serverside lua file, or in a shared file with the net.Receive function.\n\nThe string table used for this function does not interfere with the engine string tables and has 4095 slots.  \nThis limit is shared among all entities, SetNW* and SetGlobal* functions. If you exceed the limit, you cannot create new variables, and you will get the following warning:\n```lua \nWarning:  Table networkstring is full, can't add [key]\n```","warning":"Existing variables will still get updated without the warning. You can check the limit by counting up until util.NetworkIDToString returns nil"}},"realm":"Server","args":{"arg":{"text":"Adds the specified string to the string table.","name":"str","type":"string"}},"rets":{"ret":{"text":"The id of the string that was added to the string table.\n\nSame as calling util.NetworkStringToID.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AimVector","parent":"util","type":"libraryfunc","description":"Function used to calculate aim vector from 2D screen position. It is used in SuperDOF calculate Distance.\n\nEssentially a generic version of gui.ScreenToVector.","realm":"Shared and Menu","args":{"arg":[{"text":"View angles","name":"ViewAngles","type":"Angle"},{"text":"View Field of View","name":"ViewFOV","type":"number"},{"text":"Mouse X position","name":"x","type":"number"},{"text":"Mouse Y position","name":"y","type":"number"},{"text":"Screen width","name":"scrWidth","type":"number"},{"text":"Screen height","name":"scrHeight","type":"number"}]},"rets":{"ret":{"text":"Calculated aim vector","name":"","type":"Vector"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Base64Decode","parent":"util","type":"libraryfunc","description":"Decodes the specified string from base64.","realm":"Shared and Menu","added":"2020.04.29","args":{"arg":{"text":"String to decode.","name":"str","type":"string"}},"rets":{"ret":{"text":"The raw bytes of the decoded string.","name":"","type":"string"}}},"example":{"description":"Decodes a string.","code":"local decode = util.Base64Decode( \"QmFzZTY0IEVuY29kaW5n\" )\nprint(decode)","output":"`Base64 Encoding`"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Base64Encode","parent":"util","type":"libraryfunc","description":{"text":"Encodes the specified string to base64.","note":"Unless disabled with the `inline` argument, the Base64 returned is compliant to the RFC 2045 standard. **This means it will have a line break after every 76th character.**"},"realm":"Shared and Menu","args":{"arg":[{"text":"String to encode.","name":"str","type":"string"},{"text":"`true` to disable RFC 2045 compliance (newline every 76th character)","name":"inline","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"Base 64 encoded string.","name":"","type":"string"}}},"example":{"description":"Encodes a string","code":"local encoded = util.Base64Encode( \"Base64 Encoding\" )\nprint(encoded)","output":"`QmFzZTY0IEVuY29kaW5n`"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"BlastDamage","parent":"util","type":"libraryfunc","description":"Applies explosion damage to all entities in the specified radius. Performs block checking.","realm":"Server","args":{"arg":[{"text":"The entity that caused the damage.","name":"inflictor","type":"Entity"},{"text":"The entity that attacked.","name":"attacker","type":"Entity"},{"text":"The center of the explosion","name":"damageOrigin","type":"Vector"},{"text":"The radius in which entities will be damaged.","name":"damageRadius","type":"number"},{"text":"The amount of damage to be applied.","name":"damage","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"BlastDamageInfo","parent":"util","type":"libraryfunc","description":"Applies spherical damage based on damage info to all entities in the specified radius.","realm":"Server","args":{"arg":[{"text":"The information about the damage","name":"dmg","type":"CTakeDamageInfo"},{"text":"Center of the spherical damage","name":"damageOrigin","type":"Vector"},{"text":"The radius in which entities will be damaged.","name":"damageRadius","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Compress","parent":"util","type":"libraryfunc","description":{"text":"Compresses the given string using the [LZMA](https://en.wikipedia.org/wiki/LZMA) algorithm.\n\nUse with net.WriteData and net.ReadData for networking and  util.Decompress to decompress the data.","note":"The output of this function will have the uncompressed size of the data prepended to it as an 8-byte little-endian integer. [Source](https://github.com/garrynewman/bootil/blob/beb4cec8ad29533965491b767b177dc549e62d23/src/Bootil/Utility/CompressionLZMA.cpp#L56-L63)\n\nYou may therefore experience issues using the output of this function **_outside of Garry's Mod_**. If you need to do this, you will need to manually strip the first 8 bytes from the compressed output, or use third-party tools such as [gmod-lzma](https://github.com/WilliamVenner/gmod-lzma-rs) to decompress the output instead."},"realm":"Shared and Menu","args":{"arg":{"text":"String to compress.","name":"str","type":"string"}},"rets":{"ret":{"text":"The compressed string, or an empty string if the input string was zero length (\"\").","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"CRC","parent":"util","type":"libraryfunc","description":{"text":"Generates the [CRC Checksum](https://en.wikipedia.org/wiki/Cyclic_redundancy_check) of the specified string.","warning":"This is NOT a hashing function. It is a checksum, typically used for error detection/data corruption detection. It is possible for this function to generate \"collisions\", where two different strings will produce the same CRC. If you need a hashing function, use util.SHA256."},"realm":"Shared","args":{"arg":{"text":"The string to calculate the checksum of.","name":"stringToChecksum","type":"string"}},"rets":{"ret":{"text":"The unsigned 32 bit checksum.","name":"","type":"string"}}},"example":{"description":"Prints out the CRC-32 checksum of \"a\".","code":"print( util.CRC( \"a\" ))","output":"3904355907"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DateStamp","parent":"util","type":"libraryfunc","description":"Returns the current date formatted like '2012-10-31 18-00-00'","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/util.lua","line":"98-L106"},"rets":{"ret":{"text":"date","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"text":"##  Built in Decals \nHere's a list of all the decal names that should be possible to use by default.\n* BeerSplash\n* BirdPoop\n* Blood\n* BulletProof\n* Cross\n* Dark\n* ExplosiveGunshot\n* Eye\n* FadingScorch\n* GlassBreak\n* Impact.Antlion\n* Impact.BloodyFlesh\n* Impact.Flesh\n* Impact.Concrete\n* Impact.Glass\n* Impact.Metal\n* Impact.Sand\n* Impact.Wood\n* Light\n* ManhackCut\n* Nought\n* Noughtsncrosses\n* PaintSplatBlue\n* PaintSplatGreen\n* PaintSplatPink\n* Scorch\n* SmallScorch\n* Smile\n* Splash.Large\n* YellowBlood","function":{"name":"Decal","parent":"util","type":"libraryfunc","description":"Performs a trace and paints a decal to the surface hit.","realm":"Shared","args":{"arg":[{"text":"The name of the decal to paint.","name":"name","type":"string"},{"text":"The start of the trace.","name":"start","type":"Vector"},{"text":"The end of the trace.","name":"end","type":"Vector"},{"text":"If set, the decal will not be able to be placed on given entity. Can also be a table of entities.","name":"filter","type":"Entity","alttype":"table<Entity>","default":"NULL"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DecalEx","parent":"util","type":"libraryfunc","description":{"text":"Performs a trace and paints a decal to the surface hit.","note":"This function has trouble spanning across multiple brushes on the map."},"realm":"Client","args":{"arg":[{"text":"The name of the decal to paint. Can be retrieved with util.DecalMaterial.","name":"material","type":"IMaterial"},{"text":"The entity to apply the decal to","name":"ent","type":"Entity"},{"text":"The position of the decal.","name":"position","type":"Vector"},{"text":"The direction of the decal.","name":"normal","type":"Vector"},{"text":"The color of the decal. Uses Color.\n\nThis only works when used on a brush model and only if the decal material has set `$vertexcolor` to `1`.","name":"color","type":"Color"},{"text":"The width scale of the decal.","name":"w","type":"number"},{"text":"The height scale of the decal.","name":"h","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"DecalMaterial","parent":"util","type":"libraryfunc","description":"Gets the full material path by the decal name. Used with util.DecalEx.\n\nIf decal specifies multiple materials, a random one will be chosen.","realm":"Shared","args":{"arg":{"text":"Name of the decal.","name":"decalName","type":"string"}},"rets":{"ret":{"text":"Material path of the decal.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Decompress","parent":"util","type":"libraryfunc","description":{"text":"Decompresses the given string using [LZMA](https://en.wikipedia.org/wiki/LZMA) algorithm. Used to decompress strings previously compressed with util.Compress.","warning":"When reading user data, always try to specify `maxSize` argument, otherwise the server can be [decompression bombed](https://en.wikipedia.org/wiki/Zip_bomb) with bad data that will fill up all Lua memory","note":"This function expects the compressed input data to have the uncompressed size of the data prepended to it as an 8-byte little-endian integer. [Source](https://github.com/garrynewman/bootil/blob/beb4cec8ad29533965491b767b177dc549e62d23/src/Bootil/Utility/CompressionLZMA.cpp#L101)\n\nIf your compressed input data was compressed by util.Compress, you don't need to worry about this - the uncompressed size of the data is already prepended to its output.\n\nHowever, if your compressed data was produced using standard tools **_outside of Garry's Mod_**, you will need to manually prepend the length of the uncompressed data to its compressed form as an 8-byte little endian integer."},"realm":"Shared and Menu","args":{"arg":[{"text":"The compressed string to decompress.","name":"compressedString","type":"string"},{"text":"The maximum size of uncompressed data in bytes, if greater it fails.","name":"maxSize","type":"number","default":"nil"}]},"rets":{"ret":{"text":"The original, decompressed string or `nil` on failure or invalid input. Also returns empty string if the input string was zero length (\"\").","name":"","type":"string|nil"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"DistanceToLine","parent":"util","type":"libraryfunc","description":"Gets the distance between a line and a point in 3d space.","realm":"Shared","args":{"arg":[{"text":"Start of the line.","name":"lineStart","type":"Vector"},{"text":"End of the line.","name":"lineEnd","type":"Vector"},{"text":"The position of the point.","name":"pointPos","type":"Vector"}]},"rets":{"ret":[{"text":"Distance from line.","name":"","type":"number"},{"text":"Nearest point on line.","name":"","type":"Vector"},{"text":"Distance along line from start.","name":"","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Effect","parent":"util","type":"libraryfunc","description":{"text":"Creates an effect with the specified data.\n\nFor Orange Box `.pcf` particles, see Global.ParticleEffect, Global.ParticleEffectAttach and  Global.CreateParticleSystem.","note":"When dispatching an effect from the server, some values may be clamped for networking optimizations. Visit the Set accessors on CEffectData to see which ones are affected.\n\nYou will need to couple this function with Global.IsFirstTimePredicted if you want to use it in a predicted hook."},"realm":"Shared","args":{"arg":[{"text":"The name of the effect to create.\n\nYou can find a list of built-in engine effects here. You can create your own in LUA, [example effects can be found here](https://github.com/Facepunch/garrysmod/tree/master/garrysmod/gamemodes/sandbox/entities/effects) and [here](https://github.com/Facepunch/garrysmod/tree/master/garrysmod/gamemodes/base/entities/effects).","name":"effectName","type":"string","warning":"If you use this function with Lua effects more than 2048 times in a single frame,   \n\nyou will get errors: `Broke possible Lua Effect creation infinite loop` and `Too many Lua Effects (2049)! Are you killing them properly?`."},{"text":"The effect data describing the effect.","name":"effectData","type":"CEffectData"},{"text":"Whether Lua-defined effects should override engine-defined effects with the same name for this/single function call.","name":"allowOverride","type":"boolean","default":"true"},{"text":"Can either be a boolean to ignore the prediction filter or a CRecipientFilter.\n\nSet this to true if you wish to call this function in multiplayer from server.","name":"ignorePredictionOrRecipientFilter","type":"boolean|CRecipientFilter","default":"nil"}]}},"example":[{"description":"Creates a `HelicopterMegaBomb` effect at the origin of the map. ( 0, 0, 0 )","code":"local vPoint = Vector( 0, 0, 0 )\nlocal effectdata = EffectData()\neffectdata:SetOrigin( vPoint )\nutil.Effect( \"HelicopterMegaBomb\", effectdata )"},{"description":"Example usage of the impact effect, makes bullet holes without firing a bullet.","code":"concommand.Add( \"test_impact\", function( ply )\n\n\tlocal tr = ply:GetEyeTrace()\n\n\tlocal effectdata = EffectData()\n\teffectdata:SetOrigin( tr.HitPos )\n\teffectdata:SetStart( tr.StartPos )\n\teffectdata:SetSurfaceProp( tr.SurfaceProps ) // For the sound\n\teffectdata:SetEntity( tr.Entity ) // The hit entity\n\teffectdata:SetHitBox( tr.HitBoxBone || 0 ) // For the decal\n\teffectdata:SetDamageType( DMG_BULLET ) // For the decal\n\tutil.Effect( \"Impact\", effectdata )\n\nend )"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"FilterText","parent":"util","type":"libraryfunc","description":{"text":"Filters given text using Steam's filtering system. The function will obey local client's Steam settings for chat filtering:","upload":{"src":"70c/8d9e680b626348b.png","size":"50426","name":"image.png"},"note":"In some cases, especially in a chatbox, messages from some players may return an empty string if the context argument used for filtering is `TEXT_FILTER_CHAT` and [if the local player has blocked the sender of the message on Steam](https://github.com/Facepunch/garrysmod-issues/issues/5161#issuecomment-1035153941)."},"added":"2022.02.02","realm":"Client","args":{"arg":[{"text":"String to filter.","name":"str","type":"string"},{"text":"Filtering context. See Enums/TEXT_FILTER.","name":"context","type":"number","default":"TEXT_FILTER_UNKNOWN"},{"text":"Used to determine if the text should be filtered according to local user's Steam chat filtering settings.","name":"player","type":"Player","default":"nil"}]},"rets":{"ret":{"text":"The filtered text based on given settings.\n\nThe maximum length of the string is 4095 bytes.","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"FullPathToRelative_Menu","parent":"util","type":"libraryfunc","description":"Converts the full path of the given file to a relative path.  \n\t\tYou can use util.RelativePathToFull_Menu to convert the relative path back to the full path.","realm":"Menu","args":{"arg":[{"text":"The **full** path to a file.","name":"fullPath","type":"string"},{"text":"The path to look for the files and directories in. See this list for a list of valid paths.","name":"fsPath","type":"string","default":"MOD"}]},"rets":{"ret":{"text":"The relative path to the given file.","name":"relativePath","type":"string"}}},"example":{"description":"Searches for a .gma file in your addons folder and converts the path to a full path.","code":"print( util.FullPathToRelative_Menu( \"[Steam folder]\\common\\garrysmod\\garrysmod\\addons\\[Name HERE].gma\", \"GAME\" ) ) -- prints the relative path of the GMA file.","output":"```lua\naddons\\[Name].gma\n```"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"GetActivityIDByName","parent":"util","type":"libraryfunc","description":"Returns the ID of a custom model activity. This is useful for models that define custom ones.\n\nSee util.GetActivityNameByID for a function that does the opposite.","realm":"Shared","added":"2024.04.24","args":{"arg":{"text":"The name of an activity, as defined in the model's `.qc` at compile time.","name":"","type":"string"}},"rets":{"ret":{"text":"The ID of the activity. See also Enums/ACT.","name":"id","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetActivityNameByID","parent":"util","type":"libraryfunc","description":"Returns a name for given activity ID. This is useful for models that define custom activities.\n\nSee util.GetActivityIDByName for a function that does the opposite.","realm":"Shared","added":"2024.01.26","args":{"arg":{"text":"The ID of an activity from some hook. See also Enums/ACT.","name":"id","type":"number"}},"rets":{"ret":{"text":"The associated name with given activity ID.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAnimEventIDByName","parent":"util","type":"libraryfunc","description":"Returns the ID of a custom model animation event. This is useful for models that define custom animation events.\n\nSee util.GetAnimEventNameByID for a function that does the opposite.","realm":"Shared","added":"2024.04.24","args":{"arg":{"text":"The name of an model animation event, as defined in the model's `.qc` at compile time.","name":"","type":"string"}},"rets":{"ret":{"text":"The ID of an animation event, typically for usage with ENTITY:HandleAnimEvent.","name":"id","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetAnimEventNameByID","parent":"util","type":"libraryfunc","description":"Returns a name for given automatically generated numerical animation event ID. This is useful for models that define custom animation events.\n\nSee util.GetAnimEventIDByName for a function that does the opposite.","realm":"Shared","added":"2024.01.26","args":{"arg":{"text":"The ID of an animation event, typically from ENTITY:HandleAnimEvent.","name":"id","type":"number"}},"rets":{"ret":{"text":"The associated name with given event ID.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetModelInfo","parent":"util","type":"libraryfunc","description":{"text":"Returns a table containing the info about the model. The model will be loaded and cached if it was not previously.\n\nSee also util.GetModelMeshes","note":"This function will silently fail if used on models with following strings in them:\n* _shared\n* _anims\n* _gestures\n* _anim\n* _postures\n* _gst\n* _pst\n* _shd\n* _ss\n* _anm\n* _include"},"realm":"Shared","args":{"arg":{"text":"The model path to retrieve information about.","name":"mdl","type":"string"}},"rets":{"ret":{"text":"The model info. See Structures/ModelInfo for details.","name":"","type":"table{ModelInfo}"}}},"example":{"description":"Example usage of the function. We use util.KeyValuesToTablePreserveOrder in order to preserve multiple keys with the same name.","code":"local ModelInfo = util.GetModelInfo(\"models/combine_gate_vehicle.mdl\" )\nprint( ModelInfo.SkinCount ) // The skin count\nPrintTable( util.KeyValuesToTablePreserveOrder( ModelInfo.KeyValues ) ) // Physics data","output":"```\n1:\n\t\tKey\t=\tsolid\n\t\tValue:\n\t\t\t\t1:\n\t\t\t\t\t\tKey\t=\tindex\n\t\t\t\t\t\tValue\t=\t0\n\t\t\t\t2:\n\t\t\t\t\t\tKey\t=\tname\n\t\t\t\t\t\tValue\t=\tVehicle_Gate.Gate2_L\n\t\t\t\t3:\n\t\t\t\t\t\tKey\t=\tmass\n\t\t\t\t\t\tValue\t=\t1\n\t\t\t\t4:\n\t\t\t\t\t\tKey\t=\tsurfaceprop\n\t\t\t\t\t\tValue\t=\tmetal\n\t\t\t\t5:\n\t\t\t\t\t\tKey\t=\tdamping\n\t\t\t\t\t\tValue\t=\t0\n\t\t\t\t6:\n\t\t\t\t\t\tKey\t=\trotdamping\n\t\t\t\t\t\tValue\t=\t0\n\t\t\t\t7:\n\t\t\t\t\t\tKey\t=\tinertia\n\t\t\t\t\t\tValue\t=\t1\n\t\t\t\t8:\n\t\t\t\t\t\tKey\t=\tvolume\n\t\t\t\t\t\tValue\t=\t68522.9296875\n\n...\n\n6:\n\t\tKey\t=\teditparams\n\t\tValue:\n\t\t\t\t1:\n\t\t\t\t\t\tKey\t=\trootname\n\t\t\t\t\t\tValue\t=\t\n\t\t\t\t2:\n\t\t\t\t\t\tKey\t=\ttotalmass\n\t\t\t\t\t\tValue\t=\t1\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetModelMeshes","parent":"util","type":"libraryfunc","description":{"text":"Retrieves vertex, triangle, and bone data for the visual meshes of a given model.","note":"This does not work on brush models (Models with names in the format `*number`)"},"realm":"Shared","args":{"arg":[{"text":"The full path to the model to get the visual meshes of.","name":"model","type":"string"},{"text":"Which of the model's Level of Detail (LOD) models to retrieve.\n\n\t\t\t`0` is the best quality with higher numbers progressively lowering the quality.","name":"lod","type":"number","default":"0"},{"text":"The combination of bodygroups to retrieve meshes for. This can also be a specially formatted bitflag.\n\t\t\t\n\t\t\tFor more information, see Entity:SetBodyGroups.","name":"bodygroupMask","type":"string|number","default":"0"},{"text":"Skin index. Affects the `.material` of Structures/ModelMeshData.\n\t\t\t\n\t\t\tFor more information, see Entity:GetSkin.","name":"skin","type":"number","default":"0","added":"2025.10.16"}]},"rets":{"ret":[{"text":"Each index in this table corresponds to a mesh within the model passed as an argument to this function.\n\nThe mesh data is raw, and is not transformed via bone transformations. That's what the second return value is for.","name":"modelMeshes","type":"table<Structures/ModelMeshData>"},{"text":"This tables indices are bone IDs for the Structures/BoneBindPose stored at each index.","name":"modelBindPoses","type":"table<Structures/BoneBindPose>"}]}},"example":{"description":"A snippet of Entity code that renders a wireframe helicopter bomb by retrieving the model's mesh and using it to create a new mesh.","code":"-- The default material to render with in case we for some reason don't have one\nlocal myMaterial = Material( \"models/wireframe\" ) -- models/debug/debugwhite\n\nfunction ENT:CreateMesh()\n\t-- Destroy any previous meshes\n\tif ( self.Mesh ) then self.Mesh:Destroy() end\n\n\t-- Get a list of all meshes of a model\n\tlocal visualMeshes = util.GetModelMeshes( \"models/combine_helicopter/helicopter_bomb01.mdl\" )\n\n\t-- Make sure the model exists before continuing\n\tif ( !visualMeshes ) then return end\n\n\t-- Select the first mesh\n\tlocal visualMesh = visualMeshes[ 1 ]\n\n\t-- Set the material to draw the mesh with from the model data\n\tmyMaterial = Material( visualMesh.material )\n\n\t-- You can apply any changes to visualMesh.verticies table here, distorting the mesh\n\t-- or any other changes you can come up with\n\n\t-- Create and build the mesh\n\tself.Mesh = Mesh()\n\tself.Mesh:BuildFromTriangles( visualMesh.triangles )\nend\n\n-- A special hook to override the normal mesh for rendering\nfunction ENT:GetRenderMesh()\n\t-- If the mesh doesn't exist, create it!\n\tif ( !self.Mesh ) then return self:CreateMesh() end\n\n\treturn { Mesh = self.Mesh, Material = myMaterial }\nend\n\nfunction ENT:Draw()\n\t-- Draw the entity's model normally, this will internally call ENT:GetRenderMesh()\n\tself:DrawModel()\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetPData","parent":"util","type":"libraryfunc","description":{"text":"Gets persistent data of an offline player using their SteamID.\n\nSee also Player:GetPData for a more convenient version of this function for online players, util.RemovePData and \n util.SetPData for the other accompanying functions.","note":"This function internally uses util.SteamIDTo64, it previously utilized Player:UniqueID which can cause collisions (two or more players sharing the same PData entry). This function now only uses the old method as a fallback if the name isn't found."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/util.lua","line":"333-L353"},"args":{"arg":[{"text":"SteamID of the player, in the `STEAM_0:0:0` format. See Player:SteamID.","name":"steamID","type":"string"},{"text":"Variable name to get the value of","name":"name","type":"string"},{"text":"The default value, in case there's nothing stored","name":"default","type":"any"}]},"rets":{"ret":{"text":"The stored value","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetPixelVisibleHandle","parent":"util","type":"libraryfunc","description":"Creates a new PixVis handle. See util.PixelVisible.","realm":"Client","rets":{"ret":{"text":"PixVis","name":"","type":"pixelvis_handle_t"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetPlayerTrace","parent":"util","type":"libraryfunc","description":"Utility function to quickly generate a trace table that starts at the players view position, and ends `32768` units along a specified direction.\n\nFor usage with util.TraceLine and similar functions.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/util.lua","line":"32-L49"},"args":{"arg":[{"text":"The player the trace should be based on","name":"ply","type":"Player"},{"text":"The direction of the trace. By default falls back to the direction the player is looking in.","name":"dir","type":"Vector","default":"ply:GetAimVector()"}]},"rets":{"ret":{"text":"The trace data. See Structures/Trace","name":"","type":"table{Trace}"}}},"example":{"description":"Prints the entity's model the local player is looking at to console","code":"local tr = util.TraceLine( util.GetPlayerTrace( LocalPlayer() ) )\nif IsValid(tr.Entity) then print(\"I saw a \"..tr.Entity:GetModel()) end\n\nlocal trground = util.TraceLine( util.GetPlayerTrace( LocalPlayer(), Vector(0,0,-1) ) )\nif IsValid(trground.Entity) then print(\"I'm standing on a \"..trground.Entity:GetModel()) end"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetSunInfo","parent":"util","type":"libraryfunc","description":"Gets information about the sun position and obstruction or nil if there is no sun.","realm":"Client","rets":{"ret":{"text":"The sun info. See Structures/SunInfo","name":"","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetSurfaceData","parent":"util","type":"libraryfunc","description":"Returns data of a [surface property](https://developer.valvesoftware.com/wiki/Material_surface_properties) at given ID. New surface properties can be added via physenv.AddSurfaceData.","realm":"Shared","args":{"arg":{"text":"Surface property ID. You can get it from Structures/TraceResult or using util.GetSurfaceIndex.","name":"id","type":"number"}},"rets":{"ret":{"text":"The data or no value if there is no valid surface property at given index.","name":"","type":"table{SurfacePropertyData}"}}},"example":{"description":"Prints the Surface Property Data of the place the player is looking at when executing the console command.","code":"concommand.Add( \"surfprop\", function( ply )\n\tlocal surface = ply:GetEyeTrace().SurfaceProps\n\tPrintTable( util.GetSurfaceData( surface ) )\nend )","output":"```\nbreakSound\t=\t\nbulletImpactSound\t=\tconcrete.bulletimpact\nclimbable\t=\t0\ndampening\t=\t0\ndensity\t=\t2400\nelasticity\t=\t0.20000000298023\nfriction\t=\t0.80000001192093\nhardThreshold\t=\t0.5\nhardVelocityThreshold\t=\t0\nhardnessFactor\t=\t1\nimpactHardSound\t=\tconcrete.impacthard\nimpactSoftSound\t=\tconcrete.impactsoft\njumpFactor\t=\t1\nmaterial\t=\t67\nmaxSpeedFactor\t=\t1\nname\t=\tconcrete\nreflectivity\t=\t0.66000002622604\nrollingSound\t=\t\nroughThreshold\t=\t0.5\nroughnessFactor\t=\t1\nscrapeRoughSound\t=\tconcrete.scraperough\nscrapeSmoothSound\t=\tconcrete.scrapesmooth\nstepLeftSound\t=\tconcrete.stepleft\nstepRightSound\t=\tconcrete.stepright\nstrainSound\t=\t\nthickness\t=\t0\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSurfaceIndex","parent":"util","type":"libraryfunc","description":"Returns the matching surface property index for the given surface property name.\n\nSee also util.GetSurfaceData and util.GetSurfacePropName for opposite function.","realm":"Shared","args":{"arg":{"text":"The name of the surface.","name":"surfaceName","type":"string"}},"rets":{"ret":{"text":"The surface property index, or -1 if name doesn't correspond to a valid surface property.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetSurfacePropName","parent":"util","type":"libraryfunc","description":"Returns the name of a surface property at given ID.\n\nSee also util.GetSurfaceData and util.GetSurfaceIndex for opposite function.","realm":"Shared","args":{"arg":{"text":"Surface property ID. You can get it from Structures/TraceResult.","name":"id","type":"number"}},"rets":{"ret":{"text":"The name or an empty string if there is no valid surface property at given index.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetUserGroups","parent":"util","type":"libraryfunc","description":{"text":"Returns a table of all SteamIDs that have a usergroup.","note":["This returns the original usergroups table, changes done to this table are not retroactive and will only affect newly connected users","This returns only groups that are registered in the **settings/users.txt** file of your server.  \n\nIn order to get the usergroup of a connected player, please use Player:GetUserGroup instead."]},"realm":"Server","file":{"text":"lua/includes/extensions/player_auth.lua","line":"99-L103"},"rets":{"ret":{"text":"A table of users where the key is the SteamID of the user and the value is a table with 2 fields:  \n* string name - Player Steam name  \n* string group - Player usergroup name","name":"","type":"table"}}},"example":{"description":"Retrieve the names of every superadmin registered","code":"local supadminsList = {}\n\nfor steamid, infos in pairs(util.GetUserGroups()) do\n\tif infos.group == \"superadmin\" then\n\t\tsupadminsList[#supadminsList + 1] = infos.name\n\tend\nend\n\nPrintTable(supadminsList)","output":"```\n1  =\trubat\n2  =\tgarry\n```"},"realms":["Server"],"type":"Function"},
{"function":{"name":"IntersectRayWithOBB","parent":"util","type":"libraryfunc","description":"Performs a Ray-OBB (Orientated Bounding Box) intersection and returns position, normal and the fraction if there was an intersection.","realm":"Shared","args":{"arg":[{"text":"Origin or start position of the ray.","name":"rayStart","type":"Vector"},{"text":"The ray vector itself, the ray end point relative to the start point. Can be implemented as `direction * distance`\n\nNote that in this implementation, the ray is not infinite - it's only a segment.","name":"rayDelta","type":"Vector"},{"text":"The center of the box.","name":"boxOrigin","type":"Vector"},{"text":"The angle of the box.","name":"boxAngles","type":"Angle"},{"text":"The min position of the box.","name":"boxMins","type":"Vector"},{"text":"The max position of the box.","name":"boxMaxs","type":"Vector"}]},"rets":{"ret":[{"text":"Hit position, nil if not hit.","name":"","type":"Vector"},{"text":"Normal/direction vector, nil if not hit.","name":"","type":"Vector"},{"text":"Fraction of trace used, nil if not hit.","name":"","type":"number"}]}},"example":{"description":"Simple example showing example usage of the function with visualization. Enter `developer 1` into the in-game console, and look at any entity. Will display a red box if there is no intersection, a green one if there is an intersection.\n\nPlease note that while the example uses an entity to generate a box, it is not necessary. The whole point is to perform intersection checks against non physical objects, for example an in-world user interface screen, or testing if a player (or an NPC) is looking at a certain part of a map.","code":"-- Store entity we look at\nlocal ent = NULL\n\n-- Do this every frame\nhook.Add( \"Think\", \"Think_IntersectRayWithOBBExample\", function()\n\n\t-- Store player object\n\tlocal ply = Entity( 1 )\n\t\n\t-- If player looked at some valid entity, swtich our entity to that\n\tlocal trEnt = ply:GetEyeTrace().Entity\n\tif ( IsValid( trEnt ) ) then ent = trEnt end\n\n\t-- No entity? do nothing\n\tif ( !IsValid( ent ) ) then return end\n\n\t-- Perform a ray intersection against the entity's OBB from the player's eyes\n\tlocal hitPos, hitNormal, frac = util.IntersectRayWithOBB( ply:GetShootPos(), ply:GetAimVector() * 500, ent:GetPos() + ent:OBBCenter(), ent:GetAngles(), ent:OBBMins(), ent:OBBMaxs() )\n\t-- print( \"res: \", hitPos, hitNormal, frac ) -- For debugging\n\n\t-- Draw the OBB visualization, requires developer 1 in console.\n\tdebugoverlay.BoxAngles( ent:OBBCenter() + ent:GetPos(), ent:OBBMins(), ent:OBBMaxs(), ent:GetAngles(), 0.01, hitPos != nil and Color(0,255,0) or Color( 255,0, 0) )\n\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IntersectRayWithPlane","parent":"util","type":"libraryfunc","description":"Performs a [ray-plane intersection](https://en.wikipedia.org/wiki/Line%E2%80%93plane_intersection) and returns the hit position or nil.","realm":"Shared","args":{"arg":[{"text":"Origin/start position of the ray.","name":"rayOrigin","type":"Vector"},{"text":"The direction of the ray.","name":"rayDirection","type":"Vector"},{"text":"Any position of the plane.","name":"planePosition","type":"Vector"},{"text":"The normal vector of the plane.","name":"planeNormal","type":"Vector"}]},"rets":{"ret":{"text":"The position of intersection, nil if not hit.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IntersectRayWithSphere","parent":"util","type":"libraryfunc","description":"Performs a ray-sphere intersection and returns the intersection positions or nil.","realm":"Shared","added":"2023.08.08","args":{"arg":[{"text":"Origin/start position of the ray.","name":"rayOrigin","type":"Vector"},{"text":"The end position of the ray relative to the start position. Equivalent of `direction * distance`.","name":"rayDelta","type":"Vector"},{"text":"Any position of the sphere.","name":"spherePosition","type":"Vector"},{"text":"The radius of the sphere.","name":"sphereRadius","type":"number"}]},"rets":{"ret":[{"text":"The first intersection position along the ray, or `nil` if there is no intersection.","name":"","type":"number"},{"text":"The second intersection position along the ray, or `nil` if there is no intersection.","name":"","type":"number"}]}},"example":{"code":"-- Store entity we look at\nlocal ent = NULL\n\n-- Do this every frame\nhook.Add( \"Think\", \"Think_IntersectRayWithOBBExample\", function()\n\n\t-- Store player object\n\tlocal ply = LocalPlayer()\n\t\n\t-- If player looked at some valid entity, swtich our entity to that\n\tlocal trEnt = ply:GetEyeTrace().Entity\n\tif ( IsValid( trEnt ) ) then ent = trEnt end\n\n\t-- No entity? do nothing\n\tif ( !IsValid( ent ) ) then return end\n\n\tlocal start = ply:GetShootPos()\n\tlocal delta = ply:GetAimVector() * 500\n\tlocal endpos = start + delta\n\n\t-- Perform a ray intersection against a sphere from the player's eyes\n\tlocal frac1, frac2 = util.IntersectRayWithSphere( start, delta, ent:GetPos() + ent:OBBCenter(), ent:OBBMaxs():Length() )\n\t--print( \"res: \", frac1, frac2 ) -- For debugging\n\n\t-- Display intersection points\n\tif ( frac1 ) then\n\t\tlocal intersect1 = LerpVector( frac1, start, endpos )\n\t\tlocal intersect2 = LerpVector( frac2, start, endpos )\n\t\tdebugoverlay.Axis( intersect1, angle_zero, 10, 0.01 )\n\t\tdebugoverlay.Axis( intersect2, angle_zero, 10, 0.01 )\n\tend\n\n\t-- Draw the OBB visualization, requires developer 1 in console.\n\tdebugoverlay.Sphere( ent:GetPos() + ent:OBBCenter(), ent:OBBMaxs():Length(), 0.01, frac1 != nil and Color( 0, 255, 0 ) or Color( 255, 0, 0 ) )\n\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsBinaryModuleInstalled","parent":"util","type":"libraryfunc","added":"2023.01.25","description":"Returns whether a binary module is installed and is resolvable by Global.require.","realm":"Shared and Menu","args":{"arg":{"text":"Name of the binary module, exactly the same as you would enter it as the argument to Global.require.","name":"name","type":"string"}},"file":{"text":"lua/includes/extensions/util.lua","line":"394-L418"},"rets":{"ret":{"text":"Whether the binary module is installed and Global.require can resolve it.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"IsBoxIntersectingBox","parent":"util","type":"libraryfunc","description":"Performs a box-box intersection and returns whether there was an intersection or not.","realm":"Shared","added":"2025.09.18","args":{"arg":[{"text":"The minimum extents of the Axis-Aligned box.","name":"boxMin","type":"Vector"},{"text":"The maximum extents of the Axis-Aligned box.","name":"boxMax","type":"Vector"},{"text":"The minimum extents of the second Axis-Aligned box.","name":"box2Min","type":"Vector"},{"text":"The maximum extents of the second Axis-Aligned box.","name":"box2Max","type":"Vector"}]},"rets":{"ret":{"text":"`true` if there is an intersection, `false` otherwise.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsBoxIntersectingSphere","parent":"util","type":"libraryfunc","description":"Performs a box-sphere intersection and returns whether there was an intersection or not.","realm":"Shared","added":"2023.08.08","args":{"arg":[{"text":"The minimum extents of the Axis-Aligned box.","name":"boxMin","type":"Vector"},{"text":"The maximum extents of the Axis-Aligned box.","name":"boxMax","type":"Vector"},{"text":"Any position of the sphere.","name":"shpere2Position","type":"Vector"},{"text":"The radius of the sphere.","name":"sphere2Radius","type":"number"}]},"rets":{"ret":{"text":"`true` if there is an intersection, `false` otherwise.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsInWorld","parent":"util","type":"libraryfunc","description":"Checks if a certain position is within the world bounds.","realm":"Server","args":{"arg":{"text":"Position to check.","name":"position","type":"Vector"}},"rets":{"ret":{"text":"Whether the vector is in world.","name":"","type":"boolean"}}},"example":{"description":"Here's a trick you can do to achieve the behavior of this function on the client.\n\n(This may be less efficient than the serverside function itself)","code":"local tr = { collisiongroup = COLLISION_GROUP_WORLD, output = {} }\n\nfunction util.IsInWorld( pos )\n\ttr.start = pos\n\ttr.endpos = pos\n\n\treturn not util.TraceLine( tr ).HitWorld\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"IsModelLoaded","parent":"util","type":"libraryfunc","description":"Checks if the model is loaded in the game.","realm":"Shared","args":{"arg":{"text":"Name/Path of the model to check.","name":"modelName","type":"string"}},"rets":{"ret":{"text":"Returns true if the model is loaded in the game; otherwise false.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsOBBIntersectingOBB","parent":"util","type":"libraryfunc","description":"Performs OBB on OBB intersection test.","realm":"Shared","args":{"arg":[{"text":"The center of the first box.","name":"box1Origin","type":"Vector"},{"text":"The angles of the first box.","name":"box1Angles","type":"Angle"},{"text":"The min position of the first box.","name":"box1Mins","type":"Vector"},{"text":"The max position of the first box.","name":"box1Maxs","type":"Vector"},{"text":"The center of the second box.","name":"box2Origin","type":"Vector"},{"text":"The angles of the second box.","name":"box2Angles","type":"Angle"},{"text":"The min position of the second box.","name":"box2Mins","type":"Vector"},{"text":"The max position of the second box.","name":"box2Maxs","type":"Vector"},{"text":"Tolerance for error. Leave at 0 if unsure.","name":"tolerance","type":"number"}]},"rets":{"ret":{"text":"Whether there is an intersection.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsPointInCone","parent":"util","type":"libraryfunc","description":"Returns whether a point is within a cone or not.","realm":"Shared","added":"2023.08.08","args":{"arg":[{"text":"The position of the point to test.","name":"point","type":"Vector"},{"text":"The position of the cone tip.","name":"coneOrigin","type":"Vector"},{"text":"The direction of the cone.","name":"coneAxis","type":"Vector"},{"text":"The sine of the cone's angle.","name":"coneSine","type":"number"},{"text":"Length of the cone's axis.","name":"coneLength","type":"number"}]},"rets":{"ret":{"text":"`true` if the point is within the cone, `false` otherwise.","name":"","type":"boolean"}}},"example":{"code":"function ENT:Draw()\n\n\tlocal pos = self:GetPos()\n\tlocal point = Vector( 0, 0, 0 )\n\tlocal sphereRad = 20\n\n\tlocal height = 100\n\tlocal angle = 45 --[[degrees]] / 180 * math.pi -- converted to radians\n\t\n\tlocal size = math.tan( angle ) * height\n\tlocal segs = 32\n\tlocal is = util.IsPointInCone( point, pos, self:GetUp(), math.cos( angle ), height )\n\tlocal is2 = util.IsSphereIntersectingCone( point, sphereRad, pos, self:GetUp(), math.sin( angle ), math.cos( angle ) ) -- infinite height\n\n\tlocal precalc = 1/segs * math.pi * 2\n\tlocal center = pos\n\tfor i = 1, segs do\n\t\tlocal pos1 = pos + math.sin( i * precalc ) * size * self:GetForward() + math.cos( i * precalc ) * size * self:GetRight() + self:GetUp() * height\n\t\tlocal pos2 = pos + math.sin( (i-1) * precalc ) * size * self:GetForward() + math.cos( (i-1) * precalc ) * size * self:GetRight() + self:GetUp() * height\n\t\t\n\t\trender.DrawLine( pos2, pos1, is and Color( 0, 255, 0 ) or Color( 255, 0, 0 ) )\n\t\trender.DrawLine( pos2, center, is and Color( 0, 255, 0 ) or Color( 255, 0, 0 ) )\n\tend\n\t\n\trender.DrawLine( pos, point, is and Color( 0, 255, 0 ) or Color( 255, 0, 0 ) )\n\tdebugoverlay.Sphere( point, sphereRad,0.01, is2 and Color( 0, 255, 0 ) or Color( 255, 0, 0 ) )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsRayIntersectingRay","parent":"util","type":"libraryfunc","description":"Performs a ray-ray intersection and returns whether there was an intersection or not.","realm":"Shared","added":"2024.02.02","args":{"arg":[{"text":"Start position of the first ray.","name":"ray1Start","type":"Vector"},{"text":"End position of the first ray.","name":"ray1End","type":"Vector"},{"text":"Start position of the second ray.","name":"ray2Start","type":"Vector"},{"text":"End position of the second ray.","name":"ray2End","type":"Vector"}]},"rets":{"ret":[{"text":"`true` if there is an intersection, `false` otherwise.","name":"","type":"boolean"},{"text":"Distance from start of ray 1 to the intersection, if there was one.","name":"","type":"number"},{"text":"Distance from start of ray 2 to the intersection, if there was one.","name":"","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsSkyboxVisibleFromPoint","parent":"util","type":"libraryfunc","description":{"text":"Check whether the skybox is visible from the point specified.","note":"This will always return true in fullbright maps."},"realm":"Client","args":{"arg":{"text":"The position to check the skybox visibility from.","name":"position","type":"Vector"}},"rets":{"ret":{"text":"Whether the skybox is visible from the position.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsSphereIntersectingCone","parent":"util","type":"libraryfunc","description":"Returns whether a sphere is intersecting a cone or not.","realm":"Shared","added":"2023.08.08","args":{"arg":[{"text":"The center position of the sphere to test.","name":"sphereCenter","type":"Vector"},{"text":"The radius of the sphere to test.","name":"sphereRadius","type":"number"},{"text":"The position of the cone tip.","name":"coneOrigin","type":"Vector"},{"text":"The direction of the cone.","name":"coneAxis","type":"Vector"},{"text":"The math.sin of the cone's angle.","name":"coneSine","type":"number"},{"text":"The math.cos of the cone's angle.","name":"coneCosine","type":"number"}]},"rets":{"ret":{"text":"`true` if the sphere intersects the cone, `false` otherwise.","name":"","type":"boolean"}}},"example":{"code":"function ENT:Draw()\n\n\tlocal pos = self:GetPos()\n\tlocal point = Vector( 0, 0, 0 )\n\tlocal sphereRad = 20\n\n\tlocal height = 100\n\tlocal angle = 45 --[[degrees]] / 180 * math.pi -- converted to radians\n\t\n\tlocal size = math.tan( angle ) * height\n\tlocal segs = 32\n\tlocal is = util.IsPointInCone( point, pos, self:GetUp(), math.cos( angle ), height )\n\tlocal is2 = util.IsSphereIntersectingCone( point, sphereRad, pos, self:GetUp(), math.sin( angle ), math.cos( angle ) ) -- infinite height\n\n\tlocal precalc = 1/segs * math.pi * 2\n\tlocal center = pos\n\tfor i = 1, segs do\n\t\tlocal pos1 = pos + math.sin( i * precalc ) * size * self:GetForward() + math.cos( i * precalc ) * size * self:GetRight() + self:GetUp() * height\n\t\tlocal pos2 = pos + math.sin( (i-1) * precalc ) * size * self:GetForward() + math.cos( (i-1) * precalc ) * size * self:GetRight() + self:GetUp() * height\n\t\t\n\t\trender.DrawLine( pos2, pos1, is and Color( 0, 255, 0 ) or Color( 255, 0, 0 ) )\n\t\trender.DrawLine( pos2, center, is and Color( 0, 255, 0 ) or Color( 255, 0, 0 ) )\n\tend\n\t\n\trender.DrawLine( pos, point, is and Color( 0, 255, 0 ) or Color( 255, 0, 0 ) )\n\tdebugoverlay.Sphere( point, sphereRad,0.01, is2 and Color( 0, 255, 0 ) or Color( 255, 0, 0 ) )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsSphereIntersectingSphere","parent":"util","type":"libraryfunc","description":"Performs a sphere-sphere intersection and returns whether there was an intersection or not.","realm":"Shared","added":"2023.08.08","args":{"arg":[{"text":"Any position of the first sphere.","name":"sphere1Position","type":"Vector"},{"text":"The radius of the first sphere.","name":"sphere1Radius","type":"number"},{"text":"Any position of the second sphere.","name":"sphere2Position","type":"Vector"},{"text":"The radius of the second sphere.","name":"sphere2Radius","type":"number"}]},"rets":{"ret":{"text":"`true` if there is an intersection, `false` otherwise.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsValidModel","parent":"util","type":"libraryfunc","description":"Checks if the specified model is valid.\n \n\nA model is considered invalid in following cases:\n* Starts with a space or **maps**\n* Doesn't start with **models**\n* Contains any of the following:\n  * `_gestures`\n  * `_animations`\n  * `_postures`\n  * `_gst`\n  * `_pst`\n  * `_shd`\n  * `_ss`\n  * `_anm`\n  * `.bsp`\n  * `cs_fix`\n* If the model isn't precached on the server, AND if the model file doesn't exist on disk\n* If precache failed\n* Model is the error model\n\nRunning this function will also precache the model.","realm":"Shared","args":{"arg":{"text":"Name/Path of the model to check.","name":"modelName","type":"string"}},"rets":{"ret":{"text":"Whether the model is valid or not. Returns false clientside if the model is not precached by the server.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsValidPhysicsObject","parent":"util","type":"libraryfunc","description":"Checks whether the given numbered physics object of the given entity is valid or not. Most useful for ragdolls.","realm":"Shared","file":{"text":"lua/includes/extensions/util.lua","line":"9-L30"},"args":{"arg":[{"text":"The entity to take.","name":"ent","type":"Entity"},{"text":"Number of the physics object to test.","name":"physobj","type":"number"}]},"rets":{"ret":{"text":"`true` that's valid, `false` otherwise.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsValidProp","parent":"util","type":"libraryfunc","description":"Checks if the specified prop is valid (has valid physics object).","realm":"Shared","args":{"arg":{"text":"Name/Path of the model to check.","name":"modelName","type":"string"}},"rets":{"ret":{"text":"Returns true if the specified prop is valid; otherwise false.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsValidRagdoll","parent":"util","type":"libraryfunc","description":"Checks if the specified model name points to a valid ragdoll.","realm":"Shared","args":{"arg":{"text":"Name/Path of the ragdoll model to check.","name":"ragdollName","type":"string"}},"rets":{"ret":{"text":"Returns true if the specified model name points to a valid ragdoll; otherwise false.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"JSONToTable","parent":"util","type":"libraryfunc","description":{"text":"Converts a JSON string to a Lua table. It supports comments and trailing commas.\n\nSee util.TableToJSON for the opposite function.","bug":{"text":"Colors will not have the color metatable.","issue":"2407"}},"realm":"Shared and Menu","args":{"arg":[{"text":"The JSON string to convert.","name":"json","type":"string"},{"text":"ignore the depth and breadth limits, **use at your own risk!**.","name":"ignoreLimits","type":"boolean","default":"false","added":"2023.09.05","warning":"If this is false, there is a limit of 15,000 keys total."},{"text":"ignore string to number conversions for table keys.","name":"ignoreConversions","type":"boolean","default":"false","added":"2023.09.05","warning":"if this is false, keys are converted to numbers wherever possible. This means using Player:SteamID64 as keys won't work."}]},"rets":{"ret":{"text":"The table containing converted information. Returns `nil` on failure.","name":"","type":"table|nil"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"KeyValuesToTable","parent":"util","type":"libraryfunc","description":{"text":"Converts a Valve KeyValue string (typically from util.TableToKeyValues) to a Lua table.","note":"Due to how tables work in Lua, keys will not repeat within a table. See util.KeyValuesToTablePreserveOrder for alternative."},"realm":"Shared and Menu","args":{"arg":[{"text":"The KeyValue string to convert.","name":"keyValues","type":"string"},{"text":"If set to true, will replace `\\t`, `\\n`, `\\\"` and `\\\\` in the input text with their escaped variants","name":"usesEscapeSequences","type":"boolean","default":"false"},{"text":"Whether we should preserve key case (may fail) or not (always lowercase)","name":"preserveKeyCase","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"The converted table","name":"","type":"table"}}},"example":{"description":"Example usage and output of this function. Note how there's only one \"solid\" key in the table despite the fact that input string contains multiple.","code":"local ModelInfo = util.GetModelInfo(\"models/combine_gate_vehicle.mdl\" )\nPrintTable( util.KeyValuesToTable( ModelInfo.KeyValues ) )","output":"```\neditparams:\n\t\trootname\t=\t\n\t\ttotalmass\t=\t1\nsolid:\n\t\tdamping\t=\t0\n\t\tindex\t=\t4\n\t\tinertia\t=\t1\n\t\tmass\t=\t1\n\t\tname\t=\tVehicle_Gate.Gate1_L\n\t\trotdamping\t=\t0\n\t\tsurfaceprop\t=\tmetal\n\t\tvolume\t=\t68522.8828125\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"KeyValuesToTablePreserveOrder","parent":"util","type":"libraryfunc","description":"Similar to util.KeyValuesToTable, but it also preserves order of keys (since Lua dictionary-style tables do not guarantee a specific order), and allows handling of repeated keys. (since each key can only appear once in a dictionary data structure)","realm":"Shared and Menu","args":{"arg":[{"text":"The Valve KeyValue formatted text.","name":"keyValues","type":"string"},{"text":"If set to true, will replace `\\t`, `\\n`, `\\\"` and `\\\\` in the input text with their escaped variants","name":"usesEscapeSequences","type":"boolean","default":"false"},{"text":"Whether we should preserve key case (may fail) or not (always lowercase)","name":"preserveKeyCase","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"The output table","name":"","type":"table"}}},"example":{"description":"Example usage and output of this function. Note how there are multiple entries where they key is \"solid\", just like in the input string.","code":"local ModelInfo = util.GetModelInfo(\"models/combine_gate_vehicle.mdl\" )\nPrintTable( util.KeyValuesToTablePreserveOrder( ModelInfo.KeyValues ) )","output":"```\n1:\n\t\tKey\t=\tsolid\n\t\tValue:\n\t\t\t\t1:\n\t\t\t\t\t\tKey\t=\tindex\n\t\t\t\t\t\tValue\t=\t0\n\t\t\t\t2:\n\t\t\t\t\t\tKey\t=\tname\n\t\t\t\t\t\tValue\t=\tVehicle_Gate.Gate2_L\n\t\t\t\t3:\n\t\t\t\t\t\tKey\t=\tmass\n\t\t\t\t\t\tValue\t=\t1\n\t\t\t\t4:\n\t\t\t\t\t\tKey\t=\tsurfaceprop\n\t\t\t\t\t\tValue\t=\tmetal\n\t\t\t\t5:\n\t\t\t\t\t\tKey\t=\tdamping\n\t\t\t\t\t\tValue\t=\t0\n\t\t\t\t6:\n\t\t\t\t\t\tKey\t=\trotdamping\n\t\t\t\t\t\tValue\t=\t0\n\t\t\t\t7:\n\t\t\t\t\t\tKey\t=\tinertia\n\t\t\t\t\t\tValue\t=\t1\n\t\t\t\t8:\n\t\t\t\t\t\tKey\t=\tvolume\n\t\t\t\t\t\tValue\t=\t68522.9296875\n2:\n\t\tKey\t=\tsolid\n\t\tValue:\n\t\t\t\t1:\n\t\t\t\t\t\tKey\t=\tindex\n\t\t\t\t\t\tValue\t=\t1\n\t\t\t\t2:\n\t\t\t\t\t\tKey\t=\tname\n\t\t\t\t\t\tValue\t=\tVehicle_Gate.Gate3_R\n...\n```"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"LocalToWorld","parent":"util","type":"libraryfunc","description":{"text":"A convenience function around LocalToWorld-related functions.","note":"If Entity:EntIndex returns `0`, the function will return the passed `lpos`."},"realm":"Shared","file":{"text":"lua/includes/extensions/util.lua","line":"76-L95"},"args":{"arg":[{"text":"The entity to take.","name":"ent","type":"Entity"},{"text":"A local space vector.","name":"lpos","type":"Vector"},{"text":"Actually to be treated as the number corresponding to a specific PhysObj of the entity.\n\nIf that specific physics object is valid, then PhysObj:LocalToWorld is used.\n\nOtherwise, Entity:LocalToWorld.","name":"bone","type":"number","default":"0"}]},"rets":{"ret":{"text":"The corresponding worldspace vector.","name":"","type":"Vector"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"MD5","parent":"util","type":"libraryfunc","description":{"text":"Generates the [MD5 hash](https://en.wikipedia.org/wiki/MD5) of the specified string.","warning":"MD5 is considered cryptographically broken and is known to be vulnerable to a variety of attacks including duplicate return values. If security or duplicate returns is a concern, use util.SHA256."},"realm":"Shared","added":"2021.07.01","args":{"arg":{"text":"The string to calculate the MD5 hash of.","name":"stringToHash","type":"string"}},"rets":{"ret":{"text":"The MD5 hash of the string in hexadecimal form.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"NetworkIDToString","parent":"util","type":"libraryfunc","description":"Returns the networked string associated with the given ID from the string table.","realm":"Shared","args":{"arg":{"text":"ID to get the associated string from.","name":"stringTableID","type":"number"}},"rets":{"ret":{"text":"The networked string, or nil if it wasn't found.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"NetworkStringToID","parent":"util","type":"libraryfunc","description":"Returns the networked ID associated with the given string from the string table.","realm":"Shared","args":{"arg":{"text":"String to get the associated networked ID from.","name":"networkString","type":"string"}},"rets":{"ret":{"text":"The networked ID of the string, or 0 if it hasn't been networked with util.AddNetworkString.","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"NiceFloat","parent":"util","type":"libraryfunc","description":"Formats a float by stripping off extra `0's` and `.'s`.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/util.lua","line":"147-L165"},"args":{"arg":{"text":"The float to format.","name":"float","type":"number"}},"rets":{"ret":{"text":"Formatted float.","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ParticleTracer","parent":"util","type":"libraryfunc","description":{"text":"Creates an orange box (.pcf) tracer effect with the given parameters. See util.ParticleTracerEx for version with additional arguments.\n\nInternally uses `ParticleTracer` engine effect. (util.Effect) which then spawns in `ParticleEffect` effect.","note":"The default bullet effect is not in .pcf format, therefore it is not used with util.ParticleTracer.  Consider utilizing util.Effect instead"},"realm":"Shared","args":{"arg":[{"text":"The name of the .pcf particle effect to use for the tracer.\n\nControl Point 0 is the start location. Control Point 1 is the end pos.","name":"name","type":"string"},{"text":"The start position of the tracer.","name":"startPos","type":"Vector"},{"text":"The end position of the tracer.","name":"endPos","type":"Vector"},{"text":"Whether to play the hit near-miss (whiz) sound.","name":"doWhiz","type":"boolean"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ParticleTracerEx","parent":"util","type":"libraryfunc","description":"Creates a tracer effect with the given parameters. Expanded version of util.ParticleTracer.","realm":"Shared","args":{"arg":[{"text":"The name of the tracer effect.","name":"name","type":"string"},{"text":"The start position of the tracer.","name":"startPos","type":"Vector"},{"text":"The end position of the tracer.","name":"endPos","type":"Vector"},{"text":"Play the hit miss(whiz) sound.","name":"doWhiz","type":"boolean"},{"text":"Entity index of the emitting entity.","name":"entityIndex","type":"number"},{"text":"Attachment index to be used as origin.","name":"attachmentIndex","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PixelVisible","parent":"util","type":"libraryfunc","description":"Returns the visibility of a square that is always pointed at the camera in the world-space.\n\nThis is typically used for in-game sprites or \"billboards\". (render.DrawSprite)","realm":"Client","args":{"arg":[{"text":"The center of the visibility test.","name":"position","type":"Vector"},{"text":"The size of the square to check for visibility.","name":"size","type":"number"},{"text":"The PixVis handle created with util.GetPixelVisibleHandle.","name":"PixVis","type":"pixelvis_handle_t","warning":"Don't use the same handle twice per tick or it will give unpredictable results."}]},"rets":{"ret":{"text":"Visibility percentage, in range of `[0-1]`. `0` when none of the area is visible, `0.5` when half the area is visible, `1` when all of it is visible, etc.","name":"","type":"number"}}},"example":{"description":"Demonstrates approximately what this function does.","code":"local PixVis\nlocal material = Material( \"sprites/splodesprite\" )\n\n-- Position and size of the pixvis thing\nlocal vPos = Vector( 0, 0, 0 )\nlocal vSize = 16\n\nhook.Add( \"HUDPaint\", \"TestPixelVisibility\", function()\n\tif ( !PixVis ) then PixVis = util.GetPixelVisibleHandle() end\n\n\tlocal visible = util.PixelVisible( vPos, vSize, PixVis )\n\n\tlocal pos2D = vPos:ToScreen()\n\tdraw.SimpleTextOutlined( \"Visibility: \" .. math.floor( visible * 100 ), \"Default\", pos2D.x, pos2D.y, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 2, color_black )\nend )\n\nhook.Add( \"PreDrawOpaqueRenderables\", \"TestPixelVisibility\", function()\n\t-- Approximate visualization of the pixel visibility area\n\trender.SetMaterial( material )\n\trender.DrawSprite( vPos, vSize * 1.5, vSize * 1.5, color_white )\nend )","output":{"upload":{"src":"70c/8ddbe2f412a51d4.mp4","size":"2242779","name":"July08-1502-gmod.mp4"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PointContents","parent":"util","type":"libraryfunc","description":{"text":"Returns the contents of the position specified.","note":"This function will sample only the world environments. It can be used to check if Entity:GetPos is underwater for example unlike Entity:WaterLevel which works for players only."},"realm":"Shared","args":{"arg":{"text":"Position to get the contents sample from.","name":"position","type":"Vector"}},"rets":{"ret":{"text":"Contents bitflag, see Enums/CONTENTS","name":"","type":"number{CONTENTS}"}}},"example":[{"description":"Check if the trace position is underwater.","code":"local tr = Entity( 1 ):GetEyeTrace()\nprint( bit.band( util.PointContents( tr.HitPos ), CONTENTS_WATER ) == CONTENTS_WATER )"},{"description":"Check if the trace entity position is underwater assuming the object is already valid.","code":"if ( bit.band( util.PointContents( tr.Entity:GetPos() ), CONTENTS_WATER ) == CONTENTS_WATER ) then\n\t-- Do stuff here when the entity's position is underwater.\nend"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PrecacheModel","parent":"util","type":"libraryfunc","description":{"text":"Precaches a model for later use. Model is cached after being loaded once.","warning":"Modelprecache is limited to 8192 unique models. When it reaches the limit the game will crash.","note":"Does nothing on the client."},"realm":"Shared","args":{"arg":{"text":"The model to precache.","name":"modelName","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PrecacheSound","parent":"util","type":"libraryfunc","description":{"text":"Precaches a sound for later use. Sound is cached after being loaded once.","note":"Soundcache is limited to 16384 unique sounds on the server. Due to this fact this function is disabled on purpose, as exceeding the limit causes the server to shutdown.","bug":"Ultimately does nothing on client, and only works with sound scripts, not direct paths."},"realm":"Shared","args":{"arg":{"text":"The sound to precache.","name":"soundName","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"QuickTrace","parent":"util","type":"libraryfunc","description":{"text":"Performs a trace with the given origin, direction, and filter.","note":"This function will throw an error in the menu realm because it internally uses util.TraceLine which doesn't exist in the menu realm and thus error."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/util.lua","line":"52-L66"},"args":{"arg":[{"text":"The origin of the trace.","name":"origin","type":"Vector"},{"text":"The direction of the trace times the distance of the trace. This is added to the origin to determine the endpos.","name":"dir","type":"Vector"},{"text":"Entity which should be ignored by the trace. Can also be a table of entities or a function - see Structures/Trace.","name":"filter","type":"Entity|table<Entity>|table<string>|function","default":"nil"}]},"rets":{"ret":{"text":"Trace result. See Structures/TraceResult.","name":"","type":"table{TraceResult}"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"RelativePathToFull_Menu","parent":"util","type":"libraryfunc","description":"Converts the relative path of a given file to the full path on disk.  \n\t\tYou can use util.FullPathToRelative_Menu to convert the full path back to the relative path.","realm":"Menu","args":{"arg":[{"text":"The relative path of a file, for example: `addons/[Name].gma`","name":"filePath","type":"string"},{"text":"The path to look for the files and directories in. See this list for a list of valid paths.","name":"mountPath","type":"string","default":"MOD"}]},"rets":{"ret":{"text":"The full path to the file.","name":"fullpath","type":"string"}}},"example":{"description":"Searches for a .gma file in your addons folder and converts the path to a full path.","code":"local files, _ = file.Find( \"addons/*.gma\", \"GAME\" )\nlocal file = \"addons/\" .. files[1] -- gets the first file and converts it into the relative path.\nprint( util.RelativePathToFull_Menu( file ) ) -- prints the full path of the GMA file.","output":"```lua\n[Steam folder]\\common\\garrysmod\\garrysmod\\addons\\[Name].gma\n```"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"RelativePathToGMA_Menu","parent":"util","type":"libraryfunc","description":"Returns which Workshop addon the given file belongs to.","realm":"Menu","args":{"arg":{"text":"The relative path to a file, such as `materials/myMaterial.vmt`.","name":"filePath","type":"string"}},"rets":{"ret":{"text":"The info about owner addon. Will return nil if the file doesn't belong to an addon. Table Structure:\n```lua\nAuthor\t=\t[Addon Author]\nFile\t=\t[Steam folder]\\workshop\\content\\4000\\[Addon ID]/[GMA Name].gma\nID\t=\t[Addon ID]\nTitle\t=\t[Addon Title]\n```","name":"addonInfo","type":"table"}}},"example":{"description":"Prints the AddonInfo of the given Path (The Addon the file belongs to.)","code":"PrintTable( util.RelativePathToGMA_Menu( \"[Insert here something from an addon like a Model]\" ) ) -- prints the AddonInfo","output":"```lua\nAuthor\t=\t[Addon Author]\nFile\t=\t[Steam folder]\\workshop\\content\\4000\\[Addon ID]/[GMA Name].gma\nID\t=\t[Addon ID]\nTitle\t=\t[Addon Title]\n```"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"RemoveDecalsAt","parent":"util","type":"libraryfunc","description":"Removes world decals at given position, in given radius. Does not remove decals on models!","realm":"Client","added":"2025.02.06","args":{"arg":[{"text":"The position at which to remove decals.","name":"pos","type":"Vector"},{"text":"Radius of the sphere to remove decals in.","name":"distance","type":"number"},{"text":"If set to above 0, only remove this many decals.","name":"limit","type":"number","default":"0"},{"text":"Whether to remove map-spawned decals (`true`), or only gameplay-spawned decals \n such as bullet holes or anything placed by util.Decal and similar(`false`)","name":"permanent","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"How many decals were removed.","name":"removed","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"RemovePData","parent":"util","type":"libraryfunc","description":{"text":"Removes persistent data of an offline player using their SteamID.\n\nSee also Player:RemovePData for a more convenient version of this function for online players, util.SetPData and \n util.GetPData for the other accompanying functions.","note":"This function internally uses util.SteamIDTo64, it previously utilized Player:UniqueID which can cause collisions (two or more players sharing the same PData entry). This function now tries to remove both old and new entries."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/util.lua","line":"370-L380"},"args":{"arg":[{"text":"SteamID of the player to remove data of, in the `STEAM_0:0:0` format. See Player:SteamID.","name":"steamID","type":"string"},{"text":"Variable name to remove","name":"name","type":"string"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"ScreenShake","parent":"util","type":"libraryfunc","description":{"text":"Makes the screen shake.","note":"The screen shake effect is rendered by modifying the view origin on the client. If you override the view origin in GM:CalcView you may not be able to see the shake effect."},"realm":"Shared","args":{"arg":[{"text":"The origin of the effect.\n\t\t\t\nUsed serverside only, to determine which clients the event should be networked to.","name":"pos","type":"Vector"},{"text":"The strength of the effect. How far away from its origin the camera will move while shaking.","name":"amplitude","type":"number"},{"text":"How many times per second to change the direction of the camera wobble. 40 is generally enough; values higher are hardly distinguishable.","name":"frequency","type":"number"},{"text":"The duration of the effect in seconds.","name":"duration","type":"number"},{"text":"The range from the origin within which views will be affected, in Hammer units.\n\nThis is used when networking the event to clients only.","name":"radius","type":"number"},{"text":"Whether players in the air should also be affected.\n\nUsed serverside only to determine which clients to send the event to.","name":"airshake","type":"boolean","default":"false","added":"2023.09.11"},{"text":"If set, will only network the screen shake event to players present in the filter.","name":"filter","type":"CRecipientFilter","default":"nil","added":"2024.02.17"}]}},"example":{"description":"This will shake the screen, from the position 0, 0, 0 (X, Y, Z) and 5000 units away, with 5 amp, frequency 5, for 10 seconds.","code":"util.ScreenShake( Vector(0, 0, 0), 5, 5, 10, 5000 )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetPData","parent":"util","type":"libraryfunc","description":{"text":"Sets persistent data for offline player using their SteamID.\n\nSee also Player:SetPData for a more convenient version of this function for online players, util.RemovePData and \n util.GetPData for the other accompanying functions.","note":"This function internally uses util.SteamIDTo64, it previously utilized Player:UniqueID which could have caused collisions (two or more players sharing the same PData entry)."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/util.lua","line":"359-L364"},"args":{"arg":[{"text":"SteamID of the player, in the `STEAM_0:0:0` format. See Player:SteamID.","name":"steamID","type":"string"},{"text":"Variable name to store the value in.","name":"name","type":"string"},{"text":"The value to store.","name":"value","type":"any"}]}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SHA1","parent":"util","type":"libraryfunc","description":{"text":"Generates the [SHA-1 hash](https://en.wikipedia.org/wiki/SHA-1) of the specified string.","warning":"SHA-1 is considered cryptographically broken and is known to be vulnerable to a variety of attacks. If security is a concern, use util.SHA256."},"realm":"Shared","added":"2021.07.01","args":{"arg":{"text":"The string to calculate the SHA-1 hash of.","name":"stringToHash","type":"string"}},"rets":{"ret":{"text":"The SHA-1 hash of the string in hexadecimal form.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SHA256","parent":"util","type":"libraryfunc","description":"Generates the [SHA-256 hash](https://en.wikipedia.org/wiki/SHA-2) of the specified string. This is mostly unique and is astronomically unlikely to return the same hash for a different string unlike util.CRC or util.MD5 which are both much more vulnerable to duplicate returns.","realm":"Shared","added":"2021.07.01","args":{"arg":{"text":"The string to calculate the SHA-256 hash of.","name":"stringToHash","type":"string"}},"rets":{"ret":{"text":"The SHA-256 hash of the string in hexadecimal form.","name":"","type":"string"}}},"example":{"description":"Prints out an example of how SHA-256 hashes work.","code":"local a, b = util.SHA256(\"Hello\"), util.SHA256(\"World\")\nprint(a == b)\nprint(a, b)\nprint(a == util.SHA256(\"Hello\"))","output":"```\nfalse\n185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969\n78ae647dc5544d227130a0682a51e30bc7777fbb6d8a8f17007463a3ecd1d524\ntrue\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SharedRandom","parent":"util","type":"libraryfunc","description":{"text":"Generates a random float value that should be the same on client and server.\n\n\n\nThis uses a different method of obtaining random numbers and is unaffected by math.randomseed. Instead it uses an internal seed that is based on the player's current predicted command and is fixed to a value of -1 outside of prediction.","note":"This function is best used in a predicted hook."},"realm":"Shared","args":{"arg":[{"text":"The seed for the random value","name":"uniqueName","type":"string"},{"text":"The minimum value of the random range","name":"min","type":"number"},{"text":"The maximum value of the random range","name":"max","type":"number"},{"text":"The additional seed","name":"additionalSeed","type":"number","default":"0"}]},"rets":{"ret":{"text":"The random float value","name":"","type":"number"}}},"example":[{"description":"Example usage of the function. Generates some random values.","code":"print( util.SharedRandom( \"23\", 0, 100 ) )\nprint( util.SharedRandom( \"23\", 0, 100 ) )\nprint( util.SharedRandom( \"23\", 0, 100, 0 ) )\nprint( util.SharedRandom( \"23\", 0, 100, 1337 ) )\nprint( util.SharedRandom( \"lol\", 0, 100, 1337 ) )","output":"```\n15.979786317786\n15.979786317786\n15.979786317786\n24.08124470342\n78.480193614252\n```"},{"description":"A demonstration of how this function interacts with prediction.","code":"local function printValues()\n\tprint(util.SharedRandom(\"a seed\", 0, 100))\nend\n\nfunction SWEP:PrimaryAttack()\n\t-- Because it's being called in prediction these values will change every time you fire, as the\n\t-- internal seed is being updated every tick.\n\tprint(\"Predicted\")\n\tprintValues()\n\t\n\t-- The internal seed only ever updates between commands, so the same arguments will give\n\t-- the same results when executed during the same tick.\n\tprintValues()\n\t\n\t-- Timers break prediction, so the code below uses an internal seed of -1 and will\n\t-- always return the same value regardless of game tick.\n\ttimer.Simple(0, function()\n\t\tprint(\"Unpredicted\")\n\t\tprintValues()\n\tend)\nend","output":"```\nPredicted\n1.4230553998719\n1.4230553998719\n\nUnpredicted\n43.928178187426\n---\nPredicted\n46.720645319075\n46.720645319075\n\nUnpredicted\n43.928178187426\n---\nPredicted\n99.127414868738\n99.127414868738\n\nUnpredicted\n43.928178187426\n```"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SpriteTrail","parent":"util","type":"libraryfunc","description":"Adds a trail to the specified entity.","realm":"Server","args":{"arg":[{"text":"Entity to attach trail to","name":"ent","type":"Entity"},{"text":"Attachment ID of the entities model to attach trail to. If you are not sure, set this to 0","name":"attachmentID","type":"number"},{"text":"Color of the trail","name":"color","type":"Color"},{"text":"Should the trail be additive or not","name":"additive","type":"boolean"},{"text":"Start width of the trail","name":"startWidth","type":"number"},{"text":"End width of the trail","name":"endWidth","type":"number"},{"text":"How long it takes to transition from startWidth to endWidth","name":"lifetime","type":"number"},{"text":"The resolution of trails texture. A good value can be calculated using this formula: 1 / ( startWidth + endWidth ) * 0.5","name":"textureRes","type":"number"},{"text":"Path to the texture to use as a trail.","name":"texture","type":"string"}]},"rets":{"ret":{"text":"Entity of created trail ([env_spritetrail](https://developer.valvesoftware.com/wiki/Env_spritetrail))","name":"","type":"Entity"}}},"example":{"description":"A console command that gives the player a red trail.","code":"concommand.Add( \"givetrail\", function( ply )\n\tlocal trail = util.SpriteTrail( ply, 0, Color( 255, 0, 0 ), false, 15, 1, 4, 1 / ( 15 + 1 ) * 0.5, \"trails/plasma\" )\n\tprint( trail )\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"Stack","parent":"util","type":"libraryfunc","description":"Returns a new Stack object.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/util.lua","line":"324-L326"},"rets":{"ret":{"text":"A brand new stack object.","name":"","type":"Stack"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"SteamIDFrom64","parent":"util","type":"libraryfunc","description":{"text":"Given a 64bit SteamID will return a STEAM_0:0:0 style Steam ID.","note":"This operation induces data loss. Not all fields of a [64bit SteamID](https://developer.valvesoftware.com/wiki/SteamID) can be represented using the `STEAM_0:0:0` format, specifically the \"account type\" and \"account instance\" fields."},"realm":"Shared","args":{"arg":{"text":"The 64 bit Steam ID","name":"id","type":"string"}},"rets":{"ret":{"text":"String STEAM_0:0:0 style Steam ID representation.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SteamIDTo64","parent":"util","type":"libraryfunc","description":"Converts a STEAM_0:0:0 style SteamID to a 64bit SteamID.","realm":"Shared","args":{"arg":{"text":"The STEAM_0:0:0 format SteamID","name":"id","type":"string"}},"rets":{"ret":{"text":"64bit SteamID or 0 (as a string) on fail","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"StringToType","parent":"util","type":"libraryfunc","file":{"text":"lua/includes/extensions/util.lua","line":"108-L125"},"description":"Converts a string to the specified type.\n\nThis can be useful when dealing with ConVars.","realm":"Shared and Menu","args":{"arg":[{"text":"The string to convert","name":"str","type":"string"},{"text":"The type to attempt to convert the string to. This can be `vector`, `angle`, `float`, `int`, `bool`, or `string` (case insensitive).","name":"typename","type":"string"}]},"rets":{"ret":{"text":"The result of the conversion, or nil if a bad type is specified.","name":"","type":"any"}}},"example":{"description":"Creates a vector from a string representation.","code":"local vec = util.StringToType(\"5 6 75\", \"Vector\")","output":"A vector with components **(5, 6, 75)**"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"TableToJSON","parent":"util","type":"libraryfunc","description":{"text":"Converts a table to a JSON string. Keep in mind that not every data type can be stored in the JSON format, notably any entity will not be written, as if it wasn't in the table. Same goes for materials and textures, etc.\n\nSee util.JSONToTable for the opposite function.","warning":"All keys are strings in the JSON format, so all keys of other types will be converted to strings!  \nThis can lead to loss of data where a number key could be converted into an already existing string key! (for example in a table like this: `{[\"5\"] = \"ok\", [5] = \"BBB\"}`)"},"realm":"Shared and Menu","args":{"arg":[{"text":"Table to convert.","name":"table","type":"table"},{"text":"Format and indent the JSON.","name":"prettyPrint","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"A JSON formatted string containing the serialized data","name":"","type":"string"}}},"example":{"description":"Writes the positions and angles of every player to a JSON file called playerstuff.json.","code":"local Players = {}\nfor k, v in ipairs(player.GetAll()) do \n\tPlayers[k] = { pos = v:GetPos(), ang = v:GetAngles() }\nend\n\t\nlocal tab = util.TableToJSON( Players ) -- Convert the player table to JSON\nfile.CreateDir( \"jsontest\" ) -- Create the directory\nfile.Write( \"jsontest/playerstuff.json\", tab) -- Write to .json"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"TableToKeyValues","parent":"util","type":"libraryfunc","description":"Converts the given table into a Valve keyValue formatted string.\n\nUse util.KeyValuesToTable to perform the opposite transformation.\n\nutil.TableToJSON can be used as an alternative.","realm":"Shared and Menu","args":{"arg":[{"text":"The table to convert.","name":"table","type":"table"},{"text":"The root key name for the output KV table.","name":"rootKey","type":"string","default":"TableToKeyValues"}]},"rets":{"ret":{"text":"The output.","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Timer","parent":"util","type":"libraryfunc","description":"Creates a timer object. The returned timer will be already started with given duration.","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/util.lua","line":"217-L226"},"args":{"arg":{"text":"How long you want the timer to be. `Elapsed()` will return true only after this much time has passed.","name":"duration","type":"number","default":"0"}},"rets":{"ret":{"text":"A timer object. It has the following methods:\n* `Reset()` - Resets and stops the timer.\n* `Start( duration = 0 )` - (Re)starts the timer with given duration\n* `Started()` - Returns `true` if the timer has been started. It will continue to return true even after the duration has passed.\n* `Elapsed()` - Returns `true` if the timer duration has elapsed since its creation or the call to `Start()`\n* `GetElaspedTime()` - Returns amount of time since timer started.","name":"","type":"table"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"TimerCycle","parent":"util","type":"libraryfunc","description":"Returns the time since this function has been last called","realm":"Shared and Menu","rets":{"ret":{"text":"Time since this function has been last called in ms","name":"","type":"number"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"tobool","parent":"util","type":"libraryfunc","description":{"text":"Converts string or a number to a bool, if possible. Alias of Global.tobool.","deprecated":"You should use Global.tobool instead."},"realm":"Shared and Menu","file":{"text":"lua/includes/extensions/util.lua","line":"73-L73"},"args":{"arg":{"text":"A string or a number to convert.","name":"input","type":"any"}},"rets":{"ret":{"text":"False if the input is equal to the string or boolean \"false\", if the input is equal to the string or number \"0\", or if the input is nil. Returns true otherwise.","name":"","type":"boolean"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"TraceEntity","parent":"util","type":"libraryfunc","description":"Runs a trace using the entity's collisionmodel between two points. This does not take the entity's angles into account and will trace its unrotated collisionmodel.","realm":"Shared","args":{"arg":[{"text":"Trace data. See Structures/Trace","name":"tracedata","type":"table{Trace}"},{"text":"The entity to use","name":"ent","type":"Entity"}]},"rets":{"ret":{"text":"Trace result. See Structures/TraceResult","name":"","type":"table{TraceResult}"}}},"example":{"description":"From sandbox/gamemode/prop_tools.lua, this checks if there are any entities inside our entity","code":"local trace = { start = ent:GetPos(), endpos = ent:GetPos(), filter = ent }\nlocal tr = util.TraceEntity( trace, ent ) \nif ( tr.Hit ) then\n -- Do stuff\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"TraceEntityHull","parent":"util","type":"libraryfunc","description":"Identical to util.TraceHull but uses an entity's [Axis-Aligned Bounding Box (AABB)](https://en.wikipedia.org/wiki/Minimum_bounding_box) for `mins`/`maxs` inputs. (These 2 keys will be ignored in the provided table)","realm":"Shared","args":{"arg":[{"text":"Trace data. See Structures/HullTrace","name":"tracedata","type":"table{HullTrace}"},{"text":"The entity to use mins/maxs of for the hull trace.","name":"ent","type":"Entity"}]},"rets":{"ret":{"text":"Trace result. See Structures/TraceResult","name":"","type":"table{TraceResult}"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"TraceHull","parent":"util","type":"libraryfunc","description":{"text":"Performs an AABB hull (axis-aligned bounding box, aka not rotated) trace with the given trace data.\n\nThis trace type cannot hit hitboxes.\n\nSee util.TraceLine for a simple line (\"ray\") trace.","note":"This function may not always give desired results clientside due to certain physics mechanisms not existing on the client. Use it serverside for accurate results."},"realm":"Shared","args":{"arg":{"text":"The trace data to use. See Structures/HullTrace","name":"TraceData","type":"table{HullTrace}"}},"rets":{"ret":{"text":"Trace result. See Structures/TraceResult","name":"","type":"table{TraceResult}"}}},"example":[{"description":"Visual representation of a Hull Trace.","code":"function ENT:Draw()\n\n\tself:DrawModel()\n\n\t-- Entity model's bounding box\n\tlocal mins = self:OBBMins()\n\tlocal maxs = self:OBBMaxs()\n\n\tlocal startpos = self:GetPos() -- Origin point for the trace\n\tlocal dir = self:GetUp() -- Direction for the trace, as a unit vector\n\tlocal len = 128 -- Maximum length of the trace\n\n\t-- Perform the trace\n\tlocal tr = util.TraceHull( {\n\t\tstart = startpos,\n\t\tendpos = startpos + dir * len,\n\t\tmaxs = maxs,\n\t\tmins = mins,\n\t\tfilter = self\n\t} )\n\n\t-- Draw a line between start and end of the performed trace\n\trender.DrawLine( tr.HitPos, startpos + dir * len, color_white, true )\n\trender.DrawLine( startpos, tr.HitPos, Color( 0, 0, 255 ), true )\n\n\t-- Choose a color, if the trace hit - make the color red\n\tlocal clr = color_white\n\tif ( tr.Hit ) then clr = Color( 255, 0, 0 ) end\n\n\t-- Draw the trace bounds at the start and end positions\n\trender.DrawWireframeBox( startpos, Angle( 0, 0, 0 ), mins, maxs, Color( 255, 255, 255 ), true )\n\trender.DrawWireframeBox( tr.HitPos, Angle( 0, 0, 0 ), mins, maxs, clr, true )\n\nend","output":{"image":{"src":"HullTrace.gif"}}},{"description":"Trace a player sized hull to detect if a player can spawn here without getting stuck inside anything.","code":"local pos = Entity(1):GetPos() -- Choose your position.\n\nlocal tr = {\n\tstart = pos,\n\tendpos = pos,\n\tmins = Vector( -16, -16, 0 ),\n\tmaxs = Vector( 16, 16, 71 )\n}\n\nlocal hullTrace = util.TraceHull( tr )\nif ( hullTrace.Hit ) then\n    -- Find a new spawnpoint\nend"},{"description":"From a SWEP:PrimaryAttack()","code":"local tr = util.TraceHull( {\n\tstart = self:GetOwner():GetShootPos(),\n\tendpos = self:GetOwner():GetShootPos() + ( self:GetOwner():GetAimVector() * 100 ),\n\tfilter = self:GetOwner(),\n\tmins = Vector( -10, -10, -10 ),\n\tmaxs = Vector( 10, 10, 10 ),\n\tmask = MASK_SHOT_HULL\n} )"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"TraceLine","parent":"util","type":"libraryfunc","description":"Performs an infinitely thin, invisible ray trace (or \"trace\") in a line based on the input and returns a table that contains information about what, if anything, the trace line hit or intersected.\n\nTraces intersect with the physics meshes of solid, server-side, entities (including the game world) but cannot detect client-side only entities unless hitclientonly is set to true.\n  \nSee ents.FindAlongRay if you wish for the trace to not stop on first intersection.  \nSee util.TraceHull for a \"box\" type trace.\n\nTraces do not differentiate between the inside and the outside faces of physics meshes. Because of this, if a trace starts within a solid physics mesh it will hit the inside faces of the physics mesh and may return unexpected values as a result.\n\n\nYou can use `r_visualizetraces` set to `1` (requires `sv_cheats` set to `1`) to visualize traces in real time for debugging purposes.","realm":"Shared","args":{"arg":{"text":"A table of data that configures the trace. See Structures/Trace for available options.","name":"traceConfig","type":"table{Trace}"}},"rets":{"ret":{"text":"A table of information detailing where and what the trace line intersected, or `nil` if the trace is being done before the GM:InitPostEntity hook.\n\n\t\t\tFor the table's format and available options see the Structures/TraceResult page.","name":"","type":"table{TraceResult}"}}},"example":[{"description":"Example usage of various filter methods .","code":"-- This trace will ONLY hit entities that are vehicles using function callback filter\nconcommand.Add( \"test_trace_vehicles\", function( ply )\n\tlocal tr = util.TraceLine( {\n\t\tstart = ply:GetShootPos(),\n\t\tendpos = ply:GetShootPos() + ply:GetAimVector() * 10000,\n\t\tfilter = function( ent ) return ent:IsVehicle() end\n\t} )\n\n\tprint( tr.HitPos, tr.Entity )\nend )\n\n-- This trace will NOT hit entities whose classname is 'prop_physics'.\nconcommand.Add( \"test_trace_not_props\", function( ply )\n\tlocal tr = util.TraceLine( {\n\t\tstart = ply:GetShootPos(),\n\t\tendpos = ply:GetShootPos() + ply:GetAimVector() * 10000,\n\t\tfilter = { \"prop_physics\", ply } -- Also do not hit the player doing the trace\n\t} )\n\n\tprint( tr.HitPos, tr.Entity )\nend )\n\n-- This trace will ONLY hit entities whose classname is 'prop_physics'.\nconcommand.Add( \"test_trace_props\", function( ply )\n\tlocal tr = util.TraceLine( {\n\t\tstart = ply:GetShootPos(),\n\t\tendpos = ply:GetShootPos() + ply:GetAimVector() * 10000,\n\t\tfilter = { \"prop_physics\" },\n\t\twhitelist = true\n\t} )\n\n\tprint( tr.HitPos, tr.Entity )\nend )"},{"description":"Visualizes a trace.","code":"local color_red = Color( 255, 0, 0 )\nlocal color_blu = Color( 0, 0, 255 )\nlocal mins, maxs = Vector( -24, -3, -2 ), Vector( 24, 3, 2 )\n\nhook.Add( \"PostDrawTranslucentRenderables\", \"trace_visualize\", function()\n\tlocal eyePos = Entity( 1 ):EyePos() + Entity( 1 ):GetRight() * -5\n\tlocal eyeDir = Entity( 1 ):GetAimVector()\n\n\tlocal tr = util.TraceLine( {\n\t\tstart = eyePos,\n\t\tendpos = eyePos + eyeDir * 10000,\n\t\tfilter = Entity( 1 )\n\t} )\n\trender.DrawLine( eyePos + LocalPlayer():GetRight() * -5, tr.HitPos, color_red, true )\n\n\t-- Show that the traceline is a line, not a hull\n\trender.DrawWireframeBox( tr.HitPos, Angle( 0, 0, 0 ), mins, maxs, color_red, true )\n\n\teyePos = Entity( 1 ):EyePos() + Entity( 1 ):GetRight() * 5\n\tlocal tr2 = util.TraceHull( {\n\t\tstart = eyePos,\n\t\tendpos = eyePos + eyeDir * 10000,\n\t\tfilter = Entity( 1 ),\n\t\tmins = mins,\n\t\tmaxs = maxs\n\t} )\n\trender.DrawLine( eyePos, tr2.HitPos, color_blu, true )\n\trender.DrawWireframeBox( tr2.HitPos, Angle( 0, 0, 0 ), mins, maxs, color_blu, true )\nend )","output":{"upload":{"src":"70c/8dbdae6fcf05200.png","size":"5612891","name":"image.png"}}},{"description":"Example code that would hit clientside-only entities when ran on client.","code":"if ( CLIENT ) then\n\tconcommand.Add( \"test_cl_trace\", function( ply )\n\t\t\tlocal tr = util.TraceLine( {\n\t\t\t\tstart = ply:GetShootPos(),\n\t\t\t\tendpos = ply:GetShootPos() + ply:GetAimVector() * 10000,\n\t\t\t\tmask = MASK_ALL, -- This is needed to hit ragdolls of dead NPCs/players, since they are considered \"debris\"\n\t\t\t\tfilter = ply, -- Don't hit the player doing the trace\n\t\t\t\thitclientonly = true -- Hit clientside only entites\n\t\t\t} )\n\n\t\t\t-- Display trace results\n\t\t\tPrintTable( tr )\n\n\t\t\t-- With \"developer 1\" enabled, draw the hit position\n\t\t\t-- The timer is necessary because debugoverlay won't work when the game is paused (such as when the console is open)\n\t\t\ttimer.Simple( 0.0, function()\n\t\t\t\tdebugoverlay.Cross( tr.HitPos, 16, 10 )\n\t\t\t\tdebugoverlay.Text( tr.HitPos, \"Hit: \" .. tostring(tr.Entity), 10 )\n\t\t\tend )\n\tend )\nend","output":""}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"TypeToString","parent":"util","type":"libraryfunc","description":"Converts a type to a (nice, but still parsable) string","realm":"Shared and Menu","file":{"text":"lua/includes/extensions/util.lua","line":"127-L144"},"args":{"arg":{"text":"What to convert","name":"input","type":"any"}},"rets":{"ret":{"text":"Converted string","name":"","type":"string"}}},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Create","parent":"vgui","type":"libraryfunc","description":{"text":"Creates a panel by the specified classname.","note":"Custom VGUI elements are not loaded instantly. Use GM:OnGamemodeLoaded to create them on startup."},"realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/scriptedpanels.lua","line":"23-L52"},"args":{"arg":[{"text":"Classname of the panel to create.\n\nDefault panel classnames can be found on the VGUI Element List.\n\nNew panels can be registered via vgui.Register","name":"classname","type":"string"},{"text":"Panel to parent to.","name":"parent","type":"Panel","default":"nil"},{"text":"Custom name of the created panel for scripting/debugging purposes. Can be retrieved with Panel:GetName.","name":"name","type":"string","default":"nil"}]},"rets":{"ret":{"text":"The created panel, or `nil` if creation failed for whatever reason.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CreateFromTable","parent":"vgui","type":"libraryfunc","description":"Creates a panel from a table, used alongside vgui.RegisterFile and vgui.RegisterTable to efficiently define, register, and instantiate custom panels.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/scriptedpanels.lua","line":"54-L72"},"args":{"arg":[{"text":"Your PANEL table.","name":"metatable","type":"table"},{"text":"Which panel to parent the newly created panel to.","name":"parent","type":"Panel","default":"nil"},{"text":"Custom name of the created panel for scripting/debugging purposes. Can be retrieved with Panel:GetName.","name":"name","type":"string","default":"nil"}]},"rets":{"ret":{"text":"The created panel, or `nil` if creation failed for whatever reason.","name":"","type":"Panel"}}},"example":{"code":"local CustomPanel = {\n    Init = function( self )\n        self:SetSize( 200, 100 )\n    end,\n\n    Paint = function( self, w, h )\n        surface.SetDrawColor( 0, 255, 0, 255 )\n        surface.DrawRect( 0, 0, w, h)\n    end,\n}\n\nlocal my_custom_panel = vgui.RegisterTable( CustomPanel, \"Panel\" ) -- Register the panel class from a table\n\nlocal panel = vgui.CreateFromTable( my_custom_panel ) -- Create an instance of the panel\npanel:SetPos( 50, 50 )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CreateX","parent":"vgui","type":"libraryfunc","description":{"text":"Creates an engine panel.","internal":""},"realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/scriptedpanels.lua","line":"13-13"},"args":{"arg":[{"text":"Class of the panel to create","name":"class","type":"string"},{"text":"If specified, parents created panel to given one","name":"parent","type":"Panel","default":"nil"},{"text":"Name of the created panel","name":"name","type":"string","default":"nil"}]},"rets":{"ret":{"text":"Created panel","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CursorVisible","parent":"vgui","type":"libraryfunc","description":"Returns whenever the cursor is currently active and visible.","realm":"Client and Menu","rets":{"ret":{"text":"Whether the cursor is visible or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Exists","parent":"vgui","type":"libraryfunc","file":{"text":"lua/includes/extensions/client/panel/scriptedpanels.lua","line":"19-L21"},"description":"Returns true if Lua-defined panel exists by name. Uses vgui.GetControlTable internally.","realm":"Client and Menu","added":"2023.04.19","args":{"arg":{"text":"The name of the panel to get test.","name":"Panelname","type":"string"}},"rets":{"ret":{"text":"Whether a panel with given name was registered yet or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"FocusedHasParent","parent":"vgui","type":"libraryfunc","description":"Returns whether the currently focused panel is a child of the given one.","realm":"Client and Menu","args":{"arg":{"text":"The parent panel to check the currently focused one against. This doesn't need to be a direct parent (focused panel can be a child of a child and so on).","name":"parent","type":"Panel"}},"rets":{"ret":{"text":"Whether or not the focused panel is a child of the passed one.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetAll","parent":"vgui","type":"libraryfunc","description":"Returns all Lua-created panels.\n\nUsed internally for PANEL:PreAutoRefresh and PANEL:PostAutoRefresh.","realm":"Client and Menu","added":"2024.04.19","rets":{"ret":{"text":"List of all Lua created panels.","name":"","type":"table<Panel>"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetControlTable","parent":"vgui","type":"libraryfunc","description":"Returns the table of a Lua-defined panel by name. Does not return parent members of the table!","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/scriptedpanels.lua","line":"15-L17"},"args":{"arg":{"text":"The name of the panel to get the table of.","name":"Panelname","type":"string"}},"rets":{"ret":{"text":"The `PANEL` table of the a Lua-defined panel with given name.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetHoveredPanel","parent":"vgui","type":"libraryfunc","description":{"text":"Returns the panel the cursor is hovering above.","warning":"This returns a cached value that is only updated after rendering and `before` the next VGUI Think/Layout pass.\n\nie. it lags one frame behind panel layout and is completely unhelpful for PANEL:Paint if your panels are moving around under the mouse a lot every frame."},"realm":"Client and Menu","rets":{"ret":{"text":"The panel that the user is currently hovering over with their cursor.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetKeyboardFocus","parent":"vgui","type":"libraryfunc","description":"Returns the panel which is currently receiving keyboard input.","realm":"Client and Menu","rets":{"ret":{"text":"The panel with keyboard focus","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetWorldPanel","parent":"vgui","type":"libraryfunc","description":"Returns the global world panel which is the parent to all others, except for the HUD panel.\n\nSee also Global.GetHUDPanel.","realm":"Client and Menu","rets":{"ret":{"text":"The world panel","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsHoveringWorld","parent":"vgui","type":"libraryfunc","description":"Returns whenever the cursor is hovering the world panel.","realm":"Client and Menu","rets":{"ret":{"text":"isHoveringWorld","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Register","parent":"vgui","type":"libraryfunc","description":"Registers a panel for later creation via vgui.Create.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/scriptedpanels.lua","line":"74-L98"},"args":{"arg":[{"text":"Classname of the panel to register. This is what you will need to pass to vgui.Create's first argument.\n\nThis must be unique, including classnames of entities due to internal usage of baseclass.Set.","name":"classname","type":"string"},{"text":"The table containing the panel information.","name":"panelTable","type":"table"},{"text":"Classname of a panel to inherit functionality from. Functions with same names will be overwritten preferring the panel that is being registered.","name":"baseName","type":"string","default":"Panel"}]},"rets":{"ret":{"text":"The given panel table from second argument","name":"","type":"table"}}},"example":[{"description":"Defines a Panel named `PanelName` that derives from `DButton`","code":"local PANEL = {}\nPANEL.ColorIdle = Color(255, 0, 0)\nPANEL.ColorHovered = Color(0, 255, 0)\n\nfunction PANEL:Paint(w, h)\n\tlocal color = self.ColorIdle\n\n\tif self:IsHovered() then\n\t\tcolor = self.ColorHovered\n\tend\n\n\tsurface.SetDrawColor(color)\n\tsurface.DrawRect(0, 0, w, h)\nend\n\nvgui.Register(\"PanelName\", PANEL, \"DButton\")"},{"description":"Defines a Panel before adding its methods","code":"local PANEL = vgui.Register(\"PanelName\", {}, \"Panel\")\n\nfunction PANEL:Paint(w, h)\n\tsurface.SetDrawColor(255, 0, 0)\n\tsurface.DrawRect(0, 0, w, h)\nend"}],"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"RegisterFile","parent":"vgui","type":"libraryfunc","description":"Registers a new VGUI panel from a file, to be used with vgui.CreateFromTable.\n\nFile file must use the `PANEL` global that is provided just before the file is Global.included, for example:\n\n\n```\nPANEL.Base = \"Panel\"\n\nfunction PANEL:Init()\n\t-- Your code...\nend\n\nfunction PANEL:Think()\n\t-- Your code...\nend\n```","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/scriptedpanels.lua","line":"112-L129"},"args":{"arg":{"text":"The file to register","name":"file","type":"string"}},"rets":{"ret":{"text":"A table containing info about the panel.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"RegisterTable","parent":"vgui","type":"libraryfunc","description":"Registers a table to use as a panel, to be used with vgui.CreateFromTable.\n\nAll this function does is assigns Base key to your table and returns the table.","realm":"Client and Menu","file":{"text":"lua/includes/extensions/client/panel/scriptedpanels.lua","line":"100-L110"},"args":{"arg":[{"text":"The PANEL table.","name":"panel","type":"table"},{"text":"A base for the panel.","name":"base","type":"string","default":"Panel"}]},"rets":{"ret":{"text":"The PANEL table","name":"","type":"table"}}},"example":{"code":"local CustomPanel = {\n    Init = function( self )\n        self:SetSize( 200, 100 )\n    end,\n\n    Paint = function( self, w, h )\n        surface.SetDrawColor( 0, 255, 0, 255 )\n        surface.DrawRect( 0, 0, w, h)\n    end,\n}\n\nlocal my_custom_panel = vgui.RegisterTable( CustomPanel, \"Panel\" ) -- Register the panel class from a table\n\nlocal panel = vgui.CreateFromTable( my_custom_panel ) -- Create an instance of the panel\npanel:SetPos( 50, 50 )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Record","parent":"video","type":"libraryfunc","description":"Attempts to create an IVideoWriter.","realm":"Client and Menu","args":{"arg":{"text":"The video config. See Structures/VideoData.","name":"config","type":"table"}},"rets":{"ret":[{"text":"The video object. (returns **false** if there is an error)","name":"","type":"IVideoWriter"},{"text":"The error string, if there is an error.","name":"","type":"string"}]}},"example":{"description":"How to create a basic IVideoWriter, and how to use it.","code":"local config = {\n\tcontainer = \"webm\",\n\tvideo = \"vp8\",\n\taudio = \"vorbis\",\n\tquality = 50,\n\tbitrate = 200,\n\tfps = 30,\n\tlockfps = true,\n\tname = \"Test\",\n\twidth = 1280,\n\theight = 720\n}\nlocal iVideoWriter = video.Record( config )\niVideoWriter:SetRecordSound( true )\n\nlocal function Record()\n\tiVideoWriter:AddFrame( FrameTime(), true )\nend\n\nfunction StartRecording()\n\thook.Add( \"DrawOverlay\", \"Record\", Record )\nend\n\nfunction StopRecording()\n\thook.Remove( \"DrawOverlay\", \"Record\" )\n\tiVideoWriter:Finish()\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Get","parent":"weapons","type":"libraryfunc","description":{"text":"Get a `copy` of weapon table by name. This function also inherits fields from the weapon's base class, unlike weapons.GetStored or weapons.GetList.","note":"This will only work on SWEP's, this means that this will not return anything for HL2/HL:S weapons."},"realm":"Shared","file":{"text":"lua/includes/modules/weapons.lua","line":"132-L163"},"args":{"arg":{"text":"Class name of weapon to retrieve","name":"classname","type":"string"}},"rets":{"ret":{"text":"The retrieved table or nil","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetList","parent":"weapons","type":"libraryfunc","description":{"text":"Get a list of all the registered SWEPs. This does not include weapons added to spawnmenu manually.","note":"This function does not inherit fields from the weapon's base class, unlike weapons.Get"},"realm":"Shared","file":{"text":"lua/includes/modules/weapons.lua","line":"177-L185"},"rets":{"ret":{"text":"List of all the registered SWEPs","name":"","type":"table"}}},"example":{"description":"Example structure.","code":"PrintTable( weapons.GetList() )","output":"```\n1:\n\tFolder = weapons/weapon_myweapon\n\tClassName = weapon_myweapon\n\t-- The rest of the SWEP table\n2:\n\tFolder = weapons/weapon_myweapon2\n\tClassName = weapon_myweapon2\n\t-- The rest of the SWEP table\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetStored","parent":"weapons","type":"libraryfunc","description":{"text":"Gets the REAL weapon table, not a copy. The produced table does *not* inherit fields from the weapon's base class, unlike weapons.Get.","warning":"Modifying this table will modify what is stored by the weapons library. Take a copy or use weapons.Get to avoid this."},"realm":"Shared","file":{"text":"lua/includes/modules/weapons.lua","line":"169-L171"},"args":{"arg":{"text":"Weapon class to retrieve weapon table of","name":"weapon_class","type":"string"}},"rets":{"ret":{"text":"The weapon table","name":"","type":"table"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsBasedOn","parent":"weapons","type":"libraryfunc","description":"Checks if name is based on base","realm":"Shared","file":{"text":"lua/includes/modules/weapons.lua","line":"32-L39"},"args":{"arg":[{"text":"Entity's class name to be checked","name":"name","type":"string"},{"text":"Base class name to be checked","name":"base","type":"string"}]},"rets":{"ret":{"text":"Returns true if class name is based on base, else false.","name":"","type":"boolean"}}},"example":{"description":"See if gmod_tool is based on weapon_base, and whether weapon_base is based on itself.","code":"print(weapons.IsBasedOn(\"gmod_tool\", \"weapon_base\"), weapons.IsBasedOn(\"weapon_base\", \"weapon_base\"))","output":"true    \nfalse"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OnLoaded","parent":"weapons","type":"libraryfunc","description":{"text":"Called after all SWEPS have been loaded and runs baseclass.Set on each one.\n\nYou can retrieve all the currently registered SWEPS with weapons.GetList.","internal":"","note":"This is not called after a SWEP auto refresh, and thus the inherited baseclass functions retrieved with baseclass.Get will not be updated"},"realm":"Shared","file":{"text":"lua/includes/modules/weapons.lua","line":"113-L126"}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Register","parent":"weapons","type":"libraryfunc","description":{"text":"Registers a Scripted Weapon (SWEP) class manually. When the engine spawns an entity, weapons registered with this function will be created if the class names match.\n\nSee also scripted_ents.Register for Scripted Entities (SENTs)","bug":{"text":"Sub-tables provided in the first argument will not carry over their metatable, and will receive a BaseClass key if the table was merged with the base's. Userdata references, which includes Vectors, Angles, Entities, etc. will not be copied.","pull":"1300"}},"realm":"Shared","file":{"text":"lua/includes/modules/weapons.lua","line":"46-L106"},"args":{"arg":[{"text":"The SWEP table to register.  \n\t\t\tFor the table's format and available options see the Structures/SWEP page.","name":"ENT","type":"table"},{"text":"Classname to assign to that swep","name":"classname","type":"string"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayerTick","parent":"widgets","type":"libraryfunc","description":{"text":"Automatically called to update all widgets.","internal":""},"realm":"Shared","file":{"text":"lua/includes/modules/widget.lua","line":"92-L105"},"args":{"arg":[{"text":"The player","name":"ply","type":"Player"},{"text":"Player move data","name":"mv","type":"CMoveData"}]}},"example":{"description":"That's how it is used in **lua/includes/modules/widget.lua**","code":"hook.Add( \"PlayerTick\", \"TickWidgets\", function( pl, mv ) widgets.PlayerTick( pl, mv ) end )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RenderMe","parent":"widgets","type":"libraryfunc","description":"Renders a widget. Normally you won't need to call this.","realm":"Client","args":{"arg":{"text":"Widget entity to render","name":"ent","type":"Entity"}},"file":{"text":"lua/includes/modules/widget.lua","line":"114-L130"}},"example":{"description":"Example usage in **lua/entities/widget_base.lua**","code":"function ENT:Draw()\n\n\twidgets.RenderMe( self )\n\t\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"CalcView","parent":"DRIVE","type":"hook","description":"Optionally alter the player's view if they are using this drive mode.\n\nThis hook is called from the default implementation of GM:CalcView which is [here](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/gamemodes/base/gamemode/cl_init.lua#L387-L395). Therefore, it will not be called if any other hook added to `CalcView` returns any value, or if the current gamemode overrides the default hook and does not call drive.CalcView.","realm":"Client","args":{"arg":{"text":"The view, see Structures/CamData. Modify this table.","name":"view_in","type":"table{CamData}"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"EndTouch","parent":"EFFECT","type":"hook","description":"Effect alternative to ENTITY:EndTouch.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTracerShootPos","parent":"EFFECT","type":"hook","description":"Used to get the \"real\" start position of a trace, for weapon tracer effects.\n\n\"real\" meaning in 3rd person, the 3rd person position will be used, in first person the first person position will be used.","realm":"Client","file":{"text":"gamemodes/base/entities/effects/base.lua","line":"5"},"args":{"arg":[{"text":"Default position if we fail","name":"pos","type":"Vector"},{"text":"The weapon to use.","name":"ent","type":"Weapon"},{"text":"Attachment ID of on the weapon \"muzzle\", to use as the start position.","name":"attachment","type":"number","note":"Please note that it is expected that the same attachment ID is used on both, the world and the view model."}]},"rets":{"ret":{"text":"The \"real\" start position.","name":"","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Init","parent":"EFFECT","type":"hook","description":"Called when the effect is created.","realm":"Client","args":{"arg":{"text":"The effect data used to create the effect.","name":"effectData","type":"CEffectData"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PhysicsCollide","parent":"EFFECT","type":"hook","description":"Called when the effect collides with anything.","realm":"Client","args":{"arg":[{"text":"Information regarding the collision. See Structures/CollisionData","name":"colData","type":"table"},{"text":"The physics object of the entity that collided with the effect.","name":"collider","type":"PhysObj"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Render","parent":"EFFECT","type":"hook","description":"Called when the effect should be rendered. \n\n\tWhen not overridden, it will perform default action, which is Entity:DrawModel.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"StartTouch","parent":"EFFECT","type":"hook","description":"Effect alternative to ENTITY:StartTouch.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Think","parent":"EFFECT","type":"hook","description":"Called when the effect should think, return false to kill the effect.","realm":"Client","rets":{"ret":{"text":"Return false to remove this effect.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Touch","parent":"EFFECT","type":"hook","description":"Effect alternative to ENTITY:Touch.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"AcceptInput","parent":"ENTITY","type":"hook","description":"Called when another entity fires an event to this entity.","realm":"Server","args":{"arg":[{"text":"The name of the input that was triggered.","name":"inputName","type":"string"},{"text":"The initial cause for the input getting triggered. (e.g. the player who pushed a button)","name":"activator","type":"Entity"},{"text":"The entity that directly triggered the input. (e.g. the button that was pushed)","name":"caller","type":"Entity"},{"text":"The input parameter.","name":"param","type":"string"}]},"rets":{"ret":{"text":"Should we suppress the default action for this input?\n\nReturning `true` for unknown inputs will also prevent the game complaining about the unknown input in console with `developer 2`.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddOutputFromAcceptInput","parent":"ENTITY","type":"hook","added":"2021.12.15","description":"A helper function for creating Scripted Entities.\n\nSimilar to ENTITY:AddOutputFromKeyValue, call it from ENTITY:AcceptInput and it'll return true if it successfully added an output from the passed input data.","realm":"Server","args":{"arg":[{"text":"The input name from ENTITY:AcceptInput.","name":"name","type":"string"},{"text":"The input data from ENTITY:AcceptInput.","name":"data","type":"string"}]},"rets":{"ret":{"text":"Whether any outputs were added or not.","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"AddOutputFromKeyValue","parent":"ENTITY","type":"hook","added":"2021.12.15","description":"A helper function for creating Scripted Entities.\n\nCall it from ENTITY:KeyValue and it'll return true if it successfully added an output from the passed KV pair.","realm":"Server","args":{"arg":[{"text":"The key-value key.","name":"key","type":"string"},{"text":"The key-value value.","name":"value","type":"string"}]},"rets":{"ret":{"text":"Whether any outputs were added or not.","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"CalcAbsolutePosition","parent":"ENTITY","type":"hook","description":{"text":"Called whenever the entity's position changes. A callback for when an entity's angle changes is available via Entity:AddCallback.\n\nLike ENTITY:RenderOverride, this hook works on any entity (scripted or not) it is applied on.","note":["If EFL_DIRTY_ABSTRANSFORM is set on the entity, this will be called serverside only; otherwise, this will be called clientside only. This means serverside calls of Entity:SetPos without the EFL_DIRTY_ABSTRANSFORM flag enabled (most cases) will be called clientside only.","The give concommand will call this hook serverside only upon entity spawn."]},"realm":"Shared","args":{"arg":[{"text":"The entity's actual position. May differ from Entity:GetPos","name":"pos","type":"Vector"},{"text":"The entity's actual angles. May differ from Entity:GetAngles","name":"ang","type":"Angle"}]},"rets":{"ret":[{"text":"New position","name":"","type":"Vector"},{"text":"New angles","name":"","type":"Angle"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CanEditVariables","parent":"ENTITY","type":"hook","description":"Called by the Sandbox gamemode from the default implementation of GM:CanEditVariable.","realm":"Server","args":{"arg":{"text":"The player is trying to edit a variable on this entity.","name":"ply","type":"Player"}},"rets":{"ret":{"text":"`true` to allow the edit, `false` to disallow.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"CanProperty","parent":"ENTITY","type":"hook","description":{"text":"Controls if a property can be used on this entity or not.\n\nThis hook will only work in Sandbox derived gamemodes that do not have GM:CanProperty overridden.","note":"This hook will work on ALL entities, not just the scripted ones (SENTs)"},"realm":"Shared","file":{"text":"gamemodes/sandbox/gamemode/shared.lua","line":"239-L241"},"args":{"arg":[{"text":"Player, that tried to use the property","name":"ply","type":"Player"},{"text":"Class of the property that is tried to use, for example - bonemanipulate","name":"property","type":"string"}]},"rets":{"ret":{"text":"Return false to disallow using that property, return true to allow.\n\nYou must return a value. Not returning anything can cause unexpected results.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CanTool","parent":"ENTITY","type":"hook","description":{"text":"Controls if a tool can be used on this entity or not.\n\nThis hook will only work in Sandbox derived gamemodes that do not have SANDBOX:CanTool overridden.","note":"This hook will work on ALL entities, not just the scripted ones (SENTs)"},"realm":"Shared","file":{"text":"gamemodes/sandbox/gamemode/shared.lua","line":"73"},"args":{"arg":[{"text":"Player, that tried to use the tool","name":"ply","type":"Player"},{"text":"The trace of the tool.","name":"tr","type":"table{TraceResult}","warning":"Returns only Entity when the 5th argument returns `4`"},{"text":"Class of the tool that is tried to use, for example - `weld`","name":"toolname","type":"string"},{"text":"The tool mode table the player currently has selected.","name":"tool","type":"table"},{"text":"The tool button pressed.\n* 1 - left click\n* 2 - right click\n* 3 - reload\n* 4 - Menu (No interaction with the toolgun)","name":"button","type":"number","warning":"The number `4` is a test that Rubat is conducting to implement the CanTool in the SpawnMenu. It may disappear."}]},"rets":{"ret":{"text":"Return `false` to disallow using that tool on this entity, return `true` to allow.","name":"","type":"boolean"}}},"example":{"description":"Prevents usage of the remover tool on this entity.","code":"function ENT:CanTool( ply, trace, mode, tool, button )\n\n\tif ( mode == \"remover\" ) then return false end\n\n\treturn true\n\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CreateSchedulesInternal","parent":"ENTITY","type":"hook","description":{"text":"Called just before ENTITY:Initialize for \"ai\" type entities only.","internal":""},"realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"DoImpactEffect","parent":"ENTITY","type":"hook","description":{"text":"Called so the entity can override the bullet impact effects it makes. This is called when the entity itself fires bullets via Entity:FireBullets, not when it gets hit.","note":"This hook only works for the `anim` type entities."},"realm":"Shared","args":{"arg":[{"text":"A Structures/TraceResult from the bullet's start point to the impact point","name":"tr","type":"table"},{"text":"The damage type of bullet. See Enums/DMG","name":"damageType","type":"number"}]},"rets":{"ret":{"text":"Return true to not do the default thing - which is to call `UTIL_ImpactTrace` in C++","name":"","type":"boolean"}}},"example":{"description":"Makes the ENT have the AR2 bullet impact effect.","code":"function ENT:DoImpactEffect( tr, nDamageType )\n\n\tif ( tr.HitSky ) then return end\n\t\n\tlocal effectdata = EffectData()\n\teffectdata:SetOrigin( tr.HitPos + tr.HitNormal )\n\teffectdata:SetNormal( tr.HitNormal )\n\tutil.Effect( \"AR2Impact\", effectdata )\n\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DoingEngineSchedule","parent":"ENTITY","type":"hook","description":{"text":"Called by the default `base_ai` SNPC, checking whether `ENT.bDoingEngineSchedule` is set by ENTITY:StartEngineSchedule..","note":"This is a helper function only available if your SENT is based on `base_ai`"},"realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_ai/schedules.lua","line":"193"},"rets":{"ret":{"name":"ENT.bDoingEngineSchedule","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"DoSchedule","parent":"ENTITY","type":"hook","description":{"text":"Runs a Lua schedule. Runs tasks inside the schedule.","note":"This is a helper function only available if your SENT is based on `base_ai`"},"realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_ai/schedules.lua","line":"63"},"args":{"arg":{"text":"The schedule to run.","name":"sched","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Draw","parent":"ENTITY","type":"hook","description":{"text":"Called if and when the entity should be drawn opaquely, based on the Entity:GetRenderGroup of the entity.\n\nSee Structures/ENT and Enums/RENDERGROUP for more information.\n\nSee also ENTITY:DrawTranslucent.","note":"This function will not called if the entity's render bounds are not in player's view. See Entity:SetRenderBounds."},"realm":"Client","args":{"arg":{"text":"The bit flags from Enums/STUDIO","name":"flags","type":"number"}}},"example":{"description":"Draws the model and makes a rotating text over the entity","code":"-- Draw some 3D text\nlocal function Draw3DText( pos, ang, scale, text, flipView )\n\tif ( flipView ) then\n\t\t-- Flip the angle 180 degrees around the UP axis\n\t\tang:RotateAroundAxis( Vector( 0, 0, 1 ), 180 )\n\tend\n\n\tcam.Start3D2D( pos, ang, scale )\n\t\t-- Actually draw the text. Customize this to your liking.\n\t\tdraw.DrawText( text, \"Default\", 0, 0, Color( 0, 255, 0, 255 ), TEXT_ALIGN_CENTER )\n\tcam.End3D2D()\nend\n\nfunction ENT:Draw(flags)\n\t-- Draw the model\n\tself:DrawModel(flags)\n\n\t-- The text to display\n\tlocal text = \"Example Text\"\n\n\t-- The position. We use model bounds to make the text appear just above the model. Customize this to your liking.\n\tlocal mins, maxs = self:GetModelBounds()\n\tlocal pos = self:GetPos() + Vector( 0, 0, maxs.z + 2 )\n\n\t-- The angle\n\tlocal ang = Angle( 0, SysTime() * 100 % 360, 90 )\n\n\t-- Draw front\n\tDraw3DText( pos, ang, 0.2, text, false )\n\t-- DrawDraw3DTextback\n\tDraw3DText( pos, ang, 0.2, text, true )\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawTranslucent","parent":"ENTITY","type":"hook","description":"Called when the entity should be drawn translucently. If your scripted entity has a translucent model, it will be invisible unless it is drawn here.\n\nSee ENTITY:Draw for the opaque rendering alternative to this hook.","realm":"Client","args":{"arg":{"text":"The bit flags from Enums/STUDIO","name":"flags","type":"number"}}},"example":{"description":"The default action for this hook is to call ENTITY:Draw.","code":"function ENT:DrawTranslucent( flags )\n\n\t-- This is here just to make it backwards compatible.\n\t-- You shouldn't really be drawing your model here unless it's translucent\n\n\tself:Draw( flags )\n\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"EndTouch","parent":"ENTITY","type":"hook","description":{"text":"Called when the entity stops touching another entity.\n\nSee ENTITY:StartTouch and ENTITY:Touch for related hooks.","warning":"This only works for **brush** entities and for entities that have Entity:SetTrigger set to true."},"realm":"Server","args":{"arg":{"text":"The entity that we no longer touch.","name":"entity","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"EngineScheduleFinish","parent":"ENTITY","type":"hook","description":{"text":"Called whenever an engine schedule is finished; either the last task within the engine schedule has been finished or the schedule has been interrupted by an interrupt condition.","note":["This hook only exists for `ai` type [SENTs](Scripted_Entities).","This hook isn't called when the engine schedule is failed, the schedule is cleared with NPC:ClearSchedule or NPC:SetSchedule has been called."]},"realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"ExpressionFinished","parent":"ENTITY","type":"hook","realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_ai/init.lua","line":"94"},"description":{"text":"Called when an NPC's expression has finished.","note":"This hook only exists for `ai` type [SENTs](Scripted_Entities)."},"args":{"arg":{"text":"The path of the expression.","name":"strExp","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"FireAnimationEvent","parent":"ENTITY","type":"hook","description":{"text":"Called before firing clientside animation events, such as muzzle flashes or shell ejections.\n\nSee ENTITY:HandleAnimEvent for the serverside version.","note":"This hook only works on \"anim\", \"nextbot\" and \"ai\" type entities."},"realm":"Client","args":{"arg":[{"text":"Position of the effect","name":"pos","type":"Vector"},{"text":"Angle of the effect","name":"ang","type":"Angle"},{"text":"The event ID of happened even. See [this page](http://developer.valvesoftware.com/wiki/Animation_Events). Only event IDs above 5000 will appear in this hook. (Are considered the \"new\" system in-engine)","name":"event","type":"number"},{"text":"Name of the event","name":"name","type":"string"}]},"rets":{"ret":{"text":"Return true to disable the effect","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetAttackSpread","parent":"ENTITY","type":"hook","description":{"text":"Called to determine how good an NPC is at using a particular weapon.","note":"\"ai\" base only"},"realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_ai/init.lua","line":"135"},"args":{"arg":[{"text":"The weapon being used by the NPC.","name":"wep","type":"Weapon"},{"text":"The target the NPC is attacking","name":"target","type":"NPC"}]},"rets":{"ret":{"text":"The number of degrees of inaccuracy in the NPC's attack.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetRelationship","parent":"ENTITY","type":"hook","file":{"text":"gamemodes/base/entities/entities/base_ai/init.lua","line":"84"},"description":{"text":"Called when scripted NPC needs to check how he \"feels\" against another entity, such as when NPC:Disposition is called.","note":"Scripted NPCs will not select other entities using same Entity:GetModel as this Scripted NPC's Entity:GetModel as enemy, unless NPC:AddEntityRelationship is cast."},"realm":"Server","args":{"arg":{"text":"The entity in question","name":"ent","type":"Entity"}},"rets":{"ret":{"text":"How our scripter NPC \"feels\" towards the entity in question. See Enums/D. Not returning any value will make NPC:Disposition return the default disposition for this SNPC's given `m_iClass` by the engine.","name":"","type":"number{D}"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetRenderMesh","parent":"ENTITY","type":"hook","description":{"text":"Specify a mesh that should be rendered instead of this SENT's model.","note":"You should not be creating or modifying an IMesh in this hook. [Reference](https://github.com/Facepunch/garrysmod-issues/issues/6411#issuecomment-3070608549)"},"realm":"Client","rets":{"ret":{"text":"A table containing the following keys:\n* IMesh Mesh - (Required) The mesh to render instead of the default model\n* IMaterial Material - (Required) The material to render the mesh with.\n* VMatrix Matrix - (Optional) - Render matrix override (mesh position, angles, etc)","name":"","type":"table"}}},"example":{"description":"A box that renders nicely with ambient lighting, projected textures, and bumpmaps. Performed in the most lines of code possible.","code":"AddCSLuaFile()\n\nDEFINE_BASECLASS( \"base_anim\" )\n\nENT.PrintName = \"Other Cube\"\nENT.Spawnable = true\n\nENT.Mins = Vector( -16, -16, -16 )\nENT.Maxs = Vector(  16,  16,  16 )\n\nENT.Material = Material( \"hunter/myplastic\" )\n\nfunction ENT:SpawnFunction( ply, tr, ClassName )\n    local ent = ents.Create( ClassName )\n    ent:SetPos( tr.HitPos + tr.HitNormal * 32 )\n    ent:Spawn()\n    return ent\nend\n\nfunction ENT:Initialize()\n    if CLIENT then\n        self:CreateMesh()\n        self:SetRenderBounds( self.Mins, self.Maxs )\n    end\n\n    self:DrawShadow( false )\nend\n\nfunction ENT:GetRenderMesh()\n    return { Mesh = self.Mesh, Material = self.Material }\nend\n\nfunction ENT:CreateMesh()\n    self.Mesh = Mesh()\n\n    local positions = {\n        Vector( -0.5, -0.5, -0.5 ),\n        Vector(  0.5, -0.5, -0.5 ),\n        Vector( -0.5,  0.5, -0.5 ),\n        Vector(  0.5,  0.5, -0.5 ),\n        Vector( -0.5, -0.5,  0.5 ),\n        Vector(  0.5, -0.5,  0.5 ),\n        Vector( -0.5,  0.5,  0.5 ),\n        Vector(  0.5,  0.5,  0.5 ),\n    };\n\n    local indices = {\n        1, 7, 5,\n        1, 3, 7,\n        6, 4, 2,\n        6, 8, 4,\n        1, 6, 2,\n        1, 5, 6,\n        3, 8, 7,\n        3, 4, 8,\n        1, 4, 3,\n        1, 2, 4,\n        5, 8, 6,\n        5, 7, 8,\n    }\n\n    local normals = {\n       Vector( -1,  0,  0 ),\n       Vector(  1,  0,  0 ),\n       Vector(  0, -1,  0 ),\n       Vector(  0,  1,  0 ),\n       Vector(  0,  0, -1 ),\n       Vector(  0,  0,  1 ),\n    }\n\n    local tangents = {\n        { 0, 1, 0, -1 },\n        { 0, 1, 0, -1 },\n        { 0, 0, 1, -1 },\n        { 1, 0, 0, -1 },\n        { 1, 0, 0, -1 },\n        { 0, 1, 0, -1 },\n    }\n\n    local uCoords = {\n       0, 1, 0,\n       0, 1, 1,\n       0, 1, 0,\n       0, 1, 1,\n       0, 1, 0,\n       0, 1, 1,\n       0, 1, 0,\n       0, 1, 1,\n       0, 1, 0,\n       0, 1, 1,\n       0, 1, 0,\n       0, 1, 1,\n    }\n\n    local vCoords = {\n       0, 1, 1,\n       0, 0, 1,\n       0, 1, 1,\n       0, 0, 1,\n       0, 1, 1,\n       0, 0, 1,\n       0, 1, 1,\n       0, 0, 1,\n       0, 1, 1,\n       0, 0, 1,\n       0, 1, 1,\n       0, 0, 1,\n    }\n\n    local verts = {}\n    local scale = self.Maxs - self.Mins\n\n    for vert_i = 1, #indices do\n        local face_i = math.ceil( vert_i / 6 )\n\n        verts[vert_i] = {\n            pos = positions[indices[vert_i]] * scale,\n            normal = normals[face_i],\n            u = uCoords[vert_i],\n            v = vCoords[vert_i],\n            userdata = tangents[face_i]\n        }\n    end\n    \n    self.Mesh:BuildFromTriangles( verts )\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetShadowCastDirection","parent":"ENTITY","type":"hook","description":"Called when the shadow needs to be recomputed. Allows shadow angles to be customized. This only works for `anim` type entities.","realm":"Client","args":{"arg":{"text":"Type of the shadow this entity uses. Possible values:\n* 0 - No shadow\n* 1 - Simple 'blob' shadow\n* 2 - Render To Texture shadow (updates only when necessary)\n* 3 - Dynamic RTT - updates always\n* 4 - Render to Depth Texture","name":"type","type":"number"}},"rets":{"ret":{"text":"The new shadow direction to use.","name":"dir","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetSoundInterests","parent":"ENTITY","type":"hook","added":"2021.06.09","description":{"text":"Called every second to poll the sound hint interests of this SNPC. This is used in conjunction with other sound hint functions, such as sound.EmitHint and NPC:GetBestSoundHint.","note":"This hook only exists for `ai` type SENTs"},"realm":"Server","rets":{"ret":{"text":"A bitflag representing which sound types this NPC wants to react to.  See SOUND_ enums.","name":"types","type":"number"}}},"example":{"description":"React to player footstep sounds.","code":"function ENT:GetSoundInterests(  )\n\treturn SOUND_WORLD + SOUND_PLAYER \nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"GravGunPickupAllowed","parent":"ENTITY","type":"hook","description":"Called by GM:GravGunPickupAllowed on ALL entites in Sandbox-derived  gamemodes and acts as an override.","realm":"Server","args":{"arg":{"text":"The player aiming at us","name":"ply","type":"Player"}},"rets":{"ret":{"text":"Return true to allow the entity to be picked up","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GravGunPunt","parent":"ENTITY","type":"hook","description":"Called when this entity is about to be punted with the gravity gun (primary fire).\n\nOnly works in Sandbox derived gamemodes and only if GM:GravGunPunt is not overridden.","realm":"Shared","args":{"arg":{"text":"The player pressing left-click with the gravity gun at an entity","name":"ply","type":"Player"}},"rets":{"ret":{"text":"Return true or false to enable or disable punting respectively.","name":"","type":"boolean"}}},"example":{"description":"Enables a scripted entity to be punted even when frozen.","code":"function ENT:GravGunPunt( ply )\n\tself:PhysWake()\n\treturn true\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"HandleAnimEvent","parent":"ENTITY","type":"hook","description":{"text":"Called before firing serverside animation events, such as weapon reload, drawing and holstering for NPCs, scripted sequences, etc.\n\nSee ENTITY:FireAnimationEvent for the clientside version.","note":"This hook only works on \"anim\", \"ai\" and \"nextbot\" type entities."},"realm":"Server","args":{"arg":[{"text":"The ID of the event. See [this page](http://developer.valvesoftware.com/wiki/Animation_Events) for a list of default events, and see util.GetAnimEventNameByID for a helper function in handing custom events.","name":"event","type":"number"},{"text":"The absolute time this event occurred using Global.CurTime.","name":"eventTime","type":"number"},{"text":"The frame this event occurred as a number between 0 and 1.","name":"cycle","type":"number"},{"text":"Event type. See [the Source SDK](https://github.com/ValveSoftware/source-sdk-2013/blob/master/src/game/shared/eventlist.h#L14-L23).","name":"type","type":"number"},{"text":"Name or options of this event.","name":"options","type":"string"}]},"rets":{"ret":{"text":"Return true to mark the event as handled.","name":"","type":"boolean"}}},"example":{"description":"Handle a custom animation event.\n\nThe .qc of the model would look something like this:\n```\n$sequence my_sequence_name \"my_smd_name\" ..... { \n\t { event MY_CUSTOM_ANIM_EVENT 2 \"my custom options\" } \n}\n```","code":"function ENT:HandleAnimEvent( event, eventTime, cycle, type, options )\n\n\tif ( util.GetAnimEventNameByID( event ) == \"MY_CUSTOM_ANIM_EVENT\" ) then\n\t\tprint( \"Do something...\" )\n\t\treturn true\n\tend\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"ImpactTrace","parent":"ENTITY","type":"hook","description":"Called when a bullet trace hits this entity and allows you to override the default behavior by returning true.","realm":"Client","args":{"arg":[{"text":"The trace that hit this entity as a Structures/TraceResult.","name":"traceResult","type":"table"},{"text":"The damage bits associated with the trace, see Enums/DMG","name":"damageType","type":"number"},{"text":"The effect name to override the impact effect with.\nPossible arguments are ImpactJeep, AirboatGunImpact, HelicopterImpact, ImpactGunship.","name":"customImpactName","type":"string","default":"nil"}]},"rets":{"ret":{"text":"Return true to override the default impact effects.","name":"","type":"boolean"}}},"example":{"description":"Hides the original bullet impact effect and dispatches explosions instead.","code":"function ENT:ImpactTrace(trace,dmgtype,customimpactname)\n\tlocal effectdata = EffectData()\n\teffectdata:SetOrigin( trace.HitPos )\n\tutil.Effect( \"Explosion\", effectdata )\n\treturn true\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Initialize","parent":"ENTITY","type":"hook","description":"Called when the entity is created. This is called when you Entity:Spawn the custom entity.\n\nThis is called **after** ENTITY:SetupDataTables and GM:OnEntityCreated.","realm":"Shared"},"example":{"description":"Example Initialize function","code":"function ENT:Initialize()\n\t-- Sets what model to use\n\tself:SetModel( \"models/props/cs_assault/money.mdl\" )\n\n\t-- Sets what color to use\n\tself:SetColor( Color( 200, 255, 200 ) )\n\n\t-- Physics stuff\n\tself:SetMoveType( MOVETYPE_VPHYSICS )\n\tself:SetSolid( SOLID_VPHYSICS )\n\n\t-- Init physics only on server, so it doesn't mess up physgun beam\n\tif ( SERVER ) then self:PhysicsInit( SOLID_VPHYSICS ) end\n\t\n\t-- Make prop to fall on spawn\n\tself:PhysWake()\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"IsJumpLegal","parent":"ENTITY","type":"hook","description":{"text":"Called when deciding if the Scripted NPC should be able to perform a certain jump or not.","note":"This is only called for \"ai\" type entities"},"realm":"Server","args":{"arg":[{"text":"Start of the jump","name":"startPos","type":"Vector"},{"text":"Apex point of the jump","name":"apex","type":"Vector"},{"text":"The landing position","name":"endPos","type":"Vector"}]},"rets":{"ret":{"text":"Return true if this jump should be allowed to be performed, false otherwise.\n\nNot returning anything, or returning a non boolean will perform the [default action](https://github.com/ValveSoftware/source-sdk-2013/blob/master/src/game/server/ai_basenpc_movement.cpp#L319).","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"KeyValue","parent":"ENTITY","type":"hook","description":"Called when the engine sets a value for this scripted entity.\n\nThis hook is called **before** ENTITY:Initialize when the key-values are set by the map.\n\nOtherwise this hook will be called whenever Entity:SetKeyValue is called on the entity.\n\nSee GM:EntityKeyValue for a hook that works for all entities.\n\nSee WEAPON:KeyValue for a hook that works for scripted weapons.","realm":"Server","args":{"arg":[{"text":"The key that was affected.","name":"key","type":"string"},{"text":"The new value.","name":"value","type":"string"}]},"rets":{"ret":{"text":"Return true to suppress this KeyValue or return false or nothing to apply this key value.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"NextTask","parent":"ENTITY","type":"hook","description":{"text":"Start the next task in specific Lua schedule.","note":"This is a helper function only available if your SENT is based on `base_ai`"},"realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_ai/schedules.lua","line":"108"},"args":{"arg":{"text":"The schedule to start next task in.","name":"sched","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnChangeActiveWeapon","parent":"ENTITY","type":"hook","added":"2021.01.27","description":{"text":"Called when the currently active weapon of the SNPC changes.","note":"This hook only works on `ai` type entities."},"realm":"Server","args":{"arg":[{"text":"The previous active weapon.","name":"old","type":"Weapon"},{"text":"The new active weapon.","name":"new","type":"Weapon"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnChangeActivity","parent":"ENTITY","type":"hook","description":{"text":"Called when the NPC has changed its activity.","note":"This hook only works for `ai` type entities."},"realm":"Server","added":"2020.06.24","args":{"arg":{"text":"The new activity. See Enums/ACT.","name":"act","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnCondition","parent":"ENTITY","type":"hook","description":{"text":"Called each time the NPC updates its condition.","note":"This hook only exists for `ai` type [SENTs](Scripted_Entities)."},"realm":"Server","args":{"arg":{"text":"The ID of condition. See NPC:ConditionName.","name":"conditionID","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnDuplicated","parent":"ENTITY","type":"hook","description":"Called on any entity after it has been created by the duplicator and before any bone/entity modifiers have been applied.\n\nThis hook is called after ENTITY:Initialize and before ENTITY:PostEntityPaste.","realm":"Server","args":{"arg":{"text":"The stored data about the original entity that was duplicated. This would typically contain the Entity:GetTable fields that are serializalble. See Structures/EntityCopyData.","name":"entTable","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnEntityCopyTableFinish","parent":"ENTITY","type":"hook","description":"Called after duplicator finishes saving the entity, allowing you to modify the save data.\n\nThis is called after ENTITY:PostEntityCopy.","realm":"Server","args":{"arg":{"text":"The save Structures/EntityCopyData that you can modify.","name":"data","type":"table"}}},"example":{"description":"Prevent this entity from being copied and subsequently pasted.","code":"function ENT:OnEntityCopyTableFinish( data )\n\tfor k, v in pairs( data ) do data[ k ] = nil end\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnMovementComplete","parent":"ENTITY","type":"hook","added":"2021.01.27","description":{"text":"Called when the SNPC completes its movement to its destination.","note":"This hook only works on `ai` type entities."},"realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnMovementFailed","parent":"ENTITY","type":"hook","added":"2021.01.27","description":{"text":"Called when the SNPC failed to move to its destination.","note":"This hook only works on `ai` type entities."},"realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnReloaded","parent":"ENTITY","type":"hook","description":"Called when the entity is reloaded by the lua auto-refresh system, i.e. when the developer edits the lua file for the entity while the game is running.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"text":"# Clientside behaviour remarks\n\nThis hook may be called at odd times (when entity has actually not yet been removed from the server). This happens during the \"full update\" mechanism with the ENTITY:Initialize function not being called even when the entity reappears. Such calls can be differentiated via the `fullUpdate` argument of this hook.\nYou can debug this behaviour by enabling `sv_cheats` and running `cl_fullupdate` on the client.\n\nGM:NotifyShouldTransmit can be used to circumvent this problem. ENTITY:Think can also be used to detect that the entity has reappeared. You may reinitialize any necessary data in these hooks. Another way to fix this problem can be found below.","function":{"name":"OnRemove","parent":"ENTITY","type":"hook","description":{"text":"Called when the entity is about to be removed.\n\nSee also Entity:CallOnRemove, which can even be used on engine (non-Lua) entities.","example":{"description":"Create an explosion when the entity will be removed. To create an entity, you can read ents.Create.","code":"function ENT:OnRemove()\n\tlocal explosion = ents.Create( \"env_explosion\" ) -- The explosion entity\n\texplosion:SetPos( self:GetPos() ) -- Put the position of the explosion at the position of the entity\n\texplosion:Spawn() -- Spawn the explosion\n\texplosion:SetKeyValue( \"iMagnitude\", \"50\" ) -- the magnitude of the explosion\n\texplosion:Fire( \"Explode\", 0, 0 ) -- explode\nend"}},"realm":"Shared","args":{"arg":{"text":"Whether the removal is happening due to a full update clientside.\n\nThe entity may or **may not** be recreated immediately after, depending on whether it is in the local player's [PVS](https://developer.valvesoftware.com/wiki/PVS \"PVS - Valve Developer Community\"). (See Entity:IsDormant)","name":"fullUpdate","type":"boolean"}}},"example":{"description":"Another way to circumvent the problem where the client thinks the entity is removed even though it has not is to test if the entity is valid using a tick delay.","code":"function ENT:OnRemove()\n\ttimer.Simple( 0, function()\n\t\tif not IsValid( self ) then\n\t\t\t-- Your remove code here\n\t\tend\n\tend)\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OnRestore","parent":"ENTITY","type":"hook","description":"Called when the entity is reloaded from a Source Engine save (not the Sandbox saves or dupes) or on a changelevel (for example Half-Life 2 campaign level transitions).\n\nFor the duplicator callbacks, see ENTITY:OnDuplicated.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OnStateChange","parent":"ENTITY","type":"hook","added":"2023.12.07","description":{"text":"Called by the engine when NPC's state changes.","note":"This hook only exists for `ai` type SENTs."},"realm":"Server","args":{"arg":[{"text":"The old state. See Enums/NPC_STATE.","name":"oldState","type":"number"},{"text":"The new state. See Enums/NPC_STATE.","name":"newState","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnTakeDamage","parent":"ENTITY","type":"hook","description":{"text":"Called when the entity is taking damage.","warning":"Calling Entity:TakeDamage, Entity:TakeDamageInfo, Entity:DispatchTraceAttack, or Player:TraceHullAttack (if the entity is hit) in this hook on the victim entity can cause infinite loops since the hook will be called again. Make sure to setup recursion safeguards like the example below.","note":"This hook is only called for `ai`, `nextbot` and `anim` type entities."},"realm":"Server","args":{"arg":{"text":"The damage to be applied to the entity.","name":"damage","type":"CTakeDamageInfo"}},"rets":{"ret":{"text":"How much damage the entity took. Basically `> 0` means took damage, `0` means did not take damage.","type":"number"}}},"example":{"description":"All damage taken by this entity is applied twice. This will count the damage taken as two distinctive hits as opposed to just scaling it in GM:EntityTakeDamage.","code":"function ENT:OnTakeDamage( dmginfo )\n\t-- Make sure we're not already applying damage a second time\n\t-- This prevents infinite loops\n\tif ( not self.m_bApplyingDamage ) then\n\t\tself.m_bApplyingDamage = true\n\t\tself:TakeDamageInfo( dmginfo )\n\t\tself.m_bApplyingDamage = false\n\tend\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnTaskComplete","parent":"ENTITY","type":"hook","description":{"text":"Called from the engine when TaskComplete is called.\nThis allows us to move onto the next task - even when TaskComplete was called from an engine side task.","note":"This hook only exists for `ai` type [SENTs](Scripted_Entities)."},"realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnTaskFailed","parent":"ENTITY","type":"hook","description":{"text":"Called when a task this NPC was running has failed for whatever reason.","note":"This hook only exists for `ai` type [SENTs](Scripted_Entities)."},"realm":"Server","added":"2023.10.09","args":{"arg":[{"text":"The fail code for the task. It will be a [FAIL_ enum](https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/game/server/ai_task.h#L26) or a generated code for a custom string. (second argument)","name":"failCode","type":"number"},{"text":"If set, a custom reason for the failure.","name":"failReason","type":"string"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnTraceAttack","parent":"ENTITY","type":"hook","added":"2026.07.03","description":{"text":"Called when a trace attack is done against the entity, allowing override of the damage being dealt by altering the CTakeDamageInfo.\n\nThis is called before ENTITY:OnTakeDamage.","note":"This hook is only called for `ai`, `nextbot` and `anim` type entities."},"realm":"Server","args":{"arg":[{"text":"The damage info","name":"info","type":"CTakeDamageInfo"},{"text":"The direction the damage goes in","name":"dir","type":"Vector"},{"text":"The Structures/TraceResult of the attack, containing the hitgroup.","name":"trace","type":"table"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OverrideMove","parent":"ENTITY","type":"hook","added":"2023.12.06","description":{"text":"Called to completely override NPC movement. This can be used for example for flying NPCs.","note":"This hook only exists for `ai` type SENTs."},"realm":"Server","args":{"arg":{"text":"Time interval for the movement, in seconds. Usually time since last movement.","name":"interval","type":"number"}},"rets":{"ret":{"text":"Return `true` to disable the default movement code.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OverrideMoveFacing","parent":"ENTITY","type":"hook","added":"2023.12.06","description":{"text":"Called to completely override the direction NPC will be facing during navigation.","note":["This hook only exists for `ai` type SENTs.","This hook is called by the default movement hook. Returning `true` inside ENTITY:OverrideMove will prevent engine from calling this hook."]},"realm":"Server","args":{"arg":[{"text":"Time interval for the movement, in seconds. Usually time since last movement.","name":"interval","type":"number"},{"text":"Extra data for the movement. A table containing the following data:\n* boolean hasTraced - The result if a forward probing trace has been done\n* number expectedDist = `speed*interval` - The distance expected to move this think\n* number flags - [AILMG flags](https://github.com/ValveSoftware/source-sdk-2013/blob/master/src/game/server/ai_movetypes.h#L113)\n* number maxDist = NPC:GetPathDistanceToGoal - The distance maximum distance intended to travel in path length\n* number navType - Enums/NAV\n* number speed - Entity:GetSequenceGroundSpeed Note these need not always agree with `target`\n* Entity moveTarget = `m_hGoalEnt` - Target entity as goal. \n* Vector dir - The step direction, towards `target` \n* Vector facing - The direction NPC's body will turn during movement. \n* Vector target = NPC:GetCurWaypointPos - Current waypoint in world coordinates.","name":"AILMG","type":"table"}]},"rets":{"ret":{"text":"Return `true` to disable the default movement facing code.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PassesTriggerFilters","parent":"ENTITY","type":"hook","description":{"text":"Polls whenever the entity should trigger the brush.","warning":"This hook is broken and will not work without code below"},"realm":"Server","args":{"arg":{"text":"The entity that is about to trigger.","name":"ent","type":"Entity"}},"rets":{"ret":{"text":"Should trigger or not.","name":"","type":"boolean"}}},"example":{"description":"How this is supposed to work internally","code":"ENT.Entities = {}\n\nfunction ENT:IsTouchedBy( ent )\n\treturn table.HasValue( self.Entities, ent )\nend\n\nfunction ENT:StartTouch( ent )\n\tif ( !self:PassesTriggerFilters( ent ) ) then return end\n\ttable.insert( self.Entities, ent )\n\n\t/* Code */\nend\n\nfunction ENT:Touch( ent )\n\tif ( !self:PassesTriggerFilters( ent ) ) then return end\n\tif ( !table.HasValue( ent ) ) then table.insert( self.Entities, ent ) end\n\n\t/* Code */\nend\n\nfunction ENT:EndTouch( ent )\n\tif ( !self:IsTouchedBy( ent ) ) then return end\n\ttable.RemoveByValue( self.Entities, ent )\n\n\t/* Code */\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PhysicsCollide","parent":"ENTITY","type":"hook","description":{"text":"Called when the entity collides with anything via [physics objects](PhysObj). The [move type](Enums/MOVETYPE) and [solid mode](Enums/SOLID) must be `VPHYSICS` for the hook to be called.  \nThis hook only works for `anim` type entities.\n\nThis is different from ENTITY:Touch.","note":"If you want to use this hook on default/engine/non-Lua entities (like `prop_physics`), use Entity:AddCallback instead! This page describes a hook for Lua scripted entities"},"realm":"Server","args":{"arg":[{"text":"Information regarding the collision. See Structures/CollisionData.","name":"colData","type":"table"},{"text":"The physics object that collided.","name":"collider","type":"PhysObj"}]}},"example":{"description":"Play a sound when we hit something.","code":"function ENT:PhysicsCollide( data, phys )\n\tif ( data.Speed > 50 ) then self:EmitSound( Sound( \"Flashbang.Bounce\" ) ) end\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PhysicsSimulate","parent":"ENTITY","type":"hook","description":{"text":"Called from the Entity's motion controller to simulate physics.\n\nThis will only be called after using Entity:StartMotionController on a scripted entity of `anim` type.","note":"This hook can work on the CLIENT if you call Entity:StartMotionController and use Entity:AddToMotionController on the physics objects you want to control","warning":"Do not use functions such as PhysObj:EnableCollisions or PhysObj:EnableGravity in this hook as they're very likely to crash your game. You may want to use ENTITY:PhysicsUpdate instead."},"realm":"Shared","args":{"arg":[{"text":"The physics object of the entity.","name":"phys","type":"PhysObj"},{"text":"Time since the last call.","name":"deltaTime","type":"number"}]},"rets":{"ret":[{"text":"Angular force. The 3rd argument must be above SIM_NOTHING.","name":"","type":"Vector"},{"text":"Linear force. The 3rd argument must be above SIM_NOTHING.","name":"","type":"Vector"},{"text":"One of the Enums/SIM.","name":"","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PhysicsUpdate","parent":"ENTITY","type":"hook","description":"Called whenever a physics object of this entity is updated.\n\nThis hook won't be called if the Entity's PhysObj goes asleep, or doesn't exist.","realm":"Shared","args":{"arg":{"text":"The physics object of the entity.","name":"phys","type":"PhysObj"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PostEntityCopy","parent":"ENTITY","type":"hook","description":"Called after the duplicator finished copying the entity.\n\nSee also ENTITY:PreEntityCopy, ENTITY:PostEntityPaste and ENTITY:OnEntityCopyTableFinish.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PostEntityPaste","parent":"ENTITY","type":"hook","description":"Called after the duplicator pastes the entity, after the bone/entity modifiers have been applied to the entity.\n\nThis hook is called after ENTITY:OnDuplicated. See also ENTITY:PreEntityCopy.","realm":"Server","args":{"arg":[{"text":"The player who pasted the entity.","name":"ply","type":"Player","warning":"This may not be a valid player in some circumstances. For example, when a save is loaded from the main menu, this hook will be called before the player is spawned. This argument will be a NULL entity in that case."},{"text":"The entity itself. Same as `self` within the function context.","name":"ent","type":"Entity"},{"text":"All entities that are within the placed dupe.","name":"createdEntities","type":"table","note":"The keys of each value in this table are the original entity indexes when the duplication was created. This can be utilized to restore entity references that don't get saved in duplications."}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PreEntityCopy","parent":"ENTITY","type":"hook","description":"Called before the duplicator copies the entity.\n\nIf you are looking for a way to make the duplicator spawn another entity when duplicated. (For example, you duplicate a `prop_physics`, but you want the duplicator to spawn `prop_physics_my`), you should add `prop_physics.ClassOverride = \"prop_physics_my\"`. The duplication table should be also stored on that `prop_physics`, not on `prop_physics_my`.\n\nSee also ENTITY:PostEntityCopy.","realm":"Server"},"example":{"description":"Example on how to store values for duplicator, and then restore them afterwards","code":"-- Store the value for duplicator\nfunction ENT:PreEntityCopy()\n\tself.MyDuplicatorVariasble = self:GetSequence()\nend\n\n-- Restore the saved value\nfunction ENT:PostEntityPaste()\n\t-- Always validate data before using it\n\tif ( !self.MyDuplicatorVariasble ) then return end\n\n\tself:ResetSequence( self.MyDuplicatorVariasble )\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"RenderOverride","parent":"ENTITY","type":"hook","description":{"text":"Called instead of the engine drawing function of the entity. This hook works on any entity (scripted or not) it is applied on.\n\nThis does not work on \"physgun_beam\", use GM:DrawPhysgunBeam instead.","bug":[{"text":"Drawing a viewmodel in this function will cause GM:PreDrawViewModel, WEAPON:PreDrawViewModel, WEAPON:ViewModelDrawn, GM:PostDrawViewModel, and WEAPON:PostDrawViewModel to be called twice.","issue":"3292"},{"text":"This is called before PrePlayerDraw for players. If this function exists at all on a player, their worldmodel will always be rendered regardless of PrePlayerDraw's return.","issue":"3299"}]},"realm":"Client","args":{"arg":{"text":"The STUDIO_ flags for this render operation.","name":"flags","type":"number"}}},"example":{"description":"Set the entity the player is looking at to not draw if the player is its owner.","code":"local function DontDrawMe( self )\n\tif ( self:GetOwner() == LocalPlayer() ) then\n\t\treturn\n\tend\n\t\n\tself:DrawModel()\nend\n\nlocal pickent = LocalPlayer():GetEyeTrace().Entity\n\nif ( IsValid( pickent ) ) then\n\tpickent.RenderOverride = DontDrawMe\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"ResolveCustomFlyCollision","parent":"ENTITY","type":"hook","added":"2026.04.08","description":{"text":"Called during a non-VPhysics collision event for flying entities. \n\nThis is best used to make projectiles bounce off from surfaces in their own way. For this to be triggered, this entity must be the one that's colliding, have some velocity, Entity:GetMoveType must be either MOVETYPE_FLY or MOVETYPE_FLYGRAVITY, and Entity:GetMoveCollide must be MOVECOLLIDE_FLY_CUSTOM.","note":"This works only on `anim` type entities."},"realm":"Server","args":{"arg":[{"text":"The Structures/TraceResult where the collision occured.","name":"traceResult","type":"table{TraceResult}"},{"text":"The calculated velocity after calculations such as bounciness, elasticity, ground sliding etc...","name":"vel","type":"vector"}]},"rets":{"ret":{"text":"Return `true` to prevent default action.","type":"boolean"}}},"example":[{"description":"A rocket model which directly reflects off from surfaces without any velocity loss, similar to `sent_ball`.","code":"AddCSLuaFile()\n\nENT.Base = \"base_anim\"\nENT.Type = \"anim\"\nENT.PrintName = \"Bouncy Rocket\"\nENT.Category = \"Other\"\n\nENT.Editable = true\nENT.Spawnable = true\nENT.AdminOnly = true\nENT.RenderGroup = RENDERGROUP_TRANSLUCENT\nENT.PhysicsSolidMask = MASK_SOLID + CONTENTS_HITBOX -- collide with vphysics\n\nfunction ENT:Initialize()\n\n\tself:SetModel( \"models/weapons/w_missile_closed.mdl\" )\n\tself:SetMoveType( MOVETYPE_FLY )\n\tself:SetMoveCollide( MOVECOLLIDE_FLY_CUSTOM )\n\tself:SetCollisionGroup( COLLISION_GROUP_PROJECTILE )\n\tself:SetSolid( SOLID_BBOX ) -- turns on collision with other entities\n\tself:SetCollisionBounds( Vector( -1, -1, -1 ), Vector( 1, 1, 1 ) )\n\tself:SetVelocity( self:GetForward() * 650 )\n\nend\n\nif ( CLIENT ) then return end\n\nfunction ENT:ResolveCustomFlyCollision( traceResult, vel )\n\n\tvel = self:GetVelocity() -- using unmodified velocity\n\tlocal speed = vel:Length()\n\n\tlocal tempdir = traceResult.HitNormal\n\ttempdir:Mul( 2 * vel:Dot( tempdir ) )\n\n\tlocal dir = vel\n\tdir:Sub( tempdir )\n\tdir:Normalize()\n\n\tlocal reflectionangle = dir:Angle()\n\n\tlocal newvel = dir\n\tnewvel:Mul( speed )\n\tself:SetLocalVelocity( newvel )\n\n\tself:SetAngles( reflectionangle )\n\nend"},{"description":"A reduced version of the engine's crossbow bolt that replicates the behavior closely. It flies. It reflects. It sticks. It hurts.","code":"AddCSLuaFile()\n\nENT.Base = \"base_anim\"\nENT.Type = \"anim\"\nENT.PrintName = \"Simple Crossbow Bolt\"\nENT.Category = \"Other\"\n\nENT.Spawnable = true\nENT.AdminOnly = true\nENT.RenderGroup = RENDERGROUP_OPAQUE\nENT.PhysicsSolidMask = bit.band( bit.bor( MASK_SOLID, CONTENTS_HITBOX ), bit.bnot( CONTENTS_GRATE ) )\n\nfunction ENT:Initialize()\n\n\tself:SetModel( \"models/crossbow_bolt.mdl\" )\n\tself:SetSolid( SOLID_BBOX )\n\tself:AddSolidFlags( FSOLID_NOT_STANDABLE )\n\tself:SetCollisionGroup( COLLISION_GROUP_PROJECTILE )\n\tself:SetCollisionBounds( Vector( -1, -1, -1 ), Vector( 1, 1, 1 ) )\n\tself:SetMoveType( MOVETYPE_FLYGRAVITY )\n\tself:SetMoveCollide( MOVECOLLIDE_FLY_CUSTOM )\n\n\tself:SetGravity( 0.05 )\n\n\tself:SetSkin( 1 )\n\nend\n\nif ( CLIENT ) then return end\n\nlocal BOLT_AIR_VELOCITY = 3500\n\nfunction ENT:SpawnFunction( pPlayer, trace_t, classname )\n\n\tif ( not trace_t.Hit ) then return end\n\n\tlocal aimdirection = trace_t.Normal\n\tlocal angles = aimdirection:Angle()\n\tlocal origin\n\tlocal velocity\n\n\tlocal simplecrossbowbolt = ents.Create( classname )\n\tsimplecrossbowbolt:SetAngles( angles )\n\n\torigin = aimdirection\n\torigin:Mul( 32 )\n\torigin:Add( trace_t.StartPos )\n\tsimplecrossbowbolt:SetPos( origin )\n\n\tvelocity = origin\n\tvelocity:Sub( trace_t.StartPos )\n\tvelocity:Div( 32 )\n\tvelocity:Mul( BOLT_AIR_VELOCITY )\n\tsimplecrossbowbolt:SetVelocity( velocity )\n\n\tsimplecrossbowbolt:SetOwner( pPlayer )\n\tsimplecrossbowbolt:Spawn()\n\n\treturn simplecrossbowbolt\n\nend\n\nfunction ENT:ResolveCustomFlyCollision( trace_t, velocity )\n\n\tif ( trace_t.HitSky ) then return self:Remove() end\n\n\tlocal pOther = trace_t.Entity\n\n\tself:EmitSound( \"Weapon_Crossbow.BoltHitWorld\" )\n\n\tlocal direction = self:GetVelocity()\n\tlocal speed = direction:Length()\n\n\tdirection:Normalize()\n\n\tdirection:Negate()\n\tlocal hitDot = trace_t.HitNormal:Dot( direction )\n\tdirection:Negate()\n\n\tif ( ( hitDot < 0.5 ) and ( speed > 100 ) ) then -- Reflect off\n\n\t\tlocal vecReflection = Vector( 0, 0, 0 )\n\t\tvecReflection:Set( trace_t.HitNormal )\n\t\tvecReflection:Mul( 2 * hitDot )\n\t\tvecReflection:Add( direction )\n\n\t\tself:SetAngles( vecReflection:Angle() )\n\n\t\tvelocity = vecReflection\n\t\tvelocity:Mul( speed * 0.75 )\n\t\tself:SetLocalVelocity( velocity )\n\n\t\tself:SetGravity( 1 )\n\n\telse -- Stick\n\n\t\tself:SetMoveType( MOVETYPE_NONE )\n\t\tself:SetCollisionGroup( COLLISION_GROUP_DEBRIS )\n\n\t\tself:SetSkin( 0 )\n\n\t\t-- Move the bolt back a bit so it looks clean\n\t\tlocal compensatedpos = Vector( 0, 0, 0 )\n\t\tcompensatedpos:Set( trace_t.Normal )\n\t\tcompensatedpos:Mul( -6 )\n\t\tcompensatedpos:Add( trace_t.HitPos )\n\n\t\tself:SetPos( compensatedpos )\n\n\t\t-- Make it stick\n\t\tself:SetParent( pOther )\n\n\t\t-- Leave an impact effect\n\t\tlocal data = EffectData()\n\t\t\tdata:SetOrigin( trace_t.HitPos )\n\t\t\tdata:SetStart( trace_t.StartPos )\n\t\t\tdata:SetSurfaceProp( trace_t.SurfaceProps )\n\t\t\tdata:SetDamageType( DMG_BULLET )\n\t\t\tdata:SetHitBox( trace_t.HitBox )\n\t\t\tdata:SetEntIndex( pOther:EntIndex() )\n\t\tutil.Effect( \"Impact\", data )\n\n\t\t-- Cause some damage\n\t\tlocal info = DamageInfo()\n\t\t\tinfo:SetAttacker( self:GetOwner() )\n\t\t\tinfo:SetInflictor( self )\n\t\t\tinfo:SetDamage( 100 )\n\t\t\tinfo:SetDamageType( DMG_BULLET )\n\t\t\tinfo:SetDamagePosition( trace_t.HitPos )\n\t\t\tlocal force = compensatedpos\n\t\t\tforce:Set( trace_t.Normal )\n\t\t\tforce:Mul( 75 * 4 * 0.7 )\n\t\t\tinfo:SetDamageForce( force )\n\t\tpOther:TakeDamageInfo( info )\n\n\t\t-- Schedule removal\n\t\tself.Think = self.Remove\n\t\tself:NextThink( CurTime() + 10 )\n\n\tend\n\n\t-- Shoot sparks\n\tlocal data = EffectData()\n\t\tdata:SetOrigin( trace_t.HitPos )\n\t\tdata:SetMagnitude( 2 )\n\t\tdata:SetScale( 1 )\n\t\tlocal normal = trace_t.Normal\n\t\tnormal:Negate()\n\t\tdata:SetNormal( normal )\n\tutil.Effect( \"ElectricSpark\", data )\n\nend"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"RunAI","parent":"ENTITY","type":"hook","description":{"text":"Called from the engine every [m_flNextDecisionTime](https://github.com/ValveSoftware/source-sdk-2013/blob/master/src/game/server/ai_basenpc.cpp#L3943C10-L3943C30) in seconds. This interval changes depending on NPC's [Efficiency](https://github.com/ValveSoftware/source-sdk-2013/blob/master/src/game/server/ai_basenpc.cpp#L3093). Returning `true` inside this hook will allow [CAI_BaseNPC::MaintainSchedule](https://github.com/ValveSoftware/source-sdk-2013/blob/master/src/game/server/ai_basenpc_schedule.cpp#L562) to also be called.","note":"This hook only exists for `ai` type [SENTs](Scripted_Entities)."},"realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_ai/schedules.lua","line":"5"},"rets":{"ret":{"text":"`true` to run engine schedules","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"RunEngineTask","parent":"ENTITY","type":"hook","description":{"text":"Called when an engine task is ran on the entity.","note":"This hook only exists for `ai` type [SENTs](Scripted_Entities)."},"realm":"Server","args":{"arg":[{"text":"The task ID, see [ai_task.h](https://github.com/ValveSoftware/source-sdk-2013/blob/55ed12f8d1eb6887d348be03aee5573d44177ffb/mp/src/game/server/ai_task.h#L89-L502)","name":"taskID","type":"number"},{"text":"The task data.","name":"taskData","type":"number"}]},"rets":{"ret":{"text":"true to prevent default action","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"RunTask","parent":"ENTITY","type":"hook","description":{"text":"Called every think on running task.\nThe actual task function should tell us when the task is finished.","note":"This is a helper function only available if your SENT is based on `base_ai`"},"realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_ai/schedules.lua","line":"138"},"args":{"arg":{"text":"The task to run","name":"task","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"ScheduleFinished","parent":"ENTITY","type":"hook","description":{"text":"Called whenever a Lua schedule is finished or ENTITY:StartEngineSchedule is called. Clears out schedule and task data stored within NPC's table.","note":"This is a helper function only available if your SENT is based on `base_ai`"},"realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_ai/schedules.lua","line":"80"}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SelectSchedule","parent":"ENTITY","type":"hook","description":{"text":"Set the schedule we should be playing right now. Allows the NPC to start either a Lua schedule or an engine schedule. Despite sharing the same name as `CAI_BaseNPC::SelectSchedule()`, this isn't hooked to that function; this is called by Lua's ENTITY:RunAI, doesn't return an engine function, returning an engine function doesn't help and doesn't make the NPC start an engine schedule. To alter initial engine schedule, it is recommended to use ENTITY:TranslateSchedule.","note":"This is a helper function only available if your SENT is based on `base_ai`"},"realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_ai/schedules.lua","line":"39"}},"example":{"description":"Creates a new schedule and assigns it to a scripted NPC.","code":"local schdTest = ai_schedule.New( \"Test Schedule\" )\n \nschdTest:EngTask( \"TASK_GET_PATH_TO_RANDOM_NODE\",  128 )\nschdTest:EngTask( \"TASK_RUN_PATH\", \t\t   0   )\nschdTest:EngTask( \"TASK_WAIT_FOR_MOVEMENT\", \t   0   )\n \n \nfunction ENT:SelectSchedule()\n \n\tself:StartSchedule( schdTest )\n \nend","output":"The scripted NPC will run around when spawned."},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetAutomaticFrameAdvance","parent":"ENTITY","type":"hook","description":"Toggles automatic frame advancing for animated sequences on an entity.\n\nThis has the same effect as setting the ``ENT.AutomaticFrameAdvance`` property. (See Structures/ENT)","realm":"Shared","args":{"arg":{"text":"Whether or not to set automatic frame advancing.","name":"enable","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetTask","parent":"ENTITY","type":"hook","description":{"text":"Sets the current task, to be used in a Lua schedule.","note":"This is a helper function only available if your SENT is based on `base_ai`"},"realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_ai/schedules.lua","line":"93"},"args":{"arg":{"text":"The task to set.","name":"task","type":"table"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetupDataTables","parent":"ENTITY","type":"hook","description":"Called when the entity should set up its  Data Tables.\n\nThis is a much better option than using Set/Get Networked Values.\n\nThis hook is called after GM:OnEntityCreated and GM:NetworkEntityCreated.","realm":"Shared"},"example":{"description":"Sets up networked variables, adds functions SetAmount, GetAmount, GetBloodPos, SetBloodPos, GetUrinePos, SetUrinePos.\n\nThis function only supports 32 data tables per type (#0-31), except for strings which only supports 4 (#0-3).","code":"function ENT:SetupDataTables()\n\n\tself:NetworkVar( \"Float\", 0, \"Amount\" )\n\tself:NetworkVar( \"Vector\", 0, \"BloodPos\" )\n\tself:NetworkVar( \"Vector\", 1, \"UrinePos\" )\n\n\tif SERVER then\n\t\tself:SetAmount( 3 )\n\t\tself:SetBloodPos( Vector( 0, -32, 0 ) )\n\t\tself:SetUrinePos( Vector( 0, 0, -16 ) )\n\tend\n\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SpawnFunction","parent":"ENTITY","type":"hook","description":{"text":"This is the spawn function. It's called when a player spawns the entity from the spawnmenu.\n\nIf you want to make your SENT spawnable you need this function to properly create the entity.","warning":"Unlike other ENTITY functions, the \"self\" parameter of this function is not an entity but rather the table used to generate the SENT. This table is equivalent to scripted_ents.GetStored(\"ent_name\")."},"realm":"Server","args":{"arg":[{"text":"The player that is spawning this SENT","name":"ply","type":"Player"},{"text":"A Structures/TraceResult from player eyes to their aim position","name":"tr","type":"table"},{"text":"The classname of your entity","name":"ClassName","type":"string"}]}},"example":[{"description":"This is how it is defined in sent_ball","code":"function ENT:SpawnFunction( ply, tr, ClassName )\n\n\tif ( !tr.Hit ) then return end\n\n\tlocal SpawnPos = tr.HitPos + tr.HitNormal * 16\n\n\tlocal ent = ents.Create( ClassName )\n\tent:SetPos( SpawnPos )\n\tent:SetBallSize( math.random( 16, 48 ) )\n\tent:Spawn()\n\tent:Activate()\n\n\treturn ent\n\nend"},{"description":"This is how base_edit spawns (also rotates the entity to face the player, remove * 10 if it spawns in the air)","code":"function ENT:SpawnFunction( ply, tr, ClassName )\n\n\tif ( !tr.Hit ) then return end\n\t\n\tlocal SpawnPos = tr.HitPos + tr.HitNormal * 10\n\tlocal SpawnAng = ply:EyeAngles()\n\tSpawnAng.p = 0\n\tSpawnAng.y = SpawnAng.y + 180\n\t\n\tlocal ent = ents.Create( ClassName )\n\tent:SetPos( SpawnPos )\n\tent:SetAngles( SpawnAng )\n\tent:Spawn()\n\tent:Activate()\n\t\n\treturn ent\n\t\nend"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"StartEngineSchedule","parent":"ENTITY","type":"hook","description":{"text":"Called by the engine only whenever NPC:SetSchedule is called.","note":"This hook only exists for `ai` type [SENTs](Scripted_Entities)."},"realm":"Server","args":{"arg":{"text":"Schedule ID to start. See Enums/SCHED","name":"scheduleID","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"StartEngineTask","parent":"ENTITY","type":"hook","description":{"text":"Called when an engine task has been started on the entity.","note":"This hook only exists for `ai` type [SENTs](Scripted_Entities)."},"realm":"Server","args":{"arg":[{"text":"Task ID to start, see [ai_task.h](https://github.com/ValveSoftware/source-sdk-2013/blob/55ed12f8d1eb6887d348be03aee5573d44177ffb/mp/src/game/server/ai_task.h#L89-L502)","name":"taskID","type":"number"},{"text":"Task data","name":"TaskData","type":"number"}]},"rets":{"ret":{"text":"true to stop default action","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"StartSchedule","parent":"ENTITY","type":"hook","description":{"text":"Starts a schedule previously created by ai_schedule.New.\n\nNot to be confused with ENTITY:StartEngineSchedule or NPC:SetSchedule which start an Engine-based schedule.","note":"This is a helper function only available if your SENT is based on `base_ai`"},"realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_ai/schedules.lua","line":"50"},"args":{"arg":{"text":"Schedule to start.","name":"sched","type":"Schedule"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"StartTask","parent":"ENTITY","type":"hook","description":{"text":"Called once when a LUA schedule has started a task.","note":"This is a helper function only available if your SENT is based on `base_ai`"},"realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_ai/schedules.lua","line":"129"},"args":{"arg":{"text":"The task to start, created by ai_task.New.","name":"task","type":"Task"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"StartTouch","parent":"ENTITY","type":"hook","description":{"text":"Called when the entity starts touching another entity.\n\nSee ENTITY:Touch and ENTITY:EndTouch for related hooks.","warning":"This only works for **brush** entities and for entities that have Entity:SetTrigger set to true."},"realm":"Server","args":{"arg":{"text":"The entity that we started touching for the first time.","name":"entity","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"StoreOutput","parent":"ENTITY","type":"hook","description":"Used to store an output so it can be triggered with ENTITY:TriggerOutput.\nOutputs compiled into a map are passed to entities as key/value pairs through ENTITY:KeyValue.\n\nTriggerOutput will do nothing if this function has not been called first.","realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_entity/outputs.lua","line":"10-L28"},"args":{"arg":[{"text":"Name of output to store","name":"name","type":"string"},{"text":"Output info","name":"info","type":"string"}]}},"example":{"description":"Stores all outputs that are assigned to an entity in Hammer.","code":"function ENT:KeyValue( k, v )\n\t-- 99% of all outputs are named 'OnSomethingHappened'.\n\tif ( string.Left( k, 2 ) == \"On\" ) then\n\t\tself:StoreOutput( k, v )\n\tend\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"TaskFinished","parent":"ENTITY","type":"hook","description":{"text":"Returns true if the current running Task is finished. \nTasks finish whenever NPC:TaskComplete is called, which sets `TASKSTATUS_COMPLETE` for all NPCs, also sets `self.bTaskComplete` for `ai` type [SENTs](Scripted_Entities).","note":"This hook only exists for `ai` type [SENTs](Scripted_Entities)."},"realm":"Server","rets":{"ret":{"text":"Is the current running Task is finished or not.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"TaskTime","parent":"ENTITY","type":"hook","description":{"text":"Returns how many seconds we've been doing this current task","note":"This hook only exists for `ai` type [SENTs](Scripted_Entities)."},"realm":"Server","rets":{"ret":{"text":"How many seconds we've been doing this current task","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"TestCollision","parent":"ENTITY","type":"hook","description":{"text":"Allows you to override trace result when a trace hits the entity.\n\nYour entity **must** have Entity:EnableCustomCollisions enabled for this hook to work.\n\nYour entity must also be otherwise \"hit-able\" with a trace, so it should have SOLID_OBB or SOLID_VPHYSICS be set (as an example), and it must have its collision bounds be set accordingly.","note":"This hook is called for `anim` type only."},"realm":"Shared","args":{"arg":[{"text":"Start position of the trace.","name":"startpos","type":"Vector"},{"text":"Offset from startpos to the endpos of the trace.","name":"delta","type":"Vector"},{"text":"Is the trace a hull trace?","name":"isbox","type":"boolean"},{"text":"Size of the hull trace, with the center of the Bounding Box being `0, 0, 0`, so mins are `-extents`, and maxs are `extents`.","name":"extents","type":"Vector"},{"text":"The Enums/CONTENTS mask.","name":"mask","type":"number"}]},"rets":{"ret":{"text":"Returning a `table` will allow you to override trace results. Table should contain the following keys: (All keys fallback to the original trace value)\n* Vector `HitPos` - The new hit position of the trace.\n* number `Fraction` - A number from `0` to `1`, describing how far the trace went from its origin point, `1` = did not hit.\n  * Could be calculated like so : `Fraction = ( startpos + delta ):Length() / myCustomHitPos:Length()`\n* Vector `Normal` - A unit vector (length=1) describing the direction perpendicular to the hit surface.\n\nReturning `true` will allow \"normal\" collisions to happen for `SOLID_VPHYSICS` and `SOLID_OBB` entities.\n\nReturning `nothing` or `false` allows the trace to ignore the entity completely.","name":"","type":"table"}}},"example":[{"description":"Example taken from `lua/entities/widget_base.lua`","code":"function ENT:TestCollision( startpos, delta, isbox, extents )\n\n\tif ( isbox ) then return end\n\tif ( !widgets.Tracing ) then return end\n\n\t-- TODO. Actually trace against our cube!\n\n\treturn\n\t{\n\t\tHitPos\t\t= self:GetPos(),\n\t\tFraction\t= 0.5 * self:GetPriority()\n\t}\n\nend"},{"description":"Allows players to shoot through the entity, but still stand on it and use the Physics Gun on it, etc.","code":"local sent_contents = CONTENTS_GRATE\nfunction ENT:TestCollision( startpos, delta, isbox, extents, mask )\n\tif bit.band( mask, sent_contents ) ~= 0 then return true end\nend"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Think","parent":"ENTITY","type":"hook","description":{"text":"Called every frame on the client.\nCalled about 5-6 times per second on the server.","note":"You may need to call Entity:Spawn to get this hook to run server side.\n\nYou can force it to run at servers tickrate using the example below."},"realm":"Shared","rets":{"ret":{"text":"Return `true` if you used Entity:NextThink to override the next execution time. Otherwise it will be reset to `CurTime() + 0.2`.","name":"","type":"boolean"}}},"example":{"description":"Force the think hook to run at the maximum frequency.\nThis is generally only used for `anim` type entities, if the entity has to play model animations/sequences.","code":"ENT.AutomaticFrameAdvance = true -- Must be set on client\n\nfunction ENT:Think()\n\t-- Do stuff\n\n\tself:NextThink( CurTime() ) -- Set the next think to run as soon as possible, i.e. the next frame.\n\n\treturn true -- Apply NextThink call\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Touch","parent":"ENTITY","type":"hook","description":{"text":"Called every tick for every entity being \"touched\". Touching is usually detected via AABB intersection checks using entity's collision bounds.\n\nEntities like triggers would be using the touch hooks for their function.\n\nSee Entity:PhysicsCollide for physics based collision events.\n\nSee also ENTITY:StartTouch and ENTITY:EndTouch.","note":"For physics enabled entities, this hook will **not** be ran while the entity's physics is asleep. See PhysObj:Wake."},"realm":"Server","args":{"arg":{"text":"The entity that touched it.","name":"entity","type":"Entity"}}},"example":{"code":"function ENTITY:Touch(entity)\n\tself:EmitSound(\"ambient/explosions/explode_\" .. math.random(1, 9) .. \".wav\")\n\tself:Remove()\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"TranslateActivity","parent":"ENTITY","type":"hook","added":"2023.11.16","description":{"text":"Called by the engine to alter NPC activities, if desired by the NPC.","note":"This hook only exists for `ai` type SENTs."},"realm":"Server","args":{"arg":{"text":"The activity to translate.","name":"oldAct","type":"number{ACT}"}},"rets":{"ret":{"text":"The activity that should override the incoming activity. \n\nNot returning anything, or returning a non value will perform the [default action](https://github.com/ValveSoftware/source-sdk-2013/blob/master/src/game/server/ai_basenpc.cpp#L5976).","name":"newAct","type":"number{ACT}"}}},"realms":["Server"],"type":"Function"},
{"title":"ENTITY:TranslateNavGoal","function":{"name":"TranslateNavGoal","parent":"ENTITY","type":"hook","added":"2024.12.12","description":{"text":"Called by the engine to alter NPC's final position to reach its enemy or target. This is called twice for `GOALTYPE_PATHCORNER`; first is for the first path_corner and second for the next connected path_corner.","note":"This hook only exists for `ai` type SENTs."},"realm":"Server","args":{"name":"Chasing Enemy","arg":[{"text":"The enemy being chased or the path_corner in query.","name":"target","type":"NPC|Entity","default":"GetEnemy() or m_hGoalEnt"},{"text":"The target's origin.","name":"currentGoal","type":"Vector","default":"GetEnemyLastKnownPos() or m_hGoalEnt:GetPos()"}]},"rets":{"ret":{"text":"The actual point that NPC will move to reach its enemy or target. For the path to get updated, the new move path must be away from the current NPC:GetGoalPos by 120 units.\n\n\nNot returning anything, or returning a non vector will perform the [default action](https://github.com/ValveSoftware/source-sdk-2013/blob/master/src/game/server/ai_basenpc_schedule.cpp#L4251).","name":"","type":"Vector"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"TranslateSchedule","parent":"ENTITY","type":"hook","added":"2023.12.07","description":{"text":"Called by the engine to alter NPC schedules, if desired by the NPC.","note":"This hook only exists for `ai` type SENTs."},"realm":"Server","args":{"arg":{"text":"The schedule to translate. See Enums/SCHED.","name":"schedule","type":"number{SCHED}"}},"rets":{"ret":{"text":"The schedule that should override the incoming schedule. \n\nNot returning anything, or returning a non value will perform the [default action](https://github.com/ValveSoftware/source-sdk-2013/blob/master/src/game/server/ai_default.cpp#L253).","name":"","type":"number{SCHED}"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"TriggerOutput","parent":"ENTITY","type":"hook","description":"Triggers all outputs stored using ENTITY:StoreOutput.","realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_entity/outputs.lua","line":"105-L123"},"args":{"arg":[{"text":"Name of output to fire","name":"output","type":"string"},{"text":"Activator entity","name":"activator","type":"Entity"},{"text":"The data to give to the output.","name":"data","type":"string","default":"nil"}]}},"example":[{"description":"Creates a brush entity that will run `OnEndTouch` outputs when compiled into a map","code":"ENT.Type = \"brush\"\nENT.Base = \"base_brush\"\n\nfunction ENT:Initialize()\n\tself:SetSolid(SOLID_BBOX)\n\tself:SetTrigger(true) -- Generates EndTouch and StartTouch callbacks\nend\n\nfunction ENT:KeyValue( k, v )\n\t-- Store 'OnEndTouch' outputs for map created entities\n\tif ( k == \"OnEndTouch\" ) then\n\t\tself:StoreOutput( k, v )\n\tend\nend\n\nfunction ENT:EndTouch(ent)\n\t-- Trigger all stored outputs\n\tself:TriggerOutput(\"OnEndTouch\", ent)\nend"},{"description":{"text":"For engine entities you can use Entity:Fire to hook outputs. This example hooks all `trigger_teleport`.","note":"ACTIVATOR / CALLER / TRIGGER_PLAYER globals are only available during execution, they are unset directly afterwards."},"code":"local function SetupMapLua()\n\tlocal MapLua = ents.Create( \"lua_run\" )\n\tMapLua:SetName( \"triggerhook\" )\n\tMapLua:Spawn()\n\n\tfor _, v in ipairs( ents.FindByClass( \"trigger_teleport\" ) ) do\n\t\tv:Fire( \"AddOutput\", \"OnStartTouch triggerhook:RunPassedCode:hook.Run( 'OnTeleport' ):0:-1\" )\n\tend\nend\n\nhook.Add( \"InitPostEntity\", \"SetupMapLua\", SetupMapLua )\nhook.Add( \"PostCleanupMap\", \"SetupMapLua\", SetupMapLua )\nhook.Add( \"OnTeleport\", \"TestTeleportHook\", function()\n\tlocal activator, caller = ACTIVATOR, CALLER\n\tprint( activator, caller )\nend )","output":"When player touches trigger_teleport this will be printed in the console:\n```\nPlayer [1][Player1] Entity [3][trigger_teleport]\n```"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"UpdateTransmitState","parent":"ENTITY","type":"hook","description":"Called whenever the transmit state should be updated.","realm":"Server","rets":{"ret":{"text":"Transmit state to set, see Enums/TRANSMIT.","name":"","type":"number"}}},"example":{"description":"Entity pickup example, stops the entity from being networked after it's been picked up, and restores it once it \"respawns\".","code":{"text":"function ENT:Touch( other )\n\tif ( self.NextRespawn > CurTime() ) then return end\n\t\n\tself.NextRespawn = CurTime() + 5\n\tself:AddEFlags( EFL_FORCE_CHECK_TRANSMIT )\nend\n\nfunction ENT:UpdateTransmitState()\n\tif ( self.NextRespawn > CurTime() ) then\n\t\treturn TRANSMIT_NEVER\n\tend\n\t\n\treturn TRANSMIT_PVS\nend\n\nfunction ENT:Think()\n\tif ( self.NextRespawn != -1 && self.NextRespawn","curtime":{"then":"","self.nextrespawn":"-1","self:addeflags":"","efl_force_check_transmit":"","end":"","ode":"ode"}}},"realms":["Server"],"type":"Function"},
{"ambig":{"text":"You might be looking for the \"Entity:Use\" method, which has the same name as this hook.","page":"Entity:Use(function)"},"function":{"name":"Use","parent":"ENTITY","type":"hook","description":{"text":"Called when an entity \"uses\" this entity, for example a player pressing their `+use` key (default ) on this entity.\n\nTo change how often the hook is called, see Entity:SetUseType.","key":"E","note":"This hook only works for `nextbot`, `ai` and `anim` scripted entity types."},"realm":"Server","args":{"arg":[{"text":"The entity that caused this input. This will usually be the player who pressed their use key.","name":"activator","type":"Entity"},{"text":"The entity responsible for the input. This will typically be the same as `activator` unless some other entity is acting as a proxy.","name":"caller","type":"Entity"},{"text":"Use type, see Enums/USE.","name":"useType","type":"number{USE}"},{"text":"Any passed value.","name":"value","type":"number"}]}},"example":{"description":"Kills any player that uses this entity.","code":"function ENT:Use( activator )\n\n\tif ( activator:IsPlayer() ) then \n\n\t\tactivator:Kill()\n\n\tend\n\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"AcceptInput","parent":"GM","type":"hook","description":"Called when a map I/O event occurs.\n\nSee also Entity:Fire and Entity:Input for functions to fire Inputs on entities.","realm":"Server","args":{"arg":[{"text":"Entity that receives the input","name":"ent","type":"Entity"},{"text":"The input name. Is not guaranteed to be a valid input on the entity.","name":"input","type":"string"},{"text":"Activator of the input","name":"activator","type":"Entity"},{"text":"Caller of the input","name":"caller","type":"Entity"},{"text":"Data provided with the input. Will be either a string, a number, a boolean or a nil.","name":"value","type":"any"}]},"rets":{"ret":{"text":"Return true to prevent this input from being processed. Do not return otherwise.","name":"","type":"boolean"}}},"example":[{"description":"This would block any input that the lua_run entity would receive.","code":"hook.Add( \"AcceptInput\", \"BlockLuaRun\", function( ent, name, activator, caller, data )\n    if ( ent:GetClass() == \"lua_run\" ) then\n        return true\n    end\nend )"},{"description":"Block the Open/Close input on doors.","code":"local DoorClasses = {\n\t[\"func_door\"] = true,\n\t[\"func_door_rotating\"] = true\n}\nlocal BlockedInputs = {\n\t[\"Open\"] = true,\n\t[\"Close\"] = true\n}\n\nhook.Add( \"AcceptInput\", \"BlockDoors\", function( ent, name, activator, caller, data )\n    if ( BlockedInputs[name] and DoorClasses[ent:GetClass()] ) then\n        return true\n    end\nend )"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"AddDeathNotice","parent":"GM","type":"hook","description":"Adds a death notice entry.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_deathnotice.lua","line":"202-L223"},"args":{"arg":[{"text":"The name of the attacker","name":"attacker","type":"string"},{"text":"The team of the attacker","name":"attackerTeam","type":"number"},{"text":"Class name of the entity inflicting the damage","name":"inflictor","type":"string"},{"text":"Name of the victim","name":"victim","type":"string"},{"text":"Team of the victim","name":"victimTeam","type":"number"}]},"rets":{"ret":{"text":"`true/false` to prevent the notice from being shown. Do not return otherwise.","name":"","type":"any"}}},"example":{"description":"Shows a suicide death notice in Sandbox.","code":"local ply = Entity( 1 )\nhook.Run( \"AddDeathNotice\", ply:GetName(), ply:Team(), \"suicide\", ply:GetName(), ply:Team() )","output":{"upload":{"src":"b58a0/8dda6965a418353.png","size":"14377","name":"image.png"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AdjustMouseSensitivity","parent":"GM","type":"hook","description":"Allows you to adjust the mouse sensitivity.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"418"},"args":{"arg":[{"text":"The old sensitivity\n\nIn general it will be 0, which is equivalent to a sensitivity of 1.","name":"defaultSensitivity","type":"number"},{"text":"Player's current FOV.","name":"localFOV","type":"number"},{"text":"Default FOV.","name":"defaultFOV","type":"number"}]},"rets":{"ret":{"text":"A fraction of the normal sensitivity (0.5 would be half as sensitive).\n\nReturn -1 to not override and prevent subsequent hooks and WEAPON:AdjustMouseSensitivity from running.  \nReturn nil to not override and allow subsequent hooks and WEAPON:AdjustMouseSensitivity to run.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AllowPlayerPickup","parent":"GM","type":"hook","description":"Called when a player tries to pick up something using the \"use\" key, return to override.\n\nThis hook will not be called if `sv_playerpickupallowed` is set to 0.\n\nSee GM:GravGunPickupAllowed for the Gravity Gun pickup variant.\n\nSee GM:PhysgunPickup for the Physics Gun pickup variant.","realm":"Server","file":{"text":"gamemodes/base/gamemode/player.lua","line":"818-L828"},"args":{"arg":[{"text":"The player trying to pick up something.","name":"ply","type":"Player"},{"text":"The Entity the player attempted to pick up.","name":"ent","type":"Entity"}]},"rets":{"ret":{"text":"Allow the player to pick up the entity or not.","name":"","type":"boolean"}}},"example":{"description":"Allows only admins to pick up things.","code":"hook.Add( \"AllowPlayerPickup\", \"AllowAdminsPickUp\", function( ply, ent )\n\tif ( !ply:IsAdmin() ) then return false end\n\n\t-- If admin, fallback to default action (allow) and other hooks.\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"CalcMainActivity","parent":"GM","type":"hook","description":{"text":"This hook is used to calculate animations for a player.","warning":"This hook must return the same values at the same time on both, client **and** server. On client for players to see the animations, on server for hit detection to work properly."},"realm":"Shared","file":{"text":"gamemodes/base/gamemode/animations.lua","line":"296-L321"},"args":{"arg":[{"text":"The player to apply the animation.","name":"ply","type":"Player"},{"text":"The velocity of the player.","name":"vel","type":"Vector"}]},"rets":{"ret":[{"text":"Enums/ACT for the activity the player should use. A nil return will be treated as ACT_INVALID.","name":"","type":"number"},{"text":"Sequence for the player to use. This takes precedence over the activity (the activity is still used for layering). Return -1 or nil to let the activity determine the sequence.","name":"","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CalcVehicleView","parent":"GM","type":"hook","description":"Called from GM:CalcView when player is in driving a vehicle.\n\nThis hook may not be called in gamemodes that override GM:CalcView.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"305"},"args":{"arg":[{"text":"The vehicle the player is driving","name":"veh","type":"Vehicle"},{"text":"The vehicle driver","name":"ply","type":"Player"},{"text":"The view data containing players FOV, view position and angles, see Structures/CamData","name":"view","type":"table"}]},"rets":{"ret":{"text":"The modified view table containing new values, see Structures/CamData","name":"","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"CalcView","parent":"GM","type":"hook","description":"Allows override of the default view.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"357"},"args":{"arg":[{"text":"The local player.","name":"ply","type":"Player"},{"text":"The player's view position.","name":"origin","type":"Vector"},{"text":"The player's view angles.","name":"angles","type":"Angle"},{"text":"Field of view.","name":"fov","type":"number"},{"text":"Distance to near clipping plane.","name":"znear","type":"number"},{"text":"Distance to far clipping plane.","name":"zfar","type":"number"}]},"rets":{"ret":{"text":"View data table. See Structures/CamData","name":"","type":"table{CamData}"}}},"example":{"description":"Draws the LocalPlayer and sets the view behind.","code":"hook.Add( \"CalcView\", \"MyCalcView\", function( ply, pos, angles, fov )\n\tlocal view = {\n\t\torigin = pos - ( angles:Forward() * 100 ),\n\t\tangles = angles,\n\t\tfov = fov,\n\t\tdrawviewer = true\n\t}\n\n\treturn view\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"CalcViewModelView","parent":"GM","type":"hook","description":"Allows overriding the position and angle of the viewmodel.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"555"},"args":{"arg":[{"text":"The weapon entity","name":"wep","type":"Weapon"},{"text":"The viewmodel entity","name":"vm","type":"Entity"},{"text":"Original position (before viewmodel bobbing and swaying)","name":"oldPos","type":"Vector"},{"text":"Original angle (before viewmodel bobbing and swaying)","name":"oldAng","type":"Angle"},{"text":"Current position","name":"pos","type":"Vector"},{"text":"Current angle","name":"ang","type":"Angle"}]},"rets":{"ret":[{"text":"New position","name":"","type":"Vector"},{"text":"New angle","name":"","type":"Angle"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"CanCreateUndo","parent":"GM","type":"hook","description":"Called whenever a players tries to create an undo.","realm":"Server","file":{"text":"lua/includes/modules/undo.lua","line":"328-L328"},"args":{"arg":[{"text":"The player who tried to create something.","name":"ply","type":"Player"},{"text":"The undo table as a Structures/Undo.","name":"undo","type":"table"}]},"rets":{"ret":{"text":"Return false to disallow creation of the undo.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"CanEditVariable","parent":"GM","type":"hook","description":"Called when a variable is about to be edited on an Entity (called by `Edit Properties...` menu), to determine if the edit should be permitted.\n\nSee Editable entities for more details about the system.\n\nBy default, Sandbox will also call ENTITY:CanEditVariables if no hook returns a value.","realm":"Server","file":{"text":"gamemodes/base/gamemode/variable_edit.lua","line":"28"},"args":{"arg":[{"text":"The entity being edited.","name":"ent","type":"Entity"},{"text":"The player doing the editing.","name":"ply","type":"Player"},{"text":"The name of the variable.","name":"key","type":"string"},{"text":"The new value, as a string which will later be converted to its appropriate type.","name":"value","type":"string"},{"text":"The edit table defined in Entity:NetworkVar.","name":"editor","type":"table"}]},"rets":{"ret":{"text":"Return `false` to disallow editing.","name":"","type":"boolean"}}},"example":{"description":"From `base/gamemode/variable_edit.lua`.\n\nMakes `Edit Properties...` right click property admin only.","code":"hook.Add( \"CanEditVariable\", \"AdminEditVar\", function( ent, ply, key, val, editor )\n\tif ( !ply:IsAdmin() ) then return false end\n\n\t-- Do not return anything when allowed, to allow other hooks to run and potentially block the edit\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"CanExitVehicle","parent":"GM","type":"hook","description":"Determines if the player can exit the vehicle on their own. Player:ExitVehicle will bypass this hook.\n\nSee GM:CanPlayerEnterVehicle for the opposite hook.  \nSee also GM:PlayerLeaveVehicle for a hook that will be called whenever a player exits any vehicle for any reason.","realm":"Server","file":{"text":"gamemodes/base/gamemode/player.lua","line":"567"},"args":{"arg":[{"text":"The vehicle entity","name":"veh","type":"Vehicle"},{"text":"The player","name":"ply","type":"Player"}]},"rets":{"ret":{"text":"True if the player can exit the vehicle.","name":"","type":"boolean"}}},"example":{"description":"Only lets player exit vehicle if it is not in motion.","code":"hook.Add( \"CanExitVehicle\", \"PlayerMotion\", function( veh, ply )\n    return ( veh:GetVelocity() == Vector( 0, 0, 0 ) )\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"CanPlayerEnterVehicle","parent":"GM","type":"hook","description":"Determines whether or not a given player player can enter the given vehicle. Player:EnterVehicle will still call this hook.\n\nCalled just before GM:PlayerEnteredVehicle. See also GM:CanExitVehicle.","realm":"Server","file":{"text":"gamemodes/base/gamemode/player.lua","line":"584-L590"},"args":{"arg":[{"text":"The player that wants to enter a vehicle.","name":"player","type":"Player"},{"text":"The vehicle in question.","name":"vehicle","type":"Vehicle"},{"text":"The seat number.","name":"role","type":"number"}]},"rets":{"ret":{"text":"`false` if the player is not allowed to enter the vehicle.","name":"","type":"boolean"}}},"example":{"description":"Displays a message in the console when a player enters any vehicle.","code":"hook.Add( \"CanPlayerEnterVehicle\", \"PrintPlayersInVehicles\", function( ply, veh, role )\n\tprint( ply, \"has entered the vehicle\", veh )\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"CanPlayerSuicide","parent":"GM","type":"hook","description":"Determines if the player can kill themselves using the `kill` or `explode` console commands.","realm":"Server","file":{"text":"gamemodes/base/gamemode/player.lua","line":"554-L556"},"args":{"arg":{"text":"The player","name":"player","type":"Player"}},"rets":{"ret":{"text":"`true` if the player should be allowed to suicide, `false` if not.","name":"","type":"boolean"}}},"example":{"description":"Makes suiciding only accessible for super admins.","code":"hook.Add( \"CanPlayerSuicide\", \"AllowOwnerSuicide\", function( ply )\n\tif not ply:IsSuperAdmin() then\n\t\treturn false\n\tend\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"CanPlayerUnfreeze","parent":"GM","type":"hook","description":"Determines if the player can unfreeze the entity.","realm":"Server","file":{"text":"gamemodes/base/gamemode/player.lua","line":"65-L69"},"args":{"arg":[{"text":"The player","name":"player","type":"Player"},{"text":"The entity","name":"entity","type":"Entity"},{"text":"The physics object of the entity","name":"phys","type":"PhysObj"}]},"rets":{"ret":{"text":"True if they can unfreeze.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"CanProperty","parent":"GM","type":"hook","description":"Controls if a property can be used or not.","realm":"Shared","file":{"text":"gamemodes/base/gamemode/shared.lua","line":"263-L265"},"predicted":"Yes","args":{"arg":[{"text":"Player, that tried to use the property","name":"ply","type":"Player"},{"text":"Class of the property that is tried to use, for example - bonemanipulate","name":"property","type":"string","warning":"This is not guaranteed to be the internal property name used in properties.Add!"},{"text":"The entity, on which property is tried to be used on","name":"ent","type":"Entity"}]},"rets":{"ret":{"text":"Return false to disallow using that property","name":"","type":"boolean"}}},"example":{"description":"Stops non-admins from using the remover property.","code":"hook.Add( \"CanProperty\", \"block_remover_property\", function( ply, property, ent )\n\tif ( !ply:IsAdmin() && property == \"remover\" ) then return false end\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CanUndo","parent":"GM","type":"hook","description":"Called whenever a players tries to undo.","realm":"Server","file":{"text":"lua/includes/modules/undo.lua","line":"429-L429"},"args":{"arg":[{"text":"The player who tried to undo something.","name":"ply","type":"Player"},{"text":"The undo table as a Structures/Undo.","name":"undo","type":"table{Undo}"}]},"rets":{"ret":{"text":"Return false to disallow the undo.","name":"","type":"boolean"}}},"example":{"description":"Here's a trick you can do to achieve the behavior of this function on the client.","code":"hook.Add( \"PlayerBindPress\", \"CanUndo\", function( ply, bind )\n\tif ply == LocalPlayer() and bind == \"gmod_undo\" then\n\t\treturn true -- false to allow, true to prevent\n\tend\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"CaptureVideo","parent":"GM","type":"hook","description":{"text":"Called each frame to record demos to video using IVideoWriter.","note":"This hook is called every frame regardless of whether or not a demo is being recorded"},"realm":"Menu","file":{"text":"lua/menu/demo_to_video.lua","line":"286-310"}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"ChatText","parent":"GM","type":"hook","description":"Called when a message is printed to the chat box. Note, that this isn't working with player messages even though there are arguments for it.\n\nFor player messages see GM:PlayerSay and GM:OnPlayerChat","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"250-L260"},"args":{"arg":[{"text":"The index of the player.","name":"index","type":"number"},{"text":"The name of the player.","name":"name","type":"string"},{"text":"The text that is being sent.","name":"text","type":"string"},{"text":"Chat filter type. Possible values are:\n* `joinleave` - Player join and leave messages\n* `namechange` - Player name change messages\n* `servermsg` - Server messages such as convar changes\n* `teamchange` - Team changes?\n* `chat` - (Obsolete?) Player chat? Seems to trigger when server console uses the `say` command\n* `none` - A fallback value","name":"type","type":"string"}]},"rets":{"ret":{"text":"Return true to suppress the chat message.","name":"","type":"boolean"}}},"example":{"description":"Hides default join and leave messages in chat.","code":"hook.Add( \"ChatText\", \"hide_joinleave\", function( index, name, text, type )\n\tif ( type == \"joinleave\" ) then\n\t\treturn true\n\tend\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"ChatTextChanged","parent":"GM","type":"hook","description":"Called whenever the content of the user's chat input box is changed.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"243-L244"},"args":{"arg":{"text":"The new contents of the input box","name":"text","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"text":"⤶","name":"CheckPassword","parent":"GM","type":"hook","description":"Called when a **non local player** connects to allow the Lua system to check the password.\n\nThe default behaviour in the base gamemodes emulates what would normally happen. If `sv_password` is set and its value matches the password passed in by the client (via `password` concommand) - then they are allowed to join. If `sv_password` isn't set it lets them in too.","realm":"Server","file":{"text":"gamemodes/base/gamemode/init.lua","line":"124-L141"},"args":{"arg":[{"text":"The 64bit Steam ID of the joining player, use util.SteamIDFrom64 to convert it to a `STEAM_0:` one.","name":"steamID64","type":"string"},{"text":"The IP of the connecting client","name":"ipAddress","type":"string"},{"text":"The current value of sv_password (the password set by the server)","name":"svPassword","type":"string"},{"text":"The password provided by the client","name":"clPassword","type":"string"},{"text":"The name of the joining player","name":"name","type":"string"}]},"rets":{"ret":[{"text":"If the hook returns `false` then the player is disconnected","name":"","type":"boolean"},{"text":"If returning false in the first argument, then this should be the disconnect message. This will default to `#GameUI_ServerRejectBadPassword`, which is `Bad Password.` translated to the client's language.","name":"","type":"string"}]}},"example":{"description":"A user access whitelist to the server.\n\nA list of pre-defined messages can be found in `../sourceengine/resource/gameui_english.txt`, modifications [here](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/resource/garrysmod_english.txt) and historically combined (pre oct 2024) [here](https://github.com/Facepunch/garrysmod/blob/5c49c3924569f9db24ed33fa3eb4dcfccaf262b2/garrysmod/resource/gameui_english.txt).\n\nSuggested messages are `#GameUI_ConnectionFailed` and `#GameUI_ServerRejectLANRestrict`.","code":"local allowed = {\n\t[ \"76561198012345678\" ] = true, -- Me\n\t[ \"76561198123456789\" ] = true, -- Friend #1\n\t[ \"76561198234567890\" ] = true, -- Friend #2\n}\n\nhook.Add( \"CheckPassword\", \"access_whitelist\", function( steamID64 )\n\tif not allowed[ steamID64 ] then\n\t\treturn false, \"#GameUI_ServerRejectLANRestrict\"\n\tend\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"ClientSignOnStateChanged","parent":"GM","type":"hook","description":{"text":"Called when a player's sign on state changes.","bug":{"text":"You cannot get a valid player object from the userID at any point during this hook.","issue":"4899"}},"realm":"Shared","added":"2021.03.31","args":{"arg":[{"text":"The userID of the player whose sign on state has changed.","name":"userID","type":"number"},{"text":"The previous sign on state. See SIGNONSTATE enums.","name":"oldState","type":"number"},{"text":"The new/current sign on state. See SIGNONSTATE enums.","name":"newState","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CloseDermaMenus","parent":"GM","type":"hook","description":"Called when derma menus are closed with Global.CloseDermaMenus.","realm":"Client and Menu","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"729-L730"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CreateClientsideRagdoll","parent":"GM","type":"hook","description":"Called whenever an entity becomes a clientside ragdoll.\n\nSee GM:CreateEntityRagdoll for serverside ragdolls.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"732-L733"},"args":{"arg":[{"text":"The Entity that created the ragdoll","name":"entity","type":"Entity"},{"text":"The ragdoll being created.","name":"ragdoll","type":"Entity"}]}},"example":{"description":"A way of fade out a ragdoll easily. Idea from [here](https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/game/client/c_baseanimating.cpp#L533).","code":"hook.Add( \"CreateClientsideRagdoll\", \"fade_out_corpses\", function( entity, ragdoll )\n\tragdoll:SetSaveValue( \"m_bFadingOut\", true ) -- Set the magic internal variable that will cause the ragdoll to immediately start fading out\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"CreateEntityRagdoll","parent":"GM","type":"hook","description":"Called when a serverside ragdoll of an entity has been created.\n\nSee GM:CreateClientsideRagdoll for clientside ragdolls.","realm":"Server","file":{"text":"gamemodes/base/gamemode/init.lua","line":"85-L86"},"args":{"arg":[{"text":"Entity that owns the ragdoll","name":"owner","type":"Entity"},{"text":"The ragdoll entity","name":"ragdoll","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"CreateMove","parent":"GM","type":"hook","description":{"text":"Allows you to change the players movements before they're sent to the server.\n\nSee Game Movement for an explanation on the move system.","note":"Due to this hook being clientside only, it could be overridden by the user allowing them to completely skip your logic, it is recommended to use GM:StartCommand in a shared file instead."},"realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"653-L659"},"args":{"arg":{"text":"The User Command data","name":"cmd","type":"CUserCmd"}},"rets":{"ret":{"text":"Return true to:\n* Disable Sandbox C menu \"screen clicking\"\n* Disable Teammate nocollide (verification required)\n* Prevent calling of C_BaseHLPlayer::CreateMove & subsequently C_BasePlayer::CreateMove","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"CreateTeams","parent":"GM","type":"hook","description":"Teams are created within this hook using team.SetUp.\n\nThis hook is called before GM:PreGamemodeLoaded.","realm":"Shared","file":{"text":"gamemodes/base/gamemode/shared.lua","line":"127-L149"}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DoAnimationEvent","parent":"GM","type":"hook","description":"Called upon an animation event, this is the ideal place to call player animation functions such as Player:AddVCDSequenceToGestureSlot, Player:AnimRestartGesture and so on.","realm":"Shared","file":{"text":"gamemodes/base/gamemode/animations.lua","line":"352-L396"},"args":{"arg":[{"text":"Player who is being animated","name":"ply","type":"Player"},{"text":"Animation event. See Enums/PLAYERANIMEVENT","name":"event","type":"number"},{"text":"The data for the event. This is interpreted as an Enums/ACT by `PLAYERANIMEVENT_CUSTOM` and `PLAYERANIMEVENT_CUSTOM_GESTURE`, or a sequence by `PLAYERANIMEVENT_CUSTOM_SEQUENCE`.","name":"data","type":"number","default":"0"}]},"rets":{"ret":{"text":"The translated activity to send to the weapon. See Enums/ACT. Return `ACT_INVALID` if you don't want to send an activity.","name":"","type":"number"}}},"example":{"description":"Fires a custom animation event with `PLAYERANIMEVENT_ATTACK_GRENADE` as the event, and 123 as the extra data on primary attack, and 321 as the secondary attack.\nThe player will play the item throw gesture on the primary attack, and the drop one on secondary.","code":"function SWEP:PrimaryAttack()\n\tself:GetOwner():DoCustomAnimEvent( PLAYERANIMEVENT_ATTACK_GRENADE , 123 )\n\tself:SetNextPrimaryFire(CurTime() + 0.5 )\n\tself:SetNextSecondaryFire(CurTime() + 0.5 )\nend\n\nfunction SWEP:SecondaryAttack()\n\tself:GetOwner():DoCustomAnimEvent( PLAYERANIMEVENT_ATTACK_GRENADE , 321 )\n\tself:SetNextPrimaryFire(CurTime() + 0.5 )\n\tself:SetNextSecondaryFire(CurTime() + 0.5 )\nend\n\nhook.Add(\"DoAnimationEvent\" , \"AnimEventTest\" , function( ply , event , data )\n\tif event == PLAYERANIMEVENT_ATTACK_GRENADE then\n\t\tif data == 123 then\n\t\t\tply:AnimRestartGesture( GESTURE_SLOT_GRENADE, ACT_GMOD_GESTURE_ITEM_THROW, true )\n\t\t\treturn ACT_INVALID\n\t\tend\n\t\t\n\t\tif data == 321 then\n\t\t\tply:AnimRestartGesture( GESTURE_SLOT_GRENADE, ACT_GMOD_GESTURE_ITEM_DROP, true )\n\t\t\treturn ACT_INVALID\n\t\tend\n\tend\nend)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DoPlayerDeath","parent":"GM","type":"hook","description":{"text":"Handles the player's death.\n\nThis hook is **not** called if the player is killed by Player:KillSilent. See GM:PlayerSilentDeath for that.\n\n* GM:PlayerDeath is called after this hook\n* GM:PostPlayerDeath is called after that","note":"Player:Alive will return false in this hook."},"realm":"Server","file":{"text":"gamemodes/base/gamemode/init.lua","line":"39-L57"},"args":{"arg":[{"text":"The player","name":"ply","type":"Player"},{"text":"The entity that killed the player","name":"attacker","type":"Entity"},{"text":"Damage info","name":"dmg","type":"CTakeDamageInfo"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"DrawDeathNotice","parent":"GM","type":"hook","description":"This hook is called every frame to draw all of the current death notices.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_deathnotice.lua","line":"254-L292"},"args":{"arg":[{"text":"X position to draw death notices as a ratio","name":"x","type":"number"},{"text":"Y position to draw death notices as a ratio","name":"y","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawMonitors","parent":"GM","type":"hook","description":"Called every frame before drawing the in-game monitors ( Breencast, in-game TVs, etc ), but doesn't seem to be doing anything, trying to render 2D or 3D elements fail.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"717-L718"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawOverlay","parent":"GM","type":"hook","description":{"text":"Called after all other 2D draw hooks are called. Draws over all VGUI Panels and HUDs.\n\nUnlike GM:HUDPaint, this hook is called with the game paused and while the Camera SWEP is equipped.\n\nDoes not get called when `r_drawvgui` is disabled.","rendercontext":{"hook":"true","type":"2D"}},"realm":"Client and Menu","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"714-L715"}},"example":{"description":"Draws a simple box in top left corner that will be visible even when the main menu is open.","code":"hook.Add(\"DrawOverlay\", \"DrawOverlayExample\", function()\n\tdraw.RoundedBox( 4, 50, 50, 100, 100, Color( 255, 255, 255 ) )\nend )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DrawPhysgunBeam","parent":"GM","type":"hook","description":{"text":"Allows you to override physgun effects rendering.","note":"This is still called when `physgun_drawbeams` is set to `0`, because this hook is also capable of overriding physgun sprite effects, while the convar does not."},"realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"634-L639"},"args":{"arg":[{"text":"Physgun owner","name":"ply","type":"Player"},{"text":"The physgun","name":"physgun","type":"Weapon"},{"text":"Is the beam enabled","name":"enabled","type":"boolean"},{"text":"Entity we are grabbing. This will be NULL if nothing is being held","name":"target","type":"Entity"},{"text":"ID of the physics bone (PhysObj) we are grabbing at. Use Entity:TranslatePhysBoneToBone to translate to an actual bone.","name":"physBone","type":"number"},{"text":"Beam hit position relative to the physics bone (PhysObj) we are grabbing.","name":"hitPos","type":"Vector"}]},"rets":{"ret":{"text":"Return false to hide default effects","name":"","type":"boolean"}}},"example":{"description":"Example code that will draw a direct line from the physgun to the target.","code":"hook.Add( \"DrawPhysgunBeam\", \"test\", function( ply, wep, enabled, target, bone, deltaPos )\n\n\t-- Draw any physgun effects here that are not the beam.\n\n\t-- Not \"firing\" the physgun? Don't draw anything.\n\tif ( !enabled ) then return false end\n\n\tlocal clr = Color( 255, 0, 0 )\n\n\t-- White when not \"firing\" physgun, this will not work with the \"if\" above\n\tif ( !enabled ) then clr = Color( 255, 255, 255, 255 ) end\n\n\tlocal hitpos = ply:GetEyeTrace().HitPos\n\tif ( IsValid( target ) ) then\n\t\tlocal mt = target:GetBoneMatrix( bone )\n\t\tif ( target:TranslatePhysBoneToBone( bone ) >= 0 ) then\n\t\t\tmt = target:GetBoneMatrix( target:TranslatePhysBoneToBone( bone ) )\n\t\tend\n\n\t\thitpos = LocalToWorld( deltaPos, Angle( 0, 0, 0 ), mt:GetTranslation(), mt:GetAngles() )\n\tend\n\n\tlocal srcPos = wep:GetAttachment( 1 ).Pos\n\tif ( !ply:ShouldDrawLocalPlayer() ) then\n\t\tsrcPos = ply:GetViewModel():GetAttachment( 1 ).Pos\n\tend\n\n\trender.DrawLine( srcPos, hitpos, clr )\n\n\treturn false -- Hide original physics gun beam\n\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"EndEntityDriving","parent":"GM","type":"hook","description":"Called right before an entity stops driving. Overriding this hook will cause it to not call drive.End and the player will not stop driving.","realm":"Shared","file":{"text":"gamemodes/base/gamemode/shared.lua","line":"215-L219"},"args":{"arg":[{"text":"The entity being driven","name":"ent","type":"Entity"},{"text":"The player driving the entity","name":"ply","type":"Player"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EntityEmitSound","parent":"GM","type":"hook","description":"Called whenever a sound has been played. This will not be called clientside if the server played the sound without the client also calling Entity:EmitSound.","realm":"Shared","args":{"arg":{"text":"Information about the played sound. Changes done to this table can be applied by returning `true` from this hook.\n\nSee Structures/EmitSoundInfo.","name":"data","type":"table"}},"rets":{"ret":{"text":"* Return `true` to apply all changes done to the data table.\n* Return `false` to prevent the sound from playing.\n* Return `nil` or nothing to play the sound without altering it.","name":"","type":"boolean"}}},"example":{"description":"Slows down all sounds to reflect game.SetTimeScale.","code":"local cheats = GetConVar( \"sv_cheats\" )\nlocal timeScale = GetConVar( \"host_timescale\" )\n\nhook.Add( \"EntityEmitSound\", \"TimeWarpSounds\", function( t )\n\t\n\tlocal p = t.Pitch\n\t\n\tif ( game.GetTimeScale() ~= 1 ) then\n\t\tp = p * game.GetTimeScale()\n\tend\n\t\n\tif ( timeScale:GetFloat() ~= 1 and cheats:GetBool() ) then\n\t\tp = p * timeScale:GetFloat()\n\tend\n\t\n\tif ( p ~= t.Pitch ) then\n\t\tt.Pitch = math.Clamp( p, 0, 255 )\n\t\treturn true\n\tend\n\t\n\tif ( CLIENT and engine.GetDemoPlaybackTimeScale() ~= 1 ) then\n\t\tt.Pitch = math.Clamp( t.Pitch * engine.GetDemoPlaybackTimeScale(), 0, 255 )\n\t\treturn true\n\tend\n\t\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EntityFireBullets","parent":"GM","type":"hook","description":{"text":"Called every time a bullet is about to be fired from an entity, which allows to completely modify the bullet structure before the bullet is actually fired.\n\nSee GM:PostEntityFireBullets if you wish to hook the final bullet values, such as the aim direction post spread calculations.","warning":"This hook is called directly from Entity:FireBullets. Due to this, you cannot call Entity:FireBullets inside this hook or an infinite loop will occur crashing the game."},"realm":"Shared","file":{"text":"gamemodes/base/gamemode/shared.lua","line":"270-L272"},"args":{"arg":[{"text":"The entity that fired the bullet","name":"entity","type":"Entity"},{"text":"The bullet data. See Structures/Bullet.","name":"data","type":"table{Bullet}"}]},"rets":{"ret":{"text":"* Return `true` to apply all changes done to the bullet table.\n* Return `false` to suppress the bullet.","name":"","type":"boolean"}}},"example":{"description":"Replaces all bullet tracer effects with the toolgun tracer effect.","code":"hook.Add( \"EntityFireBullets\", \"EntityFireBulletsHook\", function( ent, data )\n\tdata.TracerName = \"ToolTracer\"\n\treturn true -- Apply the changes\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EntityKeyValue","parent":"GM","type":"hook","description":"Called when a key-value pair is set on an entity on map spawn. Is **not** called by Entity:SetKeyValue.\n\nSee ENTITY:KeyValue for a scripted entities hook, and its scripted weapon alternative: WEAPON:KeyValue.","realm":"Shared","file":{"text":"gamemodes/base/gamemode/shared.lua","line":"120-L121"},"args":{"arg":[{"text":"Entity that the keyvalue is being set on","name":"ent","type":"Entity"},{"text":"Key of the key/value pair","name":"key","type":"string"},{"text":"Value of the key/value pair","name":"value","type":"string"}]},"rets":{"ret":{"text":"If set, the value of the key-value pair will be overridden by this string.","name":"","type":"string"}}},"example":{"description":"Remove [`infodecal`](https://developer.valvesoftware.com/wiki/Infodecal) entities similar to the blue graffiti text behind the big building with numbered floors on **gm_construct**.  \nThe `texture` keyvalue cannot be retrieved from `infodecal` entities.","code":"local unwantedDecals = {\n\t[\"decals/decalgraffiti031a\"] = true,\n\t-- etc.\n}\nhook.Add( \"EntityKeyValue\", \"remove_unwanted_decals\", function( ent, key, value )\n\tif ( key == \"texture\" and IsValid( ent ) and ent:GetClass() == \"infodecal\" ) then\n\t\tif ( unwantedDecals[value] ) then\n\t\t\t-- set a targetname to make the decal remain and not appear automatically:\n\t\t\tent:SetName( \"remove_unwanted_decals\" )\n\t\tend\n\tend\nend )\n\nlocal function remove_unwanted_decals()\n\t-- remove the decals instead of just keeping them invisible:\n\tfor _, decal in ipairs( ents.FindByClass( \"infodecal\" ) ) do\n\t\tif ( decal:GetName() == \"remove_unwanted_decals\" ) then\n\t\t\tdecal:Remove()\n\t\tend\n\tend\nend\nhook.Add( \"InitPostEntity\", \"remove_unwanted_decals\", remove_unwanted_decals )\nhook.Add( \"PostCleanupMap\", \"remove_unwanted_decals\", remove_unwanted_decals )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EntityNetworkedVarChanged","parent":"GM","type":"hook","description":{"text":"Called when an NW2Var is changed.","bug":{"text":"If a NW2Var is set on an entity that is based on a Lua Entity could result in the NW2Var being mixed up with other ones and being updated multiple times.","issue":"5455"},"note":"This hook is fired before the client value is actually changed. Calling the GetNW2 function for the specified variable name within this hook will return the old value, not the current/updated one.  \n\n\tThis hook gets called for all NW2Vars on all Entities in a full update. The old value will be nil in this case.  \n\tIf this hook seems to be called for no apparent reason, check if it's caused by a full update."},"realm":"Shared","args":{"arg":[{"text":"The owner entity of the changed NW2Var","name":"ent","type":"Entity"},{"text":"The name of the changed NW2Var","name":"name","type":"string"},{"text":"The old value of the NW2Var","name":"oldval","type":"any"},{"text":"The new value of the NW2Var","name":"newval","type":"any"}]}},"example":{"description":"Example usage of the hook. Prints out all NW2Var changes.","code":"hook.Add( \"EntityNetworkedVarChanged\", \"printchange\", print )\n\n-- Trigger a change!\nEntity( 1 ):SetNW2String( \"UserGroup\", \"owner\" )","output":"```\nPlayer [1][Player1]\tUserGroup\tsuperadmin\towner\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EntityRemoved","parent":"GM","type":"hook","description":{"text":"Called right before removal of an entity.","warning":"This hook is called clientside during full updates due to how networking works in the Source Engine.\n\nThis can happen when the client briefly loses connection to the server, and can be simulated via `cl_fullupdate` for testing purposes."},"realm":"Shared","file":{"text":"gamemodes/base/gamemode/shared.lua","line":"98-L99"},"args":{"arg":[{"text":"Entity being removed","name":"ent","type":"Entity"},{"text":"Whether the removal is happening due to a full update clientside.\n\nThe entity may or **may not** be recreated immediately after, depending on whether it is in the local player's [PVS](https://developer.valvesoftware.com/wiki/PVS \"PVS - Valve Developer Community\"). (See Entity:IsDormant)","name":"fullUpdate","type":"boolean","added":"2023.09.26"}]}},"example":{"description":"Adds all sent_ball's into a list, which is cleared when they are removed.","code":"local BallList = {}\n\nhook.Add( \"OnEntityCreated\", \"BallList\", function( ent )\n\tif ( not ent:IsValid() or not ent:GetClass() == \"sent_ball\" ) then return end\n\n\tBallList[ ent:EntIndex() ] = ent\nend )\n\nhook.Add( \"EntityRemoved\", \"ClearBallList\", function( ent, fullUpdate )\n\tif ( fullUpdate ) then return end\n\n\tBallList[ ent:EntIndex() ] = nil\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"EntityTakeDamage","parent":"GM","type":"hook","description":{"text":"Called when an entity is about to take damage. You can modify all parts of the damage info in this hook or completely block the damage event.\n\nSee GM:PostEntityTakeDamage if you wish to hook the final damage event.","warning":"Applying damage from this hook to the entity taking damage will lead to infinite loop/crash."},"realm":"Server","file":{"text":"gamemodes/base/gamemode/init.lua","line":"71-L72"},"args":{"arg":[{"text":"The entity taking damage","name":"target","type":"Entity"},{"text":"Detailed information about the damage event.","name":"dmg","type":"CTakeDamageInfo"}]},"rets":{"ret":{"text":"Return true to completely block the damage event","name":"","type":"boolean"}}},"example":[{"description":"Explosion damage is reduced to players only.","code":"hook.Add( \"EntityTakeDamage\", \"EntityDamageExample\", function( target, dmginfo )\n\tif ( target:IsPlayer() and dmginfo:IsExplosionDamage() ) then\n\t\tdmginfo:ScaleDamage( 0.5 ) // Damage is now half of what you would normally take.\n\tend\nend )"},{"description":"Players in vehicles takes halved damage.","code":"hook.Add( \"EntityTakeDamage\", \"EntityDamageExample2\", function( target, dmginfo )\n    if ( target:IsVehicle() ) then\n        local ply = target:GetDriver()\n        if ( IsValid(ply) && dmginfo:GetDamage() > 1 ) then\n            dmginfo:SetDamage(dmginfo:GetDamage() / 2)\n\n            ply:TakeDamageInfo(dmginfo)\n\n            dmginfo:SetDamage(0)\n        end\n    end\nend )"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"FindUseEntity","parent":"GM","type":"hook","description":{"text":"This hook polls the entity the player use action should be applied to.","note":"The default behavior of this hook is in [CBasePlayer::FindUseEntity](https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/game/shared/baseplayer_shared.cpp#L1068-L1270). Despite CBasePlayer::FindUseEntity being defined shared, it is only called serverside in practice, so this hook will be only called serverside, as well. It is possible for modules to call it clientside, so the Lua code should still be treated as shared."},"realm":"Shared","file":{"text":"gamemodes/base/gamemode/player_shd.lua","line":"103-L120"},"args":{"arg":[{"text":"The player who initiated the use action.","name":"ply","type":"Player"},{"text":"The entity that was chosen by the engine.","name":"defaultEnt","type":"Entity"}]},"rets":{"ret":{"text":"The entity to use instead of default entity","name":"","type":"Entity"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"FinishChat","parent":"GM","type":"hook","description":"Runs when user cancels/finishes typing.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"237-L238"}},"example":{"description":"Prints `User has closed the chatbox.` when player closes their chat or sends the message.","code":"hook.Add( \"FinishChat\", \"ClientFinishTyping\", function()\n\tprint( \"User has closed the chatbox.\" )\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"FinishMove","parent":"GM","type":"hook","description":"Called after GM:Move, applies all the changes from the CMoveData to the player.\n\nSee Game Movement for an explanation on the move system.","realm":"Shared","file":{"text":"gamemodes/base/gamemode/shared.lua","line":"189-L194"},"predicted":"Yes","args":{"arg":[{"text":"Player","name":"ply","type":"Player"},{"text":"Movement data","name":"mv","type":"CMoveData"}]},"rets":{"ret":{"text":"Return true to suppress default engine behavior, i.e. declare that you have already moved the player according to the move data in a custom way.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ForceDermaSkin","parent":"GM","type":"hook","description":{"text":"Called to allow override of the default Derma skin for all panels.","note":["This hook is only called on Lua start up, changing its value (or adding new hooks) after it has been already called will not have any effect.","You can Panel:SetSkin \"Default\" (or other skins) on the frame/base panel and they will still take priority"]},"realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"437-L442"},"rets":{"ret":{"text":"A **case sensitive** Derma skin name to be used as default, registered previously via derma.DefineSkin.\n\n\nReturning nothing, nil or invalid name will make it fallback to the \"Default\" skin.","name":"","type":"string"}}},"example":{"description":"Example on how to use this hook. This will make all panels use specified skin.","code":"hook.Add( \"ForceDermaSkin\", \"my_new_skin\", function()\n\treturn \"some_skin\"\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GameContentChanged","parent":"GM","type":"hook","description":"Called when game content has been changed, for example an addon or a mountable game was (un)mounted.","realm":"Shared and Menu"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"GetDeathNoticeEntityName","parent":"GM","type":"hook","description":"An internal function used to get an untranslated string to show in the kill feed as the entity's name. See GM:SendDeathNotice","realm":"Server","file":{"text":"gamemodes/base/gamemode/npc.lua","line":"49-L79"},"args":{"arg":{"text":"The name of the entity.","name":"name","type":"string|Entity"}},"rets":{"ret":{"text":"The untranslated name for given NPC. The translation/localization would happen on the client.","name":"","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetFallDamage","parent":"GM","type":"hook","description":"Called when a player takes damage from falling, allows to override the damage.","realm":"Server","file":{"text":"gamemodes/base/gamemode/player.lua","line":"727-L735"},"args":{"arg":[{"text":"The player","name":"ply","type":"Player"},{"text":"The fall speed","name":"speed","type":"number"}]},"rets":{"ret":{"text":"New fall damage","name":"","type":"number"}}},"example":[{"description":"The player takes a realistic amount of damage when they fall. Fall damage becomes the fall speed divided by 8.","code":"hook.Add( \"GetFallDamage\", \"RealisticDamage\", function( ply, speed )\n    return ( speed / 8 )\nend )"},{"description":"Closely approximates the Counter-Strike: Source fall damage.","code":"hook.Add( \"GetFallDamage\", \"CSSFallDamage\", function( ply, speed )\n\treturn math.max( 0, math.ceil( 0.2418 * speed - 141.75 ) )\nend )"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"GetGameDescription","parent":"GM","type":"hook","description":{"text":"Called when the game(server) needs to update the text shown in the server browser as the gamemode. Runs at a ~2s interval, runs even when the server is hibernating.","note":"This hook (and the `sv_gamename_override` command) may not work on some popular gamemodes like DarkRP or Trouble Terrorist Town. This is not a bug, it's just how it works. See [here](https://github.com/Facepunch/garrysmod-issues/issues/4637#issuecomment-677884989) for more information.\n\nAlso, it **only** works on dedicated servers and is called at regular intervals (about one second) **even** if the server has no players and the hibernation function is enabled."},"realm":"Shared","file":{"text":"gamemodes/base/gamemode/shared.lua","line":"76-L78"},"rets":{"ret":{"text":"The text to be shown in the server browser as the gamemode.","name":"","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetMotionBlurValues","parent":"GM","type":"hook","description":"Allows you to modify the Source Engine's motion blur shaders.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"462-L468"},"args":{"arg":[{"text":"The amount of horizontal blur.","name":"horizontal","type":"number"},{"text":"The amount of vertical  blur.","name":"vertical","type":"number"},{"text":"The amount of forward/radial blur.","name":"forward","type":"number"},{"text":"The amount of rotational blur.","name":"rotational","type":"number"}]},"rets":{"ret":[{"text":"New amount of horizontal blur.","name":"","type":"number"},{"text":"New amount of vertical blur.","name":"","type":"number"},{"text":"New amount of forward/radial blur.","name":"","type":"number"},{"text":"New amount of rotational blur.","name":"","type":"number"}]}},"example":{"description":"Makes your forward/radial blur pulse.","code":"hook.Add( \"GetMotionBlurValues\", \"GetNewMotionBlurValues\", function( horizontal, vertical, forward, rotational )\n    forward = forward * math.sin( CurTime() * 5 )\n    return horizontal, vertical, forward, rotational\nend )","output":"Your radial blur pulses."},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetPreferredCarryAngles","parent":"GM","type":"hook","description":{"text":"Called to determine preferred carry angles for the entity. It works for both, +use pickup and gravity gun pickup.","warning":"Due to nature of the gravity gun coding in multiplayer, this hook **MAY** seem to not work ( but rest assured it does ), due to clientside prediction not knowing the carry angles. The +use pickup doesn't present this issue as it doesn't predict the player carrying the object clientside ( as you may notice by the prop lagging behind in multiplayer )","note":"This hook can **not** override preferred carry angles of props such as the sawblade and the harpoon."},"realm":"Server","args":{"arg":[{"text":"The entity to generate carry angles for","name":"ent","type":"Entity"},{"text":"The player who is holding the object","name":"ply","type":"Player"}]},"rets":{"ret":{"text":"The preferred carry angles for the entity.","name":"","type":"Angle"}}},"example":{"description":"Makes all pickupable entities default to Angle( 0, 0, 0 ) relatively to players aim direction.","code":"hook.Add( \"GetPreferredCarryAngles\", \"MyPreferredCarryAngles\", function( ent )\n\treturn Angle( 0, 0, 0 )\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetTeamColor","parent":"GM","type":"hook","description":"Returns the color for the given entity's team. This is used in chat and deathnotice text.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"124-L130"},"args":{"arg":{"text":"Entity","name":"ent","type":"Entity"}},"rets":{"ret":{"text":"Team Color","name":"","type":"Color"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTeamNumColor","parent":"GM","type":"hook","description":"Returns the team color for the given team index.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"136-L140"},"args":{"arg":{"text":"Team index","name":"team","type":"number"}},"rets":{"ret":{"text":"Team Color","name":"","type":"Color"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GrabEarAnimation","parent":"GM","type":"hook","description":"Override this hook to disable/change ear-grabbing in your gamemode. By default, it is not called anywhere on the server.","realm":"Shared","file":{"text":"gamemodes/base/gamemode/animations.lua","line":"249-L271"},"args":{"arg":{"text":"Player","name":"ply","type":"Player"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GravGunOnDropped","parent":"GM","type":"hook","description":"Called when an entity is released by a gravity gun.\n\nSee GM:PhysgunDrop for the Physics Gun drop variant.","realm":"Server","file":{"text":"gamemodes/base/gamemode/gravitygun.lua","line":"33-L34"},"args":{"arg":[{"text":"Player who is wielding the gravity gun","name":"ply","type":"Player"},{"text":"The entity that has been dropped","name":"ent","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GravGunOnPickedUp","parent":"GM","type":"hook","description":"Called when an entity is picked up by a gravity gun.\n\nSee GM:OnPlayerPhysicsPickup for the player `+use` pickup variant.\n\nSee GM:OnPhysgunPickup for the Physics Gun pickup variant.","realm":"Server","file":{"text":"gamemodes/base/gamemode/gravitygun.lua","line":"25-L26"},"args":{"arg":[{"text":"The player wielding the gravity gun","name":"ply","type":"Player"},{"text":"The entity that has been picked up by the gravity gun","name":"ent","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GravGunPickupAllowed","parent":"GM","type":"hook","description":"Called every tick to poll whether a player is allowed to pick up an entity with the gravity gun or not.\n\nSee GM:AllowPlayerPickup for the +USE pickup variant.\n\nSee GM:PhysgunPickup for the Physics Gun pickup variant.\n\nCalls ENTITY:GravGunPickupAllowed on the entity being hovered every frame in Sandbox-derived gamemodes.","realm":"Server","file":{"text":"gamemodes/base/gamemode/gravitygun.lua","line":"15-L17"},"args":{"arg":[{"text":"The player wielding the gravity gun","name":"ply","type":"Player"},{"text":"The entity the player is attempting to pick up","name":"ent","type":"Entity"}]},"rets":{"ret":{"text":"Return true to allow entity pick up","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GravGunPunt","parent":"GM","type":"hook","description":"Called when an entity is about to be punted with the gravity gun (primary fire).\n\nBy default this function makes ENTITY:GravGunPunt work in Sandbox derived gamemodes.","realm":"Shared","file":{"text":"gamemodes/base/gamemode/gravitygun.lua","line":"7-L9"},"args":{"arg":[{"text":"The player wielding the gravity gun","name":"ply","type":"Player"},{"text":"The entity the player is attempting to punt","name":"ent","type":"Entity"}]},"rets":{"ret":{"text":"Return true to allow and false to disallow.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GUIMouseDoublePressed","parent":"GM","type":"hook","description":"Called when the mouse has been double clicked on any panel derived from CGModBase, such as the panel used by gui.EnableScreenClicker and the panel used by Panel:ParentToHUD.\n\nBy default this hook calls GM:GUIMousePressed.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"99-L103"},"args":{"arg":[{"text":"The code of the mouse button pressed, see Enums/MOUSE","name":"mouseCode","type":"number"},{"text":"A normalized vector pointing in the direction the client has clicked","name":"aimVector","type":"Vector"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GUIMousePressed","parent":"GM","type":"hook","description":"Called whenever a players presses a mouse key on the context menu in Sandbox or on any panel derived from CGModBase, such as the panel used by gui.EnableScreenClicker and the panel used by Panel:ParentToHUD.\n\nSee GM:VGUIMousePressed for a hook that is called on all VGUI elements.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"681-L682"},"args":{"arg":[{"text":"The key that the player pressed using Enums/MOUSE.","name":"mouseCode","type":"number"},{"text":"A normalized direction vector local to the camera. Internally, this is  gui.ScreenToVector( gui.MousePos() ).","name":"aimVector","type":"Vector"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GUIMouseReleased","parent":"GM","type":"hook","description":"Called whenever a players releases a mouse key on the context menu in Sandbox or on any panel derived from CGModBase, such as the panel used by gui.EnableScreenClicker and the panel used by Panel:ParentToHUD.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"688-L689"},"args":{"arg":[{"text":"The key the player released, see Enums/MOUSE","name":"mouseCode","type":"number"},{"text":"A normalized direction vector local to the camera. Internally this is  gui.ScreenToVector( gui.MousePos() ).","name":"aimVector","type":"Vector"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"HandlePlayerArmorReduction","parent":"GM","type":"hook","description":{"text":"Called to handle player armor reduction, when player receives damage.","validate":"Clarify hook order with other damage hooks."},"realm":"Server","file":{"text":"gamemodes/base/gamemode/player.lua","line":"829-L861"},"args":{"arg":[{"text":"The player that took damage.","type":"Player","name":"ply"},{"text":"The taken damage.","type":"CTakeDamageInfo","name":"dmginfo"}]}},"example":{"description":"The default Half-Life 2 armor reduction system.","code":"function GM:HandlePlayerArmorReduction( ply, dmginfo )\n\n\t-- If no armor, or special damage types, bypass armor \n\tif ( ply:Armor() <= 0 || bit.band( dmginfo:GetDamageType(), DMG_FALL + DMG_DROWN + DMG_POISON + DMG_RADIATION ) != 0 ) then return end\n\n\tlocal flBonus = 1.0 -- Each Point of Armor is worth 1/x points of health\n\tlocal flRatio = 0.2 -- Armor Takes 80% of the damage\n\tif ( GetConVar( \"player_old_armor\" ):GetBool() ) then\n\t\tflBonus = 0.5\n\tend\n\n\tlocal flNew = dmginfo:GetDamage() * flRatio\n\tlocal flArmor = (dmginfo:GetDamage() - flNew) * flBonus\n\n\tif ( !GetConVar( \"player_old_armor\" ):GetBool() ) then\n\t\tif ( flArmor < 1.0 ) then flArmor = 1.0 end\n\tend\n\n\t-- Does this use more armor than we have?\n\tif ( flArmor > ply:Armor() ) then\n\n\t\tflArmor = ply:Armor() * ( 1 / flBonus )\n\t\tflNew = dmginfo:GetDamage() - flArmor\n\t\tply:SetArmor( 0 )\n\n\telse\n\t\tply:SetArmor( ply:Armor() - flArmor )\n\tend\n\n\tdmginfo:SetDamage( flNew )\n\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"HandlePlayerDriving","parent":"GM","type":"hook","description":"Allows to override player driving animations.","realm":"Shared","file":{"text":"gamemodes/base/gamemode/animations.lua","line":"139-L192"},"args":{"arg":{"text":"Player to process","name":"ply","type":"Player"}},"rets":{"ret":{"text":"Return true if we've changed/set the animation, false otherwise","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"HandlePlayerDucking","parent":"GM","type":"hook","description":"Allows to override player crouch animations.","realm":"Shared","file":{"text":"gamemodes/base/gamemode/animations.lua","line":"55-L69"},"args":{"arg":[{"text":"The player","name":"ply","type":"Player"},{"text":"Players velocity","name":"velocity","type":"Vector"}]},"rets":{"ret":{"text":"Return true if we've changed/set the animation, false otherwise","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"HandlePlayerJumping","parent":"GM","type":"hook","description":"Called every frame by the player model animation system. Allows to override player jumping animations.","realm":"Shared","file":{"text":"gamemodes/base/gamemode/animations.lua","line":"2-L53"},"args":{"arg":[{"text":"The player","name":"ply","type":"Player"},{"text":"Players velocity","name":"velocity","type":"Vector"}]},"rets":{"ret":{"text":"Return true if we've changed/set the animation, false otherwise","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"HandlePlayerLanding","parent":"GM","type":"hook","description":"Called every frame by the player model animation system. Allows to override player landing animations.","realm":"Shared","file":{"text":"gamemodes/base/gamemode/animations.lua","line":"129-L137"},"args":{"arg":[{"text":"The player","name":"ply","type":"Player"},{"text":"Players velocity","name":"velocity","type":"Vector"},{"text":"Was the player on ground?","name":"onGround","type":"boolean"}]},"rets":{"ret":{"text":"Return true if we've changed/set the animation, false otherwise","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"HandlePlayerNoClipping","parent":"GM","type":"hook","description":"Allows to override player noclip animations.","realm":"Shared","file":{"text":"gamemodes/base/gamemode/animations.lua","line":"71-L98"},"args":{"arg":[{"text":"The player","name":"ply","type":"Player"},{"text":"Players velocity","name":"velocity","type":"Vector"}]},"rets":{"ret":{"text":"Return true if we've changed/set the animation, false otherwise","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"HandlePlayerSwimming","parent":"GM","type":"hook","description":"Allows to override player swimming animations.","realm":"Shared","file":{"text":"gamemodes/base/gamemode/animations.lua","line":"113-L127"},"args":{"arg":[{"text":"The player","name":"ply","type":"Player"},{"text":"Players velocity","name":"velocity","type":"Vector"}]},"rets":{"ret":{"text":"Return true if we've changed/set the animation, false otherwise","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"HandlePlayerVaulting","parent":"GM","type":"hook","description":"Allows to override player flying ( in mid-air, not noclipping ) animations.","realm":"Shared","file":{"text":"gamemodes/base/gamemode/animations.lua","line":"100-L111"},"args":{"arg":[{"text":"The player","name":"ply","type":"Player"},{"text":"Players velocity","name":"velocity","type":"Vector"}]},"rets":{"ret":{"text":"Return true if we've changed/set the animation, false otherwise","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"HideTeam","parent":"GM","type":"hook","description":"Hides the team selection panel.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_pickteam.lua","line":"58-L65"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"HUDAmmoPickedUp","parent":"GM","type":"hook","description":"Called when the client has picked up ammo. Override to disable default HUD notification.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_hudpickup.lua","line":"64-L92"},"args":{"arg":[{"text":"Name of the item (ammo) picked up","name":"itemName","type":"string"},{"text":"Amount of the item (ammo) picked up","name":"amount","type":"number"}]}},"example":{"code":"hook.Add( \"HUDAmmoPickedUp\", \"AmmoPickedUp\", function( itemName, amount )\n    -- You would use HUDPaint or DFrame\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"HUDDrawPickupHistory","parent":"GM","type":"hook","description":"Renders the HUD pick-up history. Override to hide default or draw your own HUD.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_hudpickup.lua","line":"94-L173"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"HUDDrawScoreBoard","parent":"GM","type":"hook","description":{"text":"Called every frame to render the scoreboard.\n\n\nIt is recommended to use Derma and VGUI for this job instead of this hook. Called right after GM:HUDPaint.","rendercontext":{"hook":"true","type":"2D"}},"realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_scoreboard.lua","line":"294-L295"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"HUDDrawTargetID","parent":"GM","type":"hook","description":"Called from GM:HUDPaint to draw player info when you hover over a player with your crosshair or mouse.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_targetid.lua","line":"6-L60"},"rets":{"ret":{"text":"Should the player info be drawn.","name":"","type":"boolean"}}},"example":{"description":"This code will turn off the player and health appearing when you look at them.","code":"-- First solution: return false\nhook.Add( \"HUDDrawTargetID\", \"HidePlayerInfo\", function()\n\n\treturn false\n\nend )\n\n-- Second solution: override the gamemode hook\nfunction GM:HUDDrawTargetID()\n\n\treturn false\n\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"HUDItemPickedUp","parent":"GM","type":"hook","description":"Called when an item has been picked up. Override to disable the default HUD notification.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_hudpickup.lua","line":"36-L45"},"args":{"arg":{"text":"Name of the picked up item","name":"itemName","type":"string"}}},"example":{"code":"hook.Add( \"HUDItemPickedUp\", \"ItemPickedUp\", function( itemName )\n    -- Register the addition or create a Panel here\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"HUDPaint","parent":"GM","type":"hook","description":{"text":"Called whenever the HUD should be drawn.\n\n\t\tThis is the ideal place to draw custom HUD elements.\n\n\t\tTo prevent the default game HUD from drawing, use GM:HUDShouldDraw.\n\n\t\tThis hook does **not** get called when the Camera SWEP is held, or when the  menu is open.  \n\t\tIf you need to draw in those situations, use GM:DrawOverlay instead.","key":"esc","rendercontext":{"hook":"true","type":"2D"}},"realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"80-L86"}},"example":{"description":"Draws a transparent black box in the top left corner of the screen.","code":"hook.Add( \"HUDPaint\", \"HUDPaint_DrawABox\", function()\n\tsurface.SetDrawColor( 0, 0, 0, 128 )\n\tsurface.DrawRect( 50, 50, 128, 128 )\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"HUDPaintBackground","parent":"GM","type":"hook","description":{"text":"Called before GM:HUDPaint when the HUD background is being drawn.\n\nJust like GM:HUDPaint, this hook will not be called when the main menu is visible. GM:PostDrawHUD does not have this behavior.\n\nThings rendered in this hook will **always** appear behind things rendered in GM:HUDPaint.","rendercontext":{"hook":"true","type":"2D"}},"realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"92-L93"}},"example":{"description":"Draws a transparent black box in the top left corner of the screen, behind all other HUD elements.","code":"hook.Add( \"HUDPaintBackground\", \"HUDPaintBackground_DrawABox\", function()\n\tsurface.SetDrawColor( 0, 0, 0, 128 )\n\tsurface.DrawRect( 50, 50, 128, 128 )\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"HUDShouldDraw","parent":"GM","type":"hook","description":{"text":"Called when the Gamemode is about to draw a given element on the client's HUD (heads-up display).","warning":"This hook is called HUNDREDS of times per second (more than 5 times per frame on average). You shouldn't be performing any computationally intensive operations. For Weapons you SHOULD use WEAPON:HUDShouldDraw instead."},"realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"49-L74"},"args":{"arg":{"text":"The name of the HUD element. You can find a full list of HUD elements for this hook here.","name":"name","type":"string"}},"rets":{"ret":{"text":"Return false to prevent the given element from being drawn on the client's screen.","name":"","type":"boolean"}}},"example":{"description":"Hides the default health and battery (armor) HUD elements, while still allowing the display of other elements to be controlled by other addons.","code":"local hide = {\n\t[\"CHudHealth\"] = true,\n\t[\"CHudBattery\"] = true\n}\n\nhook.Add( \"HUDShouldDraw\", \"HideHUD\", function( name )\n\tif ( hide[ name ] ) then\n\t\treturn false\n\tend\n\n\t-- Don't return anything here, it may break other addons that rely on this hook.\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"HUDWeaponPickedUp","parent":"GM","type":"hook","description":"Called when a weapon has been picked up. Override to disable the default HUD notification.","realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_hudpickup.lua","line":"36-L45"},"args":{"arg":{"text":"The picked up weapon","name":"weapon","type":"Weapon"}}},"example":{"code":"hook.Add( \"HUDWeaponPickedUp\", \"WeaponPickedUp\", function( weapon )\n    -- You would use HUDPaint or DFrame\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Initialize","parent":"GM","type":"hook","description":"Called after the gamemode loads and starts.\n\nNo entities would be present at the time this hook is called, please see GM:InitPostEntity for a one time fire hook after all map entities have been initialized.","realm":"Shared"},"example":{"description":"\"hi\" will be printed to the console when the gamemode initializes.","code":"function GM:Initialize()\n\tprint( \"hi\" )\nend\n\n-- That way you are overriding the default hook.\n-- You can use hook.Add to make more functions get called on initialization.\nhook.Add( \"Initialize\", \"some_unique_name\", function()\n\tprint( \"Initialization hook called\" )\nend )","output":"`Initialization hook called` and `hi`"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"InitPostEntity","parent":"GM","type":"hook","description":{"text":"Called after all the entities are initialized. Starting from this hook Global.LocalPlayer will return valid object.","note":"At this point the client only knows about the entities that are within the spawnpoints' [PVS (Potential Visibility Set)](https://developer.valvesoftware.com/wiki/PVS \"PVS - Valve Developer Community\"). For instance, if the server sends an entity that is not within this PVS, the client will receive it as NULL entity."},"realm":"Shared"},"example":{"description":"Some message will be printed in the console when the entities initialize.","code":"function GM:InitPostEntity()\n\tprint( \"All Entities have initialized\" )\nend\n\n-- That way you are overriding the default hook.\n-- You can use hook.Add to make more functions get called when this event occurs.\nhook.Add( \"InitPostEntity\", \"some_unique_name\", function()\n\tprint( \"Initialization hook called\" )\nend )","output":"`Initialization hook called` and `All Entities have initialized`."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"InputMouseApply","parent":"GM","type":"hook","description":"Allows you to modify the supplied User Command with mouse input. This could be used to make moving the mouse do funky things to view angles.","realm":"Client","args":{"arg":[{"text":"User command.","name":"cmd","type":"CUserCmd"},{"text":"The amount of mouse movement across the X axis this frame.","name":"x","type":"number"},{"text":"The amount of mouse movement across the Y axis this frame.","name":"y","type":"number"},{"text":"The current view angle.","name":"ang","type":"Angle"}]},"rets":{"ret":{"text":"Return true if we modified something.","name":"","type":"boolean"}}},"example":{"description":"Prevents all players from turning with the mouse.","code":"hook.Add( \"InputMouseApply\", \"FreezeTurning\", function( cmd )\n\tcmd:SetMouseX( 0 )\n\tcmd:SetMouseY( 0 )\n\n\treturn true\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsSpawnpointSuitable","parent":"GM","type":"hook","description":"Check if a player can spawn at a certain spawnpoint.","realm":"Server","file":{"text":"gamemodes/base/gamemode/player.lua","line":"330-L358"},"args":{"arg":[{"text":"The player who is spawned","name":"ply","type":"Player"},{"text":"The spawnpoint entity (on the map).","name":"spawnpoint","type":"Entity"},{"text":"If this is true, it'll kill any players blocking the spawnpoint.","name":"makeSuitable","type":"boolean"}]},"rets":{"ret":{"text":"Return true to indicate that the spawnpoint is suitable (Allow for the player to spawn here), false to prevent spawning.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"KeyPress","parent":"GM","type":"hook","description":{"text":"Called whenever a player pressed a key included within the IN keys.\n\nFor a more general purpose function that handles all kinds of input, see GM:PlayerButtonDown.\nSee GM:KeyRelease for the key release event.\n\nDespite being a predicted hook, it will still be called in singleplayer for your convenience.","warning":"Due to this being a predicted hook, Global.ParticleEffects created only serverside from this hook will not be networked to the client, so make sure to do that on both realms."},"realm":"Shared","predicted":"Yes","args":{"arg":[{"text":"The player pressing the key. If running client-side, this will always be Global.LocalPlayer.","name":"ply","type":"Player"},{"text":"The key that the player pressed using Enums/IN.","name":"key","type":"number"}]}},"example":[{"description":{"text":"`hi` will be printed to the console when the player presses the  key ().","key":["+USE","E"]},"code":"hook.Add( \"KeyPress\", \"keypress_use_hi\", function( ply, key )\n\tif ( key == IN_USE ) then\n\t\tprint( \"hi\" )\n\tend\nend )","output":"hi"},{"description":"When a player tries to jump, they will be shot straight up in the air.","code":"hook.Add( \"KeyPress\", \"keypress_jump_super\", function( ply, key )\n    if ( key == IN_JUMP ) then\n        ply:SetVelocity( ply:GetVelocity() + Vector( 0, 0, 1000 ) )\n    end\nend )"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"KeyRelease","parent":"GM","type":"hook","description":"Runs when a IN key was released by a player.\n\nFor a more general purpose function that handles all kinds of input, see GM:PlayerButtonUp.\nSee GM:KeyPress for the key press event.\n\nDespite being a predicted hook, it will still be called in singleplayer for your convenience.","realm":"Shared","predicted":"Yes","args":{"arg":[{"text":"The player releasing the key. If running client-side, this will always be Global.LocalPlayer.","name":"ply","type":"Player"},{"text":"The key that the player released using Enums/IN.","name":"key","type":"number"}]}},"example":{"description":{"text":"`hi` will be printed to the console when the player releases the  key ().","key":["+USE","E"]},"code":"hook.Add( \"KeyRelease\", \"UseExample\", function( ply, key )\n    if ( key == IN_USE ) then\n        print( \"hi\" )\n    end\nend )","output":"hi"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"LoadGModSave","parent":"GM","type":"hook","description":{"text":"Called from `gm_load` when the game should load a map.","internal":""},"realm":"Server","args":{"arg":[{"text":"Compressed save data","name":"data","type":"string"},{"text":"The name of the map the save was created on","name":"map","type":"string"},{"text":"The time the save was created on. Will always be 0.","name":"timestamp","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"LoadGModSaveFailed","parent":"GM","type":"hook","description":"Called while an addon from the Steam workshop is downloading. Used by default to update details on the fancy workshop download panel.","realm":"Menu","file":{"text":"lua/menu/mount/mount.lua","line":"40-50"},"args":{"arg":[{"text":"Failure Reason.","name":"reason","type":"string"},{"text":"the workshop ID of the missing map (if found). Can be an empty string","name":"workshopid","type":"string"}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"MenuStart","parent":"GM","type":"hook","description":"Called when `menu.lua` has finished loading.","realm":"Menu"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"MouthMoveAnimation","parent":"GM","type":"hook","description":"Override this gamemode function to disable mouth movement when talking on voice chat. By default, it is not called anywhere on the server.","realm":"Shared","file":{"text":"gamemodes/base/gamemode/animations.lua","line":"276-L294"},"args":{"arg":{"text":"Player in question","name":"ply","type":"Player"}}},"example":{"description":"The default functionality taken from the base gamemode.","code":"function GM:MouthMoveAnimation( ply )\n\n\tlocal flexes = {\n\t\tply:GetFlexIDByName( \"jaw_drop\" ),\n\t\tply:GetFlexIDByName( \"left_part\" ),\n\t\tply:GetFlexIDByName( \"right_part\" ),\n\t\tply:GetFlexIDByName( \"left_mouth_drop\" ),\n\t\tply:GetFlexIDByName( \"right_mouth_drop\" )\n\t}\n\n\tlocal weight = ply:IsSpeaking() && math.Clamp( ply:VoiceVolume() * 2, 0, 2 ) || 0\n\n\tfor k, v in pairs( flexes ) do\n\n\t\tply:SetFlexWeight( v, weight )\n\n\tend\n\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Move","parent":"GM","type":"hook","description":"The Move hook is called for you to manipulate the player's MoveData. \n\nYou shouldn't adjust the player's position in any way in the move hook. This is because due to prediction errors, the netcode might run the move hook multiple times as packets arrive late. Therefore you should only adjust the movedata construct in this hook.\n\nGenerally you shouldn't have to use this hook - if you want to make a custom move type you should look at the drive system.\n\nThis hook is called after GM:PlayerTick.\n\nSee Game Movement for an explanation on the move system.","realm":"Shared","predicted":"Yes","args":{"arg":[{"text":"Player","name":"ply","type":"Player"},{"text":"Movement information","name":"mv","type":"CMoveData"}]},"rets":{"ret":{"text":"Return true to suppress default engine action.","name":"","type":"boolean"}}},"example":{"description":"A noclip move type.","code":"hook.Add( \"Move\", \"Noclip\", function( ply, mv )\n\n\t--\n\t-- Set up a speed, go faster if shift is held down\n\t--\n\tlocal speed = 0.0005 * FrameTime()\n\tif ( mv:KeyDown( IN_SPEED ) ) then speed = 0.005 * FrameTime() end\n\n\t--\n\t-- Get information from the movedata\n\t--\n\tlocal ang = mv:GetMoveAngles()\n\tlocal pos = mv:GetOrigin()\n\tlocal vel = mv:GetVelocity()\n\n\t--\n\t-- Add velocities. This can seem complicated. On the first line\n\t-- we're basically saying get the forward vector, then multiply it\n\t-- by our forward speed (which will be > 0 if we're holding W, < 0 if we're\n\t-- holding S and 0 if we're holding neither) - and add that to velocity.\n\t-- We do that for right and up too, which gives us our free movement.\n\t--\n\tvel = vel + ang:Forward() * mv:GetForwardSpeed() * speed\n\tvel = vel + ang:Right() * mv:GetSideSpeed() * speed\n\tvel = vel + ang:Up() * mv:GetUpSpeed() * speed\n\n\t--\n\t-- We don't want our velocity to get out of hand so we apply\n\t-- a little bit of air resistance. If no keys are down we apply\n\t-- more resistance so we slow down more.\n\t--\n\tif ( math.abs( mv:GetForwardSpeed() ) + math.abs( mv:GetSideSpeed() ) + math.abs( mv:GetUpSpeed() ) < 0.1 ) then\n\t\tvel = vel * 0.90\n\telse\n\t\tvel = vel * 0.99\n\tend\n\n\t--\n\t-- Add the velocity to the position (this is the movement)\n\t--\n\tpos = pos + vel\n\n\t--\n\t-- We don't set the newly calculated values on the entity itself\n\t-- we instead store them in the movedata. They should get applied\n\t-- in the FinishMove hook.\n\t--\n\tmv:SetVelocity( vel )\n\tmv:SetOrigin( pos )\n\n\t--\n\t-- Return true to not use the default behavior\n\t--\n\treturn true\n\nend)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"NeedsDepthPass","parent":"GM","type":"hook","description":"Returning true in this hook will cause it to render depth buffers defined with render.GetResolvedFullFrameDepth.","realm":"Client","rets":{"ret":{"text":"Render depth buffer","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"NetworkEntityCreated","parent":"GM","type":"hook","description":"Called when an entity has been created over the network.","realm":"Client","args":{"arg":{"text":"Created entity","name":"ent","type":"Entity"}}},"example":{"description":"Prints newly created/networked entitys to the players chat.","code":"hook.Add(\"NetworkEntityCreated\", \"InformPlayerOnEntityCreation\", function(ent)\n    chat.AddText(\"A entity was created/networked: \" .. tostring(ent) .. \" (\" .. ent:GetClass() .. \")\")\nend)"},"realms":["Client"],"type":"Function"},
{"function":{"name":"NetworkIDValidated","parent":"GM","type":"hook","description":{"text":"Called when a player's SteamID has been validated by Steam.\n\nSee also GM:PlayerAuthed and Player:IsFullyAuthenticated.","note":"This hook doesn't work intentionally in singleplayer [because the SteamID is not validated](https://github.com/Facepunch/garrysmod-issues/issues/4906#issuecomment-819337130) in that case. This also applies to `sv_lan 1` servers for every duplicate `-multirun` client."},"realm":"Server","args":{"arg":[{"text":"Player name","name":"name","type":"string"},{"text":"Player SteamID","name":"steamID","type":"string"},{"text":"SteamID64 of the game license owner, in case Family Sharing is used. See also Player:OwnerSteamID64","name":"ownerID","type":"string","added":"2024.07.22"}]}},"example":{"description":"Simply prints out the values the hook receives.","code":"hook.Add( \"NetworkIDValidated\", \"NetworkIDValidatedTest\", function( name, steamID )\n\tprint( \"NetworkIDValidated\", name, steamID )\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"NotifyShouldTransmit","parent":"GM","type":"hook","description":{"text":"Called whenever this entity changes its transmission state for this Global.LocalPlayer, such as exiting or re entering the [PVS (Potential Visibility Set)](https://developer.valvesoftware.com/wiki/PVS \"PVS - Valve Developer Community\").","note":"This is the best place to handle the reset of Entity:SetPredictable, as this would be usually called when the player lags and requests a full packet update.\n\n\tWhen the entity stops transmitting, Entity:IsDormant will only return true **after** this hook."},"realm":"Client","args":{"arg":[{"text":"The entity that changed its transmission state.","name":"entity","type":"Entity"},{"text":"`True` if we started transmitting to this client and `false` if we stopped.","name":"shouldtransmit","type":"boolean"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnAchievementAchieved","parent":"GM","type":"hook","description":"Called when a player has achieved an achievement. You can get the name and other information from an achievement ID with the achievements library.","realm":"Client","args":{"arg":[{"text":"The player that earned the achievement","name":"ply","type":"Player"},{"text":"The index of the achievement","name":"achievement","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnChatTab","parent":"GM","type":"hook","description":{"text":"Called when the local player presses TAB while having their chatbox opened.","warning":"This function now uses player.Iterator. This means it can't run all the time, as an error in the GM:OnEntityCreated or GM:EntityRemoved hooks is likely to interrupt it. Make sure that no addon causes an error in these hooks."},"realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"184-L215"},"args":{"arg":{"text":"The currently typed into chatbox text","name":"text","type":"string"}},"rets":{"ret":{"text":"What should be placed into the chatbox instead of what currently is when player presses tab","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnCleanup","parent":"GM","type":"hook","description":"Called when the player cleans up something.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/cl_init.lua","line":"76-L90"},"args":{"arg":{"text":"The name of the cleanup type","name":"name","type":"string"}},"rets":{"ret":{"text":"Return false to suppress the cleanup notification.","name":"suppress","type":"boolean"}}},"example":{"description":"Print a message when the player cleans up something.","code":"hook.Add( \"OnCleanup\", \"PrintCleanupMessage\", function( name )\n     print( \"Cleaned up \" .. name ) \nend )","output":"Cleaned up <type>"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnClientLuaError","parent":"GM","type":"hook","description":{"text":"Called on the server when a Lua error occurs on a client and is sent to the server.\n  \n        This hook allows server-side code to detect and log client-side errors.\n\nSee GM:OnLuaError for a hook that captures Lua errors directly within its [realm](States).","warning":"Note that the stack argument can contain a table with 0 values.","note":"Warning: the hook \"protects\" against lua error spam. If it has 5 errors in less than 1 second, the hook will not receive any of these 4 errors."},"realm":"Server","added":"2025.05.16","args":{"arg":[{"text":"The error that occurred. As well as the path and line of the error. Example:  \n`addons/test/lua/autorun/client/test_error.lua:4: 'then' expected near '","name":"error","type":"string","eof":"'`"},{"text":"The player whose client caused the error.","name":"ply","type":"Player"},{"text":"The Lua error stack trace","name":"stack","type":"table"},{"text":"Title of the addon that is creating the Lua errors, or \"ERROR\" if addon is not found.","name":"name","type":"string"}]}},"example":{"description":"Example of a hook to retrieve clients errors","code":"hook.Add(\"OnClientLuaError\", \"Test\", function(sError, pPlayer, tStack, sNameAddon)\n    print(\"tStack:\")\n    PrintTable(tStack)\n\n    print(\"The player \" .. (IsValid(pPlayer) and pPlayer:Nick() or \"unknown\") .. \" has encountered an error in addon '\" .. sNameAddon .. \"' : \" .. sError)\nend)","output":{"text":"```\n\n-- The “error” function is used to generate\ntStack:\n[1]:\n\t\t[\"File\"]\t=\t[C]\n\t\t[\"Function\"]\t=\terror\n\t\t[\"Line\"]\t=\t-1\n[2]:\n\t\t[\"File\"]\t=\taddons/test/lua/autorun/client/test_error.lua\n\t\t[\"Function\"]\t=\t\n\t\t[\"Line\"]\t=\t3\nThe player Vitroze_Gaming has encountered an error in addon 'test' : addons/test/lua/autorun/client/test_error.lua:3: This is a test for the hook. Generated by the error function\n\n-- A syntax error is generated\ntStack: (No Value)\nThe player Vitroze_Gaming has encountered an error in addon 'test' : addons/test/lua/autorun/client/test_error.lua:4: 'then' expected near '","eof":"'\n\n\n```"}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnCloseCaptionEmit","parent":"GM","type":"hook","description":"Called when a caption/subtitle has been emitted to the closed caption box.","realm":"Client","added":"2023.09.19","args":{"arg":[{"text":"The name of the soundscript, or `customLuaToken` if it's from gui.AddCaption","name":"soundScript","type":"string"},{"text":"How long the caption should stay for","name":"duration","type":"number"},{"text":"Is this caption coming from the player?","name":"fromPlayer","type":"boolean"},{"text":"The caption. Can be nil if its token is not registered","name":"fullText","type":"string"}]},"rets":{"ret":{"text":"Return `true` to prevent the caption from appearing","name":"","type":"boolean"}}},"example":{"code":"hook.Add( \"OnCloseCaptionEmit\", \"OnCloseCaptionEmit_Example\", function( soundScript, duration, fromPlayer, fullText )\n\tprint( \"Close caption emitted:\", fullText, duration, fromPlayer, soundScript )\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnContextMenuClose","parent":"GM","type":"hook","description":"Called when the context menu keybind (+menu_context) is released, which by default is C.\n\nThis hook will not run if input.IsKeyTrapping returns true.\n\nSee also GM:OnContextMenuOpen.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnContextMenuOpen","parent":"GM","type":"hook","description":{"text":"Called when the context menu keybind (`+menu_context`) is pressed, which by default is .\n\nSee also GM:OnContextMenuClose.","key":"C"},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnCrazyPhysics","parent":"GM","type":"hook","description":"Called when the crazy physics detection detects an entity with crazy physics, i.e. position being far outside of the map, velocities being near or at infinity, etc. The primary reason for this system is to prevent program crashes in physics engine.","realm":"Shared","args":{"arg":[{"text":"The entity that was detected as crazy","name":"ent","type":"Entity"},{"text":"The physics object that is going crazy","name":"physobj","type":"PhysObj"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OnDamagedByExplosion","parent":"GM","type":"hook","description":"Called when a player has been hurt by an explosion. Override to disable default sound effect.","realm":"Server","file":{"text":"gamemodes/base/gamemode/player.lua","line":"554-L574"},"args":{"arg":[{"text":"Player who has been hurt","name":"ply","type":"Player"},{"text":"Damage info from explosion","name":"dmginfo","type":"CTakeDamageInfo"}]}},"example":{"description":"Disables the high pitched ringing sound effect.\n\nNote that this hook does not have a return value, and instead by default it calls Player:SetDSP`( 35, false )` in the base gamemode.\n\nThis is an example of disabling explosion effects.","code":"function GAMEMODE:OnDamagedByExplosion()\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnEntityCreated","parent":"GM","type":"hook","description":{"text":"Called as soon as the entity is created. Very little of the entity's properties will be initialized at this stage. (keyvalues, classname, flags, anything), especially on the serverside.","warning":"Removing the created entity during this event can lead to unexpected problems. Use Global.SafeRemoveEntityDelayed( entity, 0 ) to safely remove the entity."},"realm":"Shared","args":{"arg":{"text":"The entity","name":"entity","type":"Entity"}}},"example":[{"description":"When a prop spawns it yells.","code":"hook.Add( \"OnEntityCreated\", \"PropScream\", function( ent )\n\tif ( ent:GetClass() == \"prop_physics\" ) then\n\t\tent:EmitSound( \"vo/npc/male01/no02.wav\" )\n\tend\nend )"},{"description":"Adds all props and ragdolls into a list. More efficient alternative to looping over ents.GetAll.","code":"local TrackedEnts = {\n\t[ \"prop_physics\" ] = true,\n\t[ \"prop_ragdoll\" ] = true\n}\n\nlocal EntList = {}\n\nhook.Add( \"OnEntityCreated\", \"SoftEntList\", function( ent )\n\tif ( TrackedEnts[ ent:GetClass() ] ) then\n\t\tEntList[ ent:EntIndex() ] = ent\n\tend\nend )"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OnEntityWaterLevelChanged","parent":"GM","type":"hook","description":{"text":"Called when the Entity:WaterLevel of an entity is changed.\n\n    0 - The entity isn't in water.\n\n    1 - Slightly submerged (at least to the feet).\n\n    2 - The majority of the entity is submerged (at least to the waist).\n\n    3 - Completely submerged.","warning":"This hook can be considered a physics callback, so changing collision rules (Entity:SetSolidFlags) in it may lead to a crash!"},"realm":"Server","added":"2020.03.17","args":{"arg":[{"text":"The entity.","name":"entity","type":"Entity"},{"text":"Previous water level.","name":"old","type":"number"},{"text":"The new water level.","name":"new","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnGamemodeLoaded","parent":"GM","type":"hook","description":"Called when the gamemode is loaded. gmod.GetGamemode will be functional at this point.\n\nGlobal.LocalPlayer() returns NULL at the time this is run.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OnLuaError","parent":"GM","type":"hook","description":{"text":"Called when a Lua error occurs.\nIf you want to retrieve client errors on the server side, you can use this hook: GM:OnClientLuaError","note":"On the server realm, this hook will only account for server-side errors, not client-side ones."},"realm":"Shared and Menu","file":{"text":"lua/menu/errors.lua","line":""},"args":{"arg":[{"text":"The error that occurred.","name":"error","type":"string"},{"text":"Where the Lua error took place, \"client\", or \"server\"","name":"realm","type":"string"},{"text":"The Lua error stack trace","name":"stack","type":"table"},{"text":"Title of the addon that is creating the Lua errors, or nil if addon is not found.","name":"name","type":"string"},{"text":"Steam Workshop ID of the addon creating Lua errors, if it is an addon.","name":"id","type":"string"}]}},"example":{"description":"Replicate [lua_error_url](https://wiki.facepunch.com/gmod/Lua_Error_Logging)'s functionality using the hook, while adding new values to the payload.","code":"--\n-- Called on logic errors such as nil functions being called or nil being used\n-- to index a table.\n--\nhook.Add( \"OnLuaError\", \"mock_lua_error_url\", function( error, realm, stack, name, addon_id )\n\n    --\n    -- Send a POST request to the given URL with \n    -- information relating to the error that could be useful for logging.\n    --\n    http.Post( \"https://example.com/report_lua_error.php\", {\n        error = error,\n        stack = util.TableToJSON(stack, false),\n        realm = realm,\n        addon = addon_id or 0,\n        gamemode = engine.ActiveGamemode(),\n        gmv = VERSIONSTR,\n        os = jit.os,\n\n        --\n        -- New data extending upon lua_error_url for demonstrative purposes,\n        -- not that these are very useful.\n        --\n        addon_name = name,\n        time = os.time(),\n        player_count = player.GetCount()\n    } )\nend )"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"OnNotifyAddonConflict","parent":"GM","type":"hook","description":"Called when a Addon Conflict occurs, only works in the Menu realm.","realm":"Menu","file":{"text":"lua/menu/problems/problems.lua","line":"260-L297"},"args":{"arg":[{"text":"The first Addon","name":"addon1","type":"string"},{"text":"The second Addon","name":"addon2","type":"string"},{"text":"The File the Conflict occurred in.","name":"fileName","type":"string"}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"OnNPCDropItem","parent":"GM","type":"hook","description":"Called whenever an NPC drops an item upon its death, such as health kits, armor batteries, etc.\n\nIt will NOT be called for dropped weapons, with exception of Half-Life: Source NPCs, since they don't use actual weapon entities and create a weapon entity on death.  \nGM:PlayerDroppedWeapon works for NPC weapon drops already. (Yes, it's not a typo)\n\nIt will also not be called for live grenades spawned by Zombine.","added":"2025.07.28","realm":"Server","args":{"arg":[{"text":"The killed NPC","name":"npc","type":"NPC"},{"text":"The item that got dropped by the NPC.","name":"item","type":"Entity"}]}},"example":{"description":"Removes the item an NPC drops upon it spawning","code":"hook.Add( \"OnNPCDropItem\", \"RemoveNPCDrops\", function( npc, item )\n\titem:Remove()\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnNPCKilled","parent":"GM","type":"hook","description":"Called whenever an NPC is killed.","file":{"text":"gamemodes/base/gamemode/npc.lua","line":"74-L138"},"realm":"Server","args":{"arg":[{"text":"The killed NPC","name":"npc","type":"NPC"},{"text":"The NPCs attacker, the entity that gets the kill credit, for example a player or an NPC.","name":"attacker","type":"Entity"},{"text":"Death inflictor. The entity that did the killing. Not necessarily a weapon.","name":"inflictor","type":"Entity"}]}},"example":{"description":"Spawns an explosion effect on an NPC when they die.","code":"hook.Add( \"OnNPCKilled\", \"ExplosionEffectOnNPCDeath\", function( npc, attacker, inflictor )\n\tlocal effectData = EffectData()\n\teffectData:SetOrigin( npc:GetPos() )\n\tutil.Effect( \"Explosion\", effectData )\nend)"},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnPauseMenuBlockedTooManyTimes","parent":"GM","type":"hook","added":"2024.07.12","description":{"text":"Called when the main menu has been blocked by GM:OnPauseMenuShow four times in a small interval. This is used internally to explain to the user that they can hold  to force open the main menu.","key":"SHIFT"},"realm":"Menu"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"OnPauseMenuShow","parent":"GM","type":"hook","added":"2024.07.11","description":{"text":"Called when the pause menu is attempting to be opened. Allows you to prevent the main menu from being opened that time.\n\n\tThe user can hold  to not call this hook. If the main menu is blocked multiple times in short succession, a warning will be displayed to the end user on how to bypass the hook.","key":"SHIFT"},"realm":"Client","rets":{"ret":{"text":"Should the menu be allowed to open?","name":"ShouldOpen","type":"boolean"}}},"example":{"description":"Stops the main menu from opening","code":"hook.Add( \"OnPauseMenuShow\", \"DisableMenu\", function()\n\tchat.AddText( \"Press Shift+Escape to open the menu.\" )\n\treturn false\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnPermissionsChanged","parent":"GM","type":"hook","description":"Called when a permission gets Granted or Revoked.","realm":"Menu","file":{"text":"lua/menu/problems/permissions.lua","line":"221-L227"}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"OnPhysgunFreeze","parent":"GM","type":"hook","description":"Called when a player freezes an entity with the physgun.","realm":"Server","args":{"arg":[{"text":"The weapon that was used to freeze the entity.","name":"weapon","type":"Entity"},{"text":"Physics object of the entity.","name":"physobj","type":"PhysObj"},{"text":"The target entity.","name":"ent","type":"Entity"},{"text":"The player who tried to freeze the entity.","name":"ply","type":"Player"}]},"rets":{"ret":{"text":"Return `false` to block the unfreeze.","name":"","type":"boolean","warning":"The unfreezing is handled by the base gamemode hook. This hook has no return value, returning any value will prevent the gamemode hook from running, which is true for every hook."}}},"example":{"description":"Only allows admins to freeze things, by preventing the default base gamemode code from running due to how the hook library functions.  \n See hook.Add for explanation. The return value does not matter, as long as it is not `nil`, the base code will not run.","code":"hook.Add( \"OnPhysgunFreeze\", \"PhysFreeze\", function( weapon, phys, ent, ply )\n  \tif not ply:IsAdmin() then\n\t\treturn false\n\tend\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnPhysgunPickup","parent":"GM","type":"hook","description":"Called to when a player has successfully picked up an entity with their Physics Gun.\n\nNot to be confused with GM:PhysgunPickup which is called to ask if the player should be able to pick up an entity.\n\n\nSee GM:GravGunOnPickedUp for the Gravity Gun pickup variant.\n\nSee GM:OnPlayerPhysicsPickup for the player `+use` pickup variant.","realm":"Server","args":{"arg":[{"text":"The player that has picked up something using the physics gun.","name":"ply","type":"Player"},{"text":"The entity that was picked up.","name":"ent","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnPhysgunReload","parent":"GM","type":"hook","description":"Called when a player reloads with the physgun. Override this to disable default unfreezing behavior.","realm":"Server","args":{"arg":[{"text":"The physgun in question","name":"physgun","type":"Weapon"},{"text":"The player wielding the physgun","name":"ply","type":"Player"}]},"rets":{"ret":{"text":"Whether the player can reload with the physgun or not","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnPlayerChangedTeam","parent":"GM","type":"hook","description":{"text":"Called when a player has changed team using GM:PlayerJoinTeam.","deprecated":"Use GM:PlayerChangedTeam instead, which works for every Player:SetTeam call.","warning":"This hook will not work with hook.Add and it is only called manually from GM:PlayerJoinTeam by the base gamemode"},"realm":"Server","args":{"arg":[{"text":"Player who has changed team","name":"ply","type":"Player"},{"text":"Index of the team the player was originally in","name":"oldTeam","type":"number"},{"text":"Index of the team the player has changed to","name":"newTeam","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnPlayerChat","parent":"GM","type":"hook","description":{"text":"Called whenever a player sends a chat message. For the serverside equivalent, see GM:PlayerSay.","note":"The input (or suppression) of this hook is based on the output from GM:PlayerSay. Chat events suppressed serverside do not call this hook."},"realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"142-L182"},"args":{"arg":[{"text":"The player","name":"ply","type":"Player"},{"text":"The message's text","name":"text","type":"string"},{"text":"Is the player typing in team chat?","name":"teamChat","type":"boolean"},{"text":"Is the player dead?","name":"isDead","type":"boolean"}]},"rets":{"ret":{"text":"Should the message be suppressed?","name":"","type":"boolean"}}},"example":{"description":"How you could create a clientside only chat command.","code":"hook.Add( \"OnPlayerChat\", \"HelloCommand\", function( ply, strText, bTeam, bDead ) \n    if ( ply != LocalPlayer() ) then return end\n\n\tstrText = string.lower( strText ) -- make the string lower case\n\n\tif ( strText == \"/hello\" ) then -- if the player typed /hello then\n\t\tprint( \"Hello world!\" ) -- print Hello world to the console\n\t\treturn true -- this suppresses the message from being shown\n\tend\nend )","output":"Prints `Hello world!` to the console when you type `/hello` in the chat."},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnPlayerHitGround","parent":"GM","type":"hook","description":"Called when a player makes contact with the ground after a jump or a fall.","realm":"Shared","predicted":"Yes","args":{"arg":[{"text":"Player","name":"player","type":"Entity"},{"text":"Did the player land in water?","name":"inWater","type":"boolean"},{"text":"Did the player land on an object floating in the water?","name":"onFloater","type":"boolean"},{"text":"The speed at which the player hit the ground","name":"speed","type":"number"}]},"rets":{"ret":{"text":"Return true to suppress default action","name":"","type":"boolean"}}},"example":{"description":"Explode players when they hit the ground too hard.","code":"hook.Add( \"OnPlayerHitGround\", \"ExplosiveFall\", function( ply, inWater, onFloater, speed )\n    if speed > 1000 and not inWater then\n        local exp = ents.Create( \"env_explosion\" )\n        exp:SetPos( ply:GetPos() )\n        exp:Spawn()\n        exp:SetKeyValue( \"iMagnitude\", \"0\" )\n        exp:Fire( \"Explode\", 0, 0 )\n \n        ply:Kill()\n    end\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OnPlayerJump","parent":"GM","type":"hook","description":"Called when a player jumps.","realm":"Shared","predicted":"Yes","added":"2023.09.13","args":{"arg":[{"text":"Player","name":"player","type":"Entity"},{"text":"The velocity/impulse of the jump","name":"speed","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OnPlayerPhysicsDrop","parent":"GM","type":"hook","added":"2021.01.27","description":"Called when a player +use drops an entity.","realm":"Server","args":{"arg":[{"text":"The player that dropped the object","name":"ply","type":"Player"},{"text":"The object that was dropped.","name":"ent","type":"Entity"},{"text":"Whether the object was throw or simply let go of.","name":"thrown","type":"boolean"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnPlayerPhysicsPickup","parent":"GM","type":"hook","added":"2021.01.27","description":"Called when a player +use pickups up an entity. This will be called after the entity passes though GM:AllowPlayerPickup.\n\nSee GM:GravGunOnPickedUp for the Gravity Gun pickup variant.\n\nSee GM:OnPhysgunPickup for the Physics Gun pickup variant.","realm":"Server","args":{"arg":[{"text":"The player that picked up the object","name":"ply","type":"Player"},{"text":"The object that was picked up.","name":"ent","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnReloaded","parent":"GM","type":"hook","description":{"text":"Called when gamemode has been reloaded by auto refresh.","note":"It seems that this event can be triggered more than once for a single refresh event."},"realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OnScreenSizeChanged","parent":"GM","type":"hook","added":"2020.04.29","description":"Called when the player's screen resolution of the game changes. This also called when changing MSAA settings.\n\nGlobal.ScrW and Global.ScrH will return the new values when this hook is called.","realm":"Client","args":{"arg":[{"text":"The previous width of the game's window.","name":"oldWidth","type":"number"},{"text":"The previous height of the game's window.","name":"oldHeight","type":"number"},{"text":"The new/current width of the game's window.","name":"newWidth","type":"number","added":"2023.10.24"},{"text":"The new/current height of the game's window.","name":"newHeight","type":"number","added":"2023.10.24"}]}},"example":{"description":"When a player change his Screen Size it's print the old Size and the new size.","code":"hook.Add( \"OnScreenSizeChanged\", \"PrintOld\", function( oldWidth, oldHeight )\n\tprint( oldWidth, oldHeight ) -- Prints old width and height\n\tprint( ScrW(), ScrH() ) -- Prints new width and height\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnSpawnMenuClose","parent":"GM","type":"hook","description":{"text":"Called when a player releases the `+menu` bind on their keyboard, which is bound to  by default.","key":"Q"},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnSpawnMenuOpen","parent":"GM","type":"hook","description":{"text":"Called when a player presses the `+menu` bind on their keyboard, which is bound to  by default.","key":"Q"},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnTextEntryGetFocus","parent":"GM","type":"hook","description":"Called when a DTextEntry gets focus.\n\nThis hook is run from DTextEntry:OnGetFocus and PANEL:OnMousePressed of DTextEntry.","realm":"Client","file":{"text":"lua/vgui/dtextentry.lua","line":"L354"},"args":{"arg":{"text":"The panel that got focus","name":"panel","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnTextEntryLoseFocus","parent":"GM","type":"hook","description":"Called when a DTextEntry loses focus.","realm":"Client","args":{"arg":{"text":"The panel that lost focus","name":"panel","type":"Panel"}},"file":{"text":"lua/vgui/dtextentry.lua","line":"L362"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnUndo","parent":"GM","type":"hook","description":"Called when the player undoes something.","file":{"text":"gamemodes/sandbox/gamemode/cl_init.lua","line":"46-L74"},"realm":"Client","args":{"arg":[{"text":"The name of the undo action","name":"name","type":"string"},{"text":"The custom text for the undo, set by undo.SetCustomUndoText","name":"customText","type":"string"}]},"rets":{"ret":{"text":"Return false to suppress the undo notification.","name":"suppress","type":"boolean"}}},"example":{"description":"Print a message when the player undoes something.","code":"hook.Add( \"OnUndo\", \"CustomUndoText\", function( name, customText )\n     if customText ~= nil then\n          MsgN( \"Undone \" .. customText )\n     else\n          MsgN( \"Undone \" .. name )\n     end\nend )","output":"Undone <action>"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnViewModelChanged","parent":"GM","type":"hook","file":{"text":"gamemodes/base/gamemode/shared.lua","line":"251-L258"},"description":{"text":"Called when the player changes their weapon to another one - and their viewmodel model changes.","bug":{"text":"This is not always called clientside.","issue":"2473"}},"realm":"Shared","args":{"arg":[{"text":"The viewmodel that is changing","name":"viewmodel","type":"Entity"},{"text":"The old model","name":"oldModel","type":"string"},{"text":"The new model","name":"newModel","type":"string"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PhysgunDrop","parent":"GM","type":"hook","file":{"text":"gamemodes/base/gamemode/shared.lua","line":"70-L71"},"description":"Called when a player drops an entity with the Physgun.\n\nSee GM:GravGunOnDropped for the Gravity Gun drop variant.","realm":"Shared","args":{"arg":[{"text":"The player who dropped an entity","name":"player","type":"Player"},{"text":"The dropped entity","name":"entity","type":"Entity"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PhysgunPickup","parent":"GM","type":"hook","file":{"text":"gamemodes/base/gamemode/shared.lua","line":"58-L64"},"description":"Called to determine if a player should be able to pick up an entity with the Physics Gun.\n\nSee GM:OnPhysgunPickup for a hook which is called when a player has successfully picked up an entity.\n\nSee GM:GravGunPickupAllowed for the Gravity Gun pickup variant.\n\nSee GM:AllowPlayerPickup for the `+USE` pickup variant.","realm":"Shared","predicted":"Yes","args":{"arg":[{"text":"The player that is picking up using the Physics Gun.","name":"player","type":"Player"},{"text":"The entity that is being picked up.","name":"entity","type":"Entity"}]},"rets":{"ret":{"text":"Returns whether the player can pick up the entity or not.","name":"","type":"boolean"}}},"example":{"description":"Allows Admins to pick up players.","code":["hook.Add( \"PhysgunPickup\", \"AllowPlayerPickup\", function( ply, ent )\n\tif ( ply:IsAdmin() and ent:IsPlayer() ) then\n\t\treturn true\n\tend\nend )","--You can also disable physgun on a certain entity using ENT.PhysgunDisabled\nENT.PhysgunDisabled = true"]},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayerAmmoChanged","parent":"GM","type":"hook","description":"Called after player's reserve ammo count changes.","added":"2020.06.24","realm":"Shared","args":{"arg":[{"text":"The player whose ammo is being affected.","name":"ply","type":"Player"},{"text":"The ammo type ID.","name":"ammoID","type":"number"},{"text":"The old ammo count.","name":"oldCount","type":"number"},{"text":"The new ammo count.","name":"newCount","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayerAuthed","parent":"GM","type":"hook","description":"Called after the player gets their Player:UniqueID set for the first time. This hook will also be called in singleplayer.\n\nSee GM:NetworkIDValidated for a hook that is called with the player's SteamID is validated by Steam.","realm":"Server","args":{"arg":[{"text":"The player","name":"ply","type":"Player"},{"text":"The player's SteamID.","name":"steamid","type":"string","warning":"This will always be an empty string `\"\"` in singleplayer."},{"text":"The player's UniqueID.","name":"uniqueid","type":"string","warning":"This will always be `\"1\"` in singleplayer."}]}},"example":{"code":"hook.Add( \"PlayerAuthed\", \"JoinNotification\", function( ply, steamid, uniqueid )\n    print( ply:Name() .. \" has been authenticated as \" .. steamid .. \".\" )\nend )","output":"```\nPlayer1 has been authenticated as STEAM_0:1:12345678.\n```"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerBindPress","parent":"GM","type":"hook","description":{"text":"Runs when a bind has been pressed. Allows to block commands.","note":"By using the \"alias\" console command, this hook can be effectively circumvented. To prevent this use input.TranslateAlias.\n\nTo stop the user from using `+attack`, `+left` and any other movement commands of the sort, please look into using GM:StartCommand instead.","bug":[{"text":"The third argument will always be true.","issue":"1176"},{"text":"This does not run for function keys binds (F1-F12).","issue":"2888"}]},"realm":"Client","args":{"arg":[{"text":"The player who used the command; this will always be equal to Global.LocalPlayer.","name":"ply","type":"Player"},{"text":"The bind command.","name":"bind","type":"string"},{"text":"If the bind was activated or deactivated.","name":"pressed","type":"boolean"},{"text":"The button code. See BUTTON_CODE Enums.","name":"code","type":"number"}]},"rets":{"ret":{"text":"Return `true` to prevent the bind.","name":"","type":"boolean"}}},"example":{"description":"Prevents players from using flashlight.","code":"hook.Add( \"PlayerBindPress\", \"PlayerBindPressExample\", function( ply, bind, pressed )\n\t--To block more commands, you could add another line similar to\n\t--the one below, just replace the command\n\tif ( string.find( bind, \"impulse 100\" ) ) then\n\t\treturn true\n\tend\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PlayerButtonDown","parent":"GM","type":"hook","description":"Called when a player presses a button.\n\nThis will not be called if player has a panel opened with keyboard input enabled, use PANEL:OnKeyCodePressed instead.\n\nSee GM:KeyPress for an alternative that uses Enums/IN.\nSee GM:PlayerButtonUp for the \"key release\" event.","realm":"Shared","predicted":"Yes","args":{"arg":[{"text":"Player who pressed the button","name":"ply","type":"Player"},{"text":"The button, see Enums/BUTTON_CODE","name":"button","type":"number{BUTTON_CODE}"}]}},"example":[{"description":"Prints the person who pressed the key.","code":"hook.Add( \"PlayerButtonDown\", \"PlayerButtonDownWikiExample\", function( ply, button )\n\tif CLIENT then\n\t\tif ( IsFirstTimePredicted() ) then print( ply:Nick() .. \" pressed \" .. input.GetKeyName( button ) ) end\n\telse\n\t\tprint( ply:Nick() .. \" pressed \" .. button )\n\tend\nend)"},{"description":"Prints the person who pressed the key if it is the T key.","code":"hook.Add( \"PlayerButtonDown\", \"PlayerButtonDownWikiExample2\", function( ply, button )\n\tif button != KEY_T then return end\n\n\tif CLIENT and not IsFirstTimePredicted() then\n\t\treturn\n\tend\n\n\tprint( ply:Nick() )\nend)"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayerButtonUp","parent":"GM","type":"hook","description":"Called when a player releases a button.\n\nThis will not be called if player has a panel opened with keyboard input enabled, use PANEL:OnKeyCodeReleased instead.\n\nSee GM:KeyRelease for an alternative that uses Enums/IN.\nSee GM:PlayerButtonDown for the \"key press\" event.","realm":"Shared","predicted":"Yes","args":{"arg":[{"text":"Player who released the button","name":"ply","type":"Player"},{"text":"The button, see Enums/BUTTON_CODE","name":"button","type":"number{BUTTON_CODE}"}]}},"example":{"description":"Prints the person who released the key.","code":"hook.Add( \"PlayerButtonUp\", \"ButtonUpWikiExample\", function( ply, button )\n\tif CLIENT then\n\t\tif ( IsFirstTimePredicted() ) then print( ply:Nick() .. \" released \" .. input.GetKeyName( button ) ) end\n\telse\n\t\tprint( ply:Nick() .. \" released \" .. button )\n\tend\nend)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayerCanHearPlayersVoice","parent":"GM","type":"hook","description":{"text":"Decides whether a player can hear another player using voice chat.","warning":"This hook is called **players count * speaking players count** times every 0.3 seconds if at least 1 player is talking or every 5 seconds if no one is talking.\n\tYou should ensure that your code is efficient, or this will definitely influence performance."},"realm":"Server","file":{"text":"gamemodes/base/gamemode/player.lua","line":"754-L761"},"args":{"arg":[{"text":"The listening player.","name":"listener","type":"Player"},{"text":"The talking player.","name":"talker","type":"Player"}]},"rets":{"ret":[{"text":"Return `true` if the listener should hear the talker, `false` if they shouldn't.","name":"","type":"boolean"},{"text":"3D sound. If set to `true`, will fade out the sound the further away listener is from the  talker, the voice will also be in stereo, and not mono.","name":"","type":"boolean"}]}},"example":{"description":"Players can only hear each other if they are within 500 units.","code":"hook.Add( \"PlayerCanHearPlayersVoice\", \"Maximum Range\", function( listener, talker )\n    if listener:GetPos():DistToSqr( talker:GetPos() ) > 250000 then\n\t\treturn false\n\tend\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerCanJoinTeam","parent":"GM","type":"hook","description":{"text":"Returns whether or not a player is allowed to join a team","warning":"This hook will not work with hook.Add and it is only called manually from GM:PlayerJoinTeam by the base gamemode"},"realm":"Server","args":{"arg":[{"text":"Player attempting to switch teams","name":"ply","type":"Player"},{"text":"Index of the team","name":"team","type":"number"}]},"rets":{"ret":{"text":"Allowed to switch","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerCanPickupItem","parent":"GM","type":"hook","description":"Returns whether or not a player is allowed to pick an item up. (ammo, health, armor)\n\nThis will typically only work for base game entities, unless mod authors that implement similar entities also manually call this hook.\n\nSee GM:PlayerCanPickupWeapon for a hook that controls weapon pickups.","realm":"Server","args":{"arg":[{"text":"Player attempting to pick up","name":"ply","type":"Player"},{"text":"The item the player is attempting to pick up","name":"item","type":"Entity"}]},"rets":{"ret":{"text":"Allow pick up","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerCanPickupWeapon","parent":"GM","type":"hook","description":["Returns whether or not a player is allowed to pick up a weapon.\n\n \tIf this returns `false`, Player:Give won't work.\n\nSee GM:PlayerCanPickupItem for a hook that affects things like health kits, armor batteries and ammo entities.\n\nSee GM:WeaponEquip for a hook that is called when a player successfully picks up a weapon after passing this hook.",""],"realm":"Server","args":{"arg":[{"text":"The player attempting to pick up the weapon.","name":"ply","type":"Player"},{"text":"The weapon entity in question.","name":"weapon","type":"Weapon"}]},"rets":{"ret":{"text":"`false` to disallow pickup.","name":"","type":"boolean"}}},"example":[{"description":"Disallows picking up a weapon if player already has this weapon ( prevents ammo pickups from lying guns ).","code":"hook.Add( \"PlayerCanPickupWeapon\", \"noDoublePickup\", function( ply, weapon )\n    if ( ply:HasWeapon( weapon:GetClass() ) ) then\n\t\treturn false\n\tend\nend )"},{"description":"Players can only pick up the HL2 Pistol.","code":"hook.Add( \"PlayerCanPickupWeapon\", \"OnlyPistol\", function( ply, weapon )\n    return ( weapon:GetClass() == \"weapon_pistol\" )\nend )"},{"description":"How you could give a player an alternate weapon to the one they picked up (such as an RPG Launcher rather than a pistol).","code":"hook.Add( \"PlayerCanPickupWeapon\", \"NoPistolGiveFists\", function( ply, weapon )\n\tif ( weapon:GetClass() == \"weapon_pistol\" ) then -- if the weapon they are trying to pick up is a pistol\n\t\tply:Give( \"weapon_rpg\" ) -- give them an RPG\n\t\tweapon:Remove() -- remove the one they were trying to pick up\n\t\treturn false -- don't give them a pistol\n\tend\nend )"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerCanSeePlayersChat","parent":"GM","type":"hook","description":{"text":"Returns whether or not the player can see the other player's chat.","note":"The **speaker** parameter does not have to be a valid Player object which happens when console messages are displayed for example."},"file":{"text":"gamemodes/base/gamemode/player.lua","line":"L763-L776"},"realm":"Server","args":{"arg":[{"text":"The chat text","name":"text","type":"string"},{"text":"If the message is team-only","name":"teamOnly","type":"boolean"},{"text":"The player receiving the message","name":"listener","type":"Player"},{"text":"The player sending the message.","name":"speaker","type":"Player"}]},"rets":{"ret":{"text":"Can see other player's chat","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerChangedTeam","parent":"GM","type":"hook","description":{"text":"Called when a player has changed team using Player:SetTeam.","warning":["Avoid calling Player:SetTeam in this hook as it may cause an infinite loop!","Player:Team inside this hook will return `oldTeam`."]},"realm":"Server","added":"2020.03.17","args":{"arg":[{"text":"Player whose team has changed.","name":"ply","type":"Player"},{"text":"Index of the team the player was originally in. See team.GetName and the team library.","name":"oldTeam","type":"number"},{"text":"Index of the team the player has changed to.","name":"newTeam","type":"number"}]}},"example":{"description":"Print the old Team name and the new Team name of players.","code":"hook.Add( \"PlayerChangedTeam\", \"PrintOldAndNewTeam\", function( ply, oldTeam, newTeam )\n\tPrintMessage( HUD_PRINTTALK, ply:Nick() .. \" switched from \" .. team.GetName( oldTeam ) .. \" to \" .. team.GetName( newTeam ) )\nend )","upload":{"src":"8e3f9/8d8138b08ccd3ed.png","size":"37088","name":"image.png"},"output":"Player1 switched from Team1 to Team2"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerCheckLimit","parent":"GM","type":"hook","description":{"text":"Called whenever a player is about to spawn something to see if they hit a limit for whatever they are spawning.","note":"This hook will not be called in singleplayer, as singleplayer does not have limits."},"realm":"Shared","added":"2020.06.24","args":{"arg":[{"text":"The player who is trying to spawn something.","name":"ply","type":"Player"},{"text":"The limit's name.","name":"limitName","type":"string"},{"text":"The amount of whatever player is trying to spawn that the player already has spawned.","name":"current","type":"number"},{"text":"The default maximum count, as dictated by the `sbox_max","name":"defaultMax","type":"number","limitname":"` convar on the server. This is the amount that will be used if nothing is returned from this hook."}]},"rets":{"ret":{"text":"Return `false` to indicate the limit was hit, or nothing otherwise","name":"","type":"boolean"}}},"example":[{"description":{"text":"Removes prop spawn limit for admins.","note":"Having multiple PlayerCheckLimit hooks that return values WILL conflict"},"code":"hook.Add(\"PlayerCheckLimit\", \"no_admin_limits\", function(ply, name, cur, max)\n    if name == \"props\" and ply:IsAdmin() then return true end\nend)"},{"description":"Doubles prop spawn limit for admins.","code":"hook.Add(\"PlayerCheckLimit\", \"admin_double_limits\", function(ply, name, cur, max)\n    if name == \"props\" and ply:IsAdmin() then\n        if cur >= max*2 then return false end\n        return true\n    end\nend)"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayerClassChanged","parent":"GM","type":"hook","description":{"text":"Called whenever a player's class is changed on the server-side with player_manager.SetPlayerClass.","internal":""},"realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"680-L695"},"args":{"arg":[{"text":"The player whose class has been changed.","name":"ply","type":"Player"},{"text":"The network ID of the player class's name string, or `0` if we are clearing a player class from the player.\n\nPass this into util.NetworkIDToString to retrieve the proper name of the player class.","name":"newID","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PlayerConnect","parent":"GM","type":"hook","description":{"text":"Executes when a player connects to the server. Called before the player has been assigned a UserID and entity. See the player_connect gameevent for a version of this hook called after the player entity has been created.","note":["This is only called clientside for listen server hosts.","This is not called clientside for the local player."]},"realm":"Shared","args":{"arg":[{"text":"The player's name.","name":"name","type":"string"},{"text":"The player's IP address. Will be \"none\" for bots.","name":"ip","type":"string","note":"This argument will only be passed serverside."}]}},"example":{"description":"prints a message to the chatbox when a player joins the game","code":"hook.Add( \"PlayerConnect\", \"JoinGlobalMessage\", function( name, ip )\n\tPrintMessage( HUD_PRINTTALK, name .. \" has joined the game.\" )\nend )","output":"Player1 has joined the game."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayerDeath","parent":"GM","type":"hook","description":{"text":"Called when a player is killed by Player:Kill or any other normal means.\n\nThis hook is **not** called if the player is killed by Player:KillSilent. See GM:PlayerSilentDeath for that.\n\n* GM:DoPlayerDeath is called **before** this hook.\n* GM:PostPlayerDeath is called **after** this hook.\n\nSee Player:LastHitGroup if you need to get the last hit hitgroup of the player.","note":"Player:Alive will return false in this hook."},"realm":"Server","args":{"arg":[{"text":"The player who died","name":"victim","type":"Player"},{"text":"Item used to kill the victim","name":"inflictor","type":"Entity"},{"text":"Player or entity that killed the victim","name":"attacker","type":"Entity"}]}},"example":{"description":"If the player suicides (they are the killer and the victim), then it will print a message to console. If someone else kills them, it will print a different message to console.","code":"hook.Add( \"PlayerDeath\", \"GlobalDeathMessage\", function( victim, inflictor, attacker )\n    if ( victim == attacker ) then\n        PrintMessage( HUD_PRINTTALK, victim:Name() .. \" committed suicide.\" )\n    else\n        PrintMessage( HUD_PRINTTALK, victim:Name() .. \" was killed by \" .. attacker:Name() .. \".\")\n    end\nend )","output":"```\n-- If suicide...\nPlayer1 has committed suicide.\n\n-- else...\nPlayer1 was killed by Player2.\n```"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerDeathSound","parent":"GM","type":"hook","description":"Returns whether or not the default death sound should be muted.","realm":"Server","rets":{"ret":{"text":"Mute death sound","name":"","type":"boolean"}},"args":{"arg":{"text":"The player","name":"ply","type":"Player"}}},"example":[{"description":"Plays a new sound for the player's demise.","code":"hook.Add( \"PlayerDeathSound\", \"CustomPlayerDeath\", function( ply )\n\tply:EmitSound( \"beams/beamstart5.wav\", 75, math.random( 70, 126 ) ) -- plays the sound with normal sound levels, and a random pitch between 70 and 126\n\treturn true -- we don't want the default sound!\nend )"},{"description":"Picks from a list of sounds and plays a certain one depending on the network variable applied to Player 1. Otherwise, it will play a fallback sound along with the original sound.","code":"local p1 = Entity( 1 ) -- returns player 1\nlocal sndtbl = { \"beams/beamstart5\", \"plats/bigstop1\", \"friends/message\", \"ambient/alarms/warningbell1\", \"vo/ravenholm/madlaugh03\" } -- random selection of sounds for our purpose\n\np1:SetNWInt( \"DSound\", math.random( 1, #sndtbl ) ) -- pick a random number from 1 to the maximum amount of entries our table has\n\nhook.Add( \"PlayerDeathSound\", \"SelectedSound\", function( ply )\n\tlocal snd = sndtbl[ p1:GetNWInt( \"DSound\", 1 ) ]\n\n\tif TypeID(snd) == TYPE_STRING then\n\t\tply:EmitSound( snd .. \".wav\" )\n\t\treturn true\n\telse -- fallback behavior\n\t\tprint( \"Sound does not exist in table, error!\" )\n\t\tply:EmitSound( \"common/bugreporter_failed.wav\" )\n\t\treturn false -- let's make it clear that we do actually have a problem when it doesn't mute the original sound\n\tend\nend )"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerDeathThink","parent":"GM","type":"hook","description":{"text":"Called every think while the player is dead. The return value will determine if the player respawns.\n\nOverwriting this function will prevent players from respawning by pressing space or clicking.","bug":{"text":"This hook is not called for players with the FL_FROZEN flag applied.","issue":"1577"}},"realm":"Server","args":{"arg":{"text":"The player affected in the hook.","name":"ply","type":"Player"}},"rets":{"ret":{"text":"Return a non-nil value to prevent the current gamemode from handling this event. In the `base` gamemode, the gamemode handles player respawning in this hook. So blocking the gamemode hook will prevent player from respawning, in this specific case.","name":"","type":"boolean","note":"This hook does not define a return value. The description below just describes how the hook library works in general."}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerDisconnected","parent":"GM","type":"hook","description":{"text":"Called when a player leaves the server. See the player_disconnect gameevent for a shared version of this hook.","bug":{"text":"This is not called in single-player or listen servers for the host.","issue":"3523"}},"realm":"Server","args":{"arg":{"text":"the player","name":"ply","type":"Player"}}},"example":{"description":"Print a message to the chatbox upon player disconnect","code":"hook.Add( \"PlayerDisconnected\", \"Playerleave\", function(ply)\n    PrintMessage( HUD_PRINTTALK, ply:Name().. \" has left the server. \" )\nend )","output":"Player1 has left the server."},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerDriveAnimate","parent":"GM","type":"hook","description":"Called to update the player's animation during a drive.","realm":"Shared","args":{"arg":{"text":"The driving player","name":"ply","type":"Player"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayerDroppedWeapon","parent":"GM","type":"hook","description":"Called when a weapon is dropped by a player via Player:DropWeapon. Despite its name, this hook is also called for NPC weapon drops.\n\nAlso called when a weapon is removed from a player via Player:StripWeapon.\n\nSee also GM:WeaponEquip for a hook when a player picks up a weapon.\n\nThe weapon's Entity:GetOwner will be NULL at the time this hook is called.\n\nWEAPON:OnDrop will be called before this hook is.","realm":"Server","args":{"arg":[{"text":"The player or NPC who owned this weapon before it was dropped.","name":"owner","type":"Player|NPC"},{"text":"The weapon that was dropped.","name":"wep","type":"Weapon"}]}},"example":{"description":"Print in the chat when a player drop his weapons","code":"hook.Add(\"PlayerDroppedWeapon\", \"PrintWhenDrop\", function(owner, wep)\n\tPrintMessage( HUD_PRINTTALK, owner:IsPlayer() and owner:Nick() or owner:GetClass() .. \" dropped \" .. wep:GetPrintName() )\nend)","output":"Player1 drop AR2"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerEndVoice","parent":"GM","type":"hook","description":"Called when player stops using voice chat.","realm":"Client","args":{"arg":{"text":"Player who stopped talking","name":"ply","type":"Player"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PlayerEnteredVehicle","parent":"GM","type":"hook","description":"Called when a player enters a vehicle.\n\nCalled just after GM:CanPlayerEnterVehicle.\n\nSee also GM:PlayerLeaveVehicle.","realm":"Server","args":{"arg":[{"text":"Player who entered vehicle.","name":"ply","type":"Player"},{"text":"Vehicle the player entered.","name":"veh","type":"Vehicle"},{"text":"The seat number.","name":"role","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerFireAnimationEvent","parent":"GM","type":"hook","description":"Called before firing clientside animation events on a player model.\n\nSee GM:PlayerHandleAnimEvent for the serverside version.","realm":"Client","added":"2020.10.14","args":{"arg":[{"text":"The player who has triggered the event.","name":"ply","type":"Player"},{"text":"Position of the effect","name":"pos","type":"Vector"},{"text":"Angle of the effect","name":"ang","type":"Angle"},{"text":"The event ID of happened even. See [this page](http://developer.valvesoftware.com/wiki/Animation_Events).","name":"event","type":"number"},{"text":"Name of the event","name":"name","type":"string"}]},"rets":{"ret":{"text":"Return true to disable the effect","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PlayerFootstep","parent":"GM","type":"hook","description":{"text":"Called whenever a player steps. Return true to mute the normal sound.\n\nSee GM:PlayerStepSoundTime for a related hook about footstep frequency.","note":"This hook is called on all clients."},"realm":"Shared","predicted":true,"args":{"arg":[{"text":"The stepping player","name":"ply","type":"Player"},{"text":"The position of the step","name":"pos","type":"Vector"},{"text":"Foot that is stepped. 0 for left, 1 for right","name":"foot","type":"number"},{"text":"Sound that is going to play","name":"sound","type":"string"},{"text":"Volume of the footstep","name":"volume","type":"number"},{"text":"The Recipient filter of players who can hear the footstep","name":"filter","type":"CRecipientFilter"}]},"rets":{"ret":{"text":"Prevent default step sound","name":"","type":"boolean"}}},"example":{"description":"Disables default player footsteps and plays custom ones.","code":"hook.Add( \"PlayerFootstep\", \"CustomFootstep\", function( ply, pos, foot, sound, volume, rf )\n\tply:EmitSound( \"NPC_Hunter.Footstep\" ) -- Play the footsteps hunter is using\n\treturn true -- Don't allow default footsteps, or other addon footsteps\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayerFrozeObject","parent":"GM","type":"hook","description":"Called when a player freezes an object.","realm":"Server","args":{"arg":[{"text":"Player who has frozen an object","name":"ply","type":"Player"},{"text":"The frozen object","name":"ent","type":"Entity"},{"text":"The frozen physics object of the frozen entity ( For ragdolls )","name":"physobj","type":"PhysObj"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerHandleAnimEvent","parent":"GM","type":"hook","description":"Called before firing serverside animation events on the player models.\n\nSee GM:PlayerFireAnimationEvent for the clientside version.","realm":"Server","added":"2020.10.14","args":{"arg":[{"text":"The player who has triggered the event.","name":"ply","type":"Player"},{"text":"The event ID of happened even. See [this page](http://developer.valvesoftware.com/wiki/Animation_Events).","name":"event","type":"number"},{"text":"The absolute time this event occurred using Global.CurTime.","name":"eventTime","type":"number"},{"text":"The frame this event occurred as a number between 0 and 1.","name":"cycle","type":"number"},{"text":"Event type. See [the Source SDK](https://github.com/ValveSoftware/source-sdk-2013/blob/master/src/game/shared/eventlist.h#L14-L23).","name":"type","type":"number"},{"text":"Name or options of this event.","name":"options","type":"string"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerHurt","parent":"GM","type":"hook","description":"Called when a player gets hurt.","realm":"Server","args":{"arg":[{"text":"Victim","name":"victim","type":"Player"},{"text":"Attacker Entity","name":"attacker","type":"Entity"},{"text":"Remaining Health","name":"healthRemaining","type":"number"},{"text":"Damage Taken","name":"damageTaken","type":"number"}]}},"example":{"description":"Show players attacker in Chat.","code":"function GM:PlayerHurt(victim, attacker)\n    if ( attacker:IsPlayer() ) then\n        victim:ChatPrint(\"You were attacked by : \" .. attacker:Nick())\n    end\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerInitialSpawn","parent":"GM","type":"hook","description":{"text":"Called when the player spawns for the first time.\n\nSee GM:PlayerSpawn for a hook called every player spawn.","note":"This hook is called before the player has fully loaded, when the player is still in seeing the `Starting Lua` screen. For example, trying to use the Entity:GetModel function will return the default model (`models/player.mdl`).","warning":"Sending net messages to the spawned player in this hook may cause them to be received before the player finishes loading, for example Global.LocalPlayer might return NULL since GM:InitPostEntity may have not been called yet clientside though the net message **won't** be lost and the client still should receive it (more information here: https://github.com/Facepunch/garrysmod-requests/issues/718).\n\nWorkaround without networking:\n```\nlocal load_queue = {}\n\nhook.Add( \"PlayerInitialSpawn\", \"myAddonName/Load\", function( ply )\n\tload_queue[ ply ] = true\nend )\n\nhook.Add( \"StartCommand\", \"myAddonName/Load\", function( ply, cmd )\n\tif load_queue[ ply ] and not cmd:IsForced() then\n\t\tload_queue[ ply ] = nil\n\n\t\t-- Send what you need here if it requires the client to be fully loaded!\n\tend\nend )\n```\n\n\nWith networking:\n```\n-- CLIENT\nhook.Add( \"InitPostEntity\", \"Ready\", function()\n\tnet.Start( \"cool_addon_client_ready\" )\n\tnet.SendToServer()\nend )\n```\n```\n-- SERVER\nutil.AddNetworkString( \"cool_addon_client_ready\" )\n\nnet.Receive( \"cool_addon_client_ready\", function( len, ply )\n\t-- Send what you need here!\nend )\n```"},"realm":"Server","args":{"arg":[{"text":"The player who spawned.","name":"player","type":"Player"},{"text":"If `true`, the player just spawned from a map transition.","name":"transition","type":"boolean"}]}},"example":{"description":"Prints the name of the player joining.","code":"function GM:PlayerInitialSpawn(ply)\n\tprint( ply:Nick() .. \" joined the server.\" )\nend\n\n-- That way you are overriding the default hook.\n-- You can use hook.Add to make more functions get called when this event occurs.\nhook.Add( \"PlayerInitialSpawn\", \"some_unique_name\", function( ply )\n\tprint( ply:Nick() ..\" joined the game.\" )\nend)","output":"```\nPlayer1 joined the game.\n```"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerJoinTeam","parent":"GM","type":"hook","description":"Makes the player join a specified team. This is a convenience function that calls Player:SetTeam and runs the GM:OnPlayerChangedTeam hook.","realm":"Server","args":{"arg":[{"text":"Player to force","name":"ply","type":"Player"},{"text":"The team to put player into","name":"team","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerLeaveVehicle","parent":"GM","type":"hook","description":{"text":"Called when a player leaves a vehicle for any reason, including Player:ExitVehicle. \n\nSee GM:PlayerEnteredVehicle for the opposite hook.","note":"For vehicles with exit animations, this will be called **at the end** of the animation, **not at the start**!"},"realm":"Server","args":{"arg":[{"text":"Player who left a vehicle.","name":"ply","type":"Player"},{"text":"Vehicle the player left.","name":"veh","type":"Vehicle"}]}},"example":{"description":"Make the vehicle continue running (or more precisely start its engine again) when a player exists it, unless the player holds their Reload key.","code":"hook.Add( \"PlayerLeaveVehicle\", \"PlayerLeaveVehicleTurnOn\", function( ply, veh )\n\tif ( ply:KeyDown( IN_RELOAD ) ) then return end\n\n\t-- We need to wait a few frames for the vehicle to stop working\n\ttimer.Create( \"magic timer\" .. veh:EntIndex(), 0, 2, function()\n\t\t-- Only run on the last time the timer is fired\n\t\tif ( timer.RepsLeft( \"magic timer\" .. veh:EntIndex() ) > 0 ) then return end\n\n\t\tveh:StartEngine( true ) -- Start the engine back up\n\t\tveh:ReleaseHandbrake() -- Release the handbrake\n\tend )\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerLoadout","parent":"GM","type":"hook","description":{"text":"Called to give players the default set of weapons.","note":"This function may not work in your custom gamemode if you have overridden your GM:PlayerSpawn and you do not use self.BaseClass.PlayerSpawn or hook.Call."},"realm":"Server","args":{"arg":{"text":"Player to give weapons to.","name":"ply","type":"Player"}}},"example":{"description":"Gives the player only a pistol.","code":"function GM:PlayerLoadout( ply )\n\tply:Give( \"weapon_pistol\" )\n\n\t-- Prevent default Loadout.\n\treturn true\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerNoClip","parent":"GM","type":"hook","description":"Called when a player tries to switch noclip mode. \n\nMOVETYPE_NOCLIP can be used to determine if a player is currently in noclip mode.","realm":"Shared","predicted":"Yes","args":{"arg":[{"text":"The person who entered/exited noclip","name":"ply","type":"Player"},{"text":"Represents the noclip state (on/off) the user will enter if this hook allows them to.","name":"desiredState","type":"boolean"}]},"rets":{"ret":{"text":"Return false to disallow the switch.","name":"","type":"boolean"}}},"example":[{"description":"Get the player when they enter/exit no clip and display their status","code":"hook.Add( \"PlayerNoClip\", \"isInNoClip\", function( ply, desiredNoClipState )\n\tif ( desiredNoClipState ) then\n\t\tprint( ply:Name() .. \" wants to enter noclip.\" )\n\telse\n\t\tprint( ply:Name() .. \" wants to leave noclip.\" )\n\tend\nend )","output":"```\nPlayer1 wants to enter noclip.\nPlayer1 wants to leave noclip.\n```"},{"description":"While keeping the default behavior of admin-only noclip, the following example will also allow anyone to turn it off (if it's set on by a third-party administration addon, for example).","code":"hook.Add( \"PlayerNoClip\", \"FeelFreeToTurnItOff\", function( ply, desiredState )\n\tif ( desiredState == false ) then -- the player wants to turn noclip off\n\t\treturn true -- always allow\n\telseif ( ply:IsAdmin() ) then\n\t\treturn true -- allow administrators to enter noclip\n\tend\nend )"},{"description":"Adds a Player:InNoclip() function, that returns a boolean depending on whether or not the player is in noclip.","code":"local meta = FindMetaTable( \"Player\" )\nfunction meta:InNoclip()\n\t-- un-comment the line below to perform a check, if the player is an admin.\n\t--if ( self:IsAdmin() == false ) then return false end\n\n\treturn self:GetMoveType() == MOVETYPE_NOCLIP\nend"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayerPostThink","parent":"GM","type":"hook","description":{"text":"Called after the player's think, just after GM:FinishMove.","note":"On the client side, it is only called for the local player."},"predicted":"Yes","realm":"Shared","args":{"arg":{"text":"The player","name":"ply","type":"Player"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayerRequestTeam","parent":"GM","type":"hook","description":"Request a player to join the team. This function will check if the team is available to join or not.\n\nThis hook is called when the player runs \"changeteam\" in the console.\n\nTo prevent the player from changing teams, see GM:PlayerCanJoinTeam","realm":"Server","args":{"arg":[{"text":"The player to try to put into a team","name":"ply","type":"Player"},{"text":"Team to put the player into if the checks succeeded","name":"team","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSay","parent":"GM","type":"hook","description":{"text":"Called when a player dispatched a chat message. For the clientside equivalent, see GM:OnPlayerChat.","note":"It may be more reliable to use gameevent/player_say to read messages serverside because addons commonly return values in this hook to change chat messages."},"realm":"Server","args":{"arg":[{"text":"The player which sent the message.","name":"sender","type":"Player"},{"text":"The message's content.","name":"text","type":"string"},{"text":"Return false when the message is for everyone, true when the message is for the sender's team.","name":"teamChat","type":"boolean"}]},"rets":{"ret":{"text":"What to show instead of original text. Set to `\"\"` to stop the message from displaying.","name":"","type":"string"}}},"example":[{"description":"Adds a coin flip command to the chat. Player should type `/flip` (case-insensitive).","code":"hook.Add( \"PlayerSay\", \"CoinFlip\", function( ply, text )\n\tif ( string.lower( text ) == \"/flip\" ) then\n\t\tPrintMessage( HUD_PRINTTALK, ply:Nick() .. \" flipped the coin and got \" .. ( math.random( 2 ) == 1 and \"heads\" or \"tails\" ) )\n\t\treturn \"\"\n\tend\nend )","output":"```\nPlayer1 flipped the coin and got heads\n```"},{"description":"Adds a symbol counter command to the chat. Player should type `/len *text*` (case-insensitive).","code":"hook.Add( \"PlayerSay\", \"CharCount\", function( ply, text )\n\tif ( string.StartWith( string.lower( text ), \"/len \" ) ) then\n\t\tply:ChatPrint( \"Your message has \" .. utf8.len( string.sub( text, 6 ) ) .. \" symbol(s).\" ) -- We use 6 in string.sub because it's a length of \"/len \" + 1\n\t\treturn \"\"\n\tend\nend )","output":"```\nYour message has 5 symbol(s). [When someone typed: \"/len Hello\"]\n```"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSelectSpawn","parent":"GM","type":"hook","description":{"text":"Called to determine a spawn point for a player to spawn at.","note":"The spawn point entity will also impact the player's eye angle. For example, if the entity is upside down, the player's view will be as well."},"realm":"Server","file":{"text":"gamemodes/base/gamemode/player.lua","line":"360-L495"},"args":{"arg":[{"text":"The player who needs a spawn point","name":"ply","type":"Player"},{"text":"If true, the player just spawned from a map transition (`trigger_changelevel`). You probably want to not return an entity for that case to not override player's position.","name":"transition","type":"boolean"}]},"rets":{"ret":{"text":"The spawn point entity to spawn the player at","name":"","type":"Entity"}}},"example":{"description":"Find a random spawn point","code":"hook.Add(\"PlayerSelectSpawn\", \"RandomSpawn\", function(pl)\n\tlocal spawns = ents.FindByClass(\"info_player_start\")\n\tlocal random_entry = math.random(#spawns)\n\n\treturn spawns[random_entry]\nend)"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSelectTeamSpawn","parent":"GM","type":"hook","description":"Find a team spawn point entity for this player.","realm":"Server","file":{"text":"gamemodes/base/gamemode/player.lua","line":"301-L323"},"args":{"arg":[{"text":"Players team","name":"team","type":"number"},{"text":"The player","name":"ply","type":"Player"}]},"rets":{"ret":{"text":"The entity to use as a spawn point.","name":"","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSetHandsModel","parent":"GM","type":"hook","description":"Called whenever view model hands needs setting a model. By default this calls PLAYER:GetHandsModel and if that fails, sets the hands model according to his player model.","realm":"Server","args":{"arg":[{"text":"The player whose hands needs a model set","name":"ply","type":"Player"},{"text":"The hands to set model of","name":"ent","type":"Entity"}]}},"example":{"description":"Sets the players hands to the model's hands.","code":"function GM:PlayerSetHandsModel( ply, ent )\n   local simplemodel = player_manager.TranslateToPlayerModelName(ply:GetModel())\n   local info = player_manager.TranslatePlayerHands(simplemodel)\n   if info then\n      ent:SetModel(info.model)\n      ent:SetSkin(info.skin)\n      ent:SetBodyGroups(info.body)\n   end\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSetModel","parent":"GM","type":"hook","description":{"text":"Called whenever a player spawns and must choose a model. A good place to assign a model to a player.","note":"This function may not work in your custom gamemode if you have overridden your GM:PlayerSpawn and you do not use self.BaseClass.PlayerSpawn in it, or hook.Call this hook from GM:PlayerSpawn."},"realm":"Server","args":{"arg":{"text":"The player being chosen","name":"ply","type":"Player"}}},"example":{"description":"Sets the player's model to Odessa","code":"function GM:PlayerSetModel( ply )\n   ply:SetModel( \"models/player/odessa.mdl\" )\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerShouldTakeDamage","parent":"GM","type":"hook","description":{"text":"Returns true if the player should take damage from the given attacker.","warning":"Applying damage from this hook to the player taking damage will lead to infinite loop/crash."},"realm":"Server","args":{"arg":[{"text":"The player","name":"ply","type":"Player"},{"text":"The attacker","name":"attacker","type":"Entity"}]},"rets":{"ret":{"text":"Allow damage","name":"","type":"boolean"}}},"example":{"description":"Block damages between two players on the same team.","code":"hook.Add( \"PlayerShouldTakeDamage\", \"AntiTeamkill\", function( ply, attacker )\n\tif ply:Team() == attacker:Team() then\n\t\treturn false -- that will block damage if attacker and ply is on the same team.\n\tend\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerShouldTaunt","parent":"GM","type":"hook","description":"Allows to suppress player taunts.","realm":"Server","args":{"arg":[{"text":"Player who tried to taunt","name":"ply","type":"Player"},{"text":"Act ID of the taunt player tries to do, see Enums/ACT","name":"act","type":"number"}]},"rets":{"ret":{"text":"Return false to disallow player taunting","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSilentDeath","parent":"GM","type":"hook","description":{"text":"Called when the player is killed by Player:KillSilent.\n\nThe player is already considered dead when this hook is called.\n\n* See GM:PlayerDeath for a hook which handles all other death causes.\n* GM:PostPlayerDeath is called **after** this hook.","note":"Player:Alive will return true in this hook."},"realm":"Server","args":{"arg":{"text":"The player who was killed","name":"ply","type":"Player"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSpawn","parent":"GM","type":"hook","description":{"text":"Called whenever a player spawns, including respawns.\n\nSee GM:PlayerInitialSpawn for a hook called only the first time a player spawns.\n\nSee the player_spawn gameevent for a shared version of this hook.","warning":"By default, in \"base\" derived gamemodes, this hook will also call GM:PlayerLoadout and GM:PlayerSetModel, which may override your Entity:SetModel and Player:Give calls. Consider using the other hooks or a 0-second timer."},"realm":"Server","args":{"arg":[{"text":"The player who spawned.","name":"player","type":"Player"},{"text":"If true, the player just spawned from a map transition. You probably want to not touch player's weapons or position if this is set to `true`.","name":"transition","type":"boolean"}]}},"example":[{"description":"Prints a message when a player spawns.","code":"function GM:PlayerSpawn( ply )\n    MsgN( ply:Nick() .. \" has spawned!\" )\nend","output":"```\nPlayer1 has spawned!\n```"},{"description":"Prints a message when a player spawns using a hook.","code":"local function Spawn( ply )\n\tprint( ply:Nick() .. \" has spawned!\" )\nend\nhook.Add( \"PlayerSpawn\", \"some_unique_name\", Spawn )","output":"```\nPlayer1 has spawned!\n```"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSpawnAsSpectator","parent":"GM","type":"hook","description":"Called to spawn the player as a spectator.","realm":"Server","file":{"text":"gamemodes/base/gamemode/player.lua","line":"219-233"},"args":{"arg":{"text":"The player to spawn as a spectator","name":"ply","type":"Player"}}},"example":{"description":"Makes all players spawn as spectators.","code":"function GM:PlayerSpawn( ply )\n \n\tGAMEMODE:PlayerSpawnAsSpectator( ply )\n \nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSpray","parent":"GM","type":"hook","description":"Determines if the player can spray using the `impulse 201` console command.","realm":"Server","args":{"arg":{"text":"The player.","name":"sprayer","type":"Player"}},"rets":{"ret":{"text":"Return `false` to allow spraying, return `true` to prevent spraying.","name":"","type":"boolean"}}},"example":{"description":"Makes so that only Admins can spray.","code":"hook.Add( \"PlayerSpray\", \"DisablePlayerSpray\", function( ply )\n\treturn not ply:IsAdmin()\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerStartTaunt","parent":"GM","type":"hook","description":"Called when player starts taunting.","realm":"Server","args":{"arg":[{"text":"The player who is taunting","name":"ply","type":"Player"},{"text":"The sequence ID of the taunt","name":"act","type":"number"},{"text":"Length of the taunt","name":"length","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerStartVoice","parent":"GM","type":"hook","description":{"text":"Called when a player starts using voice chat.","note":"Set mp_show_voice_icons to 0, if you want disable icons above player."},"realm":"Client","args":{"arg":[{"text":"Player who started using voice chat.","name":"ply","type":"Player"},{"text":"The player index. Only appears when non-local player speaks for the first time.","name":"plyIndex","type":"number","default":"nil"}]},"rets":{"ret":{"text":"Set true to hide player's `CHudVoiceStatus`.","name":"","type":"boolean"}}},"example":{"description":"Shows the icon when the player talks.","code":"local icon = Material(\"icon32/unmuted.png\")\nlocal function iconfunc()\n\tsurface.SetDrawColor(255, 255, 255)\n\tsurface.SetMaterial(icon)\n\tsurface.DrawTexturedRect(200, 200, 200, 200)\nend\n\nhook.Add(\"PlayerStartVoice\", \"ImageOnVoice\", function()\n\thook.Add(\"HUDPaint\", \"ImageOnVoice\", iconfunc)\nend)\n\nhook.Add(\"PlayerEndVoice\", \"ImageOnVoice\", function()\n\thook.Remove(\"HUDPaint\", \"ImageOnVoice\")\nend)"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PlayerStepSoundTime","parent":"GM","type":"hook","description":{"text":"Allows you to override the time between footsteps.\n\nSee GM:PlayerFootstep for a related hook about footstep sounds themselves.","note":"This hook is called on all clients."},"realm":"Shared","predicted":true,"args":{"arg":[{"text":"Player who is walking","name":"ply","type":"Player"},{"text":"The type of footsteps, see Enums/STEPSOUNDTIME","name":"type","type":"number"},{"text":"Is the player walking or not ( +walk? )","name":"walking","type":"boolean"}]},"rets":{"ret":{"text":"Time between footsteps, in ms","name":"","type":"number"}}},"example":{"description":"A Very simple footstep cadence changer. This will change the cadence of the default footsteps.","code":"hook.Add(\"PlayerStepSoundTime\", \"SimpleCadence\", function(ply, iType, walking)\n\treturn 500 -- This will change the cadence of the footsteps. Lower number = Faster cadence, Higher number = Slower cadence.\nend)"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayerSwitchFlashlight","parent":"GM","type":"hook","description":{"text":"Called whenever a player attempts to either turn on or off their flashlight, returning false will deny the change.","note":"Also gets called when using Player:Flashlight."},"realm":"Server","args":{"arg":[{"text":"The player who attempts to change their flashlight state.","name":"ply","type":"Player"},{"text":"The new state the player requested, true for on, false for off.","name":"enabled","type":"boolean"}]},"rets":{"ret":{"text":"Can toggle the flashlight or not","name":"","type":"boolean"}}},"example":{"description":"Only allow the flashlight for admins, you can also use Player:AllowFlashlight for that.","code":"hook.Add( \"PlayerSwitchFlashlight\", \"BlockFlashLight\", function( ply, enabled )\n\treturn ply:IsAdmin() -- Allow the player to use their flashlight if they are an admin\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSwitchWeapon","parent":"GM","type":"hook","description":"Called when a player attempts to switch their weapon.\n\nPrimary usage of this hook is to prevent/allow weapon switching, **not** to detect weapon switching. It will not be called for Player:SetActiveWeapon.","realm":"Shared","predicted":"Yes","args":{"arg":[{"text":"The player switching weapons.","name":"player","type":"Player"},{"text":"The previous weapon. Will be `NULL` if the previous weapon was removed or the player is switching from nothing.","name":"oldWeapon","type":"Weapon"},{"text":"The weapon the player switched to. Will be `NULL` if the player is switching to nothing.","name":"newWeapon","type":"Weapon","bug":{"text":"This can be `NULL` on the client if the weapon hasn't been created over the network yet.","issue":"2922"}}]},"rets":{"ret":{"text":"Return `true` to prevent weapon switch.","name":"","type":"boolean"}}},"example":{"description":"The players weapon information will be printed when the player switched weapons.","code":"hook.Add( \"PlayerSwitchWeapon\", \"WeaponSwitchExample\", function( ply, oldWeapon, newWeapon )\n\t-- GetClass() will return the weapons class as a string.\n\tMsgN( \"You switched weapons! Your old weapon is \" .. oldWeapon:GetClass() ..\".\" )\n\tMsgN( \"Your new weapon is \" .. newWeapon:GetClass() .. \".\" )\nend )","output":"```\nYou switched weapons! Your old weapon is gmod_camera.\nYour new weapon is weapon_crossbow.\n\n```"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayerTick","parent":"GM","type":"hook","description":{"text":"The Move hook is called for you to manipulate the player's CMoveData. This hook is called moments before GM:Move and GM:PlayerNoClip.","warning":"This hook will not run when inside a vehicle. GM:VehicleMove will be called instead."},"realm":"Shared","predicted":"Yes","args":{"arg":[{"text":"The player","name":"player","type":"Player"},{"text":"The current movedata for the player.","name":"mv","type":"CMoveData"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayerTraceAttack","parent":"GM","type":"hook","description":"Called when a player has been hit by a trace and damaged (such as from a bullet). Returning true overrides the damage handling and prevents GM:ScalePlayerDamage from being called.","realm":"Shared","args":{"arg":[{"text":"The player that has been hit","name":"ply","type":"Player"},{"text":"The damage info of the bullet","name":"dmginfo","type":"CTakeDamageInfo"},{"text":"Normalized vector direction of the bullet's path","name":"dir","type":"Vector"},{"text":"The trace of the bullet's path, see Structures/TraceResult","name":"trace","type":"table{TraceResult}"}]},"rets":{"ret":{"text":"Override engine handling","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PlayerUnfrozeObject","parent":"GM","type":"hook","description":"Called when a player unfreezes an object.","realm":"Server","args":{"arg":[{"text":"Player who has unfrozen an object","name":"ply","type":"Player"},{"text":"The unfrozen object","name":"ent","type":"Entity"},{"text":"The frozen physics object of the unfrozen entity ( For ragdolls )","name":"physobj","type":"PhysObj"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerUse","parent":"GM","type":"hook","description":"Triggered when the player presses use on an object. Continuously runs until USE is released but will not activate other Entities until the USE key is released; dependent on activation type of the Entity.","realm":"Server","args":{"arg":[{"text":"The player pressing the \"use\" key.","name":"ply","type":"Player"},{"text":"The entity which the player is looking at / activating USE on.","name":"ent","type":"Entity"}]},"rets":{"ret":{"text":"Return `false` if the player is not allowed to USE the entity.\n\nDo not return `true` if using a hook, otherwise other mods may not get a chance to block a player's use.","name":"","type":"boolean"}}},"example":[{"description":"The arguments will continue to be output as long as the user holds their USE key. If the user activates one object, say a door, and looks at a different object, say a different door, then the print statement will reflect the new Entity, however even when true is returned the new Entity will not be activated until the user lets go of USE and depresses it once again; this is dependent on the USE TYPE of the Entity.","code":"hook.Add( \"PlayerUse\", \"some_unique_name2\", function( ply, ent )\n\tprint( ply, ent )\nend )","output":"After holding it for a VERY brief moment looking at one door in a way that I would look at the other door once the first opens.\n```\nPlayer [1][Example_User_Name] \tEntity [369][func_door_rotating]\nPlayer [1][Example_User_Name] \tEntity [369][func_door_rotating]\nPlayer [1][Example_User_Name] \tEntity [368][func_door_rotating]\nPlayer [1][Example_User_Name] \tEntity [368][func_door_rotating]\n```"},{"description":"Prevent users from using the ammo cache on the back of a Jeep.","code":"hook.Add( \"PlayerUse\", \"some_unique_name\", function( ply, ent )\n\tif ( !IsValid( ent ) or !ent:IsVehicle() ) then return end\n\t\n\tif ( ply:GetEyeTrace().HitGroup == 5 ) then\n\t\treturn false\n\tend\nend )"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"PopulateMenuBar","parent":"GM","type":"hook","description":"Called when it's time to populate the context menu menu bar at the top.","realm":"Client","args":{"arg":{"text":"The DMenuBar itself.","name":"menubar","type":"Panel"}}},"example":{"description":"Example usage of the hook","code":"hook.Add( \"PopulateMenuBar\", \"My_MenuBar\", function( menubar )\n\n\tlocal m = menubar:AddOrGetMenu( \"Test\" )\n\n\tm:AddCVar( \"Item 1\", \"console_var1\", \"1\", \"0\" )\n\n\tm:AddSpacer()\n\n\tm:AddCVar( \"Item 2\", \"console_var2\", \"0\", \"100\" )\n\n\tm:AddCVar( \"Check console\", \"console_var3\", \"1\", \"0\", function() print(\"I was clicked!\") end )\n\n\n\tlocal submenu = m:AddSubMenu( \"Submenu\" )\n\n\tsubmenu:SetDeleteSelf( false )\n\tsubmenu:AddCVar( \"No password\", \"password\", \"\" )\n\tsubmenu:AddSpacer()\n\n\tsubmenu:AddCVar( \"Password: test1\", \"password\", \"test1\" )\n\tsubmenu:AddCVar( \"Password: lolno\", \"password\", \"lolno\" )\n\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PostCleanupMap","parent":"GM","type":"hook","description":"Called right after the map has cleaned up (usually because game.CleanUpMap was called)\n\nSee also GM:PreCleanupMap.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PostDraw2DSkyBox","parent":"GM","type":"hook","description":{"text":"Called right after the 2D skybox has been drawn - allowing you to draw over it.","rendercontext":{"hook":"true","type":"3D"}},"realm":"Client"},"example":{"description":"Draw a textured quad on the horizon, behind the 3D skybox.","code":"local Mat = Material( \"dev/graygrid\" )\n\nhook.Add(\"PostDraw2DSkyBox\", \"ExampleHook\", function()\n    \n    render.OverrideDepthEnable( true, false ) -- ignore Z to prevent drawing over 3D skybox\n\n    -- Start 3D cam centered at the origin\n    cam.Start3D( Vector( 0, 0, 0 ), EyeAngles() )\n        render.SetMaterial( Mat )\n        render.DrawQuadEasy( Vector(1,0,0) * 200, Vector(-1,0,0), 64, 64, Color(255,255,255), 0 )\n    cam.End3D()\n\n    render.OverrideDepthEnable( false, false )\n\nend)"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PostDrawEffects","parent":"GM","type":"hook","description":{"text":"Called after rendering effects. This is where halos are drawn. Called just before GM:PreDrawHUD (The two hooks are basically identical).\n\nSee GM:PreDrawEffects for the associated hook.","rendercontext":{"hook":"true","type":"2D"}},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PostDrawHUD","parent":"GM","type":"hook","description":{"text":"Called after GM:PreDrawHUD,  GM:HUDPaintBackground and GM:HUDPaint but before  GM:DrawOverlay.\n\nUnlike GM:HUDPaint(Background) hooks, this will still be called when the main menu is visible. And so will be GM:PreDrawHUD","rendercontext":{"hook":"true","type":"2D"}},"realm":"Client"},"example":{"description":"Draws a transparent black box in the top left corner of the screen.","code":"hook.Add( \"PostDrawHUD\", \"DrawHelloWorldBox\", function()\n    local w = 256\n    local h = 64\n\n\tcam.Start2D() -- If you don't call this the text inside the hook will render odd.\n\t\tsurface.SetDrawColor( 20, 20, 20, 200 )\n\t\tsurface.DrawRect( 0, 0, w, h )\n\n        draw.SimpleText( \"Hello World\", \"Trebuchet24\", w / 2, h / 2, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )\n\tcam.End2D()\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PostDrawOpaqueRenderables","parent":"GM","type":"hook","description":{"text":"Called after drawing opaque entities.\n\nSee also GM:PostDrawTranslucentRenderables and GM:PreDrawOpaqueRenderables.","rendercontext":{"hook":"true","type":"3D"}},"realm":"Client","args":{"arg":[{"text":"Whether the current draw is writing depth.","name":"bDrawingDepth","type":"boolean"},{"text":"Whether the current draw is drawing the 3D or 2D skybox.\n\nIn case of 2D skyboxes it is possible for this hook to always be called with this parameter set to `true`.","name":"bDrawingSkybox","type":"boolean"},{"text":"Whether the current draw is drawing the 3D.","name":"isDraw3DSkybox","type":"boolean"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PostDrawPlayerHands","parent":"GM","type":"hook","description":"Called after the player hands are drawn.\n\nSee GM:PostDrawViewModel for the view model alternative.  \nSee GM:PreDrawPlayerHands for a hook that is called just before view model hands are drawn.","realm":"Client","args":{"arg":[{"text":"This is the gmod_hands entity.","name":"hands","type":"Entity"},{"text":"This is the view model entity.","name":"vm","type":"Entity"},{"text":"The the owner of the view model.","name":"ply","type":"Player"},{"text":"This is the weapon that is from the view model.","name":"weapon","type":"Weapon"},{"text":"The STUDIO_ flags for this render operation.","name":"flags","type":"number","added":"2025.12.17"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PostDrawSkyBox","parent":"GM","type":"hook","description":{"text":"Called after drawing the 3D skybox. This will not be called if skybox rendering was prevented via the GM:PreDrawSkyBox hook.\n\nSee also GM:PostDraw2DSkyBox.","rendercontext":{"hook":"true","type":"3D"}},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PostDrawTranslucentRenderables","parent":"GM","type":"hook","description":{"text":"Called after all translucent entities are drawn.\n\nSee also GM:PostDrawOpaqueRenderables and  GM:PreDrawTranslucentRenderables.","rendercontext":{"hook":"true","type":"3D"},"bug":[{"text":"This is still called when r_drawentities or r_drawopaquerenderables is disabled.","issue":"3295"},{"text":"This is not called when r_drawtranslucentworld is disabled.","issue":"3296"}]},"realm":"Client","args":{"arg":[{"text":"Whether the current call is writing depth.","name":"bDrawingDepth","type":"boolean"},{"text":"Whether the current call is drawing the 3D or 2D skybox.\n\nIn case of 2D skyboxes it is possible for this hook to always be called with this parameter set to `true`.","name":"bDrawingSkybox","type":"boolean"},{"text":"Whether the current call is drawing the 3D skybox.","name":"isDraw3DSkybox","type":"boolean"}]}},"example":{"description":"Draws a solid black sphere at where the player is looking at, but not when the skybox is being drawn.\n\nYou can see why this is needed if you disable the skybox check and look into the sky on gm_flatgrass (or any other map where the 3d skybox is below the map) and you will notice 2 spheres and not 1.","code":"hook.Add( \"PostDrawTranslucentRenderables\", \"test\", function( bDepth, bSkybox )\n\t-- If we are drawing in the skybox, bail\n\tif ( bSkybox ) then return end\n\n\t-- Set the draw material to solid white\n\trender.SetColorMaterial()\n\n\t-- The position to render the sphere at, in this case, the looking position of the local player\n\tlocal pos = LocalPlayer():GetEyeTrace().HitPos\n\n\t-- Draw the sphere!\n\trender.DrawSphere( pos, 500, 30, 30, color_black )\nend )","output":{"upload":{"src":"22674/8d9d79bce67a7e7.png","size":"85032","name":"image.png"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PostDrawViewModel","parent":"GM","type":"hook","description":{"text":"Called after view model is drawn.\n\nThe render FOV in this hook is different from the main view, as view models are usually rendered with a different FOV. Every render operation will only be accurate with the view model entity.\n\nSee GM:PreDrawViewModel for a hook that is called just before a view model is drawn.\n\nFor view model hands alternative, see GM:PostDrawPlayerHands.","rendercontext":{"hook":"true","type":"3D"}},"realm":"Client","args":{"arg":[{"text":"Players view model","name":"viewmodel","type":"Entity"},{"text":"The owner of the weapon/view model","name":"player","type":"Player"},{"text":"The weapon the player is currently holding","name":"weapon","type":"Weapon"},{"text":"The STUDIO_ flags for this render operation.","name":"flags","type":"number","added":"2025.12.16"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PostEntityFireBullets","parent":"GM","type":"hook","description":{"text":"Called every time a bullet pellet (i.e. this hook is called multiple times for a shotgun shot) is fired from an entity. Notably this hook will have the final damage and aim direction for the bullet pellet.\n\nSee GM:EntityFireBullets if you wish to modify the bullets before they are fired.","warning":"This hook is called directly from Entity:FireBullets. Due to this, you cannot call Entity:FireBullets inside this hook or an infinite loop will occur crashing the game."},"added":"2023.11.16","realm":"Shared","args":{"arg":[{"text":"The entity that fired the bullet","name":"entity","type":"Entity"},{"text":"A table of data about the bullet that was fired.\n\n\t\t\tSee Structures/FiredBullet.","name":"data","type":"table{FiredBullet}"}]},"rets":{"ret":{"text":"Return `false` to suppress the bullet.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PostEntityTakeDamage","parent":"GM","type":"hook","description":{"text":"Called when an entity receives a damage event, after passing damage filters, etc.\n\nSee GM:EntityTakeDamage if you wish to prevent damage events, or otherwise alter them.","warning":"Applying damage from this hook to the entity taking damage will lead to infinite loop/crash."},"realm":"Server","args":{"arg":[{"text":"The entity that took the damage.","name":"ent","type":"Entity"},{"text":"Detailed information about the damage event.","name":"dmginfo","type":"CTakeDamageInfo"},{"text":"Whether the entity actually took the damage. (For example, shooting a Strider will generate this event, but it won't take bullet damage).","name":"wasDamageTaken","type":"boolean"}]}},"example":{"description":"Displays some info about damage taken event when they occur.","code":"hook.Add( \"PostEntityTakeDamage\", \"PostEntityTakeDamagePrintOut\", function( ent, dmgInfo, wasDamageTaken )\n\tprint( dmgInfo:GetDamage() )\n\tprint( ent, dmgInfo:GetAttacker(), dmgInfo:GetWeapon(), dmgInfo:GetInflictor() )\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PostGamemodeLoaded","parent":"GM","type":"hook","description":"Called after the gamemode has loaded.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PostPlayerDeath","parent":"GM","type":"hook","description":{"text":"Called right after GM:DoPlayerDeath, GM:PlayerDeath and GM:PlayerSilentDeath.\n\nThis hook will be called for all deaths, including Player:KillSilent","note":"Player:Alive will return false in this hook."},"realm":"Server","args":{"arg":{"text":"The player","name":"ply","type":"Player"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PostPlayerDraw","parent":"GM","type":"hook","description":{"text":"Called after a given player in your [PVS (Potential Visibility Set)](https://developer.valvesoftware.com/wiki/PVS \"PVS - Valve Developer Community\") was drawn.\n\nThis hook will not be called if player was prevented from being drawn via GM:PrePlayerDraw.","rendercontext":{"hook":"true","type":"3D"}},"realm":"Client","args":{"arg":[{"text":"The player that was drawn.","name":"ply","type":"Player"},{"text":"The STUDIO_ flags for this render operation.","name":"flags","type":"number"}]}},"example":[{"description":"Show each player's name above their model.","code":"local vectorpos = Vector( 0, 0, 85 ) -- we cache it to optimize the code \nlocal function DrawName( ply )\n\tif ( !IsValid( ply ) ) then return end \n\tif ( ply == LocalPlayer() ) then return end -- Don't draw a name when the player is you\n\tif ( !ply:Alive() ) then return end -- Check if the player is alive \n \n\tlocal Distance = LocalPlayer():GetPos():Distance( ply:GetPos() ) --Get the distance between you and the player\n\t\n\tif ( Distance < 1000 ) then --If the distance is less than 1000 units, it will draw the name\n \n\t\tlocal offset = vectorpos\n\t\tlocal ang = LocalPlayer():EyeAngles()\n\t\tlocal pos = ply:GetPos() + offset + ang:Up()\n\t \n\t\tang:RotateAroundAxis( ang:Forward(), 90 )\n\t\tang:RotateAroundAxis( ang:Right(), 90 )\n\t \n\t\t\n\t\tcam.Start3D2D( pos, Angle( 0, ang.y, 90 ), 0.25 )\n\t\t\tdraw.DrawText( ply:GetName(), \"HudSelectionText\", 2, 2, team.GetColor(ply:Team()), TEXT_ALIGN_CENTER )\n\t\tcam.End3D2D()\n\tend\nend\nhook.Add( \"PostPlayerDraw\", \"DrawName\", DrawName )"},{"description":"Draw a headcrab hat on all players.","code":"local model = ClientsideModel( \"models/headcrabclassic.mdl\" )\nmodel:SetNoDraw( true )\n\nhook.Add( \"PostPlayerDraw\" , \"manual_model_draw_example\" , function( ply )\n\tif not IsValid(ply) or not ply:Alive() then return end\n\n\tlocal attach_id = ply:LookupAttachment('eyes')\n\tif not attach_id then return end\n\t\t\t\n\tlocal attach = ply:GetAttachment(attach_id)\n\t\t\t\n\tif not attach then return end\n\t\t\t\n\tlocal pos = attach.Pos\n\tlocal ang = attach.Ang\n\t\t\n\tmodel:SetModelScale(1.1, 0)\n\tpos = pos + (ang:Forward() * 2.5)\n\tang:RotateAroundAxis(ang:Right(), 20)\n\t\t\n\tmodel:SetPos(pos)\n\tmodel:SetAngles(ang)\n\n\tmodel:SetRenderOrigin(pos)\n\tmodel:SetRenderAngles(ang)\n\tmodel:SetupBones()\n\tmodel:DrawModel()\n\tmodel:SetRenderOrigin()\n\tmodel:SetRenderAngles()\n\nend )","output":{"upload":{"src":"4996d/8d7f44659e598a9.jpg","size":"126942","name":"4000_screenshots_20200509142006_1.jpg"}}}],"realms":["Client"],"type":"Function"},
{"function":{"name":"PostProcessPermitted","parent":"GM","type":"hook","description":"Allows you to suppress post processing effect drawing.","realm":"Client","args":{"arg":{"text":"The classname of Post Processing effect","name":"effect_name","type":"string"}},"rets":{"ret":{"text":"Return true/false depending on whether this post process should be allowed","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PostRender","parent":"GM","type":"hook","description":"Called after the frame has been rendered.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PostRenderVGUI","parent":"GM","type":"hook","description":{"text":"Called after the VGUI has been drawn.","rendercontext":{"hook":"true","type":"2D"}},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PostUndo","parent":"GM","type":"hook","description":"Called just after performing an undo.","realm":"Server","added":"2021.03.31","args":{"arg":[{"text":"The undo table. See Undo struct.","name":"undo","type":"table"},{"text":"The amount of props/actions undone. This will be `0` for undos that are skipped in cases where for example the entity that is meant to be undone is already deleted.","name":"count","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PreCleanupMap","parent":"GM","type":"hook","description":"Called right before the map cleans up (usually because game.CleanUpMap was called)\n\nSee also GM:PostCleanupMap.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PreDrawEffects","parent":"GM","type":"hook","description":{"text":"Called just after GM:PreDrawViewModel and can technically be considered as a \"PostDrawAllViewModels\".\n\nSee GM:PostDrawEffects for the associated hook.","rendercontext":{"hook":"true","type":"3D"}},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PreDrawHalos","parent":"GM","type":"hook","description":{"text":"Called before rendering the halos. This is the place to call halo.Add. This hook is actually running inside of GM:PostDrawEffects.","rendercontext":{"hook":"true","type":"3D"}},"realm":"Client","file":{"text":"lua/includes/modules/halo.lua","line":"148"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PreDrawHUD","parent":"GM","type":"hook","description":"Called just after GM:PostDrawEffects (duplicate of it). Drawing anything in it seems to work incorrectly.\n\nSee GM:PostDrawHUD for the associated hook.","realm":"Client"},"example":{"description":"Allows you to draw something before any other HUD elements.","code":"hook.Add( \"PreDrawHUD\", \"PreDrawExample\", function()\n\n\tcam.Start2D() -- If you don't call this the drawing will not work properly.\n\n\t\tsurface.SetDrawColor( 20, 20, 20, 200 )\n\t\tsurface.DrawRect( 0, 0, ScrW(), ScrH() )\n\n\tcam.End2D()\n\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PreDrawOpaqueRenderables","parent":"GM","type":"hook","description":{"text":"Called before all opaque entities are drawn.\n\nSee also GM:PreDrawTranslucentRenderables and  GM:PostDrawOpaqueRenderables.","rendercontext":{"hook":"true","type":"3D"}},"realm":"Client","args":{"arg":[{"text":"Whether the current draw is writing depth.","name":"isDrawingDepth","type":"boolean"},{"text":"Whether the current draw is drawing the 3D or 2D skybox.\n\nIn case of 2D skyboxes it is possible for this hook to always be called with this parameter set to `true`.","name":"isDrawSkybox","type":"boolean"},{"text":"Whether the current draw is drawing the 3D.","name":"isDraw3DSkybox","type":"boolean"}]},"rets":{"ret":{"text":"Return true to prevent opaque renderables from drawing.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PreDrawPlayerHands","parent":"GM","type":"hook","description":"Called before the player hands are drawn.\n\nSee GM:PreDrawViewModel for the view model alternative.  \nSee GM:PostDrawPlayerHands for a hook that is called just before view model hands are drawn.","realm":"Client","args":{"arg":[{"text":"This is the gmod_hands entity before it is drawn.","name":"hands","type":"Entity"},{"text":"This is the view model entity before it is drawn.","name":"vm","type":"Entity"},{"text":"The the owner of the view model.","name":"ply","type":"Player"},{"text":"This is the weapon that is from the view model.","name":"weapon","type":"Weapon"},{"text":"The STUDIO_ flags for this render operation.","name":"flags","type":"number","added":"2025.12.17"}]},"rets":{"ret":{"text":"Return true to prevent the viewmodel hands from rendering","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PreDrawSkyBox","parent":"GM","type":"hook","description":{"text":"Called before the 3D sky box is drawn. This will not be called for maps with no 3D skybox, or when the 3d skybox is disabled. (`r_3dsky 0`)\n\nSee also GM:PostDrawSkyBox","rendercontext":{"hook":"true","type":"3D"}},"realm":"Client","rets":{"ret":{"text":"Return true to disable skybox drawing (both 2D and 3D skybox)","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PreDrawTranslucentRenderables","parent":"GM","type":"hook","description":{"text":"Called before all the translucent entities are drawn.\n\nSee also GM:PreDrawOpaqueRenderables and  GM:PostDrawTranslucentRenderables.","rendercontext":{"hook":"true","type":"3D"},"bug":[{"text":"This is still called when r_drawentities or r_drawopaquerenderables is disabled.","issue":"3295"},{"text":"This is not called when r_drawtranslucentworld is disabled.","issue":"3296"}]},"realm":"Client","args":{"arg":[{"text":"Whether the current draw is writing depth.","name":"isDrawingDepth","type":"boolean"},{"text":"Whether the current draw is drawing the 3D or 2D skybox.\n\nIn case of 2D skyboxes it is possible for this hook to always be called with this parameter set to `true`.","name":"isDrawSkybox","type":"boolean"},{"text":"Whether the current draw is drawing the 3D.","name":"isDraw3DSkybox","type":"boolean"}]},"rets":{"ret":{"text":"Return true to prevent translucent renderables from drawing.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PreDrawViewModel","parent":"GM","type":"hook","description":{"text":"Called before the view model has been drawn.\n\nBy default this hook also calls WEAPON:PreDrawViewModel, so you can use that if developing a scripted weapon.\n\nSee GM:PostDrawViewModel for a hook that runs immediately after rendering a view model.  \nSee GM:PreDrawViewModels for a hook that runs before **all** view models are drawn within a frame.\n\nFor view model hands, see GM:PreDrawPlayerHands.","rendercontext":{"hook":"true","type":"3D"}},"realm":"Client","args":{"arg":[{"text":"This is the view model entity before it is drawn. On server-side, this entity is the predicted view model.","name":"vm","type":"Entity"},{"text":"The owner of the view model.","name":"ply","type":"Player"},{"text":"This is the weapon that is from the view model.","name":"weapon","type":"Weapon"},{"text":"The STUDIO_ flags for this render operation.","name":"flags","type":"number","added":"2025.12.16"}]},"rets":{"ret":{"text":"Return true to prevent the default view model rendering. This also affects GM:PostDrawViewModel.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PreDrawViewModels","parent":"GM","type":"hook","added":"2020.06.24","description":{"text":"Called just before all view models (there are 3 per player, see Player:GetViewModel) and entities with `RENDERGROUP_VIEWMODEL` are drawn.\n\nSee GM:PreDrawViewModel and GM:PostDrawViewModel for hooks that run for specific view models.\n\nYou can use GM:PreDrawEffects as a \"`PostDrawViewModels`\" hook as it is called just after the all the view model(s) are drawn.","rendercontext":{"hook":"true","type":"3D"}},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PreGamemodeLoaded","parent":"GM","type":"hook","description":"Called before the gamemode is loaded.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PrePlayerDraw","parent":"GM","type":"hook","description":"Called before the player is drawn.\n\nSee also GM:PostPlayerDraw.","realm":"Client","args":{"arg":[{"text":"The player that is about to be drawn.","name":"player","type":"Player"},{"text":"The STUDIO_ flags for this render operation.","name":"flags","type":"number"}]},"rets":{"ret":{"text":"Return `true` to prevent default player rendering, which hides the player.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PreRegisterSENT","parent":"GM","type":"hook","description":"Called by scripted_ents.Register.","realm":"Shared","added":"2021.01.27","file":{"text":"lua/includes/modules/scripted_ents.lua","line":"55"},"args":{"arg":[{"text":"The entity table to be registered.","name":"ent","type":"table"},{"text":"The class name to be assigned.","name":"class","type":"string"}]},"rets":{"ret":{"text":"Return `false` to prevent the entity from being registered. Returning any other value has no effect.","name":"","type":"boolean"}}},"example":{"description":"Disallow registration of entities created by Garry, and change admin-only entities into regular entities.","code":"hook.Add( \"PreRegisterSENT\", \"MakeThingsFun\", function( ent, class )\n    if ( ent.Author == \"Garry Newman\" ) then\n        return false\n    end\n\n    ent.AdminOnly = false\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PreRegisterSWEP","parent":"GM","type":"hook","description":"Called when a Scripted Weapon (SWEP) is about to be registered, allowing addons to alter the weapon's SWEP table with custom data for later usage. Called internally from weapons.Register.","realm":"Shared","added":"2021.01.27","file":{"text":"lua/includes/modules/weapons.lua","line":"48"},"args":{"arg":[{"text":"The SWEP table to be registered.","name":"swep","type":"table"},{"text":"The class name to be assigned.","name":"class","type":"string"}]},"rets":{"ret":{"text":"Return `false` to prevent the weapon from being registered. Returning any other value has no effect.","name":"","type":"boolean"}}},"example":{"description":"Prevent registration of any weapon whose name contains a number, additionally, make all weapons automatic.","code":"hook.Add( \"PreRegisterSWEP\", \"NoNumbers\", function( swep, class )\n    if ( string.find( class, \"%d\" ) ) then\n        return false\n    end\n    \n\tswep.Primary.Automatic = true\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PreRender","parent":"GM","type":"hook","description":"Called before the renderer is about to start rendering the next frame.","realm":"Client","rets":{"ret":{"text":"Return true to prevent all rendering. This can make the whole game stop rendering anything.","name":"","type":"boolean"}}},"example":{"description":"Fills the draw buffer with black pixels, removing tearing when looking at a world leak. Achieves the same effect as using gl_clear. This is no longer needed as GMod does this by default.","code":"hook.Add(\"PreRender\", \"ResetBuffer\", function()\n\tcam.Start2D()\n\t\tsurface.SetDrawColor(0, 0, 0, 255)\n\t\tsurface.DrawRect(0, 0, ScrW(), ScrH())\n\tcam.End2D()\nend)"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PreUndo","parent":"GM","type":"hook","description":"Called just before performing an undo.","realm":"Server","added":"2021.03.31","args":{"arg":{"text":"The undo table. See Undo struct.","name":"undo","type":"table"}},"rets":{"ret":{"text":"Return `false` to disallow the undo.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PreventScreenClicks","parent":"GM","type":"hook","description":{"text":"This will prevent  from sending to server when player tries to shoot from C menu.","key":"IN_ATTACK"},"realm":"Client","rets":{"ret":{"text":"Return true to prevent screen clicks.","name":"","type":"boolean"}}},"example":{"description":{"text":"Disables usage of the World Clicker feature, where a player can hold  to shoot at their cursor instead of their crosshair.","key":"C"},"code":"hook.Add( \"PreventScreenClicks\", \"DisableWorldClicker\", function()\n\tlocal pnl = vgui.GetHoveredPanel()\n\tif ( IsValid( pnl ) ) then\n\t\tif ( pnl:IsWorldClicker() ) then return true end\n\n\t\twhile ( IsValid( pnl:GetParent() ) ) do\n\t\t\tpnl = pnl:GetParent()\n\t\t\tif ( pnl:IsWorldClicker() ) then return true end\n\t\tend\n\telse\n\t\t-- For when the cursor is outside of the game's window, there can be potential edge cases here\n\t\treturn true\n\tend\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PropBreak","parent":"GM","type":"hook","description":"Called when a prop has been destroyed.","realm":"Shared","args":{"arg":[{"text":"The person who broke the prop. This can be a NULL entity for cases where the prop was not broken by a player.","name":"attacker","type":"Player"},{"text":"The entity that has been broken by the attacker.","name":"prop","type":"Entity"}]}},"example":{"description":"This kills a player when a person breaks a prop (i.e. a wooden crate).","code":"hook.Add( \"PropBreak\", \"PropVengeance\", function( client, prop )\n\tif ( IsValid( client ) ) then client:Kill() end\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RenderScene","parent":"GM","type":"hook","description":{"text":"Render the scene. Used by the `Stereoscopy` post-processing effect.","note":"Materials rendered in this hook require `$ignorez` parameter to draw properly."},"realm":"Client","args":{"arg":[{"text":"View origin","name":"origin","type":"Vector"},{"text":"View angles","name":"angles","type":"Angle"},{"text":"View FOV","name":"fov","type":"number"}]},"rets":{"ret":{"text":"Return `true` to override drawing the scene.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"RenderScreenspaceEffects","parent":"GM","type":"hook","description":{"text":"Used to render post processing effects.","rendercontext":{"hook":"true","type":"2D"}},"realm":"Client"},"example":{"description":"Renders color modify and sobel effects to create a cartoon effect.","code":"local tab = {\n\t[\"$pp_colour_addr\"] = 0,\n\t[\"$pp_colour_addg\"] = 0,\n\t[\"$pp_colour_addb\"] = 0,\n\t[\"$pp_colour_brightness\"] = -0.04,\n\t[\"$pp_colour_contrast\"] = 1.35,\n\t[\"$pp_colour_colour\"] = 5,\n\t[\"$pp_colour_mulr\"] = 0,\n\t[\"$pp_colour_mulg\"] = 0,\n\t[\"$pp_colour_mulb\"] = 0\n}\nhook.Add(\"RenderScreenspaceEffects\", \"PostProcessingExample\", function()\n\tDrawColorModify( tab ) --Draws Color Modify effect\n\tDrawSobel( 0.5 ) --Draws Sobel effect\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Restored","parent":"GM","type":"hook","description":"Called when the game is reloaded from a Source Engine save system ( not the Sandbox saves or dupes ).\n\nSee GM:Saved for a hook that is called when such a save file is created.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Saved","parent":"GM","type":"hook","description":"Called when the game is saved using the Source Engine save system (not the Sandbox saves or dupes).\n\nSee GM:Restored for a hook that is called when such a save file is loaded.\n\nSee also the saverestore for relevant functions.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ScaleNPCDamage","parent":"GM","type":"hook","description":{"text":"Called when an NPC takes damage.","note":"This hook is called only when a specific hit group of the NPC is hit. In cases where the hitgroup doesn't matter, you should use GM:EntityTakeDamage instead!"},"realm":"Server","args":{"arg":[{"text":"The NPC that takes damage","name":"npc","type":"NPC"},{"text":"The hitgroup (hitbox) enum where the NPC took damage. See Enums/HITGROUP","name":"hitgroup","type":"number"},{"text":"Damage info","name":"dmginfo","type":"CTakeDamageInfo"}]}},"example":[{"description":"Double the damage whenever an NPC is hurt.","code":"hook.Add( \"ScaleNPCDamage\", \"ScaleNPCDamageExample\", function( npc, hitgroup, dmginfo )\n\tdmginfo:ScaleDamage( 2 )\nend )"},{"description":"Mimic Half-Life 2 behaviour, in the context of a gamemode.\n\nRunning this code from an addon is not advised, as you'd have to stop all other hooks from running, potentially breaking other addons or the gamemode, \nor be applying the damage on top of the gamemode's scaling, resulting in unwanted issues like 4x or 6x headshot damage in Sandbox.","code":"function GetNPCDamageMultiplier( npc, iHitGroup, dmginfo )\n\n\tif ( iHitGroup == HITGROUP_GEAR ) then\n\t\t-- HL2 also sets the hitgroup to GENERIC here, but we cannot\n\t\treturn 0.01\n\telseif ( iHitGroup == HITGROUP_HEAD ) then\n\t\t-- Some NPCs have unique behaviors\n\t\tif ( npc:GetClass() == \"npc_combine_s\" ) then\n\t\t\treturn 2\n\t\telseif ( npc:GetClass() == \"npc_zombie\" || npc:GetClass() == \"npc_zombine\" || npc:GetClass() == \"npc_fastzombie\" ||\n\t\t\t\tnpc:GetClass() == \"npc_poisonzombie\" || npc:GetClass() == \"npc_zombie_torso\" || npc:GetClass() == \"npc_fastzombie_torso\" ) then\n\t\t\tif ( bit.band( dmginfo:GetDamageType(), DMG_BUCKSHOT ) != 0 ) then\n\t\t\t\tif ( IsValid( dmginfo:GetAttacker() ) ) then\n\t\t\t\t\tlocal flDist = ( npc:GetPos() - dmginfo:GetAttacker():GetPos() ):Length()\n\n\t\t\t\t\tif ( flDist <= 96 ) then\n\t\t\t\t\t\treturn 3\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\treturn 2\n\t\t\tend\n\t\tend\n\n\t\treturn GetConVarNumber( \"sk_npc_head\" )\n\telseif ( iHitGroup == HITGROUP_CHEST ) then\n\t\treturn GetConVarNumber( \"sk_npc_chest\" )\n\telseif ( iHitGroup == HITGROUP_STOMACH ) then\n\t\treturn GetConVarNumber( \"sk_npc_stomach\" )\n\telseif ( iHitGroup == HITGROUP_LEFTARM || iHitGroup == HITGROUP_RIGHTARM ) then\n\t\treturn GetConVarNumber( \"sk_npc_arm\" )\n\telseif ( iHitGroup == HITGROUP_LEFTLEG || iHitGroup == HITGROUP_RIGHTLEG ) then\n\t\treturn GetConVarNumber( \"sk_npc_leg\" )\n\tend\n\n\t-- No change in damage\n\t--return 1\n\nend\n\nfunction GM:ScaleNPCDamage( npc, hitgroup, dmginfo )\n\n\tlocal damageScale = GetNPCDamageMultiplier( npc, hitgroup, dmginfo )\n\tif ( damageScale ) then\n\t\tdmginfo:ScaleDamage( damageScale )\n\tend\n\nend"}],"realms":["Server"],"type":"Function"},
{"function":{"name":"ScalePlayerDamage","parent":"GM","type":"hook","description":{"text":"This hook allows you to change how much damage a player receives when one takes damage to a specific body part.","note":"This is called only for bullet damage a player receives, you should use GM:EntityTakeDamage instead if you need to detect **ALL** damage."},"realm":"Shared","args":{"arg":[{"text":"The player taking damage.","name":"ply","type":"Player"},{"text":"The hitgroup where the player took damage. See Enums/HITGROUP","name":"hitgroup","type":"number"},{"text":"The damage info.","name":"dmginfo","type":"CTakeDamageInfo"}]},"rets":{"ret":{"text":"Return true to prevent damage that this hook is called for, stop blood particle effects and blood decals.\n\nIt is possible to return true only on client ( This will work **only in multiplayer** ) to stop the effects but still take damage.","name":"","type":"boolean"}}},"example":{"description":"Makes the player take twice as much damage when shot in the head, and only half damage when shot in the limbs.","code":"function GM:ScalePlayerDamage( ply, hitgroup, dmginfo )\n\t if ( hitgroup == HITGROUP_HEAD ) then\n\t\tdmginfo:ScaleDamage( 2 ) // More damage when we're shot in the head\n \t else\n\t\tdmginfo:ScaleDamage( 0.50 )  // Less damage when shot anywhere else\n\t end\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ScoreboardHide","parent":"GM","type":"hook","description":{"text":"Called when player released the scoreboard button ( by default).","key":"TAB"},"realm":"Client"},"example":{"code":"hook.Add( \"ScoreboardHide\", \"Scoreboard_Close\", function()\n\t-- Use something like Base:Remove or DFrame:Close\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"ScoreboardShow","parent":"GM","type":"hook","description":{"text":"Called when player presses the scoreboard button ( by default).","key":"TAB"},"realm":"Client","rets":{"ret":{"text":"Return true to prevent default scoreboard from showing.","name":"","type":"boolean"}}},"example":{"code":"hook.Add( \"ScoreboardShow\", \"Scoreboard_Open\", function()\n    -- You would use something like DFrame or HUDPaint\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SendDeathNotice","parent":"GM","type":"hook","description":"An internal function used to send a death notice event to all clients.","realm":"Server","added":"2023.09.01","args":{"arg":[{"text":"The entity that caused the death.","name":"attacker","type":"Entity|string|nil"},{"text":"The attacker's weapon class name or the attacker itself if no weapon was equipped.","name":"inflictor","type":"string"},{"text":"The entity that died.","name":"victim","type":"Entity|string"},{"text":"Death notice flags. 1 = Friendly victim (to the player), 2 = friendly attacker (to the player)","name":"flags","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetPlayerSpeed","parent":"GM","type":"hook","description":{"text":"Sets player run and sprint speeds.","bug":{"text":"Using a speed of `0` can lead to prediction errors, and can cause players to move at `sv_maxvelocity`","issue":"2030"},"warning":"This is not a hook. Treat this as a utility function to set the player's speed."},"realm":"Shared","args":{"arg":[{"text":"The player to set the speed of.","name":"ply","type":"Player"},{"text":"The walk speed.","name":"walkSpeed","type":"number"},{"text":"The run speed.","name":"runSpeed","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetupMove","parent":"GM","type":"hook","description":"SetupMove is called before the engine process movements. This allows us to override the players movement.\n\nSee Game Movement for an explanation on the move system.","file":{"text":"gamemodes/base/gamemode/shared.lua","line":"179-L184"},"realm":"Shared","predicted":"Yes","args":{"arg":[{"text":"The player whose movement we are about to process","name":"ply","type":"Player"},{"text":"The move data to override/use","name":"mv","type":"CMoveData"},{"text":"The command data","name":"cmd","type":"CUserCmd"}]}},"example":[{"description":"Make drowning even more entertaining:","code":"hook.Add( \"SetupMove\", \"Drowning:HandleWaterInLungs\", function( ply, mv, cmd )\n\tif ( ply:WaterLevel() >= 2 ) then\n\t\tmv:SetUpSpeed( -100 )\n\t\tcmd:SetUpMove( -100 )\n\tend\nend )"},{"description":"Disable the player's ability to jump by removing a key from CMoveData:","code":"local CMoveData = FindMetaTable( \"CMoveData\" )\n\nfunction CMoveData:RemoveKeys( keys )\n\t-- Using bitwise operations to clear the key bits.\n\tlocal newbuttons = bit.band( self:GetButtons(), bit.bnot( keys ) )\n\tself:SetButtons( newbuttons )\nend\n\nhook.Add(\"SetupMove\", \"Disable Jumping\", function(ply, mvd, cmd)\n\tif ( mvd:KeyDown( IN_JUMP ) ) then\n\t\tmvd:RemoveKeys( IN_JUMP )\n\tend\nend)"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetupPlayerVisibility","parent":"GM","type":"hook","description":"Allows you to add extra positions to the player's [PVS (Potential Visibility Set)](https://developer.valvesoftware.com/wiki/PVS \"PVS - Valve Developer Community\"). This is the place to call Global.AddOriginToPVS.","realm":"Server","args":{"arg":[{"text":"The player","name":"ply","type":"Player"},{"text":"Players Player:GetViewEntity","name":"viewEntity","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetupSkyboxFog","parent":"GM","type":"hook","description":"Allows you to use render.Fog* functions to manipulate skybox fog.\n\t\tThis will not be called for maps with no 3D skybox, or when the 3d skybox is disabled. (`r_3dsky 0`)","realm":"Client","args":{"arg":{"text":"The scale of 3D skybox","name":"scale","type":"number"}},"rets":{"ret":{"text":"Return true to tell the engine that fog is set up","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetupWorldFog","parent":"GM","type":"hook","description":"Allows you to use render.Fog* functions to manipulate world fog.","realm":"Client","rets":{"ret":{"text":"Return true to tell the engine that fog is set up","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ShouldCollide","parent":"GM","type":"hook","description":{"text":"Called to decide whether a pair of entities should collide with each other. This is only called if Entity:SetCustomCollisionCheck was used on one or both entities.\n\nWhere applicable, consider using constraint.NoCollide or a [logic_collision_pair](https://developer.valvesoftware.com/wiki/Logic_collision_pair) entity instead - they are considerably easier to use and may be more appropriate in some situations.","warning":"This hook **must** return the same value consistently for the same pair of entities.  \n\tIf an entity changed in such a way that its collision rules change, you **must** call Entity:CollisionRulesChanged on that entity immediately - **not in this hook and not in physics callbacks.**  \n\tAs long as you religiously follow the rules set by the examples this hook will work reliably without breaking, even a small mistake might break physics.","bug":{"text":"This hook can cause all physics to break under certain conditions.","issue":"642"}},"realm":"Shared","predicted":"Yes","args":{"arg":[{"text":"The first entity in the collision poll.","name":"ent1","type":"Entity"},{"text":"The second entity in the collision poll.","name":"ent2","type":"Entity"}]},"rets":{"ret":{"text":"Whether the entities should collide.","name":"","type":"boolean"}}},"example":[{"description":"A simple example where players do not collide with eachother.","code":"hook.Add( \"ShouldCollide\", \"CustomCollisions\", function( ent1, ent2 )\n\t-- If both entities are players then disable collisions!\n\tif ( ent1:IsPlayer() and ent2:IsPlayer() ) then return false end\nend )"},{"description":"As a best practice it is reccommended to use cached values for this hook as much as possible, calculating anything inside of this hook itself is both extremely expensive and runs the risk of not having called Entity:CollisionRulesChanged for a change in return value of the same entity pair.","code":"hook.Add( \"PlayerInitialSpawn\", \"SetCustomCollisions\", function( ply )\n\tply:SetCustomCollisionCheck( true )\nend )\n\n-- Bad bad bad!!!!!\n-- There is no guarenteed way to know beforehand a players health will decrease,\n-- by the time a change in Source Engine has gone down to the Lua API its likely already too late for beating ShouldCollide.\nhook.Add( \"ShouldCollide\", \"CustomCollisions\", function( ent1, ent2 )\n\t-- If the entities are players and they are both under 50 health then disable collisions!\n\tif ( ent1:IsPlayer() and ent2:IsPlayer() ) and ( ent1:Health() < 50 and ent2:Health() < 50 ) then return false end\nend )\n\n\n-- Good!!!!\n-- We check a custom variable we set on players when they should be considered low health enough to not have collisions,\n-- we have full control over this and can call CollisionRulesChanged at the right moment.\n\n-- Make sure this is in shared code otherwise we get spongy physics!\nhook.Add( \"ShouldCollide\", \"CustomCollisions\", function( ent1, ent2 )\n\t-- If the entities are in low health mode then disable collisions!\n\tif ( ent1:IsPlayer() and ent2:IsPlayer() ) and ( ent1:GetLowHealthMode() and ent2:GetLowHealthMode() ) then return false end\nend )\n\n\n-- Make sure the code below runs before adding the hook though, dont wanna create any errors!\n\n-- Create a name for our DT var, players do not support SetupDataTables so we have to do it manually.\nDT_PLAYER_BOOL_LOWHEALTHMODE = 0\n\nlocal meta = FindMetaTable( \"Player\" )\nfunction meta:GetLowHealthMode()\n\treturn self:GetDTBool( DT_PLAYER_BOOL_LOWHEALTHMODE )\nend\n\nfunction meta:SetLowHealthMode( enabled )\n\tself:SetDTBool( DT_PLAYER_BOOL_LOWHEALTHMODE, enabled )\n\n\t-- We changed something to collisions, we have to call CollisionRulesChanged now!\n\tself:CollisionRulesChanged()\nend\n\n-- We can now call SetLowHealthMode on our players without breaking physics!"},{"description":"The conditions that control a ShouldCollide return should always be setup before calling Entity:SetCustomCollisionCheck, not doing so will result in physics breaking from uninitialised values being different for a couple frames affecting the return value.","code":"hook.Add( \"ShouldCollide\", \"CustomCollisions\", function( ent1, ent2 )\n\t-- Dont collide with anything if the entity requests it\n\tif ( ent1.DontCollideWithAnything or ent2.DontCollideWithAnything ) then return false end\nend )\n\n\n-- Below is the Initialize function of an entity which is where you make this mistake most of the time.\n\n-- Bad! as soon as we call SetCustomCollisionCheck its gonna run, it will get this as nil for a couple frames which is intepreted as false in our ShouldCollide\n-- This will therefore be inconsistent and break physics.\nfunction ENT:Initialize()\n\tself:SetCustomCollisionCheck( true )\n\tself.DontCollideWithAnything = true\nend\n\n-- Good! we setup our variables first and then enable SetCustomCollisionCheck\nfunction ENT:Initialize()\n\tself.DontCollideWithAnything = true\n\tself:SetCustomCollisionCheck( true )\nend"},{"description":"You should always return the same value for a pair of entities, so you have to check them the same way regardless of the order of arguments","code":"-- Bad! we only check the variable on ent1, if it ever appears as ent2 then our physics will break because we arent being consistent!\nhook.Add( \"ShouldCollide\", \"CustomCollisions\", function( ent1, ent2 )\n    -- Dont collide with anything if the entity requests it\n    if ( ent1.DontCollideWithAnything ) then return false end\nend )\n\n-- Good! we check things regardless of the order they appear as!\nhook.Add( \"ShouldCollide\", \"CustomCollisions\", function( ent1, ent2 )\n    -- Dont collide with anything if the entity requests it\n    if ( ent1.DontCollideWithAnything or ent2.DontCollideWithAnything ) then return false end\nend )"},{"description":"Avoid adding this hook more than once, it is extremely expensive to run. Instead you can use an inverse pattern where you give entities a function to disable collisions instead when needed, this will prevent having to add many hooks.","code":"-- Make Entity:ShouldNotCollide checks to prevent having to add a lot of hooks that will grind your server to a halt.\n-- This is assigned as the GM variant to ensure this is your only source of truth.\nfunction GM:ShouldCollide( enta, entb )\n\n    local snca = enta.ShouldNotCollide\n    if snca and snca( enta, entb ) then return ( false ) end\n\n    local sncb = entb.ShouldNotCollide\n    if sncb and sncb( entb, enta ) then return ( false ) end\n\n    return ( true )\nend\n\n\n-- This can now be used in entity files, player metatable or the entity metatable to define when collisions should be disabled.\n-- The conditions used here should be changed from code outside of it, meaning that the same restrictions of ShouldCollide also apply here,\n-- when you change something that affects the return value immediatelly call CollisionRulesChanged afterwards, not inside of this function.\n\nfunction ENT:Initialize()\n\tself:SetCustomCollisionCheck( true )\nend\n\nfunction ENT:ShouldNotCollide( ent )\n    -- Dont collide with func_breakable\n    return ent:GetClass() == \"func_breakable\"\nend"},{"description":"If you want to use a players Team as a variable inside this hook you will have to keep in mind that you will have to call Entity:CollisionRulesChanged immediately after team changes.","code":"-- We now use ChangeTeam instead of Player:SetTeam/GM:PlayerJoinTeam so that we have control over team changing as we have to instantly call CollisionRulesChanged,\n-- and not as the result of a hook as that is likely too late to beat ShouldCollide.\nlocal meta = FindMetaTable( \"Player\" )\nfunction meta:ChangeTeam( teamid )\n\tlocal oldteam = self:Team()\n\tself:SetTeam( teamid )\n\tself:CollisionRulesChanged()\n\tif oldteam ~= teamid then\n\t\tgamemode.Call( \"OnPlayerChangedTeam\", self, oldteam, teamid )\n\tend\nend\n\nhook.Add( \"ShouldCollide\", \"CustomCollisions\", function( ent1, ent2 )\n    -- Dont collide if players team is the same\n    if ( ent1:IsPlayer() and ent2:IsPlayer() ) and ( ent1:Team() == ent2:Team() ) then return false end\nend )\n\nhook.Add( \"PlayerInitialSpawn\", \"SetCustomCollisions\", function( ply )\n\tply:SetCustomCollisionCheck( true )\nend )"},{"description":"This hook can also be used to create custom Collision Groups, as long as the conditions of it are not expected to change this is quite a safe way to use the hook. This is especially powerful if used in a custom entity base.","code":"-- Use ShouldNotCollide again for this example, this should be in a shared file not related to the specific entity.\nhook.Add( \"PlayerInitialSpawn\", \"SetCustomCollisions\", function( ply )\n\tply:SetCustomCollisionCheck( true )\nend )\n\nfunction GM:ShouldCollide( enta, entb )\n    local snca = enta.ShouldNotCollide\n    if snca and snca( enta, entb ) then return ( false ) end\n\n    local sncb = entb.ShouldNotCollide\n    if sncb and sncb( entb, enta ) then return ( false ) end\n\n    return ( true )\nend\n\n\n-- Create some new ENUM's of our custom collision types, these should be globals in a shared file.\nMY_CUSTOM_COLLISIONS_PROJECTILES = 0\nMY_CUSTOM_COLLISIONS_PLAYERS = 1\n\n\n-- Custom collision functions, this is where the actual Entity file begins, these are also all shared.\nlocal M_Player = FindMetaTable( \"Player\" )\nlocal function ShouldNotCollide_NoCollidesWithProjectiles( thisent, ent )\n\treturn getmetatable( ent ) == M_Player and ent:IsMyCustomProjectile()\nend\n\nlocal function ShouldNotCollide_NoCollidesWithPlayers( thisent, ent )\n\treturn getmetatable( ent ) == M_Player\nend\n\nlocal collisionFunctionByType = {\n\t[ MY_CUSTOM_COLLISIONS_PROJECTILES ] = ShouldNotCollide_NoCollidesWithProjectiles,\n\t[ MY_CUSTOM_COLLISIONS_PLAYERS ] = ShouldNotCollide_NoCollidesWithPlayers\n}\n\n-- Setting one of them as an example\nENT.CustomCollisionGroup = MY_CUSTOM_COLLISIONS_PLAYERS\n\n-- Actual application of the function, this should be the very first thing you do in Initialize.\nfunction ENT:Initialize()\n\tself.ShouldNotCollide = collisionFunctionByType[ self.CustomCollisionGroup ]\n\tself:SetCustomCollisionCheck( true )\nend"},{"description":"This hook should only be added BEFORE any entity affected by it exists, this ussually means you should create it during the loading phase of a server. Dynamically adding and removing them is asking for trouble.","code":"-- Bad! adding and removing these hooks randomly will very likely lead to a physics crash, entities should be loyal to this hook for their entire lifetime!\n-- Add the ShouldCollide rule after 10 minutes\ntimer.Simple( 10 * 60, function()\n    hook.Add( \"ShouldCollide\", \"CustomCollisions\", function( ent1, ent2 )\n        if ( ent1:IsPlayer() and ent2:IsPlayer() ) then return false end\n    end )\nend )\n\n-- Remove it after 20 minutes\ntimer.Simple( 20 * 60, function()\n    hook.Remove( \"ShouldCollide\", \"CustomCollisions\" )\nend )\n\n\n\n-- Good! The hook exists forever, no unexpected changes.\nhook.Add( \"ShouldCollide\", \"CustomCollisions\", function( ent1, ent2 )\n    if ( ent1:IsPlayer() and ent2:IsPlayer() ) then return false end\nend )"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ShouldDrawLocalPlayer","parent":"GM","type":"hook","description":{"text":"Called to determine if the Global.LocalPlayer should be drawn.\n\nIf you're using this hook to draw a player for a GM:CalcView hook, then you may want to consider using the `drawviewer` variable you can use in your Structures/CamData table instead.","note":"This hook has an internal cache that is reset at the start of every frame. This will prevent this hook from running in certain cases. This cache is reset in cam.Start and in a future update in render.RenderView when rendering extra views."},"realm":"Client","file":{"text":"gamemodes/base/gamemode/cl_init.lua","line":"406-L410"},"args":{"arg":{"text":"The player.","name":"ply","type":"Player"}},"rets":{"ret":{"text":"`true` to draw the player, `false` to hide.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ShowHelp","parent":"GM","type":"hook","description":{"text":"Called when a player executes `gm_showhelp` console command. (Default bind is )","key":"F1"},"realm":"Shared","args":{"arg":{"text":"Player who executed the command","name":"ply","type":"Player"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ShowSpare1","parent":"GM","type":"hook","description":{"text":"Called when a player executes `gm_showspare1` console command ( Default bind is  ).","key":"F3"},"realm":"Shared","args":{"arg":{"text":"Player who executed the command.","name":"ply","type":"Player"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ShowSpare2","parent":"GM","type":"hook","description":{"text":"Called when a player executes `gm_showspare2` console command ( Default bind is  ).","key":"F4"},"realm":"Shared","args":{"arg":{"text":"Player who executed the command.","name":"ply","type":"Player"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ShowTeam","parent":"GM","type":"hook","description":{"text":"Called when a player executes `gm_showteam` console command. ( Default bind is  )","key":"F2"},"realm":"Shared","args":{"arg":{"text":"Player who executed the command","name":"ply","type":"Player"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ShutDown","parent":"GM","type":"hook","description":"Called whenever the Lua environment is about to be shut down, for example on map change, or when the server is going to shut down.","realm":"Shared"},"example":{"description":"Prints into the players chat: `Server Is Restarting.`.","code":"hook.Add( \"ShutDown\", \"ServerShuttingDown\", function()\n    Entity( 1 ):PrintMessage( HUD_PRINTTALK, \"Server Is Restarting.\" )\nend )","output":"Server Is Restarting. When then the server is Shutting down, etc."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SpawniconGenerated","parent":"GM","type":"hook","description":"Called when spawn icon is generated.","realm":"Client","args":{"arg":[{"text":"File path of previously generated model.","name":"lastmodel","type":"string"},{"text":"File path of the generated icon.","name":"imagename","type":"string"},{"text":"Amount of models left to generate.","name":"modelsleft","type":"number"}]}},"example":{"description":"That's how it is used in **garrysmod/lua/includes/gui/icon_progress.lua** for show progress of generating icons","code":"local g_Progress = nil\n\nhook.Add( \"SpawniconGenerated\", \"SpawniconGenerated\", function( lastmodel, imagename, modelsleft )\n\n\tif ( !IsValid( g_Progress ) ) then\n\t\n\t\tg_Progress = vgui.Create( \"DPanel\" )\n\t\tg_Progress:SetSize( 64+10, 64+10+20 )\n\t\tg_Progress:SetBackgroundColor( Color( 0, 0, 0, 100 ) )\n\t\tg_Progress:SetDrawOnTop( true )\n\t\tg_Progress:DockPadding( 5, 0, 5, 5 )\n\t\tg_Progress.Think = function()\n\t\t\n\t\t\tif ( SysTime() - g_Progress.LastTouch < 3 ) then return end\n\t\t\t\n\t\t\tg_Progress:Remove()\n\t\t\tg_Progress.LastTouch = SysTime()\n\t\t\n\t\tend\n\t\t\n\n\t\t\n\t\tlocal label = g_Progress:Add( \"DLabel\" )\n\t\tlabel:Dock( BOTTOM )\n\t\tlabel:SetText( \"remaining\" )\n\t\tlabel:SetTextColor( Color( 255, 255, 255, 255 ) )\n\t\tlabel:SetExpensiveShadow( 1, Color( 0, 0, 0, 200 ) )\n\t\tlabel:SetContentAlignment( 5 )\n\t\tlabel:SetHeight( 14 )\n\t\tlabel:SetFont( \"DefaultSmall\" )\n\t\t\n\t\tg_Progress.Label = g_Progress:Add( \"DLabel\" )\n\t\tg_Progress.Label:Dock( BOTTOM )\n\t\tg_Progress.Label:SetTextColor( Color( 255, 255, 255, 255 ) )\n\t\tg_Progress.Label:SetExpensiveShadow( 1, Color( 0, 0, 0, 200 ) )\n\t\tg_Progress.Label:SetContentAlignment( 5 )\n\t\tg_Progress.Label:SetFont( \"DermaDefaultBold\" )\n\t\tg_Progress.Label:SetHeight( 14 )\n\t\t\n\t\tg_Progress.icon = vgui.Create( \"DImage\", g_Progress )\n\t\tg_Progress.icon:SetSize( 64, 64 )\n\t\tg_Progress.icon:Dock( TOP )\n\t\n\tend\n\t\n\tg_Progress.LastTouch = SysTime()\n\t\n\timagename = imagename:Replace( \"materials\\\\\", \"\" )\n\timagename = imagename:Replace( \"materials/\", \"\" )\n\t\t\n\tg_Progress.icon:SetImage( imagename )\n\t\t\n\tg_Progress:AlignRight( 10 )\n\tg_Progress:AlignBottom( 10 )\n\t\n\tg_Progress.Label:SetText( modelsleft )\n\nend )","output":{"image":{"src":"spawnicon_progress.png"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SpawnMenuCreated","parent":"GM","type":"hook","description":"Called when the Spawnmenu is Created.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/spawnmenu.lua","line":"247"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"StartChat","parent":"GM","type":"hook","description":{"text":"Runs when the user tries to open the chat box.","warning":"Returning `true` won't stop the chatbox from taking VGUI focus. chat.Close may be of use to mitigate that, or usage of GM:PlayerBindPress."},"realm":"Client","args":{"arg":{"text":"Whether the message was sent through team chat.","name":"isTeamChat","type":"boolean"}},"rets":{"ret":{"text":"Return true to hide the default chat box.","name":"","type":"boolean"}}},"example":{"code":"hook.Add( \"StartChat\", \"HasStartedTyping\", function( isTeamChat )\n\tif ( isTeamChat ) then\n\t\tprint( \"Player started typing a message in teamchat.\" )\n\telse\n\t\tprint( \"Player started typing a message.\" )\n\tend\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"StartCommand","parent":"GM","type":"hook","description":{"text":"Allows you to change the players inputs before they are processed by the server. This function is also called for bots, making it the best solution to control them.\n\nThis is basically a shared version of GM:CreateMove.","note":"This hook is predicted, but not by usual means, it is called when a CUserCmd is generated on the client, and on the server when it is received, so it is necessary for this hook to be called clientside even on singleplayer"},"predicted":"Yes","realm":"Shared","args":{"arg":[{"text":"The player","name":"ply","type":"Player"},{"text":"The usercommand","name":"ucmd","type":"CUserCmd"}]}},"example":{"description":"Example of how you'd control a bot using this hook.\n\nThe example causes all bots to go kill any players they can get to with crowbars.","code":"hook.Add( \"StartCommand\", \"StartCommandExample\", function( ply, cmd )\n\n\t-- If the player is not a bot or the bot is dead, do not do anything\n\t-- TODO: Maybe spawn the bot manually here if the bot is dead\n\tif ( !ply:IsBot() or !ply:Alive() ) then return end\n\n\t-- Clear any default movement or actions\n\tcmd:ClearMovement() \n\tcmd:ClearButtons()\n\n\t-- Bot has no enemy, try to find one\n\tif ( !IsValid( ply.CustomEnemy ) ) then\n\t\t-- Scan through all players and select one not dead\n\t\tfor id, pl in ipairs( player.GetAll() ) do\n\t\t\tif ( !pl:Alive() or pl == ply ) then continue end -- Don't select dead players or self as enemies \n\t\t\tply.CustomEnemy = pl\n\t\tend\n\t\t-- TODO: Maybe add a Line Of Sight check so bots won't walk into walls to try to get to their target\n\t\t-- Or add path finding so bots can find their way to enemies\n\tend\n\n\t-- We failed to find an enemy, don't do anything\n\tif ( !IsValid( ply.CustomEnemy ) ) then return end\n\n\t-- Move forwards at the bots normal walking speed\n\tcmd:SetForwardMove( ply:GetWalkSpeed() )\n\n\t-- Aim at our enemy\n\tif ( ply.CustomEnemy:IsPlayer() ) then\n\t\tcmd:SetViewAngles( ( ply.CustomEnemy:GetShootPos() - ply:GetShootPos() ):GetNormalized():Angle() )\n\t\tply:SetEyeAngles( ( ply.CustomEnemy:GetShootPos() - ply:GetShootPos() ):GetNormalized():Angle() )\n\telse\n\t\tcmd:SetViewAngles( ( ply.CustomEnemy:GetPos() - ply:GetShootPos() ):GetNormalized():Angle() )\n\t\tply:SetEyeAngles( ( ply.CustomEnemy:GetPos() - ply:GetShootPos() ):GetNormalized():Angle() )\n\tend\n\n\t-- Give the bot a crowbar if the bot doesn't have one yet\n\tif ( SERVER and !ply:HasWeapon( \"weapon_crowbar\" ) ) then ply:Give( \"weapon_crowbar\" ) end\n\n\t-- Select the crowbar\n\tcmd:SelectWeapon( ply:GetWeapon( \"weapon_crowbar\" ) )\n\n\t-- Hold Mouse 1 to cause the bot to attack\n\tcmd:SetButtons( IN_ATTACK )\n\n\t-- Enemy is dead, clear our enemy so that we may acquire a new one\n\tif ( !ply.CustomEnemy:Alive() ) then\n\t\tply.CustomEnemy = nil\n\tend\n\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"StartEntityDriving","parent":"GM","type":"hook","description":"Called right before an entity starts driving. Overriding this hook will cause it to not call drive.Start and the player will not begin driving the entity.","realm":"Shared","args":{"arg":[{"text":"The entity that is going to be driven","name":"ent","type":"Entity"},{"text":"The player that is going to drive the entity","name":"ply","type":"Player"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"StartGame","parent":"GM","type":"hook","description":"Called when you start a new game via the menu.","realm":"Menu","file":{"text":"html/js/menu/control.NewGame.js","line":"174"}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"Think","parent":"GM","type":"hook","description":{"text":"Called every rendered frame on client, except when the game is paused.\n\nCalled every game tick on the server. This will be the same as GM:Tick on the server when there is no lag, but will only be called once every processed server frame during lag.\nGlobal.CurTime is guaranteed to be different with each call to this hook on the server.\n\nSee GM:Tick for a hook that runs every tick on both the client and server.","note":"On server, this hook **WILL NOT** run if the server is empty, unless you set the ConVar `sv_hibernate_think` to `1`."},"realm":"Shared and Menu"},"example":{"code":"hook.Add( \"Think\", \"MyCoolThinkFunction\", function()\n\t-- Do something every frame/tick\nend )"},"realms":["Server","Client","Menu"],"type":"Function"},
{"function":{"name":"Tick","parent":"GM","type":"hook","description":{"text":"Called every game tick. engine.TickCount is guaranteed to be different between each call.\n\nServer side, this is similar to GM:Think (See that page for details). \n\nThe default tickrate is `66.6666` (15 millisecond intervals). It can be changed via the `-tickrate` [command line option](Command_Line_Parameters).  \nSee engine.TickInterval for a function to retrieve this data at runtime.","note":"This hook **WILL NOT** run if the server is empty, unless you set the ConVar `sv_hibernate_think` to 1"},"realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"TranslateActivity","parent":"GM","type":"hook","description":{"text":"Allows you to translate player activities.","note":"Isn't called when CalcMainActivity returns a valid override sequence id"},"realm":"Shared","args":{"arg":[{"text":"The player","name":"ply","type":"Player"},{"text":"The activity. See Enums/ACT","name":"act","type":"number"}]},"rets":{"ret":{"text":"The new, translated activity","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"UpdateAnimation","parent":"GM","type":"hook","description":"Animation updates (pose params etc) should be done here.","realm":"Shared","args":{"arg":[{"text":"The player to update the animation info for.","name":"ply","type":"Player"},{"text":"The player's velocity.","name":"velocity","type":"Vector"},{"text":"Speed of the animation - used for playback rate scaling.","name":"maxSeqGroundSpeed","type":"number"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"VariableEdited","parent":"GM","type":"hook","description":{"text":"Called when a variable is edited on an Entity (called by Edit Properties... menu). See Editable Entities for more information.","warning":"This hook is called to change a variable and not after a variable was changed"},"realm":"Server","args":{"arg":[{"text":"The entity being edited","name":"ent","type":"Entity"},{"text":"The player doing the editing","name":"ply","type":"Player"},{"text":"The name of the variable","name":"key","type":"string"},{"text":"The new value, as a string which will later be converted to its appropriate type","name":"val","type":"string"},{"text":"The edit table defined in Entity:NetworkVar","name":"editor","type":"table"}]}},"example":{"description":"From base/gamemode/variable_edit.lua","code":"function GM:VariableEdited( ent, ply, key, val, editor )\n    if ( !IsValid( ent ) ) then return end\n    if ( !IsValid( ply ) ) then return end\n    local CanEdit = hook.Run( \"CanEditVariable\", ent, ply, key, val, editor )\n    if ( !CanEdit ) then return end\n    ent:EditValue( key, val )\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"VehicleMove","parent":"GM","type":"hook","description":"Called when you are driving a vehicle. This hook works just like GM:Move.\n\nThis hook is called before GM:Move and will be called when GM:PlayerTick is not.","realm":"Shared","predicted":"Yes","args":{"arg":[{"text":"Player who is driving the vehicle","name":"ply","type":"Player"},{"text":"The vehicle being driven","name":"veh","type":"Vehicle"},{"text":"Move data","name":"mv","type":"CMoveData"}]}},"example":{"description":"Disables the base gamemode's 3rd person vehicle camera option.","code":"hook.Add( \"VehicleMove\", \"DisableVehicle3rdPerson\", function( ply, vehicle, mv )\n\tif ( mv:KeyPressed( IN_DUCK ) && vehicle.SetThirdPersonMode ) then\n\t\tvehicle:SetThirdPersonMode( false )\n\t\treturn true -- Block the GM:VehicleMove which sets the 3rd person mode\n\tend\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"VGUIMousePressAllowed","parent":"GM","type":"hook","description":"Called when user clicks on a VGUI panel.","realm":"Client","args":{"arg":{"text":"The button that was pressed, see Enums/MOUSE","name":"button","type":"number"}},"rets":{"ret":{"text":"Return true if the mouse click should be ignored or not.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"VGUIMousePressed","parent":"GM","type":"hook","description":"Called when a mouse button is pressed on a VGUI element or menu.","realm":"Client and Menu","file":{"text":"lua/derma/derma_menus.lua","line":"71"},"args":{"arg":[{"text":"Panel that currently has focus.","name":"pnl","type":"Panel"},{"text":"The key that the player pressed using Enums/MOUSE.","name":"mouseCode","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"WeaponEquip","parent":"GM","type":"hook","description":{"text":"Called as a weapon entity is picked up by a player. (Including Player:Give)\n\nContrary to the name of the hook, it is **not called** when the player switches their active weapon to another.\n\nSee also GM:PlayerDroppedWeapon and GM:PlayerCanPickupWeapon.","note":["At the time when this hook is called Entity:GetOwner will return `NULL`. The owner is set on the next frame.","This will not be called when picking up a weapon you already have as the weapon will be removed and WEAPON:EquipAmmo will be called instead."]},"realm":"Server","args":{"arg":[{"text":"The equipped weapon.","name":"weapon","type":"Weapon"},{"text":"The player that is picking up the weapon.","name":"owner","type":"Player"}]}},"example":{"description":"Drops the player's weapons as soon as they pick one up.","code":"hook.Add( \"WeaponEquip\", \"WeaponEquipExample\", function( weapon, ply )\n\ttimer.Simple( 0, function()\n\t\tply:DropWeapon( weapon )\n\tend )\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"WorkshopDownloadedFile","parent":"GM","type":"hook","description":"Called when an addon from the Steam workshop finishes downloading. Used by default to update details on the workshop downloading panel.","realm":"Menu","file":{"text":"lua/menu/mount/mount.lua","line":"32-38"},"args":{"arg":[{"text":"Workshop ID of addon.","name":"id","type":"number"},{"text":"Name of addon.","name":"title","type":"string"}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"WorkshopDownloadFile","parent":"GM","type":"hook","description":"Called when an addon from the Steam workshop begins downloading. Used by default to place details on the workshop downloading panel.","realm":"Menu","file":{"text":"lua/menu/mount/mount.lua","line":"21-30"},"args":{"arg":[{"text":"Workshop ID of addon.","name":"id","type":"number"},{"text":"ID of addon's preview image.\n\n\n\nFor example, for **Extended Spawnmenu** addon, the image URL is\n\n```\nhttp://cloud-4.steamusercontent.com/ugc/702859018846106764/9E7E1946296240314751192DA0AD15B6567FF92D/\n```\n\nSo, the value of this argument would be **702859018846106764**.","name":"imageID","type":"number"},{"text":"Name of addon.","name":"title","type":"string"},{"text":"File size of addon in bytes.","name":"size","type":"number"}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"WorkshopDownloadProgress","parent":"GM","type":"hook","description":"Called while an addon from the Steam workshop is downloading. Used by default to update details on the fancy workshop download panel.","realm":"Menu","file":{"text":"lua/menu/mount/mount.lua","line":"40-50"},"args":{"arg":[{"text":"Workshop ID of addon.","name":"id","type":"number"},{"text":"ID of addon's preview image.\n\n\n\nFor example, for **Extended Spawnmenu** addon, the image URL is\n\n```\nhttp://cloud-4.steamusercontent.com/ugc/702859018846106764/9E7E1946296240314751192DA0AD15B6567FF92D/\n```\n\nSo, the value of this argument would be **702859018846106764**.","name":"imageID","type":"number"},{"text":"Name of addon.","name":"title","type":"string"},{"text":"Current bytes of addon downloaded.","name":"downloaded","type":"number"},{"text":"Expected file size of addon in bytes.","name":"expected","type":"number"}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"WorkshopDownloadTotals","parent":"GM","type":"hook","description":"Called after GM:WorkshopStart.","realm":"Menu","file":{"text":"lua/menu/mount/mount.lua","line":"52-71"},"args":{"arg":[{"text":"Remaining addons to download","name":"remain","type":"number"},{"text":"Total addons needing to be downloaded","name":"total","type":"number"}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"WorkshopEnd","parent":"GM","type":"hook","description":"Called when downloading content from Steam workshop ends. Used by default to hide fancy workshop downloading panel.","realm":"Menu","file":{"text":"lua/menu/mount/mount.lua","line":"13-19"}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"WorkshopExtractProgress","parent":"GM","type":"hook","description":"Called while an addon from the Steam workshop is extracting. Used by default to update details on the fancy workshop download panel.","realm":"Menu","file":{"text":"lua/menu/mount/mount.lua","line":"52-62"},"args":{"arg":[{"text":"Workshop ID of addon.","name":"id","type":"number"},{"text":"ID of addon's preview image.\n\n\n\nFor example, for **Extended Spawnmenu** addon, the image URL is\n\n```\nhttp://cloud-4.steamusercontent.com/ugc/702859018846106764/9E7E1946296240314751192DA0AD15B6567FF92D/\n```\n\nSo, the value of this argument would be **702859018846106764**.","name":"ImageID","type":"number"},{"text":"Name of addon.","name":"title","type":"string"},{"text":"Current bytes of addon extracted.","name":"percent","type":"number"}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"WorkshopStart","parent":"GM","type":"hook","description":"Called when downloading content from Steam workshop begins. Used by default to show fancy workshop downloading panel.\n\nThe order of Workshop hooks is this:\n* WorkshopStart\n* WorkshopDownloadTotals\n* * These are called for each new item:\n* WorkshopDownloadFile\n* WorkshopDownloadProgress - This is called until the file is finished\n* WorkshopDownloadedFile\n* WorkshopEnd (this ones called once)","realm":"Menu","file":{"text":"lua/menu/mount/mount.lua","line":"5-11"}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"WorkshopSubscriptionsChanged","parent":"GM","type":"hook","description":"Called when UGC subscription status changes.","realm":"Menu"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"WorkshopSubscriptionsMessage","parent":"GM","type":"hook","description":{"text":"Called when a Workshop Message is received?. Currently, it seems like the message will be **#ugc.mounting** every time.","validate":"When does this exactly get called?. If an addon is subscribed, unsubscribed, error occurs or on any event?"},"realm":"Menu","file":{"text":"lua/menu/mount/mount.lua","line":"95-L103"},"args":{"arg":{"text":"The Message from the Workshop. Will be a phrase that needs to be translated.","name":"message","type":"string"}}},"example":{"description":"Translates the message and prints them.","code":"hook.Add( \"WorkshopSubscriptionsMessage\", \"Example\", function(msg)\n\tprint( language.GetPhrase(msg) )\nend )\n\nsteamworks.Subscribe( \"104514796\" ) -- Subscribes to a Random addon. \"Directional Gravity\"\nsteamworks.ApplyAddons()\n\ntimer.Simple(10, function()\n\tsteamworks.Unsubscribe( \"104514796\" ) --UnSubscribes the Random Addon. \"Directional Gravity\"\n\tsteamworks.ApplyAddons()\nend)","output":"```lua\nMounting Workshop content, please wait...\n\t[After 10 Seconds]\nMounting Workshop content, please wait...\n```"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"WorkshopSubscriptionsProgress","parent":"GM","type":"hook","description":{"text":"Called by the engine when the game initially fetches subscriptions to be displayed on the bottom of the main menu screen.","internal":""},"realm":"Menu","args":{"arg":[{"text":"Amount of subscribed addons that have info retrieved.","name":"num","type":"number"},{"text":"Total amount of subscribed addons that need their info retrieved.","name":"max","type":"number"}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"BehaveStart","parent":"NEXTBOT","type":"hook","description":{"text":"Called to initialize the behaviour.\n\n\t\tThis is called automatically when the NextBot is created, you should not call it manually.","note":"You shouldn't override this unless you know what you are doing - it's used to kick off the coroutine that runs the bot's behaviour. See NEXTBOT:RunBehaviour instead."},"realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_nextbot/sv_nextbot.lua","line":"2"}},"realms":["Server"],"type":"Function"},
{"function":{"name":"BehaveUpdate","parent":"NEXTBOT","type":"hook","description":"Called to update the bot's behaviour. \n\nIf you override this hook you must call `coroutine.resume(self.BehaveThread)` to resume the NEXTBOT:RunBehaviour Behavior","realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_nextbot/sv_nextbot.lua","line":"23"},"args":{"arg":{"text":"How long since the last update","name":"interval","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"BodyUpdate","parent":"NEXTBOT","type":"hook","description":"Called to update the bot's animation.","realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_nextbot/sv_nextbot.lua","line":"52"}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnContact","parent":"NEXTBOT","type":"hook","description":"Called when the nextbot touches another entity.","realm":"Server","args":{"arg":{"text":"The entity the nextbot came in contact with.","name":"ent","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnEntitySight","parent":"NEXTBOT","type":"hook","description":{"text":"Called when the nextbot NPC sees another Nextbot NPC or a Player.","note":"This hook will only run after NextBot:SetFOV or other vision related function is called on the nextbot. See NextBot:IsAbleToSee for more details."},"realm":"Server","added":"2020.08.12","args":{"arg":{"text":"the entity that was seen","name":"ent","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnEntitySightLost","parent":"NEXTBOT","type":"hook","description":{"text":"Called when the nextbot NPC loses sight of another Nextbot NPC or a Player.","note":"This hook will only run after NextBot:SetFOV or other vision related function is called on the nextbot. See NextBot:IsAbleToSee for more details."},"realm":"Server","added":"2020.08.12","args":{"arg":{"text":"the entity that we lost sight of","name":"ent","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnIgnite","parent":"NEXTBOT","type":"hook","description":"Called when the bot is ignited.","realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnInjured","parent":"NEXTBOT","type":"hook","description":"Called when the bot gets hurt. This is a good place to play hurt sounds or voice lines.","realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_nextbot/sv_nextbot.lua","line":"130"},"args":{"arg":{"text":"The damage info","name":"info","type":"CTakeDamageInfo"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnKilled","parent":"NEXTBOT","type":"hook","description":"Called when the bot gets killed.","realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_nextbot/sv_nextbot.lua","line":"140"},"args":{"arg":{"text":"The damage info","name":"info","type":"CTakeDamageInfo"}}},"example":[{"description":"Example of NPC becoming a ragdoll after death and sending death notification to everybodys killfeed.","code":"function ENT:OnKilled( dmginfo )\n\n\thook.Call( \"OnNPCKilled\", GAMEMODE, self, dmginfo:GetAttacker(), dmginfo:GetInflictor() )\n\n\tself:BecomeRagdoll( dmginfo )\n\nend"},{"description":"Removes the body after 5 seconds, to prevent having lots of bodies laying around after a while.","code":"function ENT:OnKilled( dmginfo )\n\t\n\thook.Call( \"OnNPCKilled\", GAMEMODE, self, dmginfo:GetAttacker(), dmginfo:GetInflictor() )\n\t\n\tlocal body = ents.Create( \"prop_ragdoll\" )\n\tbody:SetPos( self:GetPos() )\n\tbody:SetModel( self:GetModel() )\n\tbody:Spawn()\n\t\n\tself:Remove()\n\t\n\ttimer.Simple( 5, function()\n\t\n\t\tbody:Remove()\n\t\t\n\tend )\n\nend","output":"The body disappears after 5 seconds."}],"realms":["Server"],"type":"Function"},
{"function":{"name":"OnLandOnGround","parent":"NEXTBOT","type":"hook","description":"Called when the bot's feet return to the ground.","realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_nextbot/sv_nextbot.lua","line":"94"},"args":{"arg":{"text":"The entity the nextbot has landed on.","name":"ent","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnLeaveGround","parent":"NEXTBOT","type":"hook","description":"Called when the bot's feet leave the ground - for whatever reason.","realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_nextbot/sv_nextbot.lua","line":"82"},"args":{"arg":{"text":"The entity the bot \"jumped\" from.","name":"ent","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnNavAreaChanged","parent":"NEXTBOT","type":"hook","description":"Called when the nextbot enters a new navigation area.","realm":"Server","args":{"arg":[{"text":"The navigation area the bot just left","name":"old","type":"CNavArea"},{"text":"The navigation area the bot just entered","name":"new","type":"CNavArea"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnOtherKilled","parent":"NEXTBOT","type":"hook","description":"Called when someone else or something else has been killed.","realm":"Server","args":{"arg":[{"text":"The victim that was killed","name":"victim","type":"Entity"},{"text":"The damage info","name":"info","type":"CTakeDamageInfo"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnStuck","parent":"NEXTBOT","type":"hook","description":"Called when the bot thinks it is stuck.","realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_nextbot/sv_nextbot.lua","line":"106"}},"example":{"description":"Kills the bot when getting stuck, using a new damageinfo object.","code":"function ENT:OnStuck()\n\n\tlocal dmginfo = DamageInfo()\n\tdmginfo:SetAttacker( self )\n\n\tself:OnKilled( dmginfo )\n\t\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnTraceAttack","parent":"NEXTBOT","type":"hook","description":"Called when a trace attack is done against the nextbot, allowing override of the damage being dealt by altering the CTakeDamageInfo.\n\nThis is called before NEXTBOT:OnInjured.","realm":"Server","args":{"arg":[{"text":"The damage info","name":"info","type":"CTakeDamageInfo"},{"text":"The direction the damage goes in","name":"dir","type":"Vector"},{"text":"The Structures/TraceResult of the attack, containing the hitgroup.","name":"trace","type":"table"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnUnStuck","parent":"NEXTBOT","type":"hook","description":"Called when the bot thinks it is un-stuck.","realm":"Server","file":{"text":"gamemodes/base/entities/entities/base_nextbot/sv_nextbot.lua","line":"118"}},"realms":["Server"],"type":"Function"},
{"function":{"name":"RunBehaviour","parent":"NEXTBOT","type":"hook","description":"A hook called to process nextbot logic.\n\nThis hook runs in a coroutine by default. It will only be called if NEXTBOT:BehaveStart is not overriden.","realm":"Server"},"example":{"description":"Example usage of the hook to make NextBot logic from the Example NextBot NPC shipped with the game.","code":"function ENT:RunBehaviour()\n\n\twhile ( true ) do\n\n\t\t-- walk somewhere random\n\t\tself:StartActivity( ACT_WALK ) -- walk anims\n\t\tself.loco:SetDesiredSpeed( 100 ) -- walk speeds\n\t\tself:MoveToPos( self:GetPos() + Vector( math.Rand( -1, 1 ), math.Rand( -1, 1 ), 0 ) * 200 ) -- walk to a random place within about 200 units (yielding)\n\n\t\tself:StartActivity( ACT_IDLE ) -- revert to idle activity\n\n\t\tself:PlaySequenceAndWait( \"idle_to_sit_ground\" ) -- Sit on the floor\n\t\tself:SetSequence( \"sit_ground\" ) -- Stay sitting\n\t\tcoroutine.wait( self:PlayScene( \"scenes/eli_lab/mo_gowithalyx01.vcd\" ) ) -- play a scene and wait for it to finish before progressing\n\t\tself:PlaySequenceAndWait( \"sit_ground_to_idle\" ) -- Get up\n\n\t\t-- find the furthest away hiding spot\n\t\tlocal pos = self:FindSpot( \"random\", { type = 'hiding', radius = 5000 } )\n\n\t\t-- if the position is valid\n\t\tif ( pos ) then\n\t\t\tself:StartActivity( ACT_RUN ) -- run anim\n\t\t\tself.loco:SetDesiredSpeed( 200 ) -- run speed\n\t\t\tself:PlayScene( \"scenes/npc/female01/watchout.vcd\" ) -- shout something while we run just for a laugh\n\t\t\tself:MoveToPos( pos ) -- move to position (yielding)\n\t\t\tself:PlaySequenceAndWait( \"fear_reaction\" ) -- play a fear animation\n\t\t\tself:StartActivity( ACT_IDLE ) -- when we finished, go into the idle anim\n\t\telse\n\n\t\t\t-- some activity to signify that we didn't find anything\n\n\t\tend\n\n\t\tcoroutine.yield()\n\n\tend\n\n\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"AnimationThink","parent":"PANEL","type":"hook","description":"Called every frame unless the panel is not visible (Panel:IsVisible). Similar to PANEL:Think, but can be disabled by Panel:SetAnimationEnabled as explained below.\n\nIf you are overriding this, you must call Panel:AnimationThinkInternal every frame, else animations will cease to work.\n\nIf you want to \"disable\" this hook with Panel:SetAnimationEnabled, you must call it after defining this hook. Once disabled, a custom hook **will not** be re-enabled by Panel:SetAnimationEnabled again - the hook will have to be re-defined.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"ApplySchemeSettings","parent":"PANEL","type":"hook","description":"Called whenever the panel should apply its scheme (colors, fonts, style).\n\nIt is called a few frames after panel's creation once.\n\nThe engine will overwrite Panel:SetFGColor and Panel:SetBGColor (from the engine panel theme/scheme) for most panels just before this hook is called in Lua.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DragHoverClick","parent":"PANEL","type":"hook","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"540-L541"},"description":"Called when an object is dragged and hovered over this panel for 0.1 seconds.\n\nThis is used by DPropertySheet and DTree, for example to open a tab or expand a node when an object is hovered over it.","realm":"Client","args":{"arg":{"text":"The time the object was hovered over this panel.","name":"hoverTime","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"DroppedOn","parent":"PANEL","type":"hook","description":"Called when this panel is dropped onto another panel.\n\nOnly works for panels derived from DDragBase.","realm":"Client","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"375-L377"},"args":{"arg":{"text":"The panel we are dropped onto","name":"pnl","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GenerateExample","parent":"PANEL","type":"hook","description":"Called when the panel should generate example use case / example code to use for this panel. Used in the panel opened by **derma_controls** console command.","file":{"text":"lua/derma/derma_example.lua","line":"20"},"realm":"Client","args":{"arg":[{"text":"The classname of the panel to generate example for. This will be the class name of your panel.","name":"class","type":"string"},{"text":"A DPropertySheet to add your example to. See examples below.","name":"dpropertysheet","type":"Panel"},{"text":"Width of the property sheet?","name":"width","type":"number"},{"text":"Width of the property sheet?","name":"height","type":"number"}]}},"example":{"description":"Example usage of this hook from DButton's code.","code":"function PANEL:GenerateExample( ClassName, PropertySheet, Width, Height )\n\n\tlocal ctrl = vgui.Create( ClassName )\n\tctrl:SetText( \"Example Button\" )\n\tctrl:SetWide( 200 )\n\n\tPropertySheet:AddSheet( ClassName, ctrl, nil, true, true )\n\nend\n\nderma.DefineControl( \"DButton\", \"A standard Button\", PANEL, \"DLabel\" )","output":"A tab named \"DButton\" will appear in **derma_controls** menu."},"realms":["Client"],"type":"Function"},
{"function":{"name":"Init","parent":"PANEL","type":"hook","description":"Called when the panel is created. This is called for each base type that the panel has.","realm":"Client"},"example":{"description":"Shows how this method is called recursively for each base type a panel has.","code":"local BASE = {}\nfunction BASE:Init()\n\tprint(\"Base Init Called\")\nend\n\n\nlocal PANEL = {}\nfunction PANEL:Init()\n\tprint(\"Panel Init Called\")\nend\n\n\nvgui.Register(\"MyBase\", BASE, \"DFrame\")\nvgui.Register(\"MyPanel\", PANEL, \"MyBase\")\n\nlocal panel = vgui.Create(\"MyPanel\")","output":"Base Init Called\n\nPanel Init Called"},"realms":["Client"],"type":"Function"},
{"function":{"name":"LoadCookies","parent":"PANEL","type":"hook","description":"Called after Panel:SetCookieName is called on this panel to apply the just loaded cookie values for this panel.","realm":"Client"},"example":{"code":"function PANEL:LoadCookies()\n\n\tlocal value = self:GetCookieNumber( \"SavedCookieName\", 0 )\n\tprint( value )\n\n\t-- Do your stuff with the loaded value\n\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnActivate","parent":"PANEL","type":"hook","description":{"text":"Called when we are activated during level load. Used by the loading screen panel.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnChildAdded","parent":"PANEL","type":"hook","description":{"text":"Called whenever a child was parented to the panel.","bug":{"text":"This is called before the panel's metatable is set.","issue":"2759"}},"realm":"Client","args":{"arg":{"text":"The child which was added.","name":"child","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnChildRemoved","parent":"PANEL","type":"hook","description":"Called whenever a child of the panel is about to removed.","realm":"Client","args":{"arg":{"text":"The child which is about to be removed.","name":"child","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnCursorEntered","parent":"PANEL","type":"hook","description":"Called whenever the cursor entered the panels bounds.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnCursorExited","parent":"PANEL","type":"hook","description":"Called whenever the cursor left the panels bounds.","realm":"Client"},"warning":"This wont be called if Panel:OnCursorEntered is called on the same frame","realms":["Client"],"type":"Function"},
{"function":{"name":"OnCursorMoved","parent":"PANEL","type":"hook","description":"Called whenever the cursor was moved with the panels bounds.","realm":"Client","args":{"arg":[{"text":"The new x position of the cursor relative to the panels origin.","name":"cursorX","type":"number"},{"text":"The new y position of the cursor relative to the panels origin.","name":"cursorY","type":"number"}]},"rets":{"ret":{"text":"Return true to suppress default action.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnDeactivate","parent":"PANEL","type":"hook","description":{"text":"Called when we are deactivated during level load. Used by the loading screen panel.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnDrop","parent":"PANEL","type":"hook","description":"We're being dropped on something\nWe can create a new panel here and return it, so that instead of dropping us - it drops the new panel instead! We remain where we are!\n\nOnly works for panels derived from DDragBase.","realm":"Client","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"379-L389"},"rets":{"ret":{"text":"The panel to drop instead of us. By default you should return self.","name":"","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnFocusChanged","parent":"PANEL","type":"hook","description":{"text":"Called whenever the panel gained or lost focus.","note":"Panel:HasFocus will only be updated on the next frame and will return the \"old\" value at the time this hook is run. Same goes for vgui.GetKeyboardFocus."},"realm":"Client","args":{"arg":{"text":"If the focus was gained (`true`) or lost (`false`).","name":"gained","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnHScroll","parent":"PANEL","type":"hook","description":"Called when the panel a child DHScrollBar is scrolled.","realm":"Client","args":{"arg":{"text":"The new horizontal scroll offset.","name":"offset","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnKeyCodePressed","parent":"PANEL","type":"hook","description":{"text":"Called whenever a keyboard key was pressed while the panel is focused.","bug":{"text":"This is not run for ESC/\"cancelselect\" binding.","issue":"2886"}},"realm":"Client","args":{"arg":{"text":"The key code of the pressed key, see Enums/KEY.","name":"keyCode","type":"number"}},"rets":{"ret":{"text":"Return `true` to suppress default action.","name":"","type":"boolean"}}},"example":{"description":"Prints some text into console when the player presses any button while the panel is opened. In this example the panel is opened via the `testvgui` console command.","code":"concommand.Add( \"testvgui\", function( ply )\n\tlocal DFrame = vgui.Create( \"DFrame\" )\t-- The name of the panel, we don't have to parent it\n\tDFrame:SetPos( 100, 100 )\t\t\t\t-- Set the position to 100x by 100y \n\tDFrame:SetSize( 300, 200 )\t\t\t\t-- Set the size to 300x by 200y\n\tDFrame:SetTitle( \"Derma Frame\" )\t\t-- Set the title in the top left to 'Derma Frame'\n\tDFrame:MakePopup()\t\t\t\t\t\t-- Make the frame take user's input\n\tfunction DFrame:OnKeyCodePressed( ... ) \n\t\tprint( \"OnKeyCodePressed\", ... )\t-- Print something when a key is pressed\n\tend\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnKeyCodeReleased","parent":"PANEL","type":"hook","description":{"text":"Called whenever a keyboard key was released while the panel is focused.","bug":{"text":"This is not run for TILDE/\"toggleconsole\" binding.","issue":"2886"}},"realm":"Client","args":{"arg":{"text":"The key code of the released key, see Enums/KEY.","name":"keyCode","type":"number"}},"rets":{"ret":{"text":"Return true to suppress default action.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnMousePressed","parent":"PANEL","type":"hook","description":"Called whenever a mouse key was pressed while the panel is focused.","realm":"Client","args":{"arg":{"text":"They key code of the key pressed, see Enums/MOUSE.","name":"keyCode","type":"number"}},"rets":{"ret":{"text":"Return true to suppress default action such as right click opening edit menu for DTextEntry.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnMouseReleased","parent":"PANEL","type":"hook","description":"Called whenever a mouse key was released while the panel is focused.","realm":"Client","args":{"arg":{"text":"They key code of the key released, see Enums/MOUSE.","name":"keyCode","type":"number"}},"rets":{"ret":{"text":"Return true to suppress default action.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnMouseWheeled","parent":"PANEL","type":"hook","description":"Called whenever the mouse wheel was used.","realm":"Client","args":{"arg":{"text":"The scroll delta, indicating how much the user turned the mouse wheel.","name":"scrollDelta","type":"number"}},"rets":{"ret":{"text":"Return true to suppress default action.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnRemove","parent":"PANEL","type":"hook","description":"Called when the panel is about to be removed.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnScreenSizeChanged","parent":"PANEL","type":"hook","description":"Called when the player's screen resolution of the game changes.\n\nGlobal.ScrW and Global.ScrH will return the new values when this hook is called.","realm":"Client and Menu","args":{"arg":[{"text":"The previous width  of the game's window","name":"oldWidth","type":"number"},{"text":"The previous height of the game's window","name":"oldHeight","type":"number"},{"text":"The new/current width of the game's window.","name":"newWidth","type":"number","added":"2023.10.24"},{"text":"The new/current height of the game's window.","name":"newHeight","type":"number","added":"2023.10.24"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnScrollbarAppear","parent":"PANEL","type":"hook","description":"Called when the panel a child DVScrollBar or DHScrollBar becomes visible.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnSizeChanged","parent":"PANEL","type":"hook","description":{"text":"Called just after the panel size changes.\n\nAll size functions will return the new values when this hook is called.","warning":"Changing the panel size in this hook will cause an infinite loop!"},"realm":"Client","args":{"arg":[{"text":"The new width of the panel","name":"newWidth","type":"number"},{"text":"The new height of the panel","name":"newHeight","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnStartDragging","parent":"PANEL","type":"hook","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"391-L406"},"description":{"text":"Called by dragndrop.StartDragging when the panel starts being dragged.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnStopDragging","parent":"PANEL","type":"hook","file":{"text":"lua/includes/extensions/client/panel/dragdrop.lua","line":"408-L410"},"description":{"text":"Called by Panel:DragMouseRelease when the panel object is released after being dragged.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnTextClicked","parent":"PANEL","type":"hook","description":"Called whenever clickable text is clicked within a RichText.","realm":"Client","added":"2023.12.18","args":{"arg":{"text":"The identifier of the text clicked. The one passed to Panel:InsertClickableTextStart.","name":"id","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnVScroll","parent":"PANEL","type":"hook","description":"Called when the panel a child DVScrollBar is scrolled.","realm":"Client","args":{"arg":{"text":"The new vertical scroll offset.","name":"offset","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Paint","parent":"PANEL","type":"hook","description":{"text":"Called whenever the panel should be drawn. \n\nThis hook will not run if the panel is completely off the screen, and will still run if any parts of the panel are still on screen.\n\nYou can create panels with a customized appearance by overriding their `Paint()` function, which will prevent the default appearance from being drawn.\n\nSee also PANEL:PaintOver.","note":"Render operations from the surface library (and consequentially the draw library) are always offset by the global position of this panel, as seen in the example below"},"realm":"Client and Menu","args":{"arg":[{"text":"The panel's width.","name":"width","type":"number"},{"text":"The panel's height.","name":"height","type":"number"}]},"rets":{"ret":{"text":"Returning true prevents the background from being drawn.","name":"","type":"boolean"}}},"example":{"description":"Creates a DPanel and overrides its Paint() function to draw a 100x100 pixel black rounded box in the center of the screen.","code":"local panel = vgui.Create( \"DPanel\" )\npanel:SetSize( 100, 100 )\npanel:SetPos( ScrW() / 2 - 50, ScrH() / 2 - 50 )\n\nfunction panel:Paint( w, h )\n    draw.RoundedBox( 8, 0, 0, w, h, color_black )\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PaintOver","parent":"PANEL","type":"hook","description":"Called whenever the panel and all its children were drawn, return true to override the default drawing.\n\nThis is useful to draw content over the panel without having to overwrite it's PANEL:Paint hook, for example as an indicator that a panel is selected in PropSelect","realm":"Client and Menu","args":{"arg":[{"text":"The panels current width.","name":"width","type":"number"},{"text":"The panels current height.","name":"height","type":"number"}]},"rets":{"ret":{"text":"Should we disable default PaintOver rendering? This is useful in case with Derma panels that use Derma hooks.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PerformLayout","parent":"PANEL","type":"hook","description":"Called whenever the panels' layout needs to be performed again. This means all child panels must be re-positioned to fit the possibly new size of this panel.\n\nThis can be triggered in numerous ways:\n* Panel:InvalidateLayout was called this or previous frame (depending on the argument)\n* Panel:SetPos called more than once on the same panel ([Issue](https://github.com/Facepunch/garrysmod-issues/issues/5519))\n* A child element was added to this panel (TODO: Verify me)\n* The size of this panel has changed\n\nYou should not call this function directly. Use Panel:InvalidateLayout instead.\n\nYou should also be careful to not cause layout loops. You can use `vgui_visualizelayout 1` to visualize panel layouts as they happen for debugging purposes. Panels should not be doing this every frame for performance reasons.","realm":"Client","args":{"arg":[{"text":"The panels current width.","name":"width","type":"number"},{"text":"The panels current height.","name":"height","type":"number"}]}},"example":{"description":"Creating a resizeable DFrame with a 'sidebar' that rescales along with the DFrame","code":"local frame = vgui.Create(\"DFrame\")\nframe:SetSize(500, 400)\nframe:Center()\nframe:SetSizable(true)\n-- oPerformLayout stores the original PerformLayout function\n-- We store it because we are going to overwrite it with our own to scale the Sidebar\n-- We then call the original function to maintain proper functionality of the frame\n-- You can find the original PerformLayout here https://github.com/Facepunch/garrysmod/blob/master/garrysmod/lua/vgui/dframe.lua#L234-L258\nlocal oPerformLayout = frame.PerformLayout\n\nframe.PerformLayout = function(pnl, w, h)\n    oPerformLayout(pnl, w, h)\n    pnl.Sidebar:SetWide(w * 0.5)\nend\n\nframe.Sidebar = frame:Add(\"DPanel\")\nframe.Sidebar:Dock(LEFT)\n\nframe.Sidebar.Paint = function(pnl, w, h)\n    surface.SetDrawColor(255, 0, 0)\n    surface.DrawRect(0, 0, w, h)\nend\n\nframe.Sidebar.PerformLayout = function(pnl, w, h)\n    local buttonWidth = w * 0.5\n    local buttonHeight = h * 0.5\n    pnl.Button:SetSize(buttonWidth, buttonHeight)\n    -- now we center our button\n    pnl.Button:SetPos(w / 2 - buttonWidth / 2, h / 2 - buttonHeight / 2)\nend\n\nframe.Sidebar.Button = frame.Sidebar:Add(\"DButton\")\nframe.Sidebar.Button:SetText(\"Hello!\")"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PostAutoRefresh","parent":"PANEL","type":"hook","description":"Only works on elements defined with derma.DefineControl and only if the panel has **AllowAutoRefresh** set to true.\n\nCalled after derma.DefineControl is called with panel's class name.\n\nSee also PANEL:PreAutoRefresh","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PreAutoRefresh","parent":"PANEL","type":"hook","description":"Only works on elements defined with derma.DefineControl and only if the panel has **AllowAutoRefresh** set to true.\n\nCalled when derma.DefineControl is called with this panel's class name before applying changes to this panel.\n\nSee also PANEL:PostAutoRefresh","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"TestHover","parent":"PANEL","type":"hook","description":"Called to test if the panel is being `hovered` by the mouse. This will only be called if the panel's parent is being hovered.","realm":"Client","added":"2020.04.29","args":{"arg":[{"text":"The x coordinate of the cursor, in screen space.","name":"x","type":"number"},{"text":"The y coordinate of the cursor, in screen space.","name":"y","type":"number"}]},"rets":{"ret":{"text":"Return false when the cursor is not considered on the panel, true if it is considered on the panel. Do not return anything for default behavior.","name":"","type":"boolean"}}},"example":{"description":"Makes the button detect clicks as if the button was circular - not rectangular.","code":{"text":"concommand.Add( \"testvgui1\", function()\n\tlocal frame = vgui.Create( \"DFrame\" )\n\tframe:SetSize( 300, 400 )\n\tframe:Center()\n\tframe:MakePopup()\n\n\tlocal DermaButton = vgui.Create( \"DButton\", frame )\n\tDermaButton:SetText( \"Say hi\" )\n\tDermaButton:SetPos( 25, 50 )\n\tDermaButton:SetSize( 250, 250 )\n\tfunction DermaButton:DoClick( self ) chat.AddText( \"Hello world\" ) end\n\tfunction DermaButton:TestHover( x, y )\n\t\tlocal x, y = self:ScreenToLocal( x, y ) -- Convert to local coordinates\n\t\tlocal dist = math.sqrt( (x - self:GetWide() / 2) ^ 2 + ( y - self:GetTall() / 2 ) ^ 2 ) -- Simple distance calculation\n\t\treturn dist","math.min":{"self:getwide":"","self:gettall":"","return":"","true":"","if":"","the":"","cursor":"","is":"","within":"","buttons":"","circular":["",""],"radius":"","end":"","function":"","dermabutton:paint":"","w":"","h":"","original":"","size":["","math.min("],"draw.roundedbox":"","color":"","visualization":"","local":"","surface.drawcircle":"","ode":"ode"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Think","parent":"PANEL","type":"hook","description":"Called every frame while Panel:IsVisible is true.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ClassChanged","parent":"PLAYER","type":"hook","description":"Called when the player's class was changed from this class.","realm":"Shared","added":"2020.10.14"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Death","parent":"PLAYER","type":"hook","description":"Called when the player dies","realm":"Server","added":"2020.06.24","file":{"text":"gamemodes/base/gamemode/player_class/player_default.lua","line":"74-L75"}},"realms":["Server"],"type":"Function"},
{"function":{"name":"FinishMove","parent":"PLAYER","type":"hook","description":{"text":"Called from GM:FinishMove.","warning":"This hook will not work if the current gamemode overrides GM:FinishMove and does not call this hook.","note":"This hook is run after the drive.FinishMove has been called."},"realm":"Shared","file":{"text":"gamemodes/sandbox/gamemode/player_class/player_sandbox.lua","line":"161-L197"},"args":{"arg":{"name":"mv","type":"CMoveData"}},"rets":{"ret":{"text":"Return true to prevent default action","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"GetHandsModel","parent":"PLAYER","type":"hook","description":"Called on player spawn to determine which hand model to use","realm":"Server","file":{"text":"gamemodes/base/gamemode/player_class/player_default.lua","line":"126-L133"},"rets":{"ret":{"text":"A table containing info about view model hands model to be set. See examples.","name":"","type":"table"}}},"example":{"description":"Default action of player_default class","code":"function PLAYER:GetHandsModel()\n\n\t-- return { model = \"models/weapons/c_arms_cstrike.mdl\", skin = 1, body = \"0100000\" }\n\n\tlocal playermodel = player_manager.TranslateToPlayerModelName( self.Player:GetModel() )\n\treturn player_manager.TranslatePlayerHands( playermodel )\n\nend","output":"View model hands model is chosen according to player's player model."},"realms":["Server"],"type":"Function"},
{"function":{"name":"Init","parent":"PLAYER","type":"hook","description":"Called when the class object is created","realm":"Shared","file":{"text":"gamemodes/base/gamemode/player_class/player_default.lua","line":"L37-L43"}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Loadout","parent":"PLAYER","type":"hook","description":"Called on spawn to give the player their default loadout","realm":"Server","file":{"text":"gamemodes/base/gamemode/player_class/player_default.lua","line":"60-L65"}},"realms":["Server"],"type":"Function"},
{"function":{"name":"Move","parent":"PLAYER","type":"hook","description":{"text":"Called from GM:Move.","warning":"This hook will not work if the current gamemode overrides GM:Move and does not call this hook.","note":"This hook is run after the drive.Move has been called."},"realm":"Shared","file":{"text":"gamemodes/base/gamemode/player_class/player_default.lua","line":"L86"},"args":{"arg":{"text":"Movement information","name":"mv","type":"CMoveData"}},"rets":{"ret":{"text":"Return true to prevent default action","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PostDrawViewModel","parent":"PLAYER","type":"hook","description":"Called after the viewmodel has been drawn","realm":"Client","file":{"text":"gamemodes/base/gamemode/player_class/player_default.lua","line":"110-L118"},"args":{"arg":[{"text":"The viewmodel","name":"viewmodel","type":"Entity"},{"text":"The weapon","name":"weapon","type":"Entity"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PreDrawViewModel","parent":"PLAYER","type":"hook","description":"Called before the viewmodel is drawn","realm":"Client","file":{"text":"gamemodes/base/gamemode/player_class/player_default.lua","line":"100-L108"},"args":{"arg":[{"text":"The viewmodel","name":"viewmodel","type":"Entity"},{"text":"The weapon","name":"weapon","type":"Entity"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetModel","parent":"PLAYER","type":"hook","file":{"text":"gamemodes/base/gamemode/player_class/player_default.lua","line":"67-L74"},"description":{"text":"Called when we need to set player model from the class.","note":"This will only be called if you have not overridden GM:PlayerSetModel or call this function from it or anywhere else using player_manager.RunClass"},"realm":"Server"},"realms":["Server"],"type":"Function"},
{"function":{"name":"SetupDataTables","parent":"PLAYER","type":"hook","description":"Setup the network table accessors.","realm":"Shared","file":{"text":"gamemodes/base/gamemode/player_class/player_default.lua","line":"27-L34"}},"example":{"description":"Example usage.","code":"function PLAYER:SetupDataTables()\n\tself.Player:NetworkVar( \"Int\", 0, \"Money\" )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Spawn","parent":"PLAYER","type":"hook","description":"Called when the player spawns","realm":"Server","file":{"text":"gamemodes/base/gamemode/player_class/player_default.lua","line":"45-L52"}},"realms":["Server"],"type":"Function"},
{"function":{"name":"StartMove","parent":"PLAYER","type":"hook","description":{"text":"Called from GM:CreateMove.","warning":"This hook will not work if the current gamemode overrides GM:SetupMove and does not call this hook.","note":"This hook is run after the drive.StartMove has been called."},"realm":"Shared","file":{"text":"gamemodes/base/gamemode/player_class/player_default.lua","line":"85"},"args":{"arg":[{"text":"The move data to override/use","name":"mv","type":"CMoveData"},{"text":"The command data","name":"cmd","type":"CUserCmd"}]},"rets":{"ret":{"text":"Return true to prevent default action","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ViewModelChanged","parent":"PLAYER","type":"hook","description":"Called when the player changes their weapon to another one causing their viewmodel model to change","realm":"Client","file":{"text":"gamemodes/base/gamemode/player_class/player_default.lua","line":"89-L98"},"args":{"arg":[{"text":"The viewmodel that is changing","name":"viewmodel","type":"Entity"},{"text":"The old model","name":"old","type":"string"},{"text":"The new model","name":"new","type":"string"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddGamemodeToolMenuCategories","parent":"SANDBOX","type":"hook","description":{"text":"This hook is used to add default categories to spawnmenu tool tabs.\n\nDo not override or hook this function, use SANDBOX:AddToolMenuCategories!","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddGamemodeToolMenuTabs","parent":"SANDBOX","type":"hook","description":{"text":"This hook is used to add default tool tabs to spawnmenu.\n\nDo not override or hook this function, use SANDBOX:AddToolMenuTabs!","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddToolMenuCategories","parent":"SANDBOX","type":"hook","description":"This hook is used to add new categories to spawnmenu tool tabs.","realm":"Client"},"example":{"description":"Adds default categories to Utilities tab in spawnmenu.","code":"local function CreateUtilitiesCategories()\n\n        spawnmenu.AddToolCategory( \"Utilities\", \"User\", \"#spawnmenu.utilities.user\" )\n        spawnmenu.AddToolCategory( \"Utilities\", \"Admin\", \"#spawnmenu.utilities.admin\" )\n\nend        \nhook.Add( \"AddToolMenuCategories\", \"CreateUtilitiesCategories\", CreateUtilitiesCategories )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddToolMenuTabs","parent":"SANDBOX","type":"hook","description":"This hook is used to add new tool tabs to spawnmenu.","realm":"Client"},"example":{"description":"Add a new tab and a few categories into it.","code":"hook.Add( \"AddToolMenuTabs\", \"myHookClass\", function()\n\tspawnmenu.AddToolTab(\"myTab\", \"My Tab\", \"icon16/shield.png\") -- Add a new tab\n\n\tspawnmenu.AddToolCategory(\"myTab\", \"myCategory\", \"My Category\") -- Add a category into that new tab\n\n\tspawnmenu.AddToolMenuOption( \"myTab\", \"myCategory\", \"myEntry\", \"My Entry\", \"\", \"\", function( panel )\n\t\tpanel:AddControl( \"Header\", { Text = \"Hello!\" } )\n\tend ) -- Add an entry to our new category\nend)"},"realms":["Client"],"type":"Function"},
{"function":{"name":"CanArmDupe","parent":"SANDBOX","type":"hook","added":"2020.06.24","description":"Called when a player attempts to \"arm\" a duplication with the Duplicator tool. Return false to prevent the player from sending data to server, and to ignore data if it was somehow sent anyway.","realm":"Shared","args":{"arg":{"text":"The player who attempted to arm a dupe.","name":"ply","type":"Player"}},"rets":{"ret":[{"text":"Can the player arm a dupe or not.","name":"","type":"boolean"},{"text":"If given and the return value above is `false`, overrides the error message displayed to the player.","name":"","type":"string","added":"2024.07.10"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CanDrive","parent":"SANDBOX","type":"hook","description":"Called when a player attempts to drive a prop via Prop Drive","realm":"Shared","predicted":"Yes","args":{"arg":[{"text":"The player who attempted to use Prop Drive.","name":"ply","type":"Player"},{"text":"The entity the player is attempting to drive","name":"ent","type":"Entity"}]},"rets":{"ret":{"text":"Return true to allow driving, false to disallow","name":"","type":"boolean"}}},"example":{"description":"Stops nonadmins from using Prop Drive","code":"function GM:CanDrive( ply, ent )\n\tif !ply:IsAdmin() then return false end\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CanTool","parent":"SANDBOX","type":"hook","description":"Called when a player attempts to fire their tool gun. Return true to specifically allow the attempt, false to block it.","realm":"Shared","predicted":"Yes","args":{"arg":[{"text":"The player who attempted to use their toolgun.","name":"ply","type":"Player"},{"text":"A trace from the players eye to where in the world their crosshair/cursor is pointing.","name":"tr","type":"table{TraceResult}","warning":"Returns only Entity when the 5th argument returns `4`"},{"text":"The tool mode the player currently has selected.","name":"toolname","type":"string"},{"text":"The tool mode table the player currently has selected.","name":"tool","type":"table"},{"text":"The tool button pressed.\n* 1 - left click\n* 2 - right click\n* 3 - reload\n* 4 - Menu (No interaction with the toolgun)","name":"button","type":"number","warning":"The number `4` is a test that Rubat is conducting to implement the CanTool in the SpawnMenu. It may disappear."}]},"rets":{"ret":{"text":"Can use toolgun or not.","name":"","type":"boolean"}}},"example":{"description":"Stops players from removing doors.","code":"hook.Add( \"CanTool\", \"CanToolExample\", function( ply, tr, toolname, tool, button )\n   if toolname == \"remover\" and IsValid( tr.Entity ) and tr.Entity:GetClass() == \"prop_door_rotating\" then\n      return false\n   end\nend )"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ContentSidebarSelection","parent":"SANDBOX","type":"hook","description":"Called when player selects an item on the spawnmenu sidebar at the left.","realm":"Client","args":{"arg":[{"text":"The panel that holds spawnicons and the sidebar of spawnmenu","name":"parent","type":"Panel"},{"text":"The item player selected","name":"node","type":"Panel"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ContextMenuClosed","parent":"SANDBOX","type":"hook","description":"Called when the context menu is supposedly closed.\n\nThis is simply an alias of GM:OnContextMenuClose.\n\nThis hook **will** be called even if the Sandbox's context menu doesn't actually exist, i.e. SANDBOX:ContextMenuEnabled blocked its creation.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"ContextMenuCreated","parent":"SANDBOX","type":"hook","description":"Called when the context menu is created.","realm":"Client","args":{"arg":{"text":"The created context menu panel","name":"g_ContextMenu","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ContextMenuEnabled","parent":"SANDBOX","type":"hook","description":"Allows to prevent the creation of the context menu. If the context menu is already created, this will have no effect.","realm":"Client","rets":{"ret":{"text":"Return `false` to prevent the context menu from being created.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ContextMenuOpen","parent":"SANDBOX","type":"hook","description":"Called when the context menu is trying to be opened.","realm":"Client","rets":{"ret":{"text":"Return `false` to block the opening.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ContextMenuOpened","parent":"SANDBOX","type":"hook","description":"Called when the context menu is supposedly opened.\n\nThis is simply an alias of GM:OnContextMenuOpen but will **not** be called if SANDBOX:ContextMenuOpen prevents the context menu from opening.\n\nThis hook **will** be called even if the context menu doesn't actually exist, i.e. SANDBOX:ContextMenuEnabled blocked its creation.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"ContextMenuShowTool","parent":"SANDBOX","type":"hook","description":"Called to poll if active tool settings should appear in the context menu. Please note that this is only called on initial opening of the context menu, not every frame the context menu is in use.","realm":"Client","added":"2023.08.08","rets":{"ret":{"text":"Return `false` to prevent active tool settings from displaying in the context menu.","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnRevertSpawnlist","parent":"SANDBOX","type":"hook","description":"Called when the Client reverts spawnlist changes","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contentsidebar.lua","line":"70"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnSaveSpawnlist","parent":"SANDBOX","type":"hook","description":"Called when a player saves his changes made to the spawnmenu","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contentsidebar.lua","line":"56"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OpenToolbox","parent":"SANDBOX","type":"hook","description":{"text":"This hook is called when the player edits a category in the Spawnmenu","internal":""},"file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenttypes/custom.lua","line":"50"},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PaintNotes","parent":"SANDBOX","type":"hook","description":{"text":"Called from GM:HUDPaint; does nothing by default.","note":"This cannot be used with hook.Add"},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PaintWorldTips","parent":"SANDBOX","type":"hook","description":{"text":"Called from GM:HUDPaint to draw world tips. By default, enabling cl_drawworldtooltips will stop world tips from being drawn here.\n\nSee Global.AddWorldTip for more information.","note":"This cannot be used with hook.Add"},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PersistenceLoad","parent":"SANDBOX","type":"hook","description":"Called when persistent props are loaded.","realm":"Server","args":{"arg":{"text":"Save from which to load.","name":"name","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PersistenceSave","parent":"SANDBOX","type":"hook","description":"Called when persistent props are saved.","realm":"Server","args":{"arg":{"text":"Where to save. By default is convar \"sbox_persist\".","name":"name","type":"string"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerGiveSWEP","parent":"SANDBOX","type":"hook","file":{"text":"gamemodes/sandbox/gamemode/commands.lua","line":"902"},"description":"Called when a player attempts to give themselves a weapon from the Q menu. (Left mouse clicks on an icon)\n\nNot to be confused with SANDBOX:PlayerSpawnSWEP, which is called when the weapon is spawned as entity on the ground.","realm":"Server","args":{"arg":[{"text":"The player who attempted to give themselves a weapon.","name":"ply","type":"Player"},{"text":"Class name of the weapon the player tried to give themselves.","name":"weapon","type":"string"},{"text":"The weapon list table of this weapon, see [CCGiveSWEP](https://github.com/Facepunch/garrysmod/blob/c3801c10e1aacc4c114d81331f301c57bdcf5a52/garrysmod/gamemodes/sandbox/gamemode/commands.lua#L893) and [weapons.Register](https://github.com/Facepunch/garrysmod/blob/c3801c10e1aacc4c114d81331f301c57bdcf5a52/garrysmod/lua/includes/modules/weapons.lua#L58)","name":"spawninfo","type":"table"}]},"rets":{"ret":{"text":"Can the SWEP be given to the player","name":"","type":"boolean"}}},"example":{"description":"Stops non-admins from giving themselves weapons.","code":"hook.Add( \"PlayerGiveSWEP\", \"BlockPlayerSWEPs\", function( ply, class, spawninfo )\n\tif ( not ply:IsAdmin() ) then\n\t\treturn false\n\tend\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSpawnedEffect","parent":"SANDBOX","type":"hook","description":"Called after the player spawned an effect.","realm":"Server","args":{"arg":[{"text":"The player that spawned the effect","name":"ply","type":"Player"},{"text":"The model of spawned effect","name":"model","type":"string"},{"text":"The spawned effect itself","name":"ent","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSpawnedNPC","parent":"SANDBOX","type":"hook","description":"Called after the player spawned an NPC.","realm":"Server","args":{"arg":[{"text":"The player that spawned the NPC","name":"ply","type":"Player"},{"text":"The spawned NPC itself","name":"ent","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSpawnedProp","parent":"SANDBOX","type":"hook","description":"Called when a player has successfully spawned a prop from the Q menu.","realm":"Server","args":{"arg":[{"text":"The player who spawned a prop.","name":"ply","type":"Player"},{"text":"Path to the model of the prop the player is attempting to spawn.","name":"model","type":"string"},{"text":"The entity that was spawned.","name":"entity","type":"Entity"}]}},"example":{"description":"Turns the spawned prop green.","code":"function GM:PlayerSpawnedProp(ply, model, ent)\n\tent:SetColor(Color(0, 255, 0))\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSpawnedRagdoll","parent":"SANDBOX","type":"hook","description":"Called after the player spawned a ragdoll.","realm":"Server","args":{"arg":[{"text":"The player that spawned the ragdoll","name":"ply","type":"Player"},{"text":"The ragdoll model that player wants to spawn","name":"model","type":"string"},{"text":"The spawned ragdoll itself","name":"ent","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSpawnedSENT","parent":"SANDBOX","type":"hook","description":"Called after the player has spawned a scripted entity.","realm":"Server","args":{"arg":[{"text":"The player that spawned the SENT","name":"ply","type":"Player"},{"text":"The spawned SENT","name":"ent","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSpawnedSWEP","parent":"SANDBOX","type":"hook","description":"Called after the player has spawned a weapon from the spawnmenu with a middle mouse click (mouse wheel click).\n\nFor a hook capable of preventing such spawns, see SANDBOX:PlayerSpawnSWEP.  \nFor left mouse click spawns, see SANDBOX:PlayerGiveSWEP.","realm":"Server","args":{"arg":[{"text":"The player that spawned the SWEP","name":"ply","type":"Player"},{"text":"The SWEP itself","name":"ent","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSpawnedVehicle","parent":"SANDBOX","type":"hook","description":"Called after the player spawned a vehicle.","realm":"Server","args":{"arg":[{"text":"The player that spawned the vehicle","name":"ply","type":"Player"},{"text":"The vehicle itself","name":"ent","type":"Entity"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSpawnEffect","parent":"SANDBOX","type":"hook","description":"Called to ask if player allowed to spawn a particular effect or not.","realm":"Server","args":{"arg":[{"text":"The player that wants to spawn an effect","name":"ply","type":"Player"},{"text":"The effect model that player wants to spawn","name":"model","type":"string"}]},"rets":{"ret":{"text":"Return false to disallow spawning that effect","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSpawnNPC","parent":"SANDBOX","type":"hook","description":"Called to ask if player allowed to spawn a particular NPC or not.","realm":"Server","args":{"arg":[{"text":"The player that wants to spawn that NPC","name":"ply","type":"Player"},{"text":"The npc type that player is trying to spawn","name":"npc_type","type":"string"},{"text":"The weapon of that NPC","name":"weapon","type":"string"}]},"rets":{"ret":{"text":"Return false to disallow spawning that NPC","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSpawnObject","parent":"SANDBOX","type":"hook","description":"Called to ask whether player is allowed to spawn a given model. This includes props, effects, and ragdolls and is called before the respective PlayerSpawn* hook.","realm":"Server","args":{"arg":[{"text":"The player in question","name":"ply","type":"Player"},{"text":"Model path","name":"model","type":"string"},{"text":"Skin number","name":"skin","type":"number"}]},"rets":{"ret":{"text":"Return false to disallow the player to spawn the given model.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSpawnProp","parent":"SANDBOX","type":"hook","description":"Called when a player attempts to spawn a prop from the Q menu.","realm":"Server","args":{"arg":[{"text":"The player who attempted to spawn a prop.","name":"ply","type":"Player"},{"text":"Path to the model of the prop the player is attempting to spawn.","name":"model","type":"string"}]},"rets":{"ret":{"text":"Should the player be able to spawn the prop or not.","name":"","type":"boolean"}}},"example":{"description":"Stops non-admins from spawning props.","code":"function GM:PlayerSpawnProp( ply, model )\n\tif ( !ply:IsAdmin() ) then\n\t\treturn false\n\tend\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSpawnRagdoll","parent":"SANDBOX","type":"hook","description":"Called when a player attempts to spawn a ragdoll from the Q menu.","realm":"Server","args":{"arg":[{"text":"The player who attempted to spawn a ragdoll.","name":"ply","type":"Player"},{"text":"Path to the model of the ragdoll the player is attempting to spawn.","name":"model","type":"string"}]},"rets":{"ret":{"text":"Should the player be able to spawn the ragdoll or not.","name":"","type":"boolean"}}},"example":{"description":"Stops non-admins from spawning ragdolls.","code":"function GM:PlayerSpawnRagdoll( ply, model )\n\tif ( not ply:IsAdmin() ) then\n\t\treturn false\n\tend\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSpawnSENT","parent":"SANDBOX","type":"hook","description":"Called when a player attempts to spawn an Entity from the Q menu.","realm":"Server","args":{"arg":[{"text":"The player who attempted to spawn the entity.","name":"ply","type":"Player"},{"text":"Class name of the entity the player tried to spawn.","name":"class","type":"string"}]},"rets":{"ret":{"text":"Should the player be able to spawn the entity or not.","name":"","type":"boolean"}}},"example":{"description":"Stops non-admins from spawning entities.","code":"function GM:PlayerSpawnSENT( ply, class )\n\tif not ply:IsAdmin() then\n\t\treturn false\n\tend\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSpawnSWEP","parent":"SANDBOX","type":"hook","description":"Called when a player attempts to spawn a weapon from the spawnmenu as an entity on the ground, by middle mouse clicking (mouse wheel clicking) on a weapon icon.\n\nNot to be confused with SANDBOX:PlayerGiveSWEP, which is called only when the weapon is given to the player directly, if they don't already have it.\n\nSee SANDBOX:PlayerSpawnedSWEP for post entity creation event.","realm":"Server","args":{"arg":[{"text":"The player who attempted to spawn a weapon.","name":"ply","type":"Player"},{"text":"Class name of the weapon the player tried to spawn.","name":"weapon","type":"string"},{"text":"Information about the weapon the player is trying to spawn, see Structures/SWEP","name":"swep","type":"table"}]},"rets":{"ret":{"text":"Can the SWEP be spawned","name":"","type":"boolean"}}},"example":{"description":"Stops non-admins from spawning weapons.","code":"hook.Add( \"PlayerSpawnSWEP\", \"SpawnBlockSWEP\", function( ply, class, info )\n\tif ( not ply:IsAdmin() ) then\n\t\treturn false\n\tend\nend )"},"realms":["Server"],"type":"Function"},
{"function":{"name":"PlayerSpawnVehicle","parent":"SANDBOX","type":"hook","description":"Called to ask if player allowed to spawn a particular vehicle or not.","realm":"Server","args":{"arg":[{"text":"The player that wants to spawn that vehicle","name":"ply","type":"Player"},{"text":"The vehicle model that player wants to spawn","name":"model","type":"string"},{"text":"Vehicle name","name":"name","type":"string"},{"text":"Table of that vehicle, containing info about it See Structures/VehicleTable.","name":"table","type":"table"}]},"rets":{"ret":{"text":"Return false to disallow spawning that vehicle","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"PopulateContent","parent":"SANDBOX","type":"hook","description":{"text":"Called by the spawnmenu when the content tab is generated","warning":"Creating an error in this Hook will result in a completely broken Content Tab"},"realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/content.lua","line":"91"},"args":{"arg":[{"text":"The SpawnmenuContentPanel","name":"pnlContent","type":"Panel"},{"text":"The ContentNavBar tree from the SpawnmenuContentPanel","name":"tree","type":"Panel"},{"text":"The old Spawnlists","name":"node","type":"Panel"}]}},"example":{"description":"Generates an Example Category with a Models panel","code":"hook.Add( \"PopulateContent\", \"Example\", function( pnlContent, tree, node )\n\tlocal ViewPanel = vgui.Create( \"ContentContainer\", pnlContent )\n\tViewPanel:SetVisible( false )\n\tViewPanel.IconList:SetReadOnly( true )\n\n\tExampleNode = node:AddNode( \"Example\", \"icon16/folder_database.png\" )\n\tExampleNode.pnlContent = pnlContent\n\tExampleNode.ViewPanel = ViewPanel\n\n\tlocal models = ExampleNode:AddNode( \"Models\", \"icon16/exclamation.png\" )\n\tmodels.DoClick = function()\n\t\tViewPanel:Clear( true )\n\n\t\tlocal cp = spawnmenu.GetContentType( \"model\" )\n\t\tif cp then\n\t\t\tfor k, v in ipairs( file.Find( \"models/*.mdl\", \"GAME\" ) ) do\n\t\t\t\tcp( ViewPanel, { model = \"models/\" .. v } )\n\t\t\tend\n\t\tend\n\n\t\tExampleNode.pnlContent:SwitchPanel( ViewPanel )\n\tend\nend)","output":{"image":{"src":"ab571/8dc38944923f207.png","alt":"Tree menu"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PopulateEntities","parent":"SANDBOX","type":"hook","description":{"text":"Called by the spawnmenu when the Entities tab is generated","warning":"Creating an error in this Hook will result in a completely broken Entites Tab"},"realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenttypes/entities.lua","line":"75"},"args":{"arg":[{"text":"The SpawnmenuContentPanel","name":"pnlContent","type":"Panel"},{"text":"The ContentNavBar tree from the SpawnmenuContentPanel","name":"tree","type":"Panel"},{"text":"The old Spawnlists","name":"node","type":"Panel"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PopulateNPCs","parent":"SANDBOX","type":"hook","description":{"text":"Called by the spawnmenu when the NPCs tab is generated","warning":"Creating an error in this Hook will result in a completely broken NPCs Tab"},"realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenttypes/npcs.lua","line":"141"},"args":{"arg":[{"text":"The SpawnmenuContentPanel","name":"pnlContent","type":"Panel"},{"text":"The ContentNavBar tree from the SpawnmenuContentPanel","name":"tree","type":"Panel"},{"text":"The old Spawnlists","name":"node","type":"Panel"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PopulatePropMenu","parent":"SANDBOX","type":"hook","description":"This hook makes the engine load the spawnlist text files.\nIt calls spawnmenu.PopulateFromEngineTextFiles by default.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/content.lua","line":"90"}},"example":{"description":"Source code for this hook.","code":"function GM:PopulatePropMenu()\n\n\t-- This function makes the engine load the spawn menu text files.\n\t-- We call it here so that any gamemodes not using the default \n\t-- spawn menu can totally not call it.\n\tspawnmenu.PopulateFromEngineTextFiles()\n\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PopulateToolMenu","parent":"SANDBOX","type":"hook","description":"Add the Scripted TOOLs to the tool menu. You want to call spawnmenu.AddToolMenuOption in this hook.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/spawnmenu.lua","line":"241"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PopulateVehicles","parent":"SANDBOX","type":"hook","description":{"text":"Called by the spawnmenu when the Vehicles tab is generated","warning":"Creating an error in this Hook will result in a completely broken vehicles Tab"},"realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenttypes/vehicles.lua","line":"77"},"args":{"arg":[{"text":"The SpawnmenuContentPanel","name":"pnlContent","type":"Panel"},{"text":"The ContentNavBar tree from the SpawnmenuContentPanel","name":"tree","type":"Panel"},{"text":"The old Spawnlists","name":"node","type":"Panel"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PopulateWeapons","parent":"SANDBOX","type":"hook","description":{"text":"Called by the spawnmenu when the Weapons tab is generated","warning":"Creating an error in this Hook will result in a completely broken Weapons Tab"},"realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenttypes/weapons.lua","line":"75"},"args":{"arg":[{"text":"The SpawnmenuContentPanel","name":"pnlContent","type":"Panel"},{"text":"The ContentNavBar tree from the SpawnmenuContentPanel","name":"tree","type":"Panel"},{"text":"The old Spawnlists","name":"node","type":"Panel"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PostReloadToolsMenu","parent":"SANDBOX","type":"hook","description":"Called right after the Lua Loaded tool menus are reloaded. This is a good place to set up any ControlPanels.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PreRegisterTOOL","parent":"SANDBOX","type":"hook","description":"Called just before registering a Sandbox scripted tool.","realm":"Shared","added":"2021.10.31","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/stool.lua","line":"163-L165"},"args":{"arg":[{"text":"The TOOL table to be registered. See Structures/TOOL.","name":"tool","type":"table"},{"text":"The class name to be assigned.","name":"class","type":"string"}]},"rets":{"ret":{"text":"Return `false` to prevent the TOOL from being registered.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PreReloadToolsMenu","parent":"SANDBOX","type":"hook","description":"Called right before the Lua Loaded tool menus are reloaded.","realm":"Client"},"example":{"description":"Removes some tools from the spawnmenu tab. **Note**: the player can still take them (e.g. via console command).","code":"-- The tools that we are going to hide from the menu.\nlocal toolsToHide = {\n    weld = true,\n    rope = true,\n}\n\nhook.Add( \"PreReloadToolsMenu\", \"HideTools\", function()\n    -- Tool contains information about all registered tools.\n    for name, data in pairs( weapons.GetStored( \"gmod_tool\" ).Tool ) do\n        if toolsToHide[ name ] then\n            data.AddToMenu = false\n        end\n    end\nend )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SpawnlistContentChanged","parent":"SANDBOX","type":"hook","description":"Called when changes were made to the spawnmenu like creating a new category.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenttypes/custom.lua","line":"44"}},"example":{"description":"Plays a sound every time it's called.","code":"hook.Add(\"SpawnlistContentChanged\", \"Example\", function()\n\tsurface.PlaySound( \"ambient/water/drip\" .. math.random( 1, 4 ) .. \".wav\" )\nend)"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SpawnlistOpenGenericMenu","parent":"SANDBOX","type":"hook","description":{"text":"Called when there's one or more items selected in the spawnmenu by the player, to open the multi selection right click menu (DMenu)","internal":"Use SANDBOX:SpawnmenuIconMenuOpen if you wish to add new options to spawnmenu icon right click menus."},"realm":"Client","args":{"arg":{"text":"The canvas that has the selection. (Panel:GetSelectionCanvas)","type":"Panel","name":"canvas"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SpawnMenuEnabled","parent":"SANDBOX","type":"hook","description":"If false is returned then the spawn menu is never created. This saves load times if your mod doesn't actually use the spawn menu for any reason.","realm":"Client","rets":{"ret":{"text":"Whether to create spawnmenu or not.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SpawnmenuIconMenuOpen","parent":"SANDBOX","type":"hook","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenticon.lua","line":"32"},"description":"Called when the player opens a context menu by right clicking one of the spawnmenu icons. Either ContentIcon or SpawnIcon.\n\nThis hook can be used to add new custom menu options to the context menu.","added":"2025.03.18","realm":"Client","args":{"arg":[{"text":"The DMenu to add options to.","name":"menu","type":"Panel"},{"text":"The ContentIcon or SpawnIcon that was right clicked. It will be a `SpawnIcon` for `model` content type, and a `ContentIcon` for all others.","name":"icon","type":"Panel"},{"text":"The content type, such as:\n* `weapon`\n* `entity`\n* `vehicle`\n* `npc`\n* `model`\n* `tool`\n* `postprocess`\n\nAddon related icons may have different types.","name":"contentType","type":"string"}]}},"example":{"description":"Adds a \"copy name\" option to NPC spawn icons.","code":"hook.Add( \"SpawnmenuIconMenuOpen\", \"SM_CopyNPCName\", function( menu, icon, contentType )\n    if ( contentType != \"npc\" ) then return end\n\n    menu:AddOption( \"Copy Name\", function()\n        SetClipboardText( language.GetPhrase( icon.m_NiceName ) )\n    end ):SetIcon( \"icon16/page_copy.png\" )\nend)"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SpawnMenuOpen","parent":"SANDBOX","type":"hook","description":{"text":"Called when spawnmenu is trying to be opened.","note":"Hiding the spawnmenu will not stop people from being able to use the various console commands to spawn in items, etc. See GM:PlayerSpawn* hooks for blocking actual spawning."},"realm":"Client","rets":{"ret":{"text":"Return false to dissallow opening the spawnmenu","name":"","type":"boolean"}}},"example":[{"description":"Only allow the people you want to open the spawn menu.","code":"local allowed = {\n\t[\"STEAM_0:0:00000000\"] = true,\n\t[\"STEAM_0:0:10000000\"] = true\n}\n\nhook.Add( \"SpawnMenuOpen\", \"SpawnMenuWhitelist\", function()\n\tif ( !allowed[ LocalPlayer():SteamID() ] ) then\n\t\treturn false\n\tend\nend )"},{"description":"Disables and collapses the default customizable spawnlists node.","code":"hook.Add( \"SpawnMenuOpen\", \"SpawnMenuHide\", function()\n\tg_SpawnMenu.CustomizableSpawnlistNode:SetExpanded( false )\n\tg_SpawnMenu.CustomizableSpawnlistNode:SetEnabled( false )\n\tg_SpawnMenu.CustomizableSpawnlistNode.SMContentPanel:SwitchPanel()\nend )"}],"realms":["Client"],"type":"Function"},
{"function":{"name":"SpawnMenuOpened","parent":"SANDBOX","type":"hook","description":"Called when the spawnmenu is opened.\n\nThis is an alias of GM:OnSpawnMenuOpen but will **not** be called if SANDBOX:SpawnMenuOpen prevents the spawnmenu from opening.\n\nThis hook **will** be called even if the spawnmenu doesn't actually exist, i.e. SANDBOX:SpawnMenuEnabled blocked its creation.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"BuildCPanel","parent":"TOOL","type":"hook","description":{"text":"Called when the tool's control panel needs to be rebuilt.","warning":"Due to historical reasons, this hook does not provide the tool object as `self`! See examples."},"realm":"Client","args":{"arg":{"text":"The DForm control panel to add settings to.","name":"cpanel","type":"Panel"}}},"example":{"description":"Shows how to use this hook properly.","code":"-- Build defaults for the preset system.\nlocal ConVarsDefault = TOOL:BuildConVarList()\n\n-- Please note that this function is defined with a dot (.), not a colon (:)!!!\n-- This is important! You will not be able to access \"self\" in this function.\nfunction TOOL.BuildCPanel( CPanel )\n\n\tCPanel:AddControl( \"Header\", { Description = \"#tool.ballsocket.help\" } )\n\n\tCPanel:AddControl( \"ComboBox\", { MenuButton = 1, Folder = \"ballsocket\", Options = { [ \"#preset.default\" ] = ConVarsDefault }, CVars = table.GetKeys( ConVarsDefault ) } )\n\n\tCPanel:AddControl( \"Slider\", { Label = \"#tool.forcelimit\", Command = \"ballsocket_forcelimit\", Type = \"Float\", Min = 0, Max = 50000, Help = true } )\n\n\tCPanel:AddControl( \"CheckBox\", { Label = \"#tool.nocollide\", Command = \"ballsocket_nocollide\", Help = true } )\n\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Deploy","parent":"TOOL","type":"hook","description":"Called when WEAPON:Deploy of the toolgun is called.\n\nThis is also called when switching from another tool on the server.","realm":"Shared","predicted":"Yes","rets":{"ret":{"text":"Return true to allow switching away from the toolgun using lastinv command","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DrawHUD","parent":"TOOL","type":"hook","description":"Called when WEAPON:DrawHUD of the toolgun is called, only when the user has this tool selected.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawToolScreen","parent":"TOOL","type":"hook","description":{"text":"Called after the default tool screen has been drawn from WEAPON:RenderScreen.","note":["If this method exists on the TOOL object table, the default scrolling text will not be drawn","Materials rendered in this hook require $ignorez parameter to draw properly."]},"realm":"Client","file":{"text":"gamemodes/sandbox/entities/weapons/gmod_tool/cl_viewscreen.lua","line":"62"},"args":{"arg":[{"text":"The width of the tool's screen in pixels.","name":"width","type":"number"},{"text":"The height of the tool's screen in pixels.","name":"height","type":"number"}]}},"example":{"description":"White text that says \"Hello world!\" on a black background.","code":"function TOOL:DrawToolScreen( width, height )\n\t-- Draw black background\n\tsurface.SetDrawColor( Color( 20, 20, 20 ) )\n\tsurface.DrawRect( 0, 0, width, height )\n\t\n\t-- Draw white text in middle\n\tdraw.SimpleText( \"Hello world!\", \"DermaLarge\", width / 2, height / 2, Color( 200, 200, 200 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )\nend","output":{"image":{"src":"drawtoolscreen.jpg"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"FreezeMovement","parent":"TOOL","type":"hook","description":"Called when WEAPON:Think of the toolgun is called, only when the user has this tool selected.","realm":"Client","rets":{"ret":{"text":"Return true to freeze the player","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Holster","parent":"TOOL","type":"hook","description":"Called when WEAPON:Holster of the toolgun is called, when switching between different toolguns.","realm":"Shared","predicted":"Yes"},"example":{"description":"Clears any objects set by Tool:SetObject.","code":"function TOOL:Holster()\n\n\tself:ClearObjects()\n\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"LeftClick","parent":"TOOL","type":"hook","description":"Called when the user left clicks with the tool.","realm":"Shared","predicted":"Yes","args":{"arg":{"text":"A trace from user's eyes to wherever they aim at. See Structures/TraceResult","name":"tr","type":"table"}},"rets":{"ret":{"text":"Return `true` to draw the tool gun beam and play fire animations, `false` otherwise.","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Reload","parent":"TOOL","type":"hook","description":"Called when the user presses the reload key with the tool out.","realm":"Shared","predicted":"Yes","args":{"arg":{"text":"A trace from user's eyes to wherever they aim at. See Structures/TraceResult","name":"tr","type":"table"}},"rets":{"ret":{"text":"Return `true` to draw the tool gun beam and play fire animations, `false` otherwise","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RightClick","parent":"TOOL","type":"hook","description":"Called when the user right clicks with the tool.","realm":"Shared","predicted":"Yes","args":{"arg":{"text":"A trace from user's eyes to wherever they aim at. See Structures/TraceResult","name":"tr","type":"table"}},"rets":{"ret":{"text":"Return `true` to draw the tool gun beam and play fire animations, `false` otherwise","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Think","parent":"TOOL","type":"hook","description":"Called when WEAPON:Think of the toolgun is called. This only happens when the tool gun is currently equipped/selected by the player and the selected tool is this tool.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"AcceptInput","parent":"WEAPON","type":"hook","description":"Called when another entity fires an event to this entity.","realm":"Server","args":{"arg":[{"text":"The name of the input that was triggered.","name":"inputName","type":"string"},{"text":"The initial cause for the input getting triggered.","name":"activator","type":"Entity"},{"text":"The entity that directly trigger the input.","name":"called","type":"Entity"},{"text":"The data passed.","name":"data","type":"string"}]},"rets":{"ret":{"text":"Should we suppress the default action for this input?","name":"","type":"boolean"}}},"example":{"description":"A workaround for weapons created by maps not taking into account spawnflags.","code":"function SWEP:AcceptInput( name, activator, caller, data )\n\n\t-- Check for input and spawnflag\n\tif ( name == \"ConstraintBroken\" && self:HasSpawnFlags( 1 ) ) then\n\n\t\t-- Freeze the weapon\n\t\tlocal phys = self:GetPhysicsObject()\n\t\tif ( IsValid( phys ) ) then phys:EnableMotion( false ) end\n\t\n\t\t-- Remove the spawnflag so it doesn't freeze the weapon when it is dropped\n\t\tlocal newflags = bit.band( self:GetSpawnFlags(), bit.bnot( 1 ) )\n\t\tself:SetKeyValue( \"spawnflags\", newflags )\n\tend\nend"},"realms":["Server"],"type":"Function"},
{"function":{"name":"AdjustMouseSensitivity","parent":"WEAPON","type":"hook","description":"Allows you to adjust the weapon's mouse sensitivity. This hook only works if you haven't overridden GM:AdjustMouseSensitivity.","realm":"Client","args":{"arg":[{"text":"The old sensitivity\n\nIn general this will be 0, which is equivalent to a sensitivity of 1.","name":"defaultSensitivity","type":"number","added":"2026.03.12"},{"text":"The player's current FOV.","name":"localFOV","type":"number","added":"2026.03.12"},{"text":"The player's default FOV.","name":"defaultFOV","type":"number","added":"2026.03.12"}]},"rets":{"ret":{"text":"A multiplier of the player's normal sensitivity (0.5 would be half as sensitive, 2 would be twice as sensitive).","name":"","type":"number"}}},"example":{"description":"Properly scales the player's sensitivity with their FOV while also halving it.","code":"local ratio = GetConVar(\"zoom_sensitivity_ratio\")\n\nfunction SWEP:AdjustMouseSensitivity(default, localFOV, defaultFOV)\n\tif localFOV == defaultFOV then\n\t\treturn 0.5\n\tend\n\n\treturn (localFOV / defaultFOV) * ratio:GetFloat() * 0.5\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Ammo1","parent":"WEAPON","type":"hook","description":"Returns how much of primary ammo the player has.","realm":"Shared","file":{"text":"gamemodes/base/entities/weapons/weapon_base/shared.lua","line":"251-L257"},"rets":{"ret":{"text":"The amount of primary ammo player has","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Ammo2","parent":"WEAPON","type":"hook","description":"Returns how much of secondary ammo the player has.","realm":"Shared","file":{"text":"gamemodes/base/entities/weapons/weapon_base/shared.lua","line":"262-L267"},"rets":{"ret":{"text":"The amount of secondary ammo player has","name":"","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CalcView","parent":"WEAPON","type":"hook","description":"Allows you to adjust player view while this weapon in use.\n\nThis hook is called from the default implementation of GM:CalcView which is [here](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/gamemodes/base/gamemode/cl_init.lua#L387-L395). Therefore, it will not be called if any other hook added to `CalcView` returns any value, or if the current gamemode overrides the default hook and does not call the SWEP function.","realm":"Client","args":{"arg":[{"text":"The owner of weapon","name":"ply","type":"Player"},{"text":"Current position of players view","name":"pos","type":"Vector"},{"text":"Current angles of players view","name":"ang","type":"Angle"},{"text":"Current FOV of players view","name":"fov","type":"number"}]},"rets":{"ret":[{"text":"New position of players view","name":"","type":"Vector"},{"text":"New angle of players view","name":"","type":"Angle"},{"text":"New FOV of players view","name":"","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"CalcViewModelView","parent":"WEAPON","type":"hook","description":"Allows overriding the position and angle of the viewmodel. This hook only works if you haven't overridden GM:CalcViewModelView.","realm":"Client","args":{"arg":[{"text":"The viewmodel entity","name":"ViewModel","type":"Entity"},{"text":"Original position (before viewmodel bobbing and swaying)","name":"OldEyePos","type":"Vector"},{"text":"Original angle (before viewmodel bobbing and swaying)","name":"OldEyeAng","type":"Angle"},{"text":"Current position","name":"EyePos","type":"Vector"},{"text":"Current angle","name":"EyeAng","type":"Angle"}]},"rets":{"ret":[{"text":"New position","name":"","type":"Vector"},{"text":"New angle","name":"","type":"Angle"}]}},"example":{"description":"One way to change the viewmodel texture (skin) for your SWEP. Changing it from 0 to 1. \n\nRemember to define the base path ([$cdmaterials](https://developer.valvesoftware.com/wiki/$cdmaterials)) for your model when e.g. using [Crowbar](https://developer.valvesoftware.com/wiki/Crowbar) to compile .smd to .mdl; or else you won't get any texture(s) applied. (the game won't know where to look) [QC Commands](https://developer.valvesoftware.com/wiki/Category:QC_Commands)\n\nAnd remember to use [$texturegroup](https://developer.valvesoftware.com/wiki/$texturegroup) for multiple skins.","code":"function SWEP:CalcViewModelView(ViewModel, OldEyePos, OldEyeAng, EyePos, EyeAng)\n    -- Set skin to the SWEPs second skin; 1. Starts at 0\n    ViewModel:SetSkin(1)\nend","output":{"image":[{"src":"CalcViewModelView_ex1_skin0.JPG","alt":"thumb|left|Skin_0"},{"src":"CalcViewModelView_ex1_skin1.JPG","alt":"thumb|left|Skin_1"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"CanBePickedUpByNPCs","parent":"WEAPON","type":"hook","description":"Called when a Citizen NPC is looking around to a (better) weapon to pickup.","realm":"Server","rets":{"ret":{"text":"Return true to allow this weapon to be picked up by NPCs.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"CanPrimaryAttack","parent":"WEAPON","type":"hook","description":"Helper function for checking for no ammo.","realm":"Shared","file":{"text":"gamemodes/base/entities/weapons/weapon_base/shared.lua","line":"200-L213"},"rets":{"ret":{"text":"Can use primary attack","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CanSecondaryAttack","parent":"WEAPON","type":"hook","description":"Helper function for checking for no ammo.","realm":"Shared","file":{"text":"gamemodes/base/entities/weapons/weapon_base/shared.lua","line":"219-L231"},"rets":{"ret":{"text":"Can use secondary attack","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"CustomAmmoDisplay","parent":"WEAPON","type":"hook","description":"Allows you to use any numbers you want for the ammo display on the HUD.\n\nCan be useful for weapons that don't use standard ammo.","realm":"Client","rets":{"ret":{"text":"The new ammo display settings. A table with 4 possible keys: (All default to -1)\n* boolean Draw - Whether to draw the ammo display or not\n* number PrimaryClip - Amount of primary ammo in the clip\n* number PrimaryAmmo - Amount of primary ammo in the reserves\n* number SecondaryAmmo - Amount of secondary ammo. It is shown like alt-fire for SMG1 and AR2 are shown.\n* number SecondaryClip - Amount of secondary ammo in the clip. If set, the secondary ammo display will have clips and reserve ammo dispalyed.","name":"","type":"table"}}},"example":{"description":"How it would look with standard information","code":"function SWEP:CustomAmmoDisplay()\n\tself.AmmoDisplay = self.AmmoDisplay or {} \n \n\tself.AmmoDisplay.Draw = true //draw the display?\n \n\tif self.Primary.ClipSize > 0 then\n\t\tself.AmmoDisplay.PrimaryClip = self:Clip1() //amount in clip\n\t\tself.AmmoDisplay.PrimaryAmmo = self:Ammo1() //amount in reserve\n\tend\n\tif self.Secondary.ClipSize > 0 then\n\t\tself.AmmoDisplay.SecondaryAmmo = self:Ammo2() // amount of secondary ammo\n\tend\n \n\treturn self.AmmoDisplay //return the table\nend"},"realms":["Client"],"type":"Function"},
{"cat":"hook","function":{"name":"Deploy","parent":"WEAPON","type":"hook","description":{"text":"Called when player has just switched to this weapon.","note":"Due to this hook being predicted, it is not called clientside in singleplayer at all, and in multiplayer it will not be called clientside if the weapon is switched with Player:SelectWeapon or the \"use\" console command, however it will be called clientside with the default weapon selection menu and when using CUserCmd:SelectWeapon"},"realm":"Shared","file":{"text":"gamemodes/base/entities/weapons/weapon_base/shared.lua","line":"114-L116"},"predicted":"Yes","rets":{"ret":{"text":"Return true to allow switching away from this weapon using `lastinv` command","name":"","type":"boolean"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DoDrawCrosshair","parent":"WEAPON","type":"hook","description":"Called when the crosshair is about to get drawn, and allows you to override it.\n\nThis function will **not** be called if `SWEP.DrawCrosshair` is set to false or if player is affected by Player:CrosshairDisable.","realm":"Client","args":{"arg":[{"text":"X coordinate of the crosshair.","name":"x","type":"number"},{"text":"Y coordinate of the crosshair.","name":"y","type":"number"}]},"rets":{"ret":{"text":"Return true to override the default crosshair.","name":"","type":"boolean"}}},"example":{"description":"Draws an outlined rectangle in place of the crosshair.","code":"function SWEP:DoDrawCrosshair( x, y )\n\tsurface.SetDrawColor( 0, 250, 255, 255 )\n\tsurface.DrawOutlinedRect( x - 32, y - 32, 64, 64 )\n\treturn true\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DoImpactEffect","parent":"WEAPON","type":"hook","description":{"text":"Called so the weapon can override the impact effects it makes.","note":["If the bullet was fired in a predicted environment, the hook will not be called on the `CLIENT` realm.","This hook will also be called when `WEAPON:GetOwner():FireBullets` is called. While in `MULTIPLAYER`, this hook will be called on the respective state, but in `SINGLEPLAYER`, this hook will always be called on the `CLIENT` realm even if `FireBullets` was called on the `SERVER`."]},"realm":"Shared","args":{"arg":[{"text":"A Structures/TraceResult from player's eyes to the impact point","name":"tr","type":"table"},{"text":"The damage type of bullet. See Enums/DMG","name":"damageType","type":"number"}]},"rets":{"ret":{"text":"Return true to not do the default thing - which is to call `UTIL_ImpactTrace` in C++","name":"","type":"boolean"}}},"example":{"description":"Makes the SWEP have the AR2 bullet impact effect.","code":"function SWEP:DoImpactEffect( tr, nDamageType )\n\n\tif ( tr.HitSky ) then return end\n\t\n\tlocal effectdata = EffectData()\n\teffectdata:SetOrigin( tr.HitPos + tr.HitNormal )\n\teffectdata:SetNormal( tr.HitNormal )\n\tutil.Effect( \"AR2Impact\", effectdata )\n\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"DrawHUD","parent":"WEAPON","type":"hook","description":"This hook allows you to draw on screen while this weapon is in use.\n\nIf you want to draw a custom crosshair, consider using WEAPON:DoDrawCrosshair instead.","realm":"Client"},"example":{"description":"Weapon:DrawHud() as defined in weapon_cs_base, with more notes","code":"function SWEP:DrawHUD()\n\n\t-- No crosshair when ironsights is on\n\tif ( self.Weapon:GetNWBool( \"Ironsights\" ) ) then return end\n\n\tlocal x, y -- local, always\n\n\t-- If we're drawing the local player, draw the crosshair where they're aiming\n\t-- instead of in the center of the screen.\n\tif ( self:GetOwner() == LocalPlayer() && self:GetOwner():ShouldDrawLocalPlayer() ) then\n\t\tlocal tr = util.GetPlayerTrace( self:GetOwner() )\n\t\ttr.mask = ( CONTENTS_SOLID+CONTENTS_MOVEABLE+CONTENTS_MONSTER+CONTENTS_WINDOW+CONTENTS_DEBRIS+CONTENTS_GRATE+CONTENTS_AUX ) -- List the enums that should mask the crosshair on camrea/thridperson\n\t\tlocal trace = util.TraceLine( tr )\n\t\t\n\t\tlocal coords = trace.HitPos:ToScreen()\n\t\tx, y = coords.x, coords.y\n\n\telse\n\t\tx, y = ScrW() / 2.0, ScrH() / 2.0 -- Center of screen\n\tend\n\t\n\tlocal scale = 10 * self.Primary.Cone\n\tlocal LastShootTime = self.Weapon:GetNWFloat( \"LastShootTime\", 0 )\n        -- Scale the size of the crosshair according to how long ago we fired our weapon\n\tscale = scale * (2 - math.Clamp( (CurTime() - LastShootTime) * 5, 0.0, 1.0 ))\n\t--                    R   G    B  Alpha\n\tsurface.SetDrawColor( 0, 255, 0, 255 ) -- Sets the color of the lines we're drawing\n\t\n-- Draw a crosshair\n\tlocal gap = 40 * scale\n\tlocal length = gap + 20 * scale\n        --                 x1,        y1, x2,     y2\n\tsurface.DrawLine( x - length, y, x - gap, y )\t-- Left\n\tsurface.DrawLine( x + length, y, x + gap, y )\t-- Right\n\tsurface.DrawLine( x, y - length, x, y - gap )\t-- Top\n\tsurface.DrawLine( x, y + length, x, y + gap )\t-- Bottom\n\nend","output":"Draws 4 lines for crosshairs"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawHUDBackground","parent":"WEAPON","type":"hook","description":"This hook allows you to draw on screen while this weapon is in use. This hook is called **before** WEAPON:DrawHUD and is equivalent of GM:HUDPaintBackground.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawWeaponSelection","parent":"WEAPON","type":"hook","description":"This hook draws the selection icon in the weapon selection menu.","realm":"Client","file":{"text":"gamemodes/base/entities/weapons/weapon_base/cl_init.lua","line":"34-L58"},"args":{"arg":[{"text":"X coordinate of the selection panel","name":"x","type":"number"},{"text":"Y coordinate of the selection panel","name":"y","type":"number"},{"text":"Width of the selection panel","name":"width","type":"number"},{"text":"Height of the selection panel","name":"height","type":"number"},{"text":"Alpha value of the selection panel","name":"alpha","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawWorldModel","parent":"WEAPON","type":"hook","description":{"text":"Called when we are about to draw the opaque parts of the weapon's world model.\n\nSee WEAPON:DrawWorldModelTranslucent for translucent pass callback.\nSee WEAPON:ViewModelDrawn for view model rendering.","rendercontext":{"hook":"true","type":"3D"}},"realm":"Client","args":{"arg":{"text":"The STUDIO_ flags for this render operation.","name":"flags","type":"number"}}},"example":[{"description":"The default action - render the world model.","code":"function SWEP:DrawWorldModel( flags )\n\tself:DrawModel( flags )\nend"},{"description":"Draw the world model on the player without bonemerging it.","code":"SWEP.WorldModel= \"some_model.mdl\"\n\nif CLIENT then\n\tlocal WorldModel = ClientsideModel(SWEP.WorldModel)\n\n\t-- Settings...\n\tWorldModel:SetSkin(1)\n\tWorldModel:SetNoDraw(true)\n\n\tfunction SWEP:DrawWorldModel()\n\t\tlocal _Owner = self:GetOwner()\n\n\t\tif (IsValid(_Owner)) then\n            -- Specify a good position\n\t\t\tlocal offsetVec = Vector(5, -2.7, -3.4)\n\t\t\tlocal offsetAng = Angle(180, 90, 0)\n\t\t\t\n\t\t\tlocal boneid = _Owner:LookupBone(\"ValveBiped.Bip01_R_Hand\") -- Right Hand\n\t\t\tif !boneid then return end\n\n\t\t\tlocal matrix = _Owner:GetBoneMatrix(boneid)\n\t\t\tif !matrix then return end\n\n\t\t\tlocal newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles())\n\n\t\t\tWorldModel:SetPos(newPos)\n\t\t\tWorldModel:SetAngles(newAng)\n\n            WorldModel:SetupBones()\n\t\telse\n\t\t\tWorldModel:SetPos(self:GetPos())\n\t\t\tWorldModel:SetAngles(self:GetAngles())\n\t\tend\n\n\t\tWorldModel:DrawModel()\n\tend\nend","output":{"image":[{"src":"DrawWorldModel_example2.JPG","alt":"thumb|left|The_World_model_is_in_the_Players_hand,_with_a_skin_applied."},{"src":"DrawWorldModel_example2_2.JPG","alt":"thumb|left|The_World_model_when_dropped."}]}}],"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawWorldModelTranslucent","parent":"WEAPON","type":"hook","description":{"text":"Called when we are about to draw the translucent parts of the weapon's world model.\n\nSee WEAPON:DrawWorldModel for opaque pass callback.\nSee WEAPON:ViewModelDrawn for view model rendering.","rendercontext":{"hook":"true","type":"3D"}},"realm":"Client","args":{"arg":{"text":"The STUDIO_ flags for this render operation.","name":"flags","type":"number"}}},"example":{"description":"Do the default action - render it without any changes.","code":"function SWEP:DrawWorldModelTranslucent( flags )\n\tself:DrawModel( flags )\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Equip","parent":"WEAPON","type":"hook","description":"Called when a player or NPC has picked the weapon up.","realm":"Server","args":{"arg":{"text":"The one who picked the weapon up. Can be Player or NPC.","name":"NewOwner","type":"Entity"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"EquipAmmo","parent":"WEAPON","type":"hook","description":"The player has picked up the weapon and has taken the ammo from it.\nThe weapon will be removed immediately after this call.","realm":"Server","args":{"arg":{"text":"The player who picked up the weapon","name":"ply","type":"Player"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"FireAnimationEvent","parent":"WEAPON","type":"hook","description":"Called before executing an animation event, such as a muzzle flash appearing or a shell ejecting.\n\nThis will only be called serverside for 3000-range events, and clientside for 5000-range and other events.","realm":"Shared","args":{"arg":[{"text":"Position of the effect.","name":"pos","type":"Vector"},{"text":"Angle of the effect.","name":"ang","type":"Angle"},{"text":"The event ID of the happened event. See [this page](http://developer.valvesoftware.com/wiki/Animation_Events).","name":"event","type":"number"},{"text":"Name or options of the event.","name":"options","type":"string"},{"text":"The source entity. This will be a viewmodel on the client and the weapon itself on the server","name":"source","type":"Entity"}]},"rets":{"ret":{"text":"Return true to disable the effect.","name":"","type":"boolean"}}},"example":[{"description":"Disables muzzle flashes. Taken from tool gun source code.","code":"function SWEP:FireAnimationEvent( pos, ang, event, options )\n\t\n\t-- Disables animation based muzzle event\n\tif ( event == 21 ) then return true end\t\n\n\t-- Disable thirdperson muzzle flash\n\tif ( event == 5003 ) then return true end\n\nend"},{"description":"Counter-Strike: Source-like muzzle flashes.","code":"function SWEP:FireAnimationEvent( pos, ang, event, options )\n\n\tif ( !self.CSMuzzleFlashes ) then return end\n\n\t-- CS Muzzle flashes\n\tif ( event == 5001 or event == 5011 or event == 5021 or event == 5031 ) then\n\t\n\t\tlocal data = EffectData()\n\t\tdata:SetFlags( 0 )\n\t\tdata:SetEntity( self:GetOwner():GetViewModel() )\n\t\tdata:SetAttachment( math.floor( ( event - 4991 ) / 10 ) )\n\t\tdata:SetScale( 1 ) -- Change me\n\n\t\tif ( self.CSMuzzleX ) then\n\t\t\tutil.Effect( \"CS_MuzzleFlash_X\", data )\n\t\telse\n\t\t\tutil.Effect( \"CS_MuzzleFlash\", data )\n\t\tend\n\t\n\t\treturn true\n\tend\n\nend"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"FreezeMovement","parent":"WEAPON","type":"hook","description":{"text":"This hook allows you to freeze players screen.","note":"Player will still be able to move or shoot"},"realm":"Client","rets":{"ret":{"text":"Return true to freeze moving the view","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetCapabilities","parent":"WEAPON","type":"hook","description":{"text":"This hook is for NPCs, you return what they should try to do with it.","warning":"Calling NPC:CapabilitiesGet in this hook on the same entity can cause infinite loops since that function adds the result of WEAPON:GetCapabilities on top of the return value."},"realm":"Server","file":{"text":"gamemodes/base/entities/weapons/weapon_base/init.lua","line":"73-L77"},"rets":{"ret":{"text":"A number defining what NPC should do with the weapon. Use the Enums/CAP.","name":"","type":"number{CAP}"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetNPCBulletSpread","parent":"WEAPON","type":"hook","description":"Called when the weapon is used by NPCs to determine how accurate the bullets fired should be.\n\nThe inaccuracy is simulated by changing the NPC:GetAimVector based on the value returned from this hook.","realm":"Server","args":{"arg":{"text":"How proficient the NPC is with this gun. See Enums/WEAPON_PROFICIENCY","name":"proficiency","type":"number"}},"rets":{"ret":{"text":"An amount of degrees the bullets should deviate from the NPC's NPC:GetAimVector. Default is 15.","name":"","type":"number"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetNPCBurstSettings","parent":"WEAPON","type":"hook","description":"Called when the weapon is used by NPCs to tell the NPC how to use this weapon. Controls how long the NPC can or should shoot continuously.","realm":"Server","rets":{"ret":[{"text":"Minimum amount of bullets per burst. Default is 1.","name":"","type":"number"},{"text":"Maximum amount of bullets per burst. Default is 1.","name":"","type":"number"},{"text":"Delay between each shot, aka firerate. Default is 1.","name":"","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetNPCRestTimes","parent":"WEAPON","type":"hook","description":"Called when the weapon is used by NPCs to tell the NPC how to use this weapon. Controls amount of time the NPC can rest (not shoot) between bursts.","realm":"Server","rets":{"ret":[{"text":"Minimum amount of time the NPC can rest (not shoot) between bursts in seconds. Default is `0.3` seconds.","name":"","type":"number"},{"text":"Maximum amount of time the NPC can rest (not shoot) between bursts in seconds. Default is `0.6` seconds.","name":"","type":"number"}]}},"realms":["Server"],"type":"Function"},
{"function":{"name":"GetTracerOrigin","parent":"WEAPON","type":"hook","description":"Allows you to override where the tracer effect comes from. ( Visual bullets )","realm":"Client","rets":{"ret":{"text":"The new position to start tracer effect from","name":"","type":"Vector"}}},"example":{"description":"Alternating muzzle flash position for dual wield gun, with view model and 3rd person view support.","code":"function SWEP:GetTracerOrigin()\n\tlocal Owner = self:GetOwner()\n\tlocal ent = Owner:ShouldDrawLocalPlayer() and self or Owner:GetViewModel()\n\n\tif ( self.Tracer ) then\n\t\tself.Tracer = false\n\t\tlocal att = ent:GetAttachment( ent:LookupAttachment( \"muzzle\" ) ) or ent:GetAttachment( ent:LookupAttachment( \"1\" ) )\n\t\treturn att.Pos\n\telse\n\t\tself.Tracer = true\n\t\tlocal att = ent:GetAttachment( ent:LookupAttachment( \"muzzle2\" ) ) or ent:GetAttachment( ent:LookupAttachment( \"2\" ) )\n\t\treturn att.Pos\n\tend\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetViewModelPosition","parent":"WEAPON","type":"hook","description":"This hook allows you to adjust view model position and angles.","realm":"Client","args":{"arg":[{"text":"Current position","name":"EyePos","type":"Vector"},{"text":"Current angle","name":"EyeAng","type":"Angle"}]},"rets":{"ret":[{"text":"New position","name":"","type":"Vector"},{"text":"New angle","name":"","type":"Angle"}]}},"example":{"description":"This moves and rotates the original viewmodel based on fixed offsets, changing its idle position in front of the player.","code":"-- Adjust these variables to move the viewmodel's position\nSWEP.IronSightsPos  = Vector(9.49, 10.5, -12.371)\nSWEP.IronSightsAng  = Vector(12, 65, -22.19)\n\nfunction SWEP:GetViewModelPosition(EyePos, EyeAng)\n\tlocal Mul = 1.0\n\n\tlocal Offset = self.IronSightsPos\n\n\tif (self.IronSightsAng) then\n        EyeAng = EyeAng * 1\n        \n\t\tEyeAng:RotateAroundAxis(EyeAng:Right(), \tself.IronSightsAng.x * Mul)\n\t\tEyeAng:RotateAroundAxis(EyeAng:Up(), \t\tself.IronSightsAng.y * Mul)\n\t\tEyeAng:RotateAroundAxis(EyeAng:Forward(),   self.IronSightsAng.z * Mul)\n\tend\n\n\tlocal Right \t= EyeAng:Right()\n\tlocal Up \t\t= EyeAng:Up()\n\tlocal Forward \t= EyeAng:Forward()\n\n\tEyePos = EyePos + Offset.x * Right * Mul\n\tEyePos = EyePos + Offset.y * Forward * Mul\n\tEyePos = EyePos + Offset.z * Up * Mul\n\t\n\treturn EyePos, EyeAng\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Holster","parent":"WEAPON","type":"hook","description":{"text":"Called when weapon tries to holster.","note":"This will only be called serverside when using Player:SelectWeapon as that function immediately switches the weapon out of prediction.","bug":[{"text":"This is called twice for every holster clientside, one in Prediction and one not.","issue":"2854"},{"text":"Before WEAPON:OnRemove is called, this function is only called serverside.","issue":"3133"}]},"realm":"Shared","predicted":"Yes","args":{"arg":{"text":"The weapon we are trying switch to.","name":"weapon","type":"Entity"}},"rets":{"ret":{"text":"Return true to allow weapon to holster.\n\nThis will not have an effect if weapon was switched away from using Player:SetActiveWeapon","name":"","type":"boolean"}}},"example":{"description":"Returns the weapon switched to when when the weapon is being holstered.","code":"function SWEP:Holster( wep )\n\tif IsFirstTimePredicted() then\n\t\tLocalPlayer():ChatPrint(\"Switched to: \"..(wep.PrintName or wep:GetClass()))\n\tend\n\treturn true\nend","output":"Switched to Toolgun\nSwitched to weapon_crowbar"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"HUDShouldDraw","parent":"WEAPON","type":"hook","description":"This hook determines which parts of the HUD to draw.","realm":"Client","args":{"arg":{"text":"The HUD element in question","name":"element","type":"string"}},"rets":{"ret":{"text":"Return false to hide this HUD element","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Initialize","parent":"WEAPON","type":"hook","description":{"text":"Called when the weapon entity is created.","note":"Entity:GetOwner will return NULL at this point because the weapon is not equpped by a player or NPC yet. Use WEAPON:Equip or WEAPON:Deploy if you need the owner to be valid.","bug":{"text":"This is not called serverside after a quicksave.","issue":"3015"}},"realm":"Shared"},"example":[{"description":"Sets the weapon hold type to SWEP.HoldType.","code":"function SWEP:Initialize()\n\n\tself:SetHoldType( self.HoldType )\n\nend"},{"description":"Fixes the function not being called clientside.","code":"function SWEP:Initialize()\n\tself.m_bInitialized = true\n\n\t-- Other code\nend\n\nfunction SWEP:Think()\n\tif (not self.m_bInitialized) then\n\t\tself:Initialize()\n\tend\n\n\t-- Other code\nend"}],"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"KeyValue","parent":"WEAPON","type":"hook","description":"Called when the engine sets a value for this scripted weapon.\n\nSee GM:EntityKeyValue for a hook that works for all entities.\n\n\nSee ENTITY:KeyValue for an  hook that works for scripted entities.","realm":"Server","args":{"arg":[{"text":"The key that was affected.","name":"key","type":"string"},{"text":"The new value.","name":"value","type":"string"}]},"rets":{"ret":{"text":"Return true to suppress this KeyValue or return false or nothing to apply this key value.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"NPCShoot_Primary","parent":"WEAPON","type":"hook","description":{"text":"Called internally during `TASK_RANGE_ATTACK1 --> OnRangeAttack1`. This allows you to separate your SWEPs primary firing function from players and NPCs. \n\nTo get the delay the NPC will fire again, you can call `self:GetOwner():GetInternalVariable(\"m_flNextAttack\")`","note":"This hook is called internally only for NPCs that has `CAP_USE_SHOT_REGULATOR` set."},"realm":"Server","args":{"arg":[{"text":"The world position the NPC will use as attack starting position. You can create your projectiles here.","name":"shootPos","type":"Vector","default":"GetShootPos()"},{"text":"The direction the NPC wants to shoot at.","name":"shootDir","type":"Vector","default":"GetAimVector()"}]},"file":{"text":"gamemodes/base/entities/weapons/weapon_base/init.lua","line":"93"}},"realms":["Server"],"type":"Function"},
{"function":{"name":"NPCShoot_Secondary","parent":"WEAPON","type":"hook","description":"A utility function to seperate your SWEPs secondary firing from players. \n\nUnlike WEAPON:NPCShoot_Primary, this won't be called by the engine for `TASK_RANGE_ATTACK2`.","realm":"Server","args":{"arg":[{"text":"The world position the NPC will use as attack starting position. You can create your projectiles here.","name":"shootPos","type":"Vector","default":"GetShootPos()"},{"text":"The direction the NPC wants to shoot at.","name":"shootDir","type":"Vector","default":"GetAimVector()"}]},"file":{"text":"gamemodes/base/entities/weapons/weapon_base/init.lua","line":"83"}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnDrop","parent":"WEAPON","type":"hook","description":"Called when weapon is dropped by Player:DropWeapon.\n\nSee also WEAPON:OwnerChanged.","realm":"Server","args":{"arg":{"text":"The entity that dropped the weapon.","name":"owner","type":"Entity","added":"2025.02.12"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"OnReloaded","parent":"WEAPON","type":"hook","description":"Called whenever the weapons Lua script is reloaded.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OnRemove","parent":"WEAPON","type":"hook","description":"Called when the Scripted Weapon is about to be removed.\n\nEntity:GetOwner may be unset at this point, see WEAPON:OnDrop and WEAPON:OwnerChanged.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OnRestore","parent":"WEAPON","type":"hook","description":"Called when the weapon entity is reloaded from a Source Engine save (not the Sandbox saves or dupes) or on a changelevel (for example Half-Life 2 campaign level transitions).\n\nFor the duplicator callbacks, see ENTITY:OnDuplicated.\n\nSee also saverestore for relevant functions.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"OwnerChanged","parent":"WEAPON","type":"hook","description":"Called when weapon is dropped or picked up by a new player. This can be called clientside for all players on the server if the weapon has no owner and is picked up.\n\nSee also WEAPON:OnDrop.","realm":"Shared"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PostDrawViewModel","parent":"WEAPON","type":"hook","description":{"text":"Called after the view model has been drawn while the weapon in use.\n\nThis hook relies on default implementation of GM:PostDrawViewModel. If it appears to not work, it may have been overwritten/broken by the currently active gamemode or other addons.\n\nWEAPON:ViewModelDrawn is an alternative hook which is always called before GM:PostDrawViewModel.\n\nSee also WEAPON:PreDrawViewModel.","rendercontext":{"hook":"true","type":"3D"}},"realm":"Client","args":{"arg":[{"text":"This is the view model entity after it is drawn","name":"vm","type":"Entity"},{"text":"This is the weapon that is from the view model (same as self)","name":"weapon","type":"Weapon"},{"text":"The owner of the view model","name":"ply","type":"Player"},{"text":"The STUDIO_ flags for this render operation.","name":"flags","type":"number","added":"2025.12.16"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PreDrawViewModel","parent":"WEAPON","type":"hook","description":{"text":"Allows you to modify viewmodel while the weapon in use before it is drawn.\n\nThis hook relies on default implementation of GM:PreDrawViewModel. If it appears to not work, it may have been overwritten/broken by the currently active gamemode or other addons.\n\nSee also WEAPON:ViewModelDrawn and WEAPON:PostDrawViewModel.","rendercontext":{"hook":"true","type":"3D"}},"realm":"Client","args":{"arg":[{"text":"This is the view model entity before it is drawn.","name":"vm","type":"Entity"},{"text":"This is the weapon that is from the view model.","name":"weapon","type":"Weapon"},{"text":"The the owner of the view model.","name":"ply","type":"Player"},{"text":"The STUDIO_ flags for this render operation.","name":"flags","type":"number","added":"2025.12.16"}]},"rets":{"ret":{"text":"Return `true` to prevent the default action of rendering the view model. `PostDrawViewModel` will NOT be called in this scenario.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PrimaryAttack","parent":"WEAPON","type":"hook","description":"Called when primary attack button ( +attack ) is pressed.\n\nWhen in singleplayer, this function is only called in the server realm. When in multiplayer, the hook will be called on both the server and the client in order to allow for Prediction.\n\nYou can force the hook to always be called on client like this:\n\n```\nif ( game.SinglePlayer() ) then self:CallOnClient( \"PrimaryAttack\" ) end\n```\n\n\nNote that due to prediction, in multiplayer SWEP:PrimaryAttack is called multiple times per one \"shot\" with the gun. To work around that, use Global.IsFirstTimePredicted.","realm":"Shared","file":{"text":"gamemodes/base/entities/weapons/weapon_base/shared.lua","line":"42-L60"},"predicted":"Yes"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"PrintWeaponInfo","parent":"WEAPON","type":"hook","description":"A convenience function that draws the weapon info box, used in WEAPON:DrawWeaponSelection.","realm":"Client","file":{"text":"gamemodes/base/entities/weapons/weapon_base/cl_init.lua","line":"63-L89"},"args":{"arg":[{"text":"The x co-ordinate of box position","name":"x","type":"number"},{"text":"The y co-ordinate of box position","name":"y","type":"number"},{"text":"Alpha value for the box","name":"alpha","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Reload","parent":"WEAPON","type":"hook","description":"Called when the reload key ( +reload ) is pressed.","realm":"Shared","predicted":"Yes"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"RenderScreen","parent":"WEAPON","type":"hook","description":{"text":"Called every frame just before GM:RenderScene.\n\nUsed by the Tool Gun to render view model screens (TOOL:DrawToolScreen).","note":"Materials rendered in this hook require $ignorez parameter to draw properly."},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SecondaryAttack","parent":"WEAPON","type":"hook","description":"Called when secondary attack button ( +attack2 ) is pressed.\n\nFor issues with this hook being called rapidly on the client side, see the global function Global.IsFirstTimePredicted.","realm":"Shared","file":{"text":"gamemodes/base/entities/weapons/weapon_base/shared.lua","line":"66-L84"},"predicted":"Yes"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetupDataTables","parent":"WEAPON","type":"hook","description":"Called when the SWEP should set up its  Data Tables.","realm":"Shared"},"example":{"description":"Sets up networked variables, adds functions SetDamage, GetDamage, SetMuzzlePos and GetMuzzlePos.","code":"function SWEP:SetupDataTables()\n\tself:NetworkVar( \"Float\", 0, \"Damage\" )\n\tself:NetworkVar( \"Vector\", 0, \"MuzzlePos\" )\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"SetWeaponHoldType","parent":"WEAPON","type":"hook","description":{"text":"Sets the hold type of the weapon. This must be called on **both** the server and the client to work properly.","note":"You should avoid calling this function and call Weapon:SetHoldType now."},"realm":"Shared","args":{"arg":{"text":"Name of the hold type. You can find all default hold types here","name":"name","type":"string"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ShootBullet","parent":"WEAPON","type":"hook","description":"A convenient function to shoot bullets.","realm":"Shared","file":{"text":"gamemodes/base/entities/weapons/weapon_base/shared.lua","line":"132-L148"},"args":{"arg":[{"text":"The damage of the bullet","name":"damage","type":"number"},{"text":"Amount of bullets to shoot","name":"num_bullets","type":"number"},{"text":"Spread of bullets","name":"aimcone","type":"number"},{"text":"Ammo type of the bullets","name":"ammo_type","type":"string","default":"self.Primary.Ammo"},{"text":"Force of the bullets","name":"force","type":"number","default":"1"},{"text":"Show a tracer on every x bullets","name":"tracer","type":"number","default":"5"}]}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ShootEffects","parent":"WEAPON","type":"hook","description":"A convenience function to create shoot effects.","realm":"Shared","file":{"text":"gamemodes/base/entities/weapons/weapon_base/shared.lua","line":"122-L130"}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ShouldDrawViewModel","parent":"WEAPON","type":"hook","description":"Called to determine if the view model should be drawn or not.","realm":"Client","rets":{"ret":{"text":"Return true to draw the view model, false otherwise.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ShouldDropOnDie","parent":"WEAPON","type":"hook","description":"Should this weapon be dropped when its owner dies?\n\nThis only works if the player has Player:ShouldDropWeapon set to true.","realm":"Server","rets":{"ret":{"text":"Return true to drop the weapon, false otherwise. Default ( if you don't return anything ) is false.","name":"","type":"boolean"}}},"realms":["Server"],"type":"Function"},
{"function":{"name":"TakePrimaryAmmo","parent":"WEAPON","type":"hook","description":"A convenience function to remove primary ammo from clip.","realm":"Shared","file":{"text":"gamemodes/base/entities/weapons/weapon_base/shared.lua","line":"162-L175"},"args":{"arg":{"text":"Amount of primary ammo to remove","name":"amount","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"TakeSecondaryAmmo","parent":"WEAPON","type":"hook","description":"A convenience function to remove secondary ammo from clip.","realm":"Shared","file":{"text":"gamemodes/base/entities/weapons/weapon_base/shared.lua","line":"181-L194"},"args":{"arg":{"text":"How much of secondary ammo to remove","name":"amount","type":"number"}}},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Think","parent":"WEAPON","type":"hook","description":{"text":"Called when the weapon thinks.\n\nThis hook won't be called during the deploy animation and when using Weapon:DefaultReload. \n\n\n\nDespite being a predicted hook, this hook is called clientside in single player (for your convenience), however it will not be recognized as a predicted hook via Player:GetCurrentCommand, and will run more often in this case.\n\nThis hook will be called before Player movement is processed on the client, and after on the server.","note":["If you wish for this hook to be called during the deploy animation, add the following to the model's **ACT_VM_DRAW** sequence: `node \"Ready\"`","This hook only runs while the weapon is in players hands. It does not run while it is carried by an NPC."],"bug":{"text":"This will not be run during deploy animations after a serverside-only deploy. This usually happens after picking up and dropping an object with +use.","issue":"2855"}},"realm":"Shared","predicted":"Yes"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"Tick","parent":"WEAPON","type":"hook","description":{"text":"Alias of Weapon:Think.","deprecated":"Use Weapon:Think instead."},"realm":"Shared","predicted":"Yes"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"TranslateActivity","parent":"WEAPON","type":"hook","description":"Translate a generic activity into a more specific activity, such as holdtype-specific activities.\n\nThe translated activity is then used to request animations from the owner's model via Entity:SelectWeightedSequence and similar functions.\n\nFor example, `ACT_MP_RUN` becomes `ACT_HL2MP_RUN_PISTOL`.","realm":"Shared","args":{"arg":{"text":"The activity to translate","name":"act","type":"number{ACT}"}},"rets":{"ret":{"text":"The translated activity","name":"act","type":"number{ACT}"}}},"example":{"description":"Default action","code":"function SWEP:TranslateActivity( act )\n\n\tif ( self:GetOwner():IsNPC() ) then\n\t\tif ( self.ActivityTranslateAI[ act ] ) then\n\t\t\treturn self.ActivityTranslateAI[ act ]\n\t\tend\n\t\treturn -1\n\tend\n\n\tif ( self.ActivityTranslate[ act ] != nil ) then\n\t\treturn self.ActivityTranslate[ act ]\n\tend\n\n\treturn -1\n\nend"},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"TranslateFOV","parent":"WEAPON","type":"hook","description":{"text":"Allows to change players field of view while player holds the weapon.","note":"This hook must be defined shared and return same value on both to properly affect Area Portals."},"realm":"Shared","args":{"arg":{"text":"The current/default FOV.","name":"fov","type":"number"}},"rets":{"ret":{"text":"The target FOV.","name":"","type":"number"}}},"example":{"description":"Reduces players FOV by 30.","code":"function SWEP:TranslateFOV( fov )\n\treturn fov - 30\nend","output":"Players view is zoomed in."},"realms":["Server","Client"],"type":"Function"},
{"function":{"name":"ViewModelDrawn","parent":"WEAPON","type":"hook","description":{"text":"Called straight after the view model has been drawn. This is called before GM:PostDrawViewModel and WEAPON:PostDrawViewModel.\n\nSee WEAPON:DrawWorldModel for world model rendering.\n\nSee also WEAPON:PreDrawViewModel and WEAPON:PostDrawViewModel.","rendercontext":{"hook":"true","type":"3D"}},"realm":"Client","args":{"arg":[{"text":"Players view model","name":"ViewModel","type":"Entity"},{"text":"The STUDIO_ flags for this render operation.","name":"flags","type":"number","added":"2025.12.10"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OpenMenu","parent":"ContentHeader","type":"panelfunc","description":"Creates a Global.DermaMenu and adds a delete option before opening the menu","args":{"arg":[{"name":"style","type":"string"},{"text":"A Populate Hook like PopulateEntities","name":"hookname","type":"string","default":"PopulateContent"}]},"realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contentheader.lua","line":"96-L105"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ToTable","parent":"ContentHeader","type":"panelfunc","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contentheader.lua","line":"44-L53"},"description":"\n\t","args":{"arg":{"name":"bigtable","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetColor","parent":"ContentIcon","type":"panelfunc","description":"An Global.AccessorFunc that returns the color set by ContentIcon:SetColor","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenticon.lua","line":"13"},"rets":{"ret":{"text":"See Color","name":"","type":"Color"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetContentType","parent":"ContentIcon","type":"panelfunc","description":"An Global.AccessorFunc that returns the content type used to save and restore the content icon in a spawnlist.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenticon.lua","line":"14"},"rets":{"ret":{"text":"The content type, for example \"entity\" or \"weapon\".","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetNPCWeapon","parent":"ContentIcon","type":"panelfunc","description":"An Global.AccessorFunc that returns a table of weapon classes for the content icon with \"NPC\" content type to be randomly chosen from when user tries to spawn the NPC.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenticon.lua","line":"16"},"rets":{"ret":{"text":"A table of weapon classes to be chosen from when user tries to spawn the NPC.","name":"","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetSpawnName","parent":"ContentIcon","type":"panelfunc","description":"An Global.AccessorFunc that returns the internal \"name\" for the content icon, usually a class name for an entity.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenticon.lua","line":"15"},"rets":{"ret":{"text":"Internal \"name\" to be used when user left clicks the icon.","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OpenMenu","parent":"ContentIcon","type":"panelfunc","description":"A hook for override, by default does nothing. Called when user right clicks on the content icon, you are supposed to open a Global.DermaMenu here with additional options.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenticon.lua","line":"104-L105"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetAdminOnly","parent":"ContentIcon","type":"panelfunc","description":"An Global.AccessorFunc that sets whether the content item is admin only. This makes the icon to display a admin icon in the top left corner of the icon.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenticon.lua","line":"17"},"args":{"arg":{"text":"Whether this content should be admin only or not","name":"adminOnly","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetColor","parent":"ContentIcon","type":"panelfunc","description":"An Global.AccessorFunc that sets the color for the content icon. Currently is not used by the content icon panel.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenticon.lua","line":"13"},"args":{"arg":{"text":"The color to set. See Color","name":"clr","type":"Color"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetContentType","parent":"ContentIcon","type":"panelfunc","description":"An Global.AccessorFunc that sets the content type used to save and restore the content icon in a spawnlist.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenticon.lua","line":"14"},"args":{"arg":{"text":"The content type, for example \"entity\" or \"weapon\"","name":"type","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetMaterial","parent":"ContentIcon","type":"panelfunc","description":"Sets the material to be displayed as the content icon.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenticon.lua","line":"66-L88"},"args":{"arg":{"text":"Path to the icon to use.","name":"path","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetName","parent":"ContentIcon","type":"panelfunc","description":"Sets the tool tip and the \"nice\" name to be displayed by the content icon.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenticon.lua","line":"58-L64"},"args":{"arg":{"text":"\"Nice\" name to display.","name":"name","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetNPCWeapon","parent":"ContentIcon","type":"panelfunc","description":"An Global.AccessorFunc that sets a table of weapon classes for the content icon with \"NPC\" content type to be randomly chosen from when user tries to spawn the NPC.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenticon.lua","line":"16"},"args":{"arg":{"text":"A table of weapon classes to be chosen from when user tries to spawn the NPC.","name":"weapons","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetSpawnName","parent":"ContentIcon","type":"panelfunc","description":"An Global.AccessorFunc that sets the internal \"name\" for the content icon, usually a class name for an entity.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contenticon.lua","line":"15"},"args":{"arg":{"text":"Internal \"name\" to be used when user left clicks the icon.","name":"name","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"CreateSaveNotification","parent":"ContentSidebar","type":"panelfunc","description":"Creates a Save Notification which will be shown when SANDBOX:SpawnlistContentChanged has been called.","args":{"arg":[{"name":"style","type":"string"},{"text":"A Populate Hook like PopulateEntities","name":"hookname","type":"string","default":"PopulateContent"}]},"realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contentsidebar.lua","line":"42-L84"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"EnableModify","parent":"ContentSidebar","type":"panelfunc","description":"Internally calls ContentSidebar:EnableSearch, ContentSidebar:CreateSaveNotification and creates a ContentSidebarToolbox which is accessible under ContentSidebar.Toolbox. Call the Hook SANDBOX:OpenToolbox to open the created Toolbox","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contentsidebar.lua","line":"25-L40"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"EnableSearch","parent":"ContentSidebar","type":"panelfunc","description":"Creates a search bar which will be displayed over the Nodes.","args":{"arg":[{"name":"style","type":"string"},{"text":"A Populate Hook like PopulateEntities","name":"hookname","type":"string","default":"PopulateContent"}]},"realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/contentsidebar.lua","line":"20-L23"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ControlValues","parent":"ContextBase","type":"panelfunc","description":"Called by spawnmenu functions (when creating a context menu) to fill this control with data.","file":{"text":"lua/vgui/contextbase.lua","line":"20-L25"},"realm":"Client","args":{"arg":{"text":"A two-membered table:\n* string convar - The console variable to use. Calls ContextBase:SetConVar.\n* string label - The text to display inside the control's label.","name":"contextData","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ConVar","parent":"ContextBase","type":"panelfunc","description":"Returns the ConVar for the panel to change/handle, set by ContextBase:SetConVar","realm":"Client","file":{"text":"lua/vgui/contextbase.lua","line":"16-L18"},"rets":{"ret":{"text":"The ConVar for the panel to change.","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetConVar","parent":"ContextBase","type":"panelfunc","description":"Sets the ConVar for the panel to change/handle.","realm":"Client","file":{"text":"lua/vgui/contextbase.lua","line":"12-L14"},"args":{"arg":{"text":"The ConVar for the panel to change.","name":"cvar","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"TestForChanges","parent":"ContextBase","type":"panelfunc","description":"You should override this function and use it to check whether your convar value changed.","realm":"Client","file":{"text":"lua/vgui/contextbase.lua","line":"40-L45"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddControl","parent":"ControlPanel","type":"panelfunc","description":{"text":"Adds a control to the control panel.","deprecated":"It is recommended to use DForm's members instead."},"file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controlpanel.lua","line":"148-L431"},"realm":"Client","args":{"arg":[{"text":"The control type to add. The complete list is:\n* header\n* textbox\n* label\n* checkbox/toggle\n* slider\n* propselect\n* matselect\n* ropematerial\n* button\n* numpad\n* color\n* combobox\n* listbox\n* materialgallery","name":"type","type":"string"},{"text":"Each control takes their own table structure. You may search \"AddControl\" on GitHub for examples.\n\nHere is a full list of each type and the table members it requires:\n\n* header\n\t* description\n\n* textbox:\n\t* label (def: \"Untitled\")\n\t* command\n\n* label:\n\t* text\n\n* checkbox, toggle (same thing):\n\t* label (def: \"Untitled\")\n\t* command\n\t* help (boolean, if true assumes label is a language string (`#tool.toolname.stuff`) and adds `.help` at the end)\n\n* slider: (DForm:NumSlider)\n\t* type (optional string, if equals `float` then 2 digits after the decimal will be used, otherwise 0)\n\t* label (def: `Untitled`)\n\t* command\n\t* min (def: `0`)\n\t* max (def: `100`)\n\t* help (boolean, see above)\n\n* propselect:\n\t* (data goes directly to PropSelect's :ControlValues(data))\n\n* matselect:\n\t* (data goes directly to MatSelect's :ControlValues(data))\n\n* ropematerial:\n\t* convar (notice: NOT called command this time!)\n\n* button:\n\t* label / text (if label is missing will use text. Def: `No Label`)\n\t* command\n\n* numpad:\n\t* command\n\t* command2\n\t* label\n\t* label2\n\n* color:\n\t* label\n\t* red (convar)\n\t* green (convar)\n\t* blue (convar)\n\t* alpha (convar)\n\n* combobox:\n\t* menubutton (if doesn't equal \"1\", becomes a listbox)\n\t* folder\n\t* options (optional, ha)\n\t* cvars (optional)\n\n* listbox:\n\t* height (if set, becomes DListView, otherwise is CtrlListBox)\n\t* label (def: `unknown`)\n\t* options (optional)\n\n* materialgallery:\n\t* width (def: `32`)\n\t* height (def: `32`)\n\t* rows (def: `4`)\n\t* convar\n\t* options","name":"controlinfo","type":"table"}]},"rets":{"ret":{"text":"Returns created control","name":"","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddPanel","parent":"ControlPanel","type":"panelfunc","description":"Adds an item by calling DForm:AddItem.","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controlpanel.lua","line":"29-L34"},"realm":"Client","args":{"arg":{"text":"Panel to add as an item to the control panel.","name":"panel","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ClearControls","parent":"ControlPanel","type":"panelfunc","description":{"text":"Alias of Panel:Clear.","deprecated":""},"realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controlpanel.lua","line":"19-L21"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ColorPicker","parent":"ControlPanel","type":"panelfunc","description":"Creates a CtrlColor (a color picker) panel and adds it as an item.","added":"2021.12.15","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controlpanel.lua","line":"94-L113"},"args":{"arg":[{"text":"The label for this color picker.","name":"label","type":"string"},{"text":"Name of the convar that will store the R component of the selected color.","name":"convarR","type":"string"},{"text":"Name of the convar that will store the G component of the selected color.","name":"convarG","type":"string"},{"text":"Name of the convar that will store the B component of the selected color.","name":"convarB","type":"string"},{"text":"Name of the convar that will store the A component of the selected color.","name":"convarA","type":"string","default":"nil"}]},"rets":{"ret":{"text":"The created CtrlColor panel.","name":"","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ControlValues","parent":"ControlPanel","type":"panelfunc","description":"Sets control values of the control panel.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controlpanel.lua","line":"138-L145"},"args":{"arg":{"text":"A two-membered table:\n* boolean closed - Sets if the control panel should be unexpanded.\n* string label - The text to display inside the control's label.","name":"data","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"FillViaFunction","parent":"ControlPanel","type":"panelfunc","description":{"text":"Calls the given function with this panel as the only argument. Used by the spawnmenu to populate the control panel.","deprecated":"This is dumb. Just call the builder function directly."},"realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controlpanel.lua","line":"132-L136"},"args":{"arg":{"text":"The builder function.","name":"func","type":"function","callback":{"arg":{"type":"ControlPanel","name":"panelToPopulate"}}}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetEmbeddedPanel","parent":"ControlPanel","type":"panelfunc","description":"Returns this control panel.","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controlpanel.lua","line":"23-L27"},"realm":"Client","rets":{"ret":{"text":"The same control panel the function is being called on.","name":"","type":"ControlPanel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"KeyBinder","parent":"ControlPanel","type":"panelfunc","description":"Creates a CtrlNumPad (a Sandbox key binder) panel and adds it as an item.","added":"2021.12.15","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controlpanel.lua","line":"117-L133"},"args":{"arg":[{"text":"The label for the left key binder.","name":"label1","type":"string"},{"text":"The name of the convar that will store the key code for player selected key of the left key binder.","name":"convar1","type":"string"},{"text":"If set and `convar2` is set, the label for the right key binder.","name":"label2","type":"string","default":"nil"},{"text":"If set and `label2` is set, the name of the convar that will store the key code for player selected key of the right key binder.","name":"convar2","type":"string","default":"nil"}]},"rets":{"ret":{"text":"The created CtrlNumPad panel.","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"MatSelect","parent":"ControlPanel","type":"panelfunc","description":"Creates a MatSelect panel and adds it as an item.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controlpanel.lua","line":"36-L57"},"args":{"arg":[{"text":"Calls MatSelect:SetConVar with this value.","name":"convar","type":"string"},{"text":"If specified, calls MatSelect:AddMaterial(key, value) for each table entry. If the table key is a number, the function will instead be called with the value as both arguments.","name":"options","type":"table","default":"nil"},{"text":"If specified, calls MatSelect:SetAutoHeight with this value.","name":"autostretch","type":"boolean","default":"nil"},{"text":"If specified, calls MatSelect:SetItemWidth with this value.","name":"width","type":"number","default":"nil"},{"text":"If specified, calls MatSelect:SetItemHeight with this value.","name":"height","type":"number","default":"nil"}]},"rets":{"ret":{"text":"The created MatSelect panel.","name":"","type":"MatSelect"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ToolPresets","parent":"ControlPanel","type":"panelfunc","description":"Creates a ControlPresets panel and adds it as an item.","added":"2021.12.15","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controlpanel.lua","line":"59-L74"},"args":{"arg":[{"text":"The preset group. Must be unique.","name":"group","type":"string"},{"text":"A table of convar names as keys and their defaults as the values. Typically the output of Tool:BuildConVarList.","name":"cvarList","type":"table"}]},"rets":{"ret":{"text":"The created ControlPresets panel.","name":"","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddConVar","parent":"ControlPresets","type":"panelfunc","description":"Adds a convar to be managed by this control.","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controls/control_presets.lua","line":"110-L114"},"realm":"Client","args":{"arg":{"text":"The convar to add.","name":"convar","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddOption","parent":"ControlPresets","type":"panelfunc","description":"Adds option to the DComboBox subelement with DComboBox:AddChoice then adds it to the `options` subtable","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controls/control_presets.lua","line":"48-L54"},"args":{"arg":[{"text":"Name","name":"strName","type":"string"},{"text":"data","name":"data","type":"any"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Clear","parent":"ControlPresets","type":"panelfunc","description":"Runs Panel:Clear on the Internal DComboBox","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controls/control_presets.lua","line":"48-L54"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetConVars","parent":"ControlPresets","type":"panelfunc","description":"Get a list of all Console Variables being managed by this panel.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controls/control_presets.lua","line":"116-L120"},"rets":{"ret":{"text":"numbered table of convars","name":"","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnSelect","parent":"ControlPresets","type":"panelfunc","description":{"text":"Checks if Data is valid then uses Global.pairs to iterate over the data parameter and run each entry using Global.RunConsoleCommand","validate":"Index and Value parameters appear to not be used. Further testing should be done to confirm"},"realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controls/control_presets.lua","line":"62-L70"},"args":{"arg":[{"text":"Name","name":"index","type":"number"},{"name":"value","type":"any"},{"name":"data","type":"table"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OpenPresetEditor","parent":"ControlPresets","type":"panelfunc","description":"Creates and opens PresetEditor","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controls/control_presets.lua","line":"97-L108"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"QuickSaveInternal","parent":"ControlPresets","type":"panelfunc","description":"","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controls/control_presets.lua","line":"72-L80"},"args":{"arg":{"name":"text","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"QuickSavePreset","parent":"ControlPresets","type":"panelfunc","description":"","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controls/control_presets.lua","line":"82-L95"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ReloadPresets","parent":"ControlPresets","type":"panelfunc","description":"","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controls/control_presets.lua","line":"129-L149"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetLabel","parent":"ControlPresets","type":"panelfunc","description":"Set the name label text.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controls/control_presets.lua","line":"42-L46"},"args":{"arg":{"text":"The text to put in the label","name":"name","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetOptions","parent":"ControlPresets","type":"panelfunc","description":"Uses table.Merge to combine the provided table into the `Options` subtable","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controls/control_presets.lua","line":"56-L60"},"args":{"arg":{"text":"Options","name":"Options","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetPreset","parent":"ControlPresets","type":"panelfunc","description":"","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controls/control_presets.lua","line":"122-L127"},"args":{"arg":{"text":"Name of preset to set","name":"strName","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Update","parent":"ControlPresets","type":"panelfunc","description":"Alias of ControlPresets:ReloadPresets","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controls/control_presets.lua","line":"48-L54"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetValue1","parent":"CtrlNumPad","type":"panelfunc","description":"The value (key bind) of the first DBinder.","realm":"Client","added":"2025.07.15","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controls/ctrlnumpad.lua","line":"58-L64"},"rets":{"ret":{"text":"The key bind or `KEY_NONE`.","name":"keyBind","type":"number{KEY}"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetValue2","parent":"CtrlNumPad","type":"panelfunc","description":"The value (key bind) of the second DBinder, if it's enabled.","realm":"Client","added":"2025.07.15","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controls/ctrlnumpad.lua","line":"66-L72"},"rets":{"ret":{"text":"The key bind or `KEY_NONE`.","name":"keyBind","type":"number{KEY}"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetConVar1","parent":"CtrlNumPad","type":"panelfunc","description":"The name of the convar that will store the key code for player selected key of the left key binder.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controls/ctrlnumpad.lua","line":"45-L48"},"args":{"arg":{"text":"The convar that will be used in the event of a key change by a player.","name":"cvar","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetConVar2","parent":"CtrlNumPad","type":"panelfunc","description":"If set and label2 is set, the name of the convar that will store the key code for player selected key of the right key binder.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controls/ctrlnumpad.lua","line":"53-L56"},"args":{"arg":{"text":"The convar that will be used in the event of a key change by a player.","name":"cvar","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetLabel1","parent":"CtrlNumPad","type":"panelfunc","description":"The label for the left key binder.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controls/ctrlnumpad.lua","line":"29-L32"},"args":{"arg":{"text":"The label for the left key binder.","name":"txt","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetLabel2","parent":"CtrlNumPad","type":"panelfunc","description":"If set and convar2 is set, the label for the right key binder.","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/controls/ctrlnumpad.lua","line":"37-L40"},"args":{"arg":{"text":"The label for the right key binder.","name":"txt","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"CaptureMouse","parent":"DAdjustableModelPanel","type":"panelfunc","description":{"text":"Used by the panel to perform mouse capture operations when adjusting the model.","internal":""},"realm":"Client","file":{"text":"lua/vgui/dadjustablemodelpanel.lua","line":"61-L75"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"FirstPersonControls","parent":"DAdjustableModelPanel","type":"panelfunc","description":{"text":"Used to adjust the perspective in the model panel via the keyboard, when the right mouse button is used.","internal":""},"realm":"Client","file":{"text":"lua/vgui/dadjustablemodelpanel.lua","line":"92-L146"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetFirstPerson","parent":"DAdjustableModelPanel","type":"panelfunc","description":"Gets whether mouse and keyboard-based adjustment of the perspective has been enabled. See DAdjustableModelPanel:SetFirstPerson for more information.\n\nThis is an Global.AccessorFunc","realm":"Client","file":{"text":"lua/vgui/dadjustablemodelpanel.lua","line":"4"},"rets":{"ret":{"text":"Whether first person controls are enabled. See DAdjustableModelPanel:FirstPersonControls.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetMovementScale","parent":"DAdjustableModelPanel","type":"panelfunc","description":"Returns the movement speed multiplier set by DAdjustableModelPanel:SetMovementScale.\n\n\tAn Global.AccessorFunc","realm":"Client","added":"2024.05.09","file":{"text":"lua/vgui/dadjustablemodelpanel.lua","line":"5"},"rets":{"ret":{"text":"The movement scale, where `1` is normal, `2` is double, etc.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetFirstPerson","parent":"DAdjustableModelPanel","type":"panelfunc","description":"Enables mouse and keyboard-based adjustment of the perspective.\n\nThis is set to `true` automatically each time mouse capture is enabled, and hence doesn't serve as a usable setting, other than to disable this functionality after the PANEL:OnMousePressed event.\n\nAn Global.AccessorFunc","realm":"Client","file":{"text":"lua/vgui/dadjustablemodelpanel.lua","line":"4"},"args":{"arg":{"text":"Whether to enable/disable first person controls. See DAdjustableModelPanel:FirstPersonControls.","name":"enable","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetMovementScale","parent":"DAdjustableModelPanel","type":"panelfunc","description":"Sets the movement speed multiplier. Currently this only affects first person camera controls.","realm":"Client","file":{"text":"lua/vgui/dadjustablemodelpanel.lua","line":"5"},"added":"2024.05.09","args":{"arg":{"text":"The movement scale, where `1` is normal, `2` is double, etc.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnChange","parent":"DAlphaBar","type":"panelhook","description":"Called when user changes the desired alpha value with the control. This function is meant to be overridden","realm":"Client and Menu","file":{"text":"lua/vgui/dalphabar.lua","line":"45-L46"},"args":{"arg":{"text":"The new alpha value","name":"alpha","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetBarColor","parent":"DAlphaBar","type":"panelfunc","description":"Returns the base color of the alpha bar. This is the color for which the alpha channel is being modified. An Global.AccessorFunc","realm":"Client and Menu","file":{"text":"lua/vgui/dalphabar.lua","line":"8"},"rets":{"ret":{"text":"The current base Color.","name":"","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetValue","parent":"DAlphaBar","type":"panelfunc","description":"Returns the alpha value of the alpha bar. An Global.AccessorFunc","realm":"Client and Menu","file":{"text":"lua/vgui/dalphabar.lua","line":"7"},"rets":{"ret":{"text":"The current alpha value.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetBarColor","parent":"DAlphaBar","type":"panelfunc","description":"Sets the base color of the alpha bar. This is the color for which the alpha channel is being modified. An Global.AccessorFunc","realm":"Client and Menu","file":{"text":"lua/vgui/dalphabar.lua","line":"8"},"args":{"arg":{"text":"The new Color to set. See Global.Color.","name":"clr","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetValue","parent":"DAlphaBar","type":"panelfunc","description":"Sets the alpha value or the alpha bar. An Global.AccessorFunc","realm":"Client and Menu","file":{"text":"lua/vgui/dalphabar.lua","line":"7"},"args":{"arg":{"text":"The new alpha value to set","name":"alpha","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnChange","parent":"DBinder","type":"panelhook","description":"Called when the player selects a new bind. Meant to be Overridden","realm":"Client","file":{"text":"lua/vgui/dbinder.lua","line":"89-L90"},"args":{"arg":{"text":"The new bound key. See input.GetKeyName.","name":"iNum","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetSelectedNumber","parent":"DBinder","type":"panelfunc","description":"Gets the code of the key currently bound by the DBinder. Same as DBinder:GetValue. An Global.AccessorFunc","realm":"Client","file":{"text":"lua/vgui/dbinder.lua","line":"4"},"rets":{"ret":{"text":"The key code of the bound key. See Enums/KEY.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetValue","parent":"DBinder","type":"panelfunc","description":"Gets the code of the key currently bound by the DBinder. Same as DBinder:GetSelectedNumber.","realm":"Client","file":{"text":"lua/vgui/dbinder.lua","line":"83-L87"},"rets":{"ret":{"text":"The key code of the bound key. See Enums/KEY.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetSelectedNumber","parent":"DBinder","type":"panelfunc","description":"Sets the current key bound by the DBinder, and updates the button's text as well as the ConVar.","realm":"Client","file":{"text":"lua/vgui/dbinder.lua","line":"41-L48"},"args":{"arg":{"text":"The key code of the key to bind. See Enums/KEY.","name":"keyCode","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetValue","parent":"DBinder","type":"panelfunc","description":"Alias of DBinder:SetSelectedNumber.","realm":"Client","file":{"text":"lua/vgui/dbinder.lua","line":"77-L81"},"args":{"arg":{"text":"The key code of the key to bind. See Enums/KEY.","name":"keyCode","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"UpdateText","parent":"DBinder","type":"panelfunc","description":{"text":"Used to set the text of the DBinder to the current key binding, or `NONE`.","internal":""},"file":{"text":"lua/vgui/dbinder.lua","line":"15-L24"},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetBackgroundColor","parent":"DBubbleContainer","type":"panelfunc","description":"Returns Background Color, See DBubbleContainer:SetBackgroundColor","realm":"Client","file":{"text":"lua/vgui/dbubblecontainer.lua","line":"4"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OpenForPos","parent":"DBubbleContainer","type":"panelfunc","description":"Sets the speech bubble position and size along with the dialog point position.","realm":"Client","file":{"text":"lua/vgui/dbubblecontainer.lua","line":"14-L29"},"args":{"arg":[{"text":"The x position of the dialog point. If this is set to a value greater than half of the set width, the entire bubble container will be moved in addition to the dialog point.","name":"x","type":"number"},{"text":"The y position of the bubble container. Has no effect unless set to a value greater than the set height + 64 pixels.","name":"y","type":"number"},{"text":"The width of the bubble container.","name":"w","type":"number"},{"text":"The height of the bubble container.","name":"h","type":"number"}]}},"example":{"description":"Creates a bubble container that properly fits a 200x200 background panel.","code":"-- Length and width of background panel\nlocal size = 200\n\t\t\n-- Background panel\nBGPanel = vgui.Create(\"DPanel\")\nBGPanel:SetSize(size, size)\nBGPanel:Center()\n\n\nlocal bubble1 = vgui.Create(\"DBubbleContainer\", BGPanel)\n\n-- x = 100 (Set pointer in the middle of the speech bubble)\n-- y = 0 (Don't adjust height)\n-- w = 180 (20 pixel right margin)\n-- h = 184 (16 pixel bottom margin)\nbubble1:OpenForPos(size/2, 0, size-20, size-16)","output":{"image":{"src":"DBubbleContainer_OpenForPos_example1.jpg"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetBackgroundColor","parent":"DBubbleContainer","type":"panelfunc","description":"Sets Background Color, See Also DBubbleContainer:GetBackgroundColor","realm":"Client","file":{"text":"lua/vgui/dbubblecontainer.lua","line":"4"},"args":{"arg":{"text":"The New Color","name":"color","type":"Color"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetDrawBorder","parent":"DButton","type":"panelfunc","description":{"text":"An Global.AccessorFunc that returns value set by DButton:SetDrawBorder. See that page for more info.","deprecated":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dbutton.lua","line":"4"},"rets":{"ret":{"text":"value set by DButton:SetDrawBorder.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsDown","parent":"DButton","type":"panelfunc","description":"Returns true if the DButton is currently depressed (a user is clicking on it).","realm":"Client and Menu","file":{"text":"lua/vgui/dbutton.lua","line":"26-L30"},"rets":{"ret":{"text":"Whether or not the button is depressed.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetConsoleCommand","parent":"DButton","type":"panelfunc","realm":"Client and Menu","file":{"text":"lua/vgui/dbutton.lua","line":"129-L135"},"description":"Sets a console command to be called when the button is clicked.\n\nThis overrides the button's `DoClick` method.","args":{"arg":[{"text":"The console command to be called.","name":"command","type":"string"},{"text":"The arguments for the command.","name":"args","type":"string","default":"nil"}]}},"example":{"description":"Creates a button that makes the player say their name.","code":"local button = vgui.Create( \"DButton\" )\nbutton:SetSize( 100, 35 )\nbutton:SetText( \"Say your nickname\" )\nbutton:Center()\nbutton:MakePopup()\nbutton:SetConsoleCommand( \"say\", LocalPlayer():Nick() )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDrawBorder","parent":"DButton","type":"panelfunc","description":{"text":"Does absolutely nothing at all. Default value is automatically set to true.","deprecated":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dbutton.lua","line":"4"},"args":{"arg":{"text":"Does nothing.","name":"draw","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetIcon","parent":"DButton","type":"panelfunc","description":"Sets an image to be displayed as the button's background. Alias of DButton:SetImage","realm":"Client and Menu","file":{"text":"lua/vgui/dbutton.lua","line":"52"},"args":{"arg":{"text":"The image file to use, relative to `/materials`. If this is nil, the image background is removed.","name":"img","type":"string","default":"nil"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetImage","parent":"DButton","type":"panelfunc","file":{"text":"lua/vgui/dbutton.lua","line":"32-L52"},"realm":"Client and Menu","description":"Sets an image to be displayed as the button's background.\n\nSee DButton:SetMaterial for equivalent function that uses IMaterial instead.\n\nAlso see: DImageButton","args":{"arg":{"text":"The image file to use, relative to the `materials/` folder. Can be set to `nil` to remove the image background.","name":"img","type":"string","default":"nil"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMaterial","parent":"DButton","type":"panelfunc","file":{"text":"lua/vgui/dbutton.lua","line":"54-L73"},"realm":"Client and Menu","added":"2020.08.12","description":"Sets an image to be displayed as the button's background.\n\nSee DButton:SetImage for equivalent function that uses file paths instead. Also see DImageButton.","args":{"arg":{"text":"The material to use. If this is nil, the image background is removed.","name":"img","type":"IMaterial","default":"nil"}}},"realms":["Client","Menu"],"type":"Function"},
{"text":"Condition |  Value |\n----------|-------|\n|  | skin.Colours.Button.Disabled |\n| self.Depressed | skin.Colours.Button.Down |\n| self.m_bSelected | skin.Colours.Button.Down |\n| self.Hovered | skin.Colours.Button.Hover |","function":{"name":"UpdateColours","parent":"DButton","type":"panelfunc","file":{"text":"lua/vgui/dbutton.lua","line":"86-L94"},"description":"A hook called from within DLabel's PANEL:ApplySchemeSettings to determine the color of the text on display.","realm":"Client and Menu","args":{"arg":{"text":"A table supposed to contain the color values listed above.","name":"skin","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Add","parent":"DCategoryList","type":"panelfunc","description":"Adds a DCollapsibleCategory to the list.","realm":"Client and Menu","file":{"text":"lua/vgui/dcategorylist.lua","line":"18-L28"},"args":{"arg":{"text":"The name of the category to add.","name":"categoryName","type":"string"}},"rets":{"ret":{"text":"The created DCollapsibleCategory","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddItem","parent":"DCategoryList","type":"panelfunc","description":"Adds an element to the list.","realm":"Client and Menu","file":{"text":"lua/vgui/dcategorylist.lua","line":"10-L16"},"args":{"arg":{"text":"VGUI element to add to the list.","name":"element","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UnselectAll","parent":"DCategoryList","type":"panelfunc","description":"Calls Panel:UnselectAll on all child elements, if they have it.","realm":"Client and Menu","file":{"text":"lua/vgui/dcategorylist.lua","line":"37-L47"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnChange","parent":"DCheckBox","type":"panelhook","description":"Called when the \"checked\" state is changed. This is for Overriding","realm":"Client and Menu","file":{"text":"lua/vgui/dcheckbox.lua","line":"51-L55"},"args":{"arg":{"text":"Whether the CheckBox is checked or not.","name":"bVal","type":"boolean"}}},"example":{"description":"Creates a metamethod on the DCheckBox class to print any changes to the console.","code":"function DCheckBox:OnChange(bVal)\n\tif (bVal) then\n\t\tprint(\"Checked!\")\n\telse\n\t\tprint(\"Unchecked!\")\n\tend\nend","output":"All new checkboxes created will print `Checked!` or `Unchecked!` when their checked state is changed."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DoClick","parent":"DCheckBox","type":"panelfunc","description":"Calls DCheckBox:Toggle","realm":"Client and Menu","file":{"text":"lua/vgui/dcheckbox.lua","line":"39-L43"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetChecked","parent":"DCheckBox","type":"panelfunc","description":"An Global.AccessorFunc that gets the checked state of the checkbox.","file":{"text":"lua/vgui/dcheckbox.lua","line":"4"},"realm":"Client and Menu","rets":{"ret":{"text":"Whether the box is checked or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsEditing","parent":"DCheckBox","type":"panelfunc","description":"Returns whether the state of the checkbox is being edited. This means whether the user is currently clicking (mouse-down) on the checkbox, and applies to both the left and right mouse buttons.","realm":"Client and Menu","file":{"text":"lua/vgui/dcheckbox.lua","line":"19-L21"},"rets":{"ret":{"text":"Whether the checkbox is being clicked.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetChecked","parent":"DCheckBox","type":"panelfunc","description":"An Global.AccessorFunc that sets the checked state of the checkbox. Does not call the checkbox's DCheckBox:OnChange and Panel:ConVarChanged methods, unlike DCheckBox:SetValue.","realm":"Client and Menu","file":{"text":"lua/vgui/dcheckbox.lua","line":"4"},"args":{"arg":{"text":"Whether the box should be checked or not.","name":"checked","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetValue","parent":"DCheckBox","type":"panelfunc","description":"Sets the checked state of the checkbox, and calls the checkbox's DCheckBox:OnChange and Panel:ConVarChanged methods.","realm":"Client and Menu","file":{"text":"lua/vgui/dcheckbox.lua","line":"23-L37"},"args":{"arg":{"text":"Whether the box should be checked or not.","name":"checked","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Toggle","parent":"DCheckBox","type":"panelfunc","description":"Toggles the checked state of the checkbox, and calls the checkbox's DCheckBox:OnChange and Panel:ConVarChanged methods. DCheckBox:DoClick is an alias of this function.","realm":"Client and Menu","file":{"text":"lua/vgui/dcheckbox.lua","line":"45-L49"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnChange","parent":"DCheckBoxLabel","type":"panelhook","description":"Called when the \"checked\" state is changed. This is meant to be Overriden","file":{"text":"lua/vgui/dcheckbox.lua","line":"179-L183"},"realm":"Client and Menu","args":{"arg":{"text":"Whether the checkbox is checked or unchecked.","name":"bVal","type":"boolean"}}},"example":{"description":"Creates a a DCheckBoxLabel that prints to the console when ticked/unticked","code":"local Frame = vgui.Create( \"DFrame\" )\nFrame:SetSize( 300, 100 )\nFrame:SetPos( 200, 200 )\n\nlocal LabelBox = vgui.Create( \"DCheckBoxLabel\", Frame )\nLabelBox:SetPos( 10, 40 )\nLabelBox:SetText( \"This is a DLabel\" )\nfunction LabelBox:OnChange( val )\n\tif val then\n\t\tprint( \"The box has been ticked!\" )\n\telse\n\t\tprint( \"The box has been unticked!\" )\n\tend\nend","output":"The box has been ticked!"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetChecked","parent":"DCheckBoxLabel","type":"panelfunc","description":"Gets the checked state of the checkbox. This calls the checkbox's DCheckBox:GetChecked function.","file":{"text":"lua/vgui/dcheckbox.lua","line":"114-L116"},"realm":"Client and Menu","rets":{"ret":{"text":"Whether the box is checked or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetIndent","parent":"DCheckBoxLabel","type":"panelfunc","description":"An Global.AccessorFunc that gets the indentation of the element on the X axis. See also DCheckBoxLabel:SetIndent","realm":"Client and Menu","file":{"text":"lua/vgui/dcheckbox.lua","line":"81"},"rets":{"ret":{"text":"How much the content is moved to the right in pixels","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetBright","parent":"DCheckBoxLabel","type":"panelfunc","description":"Sets the color of the DCheckBoxLabel's text to the bright text color defined in the skin.","realm":"Client and Menu","file":{"text":"lua/vgui/dcheckbox.lua","line":"98-L100"},"args":{"arg":{"text":"true makes the text bright.","name":"bright","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetChecked","parent":"DCheckBoxLabel","type":"panelfunc","description":"Sets the checked state of the checkbox. Does not call DCheckBoxLabel:OnChange or Panel:ConVarChanged, unlike DCheckBoxLabel:SetValue.","file":{"text":"lua/vgui/dcheckbox.lua","line":"110-L112"},"realm":"Client and Menu","args":{"arg":{"text":"Whether the box should be checked or not.","name":"checked","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetConVar","parent":"DCheckBoxLabel","type":"panelfunc","description":"Sets the console variable to be set when the checked state of the DCheckBoxLabel changes.","realm":"Client and Menu","file":{"text":"lua/vgui/dcheckbox.lua","line":"102-L104"},"args":{"arg":{"text":"The name of the convar to set","name":"convar","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDark","parent":"DCheckBoxLabel","type":"panelfunc","description":"Sets the text of the DCheckBoxLabel to be dark colored in accordance with the currently active Derma skin.","realm":"Client and Menu","file":{"text":"lua/vgui/dcheckbox.lua","line":"94-L96"},"args":{"arg":{"text":"True to be dark, false to be default","name":"darkify","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetFont","parent":"DCheckBoxLabel","type":"panelfunc","description":"Sets the font of the text part of the DCheckBoxLabel.","realm":"Client and Menu","file":{"text":"lua/vgui/dcheckbox.lua","line":"156-L161"},"args":{"arg":{"text":"Font name","name":"font","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetIndent","parent":"DCheckBoxLabel","type":"panelfunc","description":"An Global.AccessorFunc that sets the indentation of the element on the X axis.","realm":"Client and Menu","file":{"text":"lua/vgui/dcheckbox.lua","line":"81"},"args":{"arg":{"text":"How much in pixels to move the content to the right","name":"ident","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTextColor","parent":"DCheckBoxLabel","type":"panelfunc","description":"Sets the text color for the DCheckBoxLabel.","file":{"text":"lua/vgui/dcheckbox.lua","line":"134-L138"},"realm":"Client and Menu","args":{"arg":{"text":"The text color. Uses the Color.","name":"color","type":"Color"}}},"example":{"description":"Creates a DCheckBoxLabel and changes the text color to red.","code":"local LabelBox = vgui.Create( \"DCheckBoxLabel\" )\nLabelBox:SetTextColor( Color(255,0,0) )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetValue","parent":"DCheckBoxLabel","type":"panelfunc","description":"Sets the checked state of the checkbox, and calls DCheckBoxLabel:OnChange and the checkbox's Panel:ConVarChanged methods.","file":{"text":"lua/vgui/dcheckbox.lua","line":"106-L108"},"realm":"Client and Menu","args":{"arg":{"text":"Whether the box should be checked or not (1 or 0 can also be used).","name":"checked","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SizeToContents","parent":"DCheckBoxLabel","type":"panelfunc","description":"Sizes the panel to the size of the internal DLabel and DButton","realm":"Client and Menu","file":{"text":"lua/vgui/dcheckbox.lua","line":"140-147"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Toggle","parent":"DCheckBoxLabel","type":"panelfunc","description":"Toggles the checked state of the DCheckBoxLabel.","realm":"Client and Menu","file":{"text":"lua/vgui/dcheckbox.lua","line":"118-L120"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnToggle","parent":"DCollapsibleCategory","type":"panelhook","description":"Called by DCollapsibleCategory:Toggle. This function does nothing by itself, as you're supposed to overwrite it.","realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"227-L231"},"args":{"arg":{"text":"If it was expanded or not","name":"expanded","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Add","parent":"DCollapsibleCategory","type":"panelfunc","description":"Adds a new text button to the collapsible category, like the tool menu in Spawnmenu.","realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"75-L122"},"args":{"arg":{"text":"The name of the button","name":"name","type":"string"}},"rets":{"ret":{"text":"The DButton","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AnimSlide","parent":"DCollapsibleCategory","type":"panelfunc","description":{"text":"Internal function that handles the open/close animations.","internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"281-L307"},"args":{"arg":[{"name":"anim","type":"table"},{"name":"delta","type":"number"},{"name":"data","type":"table"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DoExpansion","parent":"DCollapsibleCategory","type":"panelfunc","description":"Forces the category to open or collapse","realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"233-L238"},"args":{"arg":{"text":"True to open, false to collapse","name":"expand","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetAnimTime","parent":"DCollapsibleCategory","type":"panelfunc","description":"An Global.AccessorFunc that returns the expand/collapse animation time set by DCollapsibleCategory:SetAnimTime.","realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"50"},"rets":{"ret":{"text":"The animation time in seconds","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDrawBackground","parent":"DCollapsibleCategory","type":"panelfunc","description":{"text":"Returns whether or not the panel background is being drawn. Alias of DCollapsibleCategory:GetPaintBackground.","deprecated":"You should use DCollapsibleCategory:GetPaintBackground instead."},"realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"52"},"rets":{"ret":{"text":"True if the panel background is drawn, false otherwise.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetExpanded","parent":"DCollapsibleCategory","type":"panelfunc","description":"Returns whether the DCollapsibleCategory is expanded or not.","realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"48"},"rets":{"ret":{"text":"If expanded it will return true.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetHeaderHeight","parent":"DCollapsibleCategory","type":"panelfunc","description":"Returns the header height of the DCollapsibleCategory.\n\nSee also DCollapsibleCategory:SetHeaderHeight.","added":"2020.08.12","realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"162-L166"},"rets":{"ret":{"text":"The current height of the header.","name":"height","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetList","parent":"DCollapsibleCategory","type":"panelfunc","description":"If set, the DCategoryList that created this panel.\n\nSee also DCollapsibleCategory:SetList.","realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"54"},"rets":{"ret":{"text":"The DCategoryList that created us.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetPadding","parent":"DCollapsibleCategory","type":"panelfunc","description":{"text":"Doesn't actually do anything.\n\nReturns the number set by DCollapsibleCategory:SetPadding.","deprecated":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"53"},"rets":{"ret":{"name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetPaintBackground","parent":"DCollapsibleCategory","type":"panelfunc","description":"An Global.AccessorFunc that returns whether or not the background should be painted.","realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"41"},"rets":{"ret":{"text":"If the background is painted or not","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetStartHeight","parent":"DCollapsibleCategory","type":"panelfunc","description":{"text":"Returns whatever was set by DCollapsibleCategory:SetStartHeight","deprecated":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"49"},"rets":{"ret":{"name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetAnimTime","parent":"DCollapsibleCategory","type":"panelfunc","description":"Sets the time in seconds it takes to expand the DCollapsibleCategory","realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"50"},"args":{"arg":{"text":"The time in seconds it takes to expand","name":"time","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetContents","parent":"DCollapsibleCategory","type":"panelfunc","description":"Sets the contents of the DCollapsibleCategory.","realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"176-L196"},"args":{"arg":{"text":"The panel, containing the contents for the DCollapsibleCategory, mostly an DScrollPanel","name":"pnl","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDrawBackground","parent":"DCollapsibleCategory","type":"panelfunc","description":{"text":"Sets whether or not to draw the panel background. Alias of DCollapsibleCategory:SetPaintBackground.","deprecated":"You should use DCollapsibleCategory:SetPaintBackground instead."},"realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"52"},"args":{"arg":{"text":"True to show the panel's background, false to hide it.","name":"draw","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetExpanded","parent":"DCollapsibleCategory","type":"panelfunc","description":"Sets whether the DCollapsibleCategory is expanded or not upon opening the container.\n\nYou should use DCollapsibleCategory:Toggle or DCollapsibleCategory:DoExpansion instead.","realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"48"},"args":{"arg":{"text":"Whether it shall be expanded or not by default","name":"expanded","type":"boolean","default":"true"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetHeaderHeight","parent":"DCollapsibleCategory","type":"panelfunc","description":"Sets the header height of the DCollapsibleCategory.\n\nSee also DCollapsibleCategory:GetHeaderHeight.","added":"2020.08.12","realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"156-L160"},"args":{"arg":{"text":"The new height to set. Default height is 20.","name":"height","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetLabel","parent":"DCollapsibleCategory","type":"panelfunc","description":"Sets the name of the DCollapsibleCategory.","realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"150-L154"},"args":{"arg":{"text":"The label/name of the DCollapsibleCategory.","name":"label","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetList","parent":"DCollapsibleCategory","type":"panelfunc","description":"Used internally by DCategoryList when it creates a DCollapsibleCategory during DCategoryList:Add.\n\nIf set, Panel:UnselectAll will be called on the list, instead of calling it on the category panel itself when a category is clicked.","realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"54"},"args":{"arg":{"text":"The Panel:UnselectAll that is the \"parent\" of this panel.","name":"pnl","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetPadding","parent":"DCollapsibleCategory","type":"panelfunc","description":{"text":"Doesn't actually do anything.","deprecated":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"53"},"args":{"arg":{"name":"padding","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetPaintBackground","parent":"DCollapsibleCategory","type":"panelfunc","description":"Sets whether or not the background should be painted.","realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"51"},"args":{"arg":{"name":"paint","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetStartHeight","parent":"DCollapsibleCategory","type":"panelfunc","description":{"text":"Does nothing.","deprecated":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"49"},"args":{"arg":{"name":"height","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Toggle","parent":"DCollapsibleCategory","type":"panelfunc","description":"Toggles the expanded state of the DCollapsibleCategory.\n\nSee DCollapsibleCategory:GetExpanded for a function to retrieve the expanded state.","realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"209-L225"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateAltLines","parent":"DCollapsibleCategory","type":"panelfunc","description":{"text":"Used internally to update the \"AltLine\" property on all \"child\" panels.","internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcategorycollapse.lua","line":"136-L142"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetColor","parent":"DColorButton","type":"panelfunc","description":"An Global.AccessorFunc that returns the color of the button","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorbutton.lua","line":"9"},"rets":{"ret":{"text":"The Color of the button","name":"","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDrawBorder","parent":"DColorButton","type":"panelfunc","description":{"text":"An Global.AccessorFunc that returns value set by DColorButton:SetDrawBorder. See that page for more info.","deprecated":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolorbutton.lua","line":"6"},"rets":{"ret":{"text":"Value set by DColorButton:SetDrawBorder.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetID","parent":"DColorButton","type":"panelfunc","description":"An Global.AccessorFunc that returns the unique ID set by DColorButton:SetID.\n\nUsed internally by DColorPalette","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorbutton.lua","line":"10"},"rets":{"ret":{"text":"The unique ID of the button","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSelected","parent":"DColorButton","type":"panelfunc","description":{"text":"An Global.AccessorFunc that is an alias of Panel:IsSelected.","deprecated":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolorbutton.lua","line":"7"},"rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsDown","parent":"DColorButton","type":"panelfunc","description":"Returns whether the DColorButton is currently being pressed (the user is holding it down).","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorbutton.lua","line":"24-L28"},"rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetColor","parent":"DColorButton","type":"panelfunc","description":"Sets the color of the DColorButton.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorbutton.lua","line":"30-L41"},"args":{"arg":[{"text":"A Color to set the color as","name":"color","type":"Color"},{"text":"If true, the tooltip will not be reset to display the selected color.","name":"noTooltip","type":"boolean","default":"false"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDrawBorder","parent":"DColorButton","type":"panelfunc","description":{"text":"An Global.AccessorFunc that does absolutely nothing at all. Default value is automatically set to true.","deprecated":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolorbutton.lua","line":"6"},"args":{"arg":{"text":"Does nothing.","name":"draw","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetID","parent":"DColorButton","type":"panelfunc","description":"An Global.AccessorFunc that is used internally by DColorPalette to detect which button is which.\n\t\n\tPairs with DColorButton:GetID","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorbutton.lua","line":"10"},"args":{"arg":{"text":"A unique ID to give this button","name":"id","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnValueChanged","parent":"DColorCombo","type":"panelhook","description":"Called when the value (color) of this panel was changed. For override","realm":"Client","file":{"text":"lua/vgui/dcolorcombo.lua","line":"63-L67"},"args":{"arg":{"name":"newcol","type":"Color"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"BuildControls","parent":"DColorCombo","type":"panelfunc","description":{"text":"Called internally to create panels necessary for this panel to work.","internal":""},"realm":"Client","file":{"text":"lua/vgui/dcolorcombo.lua","line":"14-L55"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetColor","parent":"DColorCombo","type":"panelfunc","description":"An Global.AccessorFunc that returns the color of the DColorCombo.","realm":"Client","file":{"text":"lua/vgui/dcolorcombo.lua","line":"4"},"rets":{"ret":{"text":"A Color","name":"","type":"Color"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsEditing","parent":"DColorCombo","type":"panelfunc","description":"Returns true if the panel is currently being edited\n\nMore of a internal method, it technically should only ever work (i.e. return true) inside DColorCombo:OnValueChanged.","realm":"Client","file":{"text":"lua/vgui/dcolorcombo.lua","line":"57-L61"},"rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetColor","parent":"DColorCombo","type":"panelfunc","description":"An Global.AccessorFunc that returns the color of this panel. See also DColorCombo:GetColor","realm":"Client","file":{"text":"lua/vgui/dcolorcombo.lua","line":"69-L75"},"args":{"arg":{"text":"A Color.","name":"clr","type":"Color"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnUserChanged","parent":"DColorCube","type":"panelhook","description":"Function which is called when the color cube slider is moved (through user input). Meant to be overridden.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorcube.lua","line":"89-L93"},"args":{"arg":{"text":"The new color, uses Color.","name":"color","type":"Color"}}},"example":{"description":"Creates a color cube which controls the blue saturation and value of a ball image.","code":"-- Frame\nMainFrame = vgui.Create(\"DFrame\")\nMainFrame:SetSize(320, 200)\nMainFrame:Center()\nMainFrame:SetTitle(\"Choose the saturation and value\")\n\n-- Image of a ball\nlocal ball_img = vgui.Create(\"DImage\", MainFrame)\nball_img:SetPos(20, 45)\nball_img:SetSize(128, 128)\n\nball_img:SetImage(\"sprites/sent_ball\")\n\n-- Color cube\nlocal color_cube = vgui.Create(\"DColorCube\", MainFrame)\ncolor_cube:SetPos(160, 40)\ncolor_cube:SetSize(150, 150)\n\n-- Set color to blue\ncolor_cube:SetColor(Color(0, 0, 255))\n\n-- Called when slider is moved by user\nfunction color_cube:OnUserChanged(col)\n\t\n\t-- Update ball color\n\tball_img:SetImageColor(col)\n\nend","output":{"image":{"src":"DColorCube_OnUserChanged_example1.gif"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetBaseRGB","parent":"DColorCube","type":"panelfunc","description":"An Global.AccessorFunc that returns the base Color set by DColorCube:SetBaseRGB.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorcube.lua","line":"5"},"rets":{"ret":{"text":"A Color","name":"","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDefaultColor","parent":"DColorCube","type":"panelfunc","description":"An Global.AccessorFunc that returns the color cube's default color. By default, it is set to white. (255 255 255 RGB)","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorcube.lua","line":"7"},"rets":{"ret":{"text":"The default Color.","name":"","type":"Color"}},"added":"2024.05.02"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetHue","parent":"DColorCube","type":"panelfunc","description":{"text":"An Global.AccessorFunc that returns the value set by DColorCube:SetHue.","deprecated":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolorcube.lua","line":"4"},"rets":{"ret":{"name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetRGB","parent":"DColorCube","type":"panelfunc","description":"An Global.AccessorFunc that returns the color cube's current set color.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorcube.lua","line":"6"},"rets":{"ret":{"text":"The set color, uses Color.","name":"","type":"Color"}}},"example":{"description":"Creates a color cube, sets the color to cyan, adjusts the saturation and value to 50% each, and prints out the final color.","code":"local color_cube = vgui.Create(\"DColorCube\")\ncolor_cube:SetSize(200, 200)\ncolor_cube:Center()\n\n-- Set color to cyan\ncolor_cube:SetColor(Color(0, 255, 255))\n\n-- 50% saturated, 50% valued\ncolor_cube:TranslateValues(0.5, 0.5)\n\n-- Print set color\nPrintTable(color_cube:GetRGB())","output":"```\nr\t=\t63\nb\t=\t127\na\t=\t255\ng\t=\t127\n```"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ResetToDefaultValue","parent":"DColorCube","type":"panelfunc","description":"Sets the color to whatever DColorCube:GetDefaultColor returns","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorcube.lua","line":"43-L48"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetBaseRGB","parent":"DColorCube","type":"panelfunc","description":{"text":"An Global.AccessorFunc that sets the base color and the color used to draw the color cube panel itself.","note":"Calling this when using a color that isn't 100% saturated and valued (Global.HSVToColor with saturation and value set to 1) causes the color cube to look inaccurate compared to the color that's returned by methods like DColorCube:GetRGB and DColorCube:OnUserChanged. You should use DColorCube:SetColor instead"},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolorcube.lua","line":"107-L112"},"args":{"arg":{"text":"The base color to set, uses Color.","name":"color","type":"Color"}}},"example":{"description":"Creates a background panel and color cube that controls the background color. Demonstrates how setting the base RGB explicitly can cause a disconnect between the color represented by the cube and the color output.","code":"-- Background panel\nBGPanel = vgui.Create(\"DPanel\")\nBGPanel:SetSize(200, 200)\nBGPanel:Center()\n\n-- Color cube\nlocal color_cube = vgui.Create(\"DColorCube\", BGPanel)\ncolor_cube:SetSize(180, 180)\ncolor_cube:Center()\n\n-- Base color set to white\ncolor_cube:SetBaseRGB(Color(255, 255, 255))\n\n-- Called when the color is changed by user input\nfunction color_cube:OnUserChanged(col)\n\n\t-- Update background panel color\n\tBGPanel:SetBackgroundColor(col)\n\t\nend","output":{"text":"Notice how the output/background color doesn't match the color where the slider is positioned.","image":{"src":"DColorCube_SetBaseRGB_example1.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetColor","parent":"DColorCube","type":"panelfunc","description":"Sets the base color of the color cube and updates the slider position.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorcube.lua","line":"95-L105"},"args":{"arg":{"text":"The color to set, uses Color.","name":"color","type":"Color"}}},"example":{"description":"Picks the color at the center screen pixel and applies it to the base color of a color cube and its background panel.","code":"function makeCMenuPicker() -- creating the element\n    local c_w, c_h = ScrW()/2, ScrH()/2\n\n    PickerPanel = vgui.Create(\"DPanel\", g_ContextMenu) -- lazy parented to C menu (sandbox + derivatives), normally you would use DFrame\n    PickerPanel:SetSize(120, 120)\n    PickerPanel:SetPos( c_w-60, c_h-150 )\n    \n    local color_cube = vgui.Create(\"DColorCube\", PickerPanel) -- Color cube\n    color_cube:Dock(FILL)\n    color_cube:DockMargin(15, 15, 15, 0)\n    PickerPanel.cube = color_cube\n\n    local color_label = vgui.Create(\"DLabel\", PickerPanel)\n    color_label:Dock(BOTTOM)\n    color_label:SetContentAlignment(5)\n    PickerPanel.label = color_label\nend\nhook.Add(\"InitPostEntity\", \"create_colorpicker_vgui\", function() makeCMenuPicker() end)\n\nlocal function updateCube() -- updating the element\n    if !IsValid(PickerPanel) then return end\n\n    hook.Add(\"PostRender\", \"capture_center_pixel\", function()\n        render.CapturePixels() -- capture those pixels!\n\n        local p_r, p_g, p_b = render.ReadPixel(ScrW()/2, ScrH()/2) -- Get the color of the pixel at the center of the screen\n        local to_color = Color(p_r, p_g, p_b)\n\n        PickerPanel:SetBackgroundColor(to_color)\n        PickerPanel.cube:SetColor(to_color) -- Set the color to the center pixel color\n        PickerPanel.label:SetText(tostring(to_color))\n\n        local c, b, va = ColorToHSV(to_color)\n        if va > 0.6 then -- check the brightness and set black if its too light\n            PickerPanel.label:SetTextColor(color_black)\n        end\n\n        hook.Remove(\"PostRender\", \"capture_center_pixel\")\n    end)\nend\nhook.Add(\"OnContextMenuOpen\", \"capture_on_context_open\", function() updateCube() end) -- update it on c menu opening!","output":{"image":{"src":"70c/8dc388ff3f43f7a.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDefaultColor","parent":"DColorCube","type":"panelfunc","description":"An Global.AccessorFunc that sets the color cube's default color. This value will be used to reset to on middle mouse click of the color cube's draggable slider.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorcube.lua","line":"7"},"args":{"arg":{"text":"The new default Color.","name":"","type":"Color"}},"added":"2024.05.02"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetHue","parent":"DColorCube","type":"panelfunc","description":{"text":"An Global.AccessorFunc that appears to do nothing and unused.","deprecated":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolorcube.lua","line":"4"},"args":{"arg":{"name":"hue","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetRGB","parent":"DColorCube","type":"panelfunc","description":{"text":"An Global.AccessorFunc that used internally to set the real \"output\" color of the panel.","internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolorcube.lua","line":"6"},"args":{"arg":{"text":"A Color","name":"clr","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"TranslateValues","parent":"DColorCube","type":"panelfunc","description":{"text":"Updates the color cube RGB based on the given x and y position and returns its arguments. Similar to DColorCube:UpdateColor.","internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolorcube.lua","line":"65-L72"},"args":{"arg":[{"text":"The x position to sample color from/the percentage of saturation to remove from the color (ranges from 0.0 to 1.0).","name":"x","type":"number","default":"nil"},{"text":"The y position to sample color from/the percentage of brightness or value to remove from the color (ranges from 0.0 to 1.0).","name":"y","type":"number","default":"nil"}]},"rets":{"ret":[{"text":"The given x position.","name":"","type":"number"},{"text":"The given y position.","name":"","type":"number"}]}},"example":{"description":"Creates a green color cube and prints out the color at the (0.2, 0.4) position.","code":"local color_cube = vgui.Create(\"DColorCube\")\ncolor_cube:SetSize(200, 200)\ncolor_cube:Center()\n\n-- Set base color to green\ncolor_cube:SetColor(Color(0, 255, 0))\n\n-- 20% desaturated, 40% darker\ncolor_cube:TranslateValues(0.2, 0.4)\n\n-- Get new color\nlocal new_color = color_cube:GetRGB()\n\n-- Update slider position\ncolor_cube:SetColor(new_color)\n\n-- Print out new color\nprint(\"Color( \"..new_color.r..\", \"..new_color.g..\", \"..new_color.b..\", \"..new_color.a..\" )\")","output":{"text":"```\nColor( 30, 153, 30, 255 )\n```","image":{"src":"DColorCube_TranslateValues_example1.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateColor","parent":"DColorCube","type":"panelfunc","description":{"text":"Updates the color cube RGB based on the given x and y position. Similar to DColorCube:TranslateValues.","internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolorcube.lua","line":"74-L87"},"args":{"arg":[{"text":"The x position to set color to/the percentage of saturation to remove from the color (ranges from 0.0 to 1.0).","name":"x","type":"number","default":"nil"},{"text":"The y position to set color to/the percentage of brightness or value to remove from the color (ranges from 0.0 to 1.0).","name":"y","type":"number","default":"nil"}]}},"example":{"description":"Creates a yellow color cube and updates/prints out the color at the (0.1, 0.6) position.","code":"local color_cube = vgui.Create(\"DColorCube\")\ncolor_cube:SetSize(200, 200)\ncolor_cube:Center()\n\n-- Set base color to yellow\ncolor_cube:SetColor(Color(255, 255, 0))\n\n-- 10% less saturation, 60% darker\ncolor_cube:UpdateColor(0.1, 0.6)\n\n-- Get new color\nlocal new_color = color_cube:GetRGB()\n\n-- Print new color\nprint(\"Color( \"..new_color.r..\", \"..new_color.g..\", \"..new_color.b..\", \"..new_color.a..\" )\")","output":"```\nColor( 102, 102, 10, 255 )\n```"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ValueChanged","parent":"DColorMixer","type":"panelhook","description":{"text":"Called when the player changes the color of the DColorMixer. Meant to be overridden.","bug":"The returned color will not have the color metatable."},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"313-L315"},"args":{"arg":{"text":"The new color. See Color","name":"col","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ConVarThink","parent":"DColorMixer","type":"panelfunc","description":{"internal":""},"file":{"text":"lua/vgui/dcolormixer.lua","line":"341-L360"},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DoConVarThink","parent":"DColorMixer","type":"panelfunc","description":{"internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"362-L374"},"args":{"arg":{"name":"cvar","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetAlphaBar","parent":"DColorMixer","type":"panelfunc","description":"An Global.AccessorFunc that returns true if alpha bar is shown, false if not.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"10"},"rets":{"ret":{"text":"Return true if shown, false if not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetColor","parent":"DColorMixer","type":"panelfunc","description":"An Global.AccessorFunc that returns the current selected color.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"317-L326"},"rets":{"ret":{"text":"The current selected color as a Color.","name":"","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetConVarA","parent":"DColorMixer","type":"panelfunc","description":"An Global.AccessorFunc that returns the ConVar name for the alpha channel of the color.\n\nSee also:\n* DColorMixer:GetConVarR - For the red channel\n* DColorMixer:GetConVarG - For the green channel\n* DColorMixer:GetConVarB - For the blue channel","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"7"},"rets":{"ret":{"text":"The ConVar name for the alpha channel of the color","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetConVarB","parent":"DColorMixer","type":"panelfunc","description":"An Global.AccessorFunc that returns the ConVar name for the blue channel of the color.\n\nSee also:\n* DColorMixer:GetConVarR - For the red channel\n* DColorMixer:GetConVarG - For the green channel\n* DColorMixer:GetConVarA - For the alpha channel","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"6"},"rets":{"ret":{"text":"The ConVar name for the blue channel of the color","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetConVarG","parent":"DColorMixer","type":"panelfunc","description":"An Global.AccessorFunc that returns the ConVar name for the green channel of the color.\n\nSee also:\n* DColorMixer:GetConVarR - For the red channel\n* DColorMixer:GetConVarB - For the blue channel\n* DColorMixer:GetConVarA - For the alpha channel","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"5"},"rets":{"ret":{"text":"The ConVar name for the green channel of the color","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetConVarR","parent":"DColorMixer","type":"panelfunc","description":"An Global.AccessorFunc that returns the ConVar name for the red channel of the color.\n\nSee also:\n* DColorMixer:GetConVarG - For the green channel\n* DColorMixer:GetConVarB - For the blue channel\n* DColorMixer:GetConVarA - For the alpha channel","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"4"},"rets":{"ret":{"text":"The ConVar name for the red channel of the color","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetPalette","parent":"DColorMixer","type":"panelfunc","description":"An Global.AccessorFunc that returns true if palette is shown, false if not.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"9"},"rets":{"ret":{"text":"Return true if shown, false if not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetVector","parent":"DColorMixer","type":"panelfunc","description":"Returns the color as a normalized Vector.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"328-L333"},"rets":{"ret":{"text":"A vector representing the color of the DColorMixer, each value being in range of 0 to 1. Alpha is not included.","name":"","type":"Vector"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetWangs","parent":"DColorMixer","type":"panelfunc","description":"An Global.AccessorFunc that returns true if the wangs are shown, false if not.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"11"},"rets":{"ret":{"text":"Return true if shown, false if not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetAlphaBar","parent":"DColorMixer","type":"panelfunc","description":"An Global.AccessorFunc that show/hide the alpha bar in DColorMixer","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"166-L173"},"args":{"arg":{"text":"Show / Hide the alpha bar","name":"show","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetBaseColor","parent":"DColorMixer","type":"panelfunc","description":"Sets the base color of the DColorCube part of the DColorMixer.\n\nSee also DColorCube:SetBaseRGB","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"252-L255"},"args":{"arg":{"text":"Color","name":"clr","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetColor","parent":"DColorMixer","type":"panelfunc","description":"An Global.AccessorFunc that sets the color of the DColorMixer. See also DColorMixer:GetColor","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"13"},"args":{"arg":{"text":"The color to set. See Global.Color","name":"color","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetConVarA","parent":"DColorMixer","type":"panelfunc","description":"An Global.AccessorFunc that sets the ConVar name for the alpha channel of the color.\n\nSee also:\n* DColorMixer:SetConVarR - For the red channel\n* DColorMixer:SetConVarG - For the green channel\n* DColorMixer:SetConVarB - For the blue channel","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"198-L202"},"args":{"arg":{"text":"The ConVar name for the alpha channel of the color","name":"convar","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetConVarB","parent":"DColorMixer","type":"panelfunc","description":"An Global.AccessorFunc that sets the ConVar name for the blue channel of the color.\n\nSee also:\n* DColorMixer:SetConVarR - For the red channel\n* DColorMixer:SetConVarG - For the green channel\n* DColorMixer:SetConVarA - For the alpha channel","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"193-L196"},"args":{"arg":{"text":"The ConVar name for the blue channel of the color","name":"convar","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetConVarG","parent":"DColorMixer","type":"panelfunc","description":"An Global.AccessorFunc that sets the ConVar name for the green channel of the color.\n\nSee also:\n* DColorMixer:SetConVarR - For the red channel\n* DColorMixer:SetConVarB - For the blue channel\n* DColorMixer:SetConVarA - For the alpha channel","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"188-L191"},"args":{"arg":{"text":"The ConVar name for the green channel of the color","name":"convar","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetConVarR","parent":"DColorMixer","type":"panelfunc","description":"An Global.AccessorFunc that sets the ConVar name for the red channel of the color.\n\nSee also:\n* DColorMixer:SetConVarG - For the green channel\n* DColorMixer:SetConVarB - For the blue channel\n* DColorMixer:SetConVarA - For the alpha channel","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"183-L186"},"args":{"arg":{"text":"The ConVar name for the red channel of the color","name":"convar","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetLabel","parent":"DColorMixer","type":"panelfunc","description":"Sets the label's text to show.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"144-L156"},"args":{"arg":{"text":"Set to non empty string to show the label and its text.\n\nGive it an empty string or nothing and the label will be hidden.","name":"text","type":"string","default":"nil"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetPalette","parent":"DColorMixer","type":"panelfunc","description":"Show or hide the palette panel","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"158-L164"},"args":{"arg":{"text":"Show or hide the palette panel?","name":"enabled","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetVector","parent":"DColorMixer","type":"panelfunc","description":"Sets the color of DColorMixer from a Vector. Alpha is not included.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"246-L250"},"args":{"arg":{"text":"The color to set. It is expected that the vector will have values be from 0 to 1. (i.e. be normalized)","name":"vec","type":"Vector"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetWangs","parent":"DColorMixer","type":"panelfunc","description":"Show / Hide the colors indicators in DColorMixer","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"175-L181"},"args":{"arg":{"text":"Show / Hide the colors indicators","name":"show","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateColor","parent":"DColorMixer","type":"panelfunc","description":{"text":"Use DColorMixer:SetColor instead!","internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"277-L311"},"args":{"arg":{"name":"clr","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateConVar","parent":"DColorMixer","type":"panelfunc","description":{"internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"257-L264"},"args":{"arg":[{"text":"The ConVar name","name":"cvar","type":"string"},{"text":"The color part to set the cvar to. \"r\", \"g\", \"b\" or \"a\".","name":"part","type":"string"},{"text":"The Color","name":"clr","type":"Color"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateConVars","parent":"DColorMixer","type":"panelfunc","description":{"internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"266-L275"},"args":{"arg":{"text":"The Color","name":"clr","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateDefaultColor","parent":"DColorMixer","type":"panelfunc","description":"sets the default color of the element to the currently selected color","realm":"Client and Menu","file":{"text":"lua/vgui/dcolormixer.lua","line":"204-L222"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnValueChanged","parent":"DColorPalette","type":"panelhook","description":"Called when the color is changed after clicking a new value. For Override","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"228-L230"},"args":{"arg":{"text":"The new color of the DColorPalette","name":"newcol","type":"Color"}}},"example":{"description":"Creates a DFrame with a color palette that prints values after being changed.","code":"local frame = vgui.Create( \"DFrame\" )\nframe:SetSize( ScrW() - 100, ScrH() - 100 )\nframe:Center()\nframe:MakePopup()\n\nlocal palette = vgui.Create( \"DColorPalette\", frame )\npalette:Dock( FILL )\n\nfunction palette:OnValueChanged( newcol )\n\tPrintTable( newcol )\nend","output":"The color chosen on the palette."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DoClick","parent":"DColorPalette","type":"panelfunc","description":{"text":"Basically the same functionality as DColorPalette:OnValueChanged, you should use that instead!\n\nFor Override","deprecated":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"121-L125"},"args":{"arg":[{"text":"The new color via the Color","name":"clr","type":"Color"},{"text":"The DColorButton that was pressed.","name":"btn","type":"Panel"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetButtonSize","parent":"DColorPalette","type":"panelfunc","description":"An Global.AccessorFunc that returns the size of each palette button. Set by DColorPalette:SetButtonSize.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"11"},"rets":{"ret":{"text":"The size of each palette button","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetConVarA","parent":"DColorPalette","type":"panelfunc","description":"An Global.AccessorFunc that returns the ConVar name for the alpha channel of the color.\n\nSee also:\n* DColorPalette:GetConVarR - For the red channel\n* DColorPalette:GetConVarG - For the green channel\n* DColorPalette:GetConVarB - For the blue channel","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"9"},"rets":{"ret":{"text":"The ConVar name for the alpha channel of the color","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetConVarB","parent":"DColorPalette","type":"panelfunc","description":"An Global.AccessorFunc that returns the ConVar name for the blue channel of the color.\n\nSee also:\n* DColorPalette:GetConVarR - For the red channel\n* DColorPalette:GetConVarG - For the green channel\n* DColorPalette:GetConVarA - For the alpha channel","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"8"},"rets":{"ret":{"text":"The ConVar name for the blue channel of the color","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetConVarG","parent":"DColorPalette","type":"panelfunc","description":"An Global.AccessorFunc that returns the ConVar name for the green channel of the color.\n\nSee also:\n* DColorPalette:GetConVarR - For the red channel\n* DColorPalette:GetConVarB - For the blue channel\n* DColorPalette:GetConVarA - For the alpha channel","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"7"},"rets":{"ret":{"text":"The ConVar name for the green channel of the color","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetConVarR","parent":"DColorPalette","type":"panelfunc","description":"An Global.AccessorFunc that returns the ConVar name for the red channel of the color.\n\nSee also:\n* DColorPalette:GetConVarG - For the green channel\n* DColorPalette:GetConVarB - For the blue channel\n* DColorPalette:GetConVarA - For the alpha channel","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"6"},"rets":{"ret":{"text":"The ConVar name for the red channel of the color","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetNumRows","parent":"DColorPalette","type":"panelfunc","description":"An Global.AccessorFunc that returns the number of rows of the palette, provided 6 colors fill each row. This value is equal to the number of colors in the DColorPalette divided by 6.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"13"},"rets":{"ret":{"text":"Number of rows of the DColorPalette.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"NetworkColorChange","parent":"DColorPalette","type":"panelfunc","description":{"text":"Used internally to make sure changes on one palette affect other palettes with same name.","internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"103-L119"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnRightClickButton","parent":"DColorPalette","type":"panelfunc","description":"Called when a palette button has been pressed. For Override","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"232-L234"},"args":{"arg":{"text":"The DColorButton that was pressed.","name":"pnl","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Reset","parent":"DColorPalette","type":"panelfunc","description":"Resets this entire color palette to a default preset one, without saving.\n\nSee DColorPalette:ResetSavedColors for version that also saves the changes.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"127-L131"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ResetSavedColors","parent":"DColorPalette","type":"panelfunc","description":"Resets this entire color palette to a default preset one and saves the changes.\n\nSee DColorPalette:Reset for version that does not save the changes.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"133-L148"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SaveColor","parent":"DColorPalette","type":"panelfunc","description":"Saves the color of given button across sessions.  \nThe color is saved as a panel cookie, see Panel:SetCookie and Panel:SetCookieName.  \nIt is expected that the amount of colors per palette (Panel:SetCookieName) is the same every time.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"210-L222"},"args":{"arg":[{"text":"The button to save the color of. Used to get the ID of the button.","name":"btn","type":"Panel"},{"text":"The color to save to this button's index","name":"clr","type":"Color"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetButtonSize","parent":"DColorPalette","type":"panelfunc","description":"Sets the size of each palette button.\n\nThis is best kept to such a number, where this equation would return a whole number:\n\n`WidthOfColorPalette / ButtonSize= WholeNumber`\n\nIf not, there will be ugly whitespace on the right side of the panel.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"181-L191"},"args":{"arg":{"text":"Sets the new size","name":"size","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetColor","parent":"DColorPalette","type":"panelfunc","description":{"text":"Currently does nothing. Intended to \"select\" the color.","deprecated":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"224-L226"},"args":{"arg":{"name":"clr","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetColorButtons","parent":"DColorPalette","type":"panelfunc","description":"Clears the palette and adds new buttons with given colors.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"164-L179"},"args":{"arg":{"text":"A number indexed table where each value is a Color","name":"tab","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetConVarA","parent":"DColorPalette","type":"panelfunc","description":"An Global.AccessorFunc that sets the ConVar name for the alpha channel of the color.\n\nSee also:\n* DColorPalette:SetConVarR - For the red channel\n* DColorPalette:SetConVarG - For the green channel\n* DColorPalette:SetConVarB - For the blue channel","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"9"},"args":{"arg":{"text":"The ConVar name for the alpha channel of the color","name":"convar","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetConVarB","parent":"DColorPalette","type":"panelfunc","description":"An Global.AccessorFunc that sets the ConVar name for the blue channel of the color.\n\nSee also:\n* DColorPalette:SetConVarR - For the red channel\n* DColorPalette:SetConVarG - For the green channel\n* DColorPalette:SetConVarA - For the alpha channel","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"8"},"args":{"arg":{"text":"The ConVar name for the blue channel of the color","name":"convar","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetConVarG","parent":"DColorPalette","type":"panelfunc","description":"An Global.AccessorFunc that sets the ConVar name for the green channel of the color.\n\nSee also:\n* DColorPalette:SetConVarR - For the red channel\n* DColorPalette:SetConVarB - For the blue channel\n* DColorPalette:SetConVarA - For the alpha channel","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"7"},"args":{"arg":{"text":"The ConVar name for the green channel of the color","name":"convar","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetConVarR","parent":"DColorPalette","type":"panelfunc","description":"An Global.AccessorFunc that sets the ConVar name for the red channel of the color.\n\nSee also:\n* DColorPalette:SetConVarG - For the green channel\n* DColorPalette:SetConVarB - For the blue channel\n* DColorPalette:SetConVarA - For the alpha channel","realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"6"},"args":{"arg":{"text":"The ConVar name for the red channel of the color","name":"convar","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetNumRows","parent":"DColorPalette","type":"panelfunc","description":{"text":"Roughly sets the number of colors that can be picked by the user. If the DColorPalette is exactly 6 rows tall, this function will set the number of colors shown per row in the palette. This is an Global.AccessorFunc","note":"DColorPalette:Reset or DColorPalette:ResetSavedColors must be called after this function to apply changes."},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"13"},"args":{"arg":{"text":"Scale for the range of colors that the user can pick. Default is 8.","name":"rows","type":"number"}}},"example":{"description":"Creates four DColorPalettes, each with a varying number of colors per row.","code":"local frame = vgui.Create( \"DFrame\" ) -- Create the window\nframe:SetSize( 350, 350 )\nframe:SetTitle( \"SetNumRows Demonstration\" )\nframe:Center()\nframe:MakePopup()\n\nlocal label = vgui.Create( \"DLabel\", frame ) -- Create the help text\nlabel:Dock( TOP )\nlabel:SetText( \"Difference between SetNumRows( 4 ), SetNumRows( 8 ), SetNumRows( 16 ) and SetNumRows( 24 )\" )\nlabel:SetWrap( true ) -- Enables text wrapping for lower resolutions\nlabel:SetAutoStretchVertical( true ) -- Needed for the text to show properly\n\nlocal pallette1 = vgui.Create( \"DColorPalette\", frame ) -- First DColorPalette with 4 colors per row\npallette1:SetPos( 4, 60 )\npallette1:SetNumRows( 4 )\npallette1:SetSize( 40, 60 )\npallette1:Reset()\n\nlocal pallette2 = vgui.Create( \"DColorPalette\", frame ) -- Second DColorPalette with 8 colors per row\npallette2:SetPos( 4, 130 )\npallette2:SetNumRows( 8 )\npallette2:SetSize( 80, 60 )\npallette2:Reset()\n\nlocal pallette3 = vgui.Create( \"DColorPalette\", frame ) -- Third DColorPalette with 16 colors per row\npallette3:SetPos( 4, 200 )\npallette3:SetNumRows( 16 )\npallette3:SetSize( 160, 60 )\npallette3:Reset()\n\nlocal pallette4 = vgui.Create( \"DColorPalette\", frame ) -- Fourth DColorPalette with 24 colors per row\npallette4:SetPos( 4, 270 )\npallette4:SetNumRows( 24 )\npallette4:SetSize( 240, 60 )\npallette4:Reset()","output":{"image":{"src":"setnumrows_demonstration.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateConVar","parent":"DColorPalette","type":"panelfunc","description":{"text":"Internal helper function for DColorPalette:UpdateConVars.","internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"193-L199"},"args":{"arg":[{"text":"The name of the console variable to set","name":"name","type":"string"},{"text":"The key of the 3rd argument to set the convar to\nPossible values: \"r\", \"g\", \"b\", \"a\"","name":"key","type":"string"},{"text":"The Color to retrieve the info from.","name":"clr","type":"Color"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateConVars","parent":"DColorPalette","type":"panelfunc","description":{"text":"Updates all the console variables set by DColorPalette:SetConVarR and so on with given color.\n\nCalled internally when a palette color is clicked.","internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolorpalette.lua","line":"201-L208"},"args":{"arg":{"text":"A Color","name":"clr","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddSheet","parent":"DColumnSheet","type":"panelfunc","description":"Adds a new column/tab.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolumnsheet.lua","line":"24-L62"},"args":{"arg":[{"text":"Name of the column/tab","name":"name","type":"string"},{"text":"Panel to be used as contents of the tab. This normally would be a DPanel","name":"pnl","type":"Panel"},{"text":"Icon for the tab. This will ideally be a silkicon, but any material name can be used.","name":"icon","type":"string","default":"nil"}]},"rets":{"ret":{"text":"A table containing the following keys:\n* DButton / DImageButton Button - The created tab button that will switch to the given panel.\n* Panel Panel - The given panel to switch to when the button is pressed.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetActiveButton","parent":"DColumnSheet","type":"panelfunc","description":"An Global.AccessorFunc that returns the active button of this DColumnSheet.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolumnsheet.lua","line":"4"},"rets":{"ret":{"text":"The active button","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetActiveButton","parent":"DColumnSheet","type":"panelfunc","description":{"text":"An Global.AccessorFunc that makes a button an active button for this DColumnSheet.","internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcolumnsheet.lua","line":"64-L83"},"args":{"arg":{"text":"The button to make active button","name":"active","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UseButtonOnlyStyle","parent":"DColumnSheet","type":"panelfunc","description":"Makes the tabs/buttons show only the image and no text.","realm":"Client and Menu","file":{"text":"lua/vgui/dcolumnsheet.lua","line":"20-L22"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnMenuOpened","parent":"DComboBox","type":"panelhook","description":"Called when the player opens the dropdown menu. For Override","realm":"Client and Menu","file":{"text":"lua/vgui/dcombobox.lua","line":"126-L130"},"added":"2021.12.15","args":{"arg":{"text":"The DMenu menu panel.","name":"menu","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnSelect","parent":"DComboBox","type":"panelhook","description":"Called when an option in the combo box is selected. This function does nothing by itself, you're supposed to overwrite it.","realm":"Client and Menu","file":{"text":"lua/vgui/dcombobox.lua","line":"120-L124"},"args":{"arg":[{"text":"The index of the option for use with other DComboBox functions.","name":"index","type":"number"},{"text":"The name of the option.","name":"value","type":"string"},{"text":"The data assigned to the option.","name":"data","type":"any"}]}},"example":{"description":"Creates a combo box that controls the color of the background panel.","code":"local frame = vgui.Create(\"DFrame\")\nframe:SetSize( 500, 500 )\nframe:Center()\nframe:MakePopup()\n\n-- Background panel\nlocal BGPanel = vgui.Create( \"DPanel\", frame )\nBGPanel:Dock( FILL )\n\nlocal cbox = vgui.Create( \"DComboBox\", BGPanel )\ncbox:SetPos( 5, 5 )\ncbox:SetSize( 190, 20 )\ncbox:SetValue( \"Pick a color\" ) -- Default text\n\n-- Color choices\ncbox:AddChoice( \"Red\", Color( 255, 0, 0 ) )\ncbox:AddChoice( \"Orange\", Color( 255, 128, 0 ) )\ncbox:AddChoice( \"Yellow\", Color( 255, 255, 0 ) )\ncbox:AddChoice( \"Green\", Color( 0, 255, 0 ) )\ncbox:AddChoice( \"Blue\", Color( 0, 0, 255 ) )\ncbox:AddChoice( \"Indigo\", Color( 64, 0, 255 ) )\ncbox:AddChoice( \"Violet\", Color( 128, 0, 255 ) )\ncbox:AddChoice( \"Pink\", Color( 255, 0, 255 ) )\n\nfunction cbox:OnSelect( index, text, data )\n\n\t-- Set background panel color\n\tBGPanel:SetBackgroundColor( data )\n\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddChoice","parent":"DComboBox","type":"panelfunc","description":"Adds a choice to the combo box.","file":{"text":"lua/vgui/dcombobox.lua","line":"138-L158"},"realm":"Client and Menu","args":{"arg":[{"text":"The text show to the user.","name":"value","type":"string"},{"text":"The data accompanying this string. If left empty, the value argument is used instead.\n\nCan be accessed with the second argument of DComboBox:GetSelected, DComboBox:GetOptionData and as an argument of DComboBox:OnSelect.","name":"data","type":"any","default":"nil"},{"text":"Should this be the default selected text show to the user or not.","name":"select","type":"boolean","default":"false"},{"text":"Adds an icon for this choice.","name":"icon","type":"string","default":"nil"}]},"rets":{"ret":{"text":"The index of the new option.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddSpacer","parent":"DComboBox","type":"panelfunc","description":"Adds a spacer below the currently last item in the drop down. Recommended to use with DComboBox:SetSortItems set to `false`.","file":{"text":"lua/vgui/dcombobox.lua","line":"132-L136"},"realm":"Client and Menu","added":"2021.03.31"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CheckConVarChanges","parent":"DComboBox","type":"panelfunc","description":{"text":"Ran every frame to update the value of this panel to the value of the associated convar. See Panel:SetConvar.","internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dcombobox.lua","line":"247-L258"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ChooseOption","parent":"DComboBox","type":"panelfunc","description":"Selects a combo box option by its index and changes the text displayed at the top of the combo box.","realm":"Client and Menu","file":{"text":"lua/vgui/dcombobox.lua","line":"85-L97"},"args":{"arg":[{"text":"The text to display at the top of the combo box.","name":"value","type":"string"},{"text":"The option index.","name":"index","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ChooseOptionID","parent":"DComboBox","type":"panelfunc","description":"Selects an option within a combo box based on its table index.","realm":"Client and Menu","file":{"text":"lua/vgui/dcombobox.lua","line":"99-L104"},"args":{"arg":{"text":"Selects the option with given index.","name":"index","type":"number"}}},"example":{"description":"A simple combo box menu which gives choices for a favorite lunch meal, including a non-preference choice which randomly chooses an option.","code":"BGPanel = vgui.Create(\"DPanel\")\nBGPanel:SetPos(20, 20)\nBGPanel:SetSize(200, 100)\n\n-- Text output\nlocal lbl = vgui.Create(\"DLabel\", BGPanel)\nlbl:SetPos(10, 80)\nlbl:SetSize(180, 20)\nlbl:SetDark(true)\nlbl:SetText(\"You choose...\")\n\n-- Combo box\nlocal cbox = vgui.Create(\"DComboBox\", BGPanel)\ncbox:SetPos(5, 5)\ncbox:SetSize(190, 20)\n\ncbox:SetValue(\"What's your favorite lunch meal?\")\n\n-- Choices\ncbox:AddChoice(\"BBQ Chicken\")\ncbox:AddChoice(\"Fish and Chips\")\ncbox:AddChoice(\"Pizza\")\ncbox:AddChoice(\"Potato Salad\")\ncbox:AddChoice(\"Roast Beef Sandwich\")\ncbox:AddChoice(\"Spaghetti\")\n\n-- No preference: data is set to -1\ncbox:AddChoice(\"I don't have a favorite.\", -1)\n\nfunction cbox:OnSelect(index, value, data)\n\n\t-- No preference? Choose a random choice\n\tif(data == -1) then\t\t\t\t\n\t\tself:ChooseOptionID(math.random(1, 6))\n\t\t\n\t-- Otherwise update the text label with our choice\n\telse\n\t\tlbl:SetText(\"You choose \"..value..\".\")\n\tend\n\t\nend","output":{"image":{"src":"DComboBox_ChooseOptionID_example1.gif"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Clear","parent":"DComboBox","type":"panelfunc","description":"Clears the combo box's text value, choices, and data values.","realm":"Client and Menu","file":{"text":"lua/vgui/dcombobox.lua","line":"29-L40"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CloseMenu","parent":"DComboBox","type":"panelfunc","description":"Closes the combo box menu. Called when the combo box is clicked while open.","realm":"Client and Menu","file":{"text":"lua/vgui/dcombobox.lua","line":"236-L244"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetOptionData","parent":"DComboBox","type":"panelfunc","description":"Returns an option's data based on the given index.","realm":"Client and Menu","file":{"text":"lua/vgui/dcombobox.lua","line":"48-L52"},"args":{"arg":{"text":"The option index.","name":"index","type":"number"}},"rets":{"ret":{"text":"The option's data value.","name":"","type":"any"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetOptionText","parent":"DComboBox","type":"panelfunc","description":"Returns an option's text based on the given index.","realm":"Client and Menu","file":{"text":"lua/vgui/dcombobox.lua","line":"42-L46"},"args":{"arg":{"text":"The option index.","name":"index","type":"number"}},"rets":{"ret":{"text":"The option's text value.","name":"","type":"string"}}},"example":{"description":"Create a combo box listing some colors and print the 3rd option's text.","code":"local cbox = vgui.Create(\"DComboBox\")\ncbox:SetPos(5, 5)\ncbox:SetSize(200, 20)\n\ncbox:SetValue(\"Colors\")\ncbox:AddChoice(\"Red\")\ncbox:AddChoice(\"Green\")\ncbox:AddChoice(\"Blue\")\ncbox:AddChoice(\"Yellow\")\n\nprint(cbox:GetOptionText(3))","output":"Blue"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetOptionTextByData","parent":"DComboBox","type":"panelfunc","description":"Returns an option's text based on the given data.","realm":"Client and Menu","file":{"text":"lua/vgui/dcombobox.lua","line":"54-L72"},"args":{"arg":{"text":"The data to look up the name of.\n\nIf given a number and no matching data was found, the function will test given data against each Global.tonumber'd data entry.","name":"data","type":"string"}},"rets":{"ret":{"text":"The option's text value.\n\nIf no matching data was found, the data itself will be returned. If multiple identical data entries exist, the first instance will be returned.","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSelected","parent":"DComboBox","type":"panelfunc","description":"Returns the currently selected option's text and data","realm":"Client and Menu","file":{"text":"lua/vgui/dcombobox.lua","line":"112-L118"},"rets":{"ret":[{"text":"The option's text value.","name":"","type":"string"},{"text":"The option's stored data.","name":"","type":"any"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSelectedID","parent":"DComboBox","type":"panelfunc","description":"Returns the index (ID) of the currently selected option.","realm":"Client and Menu","file":{"text":"lua/vgui/dcombobox.lua","line":"106-L110"},"rets":{"ret":{"text":"The ID of the currently selected option.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSortItems","parent":"DComboBox","type":"panelfunc","description":"An Global.AccessorFunc that returns an whether the items in the dropdown will be alphabetically sorted or not.\n\nSee DComboBox:SetSortItems.","file":{"text":"lua/vgui/dcombobox.lua","line":"8"},"realm":"Client and Menu","rets":{"ret":{"text":"True if enabled, false otherwise.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsMenuOpen","parent":"DComboBox","type":"panelfunc","description":"Returns whether or not the combo box's menu is opened.","realm":"Client and Menu","file":{"text":"lua/vgui/dcombobox.lua","line":"170-L174"},"rets":{"ret":{"text":"True if the menu is open, false otherwise.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OpenMenu","parent":"DComboBox","type":"panelfunc","description":"Opens the combo box drop down menu. Called when the combo box is clicked.","file":{"text":"lua/vgui/dcombobox.lua","line":"176-L234"},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"RemoveChoice","parent":"DComboBox","type":"panelfunc","description":"Removes a choice added with DComboBox:AddChoice","realm":"Client and Menu","file":{"text":"lua/vgui/dcombobox.lua","line":"160-L168"},"added":"2023.09.08","args":{"arg":{"text":"The index of the option to remove.","name":"index","type":"number"}},"rets":{"ret":[{"text":"The text of the removed option.","name":"text","type":"string"},{"text":"The data of the removed option that was provided.","name":"data","type":"any"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSortItems","parent":"DComboBox","type":"panelfunc","description":"An Global.AccessorFunc that sets whether or not the items should be sorted alphabetically in the dropdown menu of the DComboBox. If set to false, items will appear in the order they were added by DComboBox:AddChoice calls.\n\nThis is enabled by default.","file":{"text":"lua/vgui/dcombobox.lua","line":"8"},"realm":"Client and Menu","args":{"arg":{"text":"true to enable, false to disable","name":"sort","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetValue","parent":"DComboBox","type":"panelfunc","description":"Sets the text shown in the combo box when the menu is not collapsed.","file":{"text":"lua/vgui/dcombobox.lua","line":"266-L270"},"realm":"Client and Menu","args":{"arg":{"text":"The text in the DComboBox.","name":"value","type":"string"}}},"example":{"description":"A simple feedback combo box which has the value set to a thank you message once a choice is clicked.","code":"BGPanel = vgui.Create(\"DPanel\")\nBGPanel:SetPos(20, 20)\nBGPanel:SetSize(200, 30)\n\nlocal cbox = vgui.Create(\"DComboBox\", BGPanel)\ncbox:SetPos(5, 5)\ncbox:SetSize(190, 20)\n\ncbox:SetValue(\"What do you think of this server?\")\n\n-- Responses\ncbox:AddChoice(\"It's the best server of all time!\")\ncbox:AddChoice(\"It's pretty good.\")\ncbox:AddChoice(\"It's okay.\")\ncbox:AddChoice(\"It's not that good.\")\ncbox:AddChoice(\"Don't bother me with this.\")\n\nfunction cbox:OnSelect(index, value, data)\n\n\t-- Clear combo box and set a thank you message\n\tself:Clear()\n\tself:SetText(\"Thank you for your feedback!\")\n\t\n\t-- Here you would send the feedback to the server using a net message\n\t-- The choice is stored in the 'data' variable\n\nend","output":{"image":{"src":"DComboBox_SetValue_example1.gif"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnModified","parent":"DDragBase","type":"panelhook","description":"Called when anything is dropped on or rearranged within the DDragBase. For Override","realm":"Client and Menu","file":{"text":"lua/vgui/ddragbase.lua","line":"139-L141"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DropAction_Copy","parent":"DDragBase","type":"panelfunc","description":{"text":"Internal function used in DDragBase:MakeDroppable","internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/ddragbase.lua","line":"47-L51"},"args":{"arg":[{"name":"drops","type":"table"},{"name":"bDoDrop","type":"boolean"},{"name":"command","type":"string"},{"name":"y","type":"number"},{"name":"x","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DropAction_Normal","parent":"DDragBase","type":"panelfunc","description":{"text":"Internal function used in DDragBase:DropAction_Copy","internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/ddragbase.lua","line":"72-L137"},"args":{"arg":[{"name":"drops","type":"table"},{"name":"bDoDrop","type":"boolean"},{"name":"command","type":"string"},{"name":"y","type":"number"},{"name":"x","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DropAction_Simple","parent":"DDragBase","type":"panelfunc","description":{"text":"Internal function used in DDragBase:DropAction_Normal","internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/ddragbase.lua","line":"53-L70"},"args":{"arg":[{"name":"drops","type":"table"},{"name":"bDoDrop","type":"boolean"},{"name":"command","type":"string"},{"name":"y","type":"number"},{"name":"x","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDnD","parent":"DDragBase","type":"panelfunc","description":"Returns the drag'n'drop group this panel belongs to. See DDragBase:MakeDroppable. An Global.AccessorFunc","realm":"Client and Menu","file":{"text":"lua/vgui/ddragbase.lua","line":"4"},"rets":{"ret":{"text":"Name of the DnD family.","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetReadOnly","parent":"DDragBase","type":"panelfunc","description":"Returns whether this panel is read only or not for drag'n'drop purposes. An Global.AccessorFunc","realm":"Client and Menu","file":{"text":"lua/vgui/ddragbase.lua","line":"6"},"rets":{"ret":{"text":"Whether this panel is read only or not.","name":"name","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetUseLiveDrag","parent":"DDragBase","type":"panelfunc","description":"Whether this panel uses live drag'n'drop previews. An Global.AccessorFunc","realm":"Client and Menu","file":{"text":"lua/vgui/ddragbase.lua","line":"5"},"rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MakeDroppable","parent":"DDragBase","type":"panelfunc","description":"Makes the panel a receiver for any droppable panel with the same DnD name. Internally calls Panel:Receiver.\n\nSee Drag and Drop for VGUI.","realm":"Client and Menu","file":{"text":"lua/vgui/ddragbase.lua","line":"34-L44"},"args":{"arg":[{"text":"The unique name for the receiver slot. Only droppable panels with the same DnD name as this can be dropped on the panel.","name":"name","type":"string"},{"text":"Whether or not to allow droppable panels to be copied when the  key is held down.","name":"allowCopy","type":"boolean","key":"Ctrl"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDnD","parent":"DDragBase","type":"panelfunc","description":{"text":"Used internally by DDragBase:MakeDroppable. \n\nSee also DDragBase:GetDnD \n\nAn Global.AccessorFunc","internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/ddragbase.lua","line":"4"},"args":{"arg":{"text":"Name of the DnD family.","name":"name","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDropPos","parent":"DDragBase","type":"panelfunc","description":"Determines where you can drop stuff.\n\"4\" for left\n\"5\" for center\n\"6\" for right\n\"8\" for top\n\"2\" for bottom","realm":"Client and Menu","file":{"text":"lua/vgui/ddragbase.lua","line":"24-L32"},"args":{"arg":{"text":"Where you're allowed to drop things.","name":"pos","type":"string","default":"5"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetReadOnly","parent":"DDragBase","type":"panelfunc","description":"Sets whether this panel is read only or not for drag'n'drop purposes. If set to `true`, you can only copy from this panel, and cannot modify its contents. This is an Global.AccessorFunc","realm":"Client and Menu","file":{"text":"lua/vgui/ddragbase.lua","line":"6"},"args":{"arg":{"text":"Whether this panel should be read only or not.","name":"name","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetUseLiveDrag","parent":"DDragBase","type":"panelfunc","description":"Whether to use live drag'n'drop previews. This is an Global.AccessorFunc","realm":"Client and Menu","file":{"text":"lua/vgui/ddragbase.lua","line":"5"},"args":{"arg":{"name":"newState","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateDropTarget","parent":"DDragBase","type":"panelfunc","description":{"text":"Internal function used in DDragBase:DropAction_Normal","internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/ddragbase.lua","line":"143-L168"},"args":{"arg":[{"name":"drop","type":"number"},{"name":"pnl","type":"Panel"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Close","parent":"DDrawer","type":"panelfunc","description":"Closes the DDrawer.","realm":"Client and Menu","file":{"text":"lua/vgui/ddrawer.lua","line":"68-L76"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetOpenSize","parent":"DDrawer","type":"panelfunc","description":"An Global.AccessorFunc that returns the Open Size of DDrawer.","realm":"Client and Menu","file":{"text":"lua/vgui/ddrawer.lua","line":"4"},"rets":{"ret":{"text":"Open size.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetOpenTime","parent":"DDrawer","type":"panelfunc","description":"An Global.AccessorFunc that returns the Open Time of DDrawer.","realm":"Client and Menu","file":{"text":"lua/vgui/ddrawer.lua","line":"5"},"rets":{"ret":{"text":"Time in seconds.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Open","parent":"DDrawer","type":"panelfunc","description":"Opens the DDrawer.","realm":"Client and Menu","file":{"text":"lua/vgui/ddrawer.lua","line":"58-L66"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetOpenSize","parent":"DDrawer","type":"panelfunc","description":"An Global.AccessorFunc that sets the height of DDrawer","realm":"Client and Menu","file":{"text":"lua/vgui/ddrawer.lua","line":"4"},"args":{"arg":{"text":"Height of DDrawer. Default is `100`.","name":"Value","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetOpenTime","parent":"DDrawer","type":"panelfunc","description":"An Global.AccessorFunc that sets the time (in seconds) for DDrawer to open.","realm":"Client and Menu","file":{"text":"lua/vgui/ddrawer.lua","line":"5"},"args":{"arg":{"text":"Length in seconds. Default is 0.3","name":"value","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Toggle","parent":"DDrawer","type":"panelfunc","description":"Toggles the DDrawer.","realm":"Client and Menu","file":{"text":"lua/vgui/ddrawer.lua","line":"48-L56"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnEntityLost","parent":"DEntityProperties","type":"panelhook","description":"Called when we were editing an entity and then it became invalid (probably removed). For Override","realm":"Client","file":{"text":"lua/vgui/dentityproperties.lua","line":"106-L110"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"EditVariable","parent":"DEntityProperties","type":"panelfunc","description":{"text":"Called internally by DEntityProperties:RebuildControls.","internal":""},"realm":"Client","file":{"text":"lua/vgui/dentityproperties.lua","line":"59-L94"},"args":{"arg":[{"name":"varname","type":"string"},{"name":"editdata","type":"table"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"EntityLost","parent":"DEntityProperties","type":"panelfunc","description":{"text":"Called internally when an entity being edited became invalid.\n\nYou should use DEntityProperties:OnEntityLost instead.","internal":""},"realm":"Client","file":{"text":"lua/vgui/dentityproperties.lua","line":"99-L104"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"RebuildControls","parent":"DEntityProperties","type":"panelfunc","description":{"text":"Called internally by DEntityProperties:SetEntity to rebuild the controls.","internal":""},"realm":"Client","file":{"text":"lua/vgui/dentityproperties.lua","line":"26-L54"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetEntity","parent":"DEntityProperties","type":"panelfunc","description":"Sets the entity to be edited by this panel. The entity must support the Editable Entities system or nothing will happen.","realm":"Client","file":{"text":"lua/vgui/dentityproperties.lua","line":"14-L21"},"args":{"arg":{"text":"The entity to edit","name":"ent","type":"Entity"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetExpanded","parent":"DExpandButton","type":"panelfunc","description":"Returns whether this DExpandButton is expanded or not.","realm":"Client and Menu","file":{"text":"lua/vgui/dexpandbutton.lua","line":"4"},"rets":{"ret":{"text":"True if expanded, false otherwise","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetExpanded","parent":"DExpandButton","type":"panelfunc","description":"Sets whether this DExpandButton should be expanded or not. Only changes appearance.","realm":"Client and Menu","file":{"text":"lua/vgui/dexpandbutton.lua","line":"4"},"args":{"arg":{"text":"True to expand ( visually will show a \"-\" )","name":"expanded","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnDoubleClick","parent":"DFileBrowser","type":"panelhook","description":{"text":"Called when a file is double-clicked.","note":"Double-clicking a file or icon will trigger **both** this and DFileBrowser:OnSelect."},"realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"297-L301"},"args":{"arg":[{"text":"The panel that was double-clicked to select this file.\n\nThis will either be a DListView_Line or SpawnIcon depending on whether the model viewer mode is enabled. See DFileBrowser:SetModels.","name":"selectedPanel","type":"Panel"},{"text":"The path to the file that was double-clicked.","name":"filePath","type":"string"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnRightClick","parent":"DFileBrowser","type":"panelhook","description":{"text":"Called when a file is right-clicked.","note":"When not in model viewer mode, DFileBrowser:OnSelect will also be called if the file is not already selected."},"realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"303-L307"},"args":{"arg":[{"text":"The path to the file that was right-clicked.","name":"filePath","type":"string"},{"text":"The panel that was right-clicked to select this file.\n\nThis will either be a DListView_Line or SpawnIcon depending on whether the model viewer mode is enabled. \nSee DFileBrowser:SetModels.","name":"selectedPanel","type":"Panel"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnSelect","parent":"DFileBrowser","type":"panelhook","description":"Called when a file is selected.","realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"291-L295"},"args":{"arg":[{"text":"The panel that was clicked to select this file.\n\nThis will either be a DListView_Line or SpawnIcon depending on whether the model viewer mode is enabled. See DFileBrowser:SetModels.","name":"selectedPanel","type":"Panel"},{"text":"The path to the file that was selected.","name":"filePath","type":"string"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Clear","parent":"DFileBrowser","type":"panelfunc","description":"Clears the file tree and list, and resets all values.","realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"273-L283"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetBaseFolder","parent":"DFileBrowser","type":"panelfunc","description":"An Global.AccessorFunc that returns the root directory/folder of the file tree.","realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"7"},"rets":{"ret":{"text":"The path to the root folder.","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetCurrentFolder","parent":"DFileBrowser","type":"panelfunc","description":"An Global.AccessorFunc that returns the current directory/folder being displayed.","realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"8"},"rets":{"ret":{"text":"The directory the file list is currently displaying.","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetFileTypes","parent":"DFileBrowser","type":"panelfunc","description":"An Global.AccessorFunc that returns the current file type filter on the file list.","realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"6"},"rets":{"ret":{"text":"The current filter applied to the file list.","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetFolderNode","parent":"DFileBrowser","type":"panelfunc","description":"Returns the DTree Node that the file tree stems from.\n\nThis is a child of the root node of the DTree.","realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"267-L271"},"rets":{"ret":{"text":"The DTree_Node used for the tree.","name":"","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetModels","parent":"DFileBrowser","type":"panelfunc","description":"An Global.AccessorFunc that returns whether or not the model viewer mode is enabled. In this mode, files are displayed as SpawnIcons instead of a list.","realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"10"},"rets":{"ret":{"text":"Whether or not files will be displayed using SpawnIcons.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetName","parent":"DFileBrowser","type":"panelfunc","description":"An Global.AccessorFunc that returns the name being used for the file tree.","realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"4"},"rets":{"ret":{"text":"The name used for the root of the file tree.","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetOpen","parent":"DFileBrowser","type":"panelfunc","description":"An Global.AccessorFunc that returns whether or not the file tree is open.","realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"11"},"rets":{"ret":{"text":"Whether or not the file tree is open.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetPath","parent":"DFileBrowser","type":"panelfunc","description":"An Global.AccessorFunc that returns the access path of the file tree. This is `GAME` unless changed with DFileBrowser:SetPath.\n\nSee file.Read for how paths work.","realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"5"},"rets":{"ret":{"text":"The current access path i.e. \"GAME\", \"LUA\", \"DATA\" etc.","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetSearch","parent":"DFileBrowser","type":"panelfunc","description":"An Global.AccessorFunc that returns the current search filter on the file tree.","realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"9"},"rets":{"ret":{"text":"The filter in use on the file tree.","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetBaseFolder","parent":"DFileBrowser","type":"panelfunc","description":"An Global.AccessorFunc that sets the root directory/folder of the file tree.\n\nThis needs to be set for the file tree to be displayed.","realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"50-L57"},"args":{"arg":{"text":"The path to the folder to use as the root.","name":"baseDir","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetCurrentFolder","parent":"DFileBrowser","type":"panelfunc","description":"An Global.AccessorFunc that sets the directory/folder from which to display the file list.","realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"104-L118"},"args":{"arg":{"text":"The directory to display files from.","name":"currentDir","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetFileTypes","parent":"DFileBrowser","type":"panelfunc","description":"An Global.AccessorFunc that sets the file type filter for the file list.\n\nThis accepts the same file extension wildcards as file.Find.","realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"81-L90"},"args":{"arg":{"text":"A list of file types to display, separated by spaces e.g.\n```\n\"*.lua *.txt *.mdl\"\n```","name":"fileTypes","type":"string","default":"*.*"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetModels","parent":"DFileBrowser","type":"panelfunc","description":{"text":"Enables or disables the model viewer mode. In this mode, files are displayed as SpawnIcons instead of a list.","note":"This should only be used for `.mdl` files; the spawn icons will display error models for others. See DFileBrowser:SetFileTypes"},"realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"92-L102"},"args":{"arg":{"text":"Whether or not to display files using SpawnIcons.","name":"showModels","type":"boolean","default":"false"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetName","parent":"DFileBrowser","type":"panelfunc","description":"An Global.AccessorFunc that sets the name to use for the file tree.","realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"36-L48"},"args":{"arg":{"text":"The name for the root of the file tree. Passing no value causes this to be the base folder name. See DFileBrowser:SetBaseFolder.","name":"treeName","type":"string","default":"`baseFolder`"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetOpen","parent":"DFileBrowser","type":"panelfunc","description":"An Global.AccessorFunc that opens or closes the file tree.","realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"120-L131"},"args":{"arg":[{"text":"`true` to open the tree, `false` to close it.","name":"open","type":"boolean","default":"false"},{"text":"If `true`, the DTree's open/close animation is used.","name":"useAnim","type":"boolean","default":"false"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetPath","parent":"DFileBrowser","type":"panelfunc","description":"An Global.AccessorFunc that sets the access path for the file tree. This is set to `GAME` by default.\n\nSee file.Read for how paths work.","realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"59-L66"},"args":{"arg":{"text":"The access path i.e. \"GAME\", \"LUA\", \"DATA\" etc.","name":"path","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetSearch","parent":"DFileBrowser","type":"panelfunc","description":"An Global.AccessorFunc that sets the search filter for the file tree.\n\nThis accepts the same wildcards as file.Find.","realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"68-L79"},"args":{"arg":{"text":"The filter to use on the file tree.","name":"filter","type":"string","default":"*"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Setup","parent":"DFileBrowser","type":"panelfunc","description":{"text":"Called to set up the DTree and file viewer when a base path has been set.\n\nCalls DFileBrowser:SetupTree and DFileBrowser:SetupFiles.","internal":""},"realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"202-L208"},"rets":{"ret":{"text":"Whether or not the variables needed to set up have been defined.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetupFiles","parent":"DFileBrowser","type":"panelfunc","description":{"text":"Called to set up the DListView or DIconBrowser by DFileBrowser:Setup.\n\nThe icon browser is used when in models mode. See DFileBrowser:SetModels.","internal":""},"realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"169-L200"},"rets":{"ret":{"text":"Whether or not the files pane was set up successfully.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetupTree","parent":"DFileBrowser","type":"panelfunc","description":{"text":"Called to set up the DTree by DFileBrowser:Setup.","internal":""},"realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"143-L167"},"rets":{"ret":{"text":"Whether or not the tree was set up successfully.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ShowFolder","parent":"DFileBrowser","type":"panelfunc","description":{"text":"Builds the file or icon list for the current directory.\n\nYou should use DFileBrowser:SetCurrentFolder to change the directory.","internal":""},"realm":"Client","file":{"text":"lua/vgui/dfilebrowser.lua","line":"210-L257"},"args":{"arg":{"text":"The directory to populate the list from.","name":"currentDir","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SortFiles","parent":"DFileBrowser","type":"panelfunc","description":{"text":"Sorts the file list.","note":"This is only functional when not using the model viewer. See DFileBrowser:SetModels"},"realm":"Client","args":{"arg":{"text":"The sort order. `true` for descending (z-a), `false` for ascending (a-z).","name":"descending","type":"boolean","default":"false"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddItem","parent":"DForm","type":"panelfunc","description":"Adds one or two items to the DForm.\nIf this method is called with only one argument, it is added to the bottom of the form. If two arguments are passed, they are placed side-by-side at the bottom of the form.\n\nInternally, this function is used by the various DForm functions to, for example, add labels to the left of buttons.","realm":"Client and Menu","file":{"text":"lua/vgui/dform.lua","line":"42-L73"},"args":{"arg":[{"text":"Left-hand element to add to the DForm.","name":"left","type":"Panel"},{"text":"Right-hand element to add to the DForm.","name":"right","type":"Panel","default":"nil"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Button","parent":"DForm","type":"panelfunc","description":"Adds a DButton onto the DForm","realm":"Client and Menu","file":{"text":"lua/vgui/dform.lua","line":"254-L267"},"args":{"arg":[{"text":"The text on the button","name":"text","type":"string"},{"text":"The concommand to run when the button is clicked","name":"concommand","type":"string","default":""},{"text":"The arguments to pass on to the concommand when the button is clicked","name":"args","type":"vararg","default":"nil"}]},"rets":{"ret":{"text":"The created DButton","name":"","type":"DButton"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CheckBox","parent":"DForm","type":"panelfunc","description":{"text":"Adds a DCheckBoxLabel onto the DForm.","note":"This will run DCheckBoxLabel:OnChange when being added. This is caused by Panel:SetConVar being used when this function is used. To avoid this, use DForm:AddItem with a DCheckBoxLabel."},"realm":"Client and Menu","file":{"text":"lua/vgui/dform.lua","line":"192-L203"},"args":{"arg":[{"text":"The label to be set next to the check box","name":"label","type":"string"},{"text":"The console variable to change when this is changed","name":"convar","type":"string"}]},"rets":{"ret":{"text":"The created DCheckBoxLabel","name":"","type":"DCheckBoxLabel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ComboBox","parent":"DForm","type":"panelfunc","description":"Adds a DComboBox onto the DForm","realm":"Client and Menu","file":{"text":"lua/vgui/dform.lua","line":"134-L152"},"args":{"arg":[{"text":"Text to the left of the combo box","name":"title","type":"string"},{"text":"Console variable to change when the user selects something from the dropdown.","name":"convar","type":"string"}]},"rets":{"ret":[{"text":"The created DComboBox","name":"","type":"DComboBox"},{"text":"The created DLabel","name":"","type":"DLabel"}]}},"example":{"code":"local frame = vgui.Create( \"DFrame\" )\nframe:SetSize( ScrW() / 2, ScrH() / 2 )\nframe:MakePopup()\n\nlocal form = frame:Add(\"DForm\")\nform:Dock( FILL )\nform:DockMargin( 5, 5, 5, 5 )\n\nlocal combobox, label = form:ComboBox( \"test\", \"sv_accelerate\" )\ncombobox:AddChoice( \"10\" ) -- 10 will be used as convar value\ncombobox:AddChoice( \"1000\", 100 ) -- 100 will be used as convar value"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ControlHelp","parent":"DForm","type":"panelfunc","description":"Adds a DLabel onto the DForm. Unlike DForm:Help, this is indented and is colored blue, depending on the derma skin.","realm":"Client and Menu","file":{"text":"lua/vgui/dform.lua","line":"225-L247"},"args":{"arg":{"text":"The help message to be displayed.","name":"help","type":"string"}},"rets":{"ret":{"text":"The created DLabel","name":"","type":"DLabel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetAutoSize","parent":"DForm","type":"panelfunc","realm":"Client and Menu","file":{"text":"lua/vgui/dform.lua","line":"6"},"description":{"text":"An Accessor Function in DForm that does nothing.","deprecated":""},"rets":{"ret":{"type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSpacing","parent":"DForm","type":"panelfunc","realm":"Client and Menu","file":{"text":"lua/vgui/dform.lua","line":"7"},"description":{"text":"An Global.AccessorFunc that does nothing.","deprecated":""},"rets":{"ret":{"type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Help","parent":"DForm","type":"panelfunc","description":"Adds a DLabel onto the DForm as a helper","realm":"Client and Menu","file":{"text":"lua/vgui/dform.lua","line":"205-L223"},"args":{"arg":{"text":"The help message to be displayed","name":"help","type":"string"}},"rets":{"ret":{"text":"The created DLabel","name":"","type":"DLabel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ListBox","parent":"DForm","type":"panelfunc","description":{"text":"Adds a DListBox onto the DForm","deprecated":"Use DListView with DForm:AddItem instead."},"realm":"Client and Menu","file":{"text":"lua/vgui/dform.lua","line":"277-L295"},"args":{"arg":{"text":"The label to set on the DListBox","name":"label","type":"string","default":"nil"}},"rets":{"ret":[{"text":"The created DListBox","name":"","type":"DListBox"},{"text":"The created DLabel if label string was specified","name":"","type":"DLabel"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"NumberWang","parent":"DForm","type":"panelfunc","description":"Adds a DNumberWang onto the DForm","realm":"Client and Menu","file":{"text":"lua/vgui/dform.lua","line":"154-L172"},"args":{"arg":[{"text":"The label to be placed next to the DNumberWang","name":"label","type":"string"},{"text":"The console variable to change when the slider is changed","name":"convar","type":"string"},{"text":"The minimum value of the slider","name":"min","type":"number"},{"text":"The maximum value of the slider","name":"max","type":"number"},{"text":"The number of decimals to allow in the slider (Optional)","name":"decimals","type":"number","default":"nil"}]},"rets":{"ret":[{"text":"The created DNumberWang","name":"","type":"DNumberWang"},{"text":"The created DLabel","name":"","type":"DLabel"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"NumSlider","parent":"DForm","type":"panelfunc","description":"Adds a DNumSlider onto the DForm","realm":"Client and Menu","file":{"text":"lua/vgui/dform.lua","line":"174-L190"},"args":{"arg":[{"text":"A short label for the slider.","name":"label","type":"string"},{"text":"The [console variable](ConVars) to change when the slider is changed","name":"convar","type":"string"},{"text":"The minimum value of the slider","name":"min","type":"number"},{"text":"The maximum value of the slider","name":"max","type":"number"},{"text":"The number of decimals to allow for the slider value.","name":"decimals","type":"number","default":"2"}]},"rets":{"ret":{"text":"The created DNumSlider.","name":"","type":"DNumSlider"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PanelSelect","parent":"DForm","type":"panelfunc","description":{"text":"Creates a DPanelSelect and docks it to the top of the DForm.","deprecated":"This is derived from the deprecated DPanelSelect."},"realm":"Client and Menu","file":{"text":"lua/vgui/dform.lua","line":"269-L275"},"rets":{"ret":{"text":"The created DPanelSelect.","name":"","type":"DPanelSelect"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PropSelect","parent":"DForm","type":"panelfunc","description":"Creates a PropSelect panel and docks it to the top of the DForm.","realm":"Client and Menu","added":"2021.12.15","file":{"text":"lua/vgui/dform.lua","line":"91-L132"},"args":{"arg":[{"text":"The label to display above the prop select.","name":"label","type":"string"},{"text":"The convar to set the selected model to.","name":"convar","type":"string"},{"text":"A table of models to display for selection. Supports 2 formats:\n1) Key is the model and value are the convars to set when that model is selected in format `convar=value`\n2) An table of tables where each table must have the following keys:\n* string model - The model.\n* number skin - Model's skin. Defaults to 0\n* string tooltip - Displayed when user hovers over the model. Defaults to the model path.\n* The key of the table is the value of the convar.","name":"models","type":"table"},{"text":"The height of the prop select panel, in 64px icon increments.","name":"height","type":"number","default":"2"}]},"rets":{"ret":{"text":"The created PropSelect panel.","name":"","type":"PropSelect"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Rebuild","parent":"DForm","type":"panelfunc","realm":"Client and Menu","file":{"text":"lua/vgui/dform.lua","line":"297-L298"},"description":{"text":"Does nothing.","deprecated":""}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetAutoSize","parent":"DForm","type":"panelfunc","realm":"Client and Menu","file":{"text":"lua/vgui/dform.lua","line":"6"},"description":{"text":"an Global.AccessorFunc that does nothing","deprecated":""},"args":{"arg":{"type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetName","parent":"DForm","type":"panelfunc","description":{"text":"Sets the title (header) name of the DForm. This is `Label` until set.","deprecated":"This is an alias of derived DCollapsibleCategory:SetLabel"},"realm":"Client and Menu","file":{"text":"lua/vgui/dform.lua","line":"24-L28"},"args":{"arg":{"text":"The new header name.","name":"name","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSpacing","parent":"DForm","type":"panelfunc","realm":"Client and Menu","file":{"text":"lua/vgui/dform.lua","line":"7"},"description":{"text":"An Global.AccessorFunc that does nothing.","deprecated":""},"args":{"arg":{"type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"TextEntry","parent":"DForm","type":"panelfunc","description":"Adds a DTextEntry to a DForm","realm":"Client and Menu","file":{"text":"lua/vgui/dform.lua","line":"75-L89"},"args":{"arg":[{"text":"The label to be next to the text entry","name":"label","type":"string"},{"text":"The console variable to be changed when the text entry is changed","name":"convar","type":"string"}]},"rets":{"ret":[{"text":"The created DTextEntry","name":"","type":"DTextEntry"},{"text":"The created DLabel","name":"","type":"DLabel"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnClose","parent":"DFrame","type":"panelhook","description":"Called when the DFrame is closed with DFrame:Close. This applies when the `close` button in the DFrame's control box is clicked.\n\nThis function does nothing and is safe to override.\n\nThis is **not** called when the DFrame is removed with Panel:Remove, see PANEL:OnRemove for that.","realm":"Client and Menu","file":{"text":"lua/vgui/dframe.lua","line":"101-L102"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Center","parent":"DFrame","type":"panelfunc","description":"Centers the frame relative to the whole screen and invalidates its layout. This overrides Panel:Center.","realm":"Client and Menu","file":{"text":"lua/vgui/dframe.lua","line":"104-L110"}},"note":"You must use Panel:SetSize before using this function.","realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Close","parent":"DFrame","type":"panelfunc","description":"Hides or removes the DFrame, and calls DFrame:OnClose.\n\nTo set whether the frame is hidden or removed, use DFrame:SetDeleteOnClose.","realm":"Client and Menu","file":{"text":"lua/vgui/dframe.lua","line":"89-L99"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetBackgroundBlur","parent":"DFrame","type":"panelfunc","description":"Gets whether the background behind the frame is being blurred.","realm":"Client and Menu","file":{"text":"lua/vgui/dframe.lua","line":"14"},"rets":{"ret":{"text":"Whether or not background blur is enabled.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDeleteOnClose","parent":"DFrame","type":"panelfunc","description":"Determines whether or not the DFrame will be removed when it is closed. This is set with DFrame:SetDeleteOnClose.","realm":"Client and Menu","file":{"text":"lua/vgui/dframe.lua","line":"8"},"rets":{"ret":{"text":"Whether or not the frame will be removed on close.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDraggable","parent":"DFrame","type":"panelfunc","description":"Gets whether or not the frame is draggable by the user.","realm":"Client and Menu","file":{"text":"lua/vgui/dframe.lua","line":"5"},"rets":{"ret":{"text":"Whether the frame is draggable or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetIsMenu","parent":"DFrame","type":"panelfunc","description":"Gets whether or not the frame is part of a derma menu. This is set with DFrame:SetIsMenu.","realm":"Client and Menu","file":{"text":"lua/vgui/dframe.lua","line":"4"},"rets":{"ret":{"text":"Whether or not this frame is a menu component.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetMinHeight","parent":"DFrame","type":"panelfunc","description":"Gets the minimum height the DFrame can be resized to by the user.\n\nYou must call DFrame:SetSizable before the user can resize the frame.","realm":"Client and Menu","file":{"text":"lua/vgui/dframe.lua","line":"12"},"rets":{"ret":{"text":"The minimum height the user can resize the frame to.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetMinWidth","parent":"DFrame","type":"panelfunc","description":"Gets the minimum width the DFrame can be resized to by the user.\n\nYou must call DFrame:SetSizable before the user can resize the frame.","realm":"Client and Menu","file":{"text":"lua/vgui/dframe.lua","line":"11"},"rets":{"ret":{"text":"The minimum width the user can resize the frame to.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetPaintShadow","parent":"DFrame","type":"panelfunc","description":"Gets whether or not the shadow effect bordering the DFrame is being drawn.","realm":"Client and Menu","file":{"text":"lua/vgui/dframe.lua","line":"9"},"rets":{"ret":{"text":"Whether or not the shadow is being drawn.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetScreenLock","parent":"DFrame","type":"panelfunc","description":"Gets whether or not the DFrame is restricted to the boundaries of the screen resolution.","realm":"Client and Menu","file":{"text":"lua/vgui/dframe.lua","line":"7"},"rets":{"ret":{"text":"Whether or not the frame is restricted.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSizable","parent":"DFrame","type":"panelfunc","description":"Gets whether or not the DFrame can be resized by the user.\n\nThis is achieved by clicking and dragging in the bottom right corner of the frame.","realm":"Client and Menu","file":{"text":"lua/vgui/dframe.lua","line":"6"},"rets":{"ret":{"text":"Whether the frame can be resized or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTitle","parent":"DFrame","type":"panelfunc","description":"Returns the title of the frame.","realm":"Client and Menu","file":{"text":"lua/vgui/dframe.lua","line":"77-L81"},"rets":{"ret":{"text":"Title of the frame.","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsActive","parent":"DFrame","type":"panelfunc","description":"Determines if the frame or one of its children has the screen focus.","realm":"Client and Menu","file":{"text":"lua/vgui/dframe.lua","line":"112-L119"},"rets":{"ret":{"text":"Whether or not the frame has focus.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetBackgroundBlur","parent":"DFrame","type":"panelfunc","description":"Indicate that the background elements won't be usable.","realm":"Client and Menu","args":{"arg":{"text":"Whether or not to block mouse on background panels or not.","name":"blur","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDeleteOnClose","parent":"DFrame","type":"panelfunc","description":"Determines whether or not the DFrame is removed when it is closed with DFrame:Close.","realm":"Client and Menu","args":{"arg":{"text":"Whether or not to delete the frame on close. This is `true` by default.","name":"shouldDelete","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDraggable","parent":"DFrame","type":"panelfunc","description":"Sets whether the frame should be draggable by the user. The DFrame can only be dragged from its title bar.","realm":"Client and Menu","args":{"arg":{"text":"Whether to be draggable or not.","name":"draggable","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetIcon","parent":"DFrame","type":"panelfunc","description":"Adds or removes an icon on the left of the DFrame's title.","realm":"Client and Menu","file":{"text":"lua/vgui/dframe.lua","line":"121-L135"},"args":{"arg":{"text":"Set to empty string (\"\") to remove the icon.\n\nOtherwise, set to file path to create the icon.","name":"path","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetIsMenu","parent":"DFrame","type":"panelfunc","description":"Sets whether the frame is part of a derma menu or not.\n\nIf this is set to `true`, Global.CloseDermaMenus will not be called when the frame is clicked, and thus any open menus will remain open.","realm":"Client and Menu","args":{"arg":{"text":"Whether or not this frame is a menu component.","name":"isMenu","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMinHeight","parent":"DFrame","type":"panelfunc","description":"Sets the minimum height the DFrame can be resized to by the user.\n\nThis only applies to users attempting to resize the frame; Panel:SetTall and similar methods will not be affected. You must call DFrame:SetSizable before the user can resize the frame.","realm":"Client and Menu","args":{"arg":{"text":"The minimum height the user can resize the frame to.","name":"minH","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMinWidth","parent":"DFrame","type":"panelfunc","description":"Sets the minimum width the DFrame can be resized to by the user.\n\nThis only applies to users attempting to resize the frame; Panel:SetWide and similar methods will not be affected. You must call DFrame:SetSizable before the user can resize the frame.","realm":"Client and Menu","args":{"arg":{"text":"The minimum width the user can resize the frame to.","name":"minW","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetPaintShadow","parent":"DFrame","type":"panelfunc","description":"Sets whether or not the shadow effect bordering the DFrame should be drawn.","realm":"Client and Menu","args":{"arg":{"text":"Whether or not to draw the shadow. This is `true` by default.","name":"shouldPaint","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetScreenLock","parent":"DFrame","type":"panelfunc","description":"Sets whether the DFrame is restricted to the boundaries of the screen resolution.","realm":"Client and Menu","args":{"arg":{"text":"If `true`, the frame cannot be dragged outside of the screen bounds","name":"lock","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSizable","parent":"DFrame","type":"panelfunc","description":"Sets whether or not the DFrame can be resized by the user.\n\nThis is achieved by clicking and dragging in the bottom right corner of the frame.\n\nYou can set the minimum size using DFrame:SetMinWidth and DFrame:SetMinHeight.","realm":"Client and Menu","args":{"arg":{"text":"Whether the frame should be resizeable or not.","name":"sizeable","type":"boolean"}}},"example":{"description":"A snippet of code that makes a frame resizable and sets the minimum size to its current size.","code":"frame:SetSizable( true )\nframe:SetMinWidth( frame:GetWide() )\nframe:SetMinHeight( frame:GetTall() )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTitle","parent":"DFrame","type":"panelfunc","description":"Sets the title of the frame.","realm":"Client and Menu","file":{"text":"lua/vgui/dframe.lua","line":"83-L87"},"args":{"arg":{"text":"New title of the frame.","name":"title","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ShowCloseButton","parent":"DFrame","type":"panelfunc","description":"Determines whether the DFrame's control box (close, minimise and maximise buttons) is displayed.","realm":"Client and Menu","file":{"text":"lua/vgui/dframe.lua","line":"69-L75"},"args":{"arg":{"text":"`false` hides the control box; this is `true` by default.","name":"show","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddItem","parent":"DGrid","type":"panelfunc","description":"Adds a new item to the grid.","realm":"Client and Menu","args":{"arg":{"text":"The item to add. It will be forced visible and parented to the DGrid.","name":"item","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetCols","parent":"DGrid","type":"panelfunc","description":"Returns the number of columns of this DGrid. Set by DGrid:SetCols.","realm":"Client and Menu","rets":{"ret":{"text":"The number of columns of this DGrid","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetColWide","parent":"DGrid","type":"panelfunc","description":"Returns the width of each column of the DGrid, which is set by DGrid:SetColWide.","realm":"Client and Menu","rets":{"ret":{"text":"The width of each column","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetItems","parent":"DGrid","type":"panelfunc","description":"Returns a list of panels in the grid.","realm":"Client and Menu","rets":{"ret":{"text":"A list of Panels.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetRowHeight","parent":"DGrid","type":"panelfunc","description":"Returns the height of each row of the DGrid, which is set by DGrid:SetRowHeight.","realm":"Client and Menu","rets":{"ret":{"text":"The height of each row","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"RemoveItem","parent":"DGrid","type":"panelfunc","description":"Removes given panel from the DGrid:GetItems.","realm":"Client and Menu","args":{"arg":[{"text":"Item to remove from the grid","name":"item","type":"Panel"},{"text":"If set to true, the actual panel will not be removed via Panel:Remove.","name":"bDontDelete","type":"boolean","default":"false"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetCols","parent":"DGrid","type":"panelfunc","description":"Sets the number of columns this panel should have.\n\nThe DGrid will resize its width to match this value.","realm":"Client and Menu","args":{"arg":{"text":"The desired number of columns","name":"cols","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetColWide","parent":"DGrid","type":"panelfunc","description":"Sets the width of each column.\n\nThe cell panels (grid items) will not be resized or centered.","realm":"Client and Menu","args":{"arg":{"text":"The width of each column.","name":"colWidth","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetRowHeight","parent":"DGrid","type":"panelfunc","description":"Sets the height of each row. \n\nThe cell panels (grid items) will not be resized or centered.","realm":"Client and Menu","args":{"arg":{"text":"The height of each row","name":"rowHeight","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SortByMember","parent":"DGrid","type":"panelfunc","description":"Sorts the items in the grid. Does not visually update the grid, use Panel:InvalidateLayout for that.","realm":"Client and Menu","args":{"arg":[{"text":"A key in the panel from DGrid:GetItems. The key's value must be numeric.","name":"key","type":"string"},{"text":"True for descending order, false for ascending.","name":"desc","type":"boolean","default":"true"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDividerWidth","parent":"DHorizontalDivider","type":"panelfunc","description":"Returns the width of the horizontal divider bar, set by DHorizontalDivider:SetDividerWidth.","realm":"Client","rets":{"ret":{"text":"The width of the horizontal divider bar","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetDragging","parent":"DHorizontalDivider","type":"panelfunc","description":"Returns whether or not the player is currently dragging the middle divider bar.","realm":"Client","rets":{"ret":{"text":"Whether or not the player is currently dragging the middle divider bar.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetHoldPos","parent":"DHorizontalDivider","type":"panelfunc","description":{"text":"Returns the local X coordinate of where the player started dragging the thing","internal":""},"realm":"Client","rets":{"ret":{"name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetLeft","parent":"DHorizontalDivider","type":"panelfunc","description":"Returns the left side content of the DHorizontalDivider","realm":"Client","rets":{"ret":{"text":"The content on the left side","name":"","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetLeftMin","parent":"DHorizontalDivider","type":"panelfunc","description":"Returns the minimum width of the left side, set by DHorizontalDivider:SetLeftMin.","realm":"Client","rets":{"ret":{"text":"The minimum width of the left side","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetLeftWidth","parent":"DHorizontalDivider","type":"panelfunc","description":"Returns the current width of the left side, set by DHorizontalDivider:SetLeftWidth or by the user.","realm":"Client","rets":{"ret":{"text":"The current width of the left side","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetMiddle","parent":"DHorizontalDivider","type":"panelfunc","description":"Returns the middle content, set by DHorizontalDivider:SetMiddle.","realm":"Client","rets":{"ret":{"text":"The middle content","name":"","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetRight","parent":"DHorizontalDivider","type":"panelfunc","description":"Returns the right side content","realm":"Client","rets":{"ret":{"text":"The right side content","name":"","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetRightMin","parent":"DHorizontalDivider","type":"panelfunc","description":"Returns the minimum width of the right side, set by DHorizontalDivider:SetRightMin.","realm":"Client","rets":{"ret":{"text":"The minimum width of the right side","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetDividerWidth","parent":"DHorizontalDivider","type":"panelfunc","description":"Sets the width of the horizontal divider bar.","realm":"Client","args":{"arg":{"text":"The width of the horizontal divider bar.","name":"width","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetDragging","parent":"DHorizontalDivider","type":"panelfunc","description":{"text":"Sets whether the player is dragging the divider or not","internal":""},"realm":"Client","args":{"arg":{"name":"dragonot","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetHoldPos","parent":"DHorizontalDivider","type":"panelfunc","description":{"text":"Sets the local X coordinate of where the player started dragging the thing","internal":""},"realm":"Client","args":{"arg":{"name":"x","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetLeft","parent":"DHorizontalDivider","type":"panelfunc","description":"Sets the left side content of the DHorizontalDivider.","realm":"Client","args":{"arg":{"text":"The panel to set as the left side","name":"pnl","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetLeftMin","parent":"DHorizontalDivider","type":"panelfunc","description":"Sets the minimum width of the left side","realm":"Client","args":{"arg":{"text":"The minimum width of the left side","name":"minWidth","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetLeftWidth","parent":"DHorizontalDivider","type":"panelfunc","description":"Sets the current/starting width of the left side.\n\nThe width of the right side is automatically calculated by subtracting this from the total width of the DHorizontalDivider.","realm":"Client","args":{"arg":{"text":"The current/starting width of the left side","name":"width","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetMiddle","parent":"DHorizontalDivider","type":"panelfunc","description":"Sets the middle content, over the draggable divider bar panel.","realm":"Client","args":{"arg":{"text":"The middle content","name":"middle","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetRight","parent":"DHorizontalDivider","type":"panelfunc","description":"Sets the right side content","realm":"Client","args":{"arg":{"text":"The right side content","name":"pnl","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetRightMin","parent":"DHorizontalDivider","type":"panelfunc","description":"Sets the minimum width of the right side","realm":"Client","args":{"arg":{"text":"The minimum width of the right side","name":"minWidth","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"StartGrab","parent":"DHorizontalDivider","type":"panelfunc","description":{"internal":"","validate":"TODO Document me"},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnDragModified","parent":"DHorizontalScroller","type":"panelhook","description":"Called when the panel is scrolled.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddPanel","parent":"DHorizontalScroller","type":"panelfunc","description":"Adds a panel to the DHorizontalScroller.","realm":"Client and Menu","args":{"arg":{"text":"The panel to add. It will be automatically parented.","name":"pnl","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetCanvas","parent":"DHorizontalScroller","type":"panelfunc","description":"Returns the internal canvas panel where the content of DHorizontalScroller are placed on.","realm":"Client and Menu","rets":{"ret":{"text":"The DDragBase panel.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetOverlap","parent":"DHorizontalScroller","type":"panelfunc","description":"Returns the overlap set by DHorizontalScroller:SetOverlap.","realm":"Client and Menu","rets":{"ret":{"text":"The overlap.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetShowDropTargets","parent":"DHorizontalScroller","type":"panelfunc","description":"Returns whether this panel should show drop targets.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MakeDroppable","parent":"DHorizontalScroller","type":"panelfunc","description":"Same as DDragBase:MakeDroppable.\nTODO: Transclude or whatever to here?","realm":"Client and Menu","args":{"arg":{"name":"name","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ScrollToChild","parent":"DHorizontalScroller","type":"panelfunc","description":"Scrolls the DHorizontalScroller to given child panel.","realm":"Client and Menu","args":{"arg":{"text":"The target child panel. Must be a child of DHorizontalScroller:GetCanvas","name":"target","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetOverlap","parent":"DHorizontalScroller","type":"panelfunc","description":"Controls the spacing between elements of the horizontal scroller.","realm":"Client and Menu","args":{"arg":{"text":"Overlap in pixels. Positive numbers will make elements `overlap` each other, negative will add spacing.","name":"overlap","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetScroll","parent":"DHorizontalScroller","type":"panelfunc","description":"Sets the scroll amount, automatically clamping the value.","realm":"Client and Menu","args":{"arg":{"text":"The new scroll amount","name":"scroll","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetShowDropTargets","parent":"DHorizontalScroller","type":"panelfunc","description":"Sets whether this panel should show drop targets.","realm":"Client and Menu","args":{"arg":{"name":"newState","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetUseLiveDrag","parent":"DHorizontalScroller","type":"panelfunc","description":"Same as DDragBase:SetUseLiveDrag","realm":"Client and Menu","args":{"arg":{"name":"newState","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddScroll","parent":"DHScrollBar","type":"panelfunc","description":"Adds specified amount of scroll in pixels.","realm":"Client and Menu","args":{"arg":{"text":"How much to scroll rightwards. Can be negative for leftwards scroll","name":"add","type":"number"}},"rets":{"ret":{"text":"True if the scroll level was changed (i.e. if we did or did not scroll)","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AnimateTo","parent":"DHScrollBar","type":"panelfunc","description":"Smoothly scrolls to given level.","realm":"Client and Menu","args":{"arg":[{"text":"The scroll level to animate to. In pixels from the left ( from 0 )","name":"scroll","type":"number"},{"text":"Length of the animation in seconds","name":"length","type":"number"},{"text":"Delay of the animation in seconds","name":"delay","type":"number","default":"0"},{"text":"See Panel:NewAnimation for explanation.","name":"ease","type":"number","default":"-1"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"BarScale","parent":"DHScrollBar","type":"panelfunc","description":"Returns the scale of the scroll bar based on the difference in size between the visible \"window\" into the canvas that is being scrolled. Should be used after DHScrollBar:SetUp.","realm":"Client and Menu","rets":{"ret":{"text":"The scale of the scrollbar.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetHideButtons","parent":"DHScrollBar","type":"panelfunc","description":"Returns whether or not the manual left/right scroll buttons are visible or not. Set by DHScrollBar:SetHideButtons.","realm":"Client and Menu","rets":{"ret":{"text":"Whether or not the manual left/right scroll buttons are visible or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetOffset","parent":"DHScrollBar","type":"panelfunc","description":"Returns the negative of DHScrollBar:GetScroll.","realm":"Client and Menu","rets":{"ret":{"text":"The scroll offset.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetScroll","parent":"DHScrollBar","type":"panelfunc","description":"Returns the amount of scroll level from the left in pixels.","realm":"Client and Menu","rets":{"ret":{"text":"The amount of scroll level from the left edge.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Grip","parent":"DHScrollBar","type":"panelfunc","description":{"text":"Called from within DScrollBarGrip","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetHideButtons","parent":"DHScrollBar","type":"panelfunc","description":"Allows hiding the left and right buttons for better visual stylisation.","realm":"Client and Menu","args":{"arg":{"text":"True to hide","name":"hide","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetScroll","parent":"DHScrollBar","type":"panelfunc","description":"Sets the scroll level in pixels.","realm":"Client and Menu","args":{"arg":{"text":"The new scroll value.","name":"scroll","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetUp","parent":"DHScrollBar","type":"panelfunc","description":"Sets up the scrollbar for use.\n\nThe scrollbar will automatically disable itself if the total width of the canvas is lower than the width of the panel that holds the canvas during this function call.","realm":"Client and Menu","args":{"arg":[{"text":"The size of the panel that holds the canvas, basically size of \"1 page\".","name":"barSize","type":"number"},{"text":"The total size of the canvas, this typically is the bigger number.","name":"canvasSize","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddFunction","parent":"DHTML","type":"panelfunc","description":{"text":"Defines a Javascript function that when called will call a Lua callback.","note":"Must be called after the HTML document has fully loaded."},"realm":"Client and Menu","file":{"text":"lua/vgui/dhtml.lua","line":"123-L146"},"args":{"arg":[{"text":"Library name of the JS function you are defining.","name":"library","type":"string"},{"text":"Name of the JS function you are defining.","name":"name","type":"string"},{"text":"Function called when the JS function is called. Arguments passed to the JS function will be passed here.","name":"callback","type":"function"}]}},"example":[{"description":"Prints text from Javascript to the console in color.","code":"-- Create the frame\nlocal frame = vgui.Create( \"DFrame\" )\nframe:SetSize( 800, 600 )\nframe:Center()\n\n-- Create a green color variable\nlocal color_green = Color( 0, 255, 0 )\n\n-- Define the Javascript function in the DHTML element\nlocal DHTML = vgui.Create( \"DHTML\", frame )\nDHTML:Dock( FILL )\nDHTML:OpenURL( \"https://wiki.facepunch.com/gmod/DHTML\" )\nDHTML:AddFunction( \"console\", \"luaprint\", function( str )\n\tMsgC( color_green, str ) -- Print the given string\nend)\n\n-- This runs our function. Our function could also be called from Javascript on the DHTML's page.\nDHTML:RunJavascript( \"console.luaprint( 'Hello from Javascript!' );\" )"},{"description":{"text":"Passing a callback to the added JavaScript function as the last argument allows us to use the values returned by our Lua function.\n\t\t\n\t\tOf course, you're allowed to use multiple return values, with each being its own argument.\n\t\t\n\t\tTables should work as you expect them to. Lua table `{true, a = true}` will be an object with keys `1` and `a`, both equal to `true`. \n\t\tUnsure about metatable behavior.\n\n\t\tUserdata (`Vector`, `Player`, etc...) will be `undefined`, obviously.\n\t\t\n\t\tAs per https://github.com/Facepunch/garrysmod-issues/issues/3995#issuecomment-531491316","note":"This is relevant for the x86-64 branch only (Chromium in place of Awesomium), you may still [handle return values normally](https://github.com/Facepunch/garrysmod/blob/b7da4993e8fbee1789eee4cded85114849d17699/garrysmod/html/js/svc.Tranny.js#L21-L34) to work with the default branch as well."},"code":"] lua_run_cl A = vgui.Create\"DHTML\"\n] lua_run_cl A:OpenURL(\"https://duckduckgo.com/html/\")\n] lua_run_cl A:AddFunction(\"gmod\", \"test\", function(x) return x end )\n-- This works\n] lua_run_cl A:RunJavascript(\"gmod.test('test', console.log)\")\n[HTML] test\n] lua_run_cl A:AddFunction(\"gmod\", \"say\", function(x) RunConsoleCommand(\"say\", x) end)\n] lua_run_cl A:RunJavascript(\"gmod.test('test', gmod.say)\")\nBell: test\n-- This doesn't work\n] lua_run_cl A:RunJavascript(\"gmod.test(console.log, 'test')\")"}],"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Call","parent":"DHTML","type":"panelfunc","description":{"text":"Runs/Executes a string as JavaScript code in a panel.","note":["This function does **NOT** evaluate expression (i.e. allow you to pass variables from JavaScript (JS) to Lua context).\nBecause a return value is nil/no value (a.k.a. void).\nIf you wish to pass/return values from JS to Lua, you may want to use DHTML:AddFunction function to accomplish that job.","This function is an alias of DHTML:QueueJavascript ([source](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/lua/vgui/dhtml.lua#L62))."]},"realm":"Client and Menu","args":{"arg":{"text":"Specify JavaScript code to be executed.","name":"js","type":"string"}}},"example":{"description":"Shows how to change [document.body.innerHTML](http://www.w3schools.com/jsref/prop_html_innerhtml.asp) property by calling this function on  panel.","code":"-- First we create a container, in this case it is a full-screen Derma Frame window.\nlocal dframe = vgui.Create( 'DFrame' )\ndframe:SetSize( ScrW(), ScrH() )\ndframe:SetTitle( \"Garry's Mod Wiki\" )\ndframe:Center()\ndframe:MakePopup() -- Enable keyboard and mouse interaction for DFrame panel.\n\n-- Create a new DHTML panel as a child of dframe, and dock-fill it.\nlocal dhtml = vgui.Create( 'DHTML', dframe )\ndhtml:Dock( FILL )\n-- Navigate to Garry's Mod wikipedia website.\ndhtml:OpenURL( 'https://wiki.garrysmod.com/index.php' )\n-- Run JavaScript code.\ndhtml:Call( [[document.body.innerHTML = 'HTML changed from Lua using JavaScript!';]] )\n\n-- This does not throw an error/exception, but instead returns nil/no value.\n-- That means you can't pass/return values from JavaScript back to Lua context using this function.\nlocal number = dhtml:Call( '22;' )\nprint( number )","output":"Inner HTML of document body in DHTML panel is now set to \"HTML changed from Lua using JavaScript!\"."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetAllowLua","parent":"DHTML","type":"panelfunc","description":"Returns if the loaded page can run Lua code, set by DHTML:SetAllowLua","realm":"Client and Menu","rets":{"ret":{"text":"Whether or not Lua code can be called from the loaded page.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetScrollbars","parent":"DHTML","type":"panelfunc","description":{"text":"Returns the value set by DHTML:SetScrollbars.","deprecated":"Broken. Use the CSS `overflow` rule instead."},"realm":"Client and Menu","rets":{"ret":{"text":"True if scrollbars should be visible.","name":"show","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"QueueJavascript","parent":"DHTML","type":"panelfunc","description":{"text":"Runs/Executes a string as JavaScript code in a panel.","note":["This function does **NOT** evaluate expression (i.e. allow you to pass variables from JavaScript (JS) to Lua context).\nBecause a return value is nil/no value (a.k.a. void).\nIf you wish to pass/return values from JS to Lua, you may want to use DHTML:AddFunction function to accomplish that job.","If Panel:IsVisible is `false`, PANEL:Think will **NOT** run, meaning the Javascript Queue will not be processed.\n\nConsider overriding PANEL:Paint to stop the panel from drawing instead."]},"realm":"Client and Menu","args":{"arg":{"text":"Specify JavaScript code to be executed.","name":"js","type":"string"}}},"example":{"description":"Shows how to change [document.body.innerHTML](http://www.w3schools.com/jsref/prop_html_innerhtml.asp) property by calling this function on  panel.","code":"-- First we create a container, in this case it is a full-screen Derma Frame window.\nlocal dframe = vgui.Create( 'DFrame' )\ndframe:SetSize( ScrW(), ScrH() )\ndframe:SetTitle( \"Garry's Mod Wiki\" )\ndframe:Center()\ndframe:MakePopup() -- Enable keyboard and mouse interaction for DFrame panel.\n\n-- Create a new DHTML panel as a child of dframe, and dock-fill it.\nlocal dhtml = vgui.Create( 'DHTML', dframe )\ndhtml:Dock( FILL )\n-- Navigate to Garry's Mod wikipedia website.\ndhtml:OpenURL( 'https://wiki.garrysmod.com/index.php' )\n-- Run JavaScript code.\ndhtml:QueueJavascript( \"document.body.innerHTML = 'HTML changed from Lua using JavaScript!';\" )\n\n-- This does not throw an error/exception, but instead returns nil/no value.\n-- That means you can't pass/return values from JavaScript back to Lua context using this function.\nlocal number = dhtml:QueueJavascript( '22;' )\nprint( number )","output":"Inner HTML of document body in DHTML panel is now set to \"HTML changed from Lua using JavaScript!\"."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetAllowLua","parent":"DHTML","type":"panelfunc","description":"Determines whether the loaded page can run Lua code or not. See DHTML for how to run Lua from a DHTML window.","realm":"Client and Menu","args":{"arg":{"text":"Whether or not to allow Lua.","name":"allow","type":"boolean","default":"false"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetScrollbars","parent":"DHTML","type":"panelfunc","description":{"text":"Sets if the loaded window should display scrollbars when the webpage is larger than the viewing window. This is similar to the CSS `overflow` rule.","deprecated":"Broken. Use the CSS `overflow` rule instead."},"realm":"Client and Menu","args":{"arg":{"text":"True if scrollbars should be visible.","name":"show","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"FinishedLoading","parent":"DHTMLControls","type":"panelfunc","description":{"internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetButtonColor","parent":"DHTMLControls","type":"panelfunc","description":"Sets the color of the navigation buttons.","realm":"Client and Menu","args":{"arg":{"text":"A Color","name":"clr","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetHTML","parent":"DHTMLControls","type":"panelfunc","description":"Sets the DHTML element to control with these DHTMLControls.","realm":"Client and Menu","args":{"arg":{"text":"The HTML panel","name":"dhtml","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"StartedLoading","parent":"DHTMLControls","type":"panelfunc","description":{"internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateHistory","parent":"DHTMLControls","type":"panelfunc","description":{"text":"Basically adds an URL to the history.","internal":""},"realm":"Client and Menu","args":{"arg":{"name":"url","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateNavButtonStatus","parent":"DHTMLControls","type":"panelfunc","description":{"internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Fill","parent":"DIconBrowser","type":"panelfunc","description":{"text":"Automatically called to fill the browser with icons. Will not work if DIconBrowser:SetManual is set to true.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"FilterByText","parent":"DIconBrowser","type":"panelfunc","description":"A simple unused search feature, hides all icons that do not contain given text in their file path.","realm":"Client and Menu","args":{"arg":{"text":"The text to search for","name":"text","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetManual","parent":"DIconBrowser","type":"panelfunc","description":"Returns whether or not the browser should fill itself with icons.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSelectedIcon","parent":"DIconBrowser","type":"panelfunc","description":"Returns the currently selected icon's file path.","realm":"Client and Menu","rets":{"ret":{"text":"The currently selected icon's file path.","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnChange","parent":"DIconBrowser","type":"panelfunc","description":"Called when the selected icon was changed. Use DIconBrowser:GetSelectedIcon to get the selected icon's filepath.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnChangeInternal","parent":"DIconBrowser","type":"panelfunc","description":{"text":"Use DIconBrowser:OnChange instead","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ScrollToSelected","parent":"DIconBrowser","type":"panelfunc","description":"Scrolls the browser to the selected icon","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SelectIcon","parent":"DIconBrowser","type":"panelfunc","description":"Selects an icon from file path","realm":"Client and Menu","args":{"arg":{"text":"The file path of the icon to select. Do not include the \"materials/\" part.","name":"icon","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetManual","parent":"DIconBrowser","type":"panelfunc","description":"Sets whether or not the browser should automatically fill itself with icons.","realm":"Client and Menu","args":{"arg":{"name":"manual","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSelectedIcon","parent":"DIconBrowser","type":"panelfunc","description":{"text":"Set the currently selected file path. Do not use. Use DIconBrowser:SelectIcon instead.","internal":""},"realm":"Client and Menu","args":{"arg":{"name":"str","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnModified","parent":"DIconLayout","type":"panelhook","description":"Called when the panel is modified.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Copy","parent":"DIconLayout","type":"panelfunc","description":"Creates a replica of the DIconLayout it is called on.","realm":"Client and Menu","rets":{"ret":{"text":"The replica.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CopyContents","parent":"DIconLayout","type":"panelfunc","description":"Copies the contents (Child elements) of another DIconLayout to itself.","realm":"Client and Menu","args":{"arg":{"text":"DIconLayout to copy from.","name":"from","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetBorder","parent":"DIconLayout","type":"panelfunc","description":"Returns the size of the border.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetLayoutDir","parent":"DIconLayout","type":"panelfunc","description":"Returns the direction that it will be layed out, using the DOCK enumerations.","realm":"Client and Menu","rets":{"ret":{"text":"Layout direction.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSpaceX","parent":"DIconLayout","type":"panelfunc","description":"Returns the distance between two 'icons' on the X axis.","realm":"Client and Menu","rets":{"ret":{"text":"Distance between two 'icons' on the X axis.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSpaceY","parent":"DIconLayout","type":"panelfunc","description":"Returns distance between two \"Icons\" on the Y axis.","realm":"Client and Menu","rets":{"ret":{"text":"distance between two \"Icons\" on the Y axis.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetStretchHeight","parent":"DIconLayout","type":"panelfunc","description":"Returns whether the icon layout will stretch its height to fit all the children.\n\nSee also DIconLayout:GetStretchWidth","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetStretchWidth","parent":"DIconLayout","type":"panelfunc","description":"Returns whether the icon layout will stretch its width to fit all the children.\n\nSee also DIconLayout:GetStretchHeight","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Layout","parent":"DIconLayout","type":"panelfunc","description":"Resets layout vars before calling Panel:InvalidateLayout. This is called when children are added or removed, and must be called when the spacing, border or layout direction is changed.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"LayoutIcons_LEFT","parent":"DIconLayout","type":"panelfunc","description":{"text":"Used internally to layout the child elements if the DIconLayout:SetLayoutDir is set to LEFT (See Enums/DOCK).","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"LayoutIcons_TOP","parent":"DIconLayout","type":"panelfunc","description":{"text":"Used internally to layout the child elements if the DIconLayout:SetLayoutDir is set to TOP (See Enums/DOCK).","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetBorder","parent":"DIconLayout","type":"panelfunc","description":"Sets the internal border (padding) within the DIconLayout. This will not change its size, only the positioning of children. You must call DIconLayout:Layout in order for the changes to take effect.","realm":"Client and Menu","args":{"arg":{"text":"The border (padding) inside the DIconLayout.","name":"width","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetLayoutDir","parent":"DIconLayout","type":"panelfunc","description":"Sets the direction that it will be layed out, using the Enums/DOCK.\n\nCurrently only TOP and LEFT are supported.","realm":"Client and Menu","args":{"arg":{"text":"Enums/DOCK","name":"direction","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSpaceX","parent":"DIconLayout","type":"panelfunc","description":"Sets the horizontal (x) spacing between children within the DIconLayout. You must call DIconLayout:Layout in order for the changes to take effect.","realm":"Client and Menu","args":{"arg":{"text":"The width of the gap between child objects.","name":"xSpacing","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSpaceY","parent":"DIconLayout","type":"panelfunc","description":"Sets the vertical (y) spacing between children within the DIconLayout. You must call DIconLayout:Layout in order for the changes to take effect.","realm":"Client and Menu","args":{"arg":{"text":"The vertical gap between rows in the DIconLayout.","name":"ySpacing","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetStretchHeight","parent":"DIconLayout","type":"panelfunc","description":"If set to true, the icon layout will stretch its height to fit all the children.\n\nSee also DIconLayout:SetStretchWidth","realm":"Client and Menu","args":{"arg":{"name":"do_stretch","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetStretchWidth","parent":"DIconLayout","type":"panelfunc","description":"If set to true, the icon layout will stretch its width to fit all the children.\n\nSee also DIconLayout:SetStretchHeight","realm":"Client and Menu","args":{"arg":{"name":"stretchW","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DoLoadMaterial","parent":"DImage","type":"panelfunc","description":{"text":"Actually loads the IMaterial to render it. Called from DImage:LoadMaterial.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"FixVertexLitMaterial","parent":"DImage","type":"panelfunc","description":{"text":"\"Fixes\" the current material of the DImage if it has VertexLit shader by creating a new one with the same name and a prefix of \"_DImage\" and automatically calling DImage:SetMaterial with the new material.\n\nThis fixes the problem where using materials using shaders that expect lighting information causing \"weird\" flickering when displayed in 2D/Unlit environment.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetFailsafeMatName","parent":"DImage","type":"panelfunc","description":{"text":"Returns the texture path set by DImage:SetFailsafeMatName.","internal":""},"realm":"Client and Menu","rets":{"ret":{"name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetImage","parent":"DImage","type":"panelfunc","description":"Returns the image loaded in the image panel.","realm":"Client and Menu","rets":{"ret":{"text":"The path to the image that is loaded.","name":"","type":"string"}}},"example":{"description":"Creates a frame with a randomly chosen post process effect thumbnail and prints the image path to console.","code":"-- Frame\nMainFrame = vgui.Create(\"DFrame\")\nMainFrame:SetSize(200, 200)\nMainFrame:Center()\nMainFrame:SetTitle(\"Post process effect\")\n\n-- Load post process effect thumbnail\nlocal postprocess = vgui.Create(\"DImage\", MainFrame)\npostprocess:SetSize(128, 128)\npostprocess:Center()\n\nlocal materials = file.Find(\"materials/gui/postprocess/*.png\", \"GAME\")\n\npostprocess:SetImage(\"materials/gui/postprocess/\"..materials[math.random(1, #materials)])\n\nprint(postprocess:GetImage())","output":{"text":"```\nmaterials/gui/postprocess/colourmod.png\n```","image":{"src":"DImage_GetImage_example1.jpg"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetImageColor","parent":"DImage","type":"panelfunc","description":"Returns the color override of the image panel.","realm":"Client and Menu","rets":{"ret":{"text":"The color override of the image. Uses Color.","name":"col","type":"Color"}}},"example":{"description":"Creates an image panel and prints the default color override to console.","code":"-- Generic image panel\nlocal img = vgui.Create(\"DImage\")\nimg:SetSize(128, 128)\nimg:Center()\nimg:SetImage(\"cantop\")\n\nprint(img:GetImageColor())","output":"```\n255 255 255 255\n```"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetKeepAspect","parent":"DImage","type":"panelfunc","description":"Returns whether the DImage should keep the aspect ratio of its image when being resized.\n\nSee DImage:SetKeepAspect for more info on how it works.","realm":"Client and Menu","rets":{"ret":{"text":"Whether the DImage should keep the aspect ratio of its image when being resized.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetMaterial","parent":"DImage","type":"panelfunc","description":"Returns the current Global.Material of the DImage.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"IMaterial"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetMatName","parent":"DImage","type":"panelfunc","description":{"text":"Returns the texture path set by DImage:SetMatName.","internal":""},"realm":"Client and Menu","rets":{"ret":{"name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"LoadMaterial","parent":"DImage","type":"panelfunc","description":{"text":"Initializes the loading process of the material to render if it is not loaded yet.\n\nYou do not need to call this function. It is done for you automatically.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PaintAt","parent":"DImage","type":"panelfunc","description":"Paints a ghost copy of the DImage panel at the given position and dimensions. This function overrides Panel:PaintAt.","realm":"Client and Menu","args":{"arg":[{"text":"The x coordinate to draw the panel from.","name":"posX","type":"number"},{"text":"The y coordinate to draw the panel from.","name":"posY","type":"number"},{"text":"The width of the panel image to be drawn.","name":"width","type":"number"},{"text":"The height of the panel image to be drawn.","name":"height","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetFailsafeMatName","parent":"DImage","type":"panelfunc","description":{"text":"Sets the backup material to be loaded when the image is first rendered. Used by DImage:SetOnViewMaterial.","internal":""},"realm":"Client and Menu","args":{"arg":{"name":"backupMat","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetImage","parent":"DImage","type":"panelfunc","description":"Sets the image to load into the frame. If the first image can't be loaded and `strBackup` is set, that image will be loaded instead.\n\nThis eventually calls DImage:SetMaterial.","file":{"text":"lua/vgui/dimage.lua","line":"91"},"realm":"Client and Menu","args":{"arg":[{"text":"The path of the image to load, relative to the `materials/` folder. When no file extension is supplied the `.vmt` file extension is assumed.","name":"strImage","type":"string"},{"text":"The path of the backup image.","name":"strBackup","type":"string","default":"nil"}]}},"example":{"description":"Creates a frame with a map of de_inferno inside, with the default avatar image loaded as a backup.","code":"-- Frame\nMainFrame = vgui.Create( \"DFrame\" )\nMainFrame:SetSize( 300, 300 )\nMainFrame:Center()\nMainFrame:SetTitle( \"Map of de_inferno\" )\n\n-- Map of de_inferno (requires CS:S)\nlocal css_map = vgui.Create( \"DImage\", MainFrame )\ncss_map:SetPos( 25, 40 )\ncss_map:SetSize( 250, 250 )\n\n-- Set image to de_inferno map\n-- If it can't be loaded, load the [?] avatar image instead\ncss_map:SetImage(\"overviews/de_inferno\", \"vgui/avatar_default\")","output":{"text":"If CS:S is mounted then the left image is shown, otherwise the right image is shown.","image":[{"src":"DImage_SetImage_example1.jpg"},{"src":"DImage_SetImage_example2.jpg"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetImageColor","parent":"DImage","type":"panelfunc","description":"Sets the image's color override.","realm":"Client and Menu","args":{"arg":{"text":"The color override of the image. Uses Color.","name":"col","type":"Color"}}},"example":{"description":"Creates a frame with a Portal box inside and sets the color to green.","code":"-- Frame\nMainFrame = vgui.Create(\"DFrame\")\nMainFrame:SetSize(200, 180)\nMainFrame:Center()\nMainFrame:SetTitle(\"Color example\")\n\n-- Image of a Portal box\nlocal metalbox_img = vgui.Create(\"DImage\", MainFrame)\nmetalbox_img:SetPos(35, 35)\nmetalbox_img:SetSize(128, 128)\nmetalbox_img:SetImage(\"spawnicons/models/props/metal_box_128.png\")\n\nmetalbox_img:SetImageColor(Color(128, 255, 0, 255))","output":{"image":{"src":"DImage_SetImageColor_example1.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetKeepAspect","parent":"DImage","type":"panelfunc","description":"Sets whether the DImage should keep the aspect ratio of its image when being resized.\n\nNote that this will not try to fit the image inside the button, but instead it will fill the button with the image.","realm":"Client and Menu","args":{"arg":{"text":"true to keep the aspect ratio, false not to","name":"keep","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMaterial","parent":"DImage","type":"panelfunc","description":"Sets a Global.Material directly as an image.","realm":"Client and Menu","args":{"arg":{"text":"The material to set","name":"mat","type":"IMaterial"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMatName","parent":"DImage","type":"panelfunc","description":{"text":"Sets the material to be loaded when the image is first rendered. Used by DImage:SetOnViewMaterial.","internal":""},"realm":"Client and Menu","args":{"arg":{"name":"mat","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetOnViewMaterial","parent":"DImage","type":"panelfunc","description":"Similar to DImage:SetImage, but will only do the expensive part of actually loading the textures/material if the material is about to be rendered/viewed.\n\nUseful for cases like DIconBrowser, where there are hundreds of small icons in 1 panel in a list that do not need all to be loaded at the same time.","realm":"Client and Menu","args":{"arg":[{"name":"mat","type":"string"},{"name":"backupMat","type":"string"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Unloaded","parent":"DImage","type":"panelfunc","description":"Returns true if the image is **not** yet loaded.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DepressImage","parent":"DImageButton","type":"panelfunc","description":{"text":"Used internally to briefly scale the image when clicked.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDepressImage","parent":"DImageButton","type":"panelfunc","description":"Returns whether DImageButton:DepressImage is functional or not.","realm":"Client and Menu","rets":{"ret":{"text":"`true` to enable image depressing when clicked.","name":"enable","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetImage","parent":"DImageButton","type":"panelfunc","description":"Returns the \"image\" of the DImageButton. Equivalent of DImage:GetImage.","realm":"Client and Menu","rets":{"ret":{"text":"The path to the image that is loaded.","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetStretchToFit","parent":"DImageButton","type":"panelfunc","description":"Returns whether the image inside the button should be stretched to fit it or not\n\nSee DImageButton:SetStretchToFit","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetColor","parent":"DImageButton","type":"panelfunc","description":"Sets the color of the image. Equivalent of DImage:SetImageColor","realm":"Client and Menu","args":{"arg":{"text":"The Color to set","name":"color","type":"Color"}}},"example":{"description":"Changes the image to blue:","code":"-- E.g. for the Engineer (blue)\nlocal engineerClass = vgui.Create(\"DImageButton\", container)\nengineerClass:SetColor(Color(22, 166, 236, 255))\n-- ...","output":{"image":[{"src":"MBD_Lobby_DImageButtonWithoutSetColor.png","alt":"thumb|left|Without_SetColor(...)"},{"src":"MBD_Lobby_DImageButtonWithSetColor.png","alt":"thumb|left|With_SetColor(...)"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDepressImage","parent":"DImageButton","type":"panelfunc","description":"Controls whether DImageButton:DepressImage is functional or not.","realm":"Client and Menu","args":{"arg":{"text":"`true` to enable image depressing when clicked.","name":"enable","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetIcon","parent":"DImageButton","type":"panelfunc","description":{"text":"Alias of DImageButton:SetImage.","deprecated":""},"realm":"Client and Menu","args":{"arg":[{"name":"strImage","type":"string"},{"name":"strBackup","type":"string","default":"nil"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetImage","parent":"DImageButton","type":"panelfunc","description":"Sets the \"image\" of the DImageButton. Equivalent of DImage:SetImage.","realm":"Client and Menu","args":{"arg":[{"text":"The path of the image to load, relative to the `materials/` folder. When no file extension is supplied the `.vmt` file extension is assumed.","name":"strImage","type":"string"},{"text":"The path of the backup image.","name":"strBackup","type":"string","default":"nil"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetImageVisible","parent":"DImageButton","type":"panelfunc","description":"Hides or shows the image of the image button. Internally this calls Panel:SetVisible on the internal DImage.","realm":"Client and Menu","args":{"arg":{"text":"Set true to make it visible ( default ), or false to hide the image","name":"visible","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetKeepAspect","parent":"DImageButton","type":"panelfunc","description":"Sets whether the DImageButton should keep the aspect ratio of its image. Equivalent of DImage:SetKeepAspect.\n\nNote that this will not try to fit the image inside the button, but instead it will fill the button with the image.","realm":"Client and Menu","args":{"arg":{"text":"true to keep the aspect ratio, false not to","name":"keep","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMaterial","parent":"DImageButton","type":"panelfunc","description":"Sets a Global.Material directly as an image. Equivalent of DImage:SetMaterial.","realm":"Client and Menu","args":{"arg":{"text":"The material to set","name":"mat","type":"IMaterial"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetOnViewMaterial","parent":"DImageButton","type":"panelfunc","description":"See DImage:SetOnViewMaterial","realm":"Client and Menu","args":{"arg":[{"name":"mat","type":"string"},{"name":"backup","type":"string"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetStretchToFit","parent":"DImageButton","type":"panelfunc","description":"Sets whether the image inside the DImageButton should be stretched to fill the entire size of the button, without preserving aspect ratio.\n\nIf set to false, the image will not be resized at all.","realm":"Client and Menu","args":{"arg":{"text":"True to stretch, false to not to stretch","name":"stretch","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetName","parent":"DKillIcon","type":"panelfunc","description":"Gets the killicon being shown.","realm":"Client","rets":{"ret":{"text":"The name of the killicon currently being displayed.","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetName","parent":"DKillIcon","type":"panelfunc","description":"Sets the killicon to be displayed. You should call Panel:SizeToContents following this.\n\nKillicons can be added with killicon.Add and killicon.AddFont.","realm":"Client","args":{"arg":{"text":"The name of the killicon to be displayed.","name":"iconName","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"DoClick","parent":"DLabel","type":"panelhook","description":"Called when the label is left clicked (on key release) by the player.\n\nThis will be called after DLabel:OnDepressed and DLabel:OnReleased.\n\nThis can be overridden; by default, it calls DLabel:Toggle.\n\nSee also DLabel:DoRightClick, DLabel:DoMiddleClick and DLabel:DoDoubleClick.","realm":"Client and Menu"},"example":{"description":"Creates a label in the center of the screen, that prints `I was clicked!` to the console and disappears when clicked.","code":"local lbl = vgui.Create( \"DLabel\" ) -- Creates our label\nlbl:SetFont( \"DermaLarge\" )\nlbl:SetText( \"Click me!\" )\nlbl:SizeToContents()\nlbl:Center()\nlbl:SetMouseInputEnabled( true ) -- We must accept mouse input\nfunction lbl:DoClick() -- Defines what should happen when the label is clicked\n\tprint(\"I was clicked!\")\n\tself:Remove()\nend","output":"```\nI was clicked!\n```\n When the label is clicked."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DoDoubleClick","parent":"DLabel","type":"panelhook","description":"Called when the label is double clicked by the player with left clicks.\n\nDLabel:SetDoubleClickingEnabled must be set to true for this hook to work, which it is by default.\n\nThis will be called after DLabel:OnDepressed and DLabel:OnReleased and DLabel:DoClick.\n\nSee also DLabel:DoRightClick and DLabel:DoMiddleClick.","realm":"Client and Menu"},"example":{"description":"Opens a URL in Steam Overlay by double clicking the text \"Click ME\"!","code":"local frame = vgui.Create( \"DFrame\" )\nframe:SetTitle( \"Double Click Example\" )\nframe:SetSize( 250, 100 )\nframe:Center()\nframe:MakePopup()\n\nlocal frame_label = vgui.Create( \"DLabel\", frame )\nframe_label:SetPos( 10, 30 )\nframe_label:SetTextColor( Color( 255, 255, 255 ) )\nframe_label:SetText( \"Double click me!\" )\nframe_label:SizeToContents()\nframe_label:SetMouseInputEnabled( true )\nframe_label.DoDoubleClick = function()\n\tgui.OpenURL(\"https://wiki.facepunch.com/gmod\")\nend\n\n-- Uncommentiing this will disable double clicking\n-- frame_label:SetDoubleClickingEnabled( false )","output":{"image":{"src":"ClickMeDouble.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DoMiddleClick","parent":"DLabel","type":"panelhook","description":"Called when the label is middle mouse (Mouse wheel, also known as mouse 3) clicked (on key release) by the player.\n\nThis will be called after DLabel:OnDepressed and DLabel:OnReleased.\n\nSee also DLabel:DoClick, DLabel:DoRightClick and DLabel:DoDoubleClick.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DoRightClick","parent":"DLabel","type":"panelhook","description":"Called when the label is right clicked (on key release) by the player.\n\nThis will be called after DLabel:OnDepressed and DLabel:OnReleased.\n\nSee also DLabel:DoClick, DLabel:DoMiddleClick and DLabel:DoDoubleClick.","realm":"Client and Menu"},"example":{"description":"Creates a label in the center of the screen, that prints `I was right clicked!` to the console and disappears when right clicked.","code":"local lbl = vgui.Create( \"DLabel\" )\nlbl:SetFont( \"DermaLarge\" )\nlbl:SetText( \"Click me!\" )\nlbl:SizeToContents()\nlbl:Center()\nlbl:SetMouseInputEnabled( true )\nfunction lbl:DoRightClick()\n\tprint(\"I was right clicked!\")\n\tself:Remove()\nend","output":"```\nI was clicked!\n```\n When the label is right clicked."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnDepressed","parent":"DLabel","type":"panelhook","description":"Called when the player presses the label with any mouse button.\n\nThis works as an alternative to PANEL:OnMousePressed as that hook is used heavily by DLabel and overriding it will break functionality.\n\nSee also DLabel:DoClick, DLabel:DoMiddleClick, DLabel:DoRightClick, DLabel:OnReleased and DLabel:DoDoubleClick.","realm":"Client and Menu"},"example":{"description":"Changes the text of the label when the hook is called.","code":"local frame = vgui.Create( \"DFrame\" )\nframe:SetTitle( \"OnDepressed/Released Example\" )\nframe:SetSize( 300, 100 )\nframe:Center()\nframe:MakePopup()\n\nlocal frame_label = vgui.Create( \"DLabel\", frame )\nframe_label:SetPos( 10, 30 )\nframe_label:SetTextColor( Color( 255, 255, 255 ) )\nframe_label:SetText( \"Click me!\" )\nframe_label:SizeToContents()\nframe_label:SetMouseInputEnabled( true )\nframe_label.OnDepressed = function( s )\n\ts:SetText( \"OnDepressed\" )\n\tframe_label:SizeToContents()\nend\nframe_label.OnReleased = function( s )\n\ts:SetText( \"OnReleased\" )\n\tframe_label:SizeToContents()\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnReleased","parent":"DLabel","type":"panelhook","description":"Called when the player releases any mouse button on the label. This is always called after DLabel:OnDepressed.\n\nThis works as an alternative to PANEL:OnMouseReleased as that hook is used heavily by DLabel and overriding it will break functionality.\n\nSee also DLabel:DoClick, DLabel:DoMiddleClick, DLabel:DoRightClick and DLabel:DoDoubleClick.","realm":"Client and Menu"},"example":{"description":"Changes the text of the label when the hook is called.","code":"local frame = vgui.Create( \"DFrame\" )\nframe:SetTitle( \"OnDepressed/Released Example\" )\nframe:SetSize( 300, 100 )\nframe:Center()\nframe:MakePopup()\n\nlocal frame_label = vgui.Create( \"DLabel\", frame )\nframe_label:SetPos( 10, 30 )\nframe_label:SetTextColor( Color( 255, 255, 255 ) )\nframe_label:SetText( \"Click me!\" )\nframe_label:SizeToContents()\nframe_label:SetMouseInputEnabled( true )\nframe_label.OnDepressed = function( s )\n\ts:SetText( \"OnDepressed\" )\n\tframe_label:SizeToContents()\nend\nframe_label.OnReleased = function( s )\n\ts:SetText( \"OnReleased\" )\n\tframe_label:SizeToContents()\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnToggled","parent":"DLabel","type":"panelhook","description":"Called when the toggle state of the label is changed by DLabel:Toggle.\n\nIn order to use toggle functionality, you must first call DLabel:SetIsToggle with `true`, as it is disabled by default.","realm":"Client and Menu","args":{"arg":{"text":"The new toggle state.","name":"toggleState","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DoClickInternal","parent":"DLabel","type":"panelfunc","description":"Called just before DLabel:DoClick.\n\nIn DLabel does nothing and is safe to override. Used by DMenuOption and DCollapsibleCategory's tabs.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DoDoubleClickInternal","parent":"DLabel","type":"panelfunc","description":"Called just before DLabel:DoDoubleClick. In DLabel does nothing and is safe to override.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetAutoStretchVertical","parent":"DLabel","type":"panelfunc","description":"Returns whether the label stretches vertically or not.\n\nSet by DLabel:SetAutoStretchVertical.","realm":"Client and Menu","rets":{"ret":{"text":"Whether the label stretches vertically or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetBright","parent":"DLabel","type":"panelfunc","description":"Returns whether the DLabel should set its text color to the current skin's bright text color.\n\nSee DLabel:SetBright.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetColor","parent":"DLabel","type":"panelfunc","description":"Returns the actual color of the text.\n\nSee also DLabel:GetTextColor and DLabel:GetTextStyleColor.","realm":"Client and Menu","rets":{"ret":{"text":"The the actual Color of the text.","name":"","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDark","parent":"DLabel","type":"panelfunc","description":"Returns whether the DLabel should set its text color to the current skin's dark text color.\n\nSee DLabel:SetDark.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDisabled","parent":"DLabel","type":"panelfunc","description":{"text":"Gets the disabled state of the DLabel. This is set with DLabel:SetDisabled.","deprecated":"Use Panel:IsEnabled instead."},"realm":"Client and Menu","rets":{"ret":{"text":"The disabled state of the label.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDoubleClickingEnabled","parent":"DLabel","type":"panelfunc","description":"Returns whether or not double clicking will call DLabel:DoDoubleClick.\n\nSee DLabel:SetDoubleClickingEnabled.","realm":"Client and Menu","rets":{"ret":{"text":"true = enabled, false means disabled","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDrawBackground","parent":"DLabel","type":"panelfunc","description":{"text":"Returns whether or not the panel background is being drawn. Alias of DLabel:GetPaintBackground.","deprecated":"You should use DLabel:GetPaintBackground instead."},"realm":"Client and Menu","rets":{"ret":{"text":"True if the panel background is drawn, false otherwise.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetFont","parent":"DLabel","type":"panelfunc","description":"Returns the current font of the DLabel. This is set with DLabel:SetFont.","realm":"Client and Menu","rets":{"ret":{"text":"The name of the font in use.","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetHighlight","parent":"DLabel","type":"panelfunc","description":"Returns whether the DLabel should set its text color to the current skin's highlighted text color.\n\nSee DLabel:SetHighlight.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetIsMenu","parent":"DLabel","type":"panelfunc","description":"Used internally by DComboBox.\n\nReturns whether the frame is part of a derma menu or not.\n\nIf this is `true`, Global.CloseDermaMenus will not be called when the frame is clicked, and thus any open menus will remain open.","realm":"Client and Menu","rets":{"ret":{"text":"Whether this panel is a Menu Component","name":"isMenu","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetIsToggle","parent":"DLabel","type":"panelfunc","description":"Returns whether the toggle functionality is enabled for a label. Set with DLabel:SetIsToggle.","realm":"Client and Menu","rets":{"ret":{"text":"Whether or not toggle functionality is enabled.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetPaintBackground","parent":"DLabel","type":"panelfunc","description":"Returns whether or not the background should be painted.","realm":"Client and Menu","rets":{"ret":{"text":"If the background is painted or not","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTextColor","parent":"DLabel","type":"panelfunc","description":"Returns the \"override\" text color, set by DLabel:SetTextColor.","realm":"Client and Menu","rets":{"ret":{"text":"The Color of the text, or nil.","name":"","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTextStyleColor","parent":"DLabel","type":"panelfunc","description":{"text":"Returns the \"internal\" or fallback color of the text.\n\nSee also DLabel:GetTextColor and DLabel:SetTextStyleColor.","internal":""},"realm":"Client and Menu","rets":{"ret":{"text":"The \"internal\" Color of the text","name":"","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetToggle","parent":"DLabel","type":"panelfunc","description":"Returns the current toggle state of the label. This can be set with DLabel:SetToggle and toggled with DLabel:Toggle.\n\nIn order to use toggle functionality, you must first call DLabel:SetIsToggle with `true`, as it is disabled by default.","realm":"Client and Menu","rets":{"ret":{"text":"The current toggle state.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetAutoStretchVertical","parent":"DLabel","type":"panelfunc","description":"Automatically adjusts the height of the label dependent of the height of the text inside of it.","realm":"Client and Menu","args":{"arg":{"text":"Whenever to stretch the label vertically or not.","name":"stretch","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetBright","parent":"DLabel","type":"panelfunc","description":"Sets the color of the text to the bright text color defined in the skin.\n\nDisables DLabel:SetDark. Gets overridden by DLabel:SetHighlight.\n\nYou should only consider using this if you are using background elements that are not manually painted and are using the skin colors. Otherwise use DLabel:SetTextColor.","realm":"Client and Menu","args":{"arg":{"text":"Whenever to set the text to bright or not.","name":"bright","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetColor","parent":"DLabel","type":"panelfunc","description":"Changes color of label. Alias of DLabel:SetTextColor.","realm":"Client and Menu","args":{"arg":{"text":"The color to set. Uses Color.","name":"color","type":"Color"}}},"example":{"description":"Creates a label and changes it color to red.","code":"local DLabel = vgui.Create( \"DLabel\" )\nDLabel:SetPos( 90, 50 )\nDLabel:SetColor(Color(255, 0, 0))\nDLabel:SetText( \"Hello world.\" )\nDLabel:SizeToContents()"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDark","parent":"DLabel","type":"panelfunc","description":"Sets the color of the text to the dark text color defined in the skin.\n\nDisables DLabel:SetBright. Gets overridden by DLabel:SetHighlight.\n\nYou should only consider using this if you are using background elements that are not manually painted and are using the skin colors. Otherwise use DLabel:SetTextColor.","realm":"Client and Menu","args":{"arg":{"text":"Whenever to set the text to dark or not.","name":"dark","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDisabled","parent":"DLabel","type":"panelfunc","description":{"text":"Sets the disabled state of the DLabel.\n\nWhen disabled, the label does not respond to click, toggle or drag & drop actions.","deprecated":"Use Panel:SetEnabled instead."},"realm":"Client and Menu","args":{"arg":{"text":"`true` to disable the DLabel, `false` to enable it.","name":"disable","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDoubleClickingEnabled","parent":"DLabel","type":"panelfunc","description":"Sets whether or not double clicking should call DLabel:DoDoubleClick.\n\nThis is enabled by default.","realm":"Client and Menu","args":{"arg":{"text":"true to enable, false to disable","name":"enable","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDrawBackground","parent":"DLabel","type":"panelfunc","description":{"text":"Sets whether or not to draw the panel background. Alias of DLabel:SetPaintBackground.","deprecated":"You should use DLabel:SetPaintBackground instead."},"realm":"Client and Menu","args":{"arg":{"text":"True to show the panel's background, false to hide it.","name":"draw","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetFont","parent":"DLabel","type":"panelfunc","description":"Sets the font of the label.","realm":"Client and Menu","args":{"arg":{"text":"The name of the font.\n\nSee here for a list of existing fonts.\nAlternatively, use surface.CreateFont to create your own custom font.","name":"fontName","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetHighlight","parent":"DLabel","type":"panelfunc","description":"Sets the color of the text to the highlight text color defined in the skin.\n\nFor the default Derma skin this makes the label red.\n\nOverrides colors set by both DLabel:SetBright and DLabel:SetDark while active.\n\nYou should only consider using this if you are using background elements that are not manually painted and are using the skin colors. Otherwise use DLabel:SetTextColor.","realm":"Client and Menu","args":{"arg":{"text":"true to set the label's color to skins's text highlight color, false otherwise.","name":"highlight","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetIsMenu","parent":"DLabel","type":"panelfunc","description":"Used internally by DComboBox.\n\n\nSets whether the frame is part of a derma menu or not.\n\nIf this is set to `true`, Global.CloseDermaMenus will not be called when the frame is clicked, and thus any open menus will remain open.","realm":"Client and Menu","args":{"arg":{"text":"Whether this pane is a Menu Component","name":"isMenu","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetIsToggle","parent":"DLabel","type":"panelfunc","description":"Enables or disables toggle functionality for a label. Retrieved with DLabel:GetIsToggle.\n\nYou must call this before using DLabel:SetToggle, DLabel:GetToggle or DLabel:Toggle.","realm":"Client and Menu","args":{"arg":{"text":"Whether or not to enable toggle functionality.","name":"allowToggle","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetPaintBackground","parent":"DLabel","type":"panelfunc","description":"Sets whether or not the background should be painted. This is mainly used by derivative classes, such as DButton.","realm":"Client and Menu","args":{"arg":{"name":"paint","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTextColor","parent":"DLabel","type":"panelfunc","description":"Sets the text color of the DLabel. This will take precedence over DLabel:SetTextStyleColor.","realm":"Client and Menu","args":{"arg":{"text":"The text color. Uses Color.","name":"color","type":"Color"}}},"example":{"description":"Changes the text color to red.","code":"local frame = vgui.Create( \"DFrame\" )\nframe:SetTitle( \"Text Color Example\" )\nframe:SetSize( 300, 100 )\nframe:Center()\nframe:MakePopup()\n\nlocal frame_label = vgui.Create( \"DLabel\", frame )\nframe_label:SetPos( 10, 30 )\nframe_label:SetTextColor( Color( 255, 0, 0) )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTextStyleColor","parent":"DLabel","type":"panelfunc","description":{"text":"Used by DLabel:SetDark, DLabel:SetBright and DLabel:SetHighlight to set the text color without affecting DLabel:SetTextColor calls.","internal":"Use DLabel:SetTextColor instead!"},"realm":"Client and Menu","args":{"arg":{"text":"The text color. Uses the Color.","name":"color","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetToggle","parent":"DLabel","type":"panelfunc","description":"Sets the toggle state of the label. This can be retrieved with DLabel:GetToggle and toggled with DLabel:Toggle.\n\nIn order to use toggle functionality, you must first call DLabel:SetIsToggle with `true`, as it is disabled by default.","realm":"Client and Menu","args":{"arg":{"text":"The toggle state to be set.","name":"toggleState","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Toggle","parent":"DLabel","type":"panelfunc","description":"Toggles the label's state. This can be set and retrieved with DLabel:SetToggle and DLabel:GetToggle.\n\nIn order to use toggle functionality, you must first call DLabel:SetIsToggle with `true`, as it is disabled by default.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"text":"Condition |  Value |\n----------|-------|\n| self.m_bBright | skin.Colours.Label.Bright |\n| self.m_bDark | skin.Colours.Label.Dark |\n| self.m_bHighlight | skin.Colours.Label.Highlight |","function":{"name":"UpdateColours","parent":"DLabel","type":"panelfunc","file":{"text":"lua/vgui/dlabel.lua","line":"289-279"},"description":"A hook called from within PANEL:ApplySchemeSettings to determine the color of the text on display.","realm":"Client and Menu","args":{"arg":{"text":"A table supposed to contain the color values listed above.","name":"skin","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateFGColor","parent":"DLabel","type":"panelfunc","description":{"text":"Called internally to update the color of the text.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetAutoStretch","parent":"DLabelEditable","type":"panelfunc","description":"Returns whether the editable label will stretch to the text entered or not.","realm":"Client","added":"2020.08.12","rets":{"ret":{"text":"Whether the editable label will stretch to the text entered or not.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"IsEditing","parent":"DLabelEditable","type":"panelfunc","description":"Returns whether this DLabelEditable is being edited or not. (i.e. has focus)","realm":"Client and Menu","rets":{"ret":{"text":"Whether this DLabelEditable is being edited or not","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnLabelTextChanged","parent":"DLabelEditable","type":"panelfunc","description":"A hook called when the player presses Enter (i.e. the finished editing the label) and the text has changed.\n\nAllows you to override/modify the text that will be set to display.","realm":"Client","args":{"arg":{"text":"The original user input text","name":"txt","type":"string"}},"rets":{"ret":{"text":"If provided, will override the text that will be applied to the label itself.","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetAutoStretch","parent":"DLabelEditable","type":"panelfunc","description":"Sets whether the editable label should stretch to the text entered or not.","realm":"Client","added":"2020.08.12","args":{"arg":{"text":"Whether the editable label should stretch to the text entered or not.","name":"stretch","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetAutoStretchVertical","parent":"DLabelURL","type":"panelfunc","description":{"text":"Does absolutely nothing at all.","deprecated":""},"realm":"Client and Menu","rets":{"ret":{"text":"Does nothing.","name":"draw","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetColor","parent":"DLabelURL","type":"panelfunc","description":"Gets the current text color of the DLabelURL. Returns either DLabelURL:GetTextColor or if that is unset -  DLabelURL:GetTextStyleColor.","realm":"Client and Menu","rets":{"ret":{"text":"The current text Color.","name":"","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTextColor","parent":"DLabelURL","type":"panelfunc","description":"Gets the current text color of the DLabelURL set by DLabelURL:SetTextColor.","realm":"Client and Menu","rets":{"ret":{"text":"The current text Color.","name":"","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTextStyleColor","parent":"DLabelURL","type":"panelfunc","description":"Returns the color set by DLabelURL:SetTextStyleColor.","realm":"Client and Menu","rets":{"ret":{"text":"The Color","name":"","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetAutoStretchVertical","parent":"DLabelURL","type":"panelfunc","description":{"text":"Does absolutely nothing at all.","deprecated":""},"realm":"Client and Menu","args":{"arg":{"text":"Does nothing.","name":"draw","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetColor","parent":"DLabelURL","type":"panelfunc","description":"Alias of DLabelURL:SetTextColor.","realm":"Client and Menu","args":{"arg":{"text":"The Color to use.","name":"col","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTextColor","parent":"DLabelURL","type":"panelfunc","description":"Sets the text color of the DLabelURL. Overrides DLabelURL:SetTextStyleColor.\n\n\nThis should only be used immediately after it is created, and otherwise Panel:SetFGColor.","realm":"Client and Menu","args":{"arg":{"text":"The Color to use.","name":"col","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTextStyleColor","parent":"DLabelURL","type":"panelfunc","description":"Sets the base text color of the DLabelURL. This is overridden by DLabelURL:SetTextColor.","realm":"Client and Menu","args":{"arg":{"text":"The Color to set","name":"color","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateFGColor","parent":"DLabelURL","type":"panelfunc","description":{"text":"Used internally to set correct text color via Panel:SetFGColor and DLabelURL:GetColor.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetMultiple","parent":"DListBox","type":"panelfunc","description":"Returns whether the list box can select multiple items.","realm":"Client and Menu","rets":{"ret":{"text":"Whether the list box can select multiple items.","name":"multiple","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSelectedItems","parent":"DListBox","type":"panelfunc","description":"Returns selected items.","realm":"Client and Menu","rets":{"ret":{"text":"The selected items. A list of DListBoxItem.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSelectedValues","parent":"DListBox","type":"panelfunc","description":"Returns selected item values.","realm":"Client and Menu","rets":{"ret":{"text":"The selected item values. A list of Panel:GetValue of each selected DListBoxItem.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SelectByName","parent":"DListBox","type":"panelfunc","description":"Select a DListBoxItem based on its value.","realm":"Client and Menu","args":{"arg":{"text":"Panel:GetValue of a DListBoxItem to select.","name":"val","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SelectItem","parent":"DListBox","type":"panelfunc","description":{"text":"Used internally to select a specific panel.","internal":""},"realm":"Client and Menu","args":{"arg":[{"text":"DListBox to select.","name":"item","type":"Panel"},{"text":"Whether to deselect other selected items.","name":"onlyme","type":"boolean"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMultiple","parent":"DListBox","type":"panelfunc","description":"Sets whether the list box can select multiple items.","realm":"Client and Menu","args":{"arg":{"text":"Whether the list box can select multiple items.","name":"multiple","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSelectedItems","parent":"DListBox","type":"panelfunc","description":{"text":"Sets selected items.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The items to select. A list of DListBoxItem.","name":"items","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetMother","parent":"DListBoxItem","type":"panelfunc","description":"Returns the parent \"mother\" of this **DListBoxItem** set by DListBoxItem:SetMother.","realm":"Client","rets":{"ret":{"text":"The \"mother\" DListBox.","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Select","parent":"DListBoxItem","type":"panelfunc","description":"Selects this item.","realm":"Client","args":{"arg":{"text":"Whether to deselect other items.","name":"onlyMe","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetMother","parent":"DListBoxItem","type":"panelfunc","description":{"text":"Sets the \"mother\" (parent) panel for this item. Done internally by DListBox:AddItem","internal":""},"realm":"Client","args":{"arg":{"text":"The \"mother\" panel to set.","name":"parent","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"DoDoubleClick","parent":"DListView","type":"panelhook","description":"Called when a line in the DListView is double clicked.","realm":"Client and Menu","args":{"arg":[{"text":"The line number of the double clicked line.","name":"lineID","type":"number"},{"text":"The double clicked DListView_Line.","name":"line","type":"Panel"}]}},"example":{"description":"Demonstrates the use of this function.","code":"local DList = vgui.Create( \"DListView\" )\nDList:SetPos( 5, 50 )\nDList:SetSize( 150, 245 )\nDList:AddColumn( \"Player Names\" )\n\nfor _, v in ipairs( player.GetAll() ) do\n\tDList:AddLine( v:Name() )\nend\n\nfunction DList:DoDoubleClick( lineID, line )\n\tMsgN( \"Line \" .. lineID .. \" was double clicked!\" )\nend","output":"The double clicked line number is printed, e.g.\n\n```\nLine 6 was double clicked!\n```"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnRowRightClick","parent":"DListView","type":"panelhook","description":"Called when a row is right-clicked","realm":"Client and Menu","args":{"arg":[{"text":"The line ID of the right clicked line","name":"lineID","type":"number"},{"text":"The line panel itself, a DListView_Line.","name":"line","type":"Panel"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnRowSelected","parent":"DListView","type":"panelhook","description":"Called internally by DListView:OnClickLine when a line is selected. This is the function you should override to define the behavior when a line is selected.","realm":"Client and Menu","args":{"arg":[{"text":"The index of the row/line that the user clicked on.","name":"rowIndex","type":"number"},{"text":"The DListView_Line that the user clicked on.","name":"row","type":"Panel"}]}},"example":{"description":"Prints the first two column values of the row that was clicked. In this example it's the nickname and kills of the player selected in the list","code":"local frame = vgui.Create( \"DFrame\" )\nframe:SetSize( 300, 300 )\nframe:MakePopup()\n\nlocal listView = frame:Add( \"DListView\" )\nlistView:Dock( FILL )\n\nlistView:AddColumn( \"Nick\" )\nlistView:AddColumn( \"Frags\" )\n\nfor i, ply in ipairs( player.GetAll() ) do\n\tlistView:AddLine( ply:Nick(), ply:Frags() )\nend\nlistView.OnRowSelected = function( panel, rowIndex, row )\n\tprint( row:GetValue( 1 ) )\n\tprint( row:GetValue( 2 ) )\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddColumn","parent":"DListView","type":"panelfunc","description":"Adds a column to the listview.","realm":"Client and Menu","args":{"arg":[{"text":"The name of the column to add.","name":"column","type":"string"},{"text":"At which position to insert the new column compared to the other columns. Set to 1 to add the new column before all other columns. \n\nBy default the column will be placed after all columns.","name":"position","type":"number","default":"nil"}]},"rets":{"ret":{"text":"The newly created DListView_Column.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddLine","parent":"DListView","type":"panelfunc","description":"Adds a line to the list view.","realm":"Client and Menu","args":{"arg":{"text":"Values for a new row in the DListView, If several arguments are supplied, each argument will correspond to a respective column in the DListView.","name":"text","type":"vararg"}},"rets":{"ret":{"text":"The newly created DListView_Line.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ClearSelection","parent":"DListView","type":"panelfunc","description":"Clears the current selection in the DListView.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ColumnWidth","parent":"DListView","type":"panelfunc","description":"Gets the width of a column.","realm":"Client and Menu","args":{"arg":{"text":"The column to get the width of.","name":"column","type":"number"}},"rets":{"ret":{"text":"Width of the column.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DataLayout","parent":"DListView","type":"panelfunc","description":"Creates the lines and gets the height of the contents, in a DListView.","realm":"Client and Menu","rets":{"ret":{"text":"The height of the contents","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DisableScrollbar","parent":"DListView","type":"panelfunc","description":"Removes the scrollbar.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"FixColumnsLayout","parent":"DListView","type":"panelfunc","description":{"text":"Internal helper function called from the PANEL:PerformLayout of DListView.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetCanvas","parent":"DListView","type":"panelfunc","description":"Gets the canvas.","realm":"Client and Menu","rets":{"ret":{"text":"The canvas.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDataHeight","parent":"DListView","type":"panelfunc","description":"Returns the height of the data of the DListView.\n\nSee also DListView:SetDataHeight.","realm":"Client and Menu","rets":{"ret":{"text":"The height of the data of the DListView.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDirty","parent":"DListView","type":"panelfunc","description":{"text":"See DListView:SetDirty.","internal":""},"realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetHeaderHeight","parent":"DListView","type":"panelfunc","description":"Returns the height of the header of the DListView.\n\nSee also DListView:SetHeaderHeight.","realm":"Client and Menu","rets":{"ret":{"text":"The height of the header of the DListView.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetHideHeaders","parent":"DListView","type":"panelfunc","description":"Returns whether the header line should be visible on not.","realm":"Client and Menu","rets":{"ret":{"text":"Whether the header line should be visible on not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetInnerTall","parent":"DListView","type":"panelfunc","description":"Returns the height of DListView:GetCanvas.\n\nIntended to represent the height of all data lines.","realm":"Client and Menu","rets":{"ret":{"text":"The height of DListView:GetCanvas.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetLine","parent":"DListView","type":"panelfunc","description":"Gets the DListView_Line at the given index.","realm":"Client and Menu","args":{"arg":{"text":"The index of the line to get.","name":"id","type":"number"}},"rets":{"ret":{"text":"The DListView_Line at the given index.","name":"","type":"Panel"}}},"example":{"description":"An example of how to retrieve a DListView_Line from a DListView.","code":"local list = vgui.Create( \"DListView\" )\nlist:AddColumn( \"Name\" )\nlist:AddLine( \"Garry :D\" )\n\nprint( list:GetLine( 1 ) )","output":"Panel: [name:DListView_Line][class:Panel][0,0,64,24]"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetLines","parent":"DListView","type":"panelfunc","description":"Gets all of the lines added to the DListView.","realm":"Client and Menu","rets":{"ret":{"text":"The lines added to the DListView.","name":"","type":"table"}}},"example":{"description":"Loops through all of the lines of a DListView and prints their first value.","code":"local list = vgui.Create( \"DListView\" )\nlist:AddColumn( \"Fruit\" )\n\nfor _, line in ipairs( { \"Apple\", \"Orange\", \"Banana\" } ) do\n    list:AddLine( line )\nend\n\nfor k, line in ipairs( list:GetLines() ) do\n    print( k, line:GetValue( 1 ) )\nend","output":"```\n1\tApple\n2\tOrange\n3\tBanana\n```"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetMultiSelect","parent":"DListView","type":"panelfunc","description":"Returns whether multiple lines can be selected or not.\n\nSee DListView:SetMultiSelect.","realm":"Client and Menu","rets":{"ret":{"text":"Whether multiple lines can be selected or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSelected","parent":"DListView","type":"panelfunc","description":"Gets all of the lines that are currently selected.","realm":"Client and Menu","rets":{"ret":{"text":"A table of DListView_Lines.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSelectedLine","parent":"DListView","type":"panelfunc","description":"Gets the currently selected DListView_Line index.\n\nIf DListView:SetMultiSelect is set to true, only the first line of all selected lines will be returned. Use DListView:GetSelected instead to get all of the selected lines.","realm":"Client and Menu","rets":{"ret":[{"text":"The index of the currently selected line.","name":"","type":"number"},{"text":"The currently selected DListView_Line.","name":"","type":"Panel"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSortable","parent":"DListView","type":"panelfunc","description":"Returns whether sorting of columns by clicking their headers is allowed or not.\n\nSee also DListView:SetSortable.","realm":"Client and Menu","rets":{"ret":{"text":"Whether sorting of columns by clicking their headers is allowed or not","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSortedID","parent":"DListView","type":"panelfunc","description":{"text":"Converts LineID to SortedID","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The DListView_Line:GetID of a line to look up","name":"lineId","type":"number"}},"rets":{"ret":{"name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnClickLine","parent":"DListView","type":"panelfunc","description":{"text":"Called whenever a line is clicked.","internal":"Use DListView:OnRowSelected instead!"},"realm":"Client and Menu","args":{"arg":[{"text":"The selected line.","name":"line","type":"Panel"},{"text":"Boolean indicating whether the line is selected.","name":"isSelected","type":"boolean"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnRequestResize","parent":"DListView","type":"panelfunc","description":{"text":"Called from DListView_Column.","internal":""},"realm":"Client and Menu","args":{"arg":[{"text":"The column which initialized the resize","name":"column","type":"Panel"},{"name":"size","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"RemoveLine","parent":"DListView","type":"panelfunc","description":"Removes a line from the list view.","realm":"Client and Menu","args":{"arg":{"text":"Removes the given row, by row id (same number as DListView:GetLine).","name":"line","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SelectFirstItem","parent":"DListView","type":"panelfunc","description":"Selects the line at the first index of the DListView if one has been added.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SelectItem","parent":"DListView","type":"panelfunc","description":"Selects a line in the listview.","realm":"Client and Menu","args":{"arg":{"text":"The line to select.","name":"Line","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDataHeight","parent":"DListView","type":"panelfunc","description":"Sets the height of all lines of the DListView except for the header line.\n\nSee also DListView:SetHeaderHeight.","realm":"Client and Menu","args":{"arg":{"text":"The new height to set. Default value is 17.","name":"height","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDirty","parent":"DListView","type":"panelfunc","description":{"text":"Used internally to signify if the DListView needs a rebuild.","internal":""},"realm":"Client and Menu","args":{"arg":{"name":"isDirty","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetHeaderHeight","parent":"DListView","type":"panelfunc","description":"Sets the height of the header line of the DListView.\n\nSee also DListView:SetDataHeight.","realm":"Client and Menu","args":{"arg":{"text":"The new height to set. Default value is 16.","name":"height","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetHideHeaders","parent":"DListView","type":"panelfunc","description":"Sets whether the header line should be visible on not.","realm":"Client and Menu","args":{"arg":{"text":"Whether the header line should be visible on not.","name":"hide","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMultiSelect","parent":"DListView","type":"panelfunc","description":{"text":"Sets whether multiple lines can be selected by the user by using the  or  keys. When set to false, only one line can be selected.","key":["Ctrl","Shift"]},"realm":"Client and Menu","args":{"arg":{"text":"Whether multiple lines can be selected or not","name":"allowMultiSelect","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSortable","parent":"DListView","type":"panelfunc","description":{"text":"Enables/disables the sorting of columns by clicking.","note":"This will only affect columns that are created after this function is called. Existing columns will be unaffected."},"realm":"Client and Menu","args":{"arg":{"text":"Whether sorting columns with clicking is allowed or not.","name":"isSortable","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SortByColumn","parent":"DListView","type":"panelfunc","description":"Sorts the items in the specified column.","realm":"Client and Menu","args":{"arg":[{"text":"The index of the column that should be sorted.","name":"columnIndex","type":"number"},{"text":"Whether the items should be sorted in descending order or not.","name":"descending","type":"boolean","default":"false"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SortByColumns","parent":"DListView","type":"panelfunc","description":"Sorts the list based on given columns.\n\nAll arguments are optional","realm":"Client and Menu","args":{"arg":[{"name":"column1","type":"number","default":"nil"},{"name":"descrending1","type":"boolean","default":"false"},{"name":"column2","type":"number","default":"nil"},{"name":"descrending2","type":"boolean","default":"false"},{"name":"column3","type":"number","default":"nil"},{"name":"descrending3","type":"boolean","default":"false"},{"name":"column4","type":"number","default":"nil"},{"name":"descrending4","type":"boolean","default":"false"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DoClick","parent":"DListView_Column","type":"panelhook","description":"Called when the column is left clicked (on key release) by the client.\n\nSee also DListView_Column:DoRightClick.","realm":"Client and Menu","file":{"text":"lua/vgui/dlistview_column.lua","line":"91-L96"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DoRightClick","parent":"DListView_Column","type":"panelhook","description":"Called when the column is right clicked (on key release) by the client.\n\nSee also DListView_Column:DoClick.","realm":"Client and Menu","file":{"text":"lua/vgui/dlistview_column.lua","line":"98-L100"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetColumnID","parent":"DListView_Column","type":"panelfunc","description":"Gets the index used for this column.","realm":"Client and Menu","rets":{"ret":{"text":"The column index of the DListView_Column.","name":"index","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDescending","parent":"DListView_Column","type":"panelfunc","description":"Returns whether the column is sorted in descending order or not.","realm":"Client and Menu","rets":{"ret":{"text":"Whether the column is sorted in descending order or not.","name":"desc","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetFixedWidth","parent":"DListView_Column","type":"panelfunc","description":"Returns the fixed width of this column.","realm":"Client and Menu","rets":{"ret":{"text":"The fixed width.","name":"width","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetMaxWidth","parent":"DListView_Column","type":"panelfunc","description":"Returns the maximum width set with DListView_Column:SetMaxWidth.","realm":"Client and Menu","rets":{"ret":{"text":"The maximum width","name":"width","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetMinWidth","parent":"DListView_Column","type":"panelfunc","description":"Returns the minimum width set with DListView_Column:SetMinWidth.","realm":"Client and Menu","rets":{"ret":{"text":"The minimum width","name":"width","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTextAlign","parent":"DListView_Column","type":"panelfunc","description":"Returns the text alignment for the column","realm":"Client and Menu","rets":{"ret":{"text":"The direction of the content, based on the number pad. See DListView_Column:SetTextAlign.","name":"alignment","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ResizeColumn","parent":"DListView_Column","type":"panelfunc","description":"Resizes the column, additionally adjusting the size of the column to the right, if any.","realm":"Client and Menu","args":{"arg":{"text":"The amount to add to the current column's width.\n\n\t\t\tPositive values will make it wider, and negative values will make it thinner.","name":"size","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetColumnID","parent":"DListView_Column","type":"panelfunc","description":{"text":"Sets the index used for this column.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The column index of the DListView_Column.","name":"index","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDescending","parent":"DListView_Column","type":"panelfunc","description":"Sets whether the column is sorted in descending order or not.","realm":"Client and Menu","args":{"arg":{"text":"Whether the column is sorted in descending order or not.","name":"desc","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetFixedWidth","parent":"DListView_Column","type":"panelfunc","description":{"text":"Sets the fixed width of the column.","note":"Internally this will set SetMinWidth and SetMaxWidth to the value provided"},"realm":"Client and Menu","args":{"arg":{"text":"The number value which will determine a fixed width.","name":"width","type":"number"}}},"example":{"description":"Creates a DListView and populates it with two columns and two items, only one of which can be selected at a time.\n\nThe first column will be longer than the second column.","code":"local Frame = vgui.Create( \"DFrame\" )\nFrame:SetSize( 500, 500 )\nFrame:Center()\nFrame:MakePopup()\n\nlocal SimpleList = vgui.Create( \"DListView\", Frame )\nSimpleList:Dock( FILL )\nSimpleList:SetMultiSelect( false )\n\nSimpleList:AddColumn( \"Column 1\" )\nSimpleList:AddColumn( \"Column 2\" ):SetFixedWidth(125)\n\nSimpleList:AddLine( \"First\", \"Column\" )\nSimpleList:AddLine( \"Second\", \"Column\" )","output":{"image":{"src":"DListView_Column_SetFixedWidth.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMaxWidth","parent":"DListView_Column","type":"panelfunc","description":"Sets the maximum width of a column.","realm":"Client and Menu","args":{"arg":{"text":"The number value which will determine a maximum width.","name":"width","type":"number"}}},"example":{"description":"Creates a DListView and populates it with two columns and two items, only one of which can be selected at a time.\n\nThe second column can't be bigger than the argument value.","code":"local Frame = vgui.Create( \"DFrame\" )\nFrame:SetSize( 500, 500 )\nFrame:Center()\nFrame:MakePopup()\n\nlocal SimpleList = vgui.Create( \"DListView\", Frame )\nSimpleList:Dock( FILL )\nSimpleList:SetMultiSelect( false )\n\nSimpleList:AddColumn( \"Column 1\" )\nSimpleList:AddColumn( \"Column 2\" ):SetMaxWidth(225)\n\nSimpleList:AddLine( \"First\", \"Column\" )\nSimpleList:AddLine( \"Second\", \"Column\" )","output":{"image":{"src":"DListView_Column_SetMaxWidth.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMinWidth","parent":"DListView_Column","type":"panelfunc","description":"Sets the minimum width of a column.","realm":"Client and Menu","args":{"arg":{"text":"The number value which will determine a minimum width.","name":"width","type":"number"}}},"example":{"description":"Creates a DListView and populates it with two columns and two items, only one of which can be selected at a time.\n\nThe second column can't be smaller than the argument value.","code":"local Frame = vgui.Create( \"DFrame\" )\nFrame:SetSize( 500, 500 )\nFrame:Center()\nFrame:MakePopup()\n\nlocal SimpleList = vgui.Create( \"DListView\", Frame )\nSimpleList:Dock( FILL )\nSimpleList:SetMultiSelect( false )\n\nSimpleList:AddColumn( \"Column 1\" )\nSimpleList:AddColumn( \"Column 2\" ):SetMinWidth(125)\n\nSimpleList:AddLine( \"First\", \"Column\" )\nSimpleList:AddLine( \"Second\", \"Column\" )","output":{"image":{"src":"DListView_Column_SetMinWidth.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetName","parent":"DListView_Column","type":"panelfunc","description":"Sets the text in the column's header.","realm":"Client and Menu","args":{"arg":{"text":"The new name that the column's header will use.","name":"name","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTextAlign","parent":"DListView_Column","type":"panelfunc","description":"Sets the text alignment for the column","realm":"Client and Menu","args":{"arg":{"text":"The direction of the content, based on the number pad.\n\n|   |   |   |\n| --- | --- | --- |\n| : **top-left** | : **top-center**\t| : **top-right** |\n| : **middle-left** | : **center** | : **middle-right** |\n| : **bottom-left** | : **bottom-center** | : **bottom-right** |","name":"alignment","type":"number","key":["7","8","9","4","5","6","1","2","3"]}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetWidth","parent":"DListView_Column","type":"panelfunc","description":"Sets the width of the panel.","realm":"Client and Menu","args":{"arg":{"text":"The number value which will determine panel width.","name":"width","type":"number"}}},"example":{"description":"Creates a DListView and populates it with two columns and two items, only one of which can be selected at a time.\n\nThe first column width is 15.\nThe second column width is 350.","code":"local Frame = vgui.Create( \"DFrame\" )\nFrame:SetSize( 500, 500 )\nFrame:Center()\nFrame:MakePopup()\n\nlocal SimpleList = vgui.Create( \"DListView\", Frame )\nSimpleList:Dock( FILL )\nSimpleList:SetMultiSelect( false )\n\nSimpleList:AddColumn( \"Column 1\" ):SetWidth(15)\nSimpleList:AddColumn( \"Column 2\" ):SetWidth(350)\n\nSimpleList:AddLine( \"First\", \"Column\" )\nSimpleList:AddLine( \"Second\", \"Column\" )","output":{"image":{"src":"DListView_Column_SetWidth.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnRightClick","parent":"DListView_Line","type":"panelhook","description":"Called when the player right clicks this line.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnSelect","parent":"DListView_Line","type":"panelhook","description":"Called when the player selects this line.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DataLayout","parent":"DListView_Line","type":"panelfunc","description":{"text":"Called by DListView:DataLayout","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The list view.","name":"pnl","type":"DListView"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetAltLine","parent":"DListView_Line","type":"panelfunc","description":"Returns whether this line is odd or even in the list. This is internally used (and set) to change the looks of every other line.","realm":"Client and Menu","rets":{"ret":{"text":"Whether this line is 'alternative'.","name":"alt","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetColumnText","parent":"DListView_Line","type":"panelfunc","description":"Gets the string held in the specified column of a DListView_Line panel.\n\nThis is the same thing as doing DListView_Line:GetValue( column_number ).","realm":"Client and Menu","args":{"arg":{"text":"The number of the column to retrieve the text from, starts with 1.","name":"column","type":"number"}},"rets":{"ret":{"text":"The contents of the specified column.","name":"","type":"string"}}},"example":{"code":"local dframe = vgui.Create(\"DFrame\")\ndframe:SetSize(450, 350)\ndframe:Center()\n\nlocal dlist = vgui.Create(\"DListView\", dframe)\ndlist:Dock(FILL)\ndlist:SetMultiSelect(false)\ndlist:AddColumn(\"Name\")\ndlist:AddColumn(\"SteamID\")\ndlist:AddLine(\"Stalker\", \"STEAM_0:1:18093014\")\nfunction dlist:DoDoubleClick(linenumber, lineinfo)\n\tprint(lineinfo:GetColumnText(2))\nend","output":"Prints \"STEAM_0:1:18093014\" when the line containing Stalker is double clicked."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetID","parent":"DListView_Line","type":"panelfunc","description":"Returns the ID of this line, set automatically in DListView:AddLine.","realm":"Client and Menu","rets":{"ret":{"text":"The ID of this line.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetListView","parent":"DListView_Line","type":"panelfunc","description":"Returns the parent DListView of this line.","realm":"Client and Menu","rets":{"ret":{"text":"The parent DListView of this line.","name":"pnl","type":"DListView"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSortValue","parent":"DListView_Line","type":"panelfunc","description":"Returns the data stored on given cell of this line.\n\n\tUsed in the DListView:SortByColumn function in case you want to sort with something else than the text.","realm":"Client and Menu","args":{"arg":{"text":"The number of the column to write the text from, starts with 1.","name":"column","type":"number"}},"rets":{"ret":{"text":"The data that is set for given column of this line, if any.","name":"data","type":"any"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetValue","parent":"DListView_Line","type":"panelfunc","description":"Alias of DListView_Line:GetColumnText. Overrides Panel:GetValue.","realm":"Client and Menu","args":{"arg":{"text":"The number of the column to retrieve the text from, starts with 1.","name":"column","type":"number"}},"rets":{"ret":{"text":"The contents of the specified column.","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsLineSelected","parent":"DListView_Line","type":"panelfunc","description":"Returns whether this line is selected.","realm":"Client and Menu","rets":{"ret":{"text":"Whether this line is selected.","name":"selected","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetAltLine","parent":"DListView_Line","type":"panelfunc","description":{"text":"Sets whether this line is odd or even in the list. This is internally used (and set automatically) to change the looks of every other line.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"Whether this line is 'alternative'.","name":"alt","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetColumnText","parent":"DListView_Line","type":"panelfunc","description":"Sets the string held in the specified column of a DListView_Line panel.","realm":"Client and Menu","args":{"arg":[{"text":"The number of the column to write the text from, starts with 1.","name":"column","type":"number"},{"text":"Column text you want to set","name":"value","type":"string"}]},"rets":{"ret":{"text":"The DLabel in which the text was set.","name":"label","type":"DLabel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetID","parent":"DListView_Line","type":"panelfunc","description":{"text":"Sets the ID of this line, used internally by DListView:AddLine.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The ID for this line.","name":"id","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetListView","parent":"DListView_Line","type":"panelfunc","description":{"text":"Sets the parent DListView for this line. Used internally by DListView:AddLine.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The new parent DListView for this line.","name":"pnl","type":"DListView"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSelected","parent":"DListView_Line","type":"panelfunc","description":"Sets whether this line is selected or not.","realm":"Client and Menu","args":{"arg":{"text":"Whether this line is selected.","name":"selected","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSortValue","parent":"DListView_Line","type":"panelfunc","description":"Allows you to store data per column.\n\n\tUsed in the DListView:SortByColumn function in case you want to sort with something else than the text.","realm":"Client and Menu","args":{"arg":[{"text":"The number of the column to write the text from, starts with 1.","name":"column","type":"number"},{"text":"Data for given column on the line you wish to set.","name":"data","type":"any"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetValue","parent":"DListView_Line","type":"panelfunc","description":"Alias of DListView_Line:SetColumnText.","realm":"Client and Menu","args":{"arg":[{"text":"The number of the column to write the text from, starts with 1.","name":"column","type":"number"},{"text":"Column text you want to set","name":"value","type":"string"}]},"rets":{"ret":{"text":"The DLabel in which the text was set.","name":"label","type":"DLabel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddCVar","parent":"DMenu","type":"panelfunc","description":"Creates a DMenuOptionCVar and adds it as an option into the menu. Checking and unchecking the option will alter the given console variable's value.","realm":"Client and Menu","file":{"text":"lua/vgui/dmenu.lua","line":"49-L64"},"args":{"arg":[{"text":"The text of the button","name":"strText","type":"string"},{"text":"The console variable to change","name":"convar","type":"string"},{"text":"The value of the console variable to set when the option is checked","name":"on","type":"string"},{"text":"The value of the console variable to set when the option is unchecked","name":"off","type":"string"},{"text":"If set, the function will be called every time the option is pressed/clicked/selected.","name":"funcFunction","type":"function","default":"nil","callback":{"arg":{"text":"The DMenuOptionCVar that was clicked.","type":"Panel","name":"pnl"}}}]},"rets":{"ret":{"text":"The created DMenuOptionCVar","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddOption","parent":"DMenu","type":"panelfunc","description":"Add an option to the DMenu","file":{"text":"lua/vgui/dmenu.lua","line":"36"},"realm":"Client and Menu","args":{"arg":[{"text":"Name of the option.","name":"name","type":"string"},{"text":"Function to execute when this option is clicked.","name":"func","type":"function","default":"nil","callback":{"arg":{"text":"The DMenuOption that was clicked.","type":"Panel","name":"pnl"}}}]},"rets":{"ret":{"text":"Returns the created DMenuOption panel.","name":"","type":"Panel"}}},"example":{"description":"Creates a DMenu with 2 options: One that kills yourself; One that does nothing.","code":"local m = DermaMenu()\n\nm:AddOption( \"Suicide\", function() RunConsoleCommand(\"kill\") end )\nm:AddOption( \"It does nothing\" )\n\nm:Open()"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddPanel","parent":"DMenu","type":"panelfunc","description":"Adds a panel to the DMenu as if it were an option.\n\nThis invokes DScrollPanel:AddItem and will not create a new panel if a class name is passed, unlike Panel:Add.","file":{"text":"lua/vgui/dmenu.lua","line":"29"},"realm":"Client and Menu","args":{"arg":{"text":"The panel that you want to add.","name":"pnl","type":"Panel"}}},"example":{"description":"Creates a DMenu with some options and places a red DPanel between them.","code":"local m = DermaMenu()\n\nm:AddOption( \"Kill yourself\", function() RunConsoleCommand( \"kill\" ) end ) -- Add first option\nm:AddSpacer()\n\n-- Create a red DPanel\nlocal panel = vgui.Create( \"DPanel\", m )\npanel:SetSize( 50, 100 )\npanel:SetBackgroundColor( Color( 255, 0, 0 ) )\n\nm:AddPanel( panel ) -- Add the panel\n\nm:AddSpacer()\nm:AddOption( \"Say hi\", function() RunConsoleCommand( \"say\", \"Hi!\" ) end ) -- Add second option\n\nm:Open() -- Show our menu","output":{"image":{"src":"DMenu_AddPanel_eg.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddSpacer","parent":"DMenu","type":"panelfunc","description":"Adds a horizontal line spacer.","realm":"Client and Menu"},"example":{"description":"Creates a DMenu with 3 options and adds a spacer before the third.","code":"local m = DermaMenu()\n\nm:AddOption( \"Kill yourself\", function() RunConsoleCommand( \"kill\" ) end ) -- Add first option\nm:AddOption( \"Disconnect\", function() RunConsoleCommand( \"disconnect\" ) end ) -- Add second option\n\nm:AddSpacer() -- Add a spacer\n\nm:AddOption( \"Say hi\", function() RunConsoleCommand( \"say\", \"Hi!\" ) end ) -- Add third option\n\nm:Open() -- Show our menu","output":{"image":{"src":"DMenu_spacer.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddSubMenu","parent":"DMenu","type":"panelfunc","description":"Add a sub menu to the DMenu","realm":"Client and Menu","args":{"arg":[{"text":"Name of the sub menu.","name":"Name","type":"string"},{"text":"Function to execute when this sub menu is clicked.","name":"func","type":"function","default":"nil","callback":{"arg":{"text":"The DMenuOption that was clicked.","type":"Panel","name":"pnl"}}}]},"rets":{"ret":[{"text":"The created sub DMenu","name":"","type":"Panel"},{"text":"The created DMenuOption","name":"","type":"Panel"}]}},"example":{"description":"Creates a menu with one option \"Do you want to die?\", which has two sub-options \"Yes\" and \"No\".","code":"local parentMenu = DermaMenu()\n\nlocal subMenu, parentMenuOption = parentMenu:AddSubMenu(\"Do you want to die?\")\nparentMenuOption:SetIcon(\"icon16/user_red.png\")\n\nlocal yesOption = subMenu:AddOption(\"Yes\", function() LocalPlayer():ConCommand(\"kill\") end)\nyesOption:SetIcon(\"icon16/accept.png\")\n\nlocal noOption = subMenu:AddOption(\"No\", function() print(\"You chose to live another day\") end)\nnoOption:SetIcon(\"icon16/cross.png\")\n\nparentMenu:Open()","output":{"image":{"src":"DMenuSubMenu.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ChildCount","parent":"DMenu","type":"panelfunc","description":"Returns the number of child elements of DMenu's DScrollPanel:GetCanvas.","realm":"Client and Menu","rets":{"ret":{"text":"The number of child elements","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ClearHighlights","parent":"DMenu","type":"panelfunc","description":{"text":"Clears all highlights made by DMenu:HighlightItem.\n\nDoesn't appear to be used or do anything.","deprecated":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CloseSubMenu","parent":"DMenu","type":"panelfunc","description":{"text":"Used internally by DMenu:OpenSubMenu.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The menu to close","name":"menu","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetChild","parent":"DMenu","type":"panelfunc","description":"Gets a child by its index.","realm":"Client and Menu","args":{"arg":{"text":"The index of the child to get.","name":"childIndex","type":"number","note":"Unlike Panel:GetChild, this index starts at 1."}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDeleteSelf","parent":"DMenu","type":"panelfunc","description":{"text":"Set by DMenu:SetDeleteSelf","deprecated":""},"realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDrawBorder","parent":"DMenu","type":"panelfunc","description":{"text":"Returns the value set by DMenu:SetDrawBorder.","deprecated":""},"realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDrawColumn","parent":"DMenu","type":"panelfunc","description":"Returns whether the DMenu should draw the icon column with a different color or not.\n\nSee DMenu:SetDrawColumn","realm":"Client and Menu","rets":{"ret":{"text":"Whether to draw the column or not","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetMaxHeight","parent":"DMenu","type":"panelfunc","description":"Returns the maximum height of the DMenu.","realm":"Client and Menu","rets":{"ret":{"text":"The maximum height in pixels","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetMinimumWidth","parent":"DMenu","type":"panelfunc","description":"Returns the minimum width of the DMenu in pixels","realm":"Client and Menu","rets":{"ret":{"text":"the minimum width of the DMenu","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetOpenSubMenu","parent":"DMenu","type":"panelfunc","description":{"text":"Returns the currently opened submenu.\n\nUsed internally to store the open submenu by DMenu:Hide, DMenu:OpenSubMenu.","internal":""},"realm":"Client and Menu","rets":{"ret":{"text":"The currently opened submenu, if any.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Hide","parent":"DMenu","type":"panelfunc","description":"Used to safely hide (not remove) the menu. This will also hide any opened submenues recursively.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"HighlightItem","parent":"DMenu","type":"panelfunc","description":{"text":"Highlights selected item in the DMenu by setting the item's key \"Highlight\" to true.\n\nDoesn't appear to be working or used.","deprecated":""},"realm":"Client and Menu","args":{"arg":{"text":"The item to highlight.","name":"item","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Open","parent":"DMenu","type":"panelfunc","description":"Opens the DMenu at given position.","realm":"Client and Menu","args":{"arg":[{"text":"Position (X coordinate) to open the menu at.","name":"x","type":"number","default":"gui.MouseX()"},{"text":"Position (Y coordinate) to open the menu at.","name":"y","type":"number","default":"gui.MouseY()"},{"text":"This argument does nothing.","name":"skipanimation","type":"any","default":"nil"},{"text":"If `x` and `y` are not set manually, setting this argument will offset the `y` position of the opened menu by the height of given panel.","name":"ownerpanel","type":"Panel","default":"nil"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OpenSubMenu","parent":"DMenu","type":"panelfunc","description":"Closes any active sub menus, and opens a new one.","realm":"Client and Menu","args":{"arg":[{"text":"The DMenuOption to open the submenu at","name":"item","type":"Panel"},{"text":"The submenu to open. If set to nil, the function just closes existing submenus.","name":"menu","type":"Panel","default":"nil"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OptionSelected","parent":"DMenu","type":"panelfunc","description":"Called when a option has been selected","realm":"Client and Menu","args":{"arg":[{"text":"The DMenuOption that was selected","name":"option","type":"Panel"},{"text":"The options text","name":"optionText","type":"string"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OptionSelectedInternal","parent":"DMenu","type":"panelfunc","description":{"text":"Called by DMenuOption. Calls DMenu:OptionSelected.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The DMenuOption that called this function","name":"option","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDeleteSelf","parent":"DMenu","type":"panelfunc","description":"Set to true by default. IF set to true, the menu will be deleted when it is closed, not simply hidden.\n\nThis is used by DMenuBar","realm":"Client and Menu","args":{"arg":{"text":"true to delete menu on close, false to simply hide.","name":"newState","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDrawBorder","parent":"DMenu","type":"panelfunc","description":{"text":"Does nothing.","deprecated":""},"realm":"Client and Menu","args":{"arg":{"name":"bool","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDrawColumn","parent":"DMenu","type":"panelfunc","description":"Sets whether the DMenu should draw the icon column with a different color.","realm":"Client and Menu","args":{"arg":{"text":"Whether to draw the column or not","name":"draw","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMaxHeight","parent":"DMenu","type":"panelfunc","description":"Sets the maximum height the DMenu can have. If the height of all menu items exceed this value, a scroll bar will be automatically added.","realm":"Client and Menu","args":{"arg":{"text":"The maximum height of the DMenu to set, in pixels","name":"maxHeight","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMinimumWidth","parent":"DMenu","type":"panelfunc","description":"Sets the minimum width of the DMenu. The menu will be stretched to match the given value.","realm":"Client and Menu","args":{"arg":{"text":"The minimum width of the DMenu in pixels","name":"minWidth","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetOpenSubMenu","parent":"DMenu","type":"panelfunc","description":{"text":"Used internally to store the open submenu by DMenu:Hide, DMenu:OpenSubMenu, DMenu:CloseSubMenu","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The menu to store","name":"item","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddMenu","parent":"DMenuBar","type":"panelfunc","description":"Creates a new DMenu object tied to a DButton with the given label on the menu bar.\n\nThis will create a new menu regardless of whether or not one with the same label exists. To add **or** get a menu, use DMenuBar:AddOrGetMenu.","realm":"Client and Menu","args":{"arg":{"text":"The name (label) of the derma menu to create.","name":"label","type":"string"}},"rets":{"ret":{"text":"The new DMenu which will be opened when the button is clicked.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddOrGetMenu","parent":"DMenuBar","type":"panelfunc","description":"Retrieves a DMenu object from the menu bar. If one with the given label doesn't exist, a new one is created.\n\nTo add a DMenu without checking, use DMenuBar:AddMenu.","realm":"Client and Menu","args":{"arg":{"text":"The name (label) of the derma menu to get or create.","name":"label","type":"string"}},"rets":{"ret":{"text":"The DMenu with the given label.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDrawBackground","parent":"DMenuBar","type":"panelfunc","description":{"text":"Returns whether or not the background should be painted. Is the same as DMenuBar:GetPaintBackground","deprecated":"Use DMenuBar:GetPaintBackground instead."},"realm":"Client and Menu","rets":{"ret":{"text":"Should the background be painted","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetIsMenu","parent":"DMenuBar","type":"panelfunc","description":"Returns whether or not the panel is a menu. Used for closing menus when another panel is selected.","realm":"Client and Menu","rets":{"ret":{"text":"Is a menu","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetOpenMenu","parent":"DMenuBar","type":"panelfunc","description":"If a menu is visible/opened, then the menu is returned.","realm":"Client and Menu","rets":{"ret":{"text":"Returns the visible/open menu or nil.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetPaintBackground","parent":"DMenuBar","type":"panelfunc","description":"Returns whether or not the background should be painted. Is the same as DMenuBar:GetDrawBackground","realm":"Client and Menu","rets":{"ret":{"text":"Should the background be painted","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDrawBackground","parent":"DMenuBar","type":"panelfunc","description":{"text":"Sets whether or not the background should be painted. Is the same as DMenuBar:SetPaintBackground","deprecated":"Use DMenuBar:SetPaintBackground"},"realm":"Client and Menu","args":{"arg":{"text":"Should the background be painted","name":"shouldPaint","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetIsMenu","parent":"DMenuBar","type":"panelfunc","description":"Sets whether or not the panel is part of a DMenu.\n\nIf this is set to `true`, Global.CloseDermaMenus will not be called when the panel is clicked, and thus any open menus will remain open.","realm":"Client and Menu","args":{"arg":{"text":"Is this a menu","name":"isMenu","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetPaintBackground","parent":"DMenuBar","type":"panelfunc","description":"Sets whether or not the background should be painted. Is the same as DMenuBar:SetDrawBackground","realm":"Client and Menu","args":{"arg":{"text":"Should the background be painted","name":"shouldPaint","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddSubMenu","parent":"DMenuOption","type":"panelfunc","description":"Creates a sub DMenu and returns it. Has no duplicate call protection.","realm":"Client and Menu","rets":{"ret":{"text":"The created DMenu to add options to.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetChecked","parent":"DMenuOption","type":"panelfunc","description":"Returns the checked state of DMenuOption.","realm":"Client and Menu","rets":{"ret":{"text":"Are we checked or not","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetIsCheckable","parent":"DMenuOption","type":"panelfunc","description":"Returns whether the DMenuOption is a checkbox option or a normal button option.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetMenu","parent":"DMenuOption","type":"panelfunc","description":"Returns which DMenu this option belongs.","realm":"Client and Menu","rets":{"ret":{"text":"A DMenu to which this panel belongs.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetRadio","parent":"DMenuOption","type":"panelfunc","description":"Returns whether this DMenuOption should act like a radio button, set by DMenuOption:SetRadio.","added":"2024.02.20","realm":"Client and Menu","rets":{"ret":{"text":"`true` to set as a radio button.","name":"checked","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnChecked","parent":"DMenuOption","type":"panelfunc","description":"Called whenever the DMenuOption's checked state changes.","realm":"Client and Menu","args":{"arg":{"text":"The new checked state","name":"checked","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetChecked","parent":"DMenuOption","type":"panelfunc","description":"Sets the checked state of the DMenuOption.\n\nInvokes DMenuOption:OnChecked.","realm":"Client and Menu","args":{"arg":{"text":"`true` to set as checked.","name":"checked","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetIsCheckable","parent":"DMenuOption","type":"panelfunc","description":"Sets whether the DMenuOption is a checkbox option or a normal button option.\n\nEnables automatic DMenuOption:GetChecked toggling with left/right clicks.","realm":"Client and Menu","args":{"arg":{"text":"Whether the menu option should allow the player to toggle itself.","name":"checkable","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMenu","parent":"DMenuOption","type":"panelfunc","description":{"text":"Used to set the DMenu for this option.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The DMenu for this option.","name":"pnl","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetRadio","parent":"DMenuOption","type":"panelfunc","description":"Sets whether this DMenuOption should act like a radio button.\n\nChecking a radio button automatically unchecks all adjacent radio buttons.","added":"2024.02.20","realm":"Client and Menu","args":{"arg":{"text":"`true` to set as a radio button.","name":"checked","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSubMenu","parent":"DMenuOption","type":"panelfunc","description":{"text":"Used internally by DMenuOption:AddSubMenu to create the submenu arrow and assign the created submenu to be opened when this option is hovered.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The sub DMenu this option belongs to.","name":"menu","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ToggleCheck","parent":"DMenuOption","type":"panelfunc","description":"Toggles the checked state of DMenuOption. Does not respect DMenuOption:GetIsCheckable.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetConVar","parent":"DMenuOptionCVar","type":"panelfunc","description":"Returns the console variable used by the DMenuOptionCVar.","realm":"Client","rets":{"ret":{"text":"The console variable used","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetValueOff","parent":"DMenuOptionCVar","type":"panelfunc","description":"Returns the value of the console variable when the DMenuOptionCVar is not checked.","realm":"Client","rets":{"ret":{"text":"The value","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetValueOn","parent":"DMenuOptionCVar","type":"panelfunc","description":"Return the value of the console variable when the DMenuOptionCVar is checked.","realm":"Client","rets":{"ret":{"text":"The value","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetConVar","parent":"DMenuOptionCVar","type":"panelfunc","description":"Sets the console variable to be used by DMenuOptionCVar.","realm":"Client","args":{"arg":{"text":"The console variable name to set","name":"cvar","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetValueOff","parent":"DMenuOptionCVar","type":"panelfunc","description":"Sets the value of the console variable when the DMenuOptionCVar is not checked.","realm":"Client","args":{"arg":{"text":"The value","name":"value","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetValueOn","parent":"DMenuOptionCVar","type":"panelfunc","description":"Sets the value of the console variable when the DMenuOptionCVar is checked.","realm":"Client","args":{"arg":{"text":"The value","name":"value","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"LayoutEntity","parent":"DModelPanel","type":"panelhook","description":"By default, this function slowly rotates and animates the entity being rendered.\n\nIf you want to change this behavior, you should override it.","realm":"Client","args":{"arg":{"text":"The entity that is being rendered.","name":"entity","type":"Entity"}}},"example":{"description":"Stops the rendered entity from rotating.","code":"local modelPanel = vgui.Create( \"DModelPanel\" )\nmodelPanel:SetPos( 0, 0 )\nmodelPanel:SetSize( 200, 200 )\nmodelPanel:SetModel( \"models/player/kleiner.mdl\" )\n\nfunction modelPanel:LayoutEntity( ent )\n\t-- do nothing\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"PostDrawModel","parent":"DModelPanel","type":"panelhook","description":"Called when the entity of the DModelPanel was drawn.\n\nThis is a rendering hook with 3d drawing context.","realm":"Client","args":{"arg":{"text":"The clientside entity of the DModelPanel that has been drawn.","name":"ent","type":"Entity"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"PreDrawModel","parent":"DModelPanel","type":"panelhook","description":"Called **before** the entity of the DModelPanel is drawn.","realm":"Client","args":{"arg":{"text":"The clientside entity of the DModelPanel that has been drawn.","name":"ent","type":"Entity"}},"rets":{"ret":{"text":"Return false to stop the entity from being drawn. This will also cause DModelPanel:PostDrawModel to stop being called.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"DrawModel","parent":"DModelPanel","type":"panelfunc","description":{"text":"Used by the DModelPanel's paint hook to draw the model and background.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetAmbientLight","parent":"DModelPanel","type":"panelfunc","description":"Returns the ambient lighting used on the rendered entity.","realm":"Client","rets":{"ret":{"text":"The color of the ambient lighting.","name":"","type":"Color"}}},"example":{"description":"Prints out the default ambient lighting used on models.","code":"local mdl = vgui.Create(\"DModelPanel\")\nmdl:SetPos(20, 20)\nmdl:SetSize(200, 200)\nmdl:SetModel(\"models/props_junk/watermelon01.mdl\")\n\nprint(mdl:GetAmbientLight())","output":"50 50 50 255"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetAnimated","parent":"DModelPanel","type":"panelfunc","description":"Returns whether or not the panel entity should be animated when the default DModelPanel:LayoutEntity function is called.","realm":"Client","rets":{"ret":{"text":"True if the panel entity can be animated with Entity:SetSequence directly, false otherwise.","name":"","type":"boolean"}}},"example":{"description":"Prints out the default boolean value for this function.","code":"local mdl = vgui.Create(\"DModelPanel\")\nmdl:SetPos(20, 20)\nmdl:SetSize(200, 200)\nmdl:SetModel(\"models/props_junk/watermelon01.mdl\")\n\nprint(mdl:GetAnimated())","output":"false"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetAnimSpeed","parent":"DModelPanel","type":"panelfunc","description":"Returns the animation speed of the panel entity, see DModelPanel:SetAnimSpeed.","realm":"Client","rets":{"ret":{"text":"The animation speed.","name":"","type":"number"}}},"example":{"description":"Prints out the default animation speed.","code":"local mdl = vgui.Create(\"DModelPanel\")\nmdl:SetPos(20, 20)\nmdl:SetSize(200, 200)\nmdl:SetModel(\"models/props_junk/watermelon01.mdl\")\n\nprint(mdl:GetAnimSpeed())","output":"0.5"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetCamPos","parent":"DModelPanel","type":"panelfunc","description":"Returns the position of the model viewing camera.","realm":"Client","rets":{"ret":{"text":"The position of the camera.","name":"","type":"Vector"}}},"example":{"description":"Prints out the default camera position.","code":"local mdl = vgui.Create(\"DModelPanel\")\nmdl:SetPos(20, 20)\nmdl:SetSize(200, 200)\nmdl:SetModel(\"models/props_junk/watermelon01.mdl\")\n\nprint(mdl:GetCamPos())","output":"```\n50.000000 50.000000 50.000000\n```"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetColor","parent":"DModelPanel","type":"panelfunc","description":"Returns the color of the rendered entity.","realm":"Client","rets":{"ret":{"text":"The color of the entity.","name":"","type":"Color"}}},"example":{"description":"Prints out the default entity color.","code":"local mdl = vgui.Create(\"DModelPanel\")\nmdl:SetPos(20, 20)\nmdl:SetSize(200, 200)\nmdl:SetModel(\"models/props_junk/watermelon01.mdl\")\n\nprint(mdl:GetColor())","output":"```\n255 255 255 255\n```"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetEntity","parent":"DModelPanel","type":"panelfunc","description":"Returns the entity being rendered by the model panel.","realm":"Client","rets":{"ret":{"text":"The rendered entity (client-side)","name":"","type":"CSEnt"}}},"example":{"description":"Creates an antlion model panel and sets the antlion's skin to 1.","code":"BGPanel = vgui.Create(\"DPanel\")\nBGPanel:SetPos(20, 20)\nBGPanel:SetSize(200, 200)\n\t\nlocal mdl = vgui.Create(\"DModelPanel\", BGPanel)\nmdl:SetSize(200, 200)\nmdl:SetModel(\"models/antlion.mdl\")\nmdl:SetLookAt(Vector(0, 0, 20))\n\nmdl:GetEntity():SetSkin(1)","output":{"image":{"src":"DModelPanel_GetEntity_example1.jpg"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetFOV","parent":"DModelPanel","type":"panelfunc","description":"Returns the FOV (field of view) the camera is using.","realm":"Client","rets":{"ret":{"text":"The FOV of the camera.","name":"","type":"number"}}},"example":{"description":"Prints out the default camera FOV.","code":"local mdl = vgui.Create(\"DModelPanel\")\nmdl:SetPos(20, 20)\nmdl:SetSize(200, 200)\nmdl:SetModel(\"models/props_junk/watermelon01.mdl\")\n\nprint(mdl:GetFOV())","output":"70"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetLookAng","parent":"DModelPanel","type":"panelfunc","description":"Returns the angles of the model viewing camera. Is **nil** until changed with DModelPanel:SetLookAng.","realm":"Client","rets":{"ret":{"text":"The angles of the camera.","name":"","type":"Angle"}}},"example":{"description":"Prints out the default camera angles.","code":"local mdl = vgui.Create(\"DModelPanel\")\nmdl:SetPos(20, 20)\nmdl:SetSize(200, 200)\nmdl:SetModel(\"models/props_junk/watermelon01.mdl\")\n\nprint(mdl:GetLookAng())","output":"nil"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetLookAt","parent":"DModelPanel","type":"panelfunc","description":"Returns the position the viewing camera is pointing toward.","realm":"Client","rets":{"ret":{"text":"The position the camera is pointing toward.","name":"","type":"Vector"}}},"example":{"description":"Prints out the default camera look-at position.","code":"local mdl = vgui.Create(\"DModelPanel\")\nmdl:SetPos(20, 20)\nmdl:SetSize(200, 200)\nmdl:SetModel(\"models/props_junk/watermelon01.mdl\")\n\nprint(mdl:GetLookAt())","output":"```\n0.000000 0.000000 40.000000\n```"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetModel","parent":"DModelPanel","type":"panelfunc","description":"Gets the model of the rendered entity.","realm":"Client","rets":{"ret":{"text":"The model of the rendered entity.","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"RunAnimation","parent":"DModelPanel","type":"panelfunc","description":"This function is used in DModelPanel:LayoutEntity. It will progress the animation, set using Entity:SetSequence. By default, it is the walking animation.","realm":"Client"},"example":{"description":"Sets the model to alyx and puts her in a walking animation","code":"local ModelPanel = vgui.Create( \"DModelPanel\", Panel )\nModelPanel:SetModel( \"models/player/alyx.mdl\" )\nfunction ModelPanel:LayoutEntity( ent )\n     ModelPanel:RunAnimation()\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetAmbientLight","parent":"DModelPanel","type":"panelfunc","description":"Sets the ambient lighting used on the rendered entity.","realm":"Client","args":{"arg":{"text":"The color of the ambient lighting.","name":"color","type":"Color"}}},"example":{"description":"Displays a model panel with a watermelon that has red ambient lighting.","code":"BGPanel = vgui.Create(\"DPanel\")\nBGPanel:SetPos(20, 20)\nBGPanel:SetSize(200, 200)\n\t\nlocal mdl = vgui.Create(\"DModelPanel\", BGPanel)\nmdl:SetSize(BGPanel:GetSize())\nmdl:SetModel(\"models/props_junk/watermelon01.mdl\")\n\nmdl:SetCamPos(Vector(15, 15, 0))\nmdl:SetLookAt(Vector(0, 0, 0))\n\nmdl:SetAmbientLight(Color(255, 0, 0, 255))","output":{"image":{"src":"DModelPanel_SetAmbientLight_example1.jpg"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetAnimated","parent":"DModelPanel","type":"panelfunc","description":"Sets whether or not to animate the entity when the default DModelPanel:LayoutEntity is called.","realm":"Client","args":{"arg":{"text":"True to animate, false otherwise.","name":"animated","type":"boolean"}}},"example":{"description":"A comparison between 2 model panels: the first one has `animated` set to false and the second one has it set to true. Both are using the default DModelPanel:LayoutEntity method.","code":"BGPanel = vgui.Create(\"DPanel\")\nBGPanel:SetPos(20, 20)\nBGPanel:SetSize(400, 200)\n\t\n-- Left panel\nlocal mdl1 = vgui.Create(\"DModelPanel\", BGPanel)\nmdl1:SetPos(0, 0)\nmdl1:SetSize(200, 200)\nmdl1:SetModel(\"models/player/mossman.mdl\")\nmdl1:SetCamPos(Vector(40, 40, 40))\n\nmdl1:SetAnimated(false)\n\n-- Right panel\nlocal mdl2 = vgui.Create(\"DModelPanel\", BGPanel)\nmdl2:SetPos(200, 0)\nmdl2:SetSize(200, 200)\nmdl2:SetModel(\"models/player/mossman.mdl\")\nmdl2:SetCamPos(Vector(40, 40, 40))\n\nmdl2:SetAnimated(true)\n\n-- Dance sequence\t\nlocal dance = mdl1:GetEntity():LookupSequence(\"taunt_dance\")\n\n-- Make both dance\nmdl1:GetEntity():SetSequence(dance)\nmdl2:GetEntity():SetSequence(dance)","output":{"image":{"src":"DModelPanel_SetAnimated_example1.jpg"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetAnimSpeed","parent":"DModelPanel","type":"panelfunc","description":{"text":"Sets the speed used by DModelPanel:RunAnimation to advance frame on an entity sequence.","note":"Entity:FrameAdvance doesn't seem to have any functioning arguments and therefore changing this will not have any affect on the panel entity's sequence speed without reimplementation. It only affects the value returned by DModelPanel:GetAnimSpeed"},"realm":"Client","args":{"arg":{"text":"The animation speed.","name":"animSpeed","type":"number"}}},"example":{"description":"A reimplementation of DModelPanel:LayoutEntity which will modify the entity's sequence playback rate based on the set animation speed. This example has Alyx run twice as fast as normal.","code":"local mdl = vgui.Create(\"DModelPanel\")\nmdl:SetPos(20, 20)\nmdl:SetSize(200, 200)\nmdl:SetModel(\"models/alyx.mdl\")\n\n-- Play sequence twice as fast\nmdl:SetAnimSpeed(2)\n\t\n-- Make Alyx run\nmdl:GetEntity():SetSequence(mdl:GetEntity():LookupSequence(\"run_all\"))\n\n-- Play animation\nfunction mdl:LayoutEntity(ent)\n\n\t-- Playback rate based on anim speed\n\tent:SetPlaybackRate(self:GetAnimSpeed())\n\t\n\t-- Advance frame\n\tent:FrameAdvance()\n\nend"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetCamPos","parent":"DModelPanel","type":"panelfunc","description":"Sets the position of the camera.","realm":"Client","args":{"arg":{"text":"The position to set the camera at.","name":"pos","type":"Vector"}}},"example":[{"description":"Creates a model panel focused on Gman's face while he adjusts his tie.","code":"BGPanel = vgui.Create(\"DPanel\")\nBGPanel:SetPos(20, 20)\nBGPanel:SetSize(200, 200)\nBGPanel:SetBackgroundColor(Color(0, 0, 0, 255))\n\t\nlocal mdl = vgui.Create(\"DModelPanel\", BGPanel)\nmdl:SetSize(BGPanel:GetSize())\nmdl:SetModel(\"models/player/gman_high.mdl\")\n\nfunction mdl:LayoutEntity(ent)\n\tent:SetSequence(ent:LookupSequence(\"menu_gman\"))\n\tmdl:RunAnimation()\t\t\n\treturn\nend\n\nlocal eyepos = mdl.Entity:GetBonePosition(mdl.Entity:LookupBone(\"ValveBiped.Bip01_Head1\"))\n\neyepos:Add(Vector(0, 0, 2))\t-- Move up slightly\n\nmdl:SetLookAt(eyepos)\n\nmdl:SetCamPos(eyepos-Vector(-12, 0, 0))\t-- Move cam in front of eyes\n\nmdl.Entity:SetEyeTarget(eyepos-Vector(-12, 0, 0))","output":{"image":{"src":"DModelPanel_SetCamPos_example1.jpg"}}},{"description":"Sets a model panel's camera position so the model won't go outside it","code":"local mdlpnl = vgui.Create( \"DModelPanel\" )\n\nlocal mn, mx = mdlpnl.Entity:GetRenderBounds()\nlocal size = 0\nsize = math.max( size, math.abs(mn.x) + math.abs(mx.x) )\nsize = math.max( size, math.abs(mn.y) + math.abs(mx.y) )\nsize = math.max( size, math.abs(mn.z) + math.abs(mx.z) )\n\nmdlpnl:SetFOV( 45 )\nmdlpnl:SetCamPos( Vector( size, size, size ) )\nmdlpnl:SetLookAt( (mn + mx) * 0.5 )"}],"realms":["Client"],"type":"Function"},
{"function":{"name":"SetColor","parent":"DModelPanel","type":"panelfunc","description":{"text":"Sets the color of the rendered entity.","note":"This does not work on Garry's Mod player models since they use a different color system. To modify a player model color, see Example 2 on the DModelPanel page"},"realm":"Client","args":{"arg":{"text":"The render color of the entity.","name":"color","type":"Color"}}},"example":{"description":"Creates a model panel with a red watermelon inside.","code":"local panel = vgui.Create(\"DPanel\")\npanel:SetPos(20, 20)\npanel:SetSize(200, 200)\n\t\nlocal mdl = vgui.Create(\"DModelPanel\", panel)\nmdl:SetSize(panel:GetSize())\nmdl:SetModel(\"models/props_junk/watermelon01.mdl\")\nmdl:SetLookAt(Vector(0, 0, 0))\nmdl:SetCamPos(Vector(10, 10, 10))\nmdl:SetColor(Color(255, 0, 0))","output":{"image":{"src":"DModelPanel_SetColor_example1.jpg"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetDirectionalLight","parent":"DModelPanel","type":"panelfunc","description":"Sets the directional lighting used on the rendered entity.","realm":"Client","args":{"arg":[{"text":"The light direction, see Enums/BOX.","name":"direction","type":"number"},{"text":"The Color of the directional lighting.","name":"color","type":"Color"}]}},"example":{"description":"Displays a model panel with no directional lighting. Dr. Kleiner is only lit by the ambient light set by DModelPanel:SetAmbientLight.","code":"-- Black background panel\nBGPanel = vgui.Create(\"DPanel\")\nBGPanel:SetPos(20, 20)\nBGPanel:SetSize(400, 400)\nBGPanel:SetBackgroundColor(Color(0, 0, 0, 255))\n\nlocal mdl = vgui.Create(\"DModelPanel\", BGPanel)\nmdl:SetSize(BGPanel:GetSize())\n\t\n-- Setup model and camera\nmdl:SetModel(\"models/kleiner.mdl\")\nmdl:SetCamPos(Vector(20, 20, 60))\nmdl:SetLookAt(Vector(0, 0, 60))\n\n-- Make Kleiner pace\nmdl:GetEntity():SetSequence(mdl:GetEntity():LookupSequence(\"pace_all\"))\n\n-- Disable directional lighting\nmdl:SetDirectionalLight(BOX_TOP, Color(0, 0, 0))\nmdl:SetDirectionalLight(BOX_FRONT, Color(0, 0, 0))\n\n-- Spin around faster and play animation\nfunction mdl:LayoutEntity(ent)\n\tent:SetAngles(Angle( 0, self.LastPaint*60,  0))\n\tself:RunAnimation()\nend","output":{"image":{"src":"DModelPanel_SetDirectionalLight_example1.jpg"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetEntity","parent":"DModelPanel","type":"panelfunc","description":{"text":"Sets the entity to be rendered by the model panel.","note":"If you set `ent` to a shared entity you must set `ent` to nil before removing this panel or else a \"Trying to remove server entity on client!\" error is thrown"},"realm":"Client","args":{"arg":{"text":"The new panel entity.","name":"ent","type":"Entity"}}},"example":{"description":"Implementation of a function called **StartBreencast** which makes Dr. Breen recite his instinct speech within a model panel that's displayed to all clients. This mainly demonstrates how even shared entities such as NPCs can be used with DModelPanel as long as they're networked properly.","code":"g_Breen = nil\t-- Breen NPC\n\nif(SERVER) then\n\t-- Broadcast propaganda to clients\n\tutil.AddNetworkString(\"BreencastSentence\")\nend\n\n-- Broadcast Breen to clients each time he starts a new sentence.\nfunction GM:EntityEmitSound(data)\n\n\tif(data.Entity == g_Breen) then\n\t\n\t\tlocal st, en = string.find(data.SoundName, \"vo/\")\n\t\tlocal sentence = \"sound/\"..string.sub(data.SoundName, st)\t-- Properly format sound name\n\t\n\t\tnet.Start(\"BreencastSentence\")\n\t\t\tnet.WriteEntity(data.Entity)\n\t\t\tnet.WriteString(sentence)\n\t\tnet.Broadcast()\n\t\t\n\tend\n\t\n\treturn nil\n\t\nend\n\nif(CLIENT) then\n\n\t-- Receive latest breencast sound byte and update screen\n\tfunction BreencastSentence()\n\t\n\t\t-- Client-side reference to Breen NPC\n\t\tg_Breen = net.ReadEntity()\n\t\t\n\t\tlocal soundname = net.ReadString()\n\t\t\n\t\t-- Play sound byte\n\t\tsound.PlayFile(soundname, \"\", function(sentence, errnum, err)\n\t\t\n\t\t\tif(err) then\n\t\t\t\tError(err)\n\t\t\telse\n\t\t\t\tsentence:Play()\n\t\t\t\tStartBreencast()\t-- Update breencast monitor\n\t\t\tend\n\t\t\n\t\tend)\n\t\n\tend\n\t\n\tnet.Receive(\"BreencastSentence\", BreencastSentence)\n\t\nend\n\n-- Call this server-side to begin Breencast\nfunction StartBreencast()\n\n\tif(SERVER) then\n\n\t\t-- Remove existing Breen NPC\n\t\tif(g_Breen && IsValid(g_Breen)) then\n\t\t\tg_Breen:Remove()\n\t\tend\n\n\t\t-- Create new Breen NPC\n\t\tg_Breen = ents.Create(\"npc_breen\")\n\t\tg_Breen:Spawn()\n\t\t\n\t\t-- Hide NPC everywhere except inside model panel\n\t\tg_Breen:SetSaveValue(\"m_takedamage\", 0)\n\t\tg_Breen:SetMoveType(MOVETYPE_NONE)\n\t\tg_Breen:SetSolid(SOLID_NONE)\n\t\tg_Breen:SetRenderMode(RENDERMODE_TRANSALPHA)\n\t\tg_Breen:SetColor(Color(255, 255, 255, 0))\n\t\t\n\t\t-- Play propaganda\t\t\n\t\tg_Breen:PlayScene(\"scenes/breencast/instinct_tv.vcd\")\n\t\tg_Breen:SetEyeTarget(Vector(100, 0, 60))\n\n\telseif(CLIENT) then\n\n\t\t-- Remove existing panel and clear model entity to prevent error\n\t\tif(BGPanel) then\n\t\t\tif(BGPanel:GetChild(0)) then BGPanel:GetChild(0):SetEntity(nil) end\n\t\t\tBGPanel:Remove()\n\t\t\tBGPanel = nil\t\t\t\n\t\tend\n\t\t\n\t\t-- Don't continue if Breen is undefined\n\t\tif(!g_Breen or !IsValid(g_Breen)) then return end\n\t\t\n\t\t-- Black background panel\n\t\tBGPanel = vgui.Create(\"DPanel\")\n\t\tBGPanel:SetPos(20, 20)\n\t\tBGPanel:SetSize(200, 200)\n\t\tBGPanel:SetBackgroundColor(Color(0, 0, 0, 255))\n\t\t\n\t\t-- Model panel\n\t\tlocal mdl = vgui.Create(\"DModelPanel\", BGPanel)\n\t\tmdl:SetSize(BGPanel:GetSize())\n\t\tmdl:SetFOV(40)\t-- Default FOV is too jarring\n\t\t\n\t\tmdl:SetEntity(g_Breen)\t-- Add Breen NPC to model panel\n\t\t\n\t\t-- Focus camera on Breen's head\n\t\tfunction mdl:LayoutEntity(ent)\n\t\t\n\t\t\t-- If Breen has been removed somehow then remove screen\n\t\t\tif(!IsValid(ent)) then\n\t\t\t\tif(mdl:GetParent()) then mdl:GetParent():Remove() end\n\t\t\t\treturn\n\t\t\tend\n\t\t\n\t\t\tlocal eyepos = ent:GetBonePosition(ent:LookupBone(\"ValveBiped.Bip01_Head1\"))\n\t\t\n\t\t\tmdl:SetLookAt(eyepos)\n\t\t\tmdl:SetCamPos(eyepos+Vector(35, 0, -4))\n\t\t\t\n\t\t\treturn\n\t\t\t\n\t\tend\n\t\t\n\tend\n\t\nend","output":{"text":"\"I find it helpful at times like these to remind myself that our true enemy is: Instinct.\"","image":{"src":"Breencast_example.jpg"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetFOV","parent":"DModelPanel","type":"panelfunc","description":"Sets the panel camera's FOV (field of view).","realm":"Client","args":{"arg":{"text":"The field of view value.","name":"fov","type":"number"}}},"example":{"description":"The best FOV demo you've ever seen.","code":"BGPanel = vgui.Create(\"DPanel\")\nBGPanel:SetPos(20, 20)\nBGPanel:SetSize(200, 200)\n\t\nlocal mdl = vgui.Create(\"DModelPanel\", BGPanel)\nmdl:Dock(FILL)\nmdl:SetModel(\"models/player/barney.mdl\")\n\nlocal fov = 10\t-- starting value\nlocal offset = 0.1\t-- amount to increment by\n\nfunction mdl:LayoutEntity(ent)\n\t\n\tmdl:SetFOV(fov)\t-- update FOV\n\t\n\tfov = fov + offset\t-- increment\n\t\n\tif(fov >= 120 or fov <= 10) then\n\t\toffset = offset*-1\t-- inverse increment amount\n\tend\n\t\n\tent:SetSequence(ent:LookupSequence(\"taunt_muscle\"))\t-- FLEX\n\tif(ent:GetCycle() >= 0.95) then ent:SetCycle(0.05) end\t-- YOUR\n\tmdl:RunAnimation()\t-- MUSCLES\n\t\nend","output":{"image":{"src":"DModelPanel_SetFOV_example1.jpg"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetLookAng","parent":"DModelPanel","type":"panelfunc","description":"Sets the angles of the camera.","realm":"Client","args":{"arg":{"text":"The angles to set the camera to.","name":"ang","type":"Angle"}}},"example":{"description":"Creates a model panel with Eli rotating normally and the camera angles rotating sideways.","code":"BGPanel = vgui.Create(\"DPanel\")\nBGPanel:SetPos(20, 20)\nBGPanel:SetSize(400, 400)\nBGPanel:SetBackgroundColor(Color(0, 0, 0, 255))\n\nlocal mdl = vgui.Create(\"DModelPanel\", BGPanel)\nmdl:SetSize(BGPanel:GetSize())\nmdl:SetModel(\"models/eli.mdl\")\n\n-- Position camera\nmdl:SetCamPos(Vector(0, 60, 36))\n\nlocal yaw = 0\n\nfunction mdl:LayoutEntity(ent)\n\n\t-- Point camera toward the look pos\n\tlocal lookAng = (self.vLookatPos-self.vCamPos):Angle()\n\t\n\t-- Rotate the look angles based on incrementing yaw value\n\tlookAng:RotateAroundAxis(Vector(0, 1, 0), yaw)\n\t\n\t-- Set camera look angles\n\tself:SetLookAng(lookAng)\n\t\n\t-- Make entity rotate like normal\n\tent:SetAngles(Angle(0, RealTime()*30,  0))\n\t\n\tyaw = yaw + 1\n\nend","output":{"image":{"src":"DModelPanel_SetLookAng_example1.gif"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetLookAt","parent":"DModelPanel","type":"panelfunc","description":"Makes the panel's camera face the given position. Basically sets the camera's angles (DModelPanel:SetLookAng) after doing some math.","realm":"Client","args":{"arg":{"text":"The position to orient the camera toward.","name":"pos","type":"Vector"}}},"example":{"description":"Creates a model panel focused on Colonel Odessa Cubbage's face.","code":"BGPanel = vgui.Create(\"DPanel\")\nBGPanel:SetPos(20, 20)\nBGPanel:SetSize(200, 200)\t\t\n\t\nlocal mdl = vgui.Create(\"DModelPanel\", BGPanel)\nmdl:SetSize(BGPanel:GetSize())\nmdl:SetModel(\"models/player/odessa.mdl\")\n\nfunction mdl:LayoutEntity( Entity ) return end\t-- Disable cam rotation\n\nlocal headpos = mdl.Entity:GetBonePosition(mdl.Entity:LookupBone(\"ValveBiped.Bip01_Head1\"))\nmdl:SetLookAt(headpos)\n\nmdl:SetCamPos(headpos-Vector(-15, 0, 0))\t-- Move cam in front of face\n\n--mdl.Entity:SetEyeTarget(headpos-Vector(-15, 0, 0))\n-- Makes Odessa look at the camera\n-- Commented out because the result is funnier without this","output":{"image":{"src":"DModelPanel_SetLookAt_example1.jpg"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetModel","parent":"DModelPanel","type":"panelfunc","description":{"text":"Sets the model of the rendered entity.","note":"This function may give a different model than expected. This is not a bug, however this problem may appear with some player models which are renamed several times in a wrong way. To solve that, you can use Entity:SetModel and Entity:SetModelName on the internal panel entity. More information : https://github.com/Facepunch/garrysmod-issues/issues/4534."},"realm":"Client","args":{"arg":{"text":"The model to apply to the entity.","name":"model","type":"string"}}},"example":{"description":"Creates a new DModelPanel with the Kleiner playermodel.","code":"local modelPanel = vgui.Create( \"DModelPanel\" )\nmodelPanel:SetPos( 0, 0 )\nmodelPanel:SetSize( 200, 200 )\nmodelPanel:SetModel( \"models/player/kleiner.mdl\" )","output":{"upload":{"src":"22674/8d8e01367a4ebd3.png","size":"88682","name":"image.png"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"StartScene","parent":"DModelPanel","type":"panelfunc","description":"Runs a Global.ClientsideScene on the panel's entity.","realm":"Client","args":{"arg":{"text":"The path to the scene file. (.vcd)","name":"path","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetHeight","parent":"DModelSelect","type":"panelfunc","description":"Sets the height of the panel **in the amount of 64px spawnicons**.\n\nOverrides Panel:SetHeight.","realm":"Client","args":{"arg":{"text":"Basically how many rows of 64x64 px spawnicons should fit in this DModelSelect","name":"num","type":"number","default":"2"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetModelList","parent":"DModelSelect","type":"panelfunc","description":"Called to set the list of models within the panel element.","realm":"Client","args":{"arg":[{"text":"Each key is a model path, the value is a kay-value table where they key is a convar name and value is the value to set to that convar.","name":"models","type":"table"},{"text":"ConVar to set when a model from this list is selected.","name":"convar","type":"string"},{"text":"Do not sort the list. (by the `Model` member)","name":"dontSort","type":"boolean"},{"text":"If set, only the `convar` from the 2nd argument will be set, not individual convars from the models list.","name":"dontCallListConVars","type":"boolean"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddModelList","parent":"DModelSelectMulti","type":"panelfunc","description":"Adds a new tab of models.","realm":"Client and Menu","args":{"arg":[{"text":"Name of the tab to add.","name":"name","type":"string"},{"text":"Models list for this tab. See DModelSelect:SetModelList.","name":"models","type":"table"},{"text":"ConVar to set when a model from this list is selected.","name":"convar","type":"string"},{"text":"Do not sort the list. (by the `Model` member)","name":"dontSort","type":"boolean"},{"text":"If set, only the `convar` from the 2nd argument will be set, not individual convars from the models list.","name":"dontCallListConVars","type":"boolean"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddItem","parent":"DNotify","type":"panelfunc","description":"Adds a panel to the notification","realm":"Client","args":{"arg":[{"text":"The panel to add","name":"pnl","type":"Panel"},{"text":"If set, overrides DNotify:SetLife for when the given panel should be removed.","name":"lifeLength","type":"number","default":"nil"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetAlignment","parent":"DNotify","type":"panelfunc","description":"Returns the current alignment of this notification panel. Set by DNotify:SetAlignment.","realm":"Client","rets":{"ret":{"text":"The numpad alignment","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetItems","parent":"DNotify","type":"panelfunc","description":"Returns all the items added with DNotify:AddItem.","realm":"Client","rets":{"ret":{"text":"A table of Panels.","name":"","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetLife","parent":"DNotify","type":"panelfunc","description":"Returns the display time in seconds of the DNotify. This is set with \nDNotify:SetLife.","realm":"Client","rets":{"ret":{"text":"The display time in seconds.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetSpacing","parent":"DNotify","type":"panelfunc","description":"Returns the spacing between items set by DNotify:SetSpacing.","realm":"Client","rets":{"ret":{"name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetAlignment","parent":"DNotify","type":"panelfunc","description":"Sets the alignment of the child panels in the notification","realm":"Client","args":{"arg":{"text":"It's the Numpad alignment, 6 is right, 9 is top left, etc.","name":"alignment","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetLife","parent":"DNotify","type":"panelfunc","description":"Sets the display time in seconds for the DNotify.","realm":"Client","args":{"arg":{"text":"The time in seconds.","name":"time","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetSpacing","parent":"DNotify","type":"panelfunc","description":"Sets the spacing between child elements of the notification panel.","realm":"Client","args":{"arg":{"name":"spacing","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Shuffle","parent":"DNotify","type":"panelfunc","description":{"text":"Used internally to position and fade in/out its DNotify:GetItems.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnValueChanged","parent":"DNumberScratch","type":"panelhook","description":"Called when the value of the DNumberScratch is changed.","realm":"Client and Menu","args":{"arg":{"text":"The new value","name":"newValue","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DrawNotches","parent":"DNumberScratch","type":"panelfunc","description":{"text":"Used by DNumberScratch:DrawScreen.","internal":""},"realm":"Client and Menu","args":{"arg":[{"name":"level","type":"number"},{"name":"x","type":"number"},{"name":"y","type":"number"},{"name":"w","type":"number"},{"name":"h","type":"number"},{"name":"range","type":"number"},{"name":"value","type":"number"},{"name":"min","type":"number"},{"name":"max","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DrawScreen","parent":"DNumberScratch","type":"panelfunc","description":{"text":"Used by DNumberScratch:PaintScratchWindow.","internal":""},"realm":"Client and Menu","args":{"arg":[{"name":"x","type":"number"},{"name":"y","type":"number"},{"name":"w","type":"number"},{"name":"h","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetActive","parent":"DNumberScratch","type":"panelfunc","description":"Returns whether this panel is active or not, i.e. if the player is currently changing its value.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDecimals","parent":"DNumberScratch","type":"panelfunc","description":"Returns the desired amount of numbers after the decimal point.","realm":"Client and Menu","rets":{"ret":{"text":"0 for whole numbers only, 1 for one number after the decimal point, etc.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetFloatValue","parent":"DNumberScratch","type":"panelfunc","description":"Returns the real value of the DNumberScratch as a number.\n\nSee also DNumberScratch:GetTextValue and DNumberScratch:GetFraction.","realm":"Client and Menu","rets":{"ret":{"text":"The real value of the DNumberScratch","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetFraction","parent":"DNumberScratch","type":"panelfunc","description":"Returns the value of the DNumberScratch as a fraction, a value between 0 and 1 where 0 is the minimum and 1 is the maximum value of the DNumberScratch.\n\nSee also:\n* DNumberScratch:GetTextValue\n* DNumberScratch:GetFloatValue\n* DNumberScratch:SetFraction","realm":"Client and Menu","rets":{"ret":{"text":"A value between 0 and 1","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetMax","parent":"DNumberScratch","type":"panelfunc","description":"Returns the maximum value that can be selected on the number scratch","realm":"Client and Menu","rets":{"ret":{"text":"The maximum value that can be selected on the number scratch","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetMin","parent":"DNumberScratch","type":"panelfunc","description":"Returns the minimum value that can be selected on the number scratch","realm":"Client and Menu","rets":{"ret":{"text":"The minimum value that can be selected on the number scratch","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetRange","parent":"DNumberScratch","type":"panelfunc","description":"Returns the range of the DNumberScratch. Basically max value - min value.","realm":"Client and Menu","rets":{"ret":{"text":"The range of the DNumberScratch","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetShouldDrawScreen","parent":"DNumberScratch","type":"panelfunc","description":"Returns whether the scratch window should be visible or not.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTextValue","parent":"DNumberScratch","type":"panelfunc","description":"Returns the real value of the DNumberScratch as a string.\n\nSee also DNumberScratch:GetFloatValue and DNumberScratch:GetFraction.","realm":"Client and Menu","rets":{"ret":{"text":"The real value of the DNumberScratch","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetZoom","parent":"DNumberScratch","type":"panelfunc","description":"Returns the zoom level of the scratch window","realm":"Client and Menu","rets":{"ret":{"name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IdealZoom","parent":"DNumberScratch","type":"panelfunc","description":"Returns the ideal zoom level for the panel based on the DNumberScratch:GetRange.","realm":"Client and Menu","rets":{"ret":{"text":"The ideal zoom level for the panel based on the panels range.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsEditing","parent":"DNumberScratch","type":"panelfunc","description":"Returns whether the player is currently editing the value of the DNumberScratch.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"LockCursor","parent":"DNumberScratch","type":"panelfunc","description":{"text":"Used to lock the cursor in place.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PaintScratchWindow","parent":"DNumberScratch","type":"panelfunc","description":{"text":"Used to paint the 'scratch' window.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetActive","parent":"DNumberScratch","type":"panelfunc","description":{"text":"Sets whether or not the panel is 'active'.\n\nForcing this panel to be active may not work.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"true to activate, false to deactivate.","name":"active","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDecimals","parent":"DNumberScratch","type":"panelfunc","description":"Sets the desired amount of numbers after the decimal point.","realm":"Client and Menu","args":{"arg":{"text":"0 for whole numbers only, 1 for one number after the decimal point, etc.","name":"decimals","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetFloatValue","parent":"DNumberScratch","type":"panelfunc","description":{"text":"Does not trigger DNumberScratch:OnValueChanged\n\nUse DNumberScratch:SetValue instead.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The value to set","name":"val","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetFraction","parent":"DNumberScratch","type":"panelfunc","description":"Sets the value of the DNumberScratch as a fraction, a value between 0 and 1 where 0 is the minimum and 1 is the maximum value of the DNumberScratch","realm":"Client and Menu","args":{"arg":{"text":"A value between 0 and 1","name":"frac","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMax","parent":"DNumberScratch","type":"panelfunc","description":"Sets the max value that can be selected on the number scratch","realm":"Client and Menu","args":{"arg":{"text":"The maximum number","name":"max","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMin","parent":"DNumberScratch","type":"panelfunc","description":"Sets the minimum value that can be selected on the number scratch.","realm":"Client and Menu","args":{"arg":{"text":"The minimum number","name":"min","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetShouldDrawScreen","parent":"DNumberScratch","type":"panelfunc","description":{"text":"Sets if the scratch window should be drawn or not. Cannot be used to force it to draw, only to hide it, which will not stop the panel from working with invisible window.","internal":""},"realm":"Client and Menu","args":{"arg":{"name":"shouldDraw","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetValue","parent":"DNumberScratch","type":"panelfunc","description":"Sets the value of the DNumberScratch and triggers DNumberScratch:OnValueChanged","realm":"Client and Menu","args":{"arg":{"text":"The value to set.","name":"val","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetZoom","parent":"DNumberScratch","type":"panelfunc","description":"Sets the zoom level of the scratch panel.","realm":"Client and Menu","args":{"arg":{"name":"zoom","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateConVar","parent":"DNumberScratch","type":"panelfunc","description":{"text":"Forces the assigned ConVar to be updated to the value of this DNumberScratch","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnValueChanged","parent":"DNumberWang","type":"panelhook","description":"Called when the number selector value is changed.","realm":"Client and Menu","args":{"arg":{"text":"The new value of the number selector.","name":"val","type":"number"}}},"example":{"description":"Creates a panel with two number selectors that play a male question sound byte and a female answer sound byte based on the new value of each number selector.","code":"-- Background panel\nBGPanel = vgui.Create(\"DPanel\")\nBGPanel:SetPos(20, 20)\nBGPanel:SetSize(100, 55)\n\n-- Statement label\nlocal lbl1 = vgui.Create(\"DLabel\", BGPanel)\nlbl1:SetPos(5, 5)\nlbl1:SetSize(100, 20)\nlbl1:SetText(\"Statement: \")\nlbl1:SetColor(Color(64, 64, 255))\n\n-- Response label\nlocal lbl2 = vgui.Create(\"DLabel\", BGPanel)\nlbl2:SetPos(5, 30)\nlbl2:SetSize(100, 20)\nlbl2:SetText(\"Response: \")\nlbl2:SetColor(Color(255, 0, 255))\n\n-- Number selector for \"questions\"\nlocal question = vgui.Create(\"DNumberWang\", BGPanel)\nquestion:SetPos(65, 5)\nquestion:SetSize(30, 20)\nquestion:SetMinMax(1, 30)\n\n-- Number selector for answers\nlocal answer = vgui.Create(\"DNumberWang\", BGPanel)\nanswer:SetPos(65, 30)\nanswer:SetSize(30, 20)\nanswer:SetMinMax(1, 40)\n\n-- This is used to prevent overlapping talking\nlocal null = Sound(\"common/null.wav\")\n\n-- Abstraction = cleaner code\nfunction TalkSound(snd)\n\tEmitSound(snd, LocalPlayer():GetPos(), LocalPlayer():EntIndex(), CHAN_VOICE, 1, 80, 0, 100)\nend\n\n-- Play a statement based on new number\nfunction question:OnValueChanged(val)\n\tTalkSound(null)\n\tTalkSound(Sound(\"vo/npc/male01/question\"..string.format(\"%02d\", val)..\".wav\"))\nend\n\n-- Play an answer based on new number\nfunction answer:OnValueChanged(val)\n\tTalkSound(null)\n\tTalkSound(Sound(\"vo/npc/female01/answer\"..string.format(\"%02d\", val)..\".wav\"))\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDecimals","parent":"DNumberWang","type":"panelfunc","description":"Returns the amount of decimal places allowed in the number selector, set by DNumberWang:SetDecimals","realm":"Client and Menu","rets":{"ret":{"text":"The amount of decimal places allowed in the number selector.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetFloatValue","parent":"DNumberWang","type":"panelfunc","description":{"text":"Returns whatever is set by DNumberWang:SetFloatValue or 0.","deprecated":""},"realm":"Client and Menu","rets":{"ret":{"name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetFraction","parent":"DNumberWang","type":"panelfunc","description":"Returns a fraction representing the current number selector value to number selector min/max range ratio. If argument `val` is supplied, that number will be computed instead.","realm":"Client and Menu","args":{"arg":{"text":"The fraction numerator.","name":"val","type":"number"}}},"example":{"description":"Prints out some fractions based on a number selector with a min/max range of 0 to 255.","code":"local numinput = vgui.Create(\"DNumberWang\")\nnuminput:SetPos(5, 5)\nnuminput:SetSize(90, 20)\n\nnuminput:SetMinMax(0, 255)\n\nnuminput:SetValue(64)\n\nprint(numinput:GetFraction())\t-- Should return ~0.25\nprint(numinput:GetFraction(128))\t-- Should return ~0.5\nprint(numinput:GetFraction(192))\t-- Should return ~0.75\nprint(numinput:GetFraction(255))\t-- Should return 1","output":"```\n0.25098039215686\n0.50196078431373\n0.75294117647059\n1\n```"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetInterval","parent":"DNumberWang","type":"panelfunc","description":"Returns interval at which the up and down buttons change the current value.","realm":"Client and Menu","rets":{"ret":{"text":"The current interval.","name":"min","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetMax","parent":"DNumberWang","type":"panelfunc","description":"Returns the maximum numeric value allowed by the number selector.","realm":"Client and Menu","rets":{"ret":{"text":"The maximum value.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetMin","parent":"DNumberWang","type":"panelfunc","description":"Returns the minimum numeric value allowed by the number selector.","realm":"Client and Menu","rets":{"ret":{"text":"The minimum number.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTextArea","parent":"DNumberWang","type":"panelfunc","description":{"text":"This function returns the panel it is used on.","deprecated":""},"realm":"Client and Menu","rets":{"ret":{"text":"self","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetValue","parent":"DNumberWang","type":"panelfunc","description":"Returns the numeric value inside the number selector.","realm":"Client and Menu","rets":{"ret":{"text":"The numeric value.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"HideWang","parent":"DNumberWang","type":"panelfunc","description":"Hides the number selector arrows.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDecimals","parent":"DNumberWang","type":"panelfunc","description":"Sets the amount of decimal places allowed in the number selector.","realm":"Client and Menu","args":{"arg":{"text":"The amount of decimal places.","name":"num","type":"number"}}},"example":{"description":"Sets the number selector to 3 decimal places and sets the value to a random number between 0 and 1.","code":"local numinput = vgui.Create(\"DNumberWang\")\nnuminput:SetPos(5, 5)\nnuminput:SetSize(90, 20)\nnuminput:SetDecimals(3)\n\nnuminput:SetValue(math.random())","output":{"image":{"src":"DNumberWang_SetDecimals_example1.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetFloatValue","parent":"DNumberWang","type":"panelfunc","description":{"text":"Appears to do nothing.","deprecated":""},"realm":"Client and Menu","args":{"arg":{"name":"val","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetFraction","parent":"DNumberWang","type":"panelfunc","description":"Sets the value of the number selector based on the given fraction number.","realm":"Client and Menu","args":{"arg":{"text":"The fraction of the number selector's range.","name":"val","type":"number"}}},"example":{"description":"Sets and prints out the value of a quarter, half, and three-fourths of the number selector range.","code":"local numinput = vgui.Create(\"DNumberWang\")\nnuminput:SetPos(5, 5)\nnuminput:SetSize(90, 20)\n\nnuminput:SetMinMax(0, 500)\n\nnuminput:SetFraction(0.25)\nprint(numinput:GetValue())\n\nnuminput:SetFraction(0.5)\nprint(numinput:GetValue())\n\nnuminput:SetFraction(0.75)\nprint(numinput:GetValue())","output":"```\n125\n250\n375\n```"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetInterval","parent":"DNumberWang","type":"panelfunc","description":"Sets interval at which the up and down buttons change the current value.","realm":"Client and Menu","args":{"arg":{"text":"The new interval.","name":"min","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMax","parent":"DNumberWang","type":"panelfunc","description":"Sets the maximum numeric value allowed by the number selector.","realm":"Client and Menu","args":{"arg":{"text":"The maximum value.","name":"max","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMin","parent":"DNumberWang","type":"panelfunc","description":"Sets the minimum numeric value allowed by the number selector.","realm":"Client and Menu","args":{"arg":{"text":"The minimum value.","name":"min","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMinMax","parent":"DNumberWang","type":"panelfunc","description":"Sets the minimum and maximum value allowed by the number selector.","realm":"Client and Menu","args":{"arg":[{"text":"The minimum value.","name":"min","type":"number"},{"text":"The maximum value.","name":"max","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetValue","parent":"DNumberWang","type":"panelfunc","description":"Sets the value of the DNumberWang and triggers DNumberWang:OnValueChanged","realm":"Client and Menu","args":{"arg":{"text":"The value to set.","name":"val","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnValueChanged","parent":"DNumSlider","type":"panelhook","description":"Called when the value of the slider is changed, through code or changing the slider.","realm":"Client and Menu","file":{"text":"lua/vgui/dnumslider.lua","line":"193-L197"},"args":{"arg":{"text":"The new value of the DNumSlider.","name":"value","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDecimals","parent":"DNumSlider","type":"panelfunc","description":"Returns the amount of numbers after the decimal point.","realm":"Client and Menu","rets":{"ret":{"text":"0 for whole numbers only, 1 for one number after the decimal point, etc.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDefaultValue","parent":"DNumSlider","type":"panelfunc","description":"Returns the default value of the slider, if one was set by DNumSlider:SetDefaultValue","realm":"Client and Menu","rets":{"ret":{"text":"The default value of the slider","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetMax","parent":"DNumSlider","type":"panelfunc","description":"Returns the maximum value of the slider","realm":"Client and Menu","rets":{"ret":{"text":"The maximum value of the slider","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetMin","parent":"DNumSlider","type":"panelfunc","description":"Returns the minimum value of the slider","realm":"Client and Menu","rets":{"ret":{"text":"The minimum value of the slider","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetRange","parent":"DNumSlider","type":"panelfunc","description":"Returns the range of the slider, basically maximum value - minimum value.","realm":"Client and Menu","rets":{"ret":{"text":"The range of the slider","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTextArea","parent":"DNumSlider","type":"panelfunc","description":"Returns the DTextEntry component of the slider.","realm":"Client and Menu","rets":{"ret":{"text":"The DTextEntry.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetValue","parent":"DNumSlider","type":"panelfunc","description":"Returns the value of the DNumSlider","realm":"Client and Menu","rets":{"ret":{"text":"The value of the slider.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsEditing","parent":"DNumSlider","type":"panelfunc","description":"Returns true if either the DTextEntry, the DSlider or the DNumberScratch are being edited.","realm":"Client and Menu","rets":{"ret":{"text":"Whether or not the DNumSlider is being edited by the player.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ResetToDefaultValue","parent":"DNumSlider","type":"panelfunc","description":"Resets the slider to the default value, if one was set by DNumSlider:SetDefaultValue.\n\nThis function is called by the DNumSlider when user middle mouse clicks on the draggable knob of the slider.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetConVar","parent":"DNumSlider","type":"panelfunc","description":"Sets the console variable to be updated when the value of the slider is changed.","realm":"Client and Menu","args":{"arg":{"text":"The name of the ConVar to be updated.","name":"cvar","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDark","parent":"DNumSlider","type":"panelfunc","description":"Calls DLabel:SetDark on the DLabel part of the DNumSlider.","realm":"Client and Menu","args":{"arg":{"name":"dark","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDecimals","parent":"DNumSlider","type":"panelfunc","description":{"text":"Sets the desired amount of numbers after the decimal point.","note":["This doesn't affect values passed to DNumSlider:OnValueChanged.","To get right values passed to DNumSlider:OnValueChanged use math.Round."]},"realm":"Client and Menu","args":{"arg":{"text":"0 for whole numbers only, 1 for one number after the decimal point, etc.","name":"decimals","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDefaultValue","parent":"DNumSlider","type":"panelfunc","description":"Sets the default value of the slider, to be used by DNumSlider:ResetToDefaultValue or by middle mouse clicking the draggable knob of the slider.","realm":"Client and Menu","args":{"arg":{"text":"The new default value of the slider to set","name":"default","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMax","parent":"DNumSlider","type":"panelfunc","description":"Sets the maximum value for the slider.","realm":"Client and Menu","args":{"arg":{"text":"The value to set as maximum for the slider.","name":"max","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMin","parent":"DNumSlider","type":"panelfunc","description":"Sets the minimum value for the slider","realm":"Client and Menu","args":{"arg":{"text":"The value to set as minimum for the slider.","name":"min","type":"number"}}},"example":{"description":"An example usage of the function","code":"--This creates the frame.\nlocal Frame = vgui.Create( \"DFrame\" )\nFrame :Center() -- or Frame:SetPos( x, y )\nFrame:SetSize( 300, 150 )\nFrame:SetTitle( \"Test\" )\nFrame:SetVisible( true )\nFrame:SetDraggable( true )\nFrame:ShowCloseButton( true )\nFrame:MakePopup()\n--Here we create the slider.\nlocal DermaSlider = vgui.Create( \"DNumSlider\", Frame )\nDermaSlider:SetPos( 25, 85 )\nDermaSlider:SetWide( 275 )\nDermaSlider:SetMin( 0 ) -- Or 3 for second image\nDermaSlider:SetMax( 5 )\nDermaSlider:SetValue( 0.5 )\nDermaSlider:SetDecimals( 2 )","output":{"image":[{"src":"DermaSlider_Test.jpeg"},{"src":"DermaSlider_min_3.jpeg"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetMinMax","parent":"DNumSlider","type":"panelfunc","description":"Sets the minimum and the maximum value of the slider.","realm":"Client and Menu","args":{"arg":[{"text":"The minimum value of the slider.","name":"min","type":"number"},{"text":"The maximum value of the slider.","name":"max","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetValue","parent":"DNumSlider","type":"panelfunc","description":"Sets the value of the DNumSlider.","realm":"Client and Menu","args":{"arg":{"text":"The value to set.","name":"val","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"TranslateSliderValues","parent":"DNumSlider","type":"panelfunc","description":{"internal":""},"realm":"Client and Menu","args":{"arg":[{"name":"x","type":"number"},{"name":"y","type":"number"}]},"rets":{"ret":[{"name":"","type":"number"},{"text":"The second passed argument.","name":"","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateNotches","parent":"DNumSlider","type":"panelfunc","description":{"text":"Updates visual notches on the slider.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ValueChanged","parent":"DNumSlider","type":"panelfunc","description":{"text":"Called when the value has been changed. This will also be called when the user manually changes the value through the text panel.\n\nThis is an internal function. Override DNumSlider:OnValueChanged instead.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The value the slider has been changed to.","name":"value","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetBackgroundColor","parent":"DPanel","type":"panelfunc","description":{"text":"Returns the panel's background color.","note":"By default this returns **nil** even though the default background color is white"},"realm":"Client and Menu","rets":{"ret":{"text":"Color of the panel's background.","name":"","type":"Color"}}},"example":{"description":"Prints out the default panel background color.","code":"BGPanel = vgui.Create(\"DPanel\")\nBGPanel:SetPos(20, 20)\nBGPanel:SetSize(200, 200)\n\nprint(BGPanel:GetBackgroundColor())","output":"nil"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDisabled","parent":"DPanel","type":"panelfunc","description":{"text":"Returns whether or not the panel is disabled.","deprecated":"Use Panel:IsEnabled."},"realm":"Client and Menu","rets":{"ret":{"text":"`true` if the panel is disabled (mouse input disabled and background alpha set to 75), `false` if its enabled (mouse input enabled and background alpha set to 255).","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDrawBackground","parent":"DPanel","type":"panelfunc","description":{"text":"Returns whether or not the panel background is being drawn. Alias of DPanel:GetPaintBackground.","deprecated":"You should use DPanel:GetPaintBackground instead."},"realm":"Client and Menu","rets":{"ret":{"text":"True if the panel background is drawn, false otherwise.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetIsMenu","parent":"DPanel","type":"panelfunc","description":"Used internally by DMenu.\n\nReturns whether the frame is part of a derma menu or not.\n\nIf this is `true`, Global.CloseDermaMenus will not be called when the frame is clicked, and thus any open menus will remain open.","realm":"Client and Menu","rets":{"ret":{"text":"Whether this panel is a Menu Component","name":"isMenu","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetPaintBackground","parent":"DPanel","type":"panelfunc","description":"Returns whether or not the panel background is being drawn.","realm":"Client and Menu","rets":{"ret":{"text":"True if the panel background is drawn, false otherwise.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTabbingDisabled","parent":"DPanel","type":"panelfunc","description":{"text":"Does nothing. Returns value set by DPanel:SetTabbingDisabled.","deprecated":""},"realm":"Client and Menu","rets":{"ret":{"name":"draw","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetBackgroundColor","parent":"DPanel","type":"panelfunc","description":"Sets the background color of the panel.","realm":"Client and Menu","args":{"arg":{"text":"The background Color.","name":"color","type":"Color"}}},"example":{"description":"Creates two empty panels with their background colors set to red and blue team colors.","code":"local COLOR_TEAM_RED = Color(255, 64, 64, 255)\nlocal COLOR_TEAM_BLUE = Color(153, 204, 255, 255)\n\nBGPanel1 = vgui.Create(\"DPanel\")\nBGPanel1:SetPos(20, 20)\nBGPanel1:SetSize(200, 200)\nBGPanel1:SetBackgroundColor(COLOR_TEAM_RED)\n\nBGPanel2 = vgui.Create(\"DPanel\")\nBGPanel2:SetPos(220, 20)\nBGPanel2:SetSize(200, 200)\nBGPanel2:SetBackgroundColor(COLOR_TEAM_BLUE)","output":{"image":{"src":"DPanel_SetBackgroundColor_example1.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDisabled","parent":"DPanel","type":"panelfunc","description":{"text":"Sets whether or not to disable the panel.","deprecated":"Use Panel:SetEnabled instead."},"realm":"Client and Menu","args":{"arg":{"text":"True to disable the panel (mouse input disabled and background alpha set to 75), false to enable it (mouse input enabled and background alpha set to 255).","name":"disabled","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDrawBackground","parent":"DPanel","type":"panelfunc","description":{"text":"Sets whether or not to draw the panel background. Alias of DPanel:SetPaintBackground.","deprecated":"You should use DPanel:SetPaintBackground instead."},"realm":"Client and Menu","args":{"arg":{"text":"True to show the panel's background, false to hide it.","name":"draw","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetIsMenu","parent":"DPanel","type":"panelfunc","description":"Used internally by DMenu.\n\n\nSets whether the frame is part of a derma menu or not.\n\nIf this is set to `true`, Global.CloseDermaMenus will not be called when the frame is clicked, and thus any open menus will remain open.","realm":"Client and Menu","args":{"arg":{"text":"Whether this pane is a Menu Component","name":"isMenu","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetPaintBackground","parent":"DPanel","type":"panelfunc","description":"Sets whether or not to paint/draw the panel background.","realm":"Client and Menu","args":{"arg":{"text":"True to show the panel's background, false to hide it.","name":"paint","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTabbingDisabled","parent":"DPanel","type":"panelfunc","description":{"text":"Does nothing.","deprecated":""},"realm":"Client and Menu","args":{"arg":{"name":"draw","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateColours","parent":"DPanel","type":"panelfunc","description":{"text":"Does nothing.","deprecated":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddItem","parent":"DPanelList","type":"panelfunc","description":"Adds a existing panel to the end of DPanelList.","realm":"Client and Menu","args":{"arg":[{"text":"Panel to be used as element of list","name":"pnl","type":"Panel"},{"text":"If set to \"ownline\", the item will take its own entire line.","name":"state","type":"string","default":"nil"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CleanList","parent":"DPanelList","type":"panelfunc","description":"Removes all items.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Clear","parent":"DPanelList","type":"panelfunc","description":"Hides all child panels, and optionally deletes them.","realm":"Client","args":{"arg":{"text":"Whether to actually delete the panels, not just hide them.","name":"remove","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"EnableVerticalScrollbar","parent":"DPanelList","type":"panelfunc","description":"Enables/creates the vertical scroll bar so that the panel list can be scrolled through.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetItems","parent":"DPanelList","type":"panelfunc","description":"Returns all panels has added by DPanelList:AddItem","realm":"Client and Menu","rets":{"ret":{"text":"A table of panels used as items of DPanelList.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetPadding","parent":"DPanelList","type":"panelfunc","description":"Returns offset of list items from the panel borders set by DPanelList:SetPadding","realm":"Client and Menu","rets":{"ret":{"text":"Offset from panel borders","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSpacing","parent":"DPanelList","type":"panelfunc","description":"Returns distance between list items set by DPanelList:SetSpacing","realm":"Client and Menu","rets":{"ret":{"text":"Distance between panels","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InsertAtTop","parent":"DPanelList","type":"panelfunc","description":"Insert given panel at the top of the list.","realm":"Client and Menu","args":{"arg":[{"text":"The panel to insert","name":"insert","type":"Panel"},{"text":"If set to \"ownline\", no other panels will be placed to the left or right of the panel we are inserting","name":"strLineState","type":"string"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Rebuild","parent":"DPanelList","type":"panelfunc","description":{"text":"Used internally to rebuild the child panel positions.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetAutoSize","parent":"DPanelList","type":"panelfunc","description":"Sets the DPanelList to size its height to its contents. This is set to false by default.","realm":"Client and Menu","file":{"text":"lua/vgui/dpanellist.lua","line":"4"},"args":{"arg":{"text":"Whether to size to the height of the DPanelList contents.","name":"shouldSizeToContents","type":"boolean"}}},"example":{"description":"Creates a list with buttons, auto sizes the list to the buttons","code":"local panelList = vgui.Create(\"DPanelList\", self)\npanelList:SetAutoSize(true)\n\nfor i = 1, 5 do\n\tlocal button = vgui.Create(\"DButton\", self)\n\tbutton:SetText(\"Button \" .. i)\n\tpanelList:AddItem(button)\nend\n\n-- Ensure PerformLayout is called (which sets the list height to the content height)\npanelList:InvalidateLayout()","output":{"upload":{"src":"a6216/8dd46150c3fc5d5.png","size":"1715","name":"list-of-buttons.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetPadding","parent":"DPanelList","type":"panelfunc","description":"Sets the offset of the lists items from the panel borders","realm":"Client and Menu","args":{"arg":{"text":"Offset from panel borders","name":"Offset","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSpacing","parent":"DPanelList","type":"panelfunc","description":"Sets distance between list items","realm":"Client and Menu","args":{"arg":{"text":"Distance between panels","name":"Distance","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetColor","parent":"DPanelOverlay","type":"panelfunc","description":"Returns the border color of the DPanelOverlay set by DPanelOverlay:SetColor.","realm":"Client and Menu","rets":{"ret":{"text":"The set color. Uses Color.","name":"","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetType","parent":"DPanelOverlay","type":"panelfunc","description":"Returns the type of the DPanelOverlay set by DPanelOverlay:SetType.","realm":"Client and Menu","rets":{"ret":{"text":"The set type.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PaintDifferentColours","parent":"DPanelOverlay","type":"panelfunc","description":{"text":"Used internally by the panel for type 3.","internal":""},"realm":"Client and Menu","args":{"arg":[{"name":"cola","type":"table"},{"name":"colb","type":"table"},{"name":"colc","type":"table"},{"name":"cold","type":"table"},{"name":"size","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PaintInnerCorners","parent":"DPanelOverlay","type":"panelfunc","description":{"text":"Used internally by the panel for types 1 and 2.","internal":""},"realm":"Client and Menu","args":{"arg":{"name":"size","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetColor","parent":"DPanelOverlay","type":"panelfunc","description":"Sets the border color of the DPanelOverlay.","realm":"Client and Menu","args":{"arg":{"text":"The color to set. Uses Color.","name":"color","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetType","parent":"DPanelOverlay","type":"panelfunc","description":"Sets the type of the DPanelOverlay.","realm":"Client and Menu","args":{"arg":{"text":"The type to set.\n\nPossible value are:\n* 1 - 8px corners of given color\n* 2 - 4px corners of given type\n* 3 - 2 top? corners of hardcoded color, 2 other corners of given color","name":"type","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddPanel","parent":"DPanelSelect","type":"panelhook","description":"Adds a panel to be selectable.","realm":"Client","args":{"arg":[{"text":"The panel to add.","name":"pnl","type":"Panel"},{"text":"ConVars to set when this panel is selected. Keys are the cvar name, value is the value for that cvar.","name":"conVars","type":"table","default":"nil"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"FindBestActive","parent":"DPanelSelect","type":"panelhook","description":{"text":"Used internally by DPanelSelect:AddPanel to select the best default selected panel based on player's convars.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnActivePanelChanged","parent":"DPanelSelect","type":"panelhook","description":"Called when the selected panel changes.","realm":"Client","args":{"arg":[{"text":"Old selected panel.","name":"oldPnl","type":"Panel"},{"text":"New selected panel.","name":"newPnl","type":"Panel"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SelectPanel","parent":"DPanelSelect","type":"panelhook","description":"Selects a given panel.","realm":"Client","args":{"arg":{"text":"Panel to select. It should've been added previously via DPanelSelect:AddPanel.","name":"pnl","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddItem","parent":"DPanPanel","type":"panelfunc","description":"Parents the passed panel to the DPanPanel:GetCanvas.","realm":"Client and Menu","args":{"arg":{"text":"The panel to add.","name":"pnl","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetCanvas","parent":"DPanPanel","type":"panelfunc","description":"The internal canvas panel.","realm":"Client and Menu","rets":{"ret":{"text":"The canvas panel.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnScroll","parent":"DPanPanel","type":"panelfunc","description":{"text":"Used internally, called from DPanPanel:ScrollToChild.","internal":""},"realm":"Client and Menu","args":{"arg":[{"name":"x","type":"number"},{"name":"y","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ScrollToChild","parent":"DPanPanel","type":"panelfunc","description":"Scroll to a specific child panel.","realm":"Client and Menu","file":{"text":"lua/vgui/dpanpanel.lua","line":"123-L135"},"args":{"arg":{"text":"The panel to scroll to.","name":"pnl","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetCanvas","parent":"DPanPanel","type":"panelfunc","description":{"text":"Used internally.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The canvas panel.","name":"pnl","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetFraction","parent":"DProgress","type":"panelfunc","description":"Returns the progress bar's fraction. 0 is 0% and 1 is 100%.","realm":"Client and Menu","rets":{"ret":{"text":"Current fraction of the progress bar.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetFraction","parent":"DProgress","type":"panelfunc","description":"Sets the fraction of the progress bar. 0 is 0% and 1 is 100%.","realm":"Client and Menu","args":{"arg":{"text":"Fraction of the progress bar. Range is 0 to 1 (0% to 100%).","name":"fraction","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CreateRow","parent":"DProperties","type":"panelfunc","description":"Creates a row in the properties panel.","realm":"Client","args":{"arg":[{"text":"The category to list this row under","name":"category","type":"string"},{"text":"The label of this row","name":"name","type":"string"}]},"rets":{"ret":{"text":"An internal Row panel. It has 2 methods of interest:\n* `Setup`( string type, table vars )\n  * Call to set up the panel as one of the `DProperty_","name":"","type":["Panel",{"text":"` panels. `vars` parameter is directly fed into the created `DProperty_","type":{"text":"` panels' `Setup` function.\n* `SetValue`( any value )\n  * Call to set the value on the created `DProperty_","type":"` panel."}}]}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetCanvas","parent":"DProperties","type":"panelfunc","description":"Returns the DScrollPanel all the properties panels are attached to.","realm":"Client","rets":{"ret":{"text":"A DScrollPanel canvas","name":"","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetCategory","parent":"DProperties","type":"panelfunc","description":{"text":"Returns (or creates) a category of properties.\n\nSee DProperties:CreateRow for adding actual properties.","internal":""},"realm":"Client","args":{"arg":[{"text":"Name of the category","name":"name","type":"string"},{"text":"Create a new category if it doesn't exist.","name":"create","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"An internal panel.","name":"","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddChoice","parent":"DProperty_Combo","type":"panelfunc","description":"Add a choice to your combo control.","realm":"Client","args":{"arg":[{"text":"Shown text.","name":"Text","type":"string"},{"text":"Stored Data.","name":"data","type":"any"},{"text":"Select this element?","name":"select","type":"boolean","default":"false"}]}},"example":{"description":"Set the \"I am selected\" option selected.","code":"local choice = DP:CreateRow( \"Choices\", \"Hello world\" )\nchoice:Setup( \"Combo\" )\nchoice:AddChoice( \"I am a choice\", {} )\nchoice:AddChoice( \"I am selected\", 8, true )\nchoice:AddChoice( \"I am not selected\", \"Hello world\" )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"DataChanged","parent":"DProperty_Combo","type":"panelfunc","description":"Called after the user selects a new value.","realm":"Client","args":{"arg":{"text":"The new data that was selected.","name":"data","type":"any"}}},"example":{"description":"Click on the \"Table\" choice.","code":"local choice = DP:CreateRow( \"Choices\", \"Combo #2: Custom default text\" )\nchoice:Setup( \"Combo\", \"Select type...\" )\nchoice:AddChoice( \"Table\", {} )\nchoice:AddChoice( \"Function\", function() end )\nchoice:AddChoice( \"String\", \"Hello world\" )\nchoice.DataChanged = function( self, data )\n\n   print( \"You selected: \", data )\n\nend","output":"```\nYou selected:\ttable: 0x8e05f3b8\n```"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetSelected","parent":"DProperty_Combo","type":"panelfunc","description":"Set the selected option.","realm":"Client","args":{"arg":{"text":"Id of the choice to be selected.","name":"Id","type":"number"}}},"example":{"description":"Set the second option selected.","code":"local choice = DP:CreateRow( \"Choices\", \"Hello world\" )\nchoice:Setup( \"Combo\" )\nchoice:AddChoice( \"Choice #1\", {} )\nchoice:AddChoice( \"Choice #2\", 8 )\nchoice:AddChoice( \"Choice #3\", \"Hello world\", true )\nchoice:SetSelected( 2 ) -- Even if \"Choice #3\" is selected by default, \"Choice #2\" will be selected."},"realms":["Client"],"type":"Function"},
{"function":{"name":"Setup","parent":"DProperty_Combo","type":"panelfunc","description":{"text":"Sets up a combo control.","internal":""},"realm":"Client","args":{"arg":{"text":"Data to use to set up the combo box control. See Editable Entities.\n\nStructure:\n* string text - The default label for this combo box\n* table values - The values to add to the combo box. Keys are the \"nice\" text, values are the data value to send.\n* table icons - The icons for each value. They will be matched by key name.\n* boolean select - The \"nice\" name/key of the value that should be initially selected.","name":"data","type":"table","default":"{ text = 'Select...' }"}}},"example":{"description":"Setup a Combo control with a custom default text and two options.","code":"-- CreateRow returns an internal panel with its own Setup method, which calls this setup method.\nlocal Combo = DP:CreateRow( \"Catergory\", \"Hello World\" )\nCombo:Setup( \"Combo\", {\n\ttext = \"Select me!\",\n\tvalues = {\n\t\t[ \"Label 1\" ] = \"data 1\",\n\t\t[ \"Label 2\" ] = 2,\n\t}\n} )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetDecimals","parent":"DProperty_Float","type":"panelhook","description":"Called to poll the amount of digits after the decimal point. This is used internally for DProperty_Int.","realm":"Client","rets":{"ret":{"text":"The amount of digits after the decimal point.","name":"data","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetRow","parent":"DProperty_Generic","type":"panelfunc","description":"Returns the internal row panel of a DProperties that this panel belongs to.","realm":"Client","rets":{"ret":{"text":"The row panel.","name":"","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetRow","parent":"DProperty_Generic","type":"panelfunc","description":{"text":"Called internally by DProperties.","internal":""},"realm":"Client","args":{"arg":{"text":"The new row panel.","name":"row","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Setup","parent":"DProperty_Generic","type":"panelfunc","description":"Sets up a generic control for use by DProperties.","realm":"Client","args":{"arg":{"text":"See Editable Entities.","name":"data","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"ValueChanged","parent":"DProperty_Generic","type":"panelfunc","description":"Called by this control, or a derived control, to alert the row of the change.","realm":"Client","args":{"arg":[{"text":"The new value.","name":"newVal","type":"any"},{"text":"Force an update.","name":"force","type":"boolean"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Setup","parent":"DProperty_VectorColor","type":"panelfunc","description":{"text":"Called by a property row to setup a color selection control.","internal":""},"realm":"Client","args":{"arg":{"text":"A table of settings. None of the values are used for this property. See Editable Entities.","name":"settings","type":"table"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetValue","parent":"DProperty_VectorColor","type":"panelfunc","description":"Sets the color value of the property.","realm":"Client","args":{"arg":{"text":"Sets the color to use in a DProperty_VectorColor.","name":"color","type":"Vector"}}},"example":{"description":"Setup a color selection control with a custom default color.","code":"local color = DP:CreateRow( \"Category\", \"Select Color\" )\ncolor:Setup( \"VectorColor\", {} )\ncolor:SetValue( Vector( 0.39, 1, 1 ) )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnActiveTabChanged","parent":"DPropertySheet","type":"panelhook","file":{"text":"lua/vgui/dpropertysheet.lua","line":"238-L240"},"description":"Called when a player switches the tabs.\n\n\t\tSource code states that this is meant to be overridden.","realm":"Client and Menu","args":{"arg":[{"text":"The previously active DTab","name":"old","type":"Panel"},{"text":"The newly active DTab","name":"new","type":"Panel"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddSheet","parent":"DPropertySheet","type":"panelfunc","file":{"text":"lua/vgui/dpropertysheet.lua","line":"175-L210"},"description":"Adds a new tab.","realm":"Client and Menu","args":{"arg":[{"text":"Name of the tab","name":"name","type":"string"},{"text":"Panel to be used as contents of the tab. This normally should be a DPanel","name":"pnl","type":"Panel"},{"text":"Icon for the tab. This will ideally be a silkicon, but any material name can be used.","name":"icon","type":"string","default":"nil"},{"text":"Should DPropertySheet try to fill itself with given panel horizontally.","name":"noStretchX","type":"boolean","default":"false"},{"text":"Should DPropertySheet try to fill itself with given panel vertically.","name":"noStretchY","type":"boolean","default":"false"},{"text":"Tooltip for the tab when user hovers over it with his cursor","name":"tooltip","type":"string","default":"nil"}]},"rets":{"ret":{"text":"A table containing the following keys:\n* Panel Tab - The created DTab.\n* string Name - Name of the created tab\n* Panel Panel - The contents panel of the tab","name":"","type":"table"}}},"example":{"code":"local frame = vgui.Create(\"DFrame\")\nframe:SetSize( ScrW() / 2, ScrH() / 2 )\nframe:SetTitle( \"Test Frame\" )\nframe:MakePopup()\nframe:Center()\n\nlocal tabs = vgui.Create( \"DPropertySheet\", frame )\ntabs:Dock( FILL )\n\nlocal tab1panel = vgui.Create( \"DPanel\" )\n\nlocal SheetItem = vgui.Create( \"DButton\", tab1panel )\nSheetItem:SetText( \"Suicide\" )\nSheetItem:SetConsoleCommand( \"kill\" )\n \ntabs:AddSheet( \"Tab 1\", tab1panel, \"icon16/user.png\", false, false, \"Description of first tab\")"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CloseTab","parent":"DPropertySheet","type":"panelfunc","file":{"text":"lua/vgui/dpropertysheet.lua","line":"405-L441"},"description":"Removes tab and/or panel from the parent DPropertySheet.","realm":"Client and Menu","args":{"arg":[{"text":"The DTab of the sheet from DPropertySheet.\n\nSee DPropertySheet:GetItems.","name":"tab","type":"Panel"},{"text":"Set to true to remove the associated panel object as well.","name":"removePanel","type":"boolean"}]},"rets":{"ret":{"text":"The panel of the tab.","name":"","type":"Panel"}}},"example":{"description":"Example of how you'd create and use this panel and close unnecessary sheets.","code":"local MainFrame = vgui.Create( \"DFrame\" )\nMainFrame:SetSize( 500, 300 )\nMainFrame:Center()\nMainFrame:MakePopup()\n\nlocal MainSheet = vgui.Create( \"DPropertySheet\", MainFrame )\nMainSheet:Dock( FILL )\n\nlocal First_Panel = vgui.Create( \"DPanel\", MainSheet )\nFirst_Panel.Paint = function( self, w, h ) draw.RoundedBox( 4, 0, 0, w, h, Color( 255, 128, 0, self:GetAlpha() ) ) end\nMainSheet:AddSheet( \"Users Page\", First_Panel, \"icon16/user.png\" )\n\nlocal Second_Panel = vgui.Create( \"DPanel\", MainSheet )\nSecond_Panel.Paint = function( self, w, h ) draw.RoundedBox( 4, 0, 0, w, h, Color( 0, 128, 255, self:GetAlpha() ) ) end\nMainSheet:AddSheet( \"Admins Page\", Second_Panel, \"icon16/lightning.png\" )\n\nif LocalPlayer():IsAdmin() then\n\tMainSheet:CloseTab( MainSheet:GetItems()[1].Tab ) --1 is a representation of the first sheet\nelse\n\tMainSheet:CloseTab( MainSheet:GetItems()[2].Tab ) --2 is a representation of the second sheet\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CrossFade","parent":"DPropertySheet","type":"panelfunc","file":{"text":"lua/vgui/dpropertysheet.lua","line":"254-L302"},"description":{"text":"Internal function that handles the cross fade animation when the player switches tabs.","internal":""},"realm":"Client and Menu","args":{"arg":[{"name":"anim","type":"table"},{"name":"delta","type":"number"},{"name":"data","type":"table"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetActiveTab","parent":"DPropertySheet","type":"panelfunc","file":{"text":"lua/vgui/dpropertysheet.lua","line":"151"},"description":"Returns the active DTab of this DPropertySheet.","realm":"Client and Menu","rets":{"ret":{"text":"The DTab","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetFadeTime","parent":"DPropertySheet","type":"panelfunc","file":{"text":"lua/vgui/dpropertysheet.lua","line":"153"},"description":"Returns the amount of time (in seconds) it takes to fade between tabs.\n\n\tSet by DPropertySheet:SetFadeTime","realm":"Client and Menu","rets":{"ret":{"text":"The amount of time (in seconds) it takes to fade between tabs.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetItems","parent":"DPropertySheet","type":"panelfunc","file":{"text":"lua/vgui/dpropertysheet.lua","line":"248-L252"},"description":"Returns a list of all tabs of this DPropertySheet.","realm":"Client and Menu","rets":{"ret":{"text":"A table of tables.\nEach table contains 3 key-value pairs:\n\n* string Name - The name of the tab.\n* Panel Tab - The DTab associated with the tab.\n* Panel Panel - The Panel associated with the tab.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetPadding","parent":"DPropertySheet","type":"panelfunc","file":{"text":"lua/vgui/dpropertysheet.lua","line":"152"},"description":"Gets the padding from the parent panel to child panels.","realm":"Client and Menu","rets":{"ret":{"text":"Padding","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetShowIcons","parent":"DPropertySheet","type":"panelfunc","file":{"text":"lua/vgui/dpropertysheet.lua","line":"155"},"description":{"text":"Returns whatever value was set by DPropertySheet:SetShowIcons.","deprecated":""},"realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetActiveTab","parent":"DPropertySheet","type":"panelfunc","file":{"text":"lua/vgui/dpropertysheet.lua","line":"151"},"description":"Sets the active tab of the DPropertySheet.","realm":"Client and Menu","args":{"arg":{"text":"The DTab to set active.\n\nSee DPropertySheet:GetItems","name":"tab","type":"Panel"}}},"example":{"description":"Example of how you'd create and use this panel and set active tab.","code":"local MainFrame = vgui.Create( \"DFrame\" )\nMainFrame:SetSize( 500, 300 )\nMainFrame:Center()\nMainFrame:MakePopup()\n\nlocal MainSheet = vgui.Create( \"DPropertySheet\", MainFrame )\nMainSheet:Dock( FILL )\n\nlocal First_Panel = vgui.Create( \"DPanel\", MainSheet )\nFirst_Panel.Paint = function( self, w, h ) draw.RoundedBox( 4, 0, 0, w, h, Color( 0, 128, 255, self:GetAlpha() ) ) end\nMainSheet:AddSheet( \"test\", First_Panel, \"icon16/cross.png\" )\n\nlocal Second_Panel = vgui.Create( \"DPanel\", MainSheet )\nSecond_Panel.Paint = function( self, w, h ) draw.RoundedBox( 4, 0, 0, w, h, Color( 255, 128, 0, self:GetAlpha() ) ) end\nMainSheet:AddSheet( \"test 2\", Second_Panel, \"icon16/tick.png\" )\n\nMainSheet:SetActiveTab( MainSheet:GetItems()[2].Tab ) --2 is a representation of the second sheet"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetFadeTime","parent":"DPropertySheet","type":"panelfunc","file":{"text":"lua/vgui/dpropertysheet.lua","line":"153"},"description":"Sets the amount of time (in seconds) it takes to fade between tabs.","realm":"Client and Menu","args":{"arg":{"text":"The amount of time it takes (in seconds) to fade between tabs.","name":"time","type":"number","default":"0.1"}}},"example":[{"description":"Sets the fade time to 0.5 seconds (500 milliseconds)","code":"DPropertySheet.SetFadeTime(0.5)"},{"description":"Sets the fade time to 2 seconds (2000 milliseconds)","code":"DPropertySheet.SetFadeTime(2)"}],"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetPadding","parent":"DPropertySheet","type":"panelfunc","file":{"text":"lua/vgui/dpropertysheet.lua","line":"152"},"description":"Sets the padding from parent panel to children panel.","realm":"Client and Menu","args":{"arg":{"text":"Amount of padding","name":"padding","type":"number","default":"8"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetShowIcons","parent":"DPropertySheet","type":"panelfunc","file":{"text":"lua/vgui/dpropertysheet.lua","line":"155"},"description":{"text":"Does nothing.","deprecated":""},"realm":"Client and Menu","args":{"arg":{"name":"show","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetupCloseButton","parent":"DPropertySheet","type":"panelfunc","file":{"text":"lua/vgui/dpropertysheet.lua","line":"391-L403"},"description":"Creates a close button on the right side of the DPropertySheet that will run the given callback function when pressed.","realm":"Client and Menu","args":{"arg":{"text":"Callback function to be called when the close button is pressed.","name":"func","type":"function"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SizeToContentWidth","parent":"DPropertySheet","type":"panelfunc","file":{"text":"lua/vgui/dpropertysheet.lua","line":"359-L374"},"description":"Sets the width of the DPropertySheet to fit the contents of all of the tabs.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SwitchToName","parent":"DPropertySheet","type":"panelfunc","file":{"text":"lua/vgui/dpropertysheet.lua","line":"376-L389"},"description":"Switches the active tab to a tab with given name.","realm":"Client and Menu","args":{"arg":{"text":"Case sensitive name of the tab.","name":"name","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnChange","parent":"DRGBPicker","type":"panelhook","description":"Function which is called when the cursor is clicked and/or moved on the color picker. Meant to be overridden.","realm":"Client and Menu","args":{"arg":{"text":"The color that is selected on the color picker (Color form).","name":"col","type":"Color"}}},"example":{"description":"Creates a color picker which controls the color of a ball image.","code":"-- Frame\nMainFrame = vgui.Create(\"DFrame\")\nMainFrame:SetSize(200, 200)\nMainFrame:Center()\nMainFrame:SetTitle(\"Pick a color\")\n\n-- Image of a ball\nlocal ball_img = vgui.Create(\"DImage\", MainFrame)\nball_img:SetPos(20, 45)\nball_img:SetSize(128, 128)\n\nball_img:SetImage(\"sprites/sent_ball\")\n\n-- Vertical color picker\nlocal color_picker = vgui.Create(\"DRGBPicker\", MainFrame)\ncolor_picker:SetPos(165, 30)\ncolor_picker:SetSize(25, 150)\n\nfunction color_picker:OnChange(col)\n\n\tball_img:SetImageColor(col)\n\t\nend","output":{"image":{"src":"DModelPanel_OnChange_example1.gif"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetPosColor","parent":"DRGBPicker","type":"panelfunc","description":{"text":"Returns the color at given position on the internal texture.","internal":""},"realm":"Client and Menu","args":{"arg":[{"text":"The X coordinate on the texture to get the color from","name":"x","type":"number"},{"text":"The Y coordinate on the texture to get the color from","name":"y","type":"number"}]},"rets":{"ret":[{"text":"The Color","name":"","type":"Color"},{"text":"The X-coordinate clamped to the texture's width.","name":"","type":"number"},{"text":"The Y-coordinate clamped to the texture's height.","name":"","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetRGB","parent":"DRGBPicker","type":"panelfunc","description":"Returns the color currently set on the color picker.","realm":"Client and Menu","rets":{"ret":{"text":"The color set on the color picker, see Color.","name":"","type":"Color"}}},"example":{"description":"Prints out the default set color.","code":"local color_picker = vgui.Create(\"DRGBPicker\")\ncolor_picker:SetSize(25, 150)\ncolor_picker:Center()\n\nprint(color_picker:GetRGB())","output":"```\n255 255 255 255\n```"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetRGB","parent":"DRGBPicker","type":"panelfunc","description":{"text":"Sets the color stored in the color picker.","note":"This function is meant to be called internally and will not update the position of the color picker line or call DRGBPicker:OnChange"},"realm":"Client and Menu","args":{"arg":{"text":"The color to set, see Color.","name":"color","type":"Color"}}},"example":{"description":"Defines a new function SetColor which will allow proper modification of the color picker directly.","code":"-- Background panel\nBGPanel = vgui.Create(\"DPanel\")\nBGPanel:SetSize(100, 200)\nBGPanel:Center()\n\n-- Color picker\nlocal color_picker = vgui.Create(\"DRGBPicker\", BGPanel)\ncolor_picker:SetSize(30, 150)\ncolor_picker:Center()\n\n-- Custom function that sets color picker position and updates color\nfunction color_picker:SetColor(col)\n\n\t-- Get hue\n\tlocal h = ColorToHSV(col)\n\t\n\t-- Maximize saturation and vibrance\n\tcol = HSVToColor(h, 1, 1)\n\n\t-- Set color var\n\tself:SetRGB(col)\n\t\n\t-- Calculate position of color picker line\n\tlocal _, height = self:GetSize()\n\tself.LastY = height*(1-(h/360))\n\t\n\t-- Register that a change has occured\n\tself:OnChange(self:GetRGB())\n\nend\n\n-- Update background color\nfunction color_picker:OnChange(col)\n\n\tBGPanel:SetBackgroundColor(col)\n\nend\n\n-- Set to random color every second for 10 seconds\ntimer.Create(\"RandomizeColorPicker\", 1, 10, function ()\n\n\tcolor_picker:SetColor(Color(math.random(0, 255), math.random(0, 255), math.random(0, 255), 255))\n\t\nend)","output":{"image":{"src":"DRGBPicker_SetRGB_example1.gif"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddItem","parent":"DScrollPanel","type":"panelfunc","description":"Parents the passed panel to the DScrollPanel's canvas.","file":{"text":"lua/vgui/dscrollpanel.lua","line":"33-L37"},"realm":"Client and Menu","args":{"arg":{"text":"The panel to add.","name":"pnl","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetCanvas","parent":"DScrollPanel","type":"panelfunc","description":"Returns the canvas ( The panel all child panels are parented to ) of the DScrollPanel.","realm":"Client and Menu","file":{"text":"lua/vgui/dscrollpanel.lua","line":"57-L61"},"rets":{"ret":{"text":"The canvas","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetPadding","parent":"DScrollPanel","type":"panelfunc","description":{"text":"Gets the DScrollPanels padding, set by DScrollPanel:SetPadding.","deprecated":""},"realm":"Client and Menu","rets":{"ret":{"text":"DScrollPanels padding","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetVBar","parent":"DScrollPanel","type":"panelfunc","description":"Returns the vertical scroll bar of the panel.","realm":"Client and Menu","file":{"text":"lua/vgui/dscrollpanel.lua","line":"51-L55"},"rets":{"ret":{"text":"The DVScrollBar.","name":"","type":"Panel{DVScrollBar}"}}},"example":{"description":"Example of styling a scrollbar","code":"local DFrame = vgui.Create(\"DFrame\")\nDFrame:SetSize(500, 500)\nDFrame:Center()\nDFrame:MakePopup()\nDFrame:SetTitle(\"Scrollbar Example\")\nfunction DFrame:Paint(w, h)\n\tdraw.RoundedBox(0, 0, 0, w, h, Color(0, 100, 100))\nend\n\nlocal DScrollPanel = vgui.Create(\"DScrollPanel\", DFrame)\nDScrollPanel:SetSize(400, 250)\nDScrollPanel:Center()\n\nlocal sbar = DScrollPanel:GetVBar()\nfunction sbar:Paint(w, h)\n\tdraw.RoundedBox(0, 0, 0, w, h, Color(0, 0, 0, 100))\nend\nfunction sbar.btnUp:Paint(w, h)\n\tdraw.RoundedBox(0, 0, 0, w, h, Color(200, 100, 0))\nend\nfunction sbar.btnDown:Paint(w, h)\n\tdraw.RoundedBox(0, 0, 0, w, h, Color(200, 100, 0))\nend\nfunction sbar.btnGrip:Paint(w, h)\n\tdraw.RoundedBox(0, 0, 0, w, h, Color(100, 200, 0))\nend\n\nlocal str = \"\"\nfor i = 1, 50 do str = str .. \"more space!\\n\" end\n\nlocal DLabel = vgui.Create(\"DLabel\", DScrollPanel)\nDLabel:SetText(str)\nDLabel:Center()\nDLabel:SizeToContents()","output":{"image":{"src":"scrollbar_style_example.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InnerWidth","parent":"DScrollPanel","type":"panelfunc","description":"Return the width of the DScrollPanel's canvas.","realm":"Client and Menu","file":{"text":"lua/vgui/dscrollpanel.lua","line":"63-L67"},"rets":{"ret":{"text":"The width of the DScrollPanel's canvas","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PerformLayoutInternal","parent":"DScrollPanel","type":"panelfunc","description":{"text":"Used internally to rebuild the panel's children positioning. You should use Panel:InvalidateLayout instead.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Rebuild","parent":"DScrollPanel","type":"panelfunc","description":{"text":"Used internally to rebuild the panel's children positioning. You should use Panel:InvalidateLayout instead.","internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dscrollpanel.lua","line":"69-L80"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ScrollToChild","parent":"DScrollPanel","type":"panelfunc","description":"Scrolls to the given child","realm":"Client and Menu","file":{"text":"lua/vgui/dscrollpanel.lua","line":"94-L106"},"args":{"arg":{"text":"The panel to scroll to, must be a child of the DScrollPanel.","name":"panel","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetCanvas","parent":"DScrollPanel","type":"panelfunc","description":{"text":"Sets the canvas of the DScrollPanel.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The new canvas","name":"canvas","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetPadding","parent":"DScrollPanel","type":"panelfunc","description":{"text":"Sets the DScrollPanel's padding. This function appears to be unused.","deprecated":""},"realm":"Client and Menu","args":{"arg":{"text":"The padding of the DScrollPanel.","name":"padding","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetBorderColor","parent":"DShape","type":"panelfunc","description":"Returns the current type of shape this panel is set to display.\n\nSee DShape:SetBorderColor.","realm":"Client","rets":{"ret":{"text":"The border Color","name":"","type":"Color"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetColor","parent":"DShape","type":"panelfunc","description":"Returns the color set to display the shape with.","realm":"Client","rets":{"ret":{"text":"The shape Color","name":"","type":"Color"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetType","parent":"DShape","type":"panelfunc","description":"Returns the current type of shape this panel is set to display.\n\nSee DShape:SetType.","realm":"Client","rets":{"ret":{"text":"Current shape type.","name":"","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetBorderColor","parent":"DShape","type":"panelfunc","description":"Sets the border color of the shape.\n\nCurrently does nothing.","realm":"Client","args":{"arg":{"text":"The desired border color. See Color","name":"clr","type":"Color"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetColor","parent":"DShape","type":"panelfunc","description":"Sets the color to display the shape with.","realm":"Client","args":{"arg":{"text":"The Color","name":"clr","type":"Color"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetType","parent":"DShape","type":"panelfunc","description":"Sets the shape to be drawn.","realm":"Client","args":{"arg":{"text":"The render type of the DShape. Only rectangles (`Rect`) work currently. If you don't define a type immediately, the PANEL:Paint method will generate errors until you do.","name":"type","type":"string"}}},"example":{"description":"Creates a DShape and sets the render type.","code":"local Shape = vgui.Create( \"DShape\" )\nShape:SetType( \"Rect\" )\nShape:SetSize(500,500)\nShape:SetPos(10, 10)"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetSizeX","parent":"DSizeToContents","type":"panelfunc","description":"Returns whether the DSizeToContents panel should size to contents horizontally.","realm":"Client and Menu","rets":{"ret":{"text":"Whether the panel should size to contents horizontally.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSizeY","parent":"DSizeToContents","type":"panelfunc","description":"Returns whether the DSizeToContents panel should size to contents vertically.","realm":"Client and Menu","rets":{"ret":{"text":"Whether the panel should size to contents vertically.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSizeX","parent":"DSizeToContents","type":"panelfunc","description":"Sets whether the DSizeToContents panel should size to contents horizontally. This is `true` by default.","realm":"Client and Menu","args":{"arg":{"text":"Whether the panel should size to contents horizontally.","name":"sizeX","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSizeY","parent":"DSizeToContents","type":"panelfunc","description":"Sets whether the DSizeToContents panel should size to contents vertically. This is `true` by default.","realm":"Client and Menu","args":{"arg":{"text":"Whether the panel should size to contents vertically.","name":"sizeY","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnValueChanged","parent":"DSlider","type":"panelhook","description":"Called when the values of this slider panel were changed.","realm":"Client and Menu","added":"2023.01.25","args":{"arg":[{"text":"The X axis position of the slider in range 0-1","name":"x","type":"number"},{"text":"The Y axis position of the slider in range 0-1","name":"y","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ResetToDefaultValue","parent":"DSlider","type":"panelhook","description":"This function is called by the DSlider when user middle mouse clicks on the draggable knob of the slider.\n\nYou are meant to override this function to do reset the slider to desired defaults on both axes.\n\nBy default, will reset the slider to `0.5` on both axes.","added":"2024.05.02","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"TranslateValues","parent":"DSlider","type":"panelhook","description":"For override by child panels, such as DNumSlider. Allows changing the output values of the slider.","realm":"Client and Menu","args":{"arg":[{"text":"The input X coordinate, in range of 0-1.","name":"x","type":"number"},{"text":"The input Y coordinate, in range of 0-1.","name":"y","type":"number"}]},"rets":{"ret":[{"text":"The output X coordinate, in range of 0-1.","name":"","type":"number"},{"text":"The output X coordinate, in range of 0-1.","name":"","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ConVarXNumberThink","parent":"DSlider","type":"panelfunc","description":{"text":"Used internally to set the X axis convar.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ConVarYNumberThink","parent":"DSlider","type":"panelfunc","description":{"text":"Used internally to set the Y axis convar.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDragging","parent":"DSlider","type":"panelfunc","description":"Identical to DSlider:IsEditing","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetLockX","parent":"DSlider","type":"panelfunc","description":"Returns the draggable panel's lock on the X axis.\n\nSee DSlider:SetLockX for more info.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetLockY","parent":"DSlider","type":"panelfunc","description":"Returns the draggable panel's lock on the Y axis.\n\nSee DSlider:SetLockY for more info.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetNotchColor","parent":"DSlider","type":"panelfunc","description":{"text":"Returns the current notch color, set by DSlider:SetNotchColor","deprecated":"Does not affect anything by default."},"realm":"Client and Menu","added":"2021.06.09","rets":{"ret":{"text":"The current color","name":"clr","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetNotches","parent":"DSlider","type":"panelfunc","description":{"text":"Appears to be non functioning, however is still used by panels such as DNumSlider.","deprecated":""},"realm":"Client and Menu","rets":{"ret":{"name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetNumSlider","parent":"DSlider","type":"panelfunc","description":{"text":"Does nothing.","deprecated":""},"realm":"Client and Menu","rets":{"ret":{"name":"","type":"any"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSlideX","parent":"DSlider","type":"panelfunc","description":"Returns the target position of the draggable \"knob\" panel of the slider on the X axis.\n\nSet by DSlider:SetSlideX.","realm":"Client and Menu","rets":{"ret":{"text":"The value range seems to be from 0 to 1","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSlideY","parent":"DSlider","type":"panelfunc","description":"Returns the target position of the draggable \"knob\" panel of the slider on the Y axis.\n\nSet by DSlider:SetSlideY.","realm":"Client and Menu","rets":{"ret":{"text":"The value range seems to be from 0 to 1","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTrapInside","parent":"DSlider","type":"panelfunc","description":"Returns the value set by DSlider:SetTrapInside.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsEditing","parent":"DSlider","type":"panelfunc","description":"Returns true if this element is being edited by the player.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnValuesChangedInternal","parent":"DSlider","type":"panelfunc","description":{"text":"Used internally to fire DSlider:OnValueChanged","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetBackground","parent":"DSlider","type":"panelfunc","description":"Sets the background for the slider.","realm":"Client and Menu","args":{"arg":{"text":"Path to the image.","name":"path","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetConVarX","parent":"DSlider","type":"panelfunc","description":"Sets the ConVar to be set when the slider changes on the X axis.","realm":"Client and Menu","args":{"arg":{"text":"Name of the convar to set.","name":"convar","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetConVarY","parent":"DSlider","type":"panelfunc","description":"Sets the ConVar to be set when the slider changes on the Y axis.","realm":"Client and Menu","args":{"arg":{"text":"Name of the convar to set.","name":"convar","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDragging","parent":"DSlider","type":"panelfunc","description":{"text":"Sets whether or not the slider is being dragged.","internal":""},"realm":"Client and Menu","args":{"arg":{"name":"dragging","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetImage","parent":"DSlider","type":"panelfunc","description":{"text":"Does nothing.","deprecated":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetImageColor","parent":"DSlider","type":"panelfunc","description":{"text":"Does nothing.","deprecated":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetLockX","parent":"DSlider","type":"panelfunc","description":"Sets the lock on the X axis. \n\nFor example the value 0.5 will lock the draggable panel to half the width of the slider's panel.","realm":"Client and Menu","args":{"arg":{"text":"Set to nil to reset lock.\n\nThe value range is from 0 to 1.","name":"lockX","type":"number","default":"nil"}}},"example":{"description":"Example of a slider that can be dragged on the X and Y axis.","code":"local frame = vgui.Create( \"DFrame\" )\nframe:SetSize( 500, 300 )\nframe:Center()\nframe:MakePopup()\n\nlocal Slider = vgui.Create( \"DSlider\", frame )\nSlider:SetPos( 50, 50 )\nSlider:SetSize( 100, 100 )\nSlider:SetLockX()\nSlider:SetLockY()"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetLockY","parent":"DSlider","type":"panelfunc","description":"Sets the lock on the Y axis. \n\nFor example the value 0.5 will lock the draggable panel to half the height of the slider's panel.","realm":"Client and Menu","args":{"arg":{"text":"Set to nil to reset lock.\n\nThe value range is from 0 to 1.","name":"lockY","type":"number","default":"nil"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetNotchColor","parent":"DSlider","type":"panelfunc","description":{"text":"Sets the current notch color, overriding the color set by the derma skin.","deprecated":"Does not affect anything by default."},"realm":"Client and Menu","added":"2021.06.09","args":{"arg":{"text":"The new color to set","name":"clr","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetNotches","parent":"DSlider","type":"panelfunc","description":{"text":"Appears to be non functioning, however is still used by panels such as DNumSlider.","deprecated":""},"realm":"Client and Menu","args":{"arg":{"name":"notches","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetNumSlider","parent":"DSlider","type":"panelfunc","description":{"text":"Does nothing.","deprecated":""},"realm":"Client and Menu","args":{"arg":{"name":"slider","type":"any"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSlideX","parent":"DSlider","type":"panelfunc","description":"Used to position the draggable panel of the slider on the X axis.","realm":"Client and Menu","args":{"arg":{"text":"The value range seems to be from 0 to 1","name":"x","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSlideY","parent":"DSlider","type":"panelfunc","description":"Used to position the draggable panel of the slider on the Y axis.","realm":"Client and Menu","args":{"arg":{"text":"The value range seems to be from 0 to 1","name":"y","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTrapInside","parent":"DSlider","type":"panelfunc","description":{"text":"Makes the slider itself, the \"knob\", trapped within the bounds of the slider panel. Example:","upload":{"src":"70c/8dafb0260022da3.png","size":"6257","name":"image.png"}},"realm":"Client and Menu","args":{"arg":{"name":"trap","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetColor","parent":"DSprite","type":"panelfunc","description":"Gets the color the sprite is using as a modifier.","realm":"Client","rets":{"ret":{"text":"The Color being used.","name":"","type":"Color"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetHandle","parent":"DSprite","type":"panelfunc","description":{"text":"Returns the value set by DSprite:SetHandle","deprecated":""},"realm":"Client","rets":{"ret":{"name":"","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetMaterial","parent":"DSprite","type":"panelfunc","description":"Gets the material the sprite is using.","realm":"Client","rets":{"ret":{"text":"The material in use.","name":"","type":"IMaterial"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetRotation","parent":"DSprite","type":"panelfunc","description":"Gets the 2D rotation angle of the sprite, in the plane of the screen.","realm":"Client","rets":{"ret":{"text":"The anti-clockwise rotation in degrees.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetColor","parent":"DSprite","type":"panelfunc","description":"Sets the color modifier for the sprite.","realm":"Client","args":{"arg":{"text":"The Color to use.","name":"color","type":"Color"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetHandle","parent":"DSprite","type":"panelfunc","description":{"text":"Seems to be an unused feature. Does nothing.","deprecated":""},"realm":"Client","args":{"arg":{"name":"vec","type":"Vector"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetMaterial","parent":"DSprite","type":"panelfunc","description":"Sets the source material for the sprite.","realm":"Client","args":{"arg":{"text":"The material to use. This will ideally be an [UnlitGeneric](https://developer.valvesoftware.com/wiki/UnlitGeneric).","name":"material","type":"IMaterial"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetRotation","parent":"DSprite","type":"panelfunc","description":"Sets the 2D rotation angle of the sprite, in the plane of the screen.","realm":"Client","args":{"arg":{"text":"The anti-clockwise rotation in degrees.","name":"ang","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetPanel","parent":"DTab","type":"panelfunc","description":"Returns the panel that the tab represents.","realm":"Client and Menu","file":{"text":"lua/vgui/dpropertysheet.lua","line":"5"},"rets":{"ret":{"text":"Panel added to the sheet using DPropertySheet:AddSheet.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetPropertySheet","parent":"DTab","type":"panelfunc","description":"The DPropertySheet this tab belongs to.","realm":"Client and Menu","rets":{"ret":{"text":"The DPropertySheet this tab belongs to.","name":"pnl","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTabHeight","parent":"DTab","type":"panelfunc","description":{"text":"Returns the target height of this tab. Used internally by DTab's PANEL:ApplySchemeSettings.","internal":""},"realm":"Client and Menu","rets":{"ret":{"text":"Either 20, or 28 if DTab:IsActive.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsActive","parent":"DTab","type":"panelfunc","description":"Returns whether the tab is the currently selected tab of the associated DPropertySheet.","realm":"Client and Menu","file":{"text":"lua/vgui/dpropertysheet.lua","line":"34"},"rets":{"ret":{"text":"Currently selected tab.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetPanel","parent":"DTab","type":"panelfunc","description":{"text":"Used internally by DTab:Setup.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The contents of this tab.","name":"pnl","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetPropertySheet","parent":"DTab","type":"panelfunc","description":{"text":"Used internally by DTab:Setup.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The DPropertySheet to set for this tab.","name":"pnl","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Setup","parent":"DTab","type":"panelfunc","description":{"text":"Used internally by DPropertySheet:AddSheet.","internal":""},"realm":"Client and Menu","args":{"arg":[{"text":"Label of the tab","name":"label","type":"string"},{"text":"The DPropertySheet this tab belongs to.","name":"sheet","type":"Panel"},{"text":"Panel to be used as contents of the tab. This normally should be a DPanel.","name":"pnl","type":"Panel"},{"text":"Icon for the tab. This will typically be a silkicon, but any material name can be used.","name":"icon","type":"string","default":"nil"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnChange","parent":"DTextEntry","type":"panelhook","description":"Called by DTextEntry:OnTextChanged when the user modifies the text in the DTextEntry.\n\nYou should override this function to define custom behavior when the DTextEntry text changes.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnEnter","parent":"DTextEntry","type":"panelhook","description":{"text":"Called whenever enter is pressed on a DTextEntry.","note":"DTextEntry:IsEditing will still return true in this callback!"},"realm":"Client and Menu","args":{"arg":{"text":"The current text of the DTextEntry","name":"value","type":"string","added":"2020.06.24"}}},"example":[{"code":"local TextEntry = vgui.Create( \"DTextEntry\" )\n\nfunction TextEntry:OnEnter( value )\n    print(\"You typed: \", value)\nend"},{"code":"local TextEntry = vgui.Create( \"DTextEntry\" )\n\nTextEntry.OnEnter = function( self )\t\t-- Alternative method, outputs DTextEntry object.\n    print(\"You typed: \", self:GetValue()) \t-- Use self:GetValue() to grab the string.\nend","output":"Whatever string was typed into the DTextEntry appears in console when enter is pressed."}],"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnGetFocus","parent":"DTextEntry","type":"panelhook","description":"Called whenever the DTextEntry gains focus.","realm":"Client and Menu","file":{"text":"lua/vgui/dtextentry.lua","line":"336-L348"}},"example":{"code":"local dTextEntry = vgui.Create(\"DTextEntry\")\ndTextEntry:SetText(\"Enter text here\")\n\n-- Make the text field clear when you click into it.\ndTextEntry.OnGetFocus = function(self)\n    self:SetValue(\"\")\nend","output":"Text entry clears when user clicks it to begin typing"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnKeyCode","parent":"DTextEntry","type":"panelhook","description":"Called from DTextEntry's TextEntry:OnKeyCodeTyped override whenever a valid character is typed while the text entry is focused.","realm":"Client and Menu","args":{"arg":{"text":"They key code of the key pressed, see Enums/KEY.","name":"keyCode","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"title":"DTextEntry:OnLoseFocus","function":{"name":"OnLoseFocus","parent":"DTextEntry","type":"panelhook","description":"Called whenever the DTextEntry lose focus.","realm":"Client and Menu"},"example":{"code":"concommand.Add( \"test_textentry_onlosefocus\", function(ply)\n\tlocal frame = vgui.Create( \"DFrame\" )\n\tframe:SetSize( 400, 200 )\n\tframe:Center()\n\tframe:MakePopup()\n\n\tlocal default = \"Brick with bob\"\n\n\tlocal textentry = vgui.Create( \"DTextEntry\", frame )\n\ttextentry:SetText( default )\n\ttextentry:Dock( TOP )\n\ttextentry.OnLoseFocus = function( self )\n\t\tif ( self:GetText() == \"\" ) then\n\t\t\tself:SetText( default )\n\t\tend\n\tend\n\nend )","output":"DTextEntry value reset to default value if the text entered is empty."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnValueChange","parent":"DTextEntry","type":"panelhook","description":"Called when the text changes of the DTextEntry are applied. (And set to the attached console variable, if one is given)\n\nSee also DTextEntry:OnChange for a function that is called on every text change, even if the console variable is not updated.\n\nYou should override this function to define custom behavior when the text changes.\n\nThis method is called:\n* When Enter is pressed after typing\n* When DTextEntry:SetValue is used\n* For every key typed - only if DTextEntry:SetUpdateOnType was set to true (default is false)","realm":"Client and Menu","args":{"arg":{"text":"The DTextEntry text.","name":"value","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddHistory","parent":"DTextEntry","type":"panelfunc","description":"Adds an entry to DTextEntry's history.\n\nSee DTextEntry:SetHistoryEnabled.","realm":"Client and Menu","file":{"text":"lua/vgui/dtextentry.lua","line":"366-L373"},"args":{"arg":{"text":"Text to add to the text entry's history.","name":"text","type":"string"}}},"example":{"description":"A simple example.","code":"-- Create a new frame (window)\nlocal frame = vgui.Create( \"DFrame\" )\nframe:SetSize( 300, 300 )  -- Set the size of the frame\nframe:Center()  -- Center the frame on the screen\nframe:MakePopup()  -- Make the frame appear in front of other windows and accept user input\n\n-- Create a text entry field within the frame\nlocal tEntry = vgui.Create(\"DTextEntry\", frame)\ntEntry:Dock(TOP)  -- Dock the text entry at the top of the frame\ntEntry:SetHistoryEnabled(true)  -- Dock the text entry at the top of the frame\ntEntry.OnEnter = function( self )\n\tlocal val = self:GetValue()\n\tself:AddHistory( val ) -- Store old value in history so the player can access it again later\n\tself:SetText( \"\" ) -- reset the text\n\t\n\t-- Do something with the data...\n\tchat.AddText( val )\t-- print the textentry text as a chat message\nend"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AllowInput","parent":"DTextEntry","type":"panelfunc","description":"Called whenever the value of the panel has been updated (whether by user input or otherwise).\n\nIt allows you to determine whether a user can modify the TextEntry's text.\n\nBy default, this only checks whether the panel disallows numeric characters, preventing it from being edited if the value contains any.\n\nThis is actually an engine hook that only works on TextEntry derived elements.\n\nIf you are looking for a way to modify character limits, see Panel:SetMaximumCharCount","realm":"Client and Menu","file":{"text":"lua/vgui/dtextentry.lua","line":"321-L327"},"args":{"arg":{"text":"The last character entered into the panel.","name":"char","type":"string"}},"rets":{"ret":{"text":"Return `true` to prevent the value from changing, `false` to allow it.","name":"","type":"boolean"}}},"example":{"description":"Prevents the user from editing the text entirely.","code":"local TextEntry = vgui.Create( \"DTextEntry\" )\nTextEntry.AllowInput = function( self, stringValue )\n\treturn true\nend","output":"The panel does not allow any alterations."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CheckNumeric","parent":"DTextEntry","type":"panelfunc","description":"Returns whether a string is numeric or not.\nAlways returns false if the DTextEntry:SetNumeric is set to false.","realm":"Client and Menu","file":{"text":"lua/vgui/dtextentry.lua","line":"296-L311"},"args":{"arg":{"text":"The string to check.","name":"strValue","type":"string"}},"rets":{"ret":{"text":"Whether the string is numeric or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetAutoComplete","parent":"DTextEntry","type":"panelfunc","description":"Called by the DTextEntry when a list of autocompletion options is requested. Meant to be overridden.","realm":"Client and Menu","args":{"arg":{"text":"Player's current input.","name":"inputText","type":"string"}},"rets":{"ret":{"text":"If a table is returned, the values of the table will show up as autocomplete suggestions for the user.","name":"","type":"table"}}},"example":{"description":"Shows a list of players to choose from.","code":"local frame = vgui.Create( \"DFrame\" )\nframe:SetSize( 300, 300 )\nframe:SetTitle( \"Autocompletion Example\" )\nframe:Center()\nframe:MakePopup()\n\nlocal label = vgui.Create( \"DLabel\", frame )\nlabel:SetText( \"Type a player...\" )\nlabel:Dock( TOP )\n\nlocal textentry = vgui.Create( \"DTextEntry\", frame )\ntextentry:Dock( TOP )\nfunction textentry:GetAutoComplete( text )\n    local suggestions = {}\n\n    for _, ply in ipairs( player.GetAll() ) do -- For every player,\n        if string.StartsWith( ply:Nick(), text ) then -- if the player's name starts with it...\n            table.insert( suggestions, ply:Nick() ) -- ... insert it into the list.\n        end\n    end\n\n\treturn suggestions\nend","output":{"image":{"src":"autocomplete_example.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetCursorColor","parent":"DTextEntry","type":"panelfunc","description":"Returns the cursor color of a DTextEntry.","realm":"Client and Menu","rets":{"ret":{"text":"The color of the cursor as a Color.","name":"","type":"Color"}}},"example":{"code":"local TextEntry = vgui.Create( \"DTextEntry\" )\nTextEntry:SetCursorColor( Color( 255, 0, 0, 255 ))\nPrintTable( TextEntry:GetCursorColor() )","output":"Prints the R, G, B and A of the cursor color."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDisabled","parent":"DTextEntry","type":"panelfunc","description":{"text":"Returns whether the textbox is disabled. Use Panel:IsEnabled instead.","deprecated":"Use Panel:IsEnabled instead."},"realm":"Client and Menu","rets":{"ret":{"text":"Whether the textbox is disabled.","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDrawBackground","parent":"DTextEntry","type":"panelfunc","description":{"text":"Alias of DTextEntry:GetPaintBackground. Use that instead.\n\nWhether the background is displayed or not.","deprecated":""},"realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDrawBorder","parent":"DTextEntry","type":"panelfunc","description":{"text":"Returns the value set by DTextEntry:SetDrawBorder.","deprecated":""},"realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetEnterAllowed","parent":"DTextEntry","type":"panelfunc","description":"Returns whether pressing Enter can cause the panel to lose focus. Note that a multiline DTextEntry cannot be escaped using the Enter key even when this function returns true.","realm":"Client and Menu","rets":{"ret":{"text":"Whether pressing the Enter key can cause the panel to lose focus.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetFloat","parent":"DTextEntry","type":"panelfunc","description":"Returns the contents of the DTextEntry as a number.","realm":"Client and Menu","file":{"text":"lua/vgui/dtextentry.lua","line":"388-L392"},"rets":{"ret":{"text":"Text of the DTextEntry as a float, or nil if it cannot be converted to a number using Global.tonumber.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetHighlightColor","parent":"DTextEntry","type":"panelfunc","description":"Returns the highlight/text selection color of the text entry. If it was not overwritten, it will return the derma skin value. (`colTextEntryTextHighlight`)","realm":"Client and Menu","rets":{"ret":{"text":"The highlight Global.Color.","name":"","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetHistoryEnabled","parent":"DTextEntry","type":"panelfunc","description":"Returns whether the history functionality of  DTextEntry is enabled. See DTextEntry:AddHistory.","realm":"Client and Menu","rets":{"ret":{"text":"Whether the history is enabled or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetInt","parent":"DTextEntry","type":"panelfunc","description":"Similar to DTextEntry:GetFloat, but rounds the value to the nearest integer.","realm":"Client and Menu","file":{"text":"lua/vgui/dtextentry.lua","line":"379-L386"},"rets":{"ret":{"text":"Text of the DTextEntry as a round number, or nil if it cannot be converted to a number.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetNumeric","parent":"DTextEntry","type":"panelfunc","description":"Returns whether only numeric characters (`123456789.-`) can be entered into the DTextEntry.","realm":"Client and Menu","rets":{"ret":{"text":"Whether the DTextEntry is numeric or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetPaintBackground","parent":"DTextEntry","type":"panelfunc","description":"Whether the background is displayed or not","realm":"Client and Menu","rets":{"ret":{"text":"`false` hides the background; this is `true` by default.","name":"show","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetPlaceholderColor","parent":"DTextEntry","type":"panelfunc","description":"Return current color of panel placeholder","realm":"Client and Menu","rets":{"ret":{"text":"Current placeholder color","name":"","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetPlaceholderText","parent":"DTextEntry","type":"panelfunc","description":"Returns the placeholder text set with DTextEntry:SetPlaceholderText.","realm":"Client and Menu","rets":{"ret":{"type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTabbingDisabled","parent":"DTextEntry","type":"panelfunc","description":{"text":"Returns whether or not the panel accepts  key.","key":"tab"},"realm":"Client and Menu","rets":{"ret":{"text":"Whether the DTextEntry should ignore .","name":"","type":"boolean","key":"tab"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetTextColor","parent":"DTextEntry","type":"panelfunc","description":"Returns the text color of a DTextEntry.","realm":"Client and Menu","rets":{"ret":{"text":"The color of the text as a Color.","name":"","type":"Color"}}},"example":{"code":"local TextEntry = vgui.Create( \"DTextEntry\" )\nTextEntry:SetTextColor( Color( 255, 0, 0, 255 ))\nPrintTable( TextEntry:GetTextColor() )","output":"Prints the R, G, B and A of the text color."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetUpdateOnType","parent":"DTextEntry","type":"panelfunc","description":"Returns whether the DTextEntry is set to run DTextEntry:OnValueChange every time a character is typed or deleted or only when Enter is pressed.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsEditing","parent":"DTextEntry","type":"panelfunc","description":"Returns whether this DTextEntry is being edited or not. (i.e. has focus)","realm":"Client and Menu","file":{"text":"lua/vgui/dtextentry.lua","line":"64-L66"},"rets":{"ret":{"text":"Whether this DTextEntry is being edited or not","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnTextChanged","parent":"DTextEntry","type":"panelfunc","description":{"text":"Called internally when the text inside the DTextEntry changes. This is an implementation of TextEntry:OnTextChanged\n\nYou should not override this function. Use DTextEntry:OnValueChange instead.","internal":""},"realm":"Client and Menu","file":{"text":"lua/vgui/dtextentry.lua","line":"188-L208"},"args":{"arg":{"text":"Determines whether to remove the autocomplete menu (false) or not (true).","name":"noMenuRemoval","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OpenAutoComplete","parent":"DTextEntry","type":"panelfunc","file":{"text":"lua/vgui/dtextentry.lua","line":"213-L232"},"description":{"text":"Builds a DMenu for the DTextEntry based on the input table.","internal":"You really should be using DTextEntry:GetAutoComplete instead."},"realm":"Client and Menu","args":{"arg":{"text":"Table containing results from DTextEntry:GetAutoComplete.","name":"tab","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetCursorColor","parent":"DTextEntry","type":"panelfunc","description":"Sets the cursor's color in  DTextEntry (the blinking line).","realm":"Client and Menu","args":{"arg":{"text":"The color to set the cursor to.","name":"color","type":"Color"}}},"example":{"description":"Creates a panel and a DTextEntry, and then sets the cursor color. \n(As seen on https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index9051.html)","code":"local ParentPanel = vgui.Create(\"DFrame\")\n\tParentPanel:SetSize(ScrW()/7, ScrH()/12)\n\tParentPanel:Center()\n\tParentPanel:SetTitle(\"Cursor Color Test\")\n\tParentPanel:SetDeleteOnClose(true)\n\tParentPanel:MakePopup()\n \nlocal TextEntry = vgui.Create( \"DTextEntry\", ParentPanel )\n\tTextEntry:SetSize(ScrW()/9, ScrH()/30)\n\tTextEntry:SetValue(\"Cursor Color Test \")\n\tTextEntry:SetPos(ParentPanel:GetWide()/2-TextEntry:GetWide()/2,\n\tParentPanel:GetTall()/2-TextEntry:GetTall()/5)\n\tTextEntry:SetEnterAllowed(false)\n \n\t-- Uses Simple RGBA (Red, Green, Blue, Alpha) Colors. --\n\tTextEntry:SetCursorColor(Color(255,0,0,255))\n \n\tTextEntry:RequestFocus()","output":"Makes the text entry's cursor color red."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDisabled","parent":"DTextEntry","type":"panelfunc","description":{"text":"Disables input on a DTextEntry and greys it out visually. This differs from DTextEntry:SetEditable which doesn't visually change the textbox.","deprecated":"Use Panel:SetEnabled instead."},"realm":"Client and Menu","file":{"text":"lua/vgui/dtextentry.lua","line":"313-L315"},"args":{"arg":{"text":"Whether the textbox should be disabled","name":"disabled","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDrawBackground","parent":"DTextEntry","type":"panelfunc","description":{"text":"Alias of DTextEntry:SetPaintBackground. Use that instead.","deprecated":""},"realm":"Client and Menu","args":{"arg":{"name":"show","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDrawBorder","parent":"DTextEntry","type":"panelfunc","description":{"text":"Does nothing.","deprecated":""},"realm":"Client and Menu","args":{"arg":{"name":"bool","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetEditable","parent":"DTextEntry","type":"panelfunc","description":"Disables Input on a DTextEntry. This differs from DTextEntry:SetDisabled - SetEditable will not affect the appearance of the textbox.","realm":"Client and Menu","file":{"text":"lua/vgui/dtextentry.lua","line":"329-L334"},"args":{"arg":{"text":"Whether the DTextEntry should be editable","name":"enabled","type":"boolean"}}},"example":{"code":"local TextEntry = vgui.Create( \"DTextEntry\", frame ) -- create the form as a child of frame\nTextEntry:SetPos( 25, 50 )\nTextEntry:SetSize( 75, 85 )\nTextEntry:SetText( \"Sample String\" )\nTextEntry:SetEditable( false )"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetEnterAllowed","parent":"DTextEntry","type":"panelfunc","description":"Sets whether pressing the Enter key will cause the DTextEntry to lose focus or not, provided it is not multiline. This is true by default.","realm":"Client and Menu","args":{"arg":{"text":"If set to false, pressing Enter will not cause the panel to lose focus and will never call DTextEntry:OnEnter.","name":"allowEnter","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetFont","parent":"DTextEntry","type":"panelfunc","description":"Changes the font of the DTextEntry.","realm":"Client and Menu","args":{"arg":{"text":"The name of the font to be changed to.","name":"font","type":"string"}}},"example":{"description":"Restores the original font the the DTextEntry.","code":"local textentry = vgui.Create(\"DTextEntry\")\ntextentry:SetFont(\"DermaDefault\")"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetHighlightColor","parent":"DTextEntry","type":"panelfunc","description":"Sets/overrides the default highlight/text selection color of the text entry.","realm":"Client and Menu","args":{"arg":{"text":"The new highlight Color.","name":"color","type":"Color"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetHistoryEnabled","parent":"DTextEntry","type":"panelfunc","description":"Enables or disables the history functionality of  DTextEntry. This allows the player to scroll through history elements using up and down arrow keys.\n\nSee DTextEntry:AddHistory.","realm":"Client and Menu","args":{"arg":{"text":"Whether to enable history or not.","name":"enable","type":"boolean"}}},"example":{"description":"A common example.","code":"local textentry = vgui.Create(\"DTextEntry\")\ntextentry:SetHistoryEnabled(true)\ntextentry.History = {\n\t\"Message 1\",\n\t\"Message 2\"\n}"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetNumeric","parent":"DTextEntry","type":"panelfunc","description":"Sets whether or not to decline non-numeric characters as input.\n\nNumeric characters are `1234567890.-`","realm":"Client and Menu","args":{"arg":{"text":"Whether to accept only numeric characters.","name":"numericOnly","type":"boolean"}}},"example":{"code":"local TextEntry = vgui.Create( \"DTextEntry\" )\nTextEntry:SetNumeric(true)","output":"Only allow numeric characters."},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetPaintBackground","parent":"DTextEntry","type":"panelfunc","description":"Sets whether to show the default background of the DTextEntry.","realm":"Client and Menu","args":{"arg":{"text":"`false` hides the background; this is `true` by default.","name":"show","type":"boolean"}}},"example":{"description":"Overrides the background of a DTextEntry and changes its color on every text change.","code":"local frame = vgui.Create( \"DFrame\" )\n    frame:SetTitle(\"Colored TextEntry!\")\n    frame:SetSize( 300, 100 )\n    frame:Center()\n    frame:MakePopup()\n\n    tEntryBG = vgui.Create(\"DPanel\", frame)\n    tEntryBG:Dock(TOP)\n    tEntryBG:SetBackgroundColor(color_white)\n\n    tEntry = vgui.Create(\"DTextEntry\", tEntryBG)\n    tEntry:SetPaintBackground(false)\n    tEntry:Dock(FILL)\n\n    tEntry.OnChange = function()\n        tEntryBG:SetBackgroundColor(ColorRand())\n    end","output":{"upload":{"src":"b4b46/8db9418b5fb5bf1.gif","size":"207110","name":"bgoverride.gif"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetPlaceholderColor","parent":"DTextEntry","type":"panelfunc","description":"Allow you to set placeholder color.","realm":"Client and Menu","args":{"arg":{"text":"The color of the placeholder.","name":"color","type":"Color","default":"Color(128, 128, 128)"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetPlaceholderText","parent":"DTextEntry","type":"panelfunc","description":"Sets the placeholder text that will be shown while the text entry has no user text. The player will not need to delete the placeholder text if they decide to start typing.","realm":"Client and Menu","args":{"arg":{"name":"text","type":"string","default":"nil"}}},"example":{"description":"This example shows what the placeholder text looks like","code":"concommand.Add( \"test_textentry\", function(ply)\n\tlocal frame = vgui.Create( \"DFrame\" )\n\tframe:SetSize( 400, 200 )\n\tframe:Center()\n\tframe:MakePopup()\n\n\tlocal TextEntry = vgui.Create( \"DTextEntry\", frame ) -- create the form as a child of frame\n\tTextEntry:Dock( TOP )\n\tTextEntry.OnEnter = function( self )\n\t\tchat.AddText( self:GetValue() )\t-- print the form's text as server text\n\tend\n\n\tlocal TextEntryPH = vgui.Create( \"DTextEntry\", frame ) -- create the form as a child of frame\n\tTextEntryPH:Dock( TOP )\n\tTextEntryPH:DockMargin( 0, 5, 0, 0 )\n\tTextEntryPH:SetPlaceholderText( \"I am a placeholder\" )\n\tTextEntryPH.OnEnter = function( self )\n\t\tchat.AddText( self:GetValue() )\t-- print the form's text as server text\n\tend\nend )","output":{"upload":{"src":"70c/8d88bebe8e67219.png","size":"11372","name":"image.png"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTabbingDisabled","parent":"DTextEntry","type":"panelfunc","description":{"text":"Sets whether or not the panel accepts  key.","key":"tab","note":"Disabling tab key prevents the panel from unfocusing by mouse, however, still works for focusing to other keyboard focus."},"realm":"Client and Menu","args":{"arg":{"text":"Whether the DTextEntry should ignore .","name":"enabled","type":"boolean","key":"tab"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetTextColor","parent":"DTextEntry","type":"panelfunc","description":"Sets the text color of the DTextEntry.","realm":"Client and Menu","args":{"arg":{"text":"The text color. Uses the Color.","name":"color","type":"Color"}}},"example":{"description":"Changes the text color inside the DTextEntry to the color red.","code":"local Frame = vgui.Create(\"DFrame\")\nFrame:SetSize(200,200)\nFrame:Center()\nFrame:MakePopup()\n\nlocal TextEntry = vgui.Create(\"DTextEntry\", Frame)\nTextEntry:SetSize(180,20)\nTextEntry:SetPos(10,80)\nTextEntry:SetTextColor(Color(255,20,20))\nTextEntry:SetValue(\"Basic Text\")"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetUpdateOnType","parent":"DTextEntry","type":"panelfunc","description":"Sets whether we should fire DTextEntry:OnValueChange every time we type or delete a character or only when Enter is pressed.","realm":"Client and Menu","args":{"arg":{"name":"updateOnType","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetValue","parent":"DTextEntry","type":"panelfunc","description":{"text":"Sets the text of the DTextEntry and calls DTextEntry:OnValueChange.","note":"The text of the DTextEntry only changes if it's not currently being typed in. If you would rather set the text regardless, use Panel:SetText."},"realm":"Client and Menu","file":{"text":"lua/vgui/dtextentry.lua","line":"277-L290"},"args":{"arg":{"text":"The value to set.","name":"text","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateConvarValue","parent":"DTextEntry","type":"panelfunc","description":{"text":"Updates the ConVar associated with the TextEntry to its new value.","internal":"Used by DTextEntry:OnTextChanged, DTextEntry:OnEnter and DTextEntry:OnLoseFocus"},"realm":"Client and Menu","file":{"text":"lua/vgui/dtextentry.lua","line":"256-L262"}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateFromHistory","parent":"DTextEntry","type":"panelfunc","description":{"text":"Used internally to set text from the history.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"UpdateFromMenu","parent":"DTextEntry","type":"panelfunc","description":{"text":"Used internally to set text from the autocomplete menu.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnModified","parent":"DTileLayout","type":"panelhook","description":"Called when anything is dropped on or rearranged within the DTileLayout.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"ClearTiles","parent":"DTileLayout","type":"panelfunc","description":{"text":"Clears the panel's tile table. Used by DTileLayout:LayoutTiles.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"ConsumeTiles","parent":"DTileLayout","type":"panelfunc","description":{"text":"Called to designate a range of tiles as occupied by a panel.","internal":""},"realm":"Client","args":{"arg":[{"text":"The x coordinate of the top-left corner of the panel.","name":"x","type":"number"},{"text":"The y coordinate of the top-left corner of the panel.","name":"y","type":"number"},{"text":"The panel's width.","name":"w","type":"number"},{"text":"The panel's height.","name":"h","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Copy","parent":"DTileLayout","type":"panelfunc","description":"Creates and returns an exact copy of the DTileLayout.","realm":"Client","rets":{"ret":{"text":"The created copy.","name":"","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"CopyContents","parent":"DTileLayout","type":"panelfunc","description":"Creates copies of all the children from the given panel object and parents them to this one.","realm":"Client","args":{"arg":{"text":"The source panel from which to copy all children.","name":"source","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"FindFreeTile","parent":"DTileLayout","type":"panelfunc","description":{"text":"Finds the coordinates of the first group of free tiles that fit the given size.","internal":""},"realm":"Client","args":{"arg":[{"text":"The x coordinate to start looking from.","name":"x","type":"number"},{"text":"The y coordinate to start looking from.","name":"y","type":"number"},{"text":"The needed width.","name":"w","type":"number"},{"text":"The needed height.","name":"h","type":"number"}]},"rets":{"ret":[{"text":"The x coordinate of the found available space.","name":"","type":"number"},{"text":"The y coordinate of the found available space.","name":"","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"FitsInTile","parent":"DTileLayout","type":"panelfunc","description":{"text":"Determines if a group of tiles is vacant.","internal":""},"realm":"Client","args":{"arg":[{"text":"The x coordinate of the first tile.","name":"x","type":"number"},{"text":"The y coordinate of the first tile.","name":"y","type":"number"},{"text":"The width needed.","name":"w","type":"number"},{"text":"The height needed.","name":"h","type":"number"}]},"rets":{"ret":{"text":"Whether or not this group is available for occupation.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetBaseSize","parent":"DTileLayout","type":"panelfunc","description":"Returns the size of each single tile, set with DTileLayout:SetBaseSize.","realm":"Client","rets":{"ret":{"text":"Base tile size.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetBorder","parent":"DTileLayout","type":"panelfunc","description":"Returns the border spacing set by DTileLayout:SetBorder.","realm":"Client","rets":{"ret":{"text":"The border spacing","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetMinHeight","parent":"DTileLayout","type":"panelfunc","description":"Returns the minimum height the DTileLayout can resize to.","realm":"Client","rets":{"ret":{"text":"The minimum height the panel can shrink to.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetSpaceX","parent":"DTileLayout","type":"panelfunc","description":"Returns the X axis spacing between 2 elements set by DTileLayout:SetSpaceX.","realm":"Client","rets":{"ret":{"name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetSpaceY","parent":"DTileLayout","type":"panelfunc","description":"Returns the Y axis spacing between 2 elements set by DTileLayout:SetSpaceY.","realm":"Client","rets":{"ret":{"name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTile","parent":"DTileLayout","type":"panelfunc","description":{"text":"Gets the occupied state of a tile.","internal":""},"realm":"Client","args":{"arg":[{"text":"The x coordinate of the tile.","name":"x","type":"number"},{"text":"The y coordinate of the tile.","name":"y","type":"number"}]},"rets":{"ret":{"text":"The occupied state of the tile, normally `1` or `nil`.","name":"","type":"any"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Layout","parent":"DTileLayout","type":"panelfunc","description":"Resets the last width/height info, and invalidates the panel's layout, causing it to recalculate all child positions. It is called whenever a child is added or removed, and can be called to refresh the panel.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"LayoutTiles","parent":"DTileLayout","type":"panelfunc","description":{"text":"Called by PANEL:PerformLayout to arrange and lay out the child panels, if it has changed in size.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetBaseSize","parent":"DTileLayout","type":"panelfunc","description":"Sets the size of a single tile. If a child panel is larger than this size, it will occupy several tiles.\n\nIf you are setting the size of the children properly then you probably don't need to change this.","realm":"Client","args":{"arg":{"text":"The size of each tile. It is recommended you use `2ⁿ` (`16, 32, 64...`) numbers, and those above `4`, as numbers lower than this will result in many tiles being processed and therefore slow operation.","name":"size","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetBorder","parent":"DTileLayout","type":"panelfunc","description":"Sets the spacing between the border/edge of the DTileLayout and all the elements inside.","realm":"Client","args":{"arg":{"name":"border","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetMinHeight","parent":"DTileLayout","type":"panelfunc","description":"Determines the minimum height the DTileLayout will resize to. This is useful if child panels will be added/removed often.","realm":"Client","args":{"arg":{"text":"The minimum height the panel can shrink to.","name":"minH","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetSpaceX","parent":"DTileLayout","type":"panelfunc","description":"Sets the spacing between 2 elements in the DTileLayout on the X axis.","realm":"Client","args":{"arg":{"text":"New X axis spacing.","name":"spacingX","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetSpaceY","parent":"DTileLayout","type":"panelfunc","description":"Sets the spacing between 2 elements in the DTileLayout on the Y axis.","realm":"Client","args":{"arg":{"text":"New Y axis spacing.","name":"spaceY","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetTile","parent":"DTileLayout","type":"panelfunc","description":{"text":"Called to set the occupied state of a tile.","internal":""},"realm":"Client","args":{"arg":[{"text":"The x coordinate of the tile.","name":"x","type":"number"},{"text":"The y coordinate of the tile.","name":"y","type":"number"},{"text":"The new state of the tile, normally `1` or `nil`.","name":"state","type":"any"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Close","parent":"DTooltip","type":"panelfunc","description":"Forces the tooltip to close. This will remove the panel.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DrawArrow","parent":"DTooltip","type":"panelfunc","description":{"text":"Used to draw a triangle beneath the DTooltip","note":"Requires DTooltip:SetContents, without this it will error"},"realm":"Client and Menu","args":{"arg":[{"text":"arrow location on the x axis","name":"x","type":"number"},{"text":"arrow location on the y axis","name":"y","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OpenForPanel","parent":"DTooltip","type":"panelfunc","description":{"text":"Sets up the tooltip for display for given panel and starts the timer.\n\nNormally you wouldn't call this and you'd use Panel:SetTooltip, Panel:SetTooltipPanel or Panel:SetTooltipPanelOverride.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The panel to open the tooltip for.","name":"pnl","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PositionTooltip","parent":"DTooltip","type":"panelfunc","description":{"text":"Positions the DTooltip so it doesn't stay in the same draw position.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetContents","parent":"DTooltip","type":"panelfunc","description":{"text":"What Panel you want put inside of the DTooltip","note":"You can only have one Panel at a time; use Parenting to add more"},"realm":"Client and Menu","args":{"arg":[{"text":"Contents","name":"panel","type":"Panel"},{"text":"If set to true, the panel in the first argument will be automatically removed when DTooltip is closed via DTooltip:Close.","name":"delete","type":"boolean","default":"false"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ChildExpanded","parent":"DTree","type":"panelhook","description":{"text":"Calls directly to Panel:InvalidateLayout.\nCalled by DTree_Nodes when a sub element has been expanded or collapsed.\n\nUsed as a placeholder function alongside DTree:ExpandTo, DTree:SetExpanded and DTree:MoveChildTo.\n\nThe DTree acts a root node and methods with the same name in DTree_Node call to the parent.","internal":""},"realm":"Client and Menu","args":{"arg":{"name":"bExpand","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DoClick","parent":"DTree","type":"panelhook","description":"Called when the any node is clicked. Called by DTree_Node:DoClick.","realm":"Client and Menu","args":{"arg":{"text":"The right clicked node.","name":"node","type":"DTree_Node"}},"rets":{"ret":{"name":"suppress","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DoRightClick","parent":"DTree","type":"panelhook","description":"Called when the any node is right clicked. Called by DTree_Node:DoRightClick.","realm":"Client and Menu","args":{"arg":{"text":"The right clicked node.","name":"node","type":"DTree_Node"}},"rets":{"ret":{"name":"suppress","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnNodeSelected","parent":"DTree","type":"panelhook","description":"This function is called when a node within a tree is selected.","realm":"Client and Menu","args":{"arg":{"text":"The node that was selected.","name":"node","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddNode","parent":"DTree","type":"panelfunc","description":"Add a node to the DTree","realm":"Client and Menu","args":{"arg":[{"text":"Name of the option.","name":"name","type":"string"},{"text":"The icon that will show nexto the node in the DTree.","name":"icon","type":"string","default":"icon16/folder.png"}]},"rets":{"ret":{"text":"Returns the created DTree_Node panel.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ExpandTo","parent":"DTree","type":"panelfunc","description":{"text":"Does nothing. Used as a placeholder empty function alongside DTree:MoveChildTo, DTree:SetExpanded and DTree:ChildExpanded.\n\nThe DTree acts a root node and methods with the same name in DTree_Node call to the parent.","internal":""},"realm":"Client and Menu","args":{"arg":{"name":"bExpand","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetClickOnDragHover","parent":"DTree","type":"panelfunc","description":"Returns the status of DTree:SetClickOnDragHover. See that for more info.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetIndentSize","parent":"DTree","type":"panelfunc","description":"Returns the indentation size of the DTree, the distance between each \"level\" of the tree is offset on the left from the previous level.\n\nCurrently this feature has no effect on the DTree element.","realm":"Client and Menu","rets":{"ret":{"text":"The indentation size.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetLineHeight","parent":"DTree","type":"panelfunc","description":"Returns the height of each DTree_Node in the tree.","realm":"Client and Menu","rets":{"ret":{"text":"The height of each DTree_Node in the tree.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetSelectedItem","parent":"DTree","type":"panelfunc","description":"Returns the currently selected node.","realm":"Client and Menu","rets":{"ret":{"text":"Curently selected DTree_Node.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetShowIcons","parent":"DTree","type":"panelfunc","description":"Returns whether or not the Silkicons next to each node of the DTree will be displayed.\n\nIndividual icons can be set with DTree_Node:SetIcon or passed as the second argument in DTree:AddNode.","realm":"Client and Menu","rets":{"ret":{"text":"Whether or not the silkicons next to each node will be displayed.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"LayoutTree","parent":"DTree","type":"panelfunc","description":{"text":"Does nothing.","deprecated":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MoveChildTo","parent":"DTree","type":"panelfunc","description":"Moves given node to the top of DTrees children. (Makes it the topmost mode)\n\nUsed as a placeholder function alongside DTree:ExpandTo, DTree:SetExpanded and DTree:ChildExpanded.\n\nThe DTree acts a root node and methods with the same name in DTree_Node call to the parent.","realm":"Client and Menu","args":{"arg":[{"text":"The node to move","name":"child","type":"Panel"},{"text":"Unused, does nothing.","name":"pos","type":"number","deprecated":""}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Root","parent":"DTree","type":"panelfunc","description":"Returns the root DTree_Node, the node that is the parent to all other nodes of the DTree.","realm":"Client and Menu","rets":{"ret":{"text":"Root node.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetClickOnDragHover","parent":"DTree","type":"panelfunc","description":"Enables the \"click when drag-hovering\" functionality.\n\nIf enabled, when hovering over any DTree_Node of this DTree while dragging a panel, the node will be automatically clicked on (and subsequently DTree:OnNodeSelected will be called) to open any attached panels, such as spawnlists in spawnmenu.\n\nSee also: PANEL:DragHoverClick.","realm":"Client and Menu","args":{"arg":{"name":"enable","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetExpanded","parent":"DTree","type":"panelfunc","description":{"text":"Does nothing. Is not called by the DTree itself.\n\nUsed as a placeholder empty function alongside DTree:ExpandTo, DTree:MoveChildTo and DTree:ChildExpanded to prevent errors when DTree_Node:SetExpanded is incorrectly used on a DTree.","internal":""},"realm":"Client and Menu","args":{"arg":{"name":"bExpand","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetIndentSize","parent":"DTree","type":"panelfunc","description":"Sets the indentation size of the DTree, the distance between each \"level\" of the tree is offset on the left from the previous level.\n\nCurrently this feature has no effect on the DTree element.","realm":"Client and Menu","args":{"arg":{"text":"The new indentation size.","name":"size","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetLineHeight","parent":"DTree","type":"panelfunc","description":"Sets the height of each DTree_Node in the tree.\n\nThe default value is 17.","realm":"Client and Menu","args":{"arg":{"text":"The height to set.","name":"h","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSelectedItem","parent":"DTree","type":"panelfunc","description":"Set the currently selected top-level node.","realm":"Client and Menu","args":{"arg":{"text":"DTree_Node to select.","name":"node","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetShowIcons","parent":"DTree","type":"panelfunc","description":"Sets whether or not the Silkicons next to each node of the DTree will be displayed.\n\nIndividual icons can be set with DTree_Node:SetIcon or passed as the second argument in DTree:AddNode.","realm":"Client and Menu","args":{"arg":{"text":"Whether or not to show icons.","name":"show","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ShowIcons","parent":"DTree","type":"panelfunc","description":"Returns whether or not the Silkicons next to each node of the DTree will be displayed.\n\nAlias of DTree:GetShowIcons.","realm":"Client and Menu","rets":{"ret":{"text":"Whether or not the silkicons next to each node will be displayed.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DoChildrenOrder","parent":"DTree_Node","type":"panelhook","description":{"text":"Called automatically to update the status of DTree_Node:GetLastChild on children of this node.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DoClick","parent":"DTree_Node","type":"panelhook","description":"Called when the node is clicked.\n\nSee also DTree_Node:DoRightClick.","realm":"Client and Menu","rets":{"ret":{"text":"Return true to prevent DoClick from being called on parent nodes or the DTree itself.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DoRightClick","parent":"DTree_Node","type":"panelhook","description":"Called when the node is right clicked.\n\nSee also DTree_Node:DoClick.","realm":"Client and Menu","rets":{"ret":{"text":"Return true to prevent DoRightClick from being called on parent nodes or the DTree itself.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnModified","parent":"DTree_Node","type":"panelhook","description":"Called when sub-nodes of this DTree_Node were changed, such as being rearranged if that functionality is enabled.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnNodeAdded","parent":"DTree_Node","type":"panelhook","description":"Called when a new sub-node is added this node.","realm":"Client and Menu","added":"2021.03.31","args":{"arg":{"text":"The newly added sub node.","name":"newNode","type":"DTree_Node"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnNodeSelected","parent":"DTree_Node","type":"panelhook","description":{"text":"Called when this or a sub node is selected. Do not use this, it is not for override.\n\nUse DTree:OnNodeSelected or DTree_Node:DoClick instead.","internal":""},"realm":"Client and Menu","args":{"arg":{"name":"node","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddFolder","parent":"DTree_Node","type":"panelfunc","description":"A helper function that adds a new node and calls to DTree_Node:MakeFolder on it.","realm":"Client and Menu","args":{"arg":[{"text":"The name of the new node","name":"name","type":"string"},{"text":"The folder in the filesystem to use, relative to the garrysmod/ folder.","name":"folder","type":"string"},{"text":"The path to search in. See File Search Paths","name":"path","type":"string"},{"text":"Should files be added as nodes (true) or folders only (false)","name":"showFiles","type":"boolean","default":"false"},{"text":"The wildcard to use when searching for files.","name":"wildcard","type":"string","default":"*"},{"name":"bDontForceExpandable","type":"boolean","default":"false"}]},"rets":{"ret":{"text":"The created DTree_Node","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddNode","parent":"DTree_Node","type":"panelfunc","description":"Add a child node to the DTree_Node","realm":"Client and Menu","args":{"arg":[{"text":"Name of the node.","name":"name","type":"string"},{"text":"The icon that will show next to the node in the DTree.","name":"icon","type":"string","default":"icon16/folder.png"}]},"rets":{"ret":{"text":"Returns the created DTree_Node panel.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AddPanel","parent":"DTree_Node","type":"panelfunc","description":{"text":"Adds the given panel to the child nodes list, a DListLayout.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The panel to add.","name":"pnl","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AnimSlide","parent":"DTree_Node","type":"panelfunc","description":{"text":"Internal function that handles the expand/collapse animations.","internal":""},"realm":"Client and Menu","args":{"arg":[{"name":"anim","type":"table"},{"name":"delta","type":"number"},{"name":"data","type":"table"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ChildExpanded","parent":"DTree_Node","type":"panelfunc","description":{"text":"Called when a child node is expanded or collapsed to propagate this event to parent nodes to update layout.","internal":""},"realm":"Client and Menu","args":{"arg":{"name":"expanded","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CleanList","parent":"DTree_Node","type":"panelfunc","description":"Cleans up the internal table of items (sub-nodes) of this node from invalid panels or sub-nodes that were moved from this node to another.\n\nAppears the be completely unused by the game on its own.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Copy","parent":"DTree_Node","type":"panelfunc","description":"Create and returns a copy of this node, including all the sub-nodes.","realm":"Client and Menu","rets":{"ret":{"text":"The copied DTree_Node.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CreateChildNodes","parent":"DTree_Node","type":"panelfunc","description":{"text":"Creates the container DListLayout for the DTree_Nodes.\n\nThis is called automatically so you don't have to.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ExpandRecurse","parent":"DTree_Node","type":"panelfunc","description":"Expands or collapses this node, as well as ALL child nodes of this node.\n\nWorks opposite of DTree_Node:ExpandTo.","realm":"Client and Menu","args":{"arg":{"text":"Whether to expand (true) or collapse (false)","name":"expand","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ExpandTo","parent":"DTree_Node","type":"panelfunc","description":"Collapses or expands all nodes from the topmost-level node to this one.\n\nWorks opposite of DTree_Node:ExpandRecurse.","realm":"Client and Menu","args":{"arg":{"text":"Whether to expand (true) or collapse (false)","name":"expand","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"FilePopulate","parent":"DTree_Node","type":"panelfunc","description":{"text":"Called automatically from DTree_Node:PopulateChildrenAndSelf and DTree_Node:PopulateChildren to populate this node with child nodes of files and folders.","internal":""},"realm":"Client and Menu","args":{"arg":[{"text":"Does nothing. Set to true if called from DTree_Node:PopulateChildren.","name":"bAndChildren","type":"boolean"},{"text":"Expand self once population process is finished.","name":"bExpand","type":"boolean"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"FilePopulateCallback","parent":"DTree_Node","type":"panelfunc","description":{"text":"Called automatically from DTree_Node:FilePopulate to actually fill the node with sub-nodes based on set preferences like should files be added, etc.","internal":""},"realm":"Client and Menu","args":{"arg":[{"text":"A list of files in this folder","name":"files","type":"table"},{"text":"A list of folder in this folder.","name":"folders","type":"table"},{"text":"The folder name/path this node represents","name":"foldername","type":"string"},{"text":"The Path ID search was performed with. See File Search Paths","name":"path","type":"string"},{"text":"Inherited from the **FilePopulate** call. Does nothing","name":"bAndChildren","type":"boolean"},{"text":"The wildcard that was given","name":"wildcard","type":"string"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetChildNode","parent":"DTree_Node","type":"panelfunc","description":"Returns n-th child node.\n\nBasically an alias of Panel:GetChild.","realm":"Client and Menu","args":{"arg":{"text":"The number of the child to get, starting with 0","name":"num","type":"number"}},"rets":{"ret":{"text":"The child panel, if valid ID is given","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetChildNodeCount","parent":"DTree_Node","type":"panelfunc","added":"2020.08.12","description":"Returns the number of child nodes this node has. For use with DTree_Node:GetChildNode","realm":"Client and Menu","rets":{"ret":{"text":"Number of child nodes.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetChildNodes","parent":"DTree_Node","type":"panelfunc","added":"2020.08.12","description":"Returns a table containing all child nodes of this node.","realm":"Client and Menu","rets":{"ret":{"text":"A list of all child nodes.","name":"","type":"table"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDirty","parent":"DTree_Node","type":"panelfunc","description":{"text":"Returns value set by DTree_Node:SetDirty.","deprecated":""},"realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDoubleClickToOpen","parent":"DTree_Node","type":"panelfunc","description":"Returns whether the double clock to collapse/expand functionality is enabled on this node.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDraggableName","parent":"DTree_Node","type":"panelfunc","description":{"text":"Returns what is set by DTree_Node:SetDraggableName.","internal":""},"realm":"Client and Menu","rets":{"ret":{"name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetDrawLines","parent":"DTree_Node","type":"panelfunc","description":{"text":"Returns whether or not this node is drawing lines","internal":""},"realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetExpanded","parent":"DTree_Node","type":"panelfunc","description":"Returns whether the node is expanded or not.","realm":"Client and Menu","added":"2021.03.31","rets":{"ret":{"text":"Expanded or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetFileName","parent":"DTree_Node","type":"panelfunc","description":"Returns the filepath of the file attached to this node.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetFolder","parent":"DTree_Node","type":"panelfunc","description":"Returns the folder path to search in, set by DTree_Node:MakeFolder.","realm":"Client and Menu","rets":{"ret":{"text":"The folder path.","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetForceShowExpander","parent":"DTree_Node","type":"panelfunc","description":"Returns whether the expand/collapse button is shown on this node regardless of whether or not it has sub-nodes.\n\nSee also DTree_Node:SetForceShowExpander.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetHideExpander","parent":"DTree_Node","type":"panelfunc","description":"Returns whether the expand button (little + button) should be shown or hidden.","realm":"Client and Menu","rets":{"ret":{"text":"Цhether the expand button should be shown or hidden.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetIcon","parent":"DTree_Node","type":"panelfunc","description":"Returns the image path to the icon of this node.","realm":"Client and Menu","rets":{"ret":{"text":"The path to the image","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetIndentSize","parent":"DTree_Node","type":"panelfunc","description":"Returns the indentation level of the DTree this node belongs to.\n\nAlias of DTree:GetIndentSize, see it for more info.","realm":"Client and Menu","rets":{"ret":{"text":"The indentation level.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetLastChild","parent":"DTree_Node","type":"panelfunc","description":"Returns whether this node is the last child on this level or not.","realm":"Client and Menu","rets":{"ret":{"text":"Whether this node is the last child on this level or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetLineHeight","parent":"DTree_Node","type":"panelfunc","description":"The height of a single DTree_Node of the DTree this node belongs to.\n\nAlias of DTree:GetLineHeight.","realm":"Client and Menu","rets":{"ret":{"text":"The height of a single DTree_Node.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetNeedsChildSearch","parent":"DTree_Node","type":"panelfunc","description":{"text":"Returns whether the node still needs a filesystem search for sub-nodes.","internal":"","deprecated":"Seems to be unused entirely."},"realm":"Client and Menu","rets":{"ret":{"text":"Whether the node still needs a filesystem search.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetNeedsPopulating","parent":"DTree_Node","type":"panelfunc","description":{"text":"Returns whether or not the node is set to be populated from the filesystem.","internal":""},"realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetParentNode","parent":"DTree_Node","type":"panelfunc","description":"Returns the parent DTree_Node. Note that Panel:GetParent will not be the same!","realm":"Client and Menu","rets":{"ret":{"text":"The parent node.","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetPathID","parent":"DTree_Node","type":"panelfunc","description":"Returns the path ID (File Search Paths) used in populating the DTree from the filesystem.\n\nSee DTree_Node:SetPathID and DTree_Node:MakeFolder.","realm":"Client and Menu","rets":{"ret":{"text":"The Path ID","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetRoot","parent":"DTree_Node","type":"panelfunc","description":"Returns the root node, the DTree this node is under.\n\nSee also DTree_Node:GetParentNode.","realm":"Client and Menu","rets":{"ret":{"text":"The root node","name":"","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetShowFiles","parent":"DTree_Node","type":"panelfunc","description":"Returns whether or not nodes for files should/will be added when populating the node from filesystem.","realm":"Client and Menu","rets":{"ret":{"name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetWildCard","parent":"DTree_Node","type":"panelfunc","description":"Returns the wildcard set by DTree_Node:MakeFolder.","realm":"Client and Menu","rets":{"ret":{"text":"The search wildcard","name":"","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Insert","parent":"DTree_Node","type":"panelfunc","description":"Inserts a sub-node into this node before or after the given node.","realm":"Client and Menu","args":{"arg":[{"text":"The DTree_Node to insert.","name":"node","type":"Panel"},{"text":"The node to insert the node above before or after.","name":"nodeNextTo","type":"Panel"},{"text":"true to insert before, false to insert after.","name":"before","type":"boolean"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InsertNode","parent":"DTree_Node","type":"panelfunc","description":{"text":"Inserts an existing node as a \"child\" or a sub-node of this node.\nUsed internally by the drag'n'drop functionality.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"Has to be DTree_Node","name":"node","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InstallDraggable","parent":"DTree_Node","type":"panelfunc","description":{"text":"Called automatically internally.\n\nMakes the target node compatible with this node's drag'n'drop.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The DTree_Node.","name":"node","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InternalDoClick","parent":"DTree_Node","type":"panelfunc","description":{"text":"See DTree_Node:DoClick","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"InternalDoRightClick","parent":"DTree_Node","type":"panelfunc","description":{"text":"See DTree_Node:DoRightClick.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"IsRootNode","parent":"DTree_Node","type":"panelfunc","description":"Returns true if DTree_Node:GetRoot is the same as DTree_Node:GetParentNode of this node.","realm":"Client and Menu","rets":{"ret":{"text":"If this is a root node.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"LeaveTree","parent":"DTree_Node","type":"panelfunc","description":"Removes given node as a sub-node of this node.\n\nIt doesn't actually remove or unparent the panel, just removes it from the internal DListView.","realm":"Client and Menu","args":{"arg":{"text":"The node to remove","name":"pnl","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MakeFolder","parent":"DTree_Node","type":"panelfunc","description":"Makes this node a folder in the filesystem. This will make it automatically populated.\n\nSee also DTree_Node:AddFolder.","realm":"Client and Menu","args":{"arg":[{"text":"The folder in the filesystem to use, relative to the garrysmod/ folder.","name":"folder","type":"string"},{"text":"The path to search in. See File Search Paths","name":"path","type":"string"},{"text":"Should files be added as nodes (true) or folders only (false)","name":"showFiles","type":"boolean","default":"false"},{"text":"The wildcard to use when searching for files.","name":"wildcard","type":"string","default":"*"},{"text":"If set to true, don't show the expand buttons on empty nodes.","name":"dontForceExpandable","type":"boolean","default":"false"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MoveChildTo","parent":"DTree_Node","type":"panelfunc","description":"Moves given panel to the top of the children of this node.\n\nDespite name of this function, it cannot move the children to any position but the topmost.","realm":"Client and Menu","args":{"arg":{"text":"The node to move.","name":"node","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"MoveToTop","parent":"DTree_Node","type":"panelfunc","description":"Moves this node to the top of the level.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PerformRootNodeLayout","parent":"DTree_Node","type":"panelfunc","description":{"text":"Called automatically to perform layout on this node if this node DTree_Node:IsRootNode.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PopulateChildren","parent":"DTree_Node","type":"panelfunc","description":{"text":"Called automatically from DTree_Node:PopulateChildrenAndSelf.","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"PopulateChildrenAndSelf","parent":"DTree_Node","type":"panelfunc","description":{"text":"Called automatically from DTree_Node:SetExpanded (or when user manually expands the node) to populate the node with sub-nodes from the filesystem if this was enabled via DTree_Node:MakeFolder.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"Expand self once population process is finished.","name":"expand","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDirty","parent":"DTree_Node","type":"panelfunc","description":{"text":"Appears to have no effect on the DTree_Node.","deprecated":""},"realm":"Client and Menu","args":{"arg":{"name":"dirty","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDoubleClickToOpen","parent":"DTree_Node","type":"panelfunc","description":"Sets whether double clicking the node should expand/collapse it or not.","realm":"Client and Menu","args":{"arg":{"text":"true to enable, false to disable this functionality.","name":"enable","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDraggableName","parent":"DTree_Node","type":"panelfunc","description":{"text":"Used to store name for sub elements for a Panel:Droppable call.","internal":""},"realm":"Client and Menu","args":{"arg":{"name":"name","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetDrawLines","parent":"DTree_Node","type":"panelfunc","description":{"text":"Sets whether or not this node should draw visual lines.","internal":""},"realm":"Client and Menu","args":{"arg":{"name":"draw","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetExpanded","parent":"DTree_Node","type":"panelfunc","description":"Expands or collapses this node.","realm":"Client and Menu","args":{"arg":[{"text":"Whether to expand (true) or collapse (false)","name":"expand","type":"boolean"},{"text":"Whether to play animation (false) or not (true)","name":"surpressAnimation","type":"boolean","default":"false"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetFileName","parent":"DTree_Node","type":"panelfunc","description":{"text":"Sets the file full filepath to the file attached to this node","internal":""},"realm":"Client and Menu","args":{"arg":{"name":"filename","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetFolder","parent":"DTree_Node","type":"panelfunc","description":{"text":"Sets the folder to search files and folders in.\n\nUse DTree_Node:MakeFolder instead.","internal":""},"realm":"Client and Menu","args":{"arg":{"name":"folder","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetForceShowExpander","parent":"DTree_Node","type":"panelfunc","description":"Sets whether or not the expand/collapse button (+/- button) should be shown on this node regardless of whether it has sub-elements or not.","realm":"Client and Menu","args":{"arg":{"name":"forceShow","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetHideExpander","parent":"DTree_Node","type":"panelfunc","description":{"text":"Sets whether the expand button (little + button) should be shown or hidden.","internal":""},"realm":"Client and Menu","args":{"arg":{"name":"hide","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetIcon","parent":"DTree_Node","type":"panelfunc","description":"Sets the material for the icon of the DTree_Node.","realm":"Client and Menu","args":{"arg":{"text":"The path to the material to be used. Do not include \"materials/\". .pngs are supported.","name":"path","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetLastChild","parent":"DTree_Node","type":"panelfunc","description":{"text":"Called automatically to set whether this node is the last child on this level or not.","internal":""},"realm":"Client and Menu","args":{"arg":{"name":"last","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetNeedsChildSearch","parent":"DTree_Node","type":"panelfunc","description":{"text":"Sets whether the node still needs a filesystem search for sub-nodes.","internal":"","deprecated":"Seems to be unused entirely."},"realm":"Client and Menu","args":{"arg":{"text":"New state.","name":"newState","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetNeedsPopulating","parent":"DTree_Node","type":"panelfunc","description":{"text":"Sets whether or not the node needs populating from the filesystem.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"Whether or not the node needs populating","name":"needs","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetParentNode","parent":"DTree_Node","type":"panelfunc","description":{"text":"Sets the parent node of this node. Not the same as Panel:SetParent.\n\nThis is set automatically, you shouldn't use this.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The panel to set as a parent node for this node","name":"parent","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetPathID","parent":"DTree_Node","type":"panelfunc","description":{"text":"Sets the path ID (File Search Paths) for populating the tree from the filesystem.\n\nUse DTree_Node:MakeFolder instead.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The path ID to set.","name":"path","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetRoot","parent":"DTree_Node","type":"panelfunc","description":{"text":"Sets the root node (the DTree) of this node.\n\nThis is set automatically, you shouldn't use this.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The panel to set as root node.","name":"root","type":"Panel"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetSelected","parent":"DTree_Node","type":"panelfunc","description":{"text":"Called automatically to update the \"selected\" status of this node.","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"Whether this node is currently selected or not.","name":"selected","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetShowFiles","parent":"DTree_Node","type":"panelfunc","description":{"text":"Sets whether or not nodes for files should be added when populating the node from filesystem.","internal":""},"realm":"Client and Menu","args":{"arg":{"name":"showFiles","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetupCopy","parent":"DTree_Node","type":"panelfunc","description":{"text":"Currently does nothing, not implemented.","deprecated":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetWildCard","parent":"DTree_Node","type":"panelfunc","description":{"text":"Sets the search wildcard.\n\nUse DTree_Node:MakeFolder instead","internal":""},"realm":"Client and Menu","args":{"arg":{"text":"The wildcard to set","name":"wildcard","type":"string"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ShowIcons","parent":"DTree_Node","type":"panelfunc","description":"Returns whether or not the DTree this node is in has icons enabled.\n\nSee DTree:ShowIcons for more info.","realm":"Client and Menu","rets":{"ret":{"text":"Whether the icons are shown or not","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"DoConstraints","parent":"DVerticalDivider","type":"panelfunc","description":{"text":"Used internally to clamp the vertical divider to DVerticalDivider:GetTopMin and DVerticalDivider:GetBottomMin.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetBottom","parent":"DVerticalDivider","type":"panelfunc","description":"Returns the bottom content panel of the DVerticalDivider.","realm":"Client","rets":{"ret":{"text":"The bottom content panel.","name":"","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetBottomMin","parent":"DVerticalDivider","type":"panelfunc","description":"Returns the minimum height of the bottom content panel.","realm":"Client","rets":{"ret":{"text":"The minimum height of the bottom content panel.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetDividerHeight","parent":"DVerticalDivider","type":"panelfunc","description":"Returns the height of the divider bar between the top and bottom content panels of the DVerticalDivider.","realm":"Client","rets":{"ret":{"text":"The height of the divider bar.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetDragging","parent":"DVerticalDivider","type":"panelfunc","description":"Returns whether the divider is being dragged or not.","realm":"Client","rets":{"ret":{"text":"If true, mouse movement will alter the size of the divider.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetHoldPos","parent":"DVerticalDivider","type":"panelfunc","description":{"text":"Returns the local Y position of where the user starts dragging the divider.","internal":""},"realm":"Client","rets":{"ret":{"text":"The local Y position where divider dragging has started.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetMiddle","parent":"DVerticalDivider","type":"panelfunc","description":"Returns the middle content panel of the DVerticalDivider.","realm":"Client","rets":{"ret":{"text":"The middle content panel.","name":"","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTop","parent":"DVerticalDivider","type":"panelfunc","description":"Returns the top content panel of the DVerticalDivider.","realm":"Client","rets":{"ret":{"text":"The top content panel.","name":"","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTopHeight","parent":"DVerticalDivider","type":"panelfunc","description":"Returns the current height of the top content panel set by DVerticalDivider:SetTopHeight or by the user.","realm":"Client","rets":{"ret":{"text":"The current height of the DVerticalDivider.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTopMax","parent":"DVerticalDivider","type":"panelfunc","description":"Returns the maximum height of the top content panel. See DVerticalDivider:SetTopMax for more information.","realm":"Client","rets":{"ret":{"text":"The maximum height of the top content panel.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetTopMin","parent":"DVerticalDivider","type":"panelfunc","description":"Returns the minimum height of the top content panel.","realm":"Client","rets":{"ret":{"text":"The minimum height of the top content panel.","name":"","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetBottom","parent":"DVerticalDivider","type":"panelfunc","description":"Sets the passed panel as the bottom content of the DVerticalDivider.","realm":"Client","args":{"arg":{"text":"The panel to set as the bottom content.","name":"pnl","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetBottomMin","parent":"DVerticalDivider","type":"panelfunc","description":"Sets the minimum height of the bottom content panel.","realm":"Client","args":{"arg":{"text":"The minimum height of the bottom content panel. Default is 50.","name":"height","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetDividerHeight","parent":"DVerticalDivider","type":"panelfunc","description":"Sets the height of the divider bar between the top and bottom content panels of the DVerticalDivider.","realm":"Client","args":{"arg":{"text":"The height of the divider bar.","name":"height","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetDragging","parent":"DVerticalDivider","type":"panelfunc","description":{"text":"Sets whether the divider is being dragged or not.","internal":""},"realm":"Client","args":{"arg":{"text":"Setting this to true causes cursor movement to alter the position of the divider.","name":"isDragging","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetHoldPos","parent":"DVerticalDivider","type":"panelfunc","description":{"text":"Sets the local Y position of where the user starts dragging the divider.","internal":""},"realm":"Client","args":{"arg":{"text":"The local Y position where divider dragging has started.","name":"y","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetMiddle","parent":"DVerticalDivider","type":"panelfunc","description":"Places the passed panel in between the top and bottom content panels of the DVerticalDivider.","realm":"Client","args":{"arg":{"text":"The panel to set as the middle content.","name":"pnl","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetTop","parent":"DVerticalDivider","type":"panelfunc","description":"Sets the passed panel as the top content of the DVerticalDivider.","realm":"Client","args":{"arg":{"text":"The panel to set as the top content.","name":"pnl","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetTopHeight","parent":"DVerticalDivider","type":"panelfunc","description":"Sets the height of the top content panel.\n\nThe height of the bottom content panel is automatically calculated by taking the total height of the DVerticalDivider and subtracting it with the height of the top content panel and the divider bar.","realm":"Client","args":{"arg":{"text":"The height of the top content panel.","name":"height","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetTopMax","parent":"DVerticalDivider","type":"panelfunc","description":"Sets the maximum height of the top content panel. This is ignored if the panel would exceed the minimum bottom content panel height set from DVerticalDivider:SetBottomMin.","realm":"Client","args":{"arg":{"text":"The maximum height of the top content panel. Default is 4096.","name":"height","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetTopMin","parent":"DVerticalDivider","type":"panelfunc","description":"Sets the minimum height of the top content panel.","realm":"Client","args":{"arg":{"text":"The minimum height of the top content panel. Default is 50.","name":"height","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"StartGrab","parent":"DVerticalDivider","type":"panelfunc","description":{"text":"Causes the user to start dragging the divider.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddScroll","parent":"DVScrollBar","type":"panelfunc","description":"Adds specified amount of scroll in pixels.","realm":"Client and Menu","args":{"arg":{"text":"How much to scroll downwards. Can be negative for upwards scroll","name":"add","type":"number"}},"rets":{"ret":{"text":"True if the scroll level was changed (i.e. if we did or did not scroll)","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"AnimateTo","parent":"DVScrollBar","type":"panelfunc","description":"Smoothly scrolls to given level.","realm":"Client and Menu","args":{"arg":[{"text":"The scroll level to animate to. In pixels from the top ( from 0 )","name":"scroll","type":"number"},{"text":"Length of the animation in seconds","name":"length","type":"number"},{"text":"Delay of the animation in seconds","name":"delay","type":"number","default":"0"},{"text":"See Panel:NewAnimation for explanation.","name":"ease","type":"number","default":"-1"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"BarScale","parent":"DVScrollBar","type":"panelfunc","description":"Returns the scale of the scroll bar based on the difference in size between the visible \"window\" into the canvas that is being scrolled. Should be used after DVScrollBar:SetUp.","realm":"Client and Menu","rets":{"ret":{"text":"The scale of the scrollbar.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetHideButtons","parent":"DVScrollBar","type":"panelfunc","description":"Returns whether or not the manual up/down scroll buttons are visible or not. Set by DVScrollBar:SetHideButtons.","realm":"Client and Menu","rets":{"ret":{"text":"Whether or not the manual up/down scroll buttons are visible or not.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetOffset","parent":"DVScrollBar","type":"panelfunc","description":"Returns the negative of DVScrollBar:GetScroll.","realm":"Client and Menu","rets":{"ret":{"text":"The scroll offset.","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"GetScroll","parent":"DVScrollBar","type":"panelfunc","description":"Returns the amount of scroll level from the top in pixels","realm":"Client and Menu","rets":{"ret":{"text":"The amount of scroll level from the top","name":"","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"Grip","parent":"DVScrollBar","type":"panelfunc","description":{"text":"Called from within DScrollBarGrip","internal":""},"realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetHideButtons","parent":"DVScrollBar","type":"panelfunc","description":"Allows hiding the up and down buttons for better visual stylisation.","realm":"Client and Menu","args":{"arg":{"text":"True to hide","name":"hide","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetScroll","parent":"DVScrollBar","type":"panelfunc","description":"Sets the scroll level in pixels.","realm":"Client and Menu","args":{"arg":{"text":"The new scroll value.","name":"scroll","type":"number"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"SetUp","parent":"DVScrollBar","type":"panelfunc","description":"Sets up the scrollbar for use.\n\nThe scrollbar will automatically disable itself if the total height of the canvas is lower than the height of the panel that holds the canvas during this function call.","realm":"Client and Menu","args":{"arg":[{"text":"The size of the panel that holds the canvas, basically size of \"1 page\".","name":"barSize","type":"number"},{"text":"The total size of the canvas, this typically is the bigger number.","name":"canvasSize","type":"number"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"ConsoleMessage","parent":"HTML","type":"panelhook","description":"Called when the page inside the HTML window runs the `console.log` javascript function.\n\nOn the x86-64 beta, it's called for all built-in `console.*` javascript functions.\n\nOverwriting this function in any way will disable default behavior of printing the message to the in-game console.","realm":"Client and Menu","args":{"arg":[{"text":"The message to be logged (or Lua code to be executed; see above).","name":"msg","type":"string"},{"text":"The message source file, if any.","name":"file","type":"string"},{"text":"The line number in the file the message was output from.","name":"lineNr","type":"number"},{"text":"The severity of the message. Possible values are:\n* \"log\"\n* \"warn\"\n* \"error\"\n* \"debug\"","name":"severity","type":"string","added":"2025.09.22"}]}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnBeginLoadingDocument","parent":"HTML","type":"panelhook","description":"Called when this panel begins loading a page.","realm":"Client","args":{"arg":{"text":"The URL of the current page.","name":"url","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnCallback","parent":"HTML","type":"panelhook","description":"Called by the engine when a callback function is called.","realm":"Client","args":{"arg":[{"text":"Library name of the JS function that was called.","name":"library","type":"string"},{"text":"Name of the JS function that was called.","name":"name","type":"string"},{"text":"Table containing all arguments passed to the JS function.","name":"arguments","type":"table"}]},"rets":{"ret":{"text":"Return `true` to suppress default engine action.","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnChangeAddressBar","parent":"HTML","type":"panelhook","description":"Called when this panel's address changes.","realm":"Client","args":{"arg":{"text":"The URL of the new page.","name":"url","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnChangeTargetURL","parent":"HTML","type":"panelhook","description":"Called by HTML panels when the target URL of the frame has changed, this happens when you hover over a link.","realm":"Client","args":{"arg":{"text":"New target URL.","name":"url","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnChangeTitle","parent":"HTML","type":"panelhook","description":"Called by HTML panels when the title of the loaded page has been changed.","realm":"Client","args":{"arg":{"text":"The new title of the page.","name":"newTitle","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnChildViewCreated","parent":"HTML","type":"panelhook","description":"Called by HTML panels when the page attempts to open a new child view (such as a popup or new tab).","realm":"Client","args":{"arg":[{"text":"The URL of the page requesting to create a child.","name":"sourceURL","type":"string"},{"text":"The URL of the requested child.","name":"targetURL","type":"string"},{"text":"True if the requested view is a popup.","name":"isPopup","type":"boolean"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnDocumentReady","parent":"HTML","type":"panelhook","description":"Called by HTML panels when the panel's DOM has been set up. You can run JavaScript in here.","realm":"Client","args":{"arg":{"text":"The URL of the current page.","name":"url","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnFinishLoadingDocument","parent":"HTML","type":"panelhook","description":"Called when this panel successfully loads a page.","realm":"Client","args":{"arg":{"text":"The URL of the current page.","name":"url","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AboveLayout","parent":"IconEditor","type":"panelfunc","description":"Applies the top-down view camera settings for the model in the DAdjustableModelPanel.\n\nCalled when a user clicks the `Above` (third) button (See IconEditor).","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"BestGuessLayout","parent":"IconEditor","type":"panelfunc","description":"Applies the best camera settings for the model in the DAdjustableModelPanel, using the values returned by Global.PositionSpawnIcon.\n\nCalled when a user clicks the `wand` button (See the ) and when IconEditor:Refresh is called.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"FillAnimations","parent":"IconEditor","type":"panelfunc","description":{"text":"Fills the DListView on the left of the editor with the model entity's animation list. Called by IconEditor:Refresh.","internal":""},"realm":"Client","args":{"arg":{"text":"The entity being rendered within the model panel.","name":"ent","type":"Entity"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"FullFrontalLayout","parent":"IconEditor","type":"panelfunc","description":"Applies the front view camera settings for the model in the DAdjustableModelPanel.\n\nCalled when a user clicks the `Front` (second) button (See the ).","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"OriginLayout","parent":"IconEditor","type":"panelfunc","description":"Places the camera at the origin (0,0,0), relative to the entity, in the DAdjustableModelPanel.\n\nCalled when a user clicks the `Center` (fifth) button (See the ).","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"Refresh","parent":"IconEditor","type":"panelfunc","description":"Updates the internal DAdjustableModelPanel and SpawnIcon. \n\nThis should be called immediately after setting the SpawnIcon with IconEditor:SetIcon.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"RenderIcon","parent":"IconEditor","type":"panelfunc","description":"Re-renders the SpawnIcon.\n\nCalled when a user clicks the `RENDER` button, this retrieves the render data from the internal DAdjustableModelPanel and passes it as a table to Panel:RebuildSpawnIconEx.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"RightLayout","parent":"IconEditor","type":"panelfunc","description":"Applies the right side view camera settings for the model in the DAdjustableModelPanel.\n\nCalled when a user clicks the `Right` (fourth) button (See the ). (Note: The icon for this points left.)","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetDefaultLighting","parent":"IconEditor","type":"panelfunc","description":{"text":"Sets up the default ambient and directional lighting for the DAdjustableModelPanel. Called by IconEditor:Refresh.","internal":""},"realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetFromEntity","parent":"IconEditor","type":"panelfunc","description":"Sets the editor's model and icon from an entity. Alternative to IconEditor:SetIcon, with uses a SpawnIcon.\n\nYou do not need to call IconEditor:Refresh after this.","realm":"Client","args":{"arg":{"text":"The entity to retrieve the model and skin from.","name":"ent","type":"Entity"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetIcon","parent":"IconEditor","type":"panelfunc","description":"Sets the SpawnIcon to modify. You should call Panel:Refresh immediately after this, as the user will not be able to make changes to the icon beforehand.","realm":"Client","args":{"arg":{"text":"The SpawnIcon object to be modified.","name":"icon","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"UpdateEntity","parent":"IconEditor","type":"panelfunc","description":{"text":"Updates the entity being rendered in the internal DAdjustableModelPanel. Called by the model panel's DModelPanel:LayoutEntity method.","internal":""},"realm":"Client","args":{"arg":{"text":"The entity being rendered within the model panel.","name":"ent","type":"Entity"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetChecked","parent":"ImageCheckBox","type":"panelfunc","description":"Returns the checked state of the ImageCheckBox","realm":"Client","rets":{"ret":{"text":"true for checked, false otherwise","name":"","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Set","parent":"ImageCheckBox","type":"panelfunc","description":"Sets the checked state of the checkbox.\n\nChecked state can be obtained by ImageCheckBox.State.","file":{"text":"lua/vgui/imagecheckbox.lua","line":"32-L36"},"realm":"Client","args":{"arg":{"text":"true for checked, false otherwise","name":"OnOff","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetChecked","parent":"ImageCheckBox","type":"panelfunc","description":"Sets the checked state of the checkbox.\n\nChecked state can be obtained via ImageCheckBox:GetChecked","realm":"Client","file":{"text":"lua/vgui/imagecheckbox.lua","line":"18-L24"},"args":{"arg":{"text":"true for checked, false otherwise","name":"bOn","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetMaterial","parent":"ImageCheckBox","type":"panelfunc","description":{"text":"Sets the material that will be visible when the ImageCheckBox is checked.\n\nInternally calls Material:SetMaterial.","note":"Will error if no material was set."},"file":{"text":"lua/vgui/imagecheckbox.lua","line":"4-L16"},"realm":"Client","args":{"arg":{"text":"The file path of the material to set (relative to \"garrysmod/materials/\").","name":"mat","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetAlpha","parent":"Material","type":"panelfunc","description":"Sets the alpha value of the Material panel.","realm":"Client","args":{"arg":{"text":"The alpha value, from 0 to 255.","name":"alpha","type":"number"}}},"example":{"description":"Creates a transparent SWEP icon in the middle of the screen.","code":"local mat = vgui.Create(\"Material\")\nmat:SetSize(200, 200)\nmat:Center()\nmat:SetMaterial(\"weapons/swep\")\n\t\nmat:SetAlpha(128)","output":{"image":{"src":"Material_SetAlpha_example1.jpg"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetMaterial","parent":"Material","type":"panelfunc","description":{"text":"Sets the material used by the panel.","note":"If the material is not showing up as the correct size, try setting the Material panel's `AutoSize` variable to **false**"},"realm":"Client","args":{"arg":{"text":"The file path of the material to set (relative to \"garrysmod/materials/\").","name":"matname","type":"string"}}},"example":{"description":"Creates a Material panel and sets the material to a screen space effect.","code":"-- Black background panel\nBGPanel = vgui.Create(\"DPanel\")\nBGPanel:SetSize(200, 200)\nBGPanel:Center()\nBGPanel:SetBackgroundColor(Color(0, 0, 0, 255))\n\t\t\nlocal mat = vgui.Create(\"Material\", BGPanel)\nmat:SetPos(5, 5)\nmat:SetSize(190, 190)\n\n-- It's not really good to use a models material for VGUI drawing\n-- But it looks good enough for a quick demo\nmat:SetMaterial(\"models/screenspace\")\n\n-- Stretch to fit\nmat.AutoSize = false","output":{"image":{"src":"Material_SetMaterial_example1.jpg"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnRightClick","parent":"MatSelect","type":"panelhook","description":"Called when the player right clicks a material.\n\nBy default, this opens a menu that lets the player copy the material path.","realm":"Client","added":"2024.09.02","args":{"arg":{"text":"The DImageButton that was clicked.","name":"pnl","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnSelect","parent":"MatSelect","type":"panelhook","description":"Called when the player selects a material.","realm":"Client","added":"2024.09.02","args":{"arg":[{"text":"Material path of the selected material, not including any file extension.","name":"material","type":"string"},{"text":"The DImageButton that was clicked.","name":"pnl","type":"Panel"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SelectedItemPaintOver","parent":"MatSelect","type":"panelhook","description":{"text":"Defines a paint over function for a DImageButton when it is selected.","warning":"`self` in the context of this function is the DImageButton!"},"realm":"Client","added":"2023.09.08","args":{"arg":[{"text":"Width of the DImageButton panel.","name":"w","type":"number"},{"text":"Height of the DImageButton panel.","name":"h","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddMaterial","parent":"MatSelect","type":"panelfunc","description":"Adds a new material to the selection list.","realm":"Client","args":{"arg":[{"text":"Tooltip for the material, for when the player hovers over the material.","name":"label","type":"string"},{"text":"Path to the material. Relative to `materials/` folder (do not include it), and do not include the `.vmt` extension.","name":"path","type":"string"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddMaterialEx","parent":"MatSelect","type":"panelfunc","description":"Adds a new material to the selection list, with some extra options.","realm":"Client","args":{"arg":[{"text":"Tooltip for the material, for when the player hovers over the material.","name":"label","type":"string"},{"text":"Path to the material. Relative to `materials/` folder (do not include it), and do not include the `.vmt` extension.","name":"path","type":"string"},{"text":"Overrides the \"value\" of the material. This will be what MatSelect:OnSelect receives in the first argument. It also affects MatSelect:FindMaterialByValue.","name":"value","type":"any"},{"text":"A list of convar names (as keys) and their values to set when the user selects this material. ContextBase:SetConVar will be ignored.","name":"convars","type":"table"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"FindAndSelectMaterial","parent":"MatSelect","type":"panelfunc","description":"Find a material and selects it, if it exists in this panel.","realm":"Client","args":{"arg":{"text":"The material to find and select within this MatSelect.","name":"mat","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"FindMaterialByValue","parent":"MatSelect","type":"panelfunc","description":"Find a DImageButton panel based on the input material path.","realm":"Client","added":"2023.09.08","args":{"arg":{"text":"The material to find within this MatSelect.","name":"mat","type":"string"}},"rets":{"ret":{"text":"The found material, or nil.","name":"","type":"DImageButton"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetAutoHeight","parent":"MatSelect","type":"panelfunc","description":"Returns whether the panel would set its own height to fit all materials within its height.","realm":"Client","rets":{"ret":{"text":"`true` = auto size itself.","name":"autoSize","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SelectMaterial","parent":"MatSelect","type":"panelfunc","description":{"text":"Selects a given material panel.","internal":"Use MatSelect:FindAndSelectMaterial instead."},"realm":"Client","added":"2023.09.08","args":{"arg":{"text":"The material to select, found by MatSelect:FindMaterialByValue","name":"mat","type":"DImageButton"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetAutoHeight","parent":"MatSelect","type":"panelfunc","description":"Sets whether the panel should set its own height to fit all materials within its height.","realm":"Client","args":{"arg":{"text":"If `true`, auto size itself.","name":"autoSize","type":"boolean"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetItemHeight","parent":"MatSelect","type":"panelfunc","description":"Sets the height of a single material in pixels.","realm":"Client","args":{"arg":{"text":"The height of the material, in pixels. Default is `128`.","name":"height ","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetItemWidth","parent":"MatSelect","type":"panelfunc","description":"Sets the width of a single material in pixels.","realm":"Client","args":{"arg":{"text":"The width of the material, in pixels. Default is `128`.","name":"width","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetNumRows","parent":"MatSelect","type":"panelfunc","description":"Sets the target height of the panel, in number of rows.","realm":"Client","args":{"arg":{"text":"Amount of rows to target the height to. Default is `2`.","name":"rows","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"Height","parent":"PropSelect","type":"panelfield","description":"If set to above 0, automatically stretches the panel to fit this many rows. Default is 2.\n\nIf 0 or below, it will automatically stretch to fit all rows.","realm":"Client","rets":{"ret":{"text":"The amount of rows to stretch to.","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnRightClick","parent":"PropSelect","type":"panelhook","description":"Called when the player right clicks a model.\n\nBy default, this opens a menu that lets the player copy the model path.","realm":"Client","added":"2024.09.02","args":{"arg":{"text":"The Spawnicon that was clicked.","name":"pnl","type":"Panel"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnSelect","parent":"PropSelect","type":"panelhook","description":"Called when the player selects a model.","realm":"Client","added":"2024.09.02","args":{"arg":[{"text":"The Spawnicon that was clicked.","name":"pnl","type":"Panel"},{"text":"Path of the selected model, or its \"value\".","name":"model","type":"String"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SelectModel","parent":"PropSelect","type":"panelhook","description":{"text":"Selects a given spawnicon panel.","internal":"Use PropSelect:FindAndSelectButton instead."},"realm":"Client","added":"2024.09.02","args":{"arg":{"text":"The spawnicon to select, retrieved via PropSelect:FindModelByValue.","name":"icon","type":"SpawnIcon"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddModel","parent":"PropSelect","type":"panelfunc","description":"Adds a new model to the selection list.","realm":"Client","args":{"arg":[{"text":"Model path, **including** `models/` and `.mdl`.","name":"model","type":"string"},{"text":"A list of convar names (as keys) and their values to set when the user selects this model.","name":"convars","type":"table"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"AddModelEx","parent":"PropSelect","type":"panelfunc","description":"Adds a new model to the selection list.","realm":"Client","args":{"arg":[{"text":"The \"value\" for this model, which is used to set the ContextBase:SetConVar.","name":"value","type":"string"},{"text":"Model path, **including** `models/` and `.mdl`.","name":"model","type":"string"},{"text":"The skin number for this model. It will **not** be set to the convar, use the value argument to track skin-model combos.","name":"skin","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"FindAndSelectButton","parent":"PropSelect","type":"panelfunc","description":"Find and select a SpawnIcon panel based on the input model path.","realm":"Client","args":{"arg":{"text":"The model to find and select within this PropSelect.","name":"mdl","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"FindModelByValue","parent":"PropSelect","type":"panelfunc","description":"Find a SpawnIcon panel based on the input model path.","realm":"Client","added":"2024.09.02","args":{"arg":{"text":"The model to find within this PropSelect.","name":"mdl","type":"string"}},"rets":{"ret":{"text":"The found spawnicon, or `nil`.","name":"","type":"SpawnIcon"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetBodyGroup","parent":"SpawnIcon","type":"panelfunc","description":"Returns the currently active Sub Model IDs for each Body Group of the spawn icon.  \n\t\t\n\t\tThis is set by SpawnIcon:SetBodyGroup.","realm":"Client","rets":{"ret":{"text":"The Body Groups of the spawnicon","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetModelName","parent":"SpawnIcon","type":"panelfunc","description":"Returns the currently set model name. This is set by SpawnIcon:SetModelName.","realm":"Client","rets":{"ret":{"text":"The model name","type":"string"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"GetSkinID","parent":"SpawnIcon","type":"panelfunc","description":"Returns the currently set skin of the spawnicon. This is set by SpawnIcon:SetSkinID.","realm":"Client","rets":{"ret":{"text":"Current skin ID","type":"number"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OpenMenu","parent":"SpawnIcon","type":"panelfunc","description":"Called when right clicked on the SpawnIcon. It will not be called if there is a selection (Panel:GetSelectionCanvas), in which case SANDBOX:SpawnlistOpenGenericMenu is called.","realm":"Client"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetBodyGroup","parent":"SpawnIcon","type":"panelfunc","description":{"text":"Sets the active Sub Model ID for the given Body Group \t\tID, so it can be retrieved with SpawnIcon:GetBodyGroup.  \n\n\t\tUse Panel:SetModel instead.","internal":"This is done automatically by SpawnIcon. You do not need to call this. Doing so may cause unforeseen consequences."},"realm":"Client","args":{"arg":[{"text":"The Body Group ID to set the active Sub Model ID for.  \n\t\t\tBody Group IDs start at `0`.","name":"bodyGroupId","type":"number"},{"text":"The Sub Model ID to set as active.  \n\t\t\tSub Model IDs start at `0`.","name":"activeSubModelId","type":"number"}]}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetModelName","parent":"SpawnIcon","type":"panelfunc","description":{"text":"Sets the model name, so it can be retrieved with SpawnIcon:GetModelName. Use Panel:SetModel instead.","internal":"This is done automatically by SpawnIcon. You do not need to call this. Doing so may cause unforeseen consequences."},"realm":"Client","args":{"arg":{"text":"The model name to set","type":"string","name":"mdl"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"SetSkinID","parent":"SpawnIcon","type":"panelfunc","description":{"text":"Sets the skin id of the spawn icon, so it can be retrieved with SpawnIcon:GetSkinID. Use Panel:SetModel instead.","internal":"This is done automatically by SpawnIcon. You do not need to call this. Doing so may cause unforeseen consequences."},"realm":"Client","args":{"arg":{"text":"Skin ID to set","type":"number","name":"skin"}}},"realms":["Client"],"type":"Function"},
{"function":{"name":"CallPopulateHook","parent":"SpawnmenuContentPanel","type":"panelfunc","description":"Changes the Spawnmenu category to search in","args":{"arg":{"text":"The Hook name","name":"hookname","type":"string"}},"realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/content.lua","line":"52-L56"}},"example":{"code":"local ctrl = vgui.Create( \"SpawnmenuContentPanel\" )\nctrl:CallPopulateHook( \"PopulateWeapons\" )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"EnableModify","parent":"SpawnmenuContentPanel","type":"panelfunc","description":"Allows the modification of the ContentSidebar","realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/content.lua","line":"44-L46"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"EnableSearch","parent":"SpawnmenuContentPanel","type":"panelfunc","description":"Changes the Spawnmenu category to search in","args":{"arg":[{"text":"The category","name":"category","type":"string"},{"text":"The Hook name","name":"hookname","type":"string"}]},"realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/content.lua","line":"48-L50"}},"example":{"code":"local ctrl = vgui.Create( \"SpawnmenuContentPanel\" )\nctrl:EnableSearch( \"weapons\", \"PopulateWeapons\" )\nctrl:CallPopulateHook( \"PopulateWeapons\" )"},"realms":["Client"],"type":"Function"},
{"function":{"name":"SwitchPanel","parent":"SpawnmenuContentPanel","type":"panelfunc","description":"Switches the current panel with the given panel","args":{"arg":{"text":"Panel to switch to","name":"panel","type":"Panel"}},"realm":"Client","file":{"text":"gamemodes/sandbox/gamemode/spawnmenu/creationmenu/content/content.lua","line":"58-L75"}},"realms":["Client"],"type":"Function"},
{"function":{"name":"OnKeyCodeTyped","parent":"TextEntry","type":"panelhook","description":"Called from engine whenever a valid character is typed while the text entry is focused.\n\nUsed internally for functionality of DTextEntry","realm":"Client and Menu","args":{"arg":{"text":"They key code of the key pressed, see Enums/KEY.","name":"keyCode","type":"number"}},"rets":{"ret":{"text":"Whether you've handled the key press. Returning true prevents the default text entry behavior from occurring.","name":"","type":"boolean"}}},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"OnTextChanged","parent":"TextEntry","type":"panelhook","description":"Called when the text inside the TextEntry changes.\n\nYou may be looking for DTextEntry:OnValueChange instead.","realm":"Client and Menu"},"realms":["Client","Menu"],"type":"Function"},
{"function":{"name":"CheckInput","parent":"UGCPublishWindow","type":"panelfunc","description":"Checks if the Tags and Title are valid and if so it enables the publish button.","realm":"Menu"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"DisplayError","parent":"UGCPublishWindow","type":"panelfunc","description":"Displays the given error message.","realm":"Menu","args":{"arg":{"text":"The error message.","name":"err","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"DoPublish","parent":"UGCPublishWindow","type":"panelfunc","description":"Publishes the Item or throws an error if the Title or Tags are invalid","realm":"Menu","args":{"arg":[{"text":"The workshop id","name":"wsid","type":"string"},{"text":"If wsid is nil, this will be the error message","name":"err","type":"string"}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"FitContents","parent":"UGCPublishWindow","type":"panelfunc","description":"Rezises the panel to nicely fit all children","realm":"Menu"},"realms":["Menu"],"type":"Function"},
{"function":{"name":"GetChosenTag","parent":"UGCPublishWindow","type":"panelfunc","description":"Returns the name of the current selected tag.","realm":"Menu","rets":{"ret":{"text":"The choosen tag, or nil if none is selected.","name":"tag","type":"string"}}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"OnPublishFinished","parent":"UGCPublishWindow","type":"panelfunc","description":"Called when the Item was published or if any error occurred while publishing","realm":"Menu","args":{"arg":[{"text":"The workshop id","name":"wsid","type":"string"},{"text":"If wsid is nil, this will be the error message","name":"err","type":"string"}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"Setup","parent":"UGCPublishWindow","type":"panelfunc","description":"updated the Workshop items list.","realm":"Menu","args":{"arg":[{"text":"The type / namespace of the WorkshopFileBase that created this panel","name":"ugcType","type":"string"},{"text":"The File to publish","name":"file","type":"string"},{"text":"The Image","name":"imageFile","type":"string"},{"text":"The WorkshopFileBase that created this panel","name":"handler","type":"WorkshopFileBase"}]}},"realms":["Menu"],"type":"Function"},
{"function":{"name":"UpdateWorkshopItems","parent":"UGCPublishWindow","type":"panelfunc","description":"updated the Workshop items list.","realm":"Menu"},"realms":["Menu"],"type":"Function"},
{"enum":{"realm":"Shared","description":"Enumerations used by Entity:SetUseType. Affects when ENTITY:Use is triggered.\n\nNot to be confused with Enums/USE used for ENTITY:Use and others.","items":{"item":[{"text":"Fire a USE_ON signal every tick as long as the player holds their use key and aims at the target.","key":"CONTINUOUS_USE","value":"0"},{"text":"Fires a USE_ON signal when starting to use an entity, and a USE_OFF signal when letting go.","key":"ONOFF_USE","value":"1","warning":"There is no guarantee to receive both ON and OFF signals. A signal will only be sent when pushing or letting go of the use key while actually aiming at the entity, so an ON signal might not be followed by an OFF signal if the player is aiming somewhere else when releasing the key, and similarly, an OFF signal may not be preceded by an ON signal if the player started aiming at the entity only after pressing the key.\n\nTherefore, this method of input is unreliable and should not be used."},{"text":"Like a wheel turning.","key":"DIRECTIONAL_USE","value":"2"},{"text":"Fire a USE_ON signal only once when player presses their use key while aiming at the target.","key":"SIMPLE_USE","value":"3"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by functions like Weapon:SendWeaponAnim & Entity:SelectWeightedSequence.\n\nAn activity is a code-friendly identifier for an animation, and can point to multiple sequences (animations) depending on the model.\n\nSee [$sequence](https://developer.valvesoftware.com/wiki/$sequence) `.qc` command documentation on Valve Developer Wiki, specifically the `activity` parameter.","items":{"item":[{"key":"ACT_INVALID","value":"-1"},{"key":"ACT_RESET","value":"0"},{"key":"ACT_IDLE","value":"1"},{"key":"ACT_TRANSITION","value":"2"},{"key":"ACT_COVER","value":"3"},{"key":"ACT_COVER_MED","value":"4"},{"key":"ACT_COVER_LOW","value":"5"},{"key":"ACT_WALK","value":"6"},{"key":"ACT_WALK_AIM","value":"7"},{"key":"ACT_WALK_CROUCH","value":"8"},{"key":"ACT_WALK_CROUCH_AIM","value":"9"},{"key":"ACT_RUN","value":"10"},{"key":"ACT_RUN_AIM","value":"11"},{"key":"ACT_RUN_CROUCH","value":"12"},{"key":"ACT_RUN_CROUCH_AIM","value":"13"},{"key":"ACT_RUN_PROTECTED","value":"14"},{"key":"ACT_SCRIPT_CUSTOM_MOVE","value":"15"},{"key":"ACT_RANGE_ATTACK1","value":"16"},{"key":"ACT_RANGE_ATTACK2","value":"17"},{"key":"ACT_RANGE_ATTACK1_LOW","value":"18"},{"key":"ACT_RANGE_ATTACK2_LOW","value":"19"},{"key":"ACT_DIESIMPLE","value":"20"},{"key":"ACT_DIEBACKWARD","value":"21"},{"key":"ACT_DIEFORWARD","value":"22"},{"key":"ACT_DIEVIOLENT","value":"23"},{"key":"ACT_DIERAGDOLL","value":"24"},{"key":"ACT_FLY","value":"25"},{"key":"ACT_HOVER","value":"26"},{"key":"ACT_GLIDE","value":"27"},{"key":"ACT_SWIM","value":"28"},{"key":"ACT_SWIM_IDLE","value":"29"},{"key":"ACT_JUMP","value":"30"},{"key":"ACT_HOP","value":"31"},{"key":"ACT_LEAP","value":"32"},{"key":"ACT_LAND","value":"33"},{"key":"ACT_CLIMB_UP","value":"34"},{"key":"ACT_CLIMB_DOWN","value":"35"},{"key":"ACT_CLIMB_DISMOUNT","value":"36"},{"key":"ACT_SHIPLADDER_UP","value":"37"},{"key":"ACT_SHIPLADDER_DOWN","value":"38"},{"key":"ACT_STRAFE_LEFT","value":"39"},{"key":"ACT_STRAFE_RIGHT","value":"40"},{"key":"ACT_ROLL_LEFT","value":"41"},{"key":"ACT_ROLL_RIGHT","value":"42"},{"key":"ACT_TURN_LEFT","value":"43"},{"key":"ACT_TURN_RIGHT","value":"44"},{"key":"ACT_CROUCH","value":"45"},{"key":"ACT_CROUCHIDLE","value":"46"},{"key":"ACT_STAND","value":"47"},{"key":"ACT_USE","value":"48"},{"key":"ACT_SIGNAL1","value":"49"},{"key":"ACT_SIGNAL2","value":"50"},{"key":"ACT_SIGNAL3","value":"51"},{"key":"ACT_SIGNAL_ADVANCE","value":"52"},{"key":"ACT_SIGNAL_FORWARD","value":"53"},{"key":"ACT_SIGNAL_GROUP","value":"54"},{"key":"ACT_SIGNAL_HALT","value":"55"},{"key":"ACT_SIGNAL_LEFT","value":"56"},{"key":"ACT_SIGNAL_RIGHT","value":"57"},{"key":"ACT_SIGNAL_TAKECOVER","value":"58"},{"key":"ACT_LOOKBACK_RIGHT","value":"59"},{"key":"ACT_LOOKBACK_LEFT","value":"60"},{"key":"ACT_COWER","value":"61"},{"key":"ACT_SMALL_FLINCH","value":"62"},{"key":"ACT_BIG_FLINCH","value":"63"},{"key":"ACT_MELEE_ATTACK1","value":"64"},{"key":"ACT_MELEE_ATTACK2","value":"65"},{"key":"ACT_RELOAD","value":"66"},{"key":"ACT_RELOAD_START","value":"67"},{"key":"ACT_RELOAD_FINISH","value":"68"},{"key":"ACT_RELOAD_LOW","value":"69"},{"key":"ACT_ARM","value":"70"},{"key":"ACT_DISARM","value":"71"},{"key":"ACT_DROP_WEAPON","value":"72"},{"key":"ACT_DROP_WEAPON_SHOTGUN","value":"73"},{"key":"ACT_PICKUP_GROUND","value":"74"},{"key":"ACT_PICKUP_RACK","value":"75"},{"key":"ACT_IDLE_ANGRY","value":"76"},{"key":"ACT_IDLE_RELAXED","value":"77"},{"key":"ACT_IDLE_STIMULATED","value":"78"},{"key":"ACT_IDLE_AGITATED","value":"79"},{"key":"ACT_IDLE_STEALTH","value":"80"},{"key":"ACT_IDLE_HURT","value":"81"},{"key":"ACT_WALK_RELAXED","value":"82"},{"key":"ACT_WALK_STIMULATED","value":"83"},{"key":"ACT_WALK_AGITATED","value":"84"},{"key":"ACT_WALK_STEALTH","value":"85"},{"key":"ACT_RUN_RELAXED","value":"86"},{"key":"ACT_RUN_STIMULATED","value":"87"},{"key":"ACT_RUN_AGITATED","value":"88"},{"key":"ACT_RUN_STEALTH","value":"89"},{"key":"ACT_IDLE_AIM_RELAXED","value":"90"},{"key":"ACT_IDLE_AIM_STIMULATED","value":"91"},{"key":"ACT_IDLE_AIM_AGITATED","value":"92"},{"key":"ACT_IDLE_AIM_STEALTH","value":"93"},{"key":"ACT_WALK_AIM_RELAXED","value":"94"},{"key":"ACT_WALK_AIM_STIMULATED","value":"95"},{"key":"ACT_WALK_AIM_AGITATED","value":"96"},{"key":"ACT_WALK_AIM_STEALTH","value":"97"},{"key":"ACT_RUN_AIM_RELAXED","value":"98"},{"key":"ACT_RUN_AIM_STIMULATED","value":"99"},{"key":"ACT_RUN_AIM_AGITATED","value":"100"},{"key":"ACT_RUN_AIM_STEALTH","value":"101"},{"key":"ACT_CROUCHIDLE_STIMULATED","value":"102"},{"key":"ACT_CROUCHIDLE_AIM_STIMULATED","value":"103"},{"key":"ACT_CROUCHIDLE_AGITATED","value":"104"},{"key":"ACT_WALK_HURT","value":"105"},{"key":"ACT_RUN_HURT","value":"106"},{"key":"ACT_SPECIAL_ATTACK1","value":"107"},{"key":"ACT_SPECIAL_ATTACK2","value":"108"},{"key":"ACT_COMBAT_IDLE","value":"109"},{"key":"ACT_WALK_SCARED","value":"110"},{"key":"ACT_RUN_SCARED","value":"111"},{"key":"ACT_VICTORY_DANCE","value":"112"},{"key":"ACT_DIE_HEADSHOT","value":"113"},{"key":"ACT_DIE_CHESTSHOT","value":"114"},{"key":"ACT_DIE_GUTSHOT","value":"115"},{"key":"ACT_DIE_BACKSHOT","value":"116"},{"key":"ACT_FLINCH_HEAD","value":"117"},{"key":"ACT_FLINCH_CHEST","value":"118"},{"key":"ACT_FLINCH_STOMACH","value":"119"},{"key":"ACT_FLINCH_LEFTARM","value":"120"},{"key":"ACT_FLINCH_RIGHTARM","value":"121"},{"key":"ACT_FLINCH_LEFTLEG","value":"122"},{"key":"ACT_FLINCH_RIGHTLEG","value":"123"},{"key":"ACT_FLINCH_PHYSICS","value":"124"},{"key":"ACT_IDLE_ON_FIRE","value":"125"},{"key":"ACT_WALK_ON_FIRE","value":"126"},{"key":"ACT_RUN_ON_FIRE","value":"127"},{"key":"ACT_RAPPEL_LOOP","value":"128"},{"key":"ACT_180_LEFT","value":"129"},{"key":"ACT_180_RIGHT","value":"130"},{"key":"ACT_90_LEFT","value":"131"},{"key":"ACT_90_RIGHT","value":"132"},{"key":"ACT_STEP_LEFT","value":"133"},{"key":"ACT_STEP_RIGHT","value":"134"},{"key":"ACT_STEP_BACK","value":"135"},{"key":"ACT_STEP_FORE","value":"136"},{"key":"ACT_GESTURE_RANGE_ATTACK1","value":"137"},{"key":"ACT_GESTURE_RANGE_ATTACK2","value":"138"},{"key":"ACT_GESTURE_MELEE_ATTACK1","value":"139"},{"key":"ACT_GESTURE_MELEE_ATTACK2","value":"140"},{"key":"ACT_GESTURE_RANGE_ATTACK1_LOW","value":"141"},{"key":"ACT_GESTURE_RANGE_ATTACK2_LOW","value":"142"},{"key":"ACT_MELEE_ATTACK_SWING_GESTURE","value":"143"},{"key":"ACT_GESTURE_SMALL_FLINCH","value":"144"},{"key":"ACT_GESTURE_BIG_FLINCH","value":"145"},{"key":"ACT_GESTURE_FLINCH_BLAST","value":"146"},{"key":"ACT_GESTURE_FLINCH_BLAST_SHOTGUN","value":"147"},{"key":"ACT_GESTURE_FLINCH_BLAST_DAMAGED","value":"148"},{"key":"ACT_GESTURE_FLINCH_BLAST_DAMAGED_SHOTGUN","value":"149"},{"key":"ACT_GESTURE_FLINCH_HEAD","value":"150"},{"key":"ACT_GESTURE_FLINCH_CHEST","value":"151"},{"key":"ACT_GESTURE_FLINCH_STOMACH","value":"152"},{"key":"ACT_GESTURE_FLINCH_LEFTARM","value":"153"},{"key":"ACT_GESTURE_FLINCH_RIGHTARM","value":"154"},{"key":"ACT_GESTURE_FLINCH_LEFTLEG","value":"155"},{"key":"ACT_GESTURE_FLINCH_RIGHTLEG","value":"156"},{"key":"ACT_GESTURE_TURN_LEFT","value":"157"},{"key":"ACT_GESTURE_TURN_RIGHT","value":"158"},{"key":"ACT_GESTURE_TURN_LEFT45","value":"159"},{"key":"ACT_GESTURE_TURN_RIGHT45","value":"160"},{"key":"ACT_GESTURE_TURN_LEFT90","value":"161"},{"key":"ACT_GESTURE_TURN_RIGHT90","value":"162"},{"key":"ACT_GESTURE_TURN_LEFT45_FLAT","value":"163"},{"key":"ACT_GESTURE_TURN_RIGHT45_FLAT","value":"164"},{"key":"ACT_GESTURE_TURN_LEFT90_FLAT","value":"165"},{"key":"ACT_GESTURE_TURN_RIGHT90_FLAT","value":"166"},{"key":"ACT_BARNACLE_HIT","value":"167"},{"key":"ACT_BARNACLE_PULL","value":"168"},{"key":"ACT_BARNACLE_CHOMP","value":"169"},{"key":"ACT_BARNACLE_CHEW","value":"170"},{"key":"ACT_DO_NOT_DISTURB","value":"171"},{"key":"ACT_VM_DRAW","value":"172"},{"key":"ACT_VM_HOLSTER","value":"173"},{"key":"ACT_VM_IDLE","value":"174"},{"key":"ACT_VM_FIDGET","value":"175"},{"key":"ACT_VM_PULLBACK","value":"176"},{"key":"ACT_VM_PULLBACK_HIGH","value":"177"},{"key":"ACT_VM_PULLBACK_LOW","value":"178"},{"key":"ACT_VM_THROW","value":"179"},{"key":"ACT_VM_PULLPIN","value":"180"},{"key":"ACT_VM_PRIMARYATTACK","value":"181"},{"key":"ACT_VM_SECONDARYATTACK","value":"182"},{"key":"ACT_VM_RELOAD","value":"183"},{"key":"ACT_VM_DRYFIRE","value":"186"},{"key":"ACT_VM_HITLEFT","value":"187"},{"key":"ACT_VM_HITLEFT2","value":"188"},{"key":"ACT_VM_HITRIGHT","value":"189"},{"key":"ACT_VM_HITRIGHT2","value":"190"},{"key":"ACT_VM_HITCENTER","value":"191"},{"key":"ACT_VM_HITCENTER2","value":"192"},{"key":"ACT_VM_MISSLEFT","value":"193"},{"key":"ACT_VM_MISSLEFT2","value":"194"},{"key":"ACT_VM_MISSRIGHT","value":"195"},{"key":"ACT_VM_MISSRIGHT2","value":"196"},{"key":"ACT_VM_MISSCENTER","value":"197"},{"key":"ACT_VM_MISSCENTER2","value":"198"},{"key":"ACT_VM_HAULBACK","value":"199"},{"key":"ACT_VM_SWINGHARD","value":"200"},{"key":"ACT_VM_SWINGMISS","value":"201"},{"key":"ACT_VM_SWINGHIT","value":"202"},{"key":"ACT_VM_IDLE_TO_LOWERED","value":"203"},{"key":"ACT_VM_IDLE_LOWERED","value":"204"},{"key":"ACT_VM_LOWERED_TO_IDLE","value":"205"},{"key":"ACT_VM_RECOIL1","value":"206"},{"key":"ACT_VM_RECOIL2","value":"207"},{"key":"ACT_VM_RECOIL3","value":"208"},{"key":"ACT_VM_PICKUP","value":"209"},{"key":"ACT_VM_RELEASE","value":"210"},{"key":"ACT_VM_ATTACH_SILENCER","value":"211"},{"key":"ACT_VM_DETACH_SILENCER","value":"212"},{"key":"ACT_SLAM_STICKWALL_IDLE","value":"229"},{"key":"ACT_SLAM_STICKWALL_ND_IDLE","value":"230"},{"key":"ACT_SLAM_STICKWALL_ATTACH","value":"231"},{"key":"ACT_SLAM_STICKWALL_ATTACH2","value":"232"},{"key":"ACT_SLAM_STICKWALL_ND_ATTACH","value":"233"},{"key":"ACT_SLAM_STICKWALL_ND_ATTACH2","value":"234"},{"key":"ACT_SLAM_STICKWALL_DETONATE","value":"235"},{"key":"ACT_SLAM_STICKWALL_DETONATOR_HOLSTER","value":"236"},{"key":"ACT_SLAM_STICKWALL_DRAW","value":"237"},{"key":"ACT_SLAM_STICKWALL_ND_DRAW","value":"238"},{"key":"ACT_SLAM_STICKWALL_TO_THROW","value":"239"},{"key":"ACT_SLAM_STICKWALL_TO_THROW_ND","value":"240"},{"key":"ACT_SLAM_STICKWALL_TO_TRIPMINE_ND","value":"241"},{"key":"ACT_SLAM_THROW_IDLE","value":"242"},{"key":"ACT_SLAM_THROW_ND_IDLE","value":"243"},{"key":"ACT_SLAM_THROW_THROW","value":"244"},{"key":"ACT_SLAM_THROW_THROW2","value":"245"},{"key":"ACT_SLAM_THROW_THROW_ND","value":"246"},{"key":"ACT_SLAM_THROW_THROW_ND2","value":"247"},{"key":"ACT_SLAM_THROW_DRAW","value":"248"},{"key":"ACT_SLAM_THROW_ND_DRAW","value":"249"},{"key":"ACT_SLAM_THROW_TO_STICKWALL","value":"250"},{"key":"ACT_SLAM_THROW_TO_STICKWALL_ND","value":"251"},{"key":"ACT_SLAM_THROW_DETONATE","value":"252"},{"key":"ACT_SLAM_THROW_DETONATOR_HOLSTER","value":"253"},{"key":"ACT_SLAM_THROW_TO_TRIPMINE_ND","value":"254"},{"key":"ACT_SLAM_TRIPMINE_IDLE","value":"255"},{"key":"ACT_SLAM_TRIPMINE_DRAW","value":"256"},{"key":"ACT_SLAM_TRIPMINE_ATTACH","value":"257"},{"key":"ACT_SLAM_TRIPMINE_ATTACH2","value":"258"},{"key":"ACT_SLAM_TRIPMINE_TO_STICKWALL_ND","value":"259"},{"key":"ACT_SLAM_TRIPMINE_TO_THROW_ND","value":"260"},{"key":"ACT_SLAM_DETONATOR_IDLE","value":"261"},{"key":"ACT_SLAM_DETONATOR_DRAW","value":"262"},{"key":"ACT_SLAM_DETONATOR_DETONATE","value":"263"},{"key":"ACT_SLAM_DETONATOR_HOLSTER","value":"264"},{"key":"ACT_SLAM_DETONATOR_STICKWALL_DRAW","value":"265"},{"key":"ACT_SLAM_DETONATOR_THROW_DRAW","value":"266"},{"key":"ACT_SHOTGUN_RELOAD_START","value":"267"},{"key":"ACT_SHOTGUN_RELOAD_FINISH","value":"268"},{"key":"ACT_SHOTGUN_PUMP","value":"269"},{"key":"ACT_SMG2_IDLE2","value":"270"},{"key":"ACT_SMG2_FIRE2","value":"271"},{"key":"ACT_SMG2_DRAW2","value":"272"},{"key":"ACT_SMG2_RELOAD2","value":"273"},{"key":"ACT_SMG2_DRYFIRE2","value":"274"},{"key":"ACT_SMG2_TOAUTO","value":"275"},{"key":"ACT_SMG2_TOBURST","value":"276"},{"key":"ACT_PHYSCANNON_UPGRADE","value":"277"},{"key":"ACT_RANGE_ATTACK_AR1","value":"278"},{"key":"ACT_RANGE_ATTACK_AR2","value":"279"},{"key":"ACT_RANGE_ATTACK_AR2_LOW","value":"280"},{"key":"ACT_RANGE_ATTACK_AR2_GRENADE","value":"281"},{"key":"ACT_RANGE_ATTACK_HMG1","value":"282"},{"key":"ACT_RANGE_ATTACK_ML","value":"283"},{"key":"ACT_RANGE_ATTACK_SMG1","value":"284"},{"key":"ACT_RANGE_ATTACK_SMG1_LOW","value":"285"},{"key":"ACT_RANGE_ATTACK_SMG2","value":"286"},{"key":"ACT_RANGE_ATTACK_SHOTGUN","value":"287"},{"key":"ACT_RANGE_ATTACK_SHOTGUN_LOW","value":"288"},{"key":"ACT_RANGE_ATTACK_PISTOL","value":"289"},{"key":"ACT_RANGE_ATTACK_PISTOL_LOW","value":"290"},{"key":"ACT_RANGE_ATTACK_SLAM","value":"291"},{"key":"ACT_RANGE_ATTACK_TRIPWIRE","value":"292"},{"key":"ACT_RANGE_ATTACK_THROW","value":"293"},{"key":"ACT_RANGE_ATTACK_SNIPER_RIFLE","value":"294"},{"key":"ACT_RANGE_ATTACK_RPG","value":"295"},{"key":"ACT_MELEE_ATTACK_SWING","value":"296"},{"key":"ACT_RANGE_AIM_LOW","value":"297"},{"key":"ACT_RANGE_AIM_SMG1_LOW","value":"298"},{"key":"ACT_RANGE_AIM_PISTOL_LOW","value":"299"},{"key":"ACT_RANGE_AIM_AR2_LOW","value":"300"},{"key":"ACT_COVER_PISTOL_LOW","value":"301"},{"key":"ACT_COVER_SMG1_LOW","value":"302"},{"key":"ACT_GESTURE_RANGE_ATTACK_AR1","value":"303"},{"key":"ACT_GESTURE_RANGE_ATTACK_AR2","value":"304"},{"key":"ACT_GESTURE_RANGE_ATTACK_AR2_GRENADE","value":"305"},{"key":"ACT_GESTURE_RANGE_ATTACK_HMG1","value":"306"},{"key":"ACT_GESTURE_RANGE_ATTACK_ML","value":"307"},{"key":"ACT_GESTURE_RANGE_ATTACK_SMG1","value":"308"},{"key":"ACT_GESTURE_RANGE_ATTACK_SMG1_LOW","value":"309"},{"key":"ACT_GESTURE_RANGE_ATTACK_SMG2","value":"310"},{"key":"ACT_GESTURE_RANGE_ATTACK_SHOTGUN","value":"311"},{"key":"ACT_GESTURE_RANGE_ATTACK_PISTOL","value":"312"},{"key":"ACT_GESTURE_RANGE_ATTACK_PISTOL_LOW","value":"313"},{"key":"ACT_GESTURE_RANGE_ATTACK_SLAM","value":"314"},{"key":"ACT_GESTURE_RANGE_ATTACK_TRIPWIRE","value":"315"},{"key":"ACT_GESTURE_RANGE_ATTACK_THROW","value":"316"},{"key":"ACT_GESTURE_RANGE_ATTACK_SNIPER_RIFLE","value":"317"},{"key":"ACT_GESTURE_MELEE_ATTACK_SWING","value":"318"},{"key":"ACT_IDLE_RIFLE","value":"319"},{"key":"ACT_IDLE_SMG1","value":"320"},{"key":"ACT_IDLE_ANGRY_SMG1","value":"321"},{"key":"ACT_IDLE_PISTOL","value":"322"},{"key":"ACT_IDLE_ANGRY_PISTOL","value":"323"},{"key":"ACT_IDLE_ANGRY_SHOTGUN","value":"324"},{"key":"ACT_IDLE_STEALTH_PISTOL","value":"325"},{"key":"ACT_IDLE_PACKAGE","value":"326"},{"key":"ACT_WALK_PACKAGE","value":"327"},{"key":"ACT_IDLE_SUITCASE","value":"328"},{"key":"ACT_WALK_SUITCASE","value":"329"},{"key":"ACT_IDLE_SMG1_RELAXED","value":"330"},{"key":"ACT_IDLE_SMG1_STIMULATED","value":"331"},{"key":"ACT_WALK_RIFLE_RELAXED","value":"332"},{"key":"ACT_RUN_RIFLE_RELAXED","value":"333"},{"key":"ACT_WALK_RIFLE_STIMULATED","value":"334"},{"key":"ACT_RUN_RIFLE_STIMULATED","value":"335"},{"key":"ACT_IDLE_AIM_RIFLE_STIMULATED","value":"336"},{"key":"ACT_WALK_AIM_RIFLE_STIMULATED","value":"337"},{"key":"ACT_RUN_AIM_RIFLE_STIMULATED","value":"338"},{"key":"ACT_IDLE_SHOTGUN_RELAXED","value":"339"},{"key":"ACT_IDLE_SHOTGUN_STIMULATED","value":"340"},{"key":"ACT_IDLE_SHOTGUN_AGITATED","value":"341"},{"key":"ACT_WALK_ANGRY","value":"342"},{"key":"ACT_POLICE_HARASS1","value":"343"},{"key":"ACT_POLICE_HARASS2","value":"344"},{"key":"ACT_IDLE_MANNEDGUN","value":"345"},{"key":"ACT_IDLE_MELEE","value":"346"},{"key":"ACT_IDLE_ANGRY_MELEE","value":"347"},{"key":"ACT_IDLE_RPG_RELAXED","value":"348"},{"key":"ACT_IDLE_RPG","value":"349"},{"key":"ACT_IDLE_ANGRY_RPG","value":"350"},{"key":"ACT_COVER_LOW_RPG","value":"351"},{"key":"ACT_WALK_RPG","value":"352"},{"key":"ACT_RUN_RPG","value":"353"},{"key":"ACT_WALK_CROUCH_RPG","value":"354"},{"key":"ACT_RUN_CROUCH_RPG","value":"355"},{"key":"ACT_WALK_RPG_RELAXED","value":"356"},{"key":"ACT_RUN_RPG_RELAXED","value":"357"},{"key":"ACT_WALK_RIFLE","value":"358"},{"key":"ACT_WALK_AIM_RIFLE","value":"359"},{"key":"ACT_WALK_CROUCH_RIFLE","value":"360"},{"key":"ACT_WALK_CROUCH_AIM_RIFLE","value":"361"},{"key":"ACT_RUN_RIFLE","value":"362"},{"key":"ACT_RUN_AIM_RIFLE","value":"363"},{"key":"ACT_RUN_CROUCH_RIFLE","value":"364"},{"key":"ACT_RUN_CROUCH_AIM_RIFLE","value":"365"},{"key":"ACT_RUN_STEALTH_PISTOL","value":"366"},{"key":"ACT_WALK_AIM_SHOTGUN","value":"367"},{"key":"ACT_RUN_AIM_SHOTGUN","value":"368"},{"key":"ACT_WALK_PISTOL","value":"369"},{"key":"ACT_RUN_PISTOL","value":"370"},{"key":"ACT_WALK_AIM_PISTOL","value":"371"},{"key":"ACT_RUN_AIM_PISTOL","value":"372"},{"key":"ACT_WALK_STEALTH_PISTOL","value":"373"},{"key":"ACT_WALK_AIM_STEALTH_PISTOL","value":"374"},{"key":"ACT_RUN_AIM_STEALTH_PISTOL","value":"375"},{"key":"ACT_RELOAD_PISTOL","value":"376"},{"key":"ACT_RELOAD_PISTOL_LOW","value":"377"},{"key":"ACT_RELOAD_SMG1","value":"378"},{"key":"ACT_RELOAD_SMG1_LOW","value":"379"},{"key":"ACT_RELOAD_SHOTGUN","value":"380"},{"key":"ACT_RELOAD_SHOTGUN_LOW","value":"381"},{"key":"ACT_GESTURE_RELOAD","value":"382"},{"key":"ACT_GESTURE_RELOAD_PISTOL","value":"383"},{"key":"ACT_GESTURE_RELOAD_SMG1","value":"384"},{"key":"ACT_GESTURE_RELOAD_SHOTGUN","value":"385"},{"key":"ACT_BUSY_LEAN_LEFT","value":"386"},{"key":"ACT_BUSY_LEAN_LEFT_ENTRY","value":"387"},{"key":"ACT_BUSY_LEAN_LEFT_EXIT","value":"388"},{"key":"ACT_BUSY_LEAN_BACK","value":"389"},{"key":"ACT_BUSY_LEAN_BACK_ENTRY","value":"390"},{"key":"ACT_BUSY_LEAN_BACK_EXIT","value":"391"},{"key":"ACT_BUSY_SIT_GROUND","value":"392"},{"key":"ACT_BUSY_SIT_GROUND_ENTRY","value":"393"},{"key":"ACT_BUSY_SIT_GROUND_EXIT","value":"394"},{"key":"ACT_BUSY_SIT_CHAIR","value":"395"},{"key":"ACT_BUSY_SIT_CHAIR_ENTRY","value":"396"},{"key":"ACT_BUSY_SIT_CHAIR_EXIT","value":"397"},{"key":"ACT_BUSY_STAND","value":"398"},{"key":"ACT_BUSY_QUEUE","value":"399"},{"key":"ACT_DUCK_DODGE","value":"400"},{"key":"ACT_DIE_BARNACLE_SWALLOW","value":"401"},{"key":"ACT_GESTURE_BARNACLE_STRANGLE","value":"402"},{"key":"ACT_PHYSCANNON_DETACH","value":"403"},{"key":"ACT_PHYSCANNON_ANIMATE","value":"404"},{"key":"ACT_PHYSCANNON_ANIMATE_PRE","value":"405"},{"key":"ACT_PHYSCANNON_ANIMATE_POST","value":"406"},{"key":"ACT_DIE_FRONTSIDE","value":"407"},{"key":"ACT_DIE_RIGHTSIDE","value":"408"},{"key":"ACT_DIE_BACKSIDE","value":"409"},{"key":"ACT_DIE_LEFTSIDE","value":"410"},{"key":"ACT_OPEN_DOOR","value":"411"},{"key":"ACT_DI_ALYX_ZOMBIE_MELEE","value":"412"},{"key":"ACT_DI_ALYX_ZOMBIE_TORSO_MELEE","value":"413"},{"key":"ACT_DI_ALYX_HEADCRAB_MELEE","value":"414"},{"key":"ACT_DI_ALYX_ANTLION","value":"415"},{"key":"ACT_DI_ALYX_ZOMBIE_SHOTGUN64","value":"416"},{"key":"ACT_DI_ALYX_ZOMBIE_SHOTGUN26","value":"417"},{"key":"ACT_READINESS_RELAXED_TO_STIMULATED","value":"418"},{"key":"ACT_READINESS_RELAXED_TO_STIMULATED_WALK","value":"419"},{"key":"ACT_READINESS_AGITATED_TO_STIMULATED","value":"420"},{"key":"ACT_READINESS_STIMULATED_TO_RELAXED","value":"421"},{"key":"ACT_READINESS_PISTOL_RELAXED_TO_STIMULATED","value":"422"},{"key":"ACT_READINESS_PISTOL_RELAXED_TO_STIMULATED_WALK","value":"423"},{"key":"ACT_READINESS_PISTOL_AGITATED_TO_STIMULATED","value":"424"},{"key":"ACT_READINESS_PISTOL_STIMULATED_TO_RELAXED","value":"425"},{"key":"ACT_IDLE_CARRY","value":"426"},{"key":"ACT_WALK_CARRY","value":"427"},{"key":"ACT_STARTDYING","value":"428"},{"key":"ACT_DYINGLOOP","value":"429"},{"key":"ACT_DYINGTODEAD","value":"430"},{"key":"ACT_RIDE_MANNED_GUN","value":"431"},{"key":"ACT_VM_SPRINT_ENTER","value":"432"},{"key":"ACT_VM_SPRINT_IDLE","value":"433"},{"key":"ACT_VM_SPRINT_LEAVE","value":"434"},{"key":"ACT_FIRE_START","value":"435"},{"key":"ACT_FIRE_LOOP","value":"436"},{"key":"ACT_FIRE_END","value":"437"},{"key":"ACT_CROUCHING_GRENADEIDLE","value":"438"},{"key":"ACT_CROUCHING_GRENADEREADY","value":"439"},{"key":"ACT_CROUCHING_PRIMARYATTACK","value":"440"},{"key":"ACT_OVERLAY_GRENADEIDLE","value":"441"},{"key":"ACT_OVERLAY_GRENADEREADY","value":"442"},{"key":"ACT_OVERLAY_PRIMARYATTACK","value":"443"},{"key":"ACT_OVERLAY_SHIELD_UP","value":"444"},{"key":"ACT_OVERLAY_SHIELD_DOWN","value":"445"},{"key":"ACT_OVERLAY_SHIELD_UP_IDLE","value":"446"},{"key":"ACT_OVERLAY_SHIELD_ATTACK","value":"447"},{"key":"ACT_OVERLAY_SHIELD_KNOCKBACK","value":"448"},{"key":"ACT_SHIELD_UP","value":"449"},{"key":"ACT_SHIELD_DOWN","value":"450"},{"key":"ACT_SHIELD_UP_IDLE","value":"451"},{"key":"ACT_SHIELD_ATTACK","value":"452"},{"key":"ACT_SHIELD_KNOCKBACK","value":"453"},{"key":"ACT_CROUCHING_SHIELD_UP","value":"454"},{"key":"ACT_CROUCHING_SHIELD_DOWN","value":"455"},{"key":"ACT_CROUCHING_SHIELD_UP_IDLE","value":"456"},{"key":"ACT_CROUCHING_SHIELD_ATTACK","value":"457"},{"key":"ACT_CROUCHING_SHIELD_KNOCKBACK","value":"458"},{"key":"ACT_TURNRIGHT45","value":"459"},{"key":"ACT_TURNLEFT45","value":"460"},{"key":"ACT_TURN","value":"461"},{"key":"ACT_OBJ_ASSEMBLING","value":"462"},{"key":"ACT_OBJ_DISMANTLING","value":"463"},{"key":"ACT_OBJ_STARTUP","value":"464"},{"key":"ACT_OBJ_RUNNING","value":"465"},{"key":"ACT_OBJ_IDLE","value":"466"},{"key":"ACT_OBJ_PLACING","value":"467"},{"key":"ACT_OBJ_DETERIORATING","value":"468"},{"key":"ACT_OBJ_UPGRADING","value":"469"},{"key":"ACT_DEPLOY","value":"470"},{"key":"ACT_DEPLOY_IDLE","value":"471"},{"key":"ACT_UNDEPLOY","value":"472"},{"key":"ACT_GRENADE_ROLL","value":"473"},{"key":"ACT_GRENADE_TOSS","value":"474"},{"key":"ACT_HANDGRENADE_THROW1","value":"475"},{"key":"ACT_HANDGRENADE_THROW2","value":"476"},{"key":"ACT_HANDGRENADE_THROW3","value":"477"},{"key":"ACT_SHOTGUN_IDLE_DEEP","value":"478"},{"key":"ACT_SHOTGUN_IDLE4","value":"479"},{"key":"ACT_GLOCK_SHOOTEMPTY","value":"480"},{"key":"ACT_GLOCK_SHOOT_RELOAD","value":"481"},{"key":"ACT_RPG_DRAW_UNLOADED","value":"482"},{"key":"ACT_RPG_HOLSTER_UNLOADED","value":"483"},{"key":"ACT_RPG_IDLE_UNLOADED","value":"484"},{"key":"ACT_RPG_FIDGET_UNLOADED","value":"485"},{"key":"ACT_CROSSBOW_DRAW_UNLOADED","value":"486"},{"key":"ACT_CROSSBOW_IDLE_UNLOADED","value":"487"},{"key":"ACT_CROSSBOW_FIDGET_UNLOADED","value":"488"},{"key":"ACT_GAUSS_SPINUP","value":"489"},{"key":"ACT_GAUSS_SPINCYCLE","value":"490"},{"key":"ACT_TRIPMINE_GROUND","value":"491"},{"key":"ACT_TRIPMINE_WORLD","value":"492"},{"key":"ACT_VM_PRIMARYATTACK_SILENCED","value":"493"},{"key":"ACT_VM_RELOAD_SILENCED","value":"494"},{"key":"ACT_VM_DRYFIRE_SILENCED","value":"495"},{"key":"ACT_VM_IDLE_SILENCED","value":"496"},{"key":"ACT_VM_DRAW_SILENCED","value":"497"},{"key":"ACT_VM_IDLE_EMPTY_LEFT","value":"498"},{"key":"ACT_VM_DRYFIRE_LEFT","value":"499"},{"key":"ACT_PLAYER_IDLE_FIRE","value":"500"},{"key":"ACT_PLAYER_CROUCH_FIRE","value":"501"},{"key":"ACT_PLAYER_CROUCH_WALK_FIRE","value":"502"},{"key":"ACT_PLAYER_WALK_FIRE","value":"503"},{"key":"ACT_PLAYER_RUN_FIRE","value":"504"},{"key":"ACT_IDLETORUN","value":"505"},{"key":"ACT_RUNTOIDLE","value":"506"},{"key":"ACT_SPRINT","value":"507"},{"key":"ACT_GET_DOWN_STAND","value":"508"},{"key":"ACT_GET_UP_STAND","value":"509"},{"key":"ACT_GET_DOWN_CROUCH","value":"510"},{"key":"ACT_GET_UP_CROUCH","value":"511"},{"key":"ACT_PRONE_FORWARD","value":"512"},{"key":"ACT_PRONE_IDLE","value":"513"},{"key":"ACT_DEEPIDLE1","value":"514"},{"key":"ACT_DEEPIDLE2","value":"515"},{"key":"ACT_DEEPIDLE3","value":"516"},{"key":"ACT_DEEPIDLE4","value":"517"},{"key":"ACT_VM_RELOAD_DEPLOYED","value":"518"},{"key":"ACT_VM_RELOAD_IDLE","value":"519"},{"key":"ACT_VM_DRAW_DEPLOYED","value":"520"},{"key":"ACT_VM_DRAW_EMPTY","value":"521"},{"key":"ACT_VM_PRIMARYATTACK_EMPTY","value":"522"},{"key":"ACT_VM_RELOAD_EMPTY","value":"523"},{"key":"ACT_VM_IDLE_EMPTY","value":"524"},{"key":"ACT_VM_IDLE_DEPLOYED_EMPTY","value":"525"},{"key":"ACT_VM_IDLE_8","value":"526"},{"key":"ACT_VM_IDLE_7","value":"527"},{"key":"ACT_VM_IDLE_6","value":"528"},{"key":"ACT_VM_IDLE_5","value":"529"},{"key":"ACT_VM_IDLE_4","value":"530"},{"key":"ACT_VM_IDLE_3","value":"531"},{"key":"ACT_VM_IDLE_2","value":"532"},{"key":"ACT_VM_IDLE_1","value":"533"},{"key":"ACT_VM_IDLE_DEPLOYED","value":"534"},{"key":"ACT_VM_IDLE_DEPLOYED_8","value":"535"},{"key":"ACT_VM_IDLE_DEPLOYED_7","value":"536"},{"key":"ACT_VM_IDLE_DEPLOYED_6","value":"537"},{"key":"ACT_VM_IDLE_DEPLOYED_5","value":"538"},{"key":"ACT_VM_IDLE_DEPLOYED_4","value":"539"},{"key":"ACT_VM_IDLE_DEPLOYED_3","value":"540"},{"key":"ACT_VM_IDLE_DEPLOYED_2","value":"541"},{"key":"ACT_VM_IDLE_DEPLOYED_1","value":"542"},{"key":"ACT_VM_UNDEPLOY","value":"543"},{"key":"ACT_VM_UNDEPLOY_8","value":"544"},{"key":"ACT_VM_UNDEPLOY_7","value":"545"},{"key":"ACT_VM_UNDEPLOY_6","value":"546"},{"key":"ACT_VM_UNDEPLOY_5","value":"547"},{"key":"ACT_VM_UNDEPLOY_4","value":"548"},{"key":"ACT_VM_UNDEPLOY_3","value":"549"},{"key":"ACT_VM_UNDEPLOY_2","value":"550"},{"key":"ACT_VM_UNDEPLOY_1","value":"551"},{"key":"ACT_VM_UNDEPLOY_EMPTY","value":"552"},{"key":"ACT_VM_DEPLOY","value":"553"},{"key":"ACT_VM_DEPLOY_8","value":"554"},{"key":"ACT_VM_DEPLOY_7","value":"555"},{"key":"ACT_VM_DEPLOY_6","value":"556"},{"key":"ACT_VM_DEPLOY_5","value":"557"},{"key":"ACT_VM_DEPLOY_4","value":"558"},{"key":"ACT_VM_DEPLOY_3","value":"559"},{"key":"ACT_VM_DEPLOY_2","value":"560"},{"key":"ACT_VM_DEPLOY_1","value":"561"},{"key":"ACT_VM_DEPLOY_EMPTY","value":"562"},{"key":"ACT_VM_PRIMARYATTACK_8","value":"563"},{"key":"ACT_VM_PRIMARYATTACK_7","value":"564"},{"key":"ACT_VM_PRIMARYATTACK_6","value":"565"},{"key":"ACT_VM_PRIMARYATTACK_5","value":"566"},{"key":"ACT_VM_PRIMARYATTACK_4","value":"567"},{"key":"ACT_VM_PRIMARYATTACK_3","value":"568"},{"key":"ACT_VM_PRIMARYATTACK_2","value":"569"},{"key":"ACT_VM_PRIMARYATTACK_1","value":"570"},{"key":"ACT_VM_PRIMARYATTACK_DEPLOYED","value":"571"},{"key":"ACT_VM_PRIMARYATTACK_DEPLOYED_8","value":"572"},{"key":"ACT_VM_PRIMARYATTACK_DEPLOYED_7","value":"573"},{"key":"ACT_VM_PRIMARYATTACK_DEPLOYED_6","value":"574"},{"key":"ACT_VM_PRIMARYATTACK_DEPLOYED_5","value":"575"},{"key":"ACT_VM_PRIMARYATTACK_DEPLOYED_4","value":"576"},{"key":"ACT_VM_PRIMARYATTACK_DEPLOYED_3","value":"577"},{"key":"ACT_VM_PRIMARYATTACK_DEPLOYED_2","value":"578"},{"key":"ACT_VM_PRIMARYATTACK_DEPLOYED_1","value":"579"},{"key":"ACT_VM_PRIMARYATTACK_DEPLOYED_EMPTY","value":"580"},{"key":"ACT_DOD_DEPLOYED","value":"581"},{"key":"ACT_DOD_PRONE_DEPLOYED","value":"582"},{"key":"ACT_DOD_IDLE_ZOOMED","value":"583"},{"key":"ACT_DOD_WALK_ZOOMED","value":"584"},{"key":"ACT_DOD_CROUCH_ZOOMED","value":"585"},{"key":"ACT_DOD_CROUCHWALK_ZOOMED","value":"586"},{"key":"ACT_DOD_PRONE_ZOOMED","value":"587"},{"key":"ACT_DOD_PRONE_FORWARD_ZOOMED","value":"588"},{"key":"ACT_DOD_PRIMARYATTACK_DEPLOYED","value":"589"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_DEPLOYED","value":"590"},{"key":"ACT_DOD_RELOAD_DEPLOYED","value":"591"},{"key":"ACT_DOD_RELOAD_PRONE_DEPLOYED","value":"592"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE","value":"593"},{"key":"ACT_DOD_SECONDARYATTACK_PRONE","value":"594"},{"key":"ACT_DOD_RELOAD_CROUCH","value":"595"},{"key":"ACT_DOD_RELOAD_PRONE","value":"596"},{"key":"ACT_DOD_STAND_IDLE","value":"597"},{"key":"ACT_DOD_STAND_AIM","value":"598"},{"key":"ACT_DOD_CROUCH_IDLE","value":"599"},{"key":"ACT_DOD_CROUCH_AIM","value":"600"},{"key":"ACT_DOD_CROUCHWALK_IDLE","value":"601"},{"key":"ACT_DOD_CROUCHWALK_AIM","value":"602"},{"key":"ACT_DOD_WALK_IDLE","value":"603"},{"key":"ACT_DOD_WALK_AIM","value":"604"},{"key":"ACT_DOD_RUN_IDLE","value":"605"},{"key":"ACT_DOD_RUN_AIM","value":"606"},{"key":"ACT_DOD_STAND_AIM_PISTOL","value":"607"},{"key":"ACT_DOD_CROUCH_AIM_PISTOL","value":"608"},{"key":"ACT_DOD_CROUCHWALK_AIM_PISTOL","value":"609"},{"key":"ACT_DOD_WALK_AIM_PISTOL","value":"610"},{"key":"ACT_DOD_RUN_AIM_PISTOL","value":"611"},{"key":"ACT_DOD_PRONE_AIM_PISTOL","value":"612"},{"key":"ACT_DOD_STAND_IDLE_PISTOL","value":"613"},{"key":"ACT_DOD_CROUCH_IDLE_PISTOL","value":"614"},{"key":"ACT_DOD_CROUCHWALK_IDLE_PISTOL","value":"615"},{"key":"ACT_DOD_WALK_IDLE_PISTOL","value":"616"},{"key":"ACT_DOD_RUN_IDLE_PISTOL","value":"617"},{"key":"ACT_DOD_SPRINT_IDLE_PISTOL","value":"618"},{"key":"ACT_DOD_PRONEWALK_IDLE_PISTOL","value":"619"},{"key":"ACT_DOD_STAND_AIM_C96","value":"620"},{"key":"ACT_DOD_CROUCH_AIM_C96","value":"621"},{"key":"ACT_DOD_CROUCHWALK_AIM_C96","value":"622"},{"key":"ACT_DOD_WALK_AIM_C96","value":"623"},{"key":"ACT_DOD_RUN_AIM_C96","value":"624"},{"key":"ACT_DOD_PRONE_AIM_C96","value":"625"},{"key":"ACT_DOD_STAND_IDLE_C96","value":"626"},{"key":"ACT_DOD_CROUCH_IDLE_C96","value":"627"},{"key":"ACT_DOD_CROUCHWALK_IDLE_C96","value":"628"},{"key":"ACT_DOD_WALK_IDLE_C96","value":"629"},{"key":"ACT_DOD_RUN_IDLE_C96","value":"630"},{"key":"ACT_DOD_SPRINT_IDLE_C96","value":"631"},{"key":"ACT_DOD_PRONEWALK_IDLE_C96","value":"632"},{"key":"ACT_DOD_STAND_AIM_RIFLE","value":"633"},{"key":"ACT_DOD_CROUCH_AIM_RIFLE","value":"634"},{"key":"ACT_DOD_CROUCHWALK_AIM_RIFLE","value":"635"},{"key":"ACT_DOD_WALK_AIM_RIFLE","value":"636"},{"key":"ACT_DOD_RUN_AIM_RIFLE","value":"637"},{"key":"ACT_DOD_PRONE_AIM_RIFLE","value":"638"},{"key":"ACT_DOD_STAND_IDLE_RIFLE","value":"639"},{"key":"ACT_DOD_CROUCH_IDLE_RIFLE","value":"640"},{"key":"ACT_DOD_CROUCHWALK_IDLE_RIFLE","value":"641"},{"key":"ACT_DOD_WALK_IDLE_RIFLE","value":"642"},{"key":"ACT_DOD_RUN_IDLE_RIFLE","value":"643"},{"key":"ACT_DOD_SPRINT_IDLE_RIFLE","value":"644"},{"key":"ACT_DOD_PRONEWALK_IDLE_RIFLE","value":"645"},{"key":"ACT_DOD_STAND_AIM_BOLT","value":"646"},{"key":"ACT_DOD_CROUCH_AIM_BOLT","value":"647"},{"key":"ACT_DOD_CROUCHWALK_AIM_BOLT","value":"648"},{"key":"ACT_DOD_WALK_AIM_BOLT","value":"649"},{"key":"ACT_DOD_RUN_AIM_BOLT","value":"650"},{"key":"ACT_DOD_PRONE_AIM_BOLT","value":"651"},{"key":"ACT_DOD_STAND_IDLE_BOLT","value":"652"},{"key":"ACT_DOD_CROUCH_IDLE_BOLT","value":"653"},{"key":"ACT_DOD_CROUCHWALK_IDLE_BOLT","value":"654"},{"key":"ACT_DOD_WALK_IDLE_BOLT","value":"655"},{"key":"ACT_DOD_RUN_IDLE_BOLT","value":"656"},{"key":"ACT_DOD_SPRINT_IDLE_BOLT","value":"657"},{"key":"ACT_DOD_PRONEWALK_IDLE_BOLT","value":"658"},{"key":"ACT_DOD_STAND_AIM_TOMMY","value":"659"},{"key":"ACT_DOD_CROUCH_AIM_TOMMY","value":"660"},{"key":"ACT_DOD_CROUCHWALK_AIM_TOMMY","value":"661"},{"key":"ACT_DOD_WALK_AIM_TOMMY","value":"662"},{"key":"ACT_DOD_RUN_AIM_TOMMY","value":"663"},{"key":"ACT_DOD_PRONE_AIM_TOMMY","value":"664"},{"key":"ACT_DOD_STAND_IDLE_TOMMY","value":"665"},{"key":"ACT_DOD_CROUCH_IDLE_TOMMY","value":"666"},{"key":"ACT_DOD_CROUCHWALK_IDLE_TOMMY","value":"667"},{"key":"ACT_DOD_WALK_IDLE_TOMMY","value":"668"},{"key":"ACT_DOD_RUN_IDLE_TOMMY","value":"669"},{"key":"ACT_DOD_SPRINT_IDLE_TOMMY","value":"670"},{"key":"ACT_DOD_PRONEWALK_IDLE_TOMMY","value":"671"},{"key":"ACT_DOD_STAND_AIM_MP40","value":"672"},{"key":"ACT_DOD_CROUCH_AIM_MP40","value":"673"},{"key":"ACT_DOD_CROUCHWALK_AIM_MP40","value":"674"},{"key":"ACT_DOD_WALK_AIM_MP40","value":"675"},{"key":"ACT_DOD_RUN_AIM_MP40","value":"676"},{"key":"ACT_DOD_PRONE_AIM_MP40","value":"677"},{"key":"ACT_DOD_STAND_IDLE_MP40","value":"678"},{"key":"ACT_DOD_CROUCH_IDLE_MP40","value":"679"},{"key":"ACT_DOD_CROUCHWALK_IDLE_MP40","value":"680"},{"key":"ACT_DOD_WALK_IDLE_MP40","value":"681"},{"key":"ACT_DOD_RUN_IDLE_MP40","value":"682"},{"key":"ACT_DOD_SPRINT_IDLE_MP40","value":"683"},{"key":"ACT_DOD_PRONEWALK_IDLE_MP40","value":"684"},{"key":"ACT_DOD_STAND_AIM_MP44","value":"685"},{"key":"ACT_DOD_CROUCH_AIM_MP44","value":"686"},{"key":"ACT_DOD_CROUCHWALK_AIM_MP44","value":"687"},{"key":"ACT_DOD_WALK_AIM_MP44","value":"688"},{"key":"ACT_DOD_RUN_AIM_MP44","value":"689"},{"key":"ACT_DOD_PRONE_AIM_MP44","value":"690"},{"key":"ACT_DOD_STAND_IDLE_MP44","value":"691"},{"key":"ACT_DOD_CROUCH_IDLE_MP44","value":"692"},{"key":"ACT_DOD_CROUCHWALK_IDLE_MP44","value":"693"},{"key":"ACT_DOD_WALK_IDLE_MP44","value":"694"},{"key":"ACT_DOD_RUN_IDLE_MP44","value":"695"},{"key":"ACT_DOD_SPRINT_IDLE_MP44","value":"696"},{"key":"ACT_DOD_PRONEWALK_IDLE_MP44","value":"697"},{"key":"ACT_DOD_STAND_AIM_GREASE","value":"698"},{"key":"ACT_DOD_CROUCH_AIM_GREASE","value":"699"},{"key":"ACT_DOD_CROUCHWALK_AIM_GREASE","value":"700"},{"key":"ACT_DOD_WALK_AIM_GREASE","value":"701"},{"key":"ACT_DOD_RUN_AIM_GREASE","value":"702"},{"key":"ACT_DOD_PRONE_AIM_GREASE","value":"703"},{"key":"ACT_DOD_STAND_IDLE_GREASE","value":"704"},{"key":"ACT_DOD_CROUCH_IDLE_GREASE","value":"705"},{"key":"ACT_DOD_CROUCHWALK_IDLE_GREASE","value":"706"},{"key":"ACT_DOD_WALK_IDLE_GREASE","value":"707"},{"key":"ACT_DOD_RUN_IDLE_GREASE","value":"708"},{"key":"ACT_DOD_SPRINT_IDLE_GREASE","value":"709"},{"key":"ACT_DOD_PRONEWALK_IDLE_GREASE","value":"710"},{"key":"ACT_DOD_STAND_AIM_MG","value":"711"},{"key":"ACT_DOD_CROUCH_AIM_MG","value":"712"},{"key":"ACT_DOD_CROUCHWALK_AIM_MG","value":"713"},{"key":"ACT_DOD_WALK_AIM_MG","value":"714"},{"key":"ACT_DOD_RUN_AIM_MG","value":"715"},{"key":"ACT_DOD_PRONE_AIM_MG","value":"716"},{"key":"ACT_DOD_STAND_IDLE_MG","value":"717"},{"key":"ACT_DOD_CROUCH_IDLE_MG","value":"718"},{"key":"ACT_DOD_CROUCHWALK_IDLE_MG","value":"719"},{"key":"ACT_DOD_WALK_IDLE_MG","value":"720"},{"key":"ACT_DOD_RUN_IDLE_MG","value":"721"},{"key":"ACT_DOD_SPRINT_IDLE_MG","value":"722"},{"key":"ACT_DOD_PRONEWALK_IDLE_MG","value":"723"},{"key":"ACT_DOD_STAND_AIM_30CAL","value":"724"},{"key":"ACT_DOD_CROUCH_AIM_30CAL","value":"725"},{"key":"ACT_DOD_CROUCHWALK_AIM_30CAL","value":"726"},{"key":"ACT_DOD_WALK_AIM_30CAL","value":"727"},{"key":"ACT_DOD_RUN_AIM_30CAL","value":"728"},{"key":"ACT_DOD_PRONE_AIM_30CAL","value":"729"},{"key":"ACT_DOD_STAND_IDLE_30CAL","value":"730"},{"key":"ACT_DOD_CROUCH_IDLE_30CAL","value":"731"},{"key":"ACT_DOD_CROUCHWALK_IDLE_30CAL","value":"732"},{"key":"ACT_DOD_WALK_IDLE_30CAL","value":"733"},{"key":"ACT_DOD_RUN_IDLE_30CAL","value":"734"},{"key":"ACT_DOD_SPRINT_IDLE_30CAL","value":"735"},{"key":"ACT_DOD_PRONEWALK_IDLE_30CAL","value":"736"},{"key":"ACT_DOD_STAND_AIM_GREN_FRAG","value":"737"},{"key":"ACT_DOD_CROUCH_AIM_GREN_FRAG","value":"738"},{"key":"ACT_DOD_CROUCHWALK_AIM_GREN_FRAG","value":"739"},{"key":"ACT_DOD_WALK_AIM_GREN_FRAG","value":"740"},{"key":"ACT_DOD_RUN_AIM_GREN_FRAG","value":"741"},{"key":"ACT_DOD_PRONE_AIM_GREN_FRAG","value":"742"},{"key":"ACT_DOD_SPRINT_AIM_GREN_FRAG","value":"743"},{"key":"ACT_DOD_PRONEWALK_AIM_GREN_FRAG","value":"744"},{"key":"ACT_DOD_STAND_AIM_GREN_STICK","value":"745"},{"key":"ACT_DOD_CROUCH_AIM_GREN_STICK","value":"746"},{"key":"ACT_DOD_CROUCHWALK_AIM_GREN_STICK","value":"747"},{"key":"ACT_DOD_WALK_AIM_GREN_STICK","value":"748"},{"key":"ACT_DOD_RUN_AIM_GREN_STICK","value":"749"},{"key":"ACT_DOD_PRONE_AIM_GREN_STICK","value":"750"},{"key":"ACT_DOD_SPRINT_AIM_GREN_STICK","value":"751"},{"key":"ACT_DOD_PRONEWALK_AIM_GREN_STICK","value":"752"},{"key":"ACT_DOD_STAND_AIM_KNIFE","value":"753"},{"key":"ACT_DOD_CROUCH_AIM_KNIFE","value":"754"},{"key":"ACT_DOD_CROUCHWALK_AIM_KNIFE","value":"755"},{"key":"ACT_DOD_WALK_AIM_KNIFE","value":"756"},{"key":"ACT_DOD_RUN_AIM_KNIFE","value":"757"},{"key":"ACT_DOD_PRONE_AIM_KNIFE","value":"758"},{"key":"ACT_DOD_SPRINT_AIM_KNIFE","value":"759"},{"key":"ACT_DOD_PRONEWALK_AIM_KNIFE","value":"760"},{"key":"ACT_DOD_STAND_AIM_SPADE","value":"761"},{"key":"ACT_DOD_CROUCH_AIM_SPADE","value":"762"},{"key":"ACT_DOD_CROUCHWALK_AIM_SPADE","value":"763"},{"key":"ACT_DOD_WALK_AIM_SPADE","value":"764"},{"key":"ACT_DOD_RUN_AIM_SPADE","value":"765"},{"key":"ACT_DOD_PRONE_AIM_SPADE","value":"766"},{"key":"ACT_DOD_SPRINT_AIM_SPADE","value":"767"},{"key":"ACT_DOD_PRONEWALK_AIM_SPADE","value":"768"},{"key":"ACT_DOD_STAND_AIM_BAZOOKA","value":"769"},{"key":"ACT_DOD_CROUCH_AIM_BAZOOKA","value":"770"},{"key":"ACT_DOD_CROUCHWALK_AIM_BAZOOKA","value":"771"},{"key":"ACT_DOD_WALK_AIM_BAZOOKA","value":"772"},{"key":"ACT_DOD_RUN_AIM_BAZOOKA","value":"773"},{"key":"ACT_DOD_PRONE_AIM_BAZOOKA","value":"774"},{"key":"ACT_DOD_STAND_IDLE_BAZOOKA","value":"775"},{"key":"ACT_DOD_CROUCH_IDLE_BAZOOKA","value":"776"},{"key":"ACT_DOD_CROUCHWALK_IDLE_BAZOOKA","value":"777"},{"key":"ACT_DOD_WALK_IDLE_BAZOOKA","value":"778"},{"key":"ACT_DOD_RUN_IDLE_BAZOOKA","value":"779"},{"key":"ACT_DOD_SPRINT_IDLE_BAZOOKA","value":"780"},{"key":"ACT_DOD_PRONEWALK_IDLE_BAZOOKA","value":"781"},{"key":"ACT_DOD_STAND_AIM_PSCHRECK","value":"782"},{"key":"ACT_DOD_CROUCH_AIM_PSCHRECK","value":"783"},{"key":"ACT_DOD_CROUCHWALK_AIM_PSCHRECK","value":"784"},{"key":"ACT_DOD_WALK_AIM_PSCHRECK","value":"785"},{"key":"ACT_DOD_RUN_AIM_PSCHRECK","value":"786"},{"key":"ACT_DOD_PRONE_AIM_PSCHRECK","value":"787"},{"key":"ACT_DOD_STAND_IDLE_PSCHRECK","value":"788"},{"key":"ACT_DOD_CROUCH_IDLE_PSCHRECK","value":"789"},{"key":"ACT_DOD_CROUCHWALK_IDLE_PSCHRECK","value":"790"},{"key":"ACT_DOD_WALK_IDLE_PSCHRECK","value":"791"},{"key":"ACT_DOD_RUN_IDLE_PSCHRECK","value":"792"},{"key":"ACT_DOD_SPRINT_IDLE_PSCHRECK","value":"793"},{"key":"ACT_DOD_PRONEWALK_IDLE_PSCHRECK","value":"794"},{"key":"ACT_DOD_STAND_AIM_BAR","value":"795"},{"key":"ACT_DOD_CROUCH_AIM_BAR","value":"796"},{"key":"ACT_DOD_CROUCHWALK_AIM_BAR","value":"797"},{"key":"ACT_DOD_WALK_AIM_BAR","value":"798"},{"key":"ACT_DOD_RUN_AIM_BAR","value":"799"},{"key":"ACT_DOD_PRONE_AIM_BAR","value":"800"},{"key":"ACT_DOD_STAND_IDLE_BAR","value":"801"},{"key":"ACT_DOD_CROUCH_IDLE_BAR","value":"802"},{"key":"ACT_DOD_CROUCHWALK_IDLE_BAR","value":"803"},{"key":"ACT_DOD_WALK_IDLE_BAR","value":"804"},{"key":"ACT_DOD_RUN_IDLE_BAR","value":"805"},{"key":"ACT_DOD_SPRINT_IDLE_BAR","value":"806"},{"key":"ACT_DOD_PRONEWALK_IDLE_BAR","value":"807"},{"key":"ACT_DOD_STAND_ZOOM_RIFLE","value":"808"},{"key":"ACT_DOD_CROUCH_ZOOM_RIFLE","value":"809"},{"key":"ACT_DOD_CROUCHWALK_ZOOM_RIFLE","value":"810"},{"key":"ACT_DOD_WALK_ZOOM_RIFLE","value":"811"},{"key":"ACT_DOD_RUN_ZOOM_RIFLE","value":"812"},{"key":"ACT_DOD_PRONE_ZOOM_RIFLE","value":"813"},{"key":"ACT_DOD_STAND_ZOOM_BOLT","value":"814"},{"key":"ACT_DOD_CROUCH_ZOOM_BOLT","value":"815"},{"key":"ACT_DOD_CROUCHWALK_ZOOM_BOLT","value":"816"},{"key":"ACT_DOD_WALK_ZOOM_BOLT","value":"817"},{"key":"ACT_DOD_RUN_ZOOM_BOLT","value":"818"},{"key":"ACT_DOD_PRONE_ZOOM_BOLT","value":"819"},{"key":"ACT_DOD_STAND_ZOOM_BAZOOKA","value":"820"},{"key":"ACT_DOD_CROUCH_ZOOM_BAZOOKA","value":"821"},{"key":"ACT_DOD_CROUCHWALK_ZOOM_BAZOOKA","value":"822"},{"key":"ACT_DOD_WALK_ZOOM_BAZOOKA","value":"823"},{"key":"ACT_DOD_RUN_ZOOM_BAZOOKA","value":"824"},{"key":"ACT_DOD_PRONE_ZOOM_BAZOOKA","value":"825"},{"key":"ACT_DOD_STAND_ZOOM_PSCHRECK","value":"826"},{"key":"ACT_DOD_CROUCH_ZOOM_PSCHRECK","value":"827"},{"key":"ACT_DOD_CROUCHWALK_ZOOM_PSCHRECK","value":"828"},{"key":"ACT_DOD_WALK_ZOOM_PSCHRECK","value":"829"},{"key":"ACT_DOD_RUN_ZOOM_PSCHRECK","value":"830"},{"key":"ACT_DOD_PRONE_ZOOM_PSCHRECK","value":"831"},{"key":"ACT_DOD_DEPLOY_RIFLE","value":"832"},{"key":"ACT_DOD_DEPLOY_TOMMY","value":"833"},{"key":"ACT_DOD_DEPLOY_MG","value":"834"},{"key":"ACT_DOD_DEPLOY_30CAL","value":"835"},{"key":"ACT_DOD_PRONE_DEPLOY_RIFLE","value":"836"},{"key":"ACT_DOD_PRONE_DEPLOY_TOMMY","value":"837"},{"key":"ACT_DOD_PRONE_DEPLOY_MG","value":"838"},{"key":"ACT_DOD_PRONE_DEPLOY_30CAL","value":"839"},{"key":"ACT_DOD_PRIMARYATTACK_RIFLE","value":"840"},{"key":"ACT_DOD_SECONDARYATTACK_RIFLE","value":"841"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_RIFLE","value":"842"},{"key":"ACT_DOD_SECONDARYATTACK_PRONE_RIFLE","value":"843"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_DEPLOYED_RIFLE","value":"844"},{"key":"ACT_DOD_PRIMARYATTACK_DEPLOYED_RIFLE","value":"845"},{"key":"ACT_DOD_PRIMARYATTACK_BOLT","value":"846"},{"key":"ACT_DOD_SECONDARYATTACK_BOLT","value":"847"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_BOLT","value":"848"},{"key":"ACT_DOD_SECONDARYATTACK_PRONE_BOLT","value":"849"},{"key":"ACT_DOD_PRIMARYATTACK_TOMMY","value":"850"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_TOMMY","value":"851"},{"key":"ACT_DOD_SECONDARYATTACK_TOMMY","value":"852"},{"key":"ACT_DOD_SECONDARYATTACK_PRONE_TOMMY","value":"853"},{"key":"ACT_DOD_PRIMARYATTACK_MP40","value":"854"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_MP40","value":"855"},{"key":"ACT_DOD_SECONDARYATTACK_MP40","value":"856"},{"key":"ACT_DOD_SECONDARYATTACK_PRONE_MP40","value":"857"},{"key":"ACT_DOD_PRIMARYATTACK_MP44","value":"858"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_MP44","value":"859"},{"key":"ACT_DOD_PRIMARYATTACK_GREASE","value":"860"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_GREASE","value":"861"},{"key":"ACT_DOD_PRIMARYATTACK_PISTOL","value":"862"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_PISTOL","value":"863"},{"key":"ACT_DOD_PRIMARYATTACK_C96","value":"864"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_C96","value":"865"},{"key":"ACT_DOD_PRIMARYATTACK_MG","value":"866"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_MG","value":"867"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_DEPLOYED_MG","value":"868"},{"key":"ACT_DOD_PRIMARYATTACK_DEPLOYED_MG","value":"869"},{"key":"ACT_DOD_PRIMARYATTACK_30CAL","value":"870"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_30CAL","value":"871"},{"key":"ACT_DOD_PRIMARYATTACK_DEPLOYED_30CAL","value":"872"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_DEPLOYED_30CAL","value":"873"},{"key":"ACT_DOD_PRIMARYATTACK_GREN_FRAG","value":"874"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_GREN_FRAG","value":"875"},{"key":"ACT_DOD_PRIMARYATTACK_GREN_STICK","value":"876"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_GREN_STICK","value":"877"},{"key":"ACT_DOD_PRIMARYATTACK_KNIFE","value":"878"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_KNIFE","value":"879"},{"key":"ACT_DOD_PRIMARYATTACK_SPADE","value":"880"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_SPADE","value":"881"},{"key":"ACT_DOD_PRIMARYATTACK_BAZOOKA","value":"882"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_BAZOOKA","value":"883"},{"key":"ACT_DOD_PRIMARYATTACK_PSCHRECK","value":"884"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_PSCHRECK","value":"885"},{"key":"ACT_DOD_PRIMARYATTACK_BAR","value":"886"},{"key":"ACT_DOD_PRIMARYATTACK_PRONE_BAR","value":"887"},{"key":"ACT_DOD_RELOAD_GARAND","value":"888"},{"key":"ACT_DOD_RELOAD_K43","value":"889"},{"key":"ACT_DOD_RELOAD_BAR","value":"890"},{"key":"ACT_DOD_RELOAD_MP40","value":"891"},{"key":"ACT_DOD_RELOAD_MP44","value":"892"},{"key":"ACT_DOD_RELOAD_BOLT","value":"893"},{"key":"ACT_DOD_RELOAD_M1CARBINE","value":"894"},{"key":"ACT_DOD_RELOAD_TOMMY","value":"895"},{"key":"ACT_DOD_RELOAD_GREASEGUN","value":"896"},{"key":"ACT_DOD_RELOAD_PISTOL","value":"897"},{"key":"ACT_DOD_RELOAD_FG42","value":"898"},{"key":"ACT_DOD_RELOAD_RIFLE","value":"899"},{"key":"ACT_DOD_RELOAD_RIFLEGRENADE","value":"900"},{"key":"ACT_DOD_RELOAD_C96","value":"901"},{"key":"ACT_DOD_RELOAD_CROUCH_BAR","value":"902"},{"key":"ACT_DOD_RELOAD_CROUCH_RIFLE","value":"903"},{"key":"ACT_DOD_RELOAD_CROUCH_RIFLEGRENADE","value":"904"},{"key":"ACT_DOD_RELOAD_CROUCH_BOLT","value":"905"},{"key":"ACT_DOD_RELOAD_CROUCH_MP44","value":"906"},{"key":"ACT_DOD_RELOAD_CROUCH_MP40","value":"907"},{"key":"ACT_DOD_RELOAD_CROUCH_TOMMY","value":"908"},{"key":"ACT_DOD_RELOAD_CROUCH_BAZOOKA","value":"909"},{"key":"ACT_DOD_RELOAD_CROUCH_PSCHRECK","value":"910"},{"key":"ACT_DOD_RELOAD_CROUCH_PISTOL","value":"911"},{"key":"ACT_DOD_RELOAD_CROUCH_M1CARBINE","value":"912"},{"key":"ACT_DOD_RELOAD_CROUCH_C96","value":"913"},{"key":"ACT_DOD_RELOAD_BAZOOKA","value":"914"},{"key":"ACT_DOD_ZOOMLOAD_BAZOOKA","value":"915"},{"key":"ACT_DOD_RELOAD_PSCHRECK","value":"916"},{"key":"ACT_DOD_ZOOMLOAD_PSCHRECK","value":"917"},{"key":"ACT_DOD_RELOAD_DEPLOYED_FG42","value":"918"},{"key":"ACT_DOD_RELOAD_DEPLOYED_30CAL","value":"919"},{"key":"ACT_DOD_RELOAD_DEPLOYED_MG","value":"920"},{"key":"ACT_DOD_RELOAD_DEPLOYED_MG34","value":"921"},{"key":"ACT_DOD_RELOAD_DEPLOYED_BAR","value":"922"},{"key":"ACT_DOD_RELOAD_PRONE_PISTOL","value":"923"},{"key":"ACT_DOD_RELOAD_PRONE_GARAND","value":"924"},{"key":"ACT_DOD_RELOAD_PRONE_M1CARBINE","value":"925"},{"key":"ACT_DOD_RELOAD_PRONE_BOLT","value":"926"},{"key":"ACT_DOD_RELOAD_PRONE_K43","value":"927"},{"key":"ACT_DOD_RELOAD_PRONE_MP40","value":"928"},{"key":"ACT_DOD_RELOAD_PRONE_MP44","value":"929"},{"key":"ACT_DOD_RELOAD_PRONE_BAR","value":"930"},{"key":"ACT_DOD_RELOAD_PRONE_GREASEGUN","value":"931"},{"key":"ACT_DOD_RELOAD_PRONE_TOMMY","value":"932"},{"key":"ACT_DOD_RELOAD_PRONE_FG42","value":"933"},{"key":"ACT_DOD_RELOAD_PRONE_RIFLE","value":"934"},{"key":"ACT_DOD_RELOAD_PRONE_RIFLEGRENADE","value":"935"},{"key":"ACT_DOD_RELOAD_PRONE_C96","value":"936"},{"key":"ACT_DOD_RELOAD_PRONE_BAZOOKA","value":"937"},{"key":"ACT_DOD_ZOOMLOAD_PRONE_BAZOOKA","value":"938"},{"key":"ACT_DOD_RELOAD_PRONE_PSCHRECK","value":"939"},{"key":"ACT_DOD_ZOOMLOAD_PRONE_PSCHRECK","value":"940"},{"key":"ACT_DOD_RELOAD_PRONE_DEPLOYED_BAR","value":"941"},{"key":"ACT_DOD_RELOAD_PRONE_DEPLOYED_FG42","value":"942"},{"key":"ACT_DOD_RELOAD_PRONE_DEPLOYED_30CAL","value":"943"},{"key":"ACT_DOD_RELOAD_PRONE_DEPLOYED_MG","value":"944"},{"key":"ACT_DOD_RELOAD_PRONE_DEPLOYED_MG34","value":"945"},{"key":"ACT_DOD_PRONE_ZOOM_FORWARD_RIFLE","value":"946"},{"key":"ACT_DOD_PRONE_ZOOM_FORWARD_BOLT","value":"947"},{"key":"ACT_DOD_PRONE_ZOOM_FORWARD_BAZOOKA","value":"948"},{"key":"ACT_DOD_PRONE_ZOOM_FORWARD_PSCHRECK","value":"949"},{"key":"ACT_DOD_PRIMARYATTACK_CROUCH","value":"950"},{"key":"ACT_DOD_PRIMARYATTACK_CROUCH_SPADE","value":"951"},{"key":"ACT_DOD_PRIMARYATTACK_CROUCH_KNIFE","value":"952"},{"key":"ACT_DOD_PRIMARYATTACK_CROUCH_GREN_FRAG","value":"953"},{"key":"ACT_DOD_PRIMARYATTACK_CROUCH_GREN_STICK","value":"954"},{"key":"ACT_DOD_SECONDARYATTACK_CROUCH","value":"955"},{"key":"ACT_DOD_SECONDARYATTACK_CROUCH_TOMMY","value":"956"},{"key":"ACT_DOD_SECONDARYATTACK_CROUCH_MP40","value":"957"},{"key":"ACT_DOD_HS_IDLE","value":"958"},{"key":"ACT_DOD_HS_CROUCH","value":"959"},{"key":"ACT_DOD_HS_IDLE_30CAL","value":"960"},{"key":"ACT_DOD_HS_IDLE_BAZOOKA","value":"961"},{"key":"ACT_DOD_HS_IDLE_PSCHRECK","value":"962"},{"key":"ACT_DOD_HS_IDLE_KNIFE","value":"963"},{"key":"ACT_DOD_HS_IDLE_MG42","value":"964"},{"key":"ACT_DOD_HS_IDLE_PISTOL","value":"965"},{"key":"ACT_DOD_HS_IDLE_STICKGRENADE","value":"966"},{"key":"ACT_DOD_HS_IDLE_TOMMY","value":"967"},{"key":"ACT_DOD_HS_IDLE_MP44","value":"968"},{"key":"ACT_DOD_HS_IDLE_K98","value":"969"},{"key":"ACT_DOD_HS_CROUCH_30CAL","value":"970"},{"key":"ACT_DOD_HS_CROUCH_BAZOOKA","value":"971"},{"key":"ACT_DOD_HS_CROUCH_PSCHRECK","value":"972"},{"key":"ACT_DOD_HS_CROUCH_KNIFE","value":"973"},{"key":"ACT_DOD_HS_CROUCH_MG42","value":"974"},{"key":"ACT_DOD_HS_CROUCH_PISTOL","value":"975"},{"key":"ACT_DOD_HS_CROUCH_STICKGRENADE","value":"976"},{"key":"ACT_DOD_HS_CROUCH_TOMMY","value":"977"},{"key":"ACT_DOD_HS_CROUCH_MP44","value":"978"},{"key":"ACT_DOD_HS_CROUCH_K98","value":"979"},{"key":"ACT_DOD_STAND_IDLE_TNT","value":"980"},{"key":"ACT_DOD_CROUCH_IDLE_TNT","value":"981"},{"key":"ACT_DOD_CROUCHWALK_IDLE_TNT","value":"982"},{"key":"ACT_DOD_WALK_IDLE_TNT","value":"983"},{"key":"ACT_DOD_RUN_IDLE_TNT","value":"984"},{"key":"ACT_DOD_SPRINT_IDLE_TNT","value":"985"},{"key":"ACT_DOD_PRONEWALK_IDLE_TNT","value":"986"},{"key":"ACT_DOD_PLANT_TNT","value":"987"},{"key":"ACT_DOD_DEFUSE_TNT","value":"988"},{"key":"ACT_VM_FIZZLE","value":"989"},{"key":"ACT_MP_STAND_IDLE","value":"990"},{"key":"ACT_MP_CROUCH_IDLE","value":"991"},{"key":"ACT_MP_CROUCH_DEPLOYED_IDLE","value":"992"},{"key":"ACT_MP_CROUCH_DEPLOYED","value":"993"},{"key":"ACT_MP_DEPLOYED_IDLE","value":"995"},{"key":"ACT_MP_RUN","value":"996"},{"key":"ACT_MP_WALK","value":"997"},{"key":"ACT_MP_AIRWALK","value":"998"},{"key":"ACT_MP_CROUCHWALK","value":"999"},{"key":"ACT_MP_SPRINT","value":"1000"},{"key":"ACT_MP_JUMP","value":"1001"},{"key":"ACT_MP_JUMP_START","value":"1002"},{"key":"ACT_MP_JUMP_FLOAT","value":"1003"},{"key":"ACT_MP_JUMP_LAND","value":"1004"},{"key":"ACT_MP_DOUBLEJUMP","value":"1005"},{"key":"ACT_MP_SWIM","value":"1006"},{"key":"ACT_MP_DEPLOYED","value":"1007"},{"key":"ACT_MP_SWIM_DEPLOYED","value":"1008"},{"key":"ACT_MP_VCD","value":"1009"},{"key":"ACT_MP_SWIM_IDLE","value":"1010"},{"key":"ACT_MP_ATTACK_STAND_PRIMARYFIRE","value":"1011"},{"key":"ACT_MP_ATTACK_STAND_PRIMARYFIRE_DEPLOYED","value":"1012"},{"key":"ACT_MP_ATTACK_STAND_SECONDARYFIRE","value":"1013"},{"key":"ACT_MP_ATTACK_STAND_GRENADE","value":"1014"},{"key":"ACT_MP_ATTACK_CROUCH_PRIMARYFIRE","value":"1015"},{"key":"ACT_MP_ATTACK_CROUCH_PRIMARYFIRE_DEPLOYED","value":"1016"},{"key":"ACT_MP_ATTACK_CROUCH_SECONDARYFIRE","value":"1017"},{"key":"ACT_MP_ATTACK_CROUCH_GRENADE","value":"1018"},{"key":"ACT_MP_ATTACK_SWIM_PRIMARYFIRE","value":"1019"},{"key":"ACT_MP_ATTACK_SWIM_SECONDARYFIRE","value":"1020"},{"key":"ACT_MP_ATTACK_SWIM_GRENADE","value":"1021"},{"key":"ACT_MP_ATTACK_AIRWALK_PRIMARYFIRE","value":"1022"},{"key":"ACT_MP_ATTACK_AIRWALK_SECONDARYFIRE","value":"1023"},{"key":"ACT_MP_ATTACK_AIRWALK_GRENADE","value":"1024"},{"key":"ACT_MP_RELOAD_STAND","value":"1025"},{"key":"ACT_MP_RELOAD_STAND_LOOP","value":"1026"},{"key":"ACT_MP_RELOAD_STAND_END","value":"1027"},{"key":"ACT_MP_RELOAD_CROUCH","value":"1028"},{"key":"ACT_MP_RELOAD_CROUCH_LOOP","value":"1029"},{"key":"ACT_MP_RELOAD_CROUCH_END","value":"1030"},{"key":"ACT_MP_RELOAD_SWIM","value":"1031"},{"key":"ACT_MP_RELOAD_SWIM_LOOP","value":"1032"},{"key":"ACT_MP_RELOAD_SWIM_END","value":"1033"},{"key":"ACT_MP_RELOAD_AIRWALK","value":"1034"},{"key":"ACT_MP_RELOAD_AIRWALK_LOOP","value":"1035"},{"key":"ACT_MP_RELOAD_AIRWALK_END","value":"1036"},{"key":"ACT_MP_ATTACK_STAND_PREFIRE","value":"1037"},{"key":"ACT_MP_ATTACK_STAND_POSTFIRE","value":"1038"},{"key":"ACT_MP_ATTACK_STAND_STARTFIRE","value":"1039"},{"key":"ACT_MP_ATTACK_CROUCH_PREFIRE","value":"1040"},{"key":"ACT_MP_ATTACK_CROUCH_POSTFIRE","value":"1041"},{"key":"ACT_MP_ATTACK_SWIM_PREFIRE","value":"1042"},{"key":"ACT_MP_ATTACK_SWIM_POSTFIRE","value":"1043"},{"key":"ACT_MP_STAND_PRIMARY","value":"1044"},{"key":"ACT_MP_CROUCH_PRIMARY","value":"1045"},{"key":"ACT_MP_RUN_PRIMARY","value":"1046"},{"key":"ACT_MP_WALK_PRIMARY","value":"1047"},{"key":"ACT_MP_AIRWALK_PRIMARY","value":"1048"},{"key":"ACT_MP_CROUCHWALK_PRIMARY","value":"1049"},{"key":"ACT_MP_JUMP_PRIMARY","value":"1050"},{"key":"ACT_MP_JUMP_START_PRIMARY","value":"1051"},{"key":"ACT_MP_JUMP_FLOAT_PRIMARY","value":"1052"},{"key":"ACT_MP_JUMP_LAND_PRIMARY","value":"1053"},{"key":"ACT_MP_SWIM_PRIMARY","value":"1054"},{"key":"ACT_MP_DEPLOYED_PRIMARY","value":"1055"},{"key":"ACT_MP_SWIM_DEPLOYED_PRIMARY","value":"1056"},{"key":"ACT_MP_ATTACK_STAND_PRIMARY","value":"1059"},{"key":"ACT_MP_ATTACK_STAND_PRIMARY_DEPLOYED","value":"1060"},{"key":"ACT_MP_ATTACK_CROUCH_PRIMARY","value":"1061"},{"key":"ACT_MP_ATTACK_CROUCH_PRIMARY_DEPLOYED","value":"1062"},{"key":"ACT_MP_ATTACK_SWIM_PRIMARY","value":"1063"},{"key":"ACT_MP_ATTACK_AIRWALK_PRIMARY","value":"1064"},{"key":"ACT_MP_RELOAD_STAND_PRIMARY","value":"1065"},{"key":"ACT_MP_RELOAD_STAND_PRIMARY_LOOP","value":"1066"},{"key":"ACT_MP_RELOAD_STAND_PRIMARY_END","value":"1067"},{"key":"ACT_MP_RELOAD_CROUCH_PRIMARY","value":"1068"},{"key":"ACT_MP_RELOAD_CROUCH_PRIMARY_LOOP","value":"1069"},{"key":"ACT_MP_RELOAD_CROUCH_PRIMARY_END","value":"1070"},{"key":"ACT_MP_RELOAD_SWIM_PRIMARY","value":"1071"},{"key":"ACT_MP_RELOAD_SWIM_PRIMARY_LOOP","value":"1072"},{"key":"ACT_MP_RELOAD_SWIM_PRIMARY_END","value":"1073"},{"key":"ACT_MP_RELOAD_AIRWALK_PRIMARY","value":"1074"},{"key":"ACT_MP_RELOAD_AIRWALK_PRIMARY_LOOP","value":"1075"},{"key":"ACT_MP_RELOAD_AIRWALK_PRIMARY_END","value":"1076"},{"key":"ACT_MP_ATTACK_STAND_GRENADE_PRIMARY","value":"1105"},{"key":"ACT_MP_ATTACK_CROUCH_GRENADE_PRIMARY","value":"1106"},{"key":"ACT_MP_ATTACK_SWIM_GRENADE_PRIMARY","value":"1107"},{"key":"ACT_MP_ATTACK_AIRWALK_GRENADE_PRIMARY","value":"1108"},{"key":"ACT_MP_STAND_SECONDARY","value":"1109"},{"key":"ACT_MP_CROUCH_SECONDARY","value":"1110"},{"key":"ACT_MP_RUN_SECONDARY","value":"1111"},{"key":"ACT_MP_WALK_SECONDARY","value":"1112"},{"key":"ACT_MP_AIRWALK_SECONDARY","value":"1113"},{"key":"ACT_MP_CROUCHWALK_SECONDARY","value":"1114"},{"key":"ACT_MP_JUMP_SECONDARY","value":"1115"},{"key":"ACT_MP_JUMP_START_SECONDARY","value":"1116"},{"key":"ACT_MP_JUMP_FLOAT_SECONDARY","value":"1117"},{"key":"ACT_MP_JUMP_LAND_SECONDARY","value":"1118"},{"key":"ACT_MP_SWIM_SECONDARY","value":"1119"},{"key":"ACT_MP_ATTACK_STAND_SECONDARY","value":"1120"},{"key":"ACT_MP_ATTACK_CROUCH_SECONDARY","value":"1121"},{"key":"ACT_MP_ATTACK_SWIM_SECONDARY","value":"1122"},{"key":"ACT_MP_ATTACK_AIRWALK_SECONDARY","value":"1123"},{"key":"ACT_MP_RELOAD_STAND_SECONDARY","value":"1124"},{"key":"ACT_MP_RELOAD_STAND_SECONDARY_LOOP","value":"1125"},{"key":"ACT_MP_RELOAD_STAND_SECONDARY_END","value":"1126"},{"key":"ACT_MP_RELOAD_CROUCH_SECONDARY","value":"1127"},{"key":"ACT_MP_RELOAD_CROUCH_SECONDARY_LOOP","value":"1128"},{"key":"ACT_MP_RELOAD_CROUCH_SECONDARY_END","value":"1129"},{"key":"ACT_MP_RELOAD_SWIM_SECONDARY","value":"1130"},{"key":"ACT_MP_RELOAD_SWIM_SECONDARY_LOOP","value":"1131"},{"key":"ACT_MP_RELOAD_SWIM_SECONDARY_END","value":"1132"},{"key":"ACT_MP_RELOAD_AIRWALK_SECONDARY","value":"1133"},{"key":"ACT_MP_RELOAD_AIRWALK_SECONDARY_LOOP","value":"1134"},{"key":"ACT_MP_RELOAD_AIRWALK_SECONDARY_END","value":"1135"},{"key":"ACT_MP_ATTACK_STAND_GRENADE_SECONDARY","value":"1140"},{"key":"ACT_MP_ATTACK_CROUCH_GRENADE_SECONDARY","value":"1141"},{"key":"ACT_MP_ATTACK_SWIM_GRENADE_SECONDARY","value":"1142"},{"key":"ACT_MP_ATTACK_AIRWALK_GRENADE_SECONDARY","value":"1143"},{"key":"ACT_MP_STAND_MELEE","value":"1171"},{"key":"ACT_MP_CROUCH_MELEE","value":"1172"},{"key":"ACT_MP_RUN_MELEE","value":"1173"},{"key":"ACT_MP_WALK_MELEE","value":"1174"},{"key":"ACT_MP_AIRWALK_MELEE","value":"1175"},{"key":"ACT_MP_CROUCHWALK_MELEE","value":"1176"},{"key":"ACT_MP_JUMP_MELEE","value":"1177"},{"key":"ACT_MP_JUMP_START_MELEE","value":"1178"},{"key":"ACT_MP_JUMP_FLOAT_MELEE","value":"1179"},{"key":"ACT_MP_JUMP_LAND_MELEE","value":"1180"},{"key":"ACT_MP_SWIM_MELEE","value":"1181"},{"key":"ACT_MP_ATTACK_STAND_MELEE","value":"1182"},{"key":"ACT_MP_ATTACK_STAND_MELEE_SECONDARY","value":"1183"},{"key":"ACT_MP_ATTACK_CROUCH_MELEE","value":"1184"},{"key":"ACT_MP_ATTACK_CROUCH_MELEE_SECONDARY","value":"1185"},{"key":"ACT_MP_ATTACK_SWIM_MELEE","value":"1186"},{"key":"ACT_MP_ATTACK_AIRWALK_MELEE","value":"1187"},{"key":"ACT_MP_ATTACK_STAND_GRENADE_MELEE","value":"1188"},{"key":"ACT_MP_ATTACK_CROUCH_GRENADE_MELEE","value":"1189"},{"key":"ACT_MP_ATTACK_SWIM_GRENADE_MELEE","value":"1190"},{"key":"ACT_MP_ATTACK_AIRWALK_GRENADE_MELEE","value":"1191"},{"key":"ACT_MP_GESTURE_FLINCH","value":"1258"},{"key":"ACT_MP_GESTURE_FLINCH_PRIMARY","value":"1259"},{"key":"ACT_MP_GESTURE_FLINCH_SECONDARY","value":"1260"},{"key":"ACT_MP_GESTURE_FLINCH_MELEE","value":"1261"},{"key":"ACT_MP_GESTURE_FLINCH_HEAD","value":"1264"},{"key":"ACT_MP_GESTURE_FLINCH_CHEST","value":"1265"},{"key":"ACT_MP_GESTURE_FLINCH_STOMACH","value":"1266"},{"key":"ACT_MP_GESTURE_FLINCH_LEFTARM","value":"1267"},{"key":"ACT_MP_GESTURE_FLINCH_RIGHTARM","value":"1268"},{"key":"ACT_MP_GESTURE_FLINCH_LEFTLEG","value":"1269"},{"key":"ACT_MP_GESTURE_FLINCH_RIGHTLEG","value":"1270"},{"key":"ACT_MP_GRENADE1_DRAW","value":"1271"},{"key":"ACT_MP_GRENADE1_IDLE","value":"1272"},{"key":"ACT_MP_GRENADE1_ATTACK","value":"1273"},{"key":"ACT_MP_GRENADE2_DRAW","value":"1274"},{"key":"ACT_MP_GRENADE2_IDLE","value":"1275"},{"key":"ACT_MP_GRENADE2_ATTACK","value":"1276"},{"key":"ACT_MP_PRIMARY_GRENADE1_DRAW","value":"1277"},{"key":"ACT_MP_PRIMARY_GRENADE1_IDLE","value":"1278"},{"key":"ACT_MP_PRIMARY_GRENADE1_ATTACK","value":"1279"},{"key":"ACT_MP_PRIMARY_GRENADE2_DRAW","value":"1280"},{"key":"ACT_MP_PRIMARY_GRENADE2_IDLE","value":"1281"},{"key":"ACT_MP_PRIMARY_GRENADE2_ATTACK","value":"1282"},{"key":"ACT_MP_SECONDARY_GRENADE1_DRAW","value":"1283"},{"key":"ACT_MP_SECONDARY_GRENADE1_IDLE","value":"1284"},{"key":"ACT_MP_SECONDARY_GRENADE1_ATTACK","value":"1285"},{"key":"ACT_MP_SECONDARY_GRENADE2_DRAW","value":"1286"},{"key":"ACT_MP_SECONDARY_GRENADE2_IDLE","value":"1287"},{"key":"ACT_MP_SECONDARY_GRENADE2_ATTACK","value":"1288"},{"key":"ACT_MP_MELEE_GRENADE1_DRAW","value":"1289"},{"key":"ACT_MP_MELEE_GRENADE1_IDLE","value":"1290"},{"key":"ACT_MP_MELEE_GRENADE1_ATTACK","value":"1291"},{"key":"ACT_MP_MELEE_GRENADE2_DRAW","value":"1292"},{"key":"ACT_MP_MELEE_GRENADE2_IDLE","value":"1293"},{"key":"ACT_MP_MELEE_GRENADE2_ATTACK","value":"1294"},{"key":"ACT_MP_STAND_BUILDING","value":"1307"},{"key":"ACT_MP_CROUCH_BUILDING","value":"1308"},{"key":"ACT_MP_RUN_BUILDING","value":"1309"},{"key":"ACT_MP_WALK_BUILDING","value":"1310"},{"key":"ACT_MP_AIRWALK_BUILDING","value":"1311"},{"key":"ACT_MP_CROUCHWALK_BUILDING","value":"1312"},{"key":"ACT_MP_JUMP_BUILDING","value":"1313"},{"key":"ACT_MP_JUMP_START_BUILDING","value":"1314"},{"key":"ACT_MP_JUMP_FLOAT_BUILDING","value":"1315"},{"key":"ACT_MP_JUMP_LAND_BUILDING","value":"1316"},{"key":"ACT_MP_SWIM_BUILDING","value":"1317"},{"key":"ACT_MP_ATTACK_STAND_BUILDING","value":"1318"},{"key":"ACT_MP_ATTACK_CROUCH_BUILDING","value":"1319"},{"key":"ACT_MP_ATTACK_SWIM_BUILDING","value":"1320"},{"key":"ACT_MP_ATTACK_AIRWALK_BUILDING","value":"1321"},{"key":"ACT_MP_ATTACK_STAND_GRENADE_BUILDING","value":"1322"},{"key":"ACT_MP_ATTACK_CROUCH_GRENADE_BUILDING","value":"1323"},{"key":"ACT_MP_ATTACK_SWIM_GRENADE_BUILDING","value":"1324"},{"key":"ACT_MP_ATTACK_AIRWALK_GRENADE_BUILDING","value":"1325"},{"key":"ACT_MP_STAND_PDA","value":"1345"},{"key":"ACT_MP_CROUCH_PDA","value":"1346"},{"key":"ACT_MP_RUN_PDA","value":"1347"},{"key":"ACT_MP_WALK_PDA","value":"1348"},{"key":"ACT_MP_AIRWALK_PDA","value":"1349"},{"key":"ACT_MP_CROUCHWALK_PDA","value":"1350"},{"key":"ACT_MP_JUMP_PDA","value":"1351"},{"key":"ACT_MP_JUMP_START_PDA","value":"1352"},{"key":"ACT_MP_JUMP_FLOAT_PDA","value":"1353"},{"key":"ACT_MP_JUMP_LAND_PDA","value":"1354"},{"key":"ACT_MP_SWIM_PDA","value":"1355"},{"key":"ACT_MP_ATTACK_STAND_PDA","value":"1356"},{"key":"ACT_MP_ATTACK_SWIM_PDA","value":"1357"},{"key":"ACT_MP_GESTURE_VC_HANDMOUTH","value":"1377"},{"key":"ACT_MP_GESTURE_VC_FINGERPOINT","value":"1378"},{"key":"ACT_MP_GESTURE_VC_FISTPUMP","value":"1379"},{"key":"ACT_MP_GESTURE_VC_THUMBSUP","value":"1380"},{"key":"ACT_MP_GESTURE_VC_NODYES","value":"1381"},{"key":"ACT_MP_GESTURE_VC_NODNO","value":"1382"},{"key":"ACT_MP_GESTURE_VC_HANDMOUTH_PRIMARY","value":"1383"},{"key":"ACT_MP_GESTURE_VC_FINGERPOINT_PRIMARY","value":"1384"},{"key":"ACT_MP_GESTURE_VC_FISTPUMP_PRIMARY","value":"1385"},{"key":"ACT_MP_GESTURE_VC_THUMBSUP_PRIMARY","value":"1386"},{"key":"ACT_MP_GESTURE_VC_NODYES_PRIMARY","value":"1387"},{"key":"ACT_MP_GESTURE_VC_NODNO_PRIMARY","value":"1388"},{"key":"ACT_MP_GESTURE_VC_HANDMOUTH_SECONDARY","value":"1389"},{"key":"ACT_MP_GESTURE_VC_FINGERPOINT_SECONDARY","value":"1390"},{"key":"ACT_MP_GESTURE_VC_FISTPUMP_SECONDARY","value":"1391"},{"key":"ACT_MP_GESTURE_VC_THUMBSUP_SECONDARY","value":"1392"},{"key":"ACT_MP_GESTURE_VC_NODYES_SECONDARY","value":"1393"},{"key":"ACT_MP_GESTURE_VC_NODNO_SECONDARY","value":"1394"},{"key":"ACT_MP_GESTURE_VC_HANDMOUTH_MELEE","value":"1395"},{"key":"ACT_MP_GESTURE_VC_FINGERPOINT_MELEE","value":"1396"},{"key":"ACT_MP_GESTURE_VC_FISTPUMP_MELEE","value":"1397"},{"key":"ACT_MP_GESTURE_VC_THUMBSUP_MELEE","value":"1398"},{"key":"ACT_MP_GESTURE_VC_NODYES_MELEE","value":"1399"},{"key":"ACT_MP_GESTURE_VC_NODNO_MELEE","value":"1400"},{"key":"ACT_MP_GESTURE_VC_HANDMOUTH_BUILDING","value":"1413"},{"key":"ACT_MP_GESTURE_VC_FINGERPOINT_BUILDING","value":"1414"},{"key":"ACT_MP_GESTURE_VC_FISTPUMP_BUILDING","value":"1415"},{"key":"ACT_MP_GESTURE_VC_THUMBSUP_BUILDING","value":"1416"},{"key":"ACT_MP_GESTURE_VC_NODYES_BUILDING","value":"1417"},{"key":"ACT_MP_GESTURE_VC_NODNO_BUILDING","value":"1418"},{"key":"ACT_MP_GESTURE_VC_HANDMOUTH_PDA","value":"1419"},{"key":"ACT_MP_GESTURE_VC_FINGERPOINT_PDA","value":"1420"},{"key":"ACT_MP_GESTURE_VC_FISTPUMP_PDA","value":"1421"},{"key":"ACT_MP_GESTURE_VC_THUMBSUP_PDA","value":"1422"},{"key":"ACT_MP_GESTURE_VC_NODYES_PDA","value":"1423"},{"key":"ACT_MP_GESTURE_VC_NODNO_PDA","value":"1424"},{"key":"ACT_VM_UNUSABLE","value":"1428"},{"key":"ACT_VM_UNUSABLE_TO_USABLE","value":"1429"},{"key":"ACT_VM_USABLE_TO_UNUSABLE","value":"1430"},{"key":"ACT_GMOD_GESTURE_AGREE","value":"1610"},{"key":"ACT_GMOD_GESTURE_BECON","value":"1611"},{"key":"ACT_GMOD_GESTURE_BOW","value":"1612"},{"key":"ACT_GMOD_GESTURE_DISAGREE","value":"1613"},{"key":"ACT_GMOD_TAUNT_SALUTE","value":"1614"},{"key":"ACT_GMOD_GESTURE_WAVE","value":"1615"},{"key":"ACT_GMOD_TAUNT_PERSISTENCE","value":"1616"},{"key":"ACT_GMOD_TAUNT_MUSCLE","value":"1617"},{"key":"ACT_GMOD_TAUNT_LAUGH","value":"1618"},{"key":"ACT_GMOD_GESTURE_POINT","value":"1619"},{"key":"ACT_GMOD_TAUNT_CHEER","value":"1620"},{"key":"ACT_HL2MP_RUN_FAST","value":"1621"},{"key":"ACT_HL2MP_RUN_CHARGING","value":"1622"},{"key":"ACT_HL2MP_RUN_PANICKED","value":"1623"},{"key":"ACT_HL2MP_RUN_PROTECTED","value":"1624"},{"key":"ACT_HL2MP_IDLE_MELEE_ANGRY","value":"1625"},{"key":"ACT_HL2MP_ZOMBIE_SLUMP_IDLE","value":"1626"},{"key":"ACT_HL2MP_ZOMBIE_SLUMP_RISE","value":"1627"},{"key":"ACT_HL2MP_WALK_ZOMBIE_01","value":"1628"},{"key":"ACT_HL2MP_WALK_ZOMBIE_02","value":"1629"},{"key":"ACT_HL2MP_WALK_ZOMBIE_03","value":"1630"},{"key":"ACT_HL2MP_WALK_ZOMBIE_04","value":"1631"},{"key":"ACT_HL2MP_WALK_ZOMBIE_05","value":"1632"},{"key":"ACT_HL2MP_WALK_CROUCH_ZOMBIE_01","value":"1633"},{"key":"ACT_HL2MP_WALK_CROUCH_ZOMBIE_02","value":"1634"},{"key":"ACT_HL2MP_WALK_CROUCH_ZOMBIE_03","value":"1635"},{"key":"ACT_HL2MP_WALK_CROUCH_ZOMBIE_04","value":"1636"},{"key":"ACT_HL2MP_WALK_CROUCH_ZOMBIE_05","value":"1637"},{"key":"ACT_HL2MP_IDLE_CROUCH_ZOMBIE_01","value":"1638"},{"key":"ACT_HL2MP_IDLE_CROUCH_ZOMBIE_02","value":"1639"},{"key":"ACT_GMOD_GESTURE_RANGE_ZOMBIE","value":"1640"},{"key":"ACT_GMOD_GESTURE_TAUNT_ZOMBIE","value":"1641"},{"key":"ACT_GMOD_TAUNT_DANCE","value":"1642"},{"key":"ACT_GMOD_TAUNT_ROBOT","value":"1643"},{"key":"ACT_GMOD_GESTURE_RANGE_ZOMBIE_SPECIAL","value":"1644"},{"key":"ACT_GMOD_GESTURE_RANGE_FRENZY","value":"1645"},{"key":"ACT_HL2MP_RUN_ZOMBIE_FAST","value":"1646"},{"key":"ACT_HL2MP_WALK_ZOMBIE_06","value":"1647"},{"key":"ACT_ZOMBIE_LEAP_START","value":"1648"},{"key":"ACT_ZOMBIE_LEAPING","value":"1649"},{"key":"ACT_ZOMBIE_CLIMB_UP","value":"1650"},{"key":"ACT_ZOMBIE_CLIMB_START","value":"1651"},{"key":"ACT_ZOMBIE_CLIMB_END","value":"1652"},{"key":"ACT_HL2MP_IDLE_MAGIC","value":"1653"},{"key":"ACT_HL2MP_WALK_MAGIC","value":"1654"},{"key":"ACT_HL2MP_RUN_MAGIC","value":"1655"},{"key":"ACT_HL2MP_IDLE_CROUCH_MAGIC","value":"1656"},{"key":"ACT_HL2MP_WALK_CROUCH_MAGIC","value":"1657"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_MAGIC","value":"1658"},{"key":"ACT_HL2MP_GESTURE_RELOAD_MAGIC","value":"1659"},{"key":"ACT_HL2MP_JUMP_MAGIC","value":"1660"},{"key":"ACT_HL2MP_SWIM_IDLE_MAGIC","value":"1661"},{"key":"ACT_HL2MP_SWIM_MAGIC","value":"1662"},{"key":"ACT_HL2MP_IDLE_REVOLVER","value":"1663"},{"key":"ACT_HL2MP_WALK_REVOLVER","value":"1664"},{"key":"ACT_HL2MP_RUN_REVOLVER","value":"1665"},{"key":"ACT_HL2MP_IDLE_CROUCH_REVOLVER","value":"1666"},{"key":"ACT_HL2MP_WALK_CROUCH_REVOLVER","value":"1667"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_REVOLVER","value":"1668"},{"key":"ACT_HL2MP_GESTURE_RELOAD_REVOLVER","value":"1669"},{"key":"ACT_HL2MP_JUMP_REVOLVER","value":"1670"},{"key":"ACT_HL2MP_SWIM_IDLE_REVOLVER","value":"1671"},{"key":"ACT_HL2MP_SWIM_REVOLVER","value":"1672"},{"key":"ACT_HL2MP_IDLE_CAMERA","value":"1673"},{"key":"ACT_HL2MP_WALK_CAMERA","value":"1674"},{"key":"ACT_HL2MP_RUN_CAMERA","value":"1675"},{"key":"ACT_HL2MP_IDLE_CROUCH_CAMERA","value":"1676"},{"key":"ACT_HL2MP_WALK_CROUCH_CAMERA","value":"1677"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_CAMERA","value":"1678"},{"key":"ACT_HL2MP_GESTURE_RELOAD_CAMERA","value":"1679"},{"key":"ACT_HL2MP_JUMP_CAMERA","value":"1680"},{"key":"ACT_HL2MP_SWIM_IDLE_CAMERA","value":"1681"},{"key":"ACT_HL2MP_SWIM_CAMERA","value":"1682"},{"key":"ACT_HL2MP_IDLE_ANGRY","value":"1683"},{"key":"ACT_HL2MP_WALK_ANGRY","value":"1684"},{"key":"ACT_HL2MP_RUN_ANGRY","value":"1685"},{"key":"ACT_HL2MP_IDLE_CROUCH_ANGRY","value":"1686"},{"key":"ACT_HL2MP_WALK_CROUCH_ANGRY","value":"1687"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_ANGRY","value":"1688"},{"key":"ACT_HL2MP_GESTURE_RELOAD_ANGRY","value":"1689"},{"key":"ACT_HL2MP_JUMP_ANGRY","value":"1690"},{"key":"ACT_HL2MP_SWIM_IDLE_ANGRY","value":"1691"},{"key":"ACT_HL2MP_SWIM_ANGRY","value":"1692"},{"key":"ACT_HL2MP_IDLE_SCARED","value":"1693"},{"key":"ACT_HL2MP_WALK_SCARED","value":"1694"},{"key":"ACT_HL2MP_RUN_SCARED","value":"1695"},{"key":"ACT_HL2MP_IDLE_CROUCH_SCARED","value":"1696"},{"key":"ACT_HL2MP_WALK_CROUCH_SCARED","value":"1697"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_SCARED","value":"1698"},{"key":"ACT_HL2MP_GESTURE_RELOAD_SCARED","value":"1699"},{"key":"ACT_HL2MP_JUMP_SCARED","value":"1700"},{"key":"ACT_HL2MP_SWIM_IDLE_SCARED","value":"1701"},{"key":"ACT_HL2MP_SWIM_SCARED","value":"1702"},{"key":"ACT_HL2MP_IDLE_ZOMBIE","value":"1703"},{"key":"ACT_HL2MP_WALK_ZOMBIE","value":"1704"},{"key":"ACT_HL2MP_RUN_ZOMBIE","value":"1705"},{"key":"ACT_HL2MP_IDLE_CROUCH_ZOMBIE","value":"1706"},{"key":"ACT_HL2MP_WALK_CROUCH_ZOMBIE","value":"1707"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_ZOMBIE","value":"1708"},{"key":"ACT_HL2MP_GESTURE_RELOAD_ZOMBIE","value":"1709"},{"key":"ACT_HL2MP_JUMP_ZOMBIE","value":"1710"},{"key":"ACT_HL2MP_SWIM_IDLE_ZOMBIE","value":"1711"},{"key":"ACT_HL2MP_SWIM_ZOMBIE","value":"1712"},{"key":"ACT_HL2MP_IDLE_SUITCASE","value":"1713"},{"key":"ACT_HL2MP_WALK_SUITCASE","value":"1714"},{"key":"ACT_HL2MP_RUN_SUITCASE","value":"1715"},{"key":"ACT_HL2MP_IDLE_CROUCH_SUITCASE","value":"1716"},{"key":"ACT_HL2MP_WALK_CROUCH_SUITCASE","value":"1717"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_SUITCASE","value":"1718"},{"key":"ACT_HL2MP_GESTURE_RELOAD_SUITCASE","value":"1719"},{"key":"ACT_HL2MP_JUMP_SUITCASE","value":"1720"},{"key":"ACT_HL2MP_SWIM_IDLE_SUITCASE","value":"1721"},{"key":"ACT_HL2MP_SWIM_SUITCASE","value":"1722"},{"key":"ACT_HL2MP_IDLE","value":"1777"},{"key":"ACT_HL2MP_WALK","value":"1778"},{"key":"ACT_HL2MP_RUN","value":"1779"},{"key":"ACT_HL2MP_IDLE_CROUCH","value":"1780"},{"key":"ACT_HL2MP_WALK_CROUCH","value":"1781"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK","value":"1782"},{"key":"ACT_HL2MP_GESTURE_RELOAD","value":"1783"},{"key":"ACT_HL2MP_JUMP","value":"1784"},{"key":"ACT_HL2MP_SWIM","value":"1786"},{"key":"ACT_HL2MP_IDLE_PISTOL","value":"1787"},{"key":"ACT_HL2MP_WALK_PISTOL","value":"1788"},{"key":"ACT_HL2MP_RUN_PISTOL","value":"1789"},{"key":"ACT_HL2MP_IDLE_CROUCH_PISTOL","value":"1790"},{"key":"ACT_HL2MP_WALK_CROUCH_PISTOL","value":"1791"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL","value":"1792"},{"key":"ACT_HL2MP_GESTURE_RELOAD_PISTOL","value":"1793"},{"key":"ACT_HL2MP_JUMP_PISTOL","value":"1794"},{"key":"ACT_HL2MP_SWIM_IDLE_PISTOL","value":"1795"},{"key":"ACT_HL2MP_SWIM_PISTOL","value":"1796"},{"key":"ACT_HL2MP_IDLE_SMG1","value":"1797"},{"key":"ACT_HL2MP_WALK_SMG1","value":"1798"},{"key":"ACT_HL2MP_RUN_SMG1","value":"1799"},{"key":"ACT_HL2MP_IDLE_CROUCH_SMG1","value":"1800"},{"key":"ACT_HL2MP_WALK_CROUCH_SMG1","value":"1801"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_SMG1","value":"1802"},{"key":"ACT_HL2MP_GESTURE_RELOAD_SMG1","value":"1803"},{"key":"ACT_HL2MP_JUMP_SMG1","value":"1804"},{"key":"ACT_HL2MP_SWIM_IDLE_SMG1","value":"1805"},{"key":"ACT_HL2MP_SWIM_SMG1","value":"1806"},{"key":"ACT_HL2MP_IDLE_AR2","value":"1807"},{"key":"ACT_HL2MP_WALK_AR2","value":"1808"},{"key":"ACT_HL2MP_RUN_AR2","value":"1809"},{"key":"ACT_HL2MP_IDLE_CROUCH_AR2","value":"1810"},{"key":"ACT_HL2MP_WALK_CROUCH_AR2","value":"1811"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_AR2","value":"1812"},{"key":"ACT_HL2MP_GESTURE_RELOAD_AR2","value":"1813"},{"key":"ACT_HL2MP_JUMP_AR2","value":"1814"},{"key":"ACT_HL2MP_SWIM_IDLE_AR2","value":"1815"},{"key":"ACT_HL2MP_SWIM_AR2","value":"1816"},{"key":"ACT_HL2MP_IDLE_SHOTGUN","value":"1817"},{"key":"ACT_HL2MP_WALK_SHOTGUN","value":"1818"},{"key":"ACT_HL2MP_RUN_SHOTGUN","value":"1819"},{"key":"ACT_HL2MP_IDLE_CROUCH_SHOTGUN","value":"1820"},{"key":"ACT_HL2MP_WALK_CROUCH_SHOTGUN","value":"1821"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_SHOTGUN","value":"1822"},{"key":"ACT_HL2MP_GESTURE_RELOAD_SHOTGUN","value":"1823"},{"key":"ACT_HL2MP_JUMP_SHOTGUN","value":"1824"},{"key":"ACT_HL2MP_SWIM_IDLE_SHOTGUN","value":"1825"},{"key":"ACT_HL2MP_SWIM_SHOTGUN","value":"1826"},{"key":"ACT_HL2MP_IDLE_RPG","value":"1827"},{"key":"ACT_HL2MP_WALK_RPG","value":"1828"},{"key":"ACT_HL2MP_RUN_RPG","value":"1829"},{"key":"ACT_HL2MP_IDLE_CROUCH_RPG","value":"1830"},{"key":"ACT_HL2MP_WALK_CROUCH_RPG","value":"1831"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_RPG","value":"1832"},{"key":"ACT_HL2MP_GESTURE_RELOAD_RPG","value":"1833"},{"key":"ACT_HL2MP_JUMP_RPG","value":"1834"},{"key":"ACT_HL2MP_SWIM_IDLE_RPG","value":"1835"},{"key":"ACT_HL2MP_SWIM_RPG","value":"1836"},{"key":"ACT_HL2MP_IDLE_GRENADE","value":"1837"},{"key":"ACT_HL2MP_WALK_GRENADE","value":"1838"},{"key":"ACT_HL2MP_RUN_GRENADE","value":"1839"},{"key":"ACT_HL2MP_IDLE_CROUCH_GRENADE","value":"1840"},{"key":"ACT_HL2MP_WALK_CROUCH_GRENADE","value":"1841"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE","value":"1842"},{"key":"ACT_HL2MP_GESTURE_RELOAD_GRENADE","value":"1843"},{"key":"ACT_HL2MP_JUMP_GRENADE","value":"1844"},{"key":"ACT_HL2MP_SWIM_IDLE_GRENADE","value":"1845"},{"key":"ACT_HL2MP_SWIM_GRENADE","value":"1846"},{"key":"ACT_HL2MP_IDLE_DUEL","value":"1847"},{"key":"ACT_HL2MP_WALK_DUEL","value":"1848"},{"key":"ACT_HL2MP_RUN_DUEL","value":"1849"},{"key":"ACT_HL2MP_IDLE_CROUCH_DUEL","value":"1850"},{"key":"ACT_HL2MP_WALK_CROUCH_DUEL","value":"1851"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_DUEL","value":"1852"},{"key":"ACT_HL2MP_GESTURE_RELOAD_DUEL","value":"1853"},{"key":"ACT_HL2MP_JUMP_DUEL","value":"1854"},{"key":"ACT_HL2MP_SWIM_IDLE_DUEL","value":"1855"},{"key":"ACT_HL2MP_SWIM_DUEL","value":"1856"},{"key":"ACT_HL2MP_IDLE_PHYSGUN","value":"1857"},{"key":"ACT_HL2MP_WALK_PHYSGUN","value":"1858"},{"key":"ACT_HL2MP_RUN_PHYSGUN","value":"1859"},{"key":"ACT_HL2MP_IDLE_CROUCH_PHYSGUN","value":"1860"},{"key":"ACT_HL2MP_WALK_CROUCH_PHYSGUN","value":"1861"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_PHYSGUN","value":"1862"},{"key":"ACT_HL2MP_GESTURE_RELOAD_PHYSGUN","value":"1863"},{"key":"ACT_HL2MP_JUMP_PHYSGUN","value":"1864"},{"key":"ACT_HL2MP_SWIM_IDLE_PHYSGUN","value":"1865"},{"key":"ACT_HL2MP_SWIM_PHYSGUN","value":"1866"},{"key":"ACT_HL2MP_IDLE_CROSSBOW","value":"1867"},{"key":"ACT_HL2MP_WALK_CROSSBOW","value":"1868"},{"key":"ACT_HL2MP_RUN_CROSSBOW","value":"1869"},{"key":"ACT_HL2MP_IDLE_CROUCH_CROSSBOW","value":"1870"},{"key":"ACT_HL2MP_WALK_CROUCH_CROSSBOW","value":"1871"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW","value":"1872"},{"key":"ACT_HL2MP_GESTURE_RELOAD_CROSSBOW","value":"1873"},{"key":"ACT_HL2MP_JUMP_CROSSBOW","value":"1874"},{"key":"ACT_HL2MP_SWIM_IDLE_CROSSBOW","value":"1875"},{"key":"ACT_HL2MP_SWIM_CROSSBOW","value":"1876"},{"key":"ACT_HL2MP_IDLE_MELEE","value":"1877"},{"key":"ACT_HL2MP_WALK_MELEE","value":"1878"},{"key":"ACT_HL2MP_RUN_MELEE","value":"1879"},{"key":"ACT_HL2MP_IDLE_CROUCH_MELEE","value":"1880"},{"key":"ACT_HL2MP_WALK_CROUCH_MELEE","value":"1881"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE","value":"1882"},{"key":"ACT_HL2MP_GESTURE_RELOAD_MELEE","value":"1883"},{"key":"ACT_HL2MP_JUMP_MELEE","value":"1884"},{"key":"ACT_HL2MP_SWIM_IDLE_MELEE","value":"1885"},{"key":"ACT_HL2MP_SWIM_MELEE","value":"1886"},{"key":"ACT_HL2MP_IDLE_SLAM","value":"1887"},{"key":"ACT_HL2MP_WALK_SLAM","value":"1888"},{"key":"ACT_HL2MP_RUN_SLAM","value":"1889"},{"key":"ACT_HL2MP_IDLE_CROUCH_SLAM","value":"1890"},{"key":"ACT_HL2MP_WALK_CROUCH_SLAM","value":"1891"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_SLAM","value":"1892"},{"key":"ACT_HL2MP_GESTURE_RELOAD_SLAM","value":"1893"},{"key":"ACT_HL2MP_JUMP_SLAM","value":"1894"},{"key":"ACT_HL2MP_SWIM_IDLE_SLAM","value":"1895"},{"key":"ACT_HL2MP_SWIM_SLAM","value":"1896"},{"key":"ACT_VM_CRAWL","value":"1897"},{"key":"ACT_VM_CRAWL_EMPTY","value":"1898"},{"key":"ACT_VM_HOLSTER_EMPTY","value":"1899"},{"key":"ACT_VM_DOWN","value":"1900"},{"key":"ACT_VM_DOWN_EMPTY","value":"1901"},{"key":"ACT_VM_READY","value":"1902"},{"key":"ACT_VM_ISHOOT","value":"1903"},{"key":"ACT_VM_IIN","value":"1904"},{"key":"ACT_VM_IIN_EMPTY","value":"1905"},{"key":"ACT_VM_IIDLE","value":"1906"},{"key":"ACT_VM_IIDLE_EMPTY","value":"1907"},{"key":"ACT_VM_IOUT","value":"1908"},{"key":"ACT_VM_IOUT_EMPTY","value":"1909"},{"key":"ACT_VM_PULLBACK_HIGH_BAKE","value":"1910"},{"key":"ACT_VM_HITKILL","value":"1911"},{"key":"ACT_VM_DEPLOYED_IN","value":"1912"},{"key":"ACT_VM_DEPLOYED_IDLE","value":"1913"},{"key":"ACT_VM_DEPLOYED_FIRE","value":"1914"},{"key":"ACT_VM_DEPLOYED_DRYFIRE","value":"1915"},{"key":"ACT_VM_DEPLOYED_RELOAD","value":"1916"},{"key":"ACT_VM_DEPLOYED_RELOAD_EMPTY","value":"1917"},{"key":"ACT_VM_DEPLOYED_OUT","value":"1918"},{"key":"ACT_VM_DEPLOYED_IRON_IN","value":"1919"},{"key":"ACT_VM_DEPLOYED_IRON_IDLE","value":"1920"},{"key":"ACT_VM_DEPLOYED_IRON_FIRE","value":"1921"},{"key":"ACT_VM_DEPLOYED_IRON_DRYFIRE","value":"1922"},{"key":"ACT_VM_DEPLOYED_IRON_OUT","value":"1923"},{"key":"ACT_VM_DEPLOYED_LIFTED_IN","value":"1924"},{"key":"ACT_VM_DEPLOYED_LIFTED_IDLE","value":"1925"},{"key":"ACT_VM_DEPLOYED_LIFTED_OUT","value":"1926"},{"key":"ACT_VM_RELOADEMPTY","value":"1927"},{"key":"ACT_VM_IRECOIL1","value":"1928"},{"key":"ACT_VM_IRECOIL2","value":"1929"},{"key":"ACT_VM_FIREMODE","value":"1930"},{"key":"ACT_VM_ISHOOT_LAST","value":"1931"},{"key":"ACT_VM_IFIREMODE","value":"1932"},{"key":"ACT_VM_DFIREMODE","value":"1933"},{"key":"ACT_VM_DIFIREMODE","value":"1934"},{"key":"ACT_VM_SHOOTLAST","value":"1935"},{"key":"ACT_VM_ISHOOTDRY","value":"1936"},{"key":"ACT_VM_DRAW_M203","value":"1937"},{"key":"ACT_VM_DRAWFULL_M203","value":"1938"},{"key":"ACT_VM_READY_M203","value":"1939"},{"key":"ACT_VM_IDLE_M203","value":"1940"},{"key":"ACT_VM_RELOAD_M203","value":"1941"},{"key":"ACT_VM_HOLSTER_M203","value":"1942"},{"key":"ACT_VM_HOLSTERFULL_M203","value":"1943"},{"key":"ACT_VM_IIN_M203","value":"1944"},{"key":"ACT_VM_IIDLE_M203","value":"1945"},{"key":"ACT_VM_IOUT_M203","value":"1946"},{"key":"ACT_VM_CRAWL_M203","value":"1947"},{"key":"ACT_VM_DOWN_M203","value":"1948"},{"key":"ACT_VM_ISHOOT_M203","value":"1949"},{"key":"ACT_VM_RELOAD_INSERT","value":"1950"},{"key":"ACT_VM_RELOAD_INSERT_PULL","value":"1951"},{"key":"ACT_VM_RELOAD_END","value":"1952"},{"key":"ACT_VM_RELOAD_END_EMPTY","value":"1953"},{"key":"ACT_VM_RELOAD_INSERT_EMPTY","value":"1954"},{"key":"ACT_CROSSBOW_HOLSTER_UNLOADED","value":"1955"},{"key":"ACT_VM_FIRE_TO_EMPTY","value":"1956"},{"key":"ACT_VM_UNLOAD","value":"1957"},{"key":"ACT_VM_RELOAD2","value":"1958"},{"key":"ACT_GMOD_NOCLIP_LAYER","value":"1959"},{"key":"ACT_HL2MP_IDLE_FIST","value":"1960"},{"key":"ACT_HL2MP_WALK_FIST","value":"1961"},{"key":"ACT_HL2MP_RUN_FIST","value":"1962"},{"key":"ACT_HL2MP_IDLE_CROUCH_FIST","value":"1963"},{"key":"ACT_HL2MP_WALK_CROUCH_FIST","value":"1964"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_FIST","value":"1965"},{"key":"ACT_HL2MP_GESTURE_RELOAD_FIST","value":"1966"},{"key":"ACT_HL2MP_JUMP_FIST","value":"1967"},{"key":"ACT_HL2MP_SWIM_IDLE_FIST","value":"1968"},{"key":"ACT_HL2MP_SWIM_FIST","value":"1969"},{"key":"ACT_HL2MP_SIT","value":"1970"},{"key":"ACT_HL2MP_FIST_BLOCK","value":"1971"},{"key":"ACT_DRIVE_AIRBOAT","value":"1972"},{"key":"ACT_DRIVE_JEEP","value":"1973"},{"key":"ACT_GMOD_SIT_ROLLERCOASTER","value":"1974"},{"key":"ACT_HL2MP_IDLE_KNIFE","value":"1975"},{"key":"ACT_HL2MP_WALK_KNIFE","value":"1976"},{"key":"ACT_HL2MP_RUN_KNIFE","value":"1977"},{"key":"ACT_HL2MP_IDLE_CROUCH_KNIFE","value":"1978"},{"key":"ACT_HL2MP_WALK_CROUCH_KNIFE","value":"1979"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_KNIFE","value":"1980"},{"key":"ACT_HL2MP_GESTURE_RELOAD_KNIFE","value":"1981"},{"key":"ACT_HL2MP_JUMP_KNIFE","value":"1982"},{"key":"ACT_HL2MP_SWIM_IDLE_KNIFE","value":"1983"},{"key":"ACT_HL2MP_SWIM_KNIFE","value":"1984"},{"key":"ACT_HL2MP_IDLE_PASSIVE","value":"1985"},{"key":"ACT_HL2MP_WALK_PASSIVE","value":"1986"},{"key":"ACT_HL2MP_RUN_PASSIVE","value":"1987"},{"key":"ACT_HL2MP_IDLE_CROUCH_PASSIVE","value":"1988"},{"key":"ACT_HL2MP_WALK_CROUCH_PASSIVE","value":"1989"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_PASSIVE","value":"1990"},{"key":"ACT_HL2MP_GESTURE_RELOAD_PASSIVE","value":"1991"},{"key":"ACT_HL2MP_JUMP_PASSIVE","value":"1992"},{"key":"ACT_HL2MP_SWIM_PASSIVE","value":"1993"},{"key":"ACT_HL2MP_SWIM_IDLE_PASSIVE","value":"1994"},{"key":"ACT_HL2MP_IDLE_MELEE2","value":"1995"},{"key":"ACT_HL2MP_WALK_MELEE2","value":"1996"},{"key":"ACT_HL2MP_RUN_MELEE2","value":"1997"},{"key":"ACT_HL2MP_IDLE_CROUCH_MELEE2","value":"1998"},{"key":"ACT_HL2MP_WALK_CROUCH_MELEE2","value":"1999"},{"key":"ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE2","value":"2000"},{"key":"ACT_HL2MP_GESTURE_RELOAD_MELEE2","value":"2001"},{"key":"ACT_HL2MP_JUMP_MELEE2","value":"2002"},{"key":"ACT_HL2MP_SWIM_IDLE_MELEE2","value":"2003"},{"key":"ACT_HL2MP_SWIM_MELEE2","value":"2004"},{"key":"ACT_HL2MP_SIT_PISTOL","value":"2005"},{"key":"ACT_HL2MP_SIT_SHOTGUN","value":"2006"},{"key":"ACT_HL2MP_SIT_SMG1","value":"2007"},{"key":"ACT_HL2MP_SIT_AR2","value":"2008"},{"key":"ACT_HL2MP_SIT_PHYSGUN","value":"2009"},{"key":"ACT_HL2MP_SIT_GRENADE","value":"2010"},{"key":"ACT_HL2MP_SIT_RPG","value":"2011"},{"key":"ACT_HL2MP_SIT_CROSSBOW","value":"2012"},{"key":"ACT_HL2MP_SIT_MELEE","value":"2013"},{"key":"ACT_HL2MP_SIT_SLAM","value":"2014"},{"key":"ACT_HL2MP_SIT_FIST","value":"2015"},{"key":"ACT_GMOD_IN_CHAT","value":"2019"},{"key":"ACT_GMOD_GESTURE_ITEM_GIVE","value":"2020"},{"key":"ACT_GMOD_GESTURE_ITEM_DROP","value":"2021"},{"key":"ACT_GMOD_GESTURE_ITEM_PLACE","value":"2022"},{"key":"ACT_GMOD_GESTURE_ITEM_THROW","value":"2023"},{"key":"ACT_GMOD_GESTURE_MELEE_SHOVE_2HAND","value":"2024"},{"key":"ACT_GMOD_GESTURE_MELEE_SHOVE_1HAND","value":"2025"},{"key":"ACT_HL2MP_SWIM_IDLE","value":"2026"},{"key":"ACT_HL2MP_IDLE_COWER","value":"2027"},{"key":"ACT_GMOD_DEATH","value":"2028"},{"key":"ACT_DRIVE_POD","value":"2029"},{"key":"ACT_FLINCH","value":"2030"},{"key":"ACT_FLINCH_BACK","value":"2031"},{"key":"ACT_FLINCH_SHOULDER_LEFT","value":"2032"},{"key":"ACT_FLINCH_SHOULDER_RIGHT","value":"2033"},{"key":"ACT_HL2MP_SIT_CAMERA","value":"2034"},{"key":"ACT_HL2MP_SIT_PASSIVE","value":"2035"},{"key":"ACT_HL2MP_ZOMBIE_SLUMP_ALT_IDLE","value":"2036"},{"key":"ACT_HL2MP_ZOMBIE_SLUMP_ALT_RISE_FAST","value":"2037"},{"key":"ACT_HL2MP_ZOMBIE_SLUMP_ALT_RISE_SLOW","value":"2038"},{"key":"ACT_GMOD_SHOWOFF_STAND_01","value":"2039"},{"key":"ACT_GMOD_SHOWOFF_STAND_02","value":"2040"},{"key":"ACT_GMOD_SHOWOFF_STAND_03","value":"2041"},{"key":"ACT_GMOD_SHOWOFF_STAND_04","value":"2042"},{"key":"ACT_GMOD_SHOWOFF_DUCK_01","value":"2043"},{"key":"ACT_GMOD_SHOWOFF_DUCK_02","value":"2044"},{"text":"The last shared activity number. IDs after this are \"private\" activities registered at runtime, and will have random IDs associated with specific ACTivities.","key":"LAST_SHARED_ACTIVITY","value":"2045"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Server","added":"2021.03.31","description":"Used by NPC:MoveClimbExec, NPC:MoveJumpExec and NPC:MoveJumpStop.","items":{"item":[{"text":"Move is illegal for some reason.","key":"AIMR_ILLEGAL","value":"-4"},{"text":"Move was blocked by an NPC.","key":"AIMR_BLOCKED_NPC","value":"-3"},{"text":"Move was blocked by the world.","key":"AIMR_BLOCKED_WORLD","value":"-2"},{"text":"Move was blocked by an entity.","key":"AIMR_BLOCKED_ENTITY","value":"-1"},{"text":"Move op was ok.","key":"AIMR_OK","value":"0"},{"text":"Locomotion method has changed.","key":"AIMR_CHANGE_TYPE","value":"1"}]}},"realms":["Server"],"type":"Enum"},
{"enum":{"realm":"Shared","description":{"text":"Used by game.AddAmmoType's input structure - the Structures/AmmoData.","warning":"These enumerations do not exist in game and are listed here only for reference"},"items":{"item":[{"text":"Forces player to drop the object they are carrying if the object was hit by this ammo type.","key":"AMMO_FORCE_DROP_IF_CARRIED","value":"1"},{"text":"Uses AmmoData.plydmg of the ammo type as the damage to deal to shot players instead of Bullet.Damage.","key":"AMMO_INTERPRET_PLRDAMAGE_AS_DAMAGE_TO_PLAYER","value":"2"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Client","added":"2021.01.27","description":"The analog axis to get the value of via input.GetAnalogValue.","items":{"item":[{"key":"ANALOG_MOUSE_X","value":"0"},{"key":"ANALOG_MOUSE_Y","value":"1"},{"key":"ANALOG_MOUSE_WHEEL","value":"3"},{"key":"ANALOG_JOY_X","value":"4"},{"key":"ANALOG_JOY_Y","value":"5"},{"key":"ANALOG_JOY_Z","value":"6"},{"key":"ANALOG_JOY_R","value":"7"},{"key":"ANALOG_JOY_U","value":"8"},{"key":"ANALOG_JOY_V","value":"9"}]}},"realms":["Client"],"type":"Enum"},
{"enum":{"realm":"Client","description":{"text":"These enums are used by render.OverrideBlend to determine what the Source and Destination color and alpha channel values for a given pixel will be multiplied by before they are sent to the Blend Function to calculate the pixel's final color during draw operations.\n\nFor an interactive demonstration of how these enums behave, see [Anders Riggelsen's Visual glBlendFunc Tool here](https://www.andersriggelsen.dk/glblendfunc.php)","upload":{"src":"19952/8d96354db95acb4.png","size":"573673","name":"image.png"}},"items":{"item":[{"text":"The Multiplier will be `r=0`, `g=0`, `b=0`, `a=0`\n\n\t\t\tThis is useful for removing the Source or Destination from the final pixel color.","key":"BLEND_ZERO","value":"0"},{"text":"The Multiplier will be `r=1`, `g=1`, `b=1`, `a=1`\n\n\t\t\tThis is useful for keeping the Source or Destination as their starting values.","key":"BLEND_ONE","value":"1"},{"text":"The Multiplier will be the same as the Destination color and alpha.","key":"BLEND_DST_COLOR","value":"2"},{"text":"Each color and alpha channel value of the Destination is subtracted from `1`.\n\n\t\t\t**Example:**  \n\t\t\tIf your Destination channels are: `r=1`, `g=0.25`, `b=0.1`, `a=1`  \n\t\t\tThey will be modified by: `r=1-1`, `g=1-0.25`, `b=1-0.1`, `a=1-1`  \n\t\t\tThe final Multiplier value will be: `r=0`, `g=0.75`, `b=0.9`, `a=0`","key":"BLEND_ONE_MINUS_DST_COLOR","value":"3"},{"text":"All color and alpha channels will be the same as the Source alpha value.  \n\n\t\t\t**Example:**  \n\t\t\tIf your Source channels are: `r=0.1`, `g=0`, `b=1`, `a=0.5`  \n\t\t\tThe final Multiplier value will be: `r=0.5`, `g=0.5`, `b=0.5`, `a=0.5`","key":"BLEND_SRC_ALPHA","value":"4"},{"text":"All color and alpha channels will be set to the Source alpha value subtracted from `1`.\n\n\t\t\t**Example:**  \n\t\t\tIf your Source channels are: `r=0`, `g=0.23`, `b=1`, `a=0.6`  \n\t\t\tThe alpha channel will be modified by `a=1-0.6`  \n\t\t\tThe final Multiplier value will be: `r=0.4`, `g=0.4`, `b=0.4`, `a=0.4`","key":"BLEND_ONE_MINUS_SRC_ALPHA","value":"5"},{"text":"All color and alpha channels will be set to the the Destination alpha value.\n\n\t\t\t**Example:**  \n\t\t\tIf your Destination channels are: `r=0.1`, `g=0`, `b=1`, `a=0.5`  \n\t\t\tThe final Multiplier value will be: `r=0.5`, `g=0.5`, `b=0.5`, `a=0.5`","key":"BLEND_DST_ALPHA","value":"6"},{"text":"All color and alpha channels will be set to the Destination alpha value subtracted from `1`.\n\n\t\t\t**Example:**  \n\t\t\tIf your Destination channels are: `r=0`, `g=0.23`, `b=1`, `a=0.6`  \n\t\t\tThe alpha channel will be modified by `a=1-0.6`  \n\t\t\tThe final Multiplier value will be: `r=0.4`, `g=0.4`, `b=0.4`, `a=0.4`","key":"BLEND_ONE_MINUS_DST_ALPHA","value":"7"},{"text":"First, the Source alpha is compared against the Destination alpha value subtracted from `1` and the smaller of the two is kept.\n\n\t\t\tThen, the Source color channels are multiplied by the value from the first step.\n\n\t\t\tThe Source alpha channel is multiplied by `1`.\n\n\t\t\t**Example:**  \n\t\t\tIf your Source channels are: `r=1`, `g=0.25`, `b=0.1`, `a=0.6`  \n\t\t\tand your Destination channels are: `r=0`, `g=1`, `b=0.5`, `a=0.75`\n\n\t\t\tThe Destination alpha value subtracted from `1` is calculated: `1-0.75` = `0.25`  \n\t\t\tThe Source alpha `0.6` is compared to the subtracted Destination alpha `0.25` and the smaller of the two is kept (`0.25`)\n\n\t\t\tThe color channels of the Source are multiplied by the smaller value: `r=1*0.25`, `g=0.25*0.25`, `b=0.1*0.25`\n\n\t\t\tThe final Multiplier value will be `r=0.25`, `g=0.0625`, `b=0.025`, `a=0.6`","key":"BLEND_SRC_ALPHA_SATURATE","value":"8"},{"text":"The Multiplier will be the same as the Source color and alpha.","key":"BLEND_SRC_COLOR","value":"9"},{"text":"Each color and alpha channel value of the Source is subtracted from `1`.\n\n\t\t\t**Example:**  \n\t\t\tIf your Source channels are: `r=1`, `g=0.25`, `b=0.1`, `a=1`  \n\t\t\tThey will be modified by: `r=1-1`, `g=1-0.25`, `b=1-0.1`, `a=1-1`  \n\t\t\tThe final Multiplier value will be: `r=0`, `g=0.75`, `b=0.9`, `a=0`","key":"BLEND_ONE_MINUS_SRC_COLOR","value":"10"}]}},"realms":["Client"],"type":"Enum"},
{"enum":{"realm":"Shared and Menu","description":"These enums are used by render.OverrideBlend to combine the Source and Destination color and alpha into a final pixel color after they have been multiplied by their corresponding Blend Multiplier.\n\nAll results will be clamped in the range `(0-1)` and will produce final pixel channel values in the range `(0-255)`.\n\nFor an interactive demonstration of how these enums behave, see [Anders Riggelsen's Visual glBlendFunc Tool here](https://www.andersriggelsen.dk/glblendfunc.php)","items":{"item":[{"text":"**Source + Destination**  \n\t\t\tAdds each channel of the Source with the same channel of the Destination.\n\n\t\t\t**Example:**  \n\t\t\tUsing the Source channels: `r=0.0`, `g=0.25`, `b=0.1`, `a=0.9`  \n\t\t\tWith Destination channels: `r=0.25`, `g=0.25`, `b=1.0`, `a=0.0`  \n\t\t\tThe final pixel channels are: `r=0.25`, `g=0.5`, `b=1.0`, `a=0.9`","key":"BLENDFUNC_ADD","value":"0"},{"text":"**Source - Destination**  \n\t\t\tSubtracts each channel of the Destination from the same channel of the Source.\n\n\t\t\t**Example:**  \n\t\t\tUsing the Source channels: `r=0.0`, `g=0.25`, `b=1.0`, `a=0.9`  \n\t\t\tWith Destination channels: `r=0.25`, `g=0.1`, `b=0.4`, `a=0.0`  \n\t\t\tThe final pixel channels are: `r=0.0`, `g=0.0`, `b=0.6`, `a=0.9`","key":"BLENDFUNC_SUBTRACT","value":"1"},{"text":"**Destination - Source**  \n\t\t\tSubtracts each channel of the Source from the same channel of the Destination.\n\n\t\t\t**Example:**  \n\t\t\tUsing the Source channels: `r=0.0`, `g=0.25`, `b=1.0`, `a=0.9`  \n\t\t\tWith Destination channels: `r=0.25`, `g=0.1`, `b=0.4`, `a=0.0`  \n\t\t\tThe final pixel channels are: `r=0.0`, `g=0.75`, `b=0.0`, `a=0.0`","key":"BLENDFUNC_REVERSE_SUBTRACT","value":"2"},{"text":"**Min(Source, Destination**  \n\t\t\tAll of the Source channels are added together and compared to all of the Destination channels added together and the smaller of the two is used as the final pixel color.","key":"BLENDFUNC_MIN","value":"3"},{"text":"**Max(Source, Destination**  \n\t\t\tAll of the Source channels are added together and compared to all of the Destination channels added together and the larger of the two is used as the final pixel color.","key":"BLENDFUNC_MAX","value":"4"}]}},"realms":["Server","Client","Menu"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by Entity:GetBloodColor and Entity:SetBloodColor.","items":{"item":[{"text":"No blood","key":"DONT_BLEED","value":"-1"},{"text":"Normal red blood","key":"BLOOD_COLOR_RED","value":"0"},{"text":"Yellow blood","key":"BLOOD_COLOR_YELLOW","value":"1"},{"text":"Green-red blood","key":"BLOOD_COLOR_GREEN","value":"2"},{"text":"Sparks","key":"BLOOD_COLOR_MECH","value":"3"},{"text":"Yellow blood","key":"BLOOD_COLOR_ANTLION","value":"4"},{"text":"Green-red blood","key":"BLOOD_COLOR_ZOMBIE","value":"5"},{"text":"Bright green blood","key":"BLOOD_COLOR_ANTLION_WORKER","value":"6"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Used by Entity:BoneHasFlag.","items":{"item":[{"text":"Bone is physically simulated when physics are active","key":"BONE_PHYSICALLY_SIMULATED","value":"1"},{"text":"Procedural when physics is active","key":"BONE_PHYSICS_PROCEDURAL","value":"2"},{"text":"Bone is always procedurally animated","key":"BONE_ALWAYS_PROCEDURAL","value":"4"},{"text":"Bone aligns to the screen, not constrained in motion.","key":"BONE_SCREEN_ALIGN_SPHERE","value":"8"},{"text":"Bone aligns to the screen, constrained by it's own axis.","key":"BONE_SCREEN_ALIGN_CYLINDER","value":"16"},{"key":"BONE_CALCULATE_MASK","value":"31"},{"text":"A hitbox is attached to this bone","key":"BONE_USED_BY_HITBOX","value":"256"},{"text":"An attachment is attached to this bone","key":"BONE_USED_BY_ATTACHMENT","value":"512"},{"key":"BONE_USED_BY_VERTEX_LOD0","value":"1024"},{"key":"BONE_USED_BY_VERTEX_LOD1","value":"2048"},{"key":"BONE_USED_BY_VERTEX_LOD2","value":"4096"},{"key":"BONE_USED_BY_VERTEX_LOD3","value":"8192"},{"key":"BONE_USED_BY_VERTEX_LOD4","value":"16384"},{"key":"BONE_USED_BY_VERTEX_LOD5","value":"32768"},{"key":"BONE_USED_BY_VERTEX_LOD6","value":"65536"},{"key":"BONE_USED_BY_VERTEX_LOD7","value":"131072"},{"key":"BONE_USED_BY_VERTEX_MASK","value":"261120"},{"text":"Bone is available for bone merge to occur against it","key":"BONE_USED_BY_BONE_MERGE","value":"262144"},{"text":"Is this bone used by anything?\n\n( If any BONE_USED_BY_* flags are true )","key":"BONE_USED_BY_ANYTHING","value":"524032"},{"key":"BONE_USED_MASK","value":"524032"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by Entity:SetSurroundingBoundsType.","items":{"item":[{"text":"Sets the bounds in relation to the entity's collision bounds.","key":"BOUNDS_COLLISION","value":"0"},{"text":"Sets the bounds to fit all hitboxes of the entity's model.","key":"BOUNDS_HITBOXES","value":"2"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared and Menu","description":"Enumerations used by render.SetModelLighting.","items":{"item":[{"text":"Place the light from the front","key":"BOX_FRONT","value":"0"},{"text":"Place the light behind","key":"BOX_BACK","value":"1"},{"text":"Place the light to the right","key":"BOX_RIGHT","value":"2"},{"text":"Place the light to the left","key":"BOX_LEFT","value":"3"},{"text":"Place the light to the top","key":"BOX_TOP","value":"4"},{"text":"Place the light to the bottom","key":"BOX_BOTTOM","value":"5"}]}},"realms":["Server","Client","Menu"],"type":"Enum"},
{"enum":{"realm":"Shared and Menu","description":"Encompasses the range of Enums/KEY, Enums/MOUSE and Enums/JOYSTICK, all of which can be used by:\n* input.IsButtonDown\n* input.LookupKeyBinding\n* input.GetKeyName\n* input.GetKeyCode\n* GM:PlayerButtonDown\n* GM:PlayerButtonUp","items":{"item":[{"key":"BUTTON_CODE_INVALID","value":"-1"},{"key":"BUTTON_CODE_NONE","value":"0"},{"key":"BUTTON_CODE_LAST","value":"171"},{"key":"BUTTON_CODE_COUNT","value":"172"}]},"appendedenums":"KEY |  \n MOUSE |  \n JOYSTICK |"},"realms":["Server","Client","Menu"],"type":"Enum"},
{"enum":{"realm":"Server","description":"Enumerations used by NPC:CapabilitiesAdd, WEAPON:GetCapabilities and NPC:CapabilitiesGet. Serverside only.","items":{"item":[{"text":"When hit by an explosion, we'll simply block it instead of spilling it to entities behind us, the sv_robust_explosions cvar can also enable this globally when set to 0","key":"CAP_SIMPLE_RADIUS_DAMAGE","value":"-2147483648"},{"text":"Walk/Run","key":"CAP_MOVE_GROUND","value":"1"},{"text":"Jump/Leap","key":"CAP_MOVE_JUMP","value":"2"},{"text":"Can fly  move all around","key":"CAP_MOVE_FLY","value":"4"},{"text":"climb ladders","key":"CAP_MOVE_CLIMB","value":"8"},{"key":"CAP_MOVE_SWIM","value":"16"},{"key":"CAP_MOVE_CRAWL","value":"32"},{"text":"Tries to shoot weapon while moving","key":"CAP_MOVE_SHOOT","value":"64"},{"key":"CAP_SKIP_NAV_GROUND_CHECK","value":"128"},{"text":"Open doors/push buttons/pull levers","key":"CAP_USE","value":"256"},{"text":"Can trigger auto doors","key":"CAP_AUTO_DOORS","value":"1024"},{"text":"Can open manual doors","key":"CAP_OPEN_DOORS","value":"2048"},{"text":"Can turn head  always bone controller 0","key":"CAP_TURN_HEAD","value":"4096"},{"key":"CAP_WEAPON_RANGE_ATTACK1","value":"8192"},{"key":"CAP_WEAPON_RANGE_ATTACK2","value":"16384"},{"key":"CAP_WEAPON_MELEE_ATTACK1","value":"32768"},{"key":"CAP_WEAPON_MELEE_ATTACK2","value":"65536"},{"key":"CAP_INNATE_RANGE_ATTACK1","value":"131072"},{"key":"CAP_INNATE_RANGE_ATTACK2","value":"262144"},{"key":"CAP_INNATE_MELEE_ATTACK1","value":"524288"},{"key":"CAP_INNATE_MELEE_ATTACK2","value":"1048576"},{"key":"CAP_USE_WEAPONS","value":"2097152"},{"key":"CAP_USE_SHOT_REGULATOR","value":"16777216"},{"text":"Has animated eyes/face","key":"CAP_ANIMATEDFACE","value":"8388608"},{"text":"Don't take damage from npc's that are D_LI","key":"CAP_FRIENDLY_DMG_IMMUNE","value":"33554432"},{"text":"Can form squads","key":"CAP_SQUAD","value":"67108864"},{"text":"Cover and Reload ducking","key":"CAP_DUCK","value":"134217728"},{"text":"Don't hit players","key":"CAP_NO_HIT_PLAYER","value":"268435456"},{"text":"Use arms to aim gun, not just body","key":"CAP_AIM_GUN","value":"536870912"},{"key":"CAP_NO_HIT_SQUADMATES","value":"1073741824"}]}},"realms":["Server"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by Global.EmitSound and sound.Add.","items":{"item":[{"text":"Used when playing sounds through console commands.","key":"CHAN_REPLACE","value":"-1"},{"text":"Automatic channel","key":"CHAN_AUTO","value":"0"},{"text":"Channel for weapon sounds","key":"CHAN_WEAPON","value":"1"},{"text":"Channel for NPC voices","key":"CHAN_VOICE","value":"2"},{"text":"Channel for items ( Health kits, etc )","key":"CHAN_ITEM","value":"3"},{"text":"Clothing, ragdoll impacts, footsteps, knocking/pounding/punching etc.","key":"CHAN_BODY","value":"4"},{"text":"Stream channel from the static or dynamic area","key":"CHAN_STREAM","value":"5"},{"text":"A constant/background sound that doesn't require any reaction.\n\n\n**This channel allows same sounds files to play multiple times without cutting out.**","key":"CHAN_STATIC","value":"6"},{"text":"TF2s Announcer dialogue channel","key":"CHAN_VOICE2","value":"7"},{"text":"Channels 8-135 (128 channels) are allocated for player voice chat\n\n\n**This channel allows same sounds files to play multiple times without cutting out.**","key":"CHAN_VOICE_BASE","value":"8"},{"text":"Channels from this and onwards are allocated to game code","key":"CHAN_USER_BASE","value":"136"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Server","description":"Enumerations used by NPC:Classify.","items":{"item":[{"text":"None - default class for entities.","key":"CLASS_NONE","value":"0"},{"text":"Players","key":"CLASS_PLAYER","value":"1"},{"text":"HL2 - **Allies**  \n\t\t\t- `monster_barney`  \n\t\t\t- `npc_citizen`  \n\t\t\t- `npc_manhack` ( Hacked )  \n\t\t\t- `npc_turret_floor` ( Friendly )","key":"CLASS_PLAYER_ALLY","value":"2"},{"text":"HL2 - **Vital Allies**  \n\t\t\t- `npc_magnusson`  \n\t\t\t- `npc_gman`  \n\t\t\t- `npc_fisherman`  \n\t\t\t- `npc_eli`  \n\t\t\t- `npc_barney`  \n\t\t\t- `npc_kleiner`  \n\t\t\t- `npc_mossman`  \n\t\t\t- `npc_alyx`  \n\t\t\t- `npc_monk`  \n\t\t\t- `npc_dog`  \n\t\t\t- `npc_vortigaunt` at the end of EP2 (controlled by `MakeGameEndAlly` input)","key":"CLASS_PLAYER_ALLY_VITAL","value":"3"},{"text":"HL2 - **Antlions**  \n\t\t\t- `npc_antlion`  \n\t\t\t- `npc_antlionguard`  \n\t\t\t- `npc_antlionguard`","key":"CLASS_ANTLION","value":"4"},{"text":"HL2 - **Barnacles**  \n\t\t\t- `npc_barnacle`","key":"CLASS_BARNACLE","value":"5"},{"text":"HL2 - **Bullseyes**  \n\t\t\t- `npc_bullseye`","key":"CLASS_BULLSEYE","value":"6"},{"text":"HL2 - **Passive / Non-Rebel Citizens**  \n\t\t\t- `npc_citizen` in the beginning of HL2.","key":"CLASS_CITIZEN_PASSIVE","value":"7"},{"text":"HL2 -","key":["CLASS_CITIZEN_REBEL","Unused"],"value":"8"},{"text":"HL2 - **Combine Troops**  \n\t\t\t- `npc_combine`  \n\t\t\t- `npc_advisor`  \n\t\t\t- `apc_missile`  \n\t\t\t- `npc_apcdriver`  \n\t\t\t- `npc_turret_floor` ( Hostile )  \n\t\t\t- `npc_rollermine` ( Hostile )  \n\t\t\t- `npc_turret_ground` ( Active )  \n\t\t\t- `npc_turret_ceiling` ( Active )  \n\t\t\t- `npc_strider` ( Active - Not being carried by the gunship )","key":"CLASS_COMBINE","value":"9"},{"text":"HL2 - **Combine Aircrafts**  \n\t\t\t- `npc_combinegunship`  \n\t\t\t- `npc_combinedropship`\n\t\t\t- `npc_helicopter`","key":"CLASS_COMBINE_GUNSHIP","value":"10"},{"text":"HL2 -","key":["CLASS_CONSCRIPT","Unused"],"value":"11"},{"text":"HL2 - **Headcrabs**  \n\t\t\t- `npc_headcrab` ( Visible )","key":"CLASS_HEADCRAB","value":"12"},{"text":"HL2 - **Manhacks**  \n\t\t\t- `npc_manhack` ( Hostile - Not held by the gravity gun )","key":"CLASS_MANHACK","value":"13"},{"text":"HL2 - **Metro Police**  \n\t\t\t- `npc_metropolice`  \n\t\t\t- `npc_vehicledriver`","key":"CLASS_METROPOLICE","value":"14"},{"text":"HL2 - **Combine Military Objects**  \n\t\t\t- `func_guntarget`  \n\t\t\t- `npc_spotlight`  \n\t\t\t- `npc_combine_camera` ( Active )","key":"CLASS_MILITARY","value":"15"},{"text":"HL2 - **Combine Scanners**  \n\t\t\t- `npc_cscanner`  \n\t\t\t- `npc_clawscanner`","key":"CLASS_SCANNER","value":"16"},{"text":"HL2 - **Stalkers**  \n\t\t\t- `npc_stalker`","key":"CLASS_STALKER","value":"17"},{"text":"HL2 - **Vortigaunts**  \n\t\t\t- `npc_vortigaunt` before the end of EP2 ( Controlled by `MakeGameEndAlly` input )","key":"CLASS_VORTIGAUNT","value":"18"},{"text":"HL2 - **Zombies**  \n\t\t\t- `npc_zombie` ( Unslumped )  \n\t\t\t- `npc_poisonzombie`  \n\t\t\t- `npc_fastzombie`  \n\t\t\t- `npc_fastzombie_torso`  \n\t\t\t- `npc_zombine`","key":"CLASS_ZOMBIE","value":"19"},{"text":"HL2 - **Snipers**  \n\t\t\t- `npc_sniper`  \n\t\t\t- `proto_sniper`","key":"CLASS_PROTOSNIPER","value":"20"},{"text":"HL2 - **Missiles**  \n\t\t\t- `rpg_missile`  \n\t\t\t- `apc_missile`  \n\t\t\t- `grenade_pathfollower`","key":"CLASS_MISSILE","value":"21"},{"text":"HL2 - **Flares**  \n\t\t\t- `env_flare`","key":"CLASS_FLARE","value":"22"},{"text":"HL2 - **Animals**  \n\t\t\t- `npc_crow`  \n\t\t\t- `npc_seagull`  \n\t\t\t- `npc_pigeon`","key":"CLASS_EARTH_FAUNA","value":"23"},{"text":"HL2 - **Friendly Rollermines**  \n\t\t\t- `npc_rollermine` ( Hacked )","key":"CLASS_HACKED_ROLLERMINE","value":"24"},{"text":"HL2 - **Hunters**  \n\t\t\t- `npc_hunter`","key":"CLASS_COMBINE_HUNTER","value":"25"},{"text":"HL:S - **Turrets**  \n\t\t\t- `monster_turret`  \n\t\t\t- `monster_miniturret`  \n\t\t\t- `monster_sentry`","key":"CLASS_MACHINE","value":"26"},{"text":"HL:S - **Friendly Humans**  \n\t\t\t- `monster_scientist`","key":"CLASS_HUMAN_PASSIVE","value":"27"},{"text":"HL:S - **Human Military**  \n\t\t\t- `monster_human_grunt`  \n\t\t\t- `monster_apache`","key":"CLASS_HUMAN_MILITARY","value":"28"},{"text":"HL:S - **Alien Military**  \n\t\t\t- `monster_alien_controller`  \n\t\t\t- `monster_vortigaunt`  \n\t\t\t- `monster_alien_grunt`  \n\t\t\t- `monster_nihilanth`  \n\t\t\t- `monster_snark` if it has an enemy of class \n `CLASS_PLAYER` , `CLASS_HUMAN_PASSIVE` or `CLASS_HUMAN_MILITARY`","key":"CLASS_ALIEN_MILITARY","value":"29"},{"text":"HL:S - **Monsters**  \n\t\t\t- `monster_tentacle`  \n\t\t\t- `monster_barnacle`  \n\t\t\t- `monster_zombie`  \n\t\t\t- `monster_gargantua`  \n\t\t\t- `monster_houndeye`  \n\t\t\t- `monster_ichthyosaur`  \n\t\t\t- `monster_bigmomma`","key":"CLASS_ALIEN_MONSTER","value":"30"},{"text":"HL:S - **Headcrabs**  \n\t\t\t- `monster_headcrab`","key":"CLASS_ALIEN_PREY","value":"31"},{"text":"HL:S - **Alien Predators**  \n\t\t\t- `monster_bullsquid`  \n\t\t\t- `xen_tree`  \n\t\t\t- `xen_hull`","key":"CLASS_ALIEN_PREDATOR","value":"32"},{"text":"HL:S - **Insects**  \n\t\t\t- `montser_roach`  \n\t\t\t- `monster_leech`","key":"CLASS_INSECT","value":"33"},{"text":"HL:S - **Player Bioweapons**  \n\t\t\t- `hornet` fired by a player","key":"CLASS_PLAYER_BIOWEAPON","value":"34"},{"text":"HL:S - **Enemy Bioweapons**  \n\t\t\t- `hornet` fired by anyone but a player  \n\t\t\t- `monster_snark` with no enemy or an enemy without the class \n `CLASS_PLAYER` , `CLASS_HUMAN_PASSIVE` or `CLASS_HUMAN_MILITARY`","key":"CLASS_ALIEN_BIOWEAPON","value":"35"},{"text":"Portal - **Portal rocket and normal turrets, and the camera**\n* `npc_portal_turret_floor`\n* `npc_rocket_turret`\n* `npc_security_camera`","key":"CLASS_PORTAL_TURRET","value":"36"}]}},"realms":["Server"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by Entity:SetCollisionGroup, Entity:GetCollisionGroup and Traces.","items":{"item":[{"text":"Normal","key":"COLLISION_GROUP_NONE","value":"0"},{"text":"Collides with nothing but world and static stuff","key":"COLLISION_GROUP_DEBRIS","value":"1"},{"text":"Same as debris, but hits triggers. Useful for an item that can be shot, but doesn't collide.","key":"COLLISION_GROUP_DEBRIS_TRIGGER","value":"2"},{"text":"Collides with everything except other interactive debris or debris","key":"COLLISION_GROUP_INTERACTIVE_DEBRIS","value":"3"},{"text":"Collides with everything except interactive debris or debris","key":"COLLISION_GROUP_INTERACTIVE","value":"4"},{"text":"Used by players, but NOT for movement collision. Does not collide with COLLISION_GROUP_PASSABLE_DOOR and COLLISION_GROUP_PUSHAWAY","key":"COLLISION_GROUP_PLAYER","value":"5"},{"text":"NPCs can see straight through an Entity with this applied.","key":"COLLISION_GROUP_BREAKABLE_GLASS","value":"6"},{"text":"Used by driveable vehicles. Always collides against COLLISION_GROUP_VEHICLE_CLIP","key":"COLLISION_GROUP_VEHICLE","value":"7"},{"text":"For HL2, same as Collision_Group_Player, for TF2, this filters out other players and CBaseObjects","key":"COLLISION_GROUP_PLAYER_MOVEMENT","value":"8"},{"text":"Generic NPC group","key":"COLLISION_GROUP_NPC","value":"9"},{"text":"Doesn't collide with anything, no traces","key":"COLLISION_GROUP_IN_VEHICLE","value":"10"},{"text":"Doesn't collide with players and vehicles","key":"COLLISION_GROUP_WEAPON","value":"11"},{"text":"Only collides with vehicles","key":"COLLISION_GROUP_VEHICLE_CLIP","value":"12"},{"text":"Set on projectiles. Does not collide with other projectiles.","key":"COLLISION_GROUP_PROJECTILE","value":"13"},{"text":"Blocks entities not permitted to get near moving doors","key":"COLLISION_GROUP_DOOR_BLOCKER","value":"14"},{"text":"Lets the Player through, nothing else.","key":"COLLISION_GROUP_PASSABLE_DOOR","value":"15"},{"text":"Things that are dissolving are in this group","key":"COLLISION_GROUP_DISSOLVING","value":"16"},{"text":"Nonsolid on client and server, pushaway in player code","key":"COLLISION_GROUP_PUSHAWAY","value":"17"},{"text":"Used so NPCs in scripts ignore the player","key":"COLLISION_GROUP_NPC_ACTOR","value":"18"},{"text":"Used for NPCs in scripts that should not collide with each other","key":"COLLISION_GROUP_NPC_SCRIPTED","value":"19"},{"text":"Doesn't collide with players/props","key":"COLLISION_GROUP_WORLD","value":"20"},{"text":"Amount of COLLISION_GROUP_ enumerations","key":"LAST_SHARED_COLLISION_GROUP","value":"21"},{"text":"Half-Life 2 exclusive collision group, acts similarly to `COLLISION_GROUP_PROJECTILE` but is also ignored by player movement.","key":"COLLISION_GROUP_HL2_SPIT","value":"22","added":"2025.12.18"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Server","description":{"text":"Enumerations for NPC conditions, used by NPC:SetCondition. Serverside only.","note":"Unlike other Enums `COND` is a table that contains all the enums.\n\n\tThere are more conditions than listed here after **COND_NO_CUSTOM_INTERRUPTS**(70) \n\tbut the name depends on what's returned by NPC:ConditionName"},"items":{"item":[{"key":"COND.BEHIND_ENEMY","value":"29"},{"key":"COND.BETTER_WEAPON_AVAILABLE","value":"46"},{"key":"COND.CAN_MELEE_ATTACK1","value":"23"},{"key":"COND.CAN_MELEE_ATTACK2","value":"24"},{"key":"COND.CAN_RANGE_ATTACK1","value":"21"},{"key":"COND.CAN_RANGE_ATTACK2","value":"22"},{"key":"COND.ENEMY_DEAD","value":"30"},{"key":"COND.ENEMY_FACING_ME","value":"28"},{"key":"COND.ENEMY_OCCLUDED","value":"13"},{"key":"COND.ENEMY_TOO_FAR","value":"27"},{"key":"COND.ENEMY_UNREACHABLE","value":"31"},{"key":"COND.ENEMY_WENT_NULL","value":"12"},{"key":"COND.FLOATING_OFF_GROUND","value":"61"},{"key":"COND.GIVE_WAY","value":"48"},{"key":"COND.HAVE_ENEMY_LOS","value":"15"},{"key":"COND.HAVE_TARGET_LOS","value":"16"},{"key":"COND.HEALTH_ITEM_AVAILABLE","value":"47"},{"key":"COND.HEAR_BUGBAIT","value":"52"},{"key":"COND.HEAR_BULLET_IMPACT","value":"56"},{"key":"COND.HEAR_COMBAT","value":"53"},{"key":"COND.HEAR_DANGER","value":"50"},{"key":"COND.HEAR_MOVE_AWAY","value":"58"},{"key":"COND.HEAR_PHYSICS_DANGER","value":"57"},{"key":"COND.HEAR_PLAYER","value":"55"},{"key":"COND.HEAR_SPOOKY","value":"59"},{"key":"COND.HEAR_THUMPER","value":"51"},{"key":"COND.HEAR_WORLD","value":"54"},{"key":"COND.HEAVY_DAMAGE","value":"18"},{"key":"COND.IDLE_INTERRUPT","value":"2"},{"key":"COND.IN_PVS","value":"1"},{"key":"COND.LIGHT_DAMAGE","value":"17"},{"key":"COND.LOST_ENEMY","value":"11"},{"key":"COND.LOST_PLAYER","value":"33"},{"key":"COND.LOW_PRIMARY_AMMO","value":"3"},{"key":"COND.MOBBED_BY_ENEMIES","value":"62"},{"key":"COND.NEW_ENEMY","value":"26"},{"key":"COND.NO_CUSTOM_INTERRUPTS","value":"70"},{"key":"COND.NO_HEAR_DANGER","value":"60"},{"key":"COND.NO_PRIMARY_AMMO","value":"4"},{"key":"COND.NO_SECONDARY_AMMO","value":"5"},{"key":"COND.NO_WEAPON","value":"6"},{"text":"No additional conditions are being played","key":"COND.NONE","value":"0"},{"key":"COND.NOT_FACING_ATTACK","value":"40"},{"text":"Freezes NPC movement","key":"COND.NPC_FREEZE","value":"67"},{"text":"Unfreezes NPC movement","key":"COND.NPC_UNFREEZE","value":"68"},{"key":"COND.PHYSICS_DAMAGE","value":"19"},{"key":"COND.PLAYER_ADDED_TO_SQUAD","value":"64"},{"key":"COND.PLAYER_PUSHING","value":"66"},{"key":"COND.PLAYER_REMOVED_FROM_SQUAD","value":"65"},{"key":"COND.PROVOKED","value":"25"},{"key":"COND.RECEIVED_ORDERS","value":"63"},{"key":"COND.REPEATED_DAMAGE","value":"20"},{"key":"COND.SCHEDULE_DONE","value":"36"},{"key":"COND.SEE_DISLIKE","value":"9"},{"key":"COND.SEE_ENEMY","value":"10"},{"key":"COND.SEE_FEAR","value":"8"},{"key":"COND.SEE_HATE","value":"7"},{"key":"COND.SEE_NEMESIS","value":"34"},{"key":"COND.SEE_PLAYER","value":"32"},{"key":"COND.SMELL","value":"37"},{"key":"COND.TALKER_RESPOND_TO_QUESTION","value":"69"},{"key":"COND.TARGET_OCCLUDED","value":"14"},{"key":"COND.TASK_FAILED","value":"35"},{"key":"COND.TOO_CLOSE_TO_ATTACK","value":"38"},{"key":"COND.TOO_FAR_TO_ATTACK","value":"39"},{"key":"COND.WAY_CLEAR","value":"49"},{"key":"COND.WEAPON_BLOCKED_BY_FRIEND","value":"42"},{"key":"COND.WEAPON_HAS_LOS","value":"41"},{"key":"COND.WEAPON_PLAYER_IN_SPREAD","value":"43"},{"key":"COND.WEAPON_PLAYER_NEAR_TARGET","value":"44"},{"key":"COND.WEAPON_SIGHT_OCCLUDED","value":"45"}]}},"realms":["Server"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by util.PointContents and PhysObj:SetContents as tracer masks, and by ENT.PhysicsSolidMask for collision masking.","items":{"item":[{"text":"Things that are not solid","key":"CONTENTS_EMPTY","value":"0"},{"text":"Things that are solid","key":"CONTENTS_SOLID","value":"1"},{"text":"Glass","key":"CONTENTS_WINDOW","value":"2"},{"key":"CONTENTS_AUX","value":"4"},{"text":"Bullets go through, solids don't","key":"CONTENTS_GRATE","value":"8"},{"key":"CONTENTS_SLIME","value":"16"},{"text":"Hits world but not skybox","key":"CONTENTS_WATER","value":"32"},{"text":"Things that block line of sight","key":"CONTENTS_BLOCKLOS","value":"64"},{"text":"Things that block light","key":"CONTENTS_OPAQUE","value":"128"},{"key":"CONTENTS_TESTFOGVOLUME","value":"256"},{"key":"CONTENTS_TEAM4","value":"512"},{"key":"CONTENTS_TEAM3","value":"1024"},{"key":"CONTENTS_TEAM1","value":"2048"},{"key":"CONTENTS_TEAM2","value":"4096"},{"key":"CONTENTS_IGNORE_NODRAW_OPAQUE","value":"8192"},{"key":"CONTENTS_MOVEABLE","value":"16384"},{"key":"CONTENTS_AREAPORTAL","value":"32768"},{"key":"CONTENTS_PLAYERCLIP","value":"65536"},{"key":"CONTENTS_MONSTERCLIP","value":"131072"},{"key":"CONTENTS_CURRENT_0","value":"262144"},{"key":"CONTENTS_CURRENT_180","value":"1048576"},{"key":"CONTENTS_CURRENT_270","value":"2097152"},{"key":"CONTENTS_CURRENT_90","value":"524288"},{"key":"CONTENTS_CURRENT_DOWN","value":"8388608"},{"key":"CONTENTS_CURRENT_UP","value":"4194304"},{"text":"Includes, among other things, client-side ragdolls and prop gibs","key":"CONTENTS_DEBRIS","value":"67108864"},{"key":"CONTENTS_DETAIL","value":"134217728"},{"text":"Hitbox","key":"CONTENTS_HITBOX","value":"1073741824"},{"text":"Ladder","key":"CONTENTS_LADDER","value":"536870912"},{"text":"NPCs","key":"CONTENTS_MONSTER","value":"33554432"},{"key":"CONTENTS_ORIGIN","value":"16777216"},{"text":"Hits world but not skybox","key":"CONTENTS_TRANSLUCENT","value":"268435456"},{"text":"Last visible contents enumeration","key":"LAST_VISIBLE_CONTENTS","value":"128"},{"text":"Sum of all the visible contents enumerations","key":"ALL_VISIBLE_CONTENTS","value":"255"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Client","description":"Enumerations used by Global.GetRenderTargetEx. Clientside only.","items":{"item":[{"text":"Makes this render target an HDR render target if the current system supports HDR.","key":"CREATERENDERTARGETFLAGS_HDR","value":"1"},{"text":"Does nothing.","key":"CREATERENDERTARGETFLAGS_AUTOMIPMAP","value":"2"},{"text":"Does nothing","key":"CREATERENDERTARGETFLAGS_UNFILTERABLE_OK","value":"4"}]}},"realms":["Client"],"type":"Enum"},
{"enum":{"realm":"Server","description":"Citizen type, a KeyValue for npc_citizen( citizentype ), serverside only.","items":{"item":[{"text":"Default citizen","key":"CT_DEFAULT","value":"0"},{"text":"Default citizen(?)","key":"CT_DOWNTRODDEN","value":"1"},{"text":"Refugee","key":"CT_REFUGEE","value":"2"},{"text":"Rebel","key":"CT_REBEL","value":"3"},{"text":"Odessa?","key":"CT_UNIQUE","value":"4"}]}},"realms":["Server"],"type":"Enum"},
{"enum":{"realm":"Server","description":"Enumerations used by NPC:Disposition and ENTITY:GetRelationship.","items":{"item":[{"text":"Error","key":"D_ER","value":"0"},{"text":"Hate","key":"D_HT","value":"1"},{"text":"Frightened / Fear","key":"D_FR","value":"2"},{"text":"Like","key":"D_LI","value":"3"},{"text":"Neutral","key":"D_NU","value":"4"}]}},"realms":["Server"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used internally by death notice system.\n\nThis enumeration is a bit field/bitflag, which means that you can combine multiple death flags using the bit library. You can use bit.band to test if a specific death flag is set.","items":{"item":[{"text":"Was the victim friendly?","key":"DEATH_NOTICE_FRIENDLY_VICTIM","value":"1"},{"text":"Was the attacker friendly?","key":"DEATH_NOTICE_FRIENDLY_ATTACKER","value":"2"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Displacement surface flags, used by the Structures/TraceResult.","items":{"item":[{"key":"DISPSURF_SURFACE","value":"1"},{"key":"DISPSURF_WALKABLE","value":"2"},{"key":"DISPSURF_BUILDABLE","value":"4"},{"key":"DISPSURF_SURFPROP1","value":"8"},{"key":"DISPSURF_SURFPROP2","value":"16"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by CTakeDamageInfo:GetDamageType, CTakeDamageInfo:SetDamageType and CTakeDamageInfo:IsDamageType.\n\nThis enumeration is a bit field/bitflag, which means that you can combine multiple damage types using the bit library. You can use bit.band to test if a specific damage type is set.","items":{"item":[{"text":"Generic damage (used by weapon_fists)","key":"DMG_GENERIC","value":"0"},{"text":"Caused by physics interaction and ignored by airboat drivers. This is used by the Rollermine and an unused animation attack called 'Fireattack' by the Antlion Guard [ACT_RANGE_ATTACK1](https://wiki.facepunch.com/gmod/Enums/ACT)","key":"DMG_CRUSH","value":"1"},{"text":"Bullet damage from Ceiling Turrets, the Strider, Turrets and most guns.","key":"DMG_BULLET","value":"2"},{"text":"Used by the Stunstick, Manhacks, Antlions, Antlion Guards, Headcrabs, Fast Headcrabs, all Zombies types, Hunter, and potentially other NPCs attacks","key":"DMG_SLASH","value":"4"},{"text":"Damage from fire","key":"DMG_BURN","value":"8"},{"text":"Hit by a vehicle (This will need to be set for passengers of some vehicle to receive damage)","key":"DMG_VEHICLE","value":"16"},{"text":"Fall damage","key":"DMG_FALL","value":"32"},{"text":"Explosion damage like grenades, helicopter bombs, combine mines, Will be ignored by most vehicle passengers.","key":"DMG_BLAST","value":"64"},{"text":"Blunt attacks such as from the Crowbar, Antlion Guard & Hunter","key":"DMG_CLUB","value":"128"},{"text":"Electrical damage, shows smoke at the damage position and its used by Stalkers & Vortigaunts","key":"DMG_SHOCK","value":"256"},{"text":"Sonic damage, used by the Gargantua and Houndeye NPCs","key":"DMG_SONIC","value":"512"},{"text":"Laser damage","key":"DMG_ENERGYBEAM","value":"1024"},{"text":"Prevent a physics force.","key":"DMG_PREVENT_PHYSICS_FORCE","value":"2048"},{"text":"Crossbow damage, never creates gibs.","key":"DMG_NEVERGIB","value":"4096"},{"text":"Always create gibs","key":"DMG_ALWAYSGIB","value":"8192"},{"text":"Drown damage","key":"DMG_DROWN","value":"16384"},{"text":"Same as DMG_POISON","key":"DMG_PARALYZE","value":"32768"},{"text":"Neurotoxin damage","key":"DMG_NERVEGAS","value":"65536"},{"text":"Poison damage used by Antlion Workers & Poison Headcrabs.","key":"DMG_POISON","value":"131072"},{"text":"Radiation damage & it will be ignored by most vehicle passengers","key":"DMG_RADIATION","value":"262144"},{"text":"Damage applied to the player to restore health after drowning","key":"DMG_DROWNRECOVER","value":"524288"},{"text":"Toxic chemical or acid burn damage used by the Antlion Workers","key":"DMG_ACID","value":"1048576"},{"text":"In an oven","key":"DMG_SLOWBURN","value":"2097152"},{"text":"Don't create a ragdoll on death","key":"DMG_REMOVENORAGDOLL","value":"4194304"},{"text":"Damage done by the gravity gun.","key":"DMG_PHYSGUN","value":"8388608"},{"text":"Plasma damage","key":"DMG_PLASMA","value":"16777216"},{"text":"Airboat gun damage","key":"DMG_AIRBOAT","value":"33554432"},{"text":"Forces the entity to dissolve on death. This is what the combine ball uses when it hits a target.","key":"DMG_DISSOLVE","value":"67108864"},{"text":"This won't hurt the player underwater","key":"DMG_BLAST_SURFACE","value":"134217728"},{"text":"Direct damage to the entity that does not go through any damage value modifications","key":"DMG_DIRECT","value":"268435456"},{"text":"The pellets fired from a shotgun","key":"DMG_BUCKSHOT","value":"536870912"},{"text":"Damage from SniperRound/SniperPenetratedRound ammo types","key":"DMG_SNIPER","value":"1073741824"},{"text":"Damage from npc_missiledefense, npc_combinegunship, or monster_mortar","key":"DMG_MISSILEDEFENSE","value":"2147483648"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Client and Menu","description":{"text":"Enumerations used by Panel:Dock.","note":"These enumerations doesn't have DOCK_ prefix, this is an exception from all other enumerations."},"items":{"item":[{"text":"Don't dock","key":"NODOCK","value":"0"},{"text":"Fill parent","key":"FILL","value":"1"},{"text":"Dock to the left","key":"LEFT","value":"2"},{"text":"Dock to the right","key":"RIGHT","value":"3"},{"text":"Dock to the top","key":"TOP","value":"4"},{"text":"Dock to the bottom","key":"BOTTOM","value":"5"}]}},"realms":["Client","Menu"],"type":"Enum"},
{"enum":{"realm":"Client","description":"Internal globals for SimpleDoF.","items":{"item":[{"key":"DOF_OFFSET","value":"256"},{"key":"DOF_SPACING","value":"512"}]}},"realms":["Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by Entity:AddEffects,  Entity:RemoveEffects and  Entity:IsEffectActive.","items":{"item":[{"text":"Performs bone merge on client side, merging bone positions of child entities (Entity:SetParent) with those of the parent, by bone names. The skeletons should have identical proportions, however it is not a requirement.","key":"EF_BONEMERGE","value":"1"},{"text":"For use with EF_BONEMERGE. If this is set, then it places this ents origin at its parent and uses the parent's bbox + the max extents of the aiment. Otherwise, it sets up the parent's bones every frame to figure out where to place the aiment, which is inefficient because it'll setup the parent's bones even if the parent is not in the PVS.","key":"EF_BONEMERGE_FASTCULL","value":"128"},{"text":"DLIGHT centered at entity origin.","key":"EF_BRIGHTLIGHT","value":"2"},{"text":"Player flashlight.","key":"EF_DIMLIGHT","value":"4"},{"text":"Don't interpolate the next frame.","key":"EF_NOINTERP","value":"8","deprecated":{"text":"Seems to have no effect. Has been replaced with [C_BaseEntity::IsNoInterpolationFrame()](https://github.com/ValveSoftware/source-sdk-2013/blob/master/src/game/client/c_baseentity.h#L1331-L1332).","notag":"true"}},{"text":"Disables shadow.","key":"EF_NOSHADOW","value":"16"},{"text":"Prevents the entity from drawing and networking.","key":"EF_NODRAW","value":"32"},{"text":"Don't receive shadows.","key":"EF_NORECEIVESHADOW","value":"64"},{"text":"Makes the entity blink.","key":"EF_ITEM_BLINK","value":"256"},{"text":"Always assume that the parent entity is animating.","key":"EF_PARENT_ANIMATES","value":"512"},{"text":"Internal flag that is set by Entity:FollowBone.","key":"EF_FOLLOWBONE","value":"1024"},{"text":"GMod-specific. Makes the entity not accept being lit by projected textures, including the player's flashlight.","key":"EF_NOFLASHLIGHT","value":"8192"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by Entity:AddEFlags, Entity:RemoveEFlags and Entity:IsEFlagSet.","items":{"item":[{"text":"This entity is marked for death -- This allows the game to actually delete ents at a safe time.","key":"EFL_KILLME","value":"1","warning":"You should never set this flag manually."},{"text":"Entity is dormant, no updates to client","key":"EFL_DORMANT","value":"2"},{"text":"Lets us know when the noclip command is active","key":"EFL_NOCLIP_ACTIVE","value":"4"},{"text":"Set while a model is setting up its bones","key":"EFL_SETTING_UP_BONES","value":"8"},{"text":"This is a special entity that should not be deleted when we respawn entities via game.CleanUpMap.","key":"EFL_KEEP_ON_RECREATE_ENTITIES","value":"16"},{"text":"One of the child entities is a player","key":"EFL_HAS_PLAYER_CHILD","value":"16"},{"text":"(Client only) need shadow manager to update the shadow","key":"EFL_DIRTY_SHADOWUPDATE","value":"32"},{"text":"Another entity is watching events on this entity (used by teleport)","key":"EFL_NOTIFY","value":"64"},{"text":"The default behavior in ShouldTransmit is to not send an entity if it doesn't have a model. Certain entities want to be sent anyway because all the drawing logic is in the client DLL. They can set this flag and the engine will transmit them even if they don't have model","key":"EFL_FORCE_CHECK_TRANSMIT","value":"128"},{"text":"This is set on bots that are frozen","key":"EFL_BOT_FROZEN","value":"256"},{"text":"Non-networked entity","key":"EFL_SERVER_ONLY","value":"512"},{"text":"Don't attach the edict","key":"EFL_NO_AUTO_EDICT_ATTACH","value":"1024"},{"text":"Some 'dirty' bits with respect to absolute computations. Used internally by the engine when an entity's absolute position needs to be recalculated.","key":"EFL_DIRTY_ABSTRANSFORM","value":"2048"},{"text":"Some 'dirty' bits with respect to absolute computations. Used internally by the engine when an entity's absolute velocity needs to be recalculated.","key":"EFL_DIRTY_ABSVELOCITY","value":"4096"},{"text":"Some 'dirty' bits with respect to absolute computations. Used internally by the engine when an entity's absolute angular velocity needs to be recalculated.","key":"EFL_DIRTY_ABSANGVELOCITY","value":"8192"},{"text":"Marks the entity as having a 'dirty' surrounding box. Used internally by the engine to recompute the entity's collision bounds.","key":"EFL_DIRTY_SURROUNDING_COLLISION_BOUNDS","value":"16384"},{"text":"Used internally by the engine when an entity's \"spatial partition\" needs to be recalculated.","key":"EFL_DIRTY_SPATIAL_PARTITION","value":"32768"},{"text":"This is set if the entity detects that it's in the skybox. This forces it to pass the \"in PVS\" for transmission","key":"EFL_IN_SKYBOX","value":"131072"},{"text":"Entities with this flag set show up in the partition even when not solid","key":"EFL_USE_PARTITION_WHEN_NOT_SOLID","value":"262144"},{"text":"Used to determine if an entity is floating","key":"EFL_TOUCHING_FLUID","value":"524288"},{"text":"The entity is currently being lifted by a Barnacle.","key":"EFL_IS_BEING_LIFTED_BY_BARNACLE","value":"1048576"},{"text":"The entity is not affected by 'rotorwash push'--the wind-push effect caused by helicopters close to the ground in Half-Life 2.","key":"EFL_NO_ROTORWASH_PUSH","value":"2097152"},{"text":"Avoid executing the entity's Think","key":"EFL_NO_THINK_FUNCTION","value":"4194304"},{"text":"The entity is currently not simulating any physics.","key":"EFL_NO_GAME_PHYSICS_SIMULATION","value":"8388608"},{"text":"The entity is about to have its untouch callback checked, e.g. when this entity stops touching another entity.","key":"EFL_CHECK_UNTOUCH","value":"16777216"},{"text":"Entity shouldn't block NPC line-of-sight","key":"EFL_DONTBLOCKLOS","value":"33554432"},{"text":"NPCs should not walk on this entity","key":"EFL_DONTWALKON","value":"67108864"},{"text":"The entity shouldn't dissolve","key":"EFL_NO_DISSOLVE","value":"134217728"},{"text":"Mega physcannon can't ragdoll these guys","key":"EFL_NO_MEGAPHYSCANNON_RAGDOLL","value":"268435456"},{"text":"Don't adjust this entity's velocity when transitioning into water","key":"EFL_NO_WATER_VELOCITY_CHANGE","value":"536870912"},{"text":"Physcannon can't pick these up or punt them","key":"EFL_NO_PHYSCANNON_INTERACTION","value":"1073741824"},{"text":"Doesn't accept forces from physics damage","key":"EFL_NO_DAMAGE_FORCES","value":"-2147483648"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared and Menu","description":"Enumerations used by Global.AddConsoleCommand, concommand.Add, Global.CreateClientConVar and Global.CreateConVar.","items":{"item":[{"text":"Save the ConVar value into either client.vdf or server.vdf\n\nReported as \"a\" by `cvarlist`, except Lua ConVars","key":"FCVAR_ARCHIVE","value":"128"},{"text":"Save the ConVar value into config.vdf on XBox","key":"FCVAR_ARCHIVE_XBOX","value":"16777216"},{"text":"Requires `sv_cheats` to be enabled to change the ConVar or run the command\n\nReported as \"cheat\" by `cvarlist`","key":"FCVAR_CHEAT","value":"16384"},{"text":"`IVEngineClient::ClientCmd` is allowed to execute this command\n\nReported as \"clientcmd_can_execute\" by `cvarlist`","key":"FCVAR_CLIENTCMD_CAN_EXECUTE","value":"1073741824"},{"text":"ConVar is defined by the client DLL.\n\nThis flag is set automatically\n\nReported as \"cl\" by `cvarlist`","key":"FCVAR_CLIENTDLL","value":"8"},{"text":"Force the ConVar to be recorded by demo recordings.\n\nReported as \"demo\" by `cvarlist`","key":"FCVAR_DEMO","value":"65536"},{"text":"Opposite of [FCVAR_DEMO](#FCVAR_DEMO), ensures the ConVar is not recorded in demos\n\nReported as \"norecord\" by `cvarlist`","key":"FCVAR_DONTRECORD","value":"131072"},{"text":"ConVar is defined by the game DLL.\n\nThis flag is set automatically\n\nReported as \"sv\" by `cvarlist`","key":"FCVAR_GAMEDLL","value":"4"},{"text":"Set automatically on all ConVars and console commands created by the client Lua state.\n\nReported as \"lua_client\" by `cvarlist`","key":"FCVAR_LUA_CLIENT","value":"262144"},{"text":"Set automatically on all ConVars and console commands created by the server Lua state.\n\nReported as \"lua_server\" by `cvarlist`","key":"FCVAR_LUA_SERVER","value":"524288"},{"text":"Tells the engine to never print this variable as a string. This is used for variables which may contain control characters.\n\nReported as \"numeric\" by `cvarlist`","key":"FCVAR_NEVER_AS_STRING","value":"4096"},{"text":"No flags","key":"FCVAR_NONE","value":"0"},{"text":"For serverside ConVars, notifies all players with blue chat text when the value gets changed, also makes the convar appear in [A2S_RULES](https://developer.valvesoftware.com/wiki/Server_queries#A2S_RULES)\n\nReported as \"nf\" by `cvarlist`","key":"FCVAR_NOTIFY","value":"256"},{"text":"Makes the ConVar not changeable while connected to a server or in singleplayer","key":"FCVAR_NOT_CONNECTED","value":"4194304"},{"text":"Forces the ConVar to only have printable characters (No control characters)\n\nReported as \"print\" by `cvarlist`","key":"FCVAR_PRINTABLEONLY","value":"1024"},{"text":"Makes the ConVar value hidden from all clients (For example `sv_password`)\n\nReported as \"prot\" by `cvarlist`","key":"FCVAR_PROTECTED","value":"32"},{"text":"For serverside ConVars, it will enforce its value on all clients. The ConVar with the same name must also exist on the client!\n\nReported as \"rep\" by `cvarlist`","key":"FCVAR_REPLICATED","value":"8192"},{"text":"Prevents the server from querying value of this ConVar","key":"FCVAR_SERVER_CANNOT_QUERY","value":"536870912"},{"text":"The server is allowed to execute this command on clients.\n\nReported as \"server_can_execute\" by `cvarlist`","key":"FCVAR_SERVER_CAN_EXECUTE","value":"268435456"},{"text":"Executing the command or changing the ConVar is only allowed in singleplayer\n\nReported as \"sp\" by `cvarlist`","key":"FCVAR_SPONLY","value":"64"},{"text":"Don't log the ConVar changes to console/log files/users\n\nReported as \"log\" by `cvarlist`","key":"FCVAR_UNLOGGED","value":"2048"},{"text":"If this is set, the convar will become anonymous and won't show up in the `find` results.","key":"FCVAR_UNREGISTERED","value":"1"},{"text":"For clientside commands, sends the value to the server\n\nReported as \"user\" by `cvarlist`","key":"FCVAR_USERINFO","value":"512"}]}},"realms":["Server","Client","Menu"],"type":"Enum"},
{"enum":{"realm":"Client","description":"Enumerations used by IGModAudioChannel:FFT. Clientside only.","items":{"item":[{"text":"128 levels","key":"FFT_256","value":"0"},{"text":"256 levels","key":"FFT_512","value":"1"},{"text":"512 levels","key":"FFT_1024","value":"2"},{"text":"1024 levels","key":"FFT_2048","value":"3"},{"text":"2048 levels","key":"FFT_4096","value":"4"},{"text":"4096 levels","key":"FFT_8192","value":"5"},{"text":"8192 levels","key":"FFT_16384","value":"6"},{"text":"16384 levels","key":"FFT_32768","value":"7"}]}},"realms":["Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by Entity:AddFlags, Entity:RemoveFlags and Entity:IsFlagSet.","items":{"item":[{"text":"Is the entity on ground or not","key":"FL_ONGROUND","value":"1"},{"text":"Is player ducking or not","key":"FL_DUCKING","value":"2"},{"text":"Is the player in the process of ducking or standing up","key":"FL_ANIMDUCKING","value":"4"},{"text":"The player is jumping out of water","key":"FL_WATERJUMP","value":"8"},{"text":"This player is controlling a func_train","key":"FL_ONTRAIN","value":"16"},{"text":"Indicates the entity is standing in rain","key":"FL_INRAIN","value":"32"},{"text":"Completely freezes the player","key":"FL_FROZEN","value":"64","bug":"Bots will still be able to look around."},{"text":"This player is controlling something UI related in the world, this prevents his movement, but doesn't freeze mouse movement, jumping, etc.","key":"FL_ATCONTROLS","value":"128"},{"text":"Is this entity a player or not","key":"FL_CLIENT","value":"256"},{"text":"Bots have this flag","key":"FL_FAKECLIENT","value":"512"},{"text":"Is the player in water or not","key":"FL_INWATER","value":"1024"},{"text":"This entity can fly","key":"FL_FLY","value":"2048"},{"text":"This entity can swim","key":"FL_SWIM","value":"4096"},{"text":"This entity is a func_conveyor","key":"FL_CONVEYOR","value":"8192"},{"text":"NPCs have this flag (NPC: Ignore player push)","key":"FL_NPC","value":"16384"},{"text":"Whether the player has god mode enabled","key":"FL_GODMODE","value":"32768"},{"text":"Makes the entity invisible to AI","key":"FL_NOTARGET","value":"65536"},{"text":"This entity can be aimed at","key":"FL_AIMTARGET","value":"131072"},{"text":"Not all corners are valid","key":"FL_PARTIALGROUND","value":"262144"},{"text":"It's a static prop","key":"FL_STATICPROP","value":"524288"},{"text":"worldgraph has this ent listed as something that blocks a connection","key":"FL_GRAPHED","value":"1048576"},{"text":"This entity is a grenade, unused","key":"FL_GRENADE","value":"2097152"},{"text":"Changes the SV_Movestep() behavior to not do any processing","key":"FL_STEPMOVEMENT","value":"4194304"},{"text":"Doesn't generate touch functions, calls ENTITY:EndTouch when this flag gets set during a touch callback","key":"FL_DONTTOUCH","value":"8388608"},{"text":"Base velocity has been applied this frame (used to convert base velocity into momentum)","key":"FL_BASEVELOCITY","value":"16777216"},{"text":"This entity is a brush and part of the world","key":"FL_WORLDBRUSH","value":"33554432"},{"text":"This entity can be seen by NPCs","key":"FL_OBJECT","value":"67108864"},{"text":"This entity is about to get removed","key":"FL_KILLME","value":"134217728"},{"text":"This entity is on fire","key":"FL_ONFIRE","value":"268435456"},{"text":"The entity is currently dissolving","key":"FL_DISSOLVING","value":"536870912"},{"text":"This entity is about to become a ragdoll","key":"FL_TRANSRAGDOLL","value":"1073741824"},{"text":"This moving door can't be blocked by the player","key":"FL_UNBLOCKABLE_BY_PLAYER","value":"-2147483648"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared and Menu","description":"Enumerations used by Global.AccessorFunc.","items":{"item":[{"text":"Forces the function to take strings only","key":"FORCE_STRING","value":"1"},{"text":"Forces the function to take numbers only","key":"FORCE_NUMBER","value":"2"},{"text":"Forces the function to take booleans only","key":"FORCE_BOOL","value":"3"},{"text":"Forces the function to take Angles only","key":"FORCE_ANGLE","value":"4"},{"text":"Forces the function to take Colors only","key":"FORCE_COLOR","value":"5"},{"text":"Forces the function to take Vectors only","key":"FORCE_VECTOR","value":"6"}]}},"realms":["Server","Client","Menu"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Used by file.AsyncRead.","items":{"item":[{"key":"FSASYNC_ERR_NOT_MINE","value":"-8"},{"key":"FSASYNC_ERR_RETRY_LATER","value":"-7"},{"key":"FSASYNC_ERR_ALIGNMENT","value":"-6"},{"key":"FSASYNC_ERR_FAILURE","value":"-5"},{"key":"FSASYNC_ERR_READING","value":"-4"},{"key":"FSASYNC_ERR_NOMEMORY","value":"-3"},{"key":"FSASYNC_ERR_UNKNOWNID","value":"-2"},{"key":"FSASYNC_ERR_FILEOPEN","value":"-1"},{"key":"FSASYNC_OK","value":"0"},{"key":"FSASYNC_STATUS_PENDING","value":"1"},{"key":"FSASYNC_STATUS_INPROGRESS","value":"2"},{"key":"FSASYNC_STATUS_ABORTED","value":"3"},{"key":"FSASYNC_STATUS_UNSERVICED","value":"4"}]},"fieldsonly":""},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by Entity:SetSolidFlags and Entity:GetSolidFlags.","items":{"item":[{"text":"Ignore solid type + always call into the entity for ray tests","key":"FSOLID_CUSTOMRAYTEST","value":"1"},{"text":"Ignore solid type + always call into the entity for swept box tests","key":"FSOLID_CUSTOMBOXTEST","value":"2"},{"text":"The object is currently not solid","key":"FSOLID_NOT_SOLID","value":"4"},{"text":"This is something may be collideable but fires touch functions even when it's not collideable (when the FSOLID_NOT_SOLID flag is set)","key":"FSOLID_TRIGGER","value":"8"},{"text":"The player can't stand on this","key":"FSOLID_NOT_STANDABLE","value":"16"},{"text":"Contains volumetric contents (like water)","key":"FSOLID_VOLUME_CONTENTS","value":"32"},{"text":"Forces the collision representation to be world-aligned even if it's SOLID_BSP or SOLID_VPHYSICS","key":"FSOLID_FORCE_WORLD_ALIGNED","value":"64"},{"text":"Uses a special trigger bounds separate from the normal OBB","key":"FSOLID_USE_TRIGGER_BOUNDS","value":"128"},{"text":"Collisions are defined in root parent's local coordinate space","key":"FSOLID_ROOT_PARENT_ALIGNED","value":"256"},{"text":"This trigger will touch debris objects","key":"FSOLID_TRIGGER_TOUCH_DEBRIS","value":"512"},{"text":"The amount of bits needed to store the all the flags in a variable/sent over network.","key":"FSOLID_MAX_BITS","value":"10"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by PhysObj:AddGameFlag, PhysObj:HasGameFlag and PhysObj:ClearGameFlag.","items":{"item":[{"text":"Won't receive physics forces from collisions and won't collide with other PhysObj with the same flag set.","key":"FVPHYSICS_CONSTRAINT_STATIC","value":"2"},{"text":"Colliding with entities will cause 1000 damage with DMG_DISSOLVE as the damage type, but only if EFL_NO_DISSOLVE is not set.","key":"FVPHYSICS_DMG_DISSOLVE","value":"512"},{"text":"Does slice damage, not just blunt damage.","key":"FVPHYSICS_DMG_SLICE","value":"1"},{"text":"Will deal high physics damage even with a small mass.","key":"FVPHYSICS_HEAVY_OBJECT","value":"32"},{"text":"This PhysObj is part of an entity with multiple PhysObj , such as a ragdoll or a vehicle , and will be considered during collision damage events.","key":"FVPHYSICS_MULTIOBJECT_ENTITY","value":"16"},{"text":"Colliding with entities won't cause physics damage.","key":"FVPHYSICS_NO_IMPACT_DMG","value":"1024"},{"text":"Like FVPHYSICS_NO_IMPACT_DMG, but only checks for NPCs. Usually set on Combine Balls fired by Combine Soldiers.","key":"FVPHYSICS_NO_NPC_IMPACT_DMG","value":"2048"},{"text":"Doesn't allow the player to pick this PhysObj with the Gravity Gun or +use pickup.","key":"FVPHYSICS_NO_PLAYER_PICKUP","value":"128"},{"text":"We won't collide with other PhysObj associated to the same entity, only used for vehicles and ragdolls held by the Super Gravity Gun.","key":"FVPHYSICS_NO_SELF_COLLISIONS","value":"32768"},{"text":"This PhysObj is part of a ragdoll.","key":"FVPHYSICS_PART_OF_RAGDOLL","value":"8"},{"text":"Set by the physics engine when two PhysObj are penetrating each other. This is only automatically updated for non-static physics objects.","key":"FVPHYSICS_PENETRATING","value":"64"},{"text":"Set when the player is holding this PhysObj with the Physics Gun, Gravity Gun or +use pickup.","key":"FVPHYSICS_PLAYER_HELD","value":"4"},{"text":"This object was thrown by the Gravity Gun , stuns Antlion guards, Hunters, and squashes Antlion grubs.","key":"FVPHYSICS_WAS_THROWN","value":"256"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by Player:AddVCDSequenceToGestureSlot, Player:AnimResetGestureSlot and Player:AnimRestartGesture.","items":{"item":[{"text":"Slot for weapon gestures","key":"GESTURE_SLOT_ATTACK_AND_RELOAD","value":"0"},{"key":"GESTURE_SLOT_GRENADE","value":"1"},{"text":"Slot for jump gestures","key":"GESTURE_SLOT_JUMP","value":"2"},{"text":"Slot for swimming gestures","key":"GESTURE_SLOT_SWIM","value":"3"},{"text":"Slot for flinching gestures","key":"GESTURE_SLOT_FLINCH","value":"4"},{"key":"GESTURE_SLOT_VCD","value":"5"},{"text":"Slot for custom gestures","key":"GESTURE_SLOT_CUSTOM","value":"6"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Server","description":"Enumerations used by game.SetGlobalState and game.GetGlobalState.\n\nServerside only.","items":{"item":[{"text":"Initial state, the global state is off.","key":"GLOBAL_OFF","value":"0"},{"text":"The global state is enabled.","key":"GLOBAL_ON","value":"1"},{"text":"The global state is dead and is no longer active. It will be cleared.","key":"GLOBAL_DEAD","value":"2"}]}},"realms":["Server"],"type":"Enum"},
{"enum":{"realm":"Client","description":"Enumerations used by IGModAudioChannel:GetState. Clientside only.","items":{"item":[{"text":"The channel is stopped","key":"GMOD_CHANNEL_STOPPED","value":"0"},{"text":"The channel is playing","key":"GMOD_CHANNEL_PLAYING","value":"1"},{"text":"The channel is paused","key":"GMOD_CHANNEL_PAUSED","value":"2"},{"text":"The channel is buffering","key":"GMOD_CHANNEL_STALLED","value":"3"}]}},"realms":["Client"],"type":"Enum"},
{"enum":{"realm":"Server","added":"2021.10.04","description":{"text":"Used by NPC:GetCurGoalType.","warning":"These enumerations do not exist in game and are listed here only for reference"},"items":{"item":[{"text":"No goal type.","key":"GOALTYPE_NONE","value":"0"},{"text":"The goal type is an entity.","key":"GOALTYPE_TARGETENT","value":"1"},{"text":"The goal type is the enemy entity.","key":"GOALTYPE_ENEMY","value":"2"},{"text":"The goal type is a path corner.","key":"GOALTYPE_PATHCORNER","value":"3"},{"text":"The goal type is a position.","key":"GOALTYPE_LOCATION","value":"4"},{"text":"The goal type is a node nearest to a certain position.","key":"GOALTYPE_LOCATION_NEAREST_NODE","value":"5"},{"text":"Goal type is a flank location.","key":"GOALTYPE_FLANK","value":"6"},{"text":"Goal type is a cover spot.","key":"GOALTYPE_COVER","value":"7"},{"text":"Invalid goal type.","key":"GOALTYPE_INVALID","value":"8"}]}},"realms":["Server"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by GM:ScalePlayerDamage and GM:ScaleNPCDamage and returned by Player:LastHitGroup.","items":{"item":[{"text":"1:1 damage. Melee weapons and fall damage typically hit this hitgroup.\nThis hitgroup is not present on default player models.\n\nIt is unknown how this is generated in GM:ScalePlayerDamage, but it occurs when shot by NPCs ( npc_combine_s ) for example.","key":"HITGROUP_GENERIC","value":"0"},{"text":"Head","key":"HITGROUP_HEAD","value":"1"},{"text":"Chest","key":"HITGROUP_CHEST","value":"2"},{"text":"Stomach","key":"HITGROUP_STOMACH","value":"3"},{"text":"Left arm","key":"HITGROUP_LEFTARM","value":"4"},{"text":"Right arm","key":"HITGROUP_RIGHTARM","value":"5"},{"text":"Left leg","key":"HITGROUP_LEFTLEG","value":"6"},{"text":"Right leg","key":"HITGROUP_RIGHTLEG","value":"7"},{"text":"Gear. Supposed to be belt area.\n\nThis hitgroup is not present on default player models.\n\nAlerts NPC, but doesn't do damage or bleed (1/100th damage)","key":"HITGROUP_GEAR","value":"10"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by Player:PrintMessage and Global.PrintMessage.","items":{"item":[{"text":"No longer works; now same as HUD_PRINTCONSOLE","key":"HUD_PRINTNOTIFY","value":"1"},{"text":"Console","key":"HUD_PRINTCONSOLE","value":"2"},{"text":"Chat, also prints to console","key":"HUD_PRINTTALK","value":"3"},{"text":"Center of the screen, nothing on client","key":"HUD_PRINTCENTER","value":"4"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Server","description":"Enumerations used by NPC:SetHullType and  NPC:GetHullType. Serverside only.","items":{"item":[{"text":"Hull of a Citizen","key":"HULL_HUMAN","value":"0"},{"key":"HULL_SMALL_CENTERED","value":"1"},{"key":"HULL_WIDE_HUMAN","value":"2"},{"key":"HULL_TINY","value":"3"},{"key":"HULL_WIDE_SHORT","value":"4"},{"key":"HULL_MEDIUM","value":"5"},{"key":"HULL_TINY_CENTERED","value":"6"},{"key":"HULL_LARGE","value":"7"},{"key":"HULL_LARGE_CENTERED","value":"8"},{"key":"HULL_MEDIUM_TALL","value":"9"}]}},"realms":["Server"],"type":"Enum"},
{"text":"# Additional Values\n\nIn addition to the enum values listed above, there are several additional image formats that can be used to create Render Targets but **do not** have Lua variables defined for them.\n\nTo use these additional enums, use the numerical value directly.  \n(E.g. use `5` instead of `IMAGE_FORMAT_I8`)\n\nThe values below may not be an completely exhaustive list.  \nFor more information on these formats, see [VTF Enumerations.](https://developer.valvesoftware.com/wiki/Valve_Texture_Format#VTF_enumerations)\n\n## General\n\nThe following enum values are from the base Source Engine and do not have Lua variables defined for them simply because they are used less frequently than other formats.\n\n| Enum Name | Value | Description |\n| ---- | ----- | ----------- |\n| IMAGE_FORMAT_I8 | 5 | Grayscale format (black and white), 8 bits per pixel. |\n| IMAGE_FORMAT_IA88 | 6 | Grayscale format (black and white) with alpha support, 8 bits per pixel/channel. It have fallback to `D3DFMT_A8R8G8B8` for render targets. Can be used as `D3DFMT_A8L8` for `.vtf` textures. But it good works for DXVK Vulkan as `R8G8_UNORM`. |\n| IMAGE_FORMAT_A8 | 8 | 8 bit alpha. |\n| IMAGE_FORMAT_BGRX8888 | 16 | Same as `BGRA8888`, but 4th `X` channel is empty. |\n| IMAGE_FORMAT_BGR565 | 17 | `RGB565`, but reverse color order. |\n| IMAGE_FORMAT_BGRX5551 | 18 | 5 bits per RGB, 4th bit is empty. |\n| IMAGE_FORMAT_BGRA4444 | 19 | 4 bits per pixel. |\n| IMAGE_FORMAT_BGRA5551 | 21 | 5 bits per RGB, 1 bit alpha. |\n| IMAGE_FORMAT_R32F | 27 | Single color channel, 32bit float per pixel. |\n| IMAGE_FORMAT_RGBA32323232F | 29 | 32bit floating point RGBA. |\n| IMAGE_FORMAT_DXT1 | 13 | Compressed texture format. See https://en.wikipedia.org/wiki/S3_Texture_Compression. |\n| IMAGE_FORMAT_DXT3 | 14 | Compressed texture format. Do not use. See https://en.wikipedia.org/wiki/S3_Texture_Compression. |\n| IMAGE_FORMAT_DXT5 | 15 | Compressed texture format. Better quality than DXT1, supports alpha. See https://en.wikipedia.org/wiki/S3_Texture_Compression. |\n\n\n## Team Fortress 2\n\nThe following enum values are available on the `main` and `dev` branches and are originally from [Team Fortress 2's engine branch](https://developer.valvesoftware.com/wiki/Team_Fortress_2_engine_branch). \n\n| Enum Name | Value | Description |\n| ---- | ----- | ----------- |\n| IMAGE_FORMAT_NV_DST16 | 30 | Hardware 16 bit Depth texture format for shadow depth mapping.  Used in Global.ProjectedTexture. |\n| IMAGE_FORMAT_NV_DST24 | 31 | Hardware 24 bit Depth texture format for shadow depth mapping. |\n| IMAGE_FORMAT_NV_INTZ | 32 | Hardware depth format. Allow to read depth as color texture. See [D3D9 GPU Hacks](https://aras-p.info/texts/D3D9GPUHacks.html). |\n\n## Counter-Strike: Global Offensive\n\nThe following enum values are available on the `x86-64` branch and are originally from [Counter-Strike: Global Offensive's engine branch](https://developer.valvesoftware.com/wiki/Counter-Strike:_Global_Offensive_engine_branch)\n\n| Enum Name | Value | Description |\n| ---- | ----- | ----------- |\n| IMAGE_FORMAT_D16 | 39 | Hardware 16 bit Depth texture format for shadow depth mapping. |\n| IMAGE_FORMAT_D16_SHADOW | 47 | Hardware 16 bit Depth texture format for shadow depth mapping. Used in Global.ProjectedTexture. |\n| IMAGE_FORMAT_D24X8_SHADOW | 48 | Hardware Depth-stencil texture format for shadow depth mapping. 24 bit depth + 8 bit stencil. |\n| IMAGE_FORMAT_INTZ | 67 | Hardware depth format. Allow to read depth as color texture. See [D3D9 GPU Hacks](https://aras-p.info/texts/D3D9GPUHacks.html). |","enum":{"realm":"Client","description":"Enumerations used by Global.GetRenderTargetEx to determine the byte format of each pixel in the Render Target.","items":{"item":[{"key":"IMAGE_FORMAT_DEFAULT","value":"-1"},{"text":"Red, Green, Blue, Alpha, 8 bit per pixel.","key":"IMAGE_FORMAT_RGBA8888","value":"0"},{"text":"Probably legacy format. Alpha, Red, Green, Blue, 8 bit per pixel.","key":"IMAGE_FORMAT_ABGR8888","value":"1"},{"text":"Legacy format. Red, Green, Blue, 8 bit per pixel. `D3DFMT_R8G8B8` is invalid for most modern video cards. Thats why `IMAGE_FORMAT_RGB888` and `IMAGE_FORMAT_BGR888` is legacy formats. It have fallback to `IMAGE_FORMAT_BGRX8888`. `X` means «any».","key":"IMAGE_FORMAT_RGB888","value":"2"},{"text":"Legacy format. Blue, Green, Red order, 8 bit per pixel.","key":"IMAGE_FORMAT_BGR888","value":"3"},{"text":"Red, Green, Blue, 5 bit per pixel for Red and Blue channels, 6 bits for Green. Effectively uses less video memory.","key":"IMAGE_FORMAT_RGB565","value":"4"},{"text":"`IMAGE_FORMAT_RGBA8888` with different byte order. Legacy format.","key":"IMAGE_FORMAT_ARGB8888","value":"11"},{"text":"`IMAGE_FORMAT_RGBA8888` with different byte order. Legacy format.","key":"IMAGE_FORMAT_BGRA8888","value":"12"},{"text":"RGBA, but 16 bits per pixel. Was meant to be used for \"Integer mode\" for HDR.","key":"IMAGE_FORMAT_RGBA16161616","value":"25"},{"text":"RGBA, but floating point 16 bits per pixel. Is used for \"Float mode\" HDR.","key":"IMAGE_FORMAT_RGBA16161616F","value":"24"}]}},"realms":["Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Unlike Enums/BUTTON_CODE, these enums are abstracted to allow the user to bind actions to any key they might prefer.\n\nKeybinds using these actions work with two console commands, one starting with a plus and one with a minus symbol. A key press or release will call either the plus or minus command, adding or removing the corresponding enum in the current CUserCmd.\n\nEnumerations used by:\n* Player:KeyDown\n* Player:KeyDownLast\n* Player:KeyPressed\n* Player:KeyReleased\n* CMoveData:AddKey\n* CMoveData:GetButtons\n* CMoveData:GetOldButtons\n* CMoveData:KeyDown\n* CMoveData:KeyPressed\n* CMoveData:KeyReleased\n* CMoveData:KeyWasDown\n* CMoveData:SetButtons\n* CMoveData:SetOldButtons\n* CUserCmd:GetButtons\n* CUserCmd:KeyDown\n* CUserCmd:RemoveKey\n* CUserCmd:SetButtons\n* GM:KeyPress\n* GM:KeyRelease","items":{"item":[{"text":"+attack bound key ( Default: Left Mouse Button )","key":"IN_ATTACK","value":"1"},{"text":"+jump bound key ( Default: Space )","key":"IN_JUMP","value":"2"},{"text":"+duck bound key ( Default: CTRL )","key":"IN_DUCK","value":"4"},{"text":"+forward bound key ( Default: W )","key":"IN_FORWARD","value":"8"},{"text":"+back bound key ( Default: S )","key":"IN_BACK","value":"16"},{"text":"+use bound key ( Default: E )","key":"IN_USE","value":"32"},{"key":"IN_CANCEL","value":"64"},{"text":"+left bound key ( Look left )","key":"IN_LEFT","value":"128"},{"text":"+right bound key ( Look right )","key":"IN_RIGHT","value":"256"},{"text":"+moveleft bound key ( Default: A )","key":"IN_MOVELEFT","value":"512"},{"text":"+moveright bound key ( Default: D )","key":"IN_MOVERIGHT","value":"1024"},{"text":"+attack2 bound key ( Default: Right Mouse Button )","key":"IN_ATTACK2","value":"2048"},{"key":"IN_RUN","value":"4096"},{"text":"+reload bound key ( Default: R )","key":"IN_RELOAD","value":"8192"},{"text":"+alt1 bound key","key":"IN_ALT1","value":"16384"},{"text":"+alt2 bound key","key":"IN_ALT2","value":"32768"},{"text":"+showscores bound key ( Default: Tab )","key":"IN_SCORE","value":"65536"},{"text":"+speed bound key ( Default: Shift )","key":"IN_SPEED","value":"131072"},{"text":"+walk bound key ( Slow walk )","key":"IN_WALK","value":"262144"},{"text":"+zoom bound key ( Suit Zoom )","key":"IN_ZOOM","value":"524288"},{"text":"For use in weapons. Set in the physgun when scrolling an object away from you.","key":"IN_WEAPON1","value":"1048576"},{"text":"For use in weapons. Set in the physgun when scrolling an object towards you.","key":"IN_WEAPON2","value":"2097152"},{"key":"IN_BULLRUSH","value":"4194304"},{"text":"+grenade1 bound key","key":"IN_GRENADE1","value":"8388608"},{"text":"+grenade2 bound key","key":"IN_GRENADE2","value":"16777216"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared and Menu","description":"Enumerations used by input.IsButtonDown.\n\nIt's also part of the Enums/BUTTON_CODE.","items":{"item":[{"key":"JOYSTICK_FIRST","value":"114"},{"text":"Joystick buttons are in this range, but don't have individual enum names.","key":"JOYSTICK_FIRST_BUTTON","value":"114"},{"key":"JOYSTICK_LAST_BUTTON","value":"145"},{"text":"Joystick POV buttons are in this range, but don't have individual enum names.","key":"JOYSTICK_FIRST_POV_BUTTON","value":"146"},{"key":"JOYSTICK_LAST_POV_BUTTON","value":"149"},{"text":"Joystick axis buttons are in this range, but don't have individual enum names.","key":"JOYSTICK_FIRST_AXIS_BUTTON","value":"150"},{"key":"JOYSTICK_LAST_AXIS_BUTTON","value":"161"},{"key":"JOYSTICK_LAST","value":"161"}]},"fieldsonly":""},"example":{"description":"A button configuration for a wireless controller.","code":"local lx=input.GetAnalogValue(ANALOG_JOY_X) // Left X Axis: left -, right +\nlocal ly=input.GetAnalogValue(ANALOG_JOY_Y) // Left Y Axis: up -, bottom +\nlocal lr=input.GetAnalogValue(ANALOG_JOY_R) // Right X Axis: left -, right +\nlocal lu=input.GetAnalogValue(ANALOG_JOY_U) // Right Y Axis: up -, bottom +\n\nlx=lx/32768; ly=ly/32768; lr=lr/32768; lu=lu/32768; // Conversion to floats -1.0 - 1.0\n\nlocal jA=input.IsButtonDown(114); // A Button\nlocal jB=input.IsButtonDown(115); // B Button\nlocal jX=input.IsButtonDown(116); // X Button\nlocal jY=input.IsButtonDown(117); // Y button\nlocal jL1=input.IsButtonDown(118); // L1 button\nlocal jL2=input.IsButtonDown(119); // R1 button\nlocal jPL=input.IsButtonDown(120); // Pause left\nlocal jPR=input.IsButtonDown(121); // Pause Right\nlocal jLAPD=input.IsButtonDown(122); // Left Analog Press down\nlocal jRAPD=input.IsButtonDown(123); // Right Analog Press down\n\nlocal jUp=input.IsButtonDown(146); // PAD BUTTONS .....\nlocal jRight=input.IsButtonDown(147); // \nlocal jDown=input.IsButtonDown(148); // \nlocal jLeft=input.IsButtonDown(149); // \n\nlocal jLT=input.IsButtonDown(154); // Triggers \nlocal jRT=input.IsButtonDown(155); // \n\n// Obtain Mapping Enums //\n//for i=0,47 do\n//\tif(input.IsButtonDown(114+i)) then \n//\t\tprint((i+114)..\" TRUE\")\n//\telse \n//\t\n//\tend\n//end"},"realms":["Server","Client","Menu"],"type":"Enum"},
{"enum":{"realm":"Shared and Menu","description":"Enumerations used by:\n* input.IsKeyDown\n* input.WasKeyPressed\n* input.WasKeyReleased\n* input.WasKeyTyped\n* input.IsKeyTrapping\n* input.GetKeyName\n* input.LookupBinding\n* PANEL:OnKeyCodePressed\n* PANEL:OnKeyCodeReleased\n\nIt's also part of the Enums/BUTTON_CODE.","items":{"item":[{"key":"KEY_FIRST","value":"0"},{"key":"KEY_NONE","value":"0"},{"text":"Normal number 0 key","key":"KEY_0","value":"1"},{"text":"Normal number 1 key","key":"KEY_1","value":"2"},{"text":"Normal number 2 key","key":"KEY_2","value":"3"},{"text":"Normal number 3 key","key":"KEY_3","value":"4"},{"text":"Normal number 4 key","key":"KEY_4","value":"5"},{"text":"Normal number 5 key","key":"KEY_5","value":"6"},{"text":"Normal number 6 key","key":"KEY_6","value":"7"},{"text":"Normal number 7 key","key":"KEY_7","value":"8"},{"text":"Normal number 8 key","key":"KEY_8","value":"9"},{"text":"Normal number 9 key","key":"KEY_9","value":"10"},{"key":"KEY_A","value":"11"},{"key":"KEY_B","value":"12"},{"key":"KEY_C","value":"13"},{"key":"KEY_D","value":"14"},{"key":"KEY_E","value":"15"},{"key":"KEY_F","value":"16"},{"key":"KEY_G","value":"17"},{"key":"KEY_H","value":"18"},{"key":"KEY_I","value":"19"},{"key":"KEY_J","value":"20"},{"key":"KEY_K","value":"21"},{"key":"KEY_L","value":"22"},{"key":"KEY_M","value":"23"},{"key":"KEY_N","value":"24"},{"key":"KEY_O","value":"25"},{"key":"KEY_P","value":"26"},{"key":"KEY_Q","value":"27"},{"key":"KEY_R","value":"28"},{"key":"KEY_S","value":"29"},{"key":"KEY_T","value":"30"},{"key":"KEY_U","value":"31"},{"key":"KEY_V","value":"32"},{"key":"KEY_W","value":"33"},{"key":"KEY_X","value":"34"},{"key":"KEY_Y","value":"35"},{"key":"KEY_Z","value":"36"},{"text":"Keypad number 0 key","key":"KEY_PAD_0","value":"37"},{"text":"Keypad number 1 key","key":"KEY_PAD_1","value":"38"},{"text":"Keypad number 2 key","key":"KEY_PAD_2","value":"39"},{"text":"Keypad number 3 key","key":"KEY_PAD_3","value":"40"},{"text":"Keypad number 4 key","key":"KEY_PAD_4","value":"41"},{"text":"Keypad number 5 key","key":"KEY_PAD_5","value":"42"},{"text":"Keypad number 6 key","key":"KEY_PAD_6","value":"43"},{"text":"Keypad number 7 key","key":"KEY_PAD_7","value":"44"},{"text":"Keypad number 8 key","key":"KEY_PAD_8","value":"45"},{"text":"Keypad number 9 key","key":"KEY_PAD_9","value":"46"},{"text":"Keypad division/slash key (/)","key":"KEY_PAD_DIVIDE","value":"47"},{"text":"Keypad asterisk key (*)","key":"KEY_PAD_MULTIPLY","value":"48"},{"text":"Keypad minus key","key":"KEY_PAD_MINUS","value":"49"},{"text":"Keypad plus key","key":"KEY_PAD_PLUS","value":"50"},{"text":"Keypad enter key","key":"KEY_PAD_ENTER","value":"51"},{"text":"Keypad dot key (.)","key":"KEY_PAD_DECIMAL","value":"52"},{"key":"KEY_LBRACKET","value":"53"},{"key":"KEY_RBRACKET","value":"54"},{"key":"KEY_SEMICOLON","value":"55"},{"key":"KEY_APOSTROPHE","value":"56"},{"key":"KEY_BACKQUOTE","value":"57"},{"key":"KEY_COMMA","value":"58"},{"key":"KEY_PERIOD","value":"59"},{"key":"KEY_SLASH","value":"60"},{"key":"KEY_BACKSLASH","value":"61"},{"key":"KEY_MINUS","value":"62"},{"key":"KEY_EQUAL","value":"63"},{"key":"KEY_ENTER","value":"64"},{"key":"KEY_SPACE","value":"65"},{"key":"KEY_BACKSPACE","value":"66"},{"key":"KEY_TAB","value":"67"},{"key":"KEY_CAPSLOCK","value":"68"},{"key":"KEY_NUMLOCK","value":"69"},{"key":"KEY_ESCAPE","value":"70"},{"key":"KEY_SCROLLLOCK","value":"71"},{"key":"KEY_INSERT","value":"72"},{"key":"KEY_DELETE","value":"73"},{"key":"KEY_HOME","value":"74"},{"key":"KEY_END","value":"75"},{"key":"KEY_PAGEUP","value":"76"},{"key":"KEY_PAGEDOWN","value":"77"},{"key":"KEY_BREAK","value":"78"},{"text":"The left Shift key, has been seen to be triggered by Right Shift in PANEL:OnKeyCodePressed","key":"KEY_LSHIFT","value":"79"},{"key":"KEY_RSHIFT","value":"80"},{"key":"KEY_LALT","value":"81"},{"key":"KEY_RALT","value":"82"},{"key":"KEY_LCONTROL","value":"83"},{"key":"KEY_RCONTROL","value":"84"},{"text":"The left Windows key or the Command key on Mac OSX","key":"KEY_LWIN","value":"85"},{"text":"The right Windows key or the Command key on Mac OSX","key":"KEY_RWIN","value":"86"},{"key":"KEY_APP","value":"87"},{"key":"KEY_UP","value":"88"},{"key":"KEY_LEFT","value":"89"},{"key":"KEY_DOWN","value":"90"},{"key":"KEY_RIGHT","value":"91"},{"key":"KEY_F1","value":"92"},{"key":"KEY_F2","value":"93"},{"key":"KEY_F3","value":"94"},{"key":"KEY_F4","value":"95"},{"key":"KEY_F5","value":"96"},{"key":"KEY_F6","value":"97"},{"key":"KEY_F7","value":"98"},{"key":"KEY_F8","value":"99","warning":"By default, it serves as bind \"load quick\", which loads the save by forcing the player to exit the server."},{"key":"KEY_F9","value":"100"},{"key":"KEY_F10","value":"101"},{"key":"KEY_F11","value":"102"},{"key":"KEY_F12","value":"103"},{"key":"KEY_CAPSLOCKTOGGLE","value":"104"},{"key":"KEY_NUMLOCKTOGGLE","value":"105"},{"key":"KEY_LAST","value":"106"},{"key":"KEY_SCROLLLOCKTOGGLE","value":"106"},{"key":"KEY_COUNT","value":"107"},{"key":"KEY_XBUTTON_A","value":"114"},{"key":"KEY_XBUTTON_B","value":"115"},{"key":"KEY_XBUTTON_X","value":"116"},{"key":"KEY_XBUTTON_Y","value":"117"},{"key":"KEY_XBUTTON_LEFT_SHOULDER","value":"118"},{"key":"KEY_XBUTTON_RIGHT_SHOULDER","value":"119"},{"key":"KEY_XBUTTON_BACK","value":"120"},{"key":"KEY_XBUTTON_START","value":"121"},{"key":"KEY_XBUTTON_STICK1","value":"122"},{"key":"KEY_XBUTTON_STICK2","value":"123"},{"key":"KEY_XBUTTON_UP","value":"146"},{"key":"KEY_XBUTTON_RIGHT","value":"147"},{"key":"KEY_XBUTTON_DOWN","value":"148"},{"key":"KEY_XBUTTON_LEFT","value":"149"},{"key":"KEY_XSTICK1_RIGHT","value":"150"},{"key":"KEY_XSTICK1_LEFT","value":"151"},{"key":"KEY_XSTICK1_DOWN","value":"152"},{"key":"KEY_XSTICK1_UP","value":"153"},{"key":"KEY_XBUTTON_LTRIGGER","value":"154"},{"key":"KEY_XBUTTON_RTRIGGER","value":"155"},{"key":"KEY_XSTICK2_RIGHT","value":"156"},{"key":"KEY_XSTICK2_LEFT","value":"157"},{"key":"KEY_XSTICK2_DOWN","value":"158"},{"key":"KEY_XSTICK2_UP","value":"159"}]},"fieldsonly":""},"realms":["Server","Client","Menu"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Used by Entity:SetRenderFX and returned by Entity:GetRenderFX.\n\nMost of these require alpha value of entitys color to be less than 255 to have any visible effect.","items":{"item":[{"text":"None. No change.","key":"kRenderFxNone","value":"0"},{"text":"Slowly pulses the entitys transparency, +-15 to the current alpha.","key":"kRenderFxPulseSlow","value":"1"},{"text":"Quickly pulses the entitys transparency, +-15 to the current alpha.","key":"kRenderFxPulseFast","value":"2"},{"text":"Slowly pulses the entitys transparency, +-60 to the current alpha.","key":"kRenderFxPulseSlowWide","value":"3"},{"text":"Quickly pulses the entitys transparency, +-60 to the current alpha.","key":"kRenderFxPulseFastWide","value":"4"},{"text":"Slowly fades away the entity, making it completely invisible over 3 seconds.\n\nStarts from whatever alpha the entity currently has set.","key":"kRenderFxFadeSlow","value":"5"},{"text":"Quickly fades away the entity, making it completely invisible.\n\nStarts from whatever alpha the entity currently has set.","key":"kRenderFxFadeFast","value":"6"},{"text":"Slowly solidifies the entity, making it fully opaque.\n\nStarts from whatever alpha the entity currently has set.","key":"kRenderFxSolidSlow","value":"7"},{"text":"Quickly solidifies the entity, making it fully opaque.\n\nStarts from whatever alpha the entity currently has set.","key":"kRenderFxSolidFast","value":"8"},{"text":"Slowly switches the entitys transparency between its alpha and 0.","key":"kRenderFxStrobeSlow","value":"9"},{"text":"Quickly switches the entitys transparency between its alpha and 0.","key":"kRenderFxStrobeFast","value":"10"},{"text":"Very quickly switches the entitys transparency between its alpha and 0.","key":"kRenderFxStrobeFaster","value":"11"},{"text":"Same as Strobe Slow, but the interval is more randomized.","key":"kRenderFxFlickerSlow","value":"12"},{"text":"Same as Strobe Fast, but the interval is more randomized.","key":"kRenderFxFlickerFast","value":"13"},{"key":"kRenderFxNoDissipation","value":"14"},{"text":"Flickers ( randomizes ) the entitys transparency","key":"kRenderFxDistort","value":"15"},{"text":"Same as Distort, but fades the entity away the farther you are from it.","key":"kRenderFxHologram","value":"16"},{"key":"kRenderFxExplode","value":"17"},{"key":"kRenderFxGlowShell","value":"18"},{"key":"kRenderFxClampMinScale","value":"19"},{"key":"kRenderFxEnvRain","value":"20"},{"key":"kRenderFxEnvSnow","value":"21"},{"key":"kRenderFxSpotlight","value":"22"},{"text":"Is ragdoll, can be set to force an entity to create a clientside ragdoll.","key":"kRenderFxRagdoll","value":"23"},{"text":"Quickly pulses the entitys transparency, from 0 to 255.","key":"kRenderFxPulseFastWider","value":"24"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used as trace masks in Structures/Trace and Structures/HullTrace. These enumerations are simply combinations of Enums/CONTENTS.","items":{"item":[{"text":"Anything that is not empty space","key":"MASK_ALL","value":"4294967295"},{"text":"Anything that blocks line of sight for AI","key":"MASK_BLOCKLOS","value":"16449"},{"text":"Anything that blocks line of sight for AI or NPCs","key":"MASK_BLOCKLOS_AND_NPCS","value":"33570881"},{"text":"Water that is moving (may not work)","key":"MASK_CURRENT","value":"16515072"},{"text":"Anything that blocks corpse movement","key":"MASK_DEADSOLID","value":"65547"},{"text":"Anything that blocks NPC movement","key":"MASK_NPCSOLID","value":"33701899"},{"text":"Anything that blocks NPC movement, except other NPCs","key":"MASK_NPCSOLID_BRUSHONLY","value":"147467"},{"text":"The world entity","key":"MASK_NPCWORLDSTATIC","value":"131083"},{"text":"Anything that blocks lighting","key":"MASK_OPAQUE","value":"16513"},{"text":"Anything that blocks lighting, including NPCs","key":"MASK_OPAQUE_AND_NPCS","value":"33570945"},{"text":"Anything that blocks player movement","key":"MASK_PLAYERSOLID","value":"33636363"},{"text":"World + Brushes + Player Clips","key":"MASK_PLAYERSOLID_BRUSHONLY","value":"81931"},{"text":"Anything that stops a bullet (including hitboxes)","key":"MASK_SHOT","value":"1174421507"},{"text":"Anything that stops a bullet (excluding hitboxes)","key":"MASK_SHOT_HULL","value":"100679691"},{"text":"Solids except for grates","key":"MASK_SHOT_PORTAL","value":"33570819"},{"text":"Anything that is (normally) solid","key":"MASK_SOLID","value":"33570827"},{"text":"World + Brushes","key":"MASK_SOLID_BRUSHONLY","value":"16395"},{"text":"Things that split area portals","key":"MASK_SPLITAREAPORTAL","value":"48"},{"text":"Anything that blocks line of sight for players","key":"MASK_VISIBLE","value":"24705"},{"text":"Anything that blocks line of sight for players, including NPCs","key":"MASK_VISIBLE_AND_NPCS","value":"33579137"},{"text":"Anything that has water-like physics","key":"MASK_WATER","value":"16432"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":{"text":"Enumerations used in Structures/TraceResult and Structures/SurfacePropertyData, and by Entity:GetMaterialType.","note":"These aren't VMT materials!\n\n[Material types](https://developer.valvesoftware.com/wiki/Material_Types) are a [holdover from GoldSrc](https://developer.valvesoftware.com/wiki/Material_surface_properties) and Quake before it. They were previously used to classify textures and entities into categories, defining their physical properties. In practice, this really only changed impact sounds and effects, and player footstep sounds. For example, `func_breakable` (in GoldSrc) used it to select which gibs to spawn when broken. Raw texture files were given these properties by assigning them to a material. These were tracked in the single file `materials.txt`, which contained mappings of material types to texture names. Materials are indexed using a letter—for example `MAT_METAL` was indexed in `materials.txt` with the letter \"M\". The value of `MAT_METAL` is 77, because the ASCII value for M is 77. Some entities could also be assigned materials directly in their keyvalues using the same system.\n\nIn Source, materials were moved out of the single `materials.txt` file; now every texture has its own associated material file, called [VMT](https://developer.valvesoftware.com/wiki/VMT) (**V**alve **M**aterial **T**ype). VMTs contain all the information legacy materials used to provide and more, including including shader, transparency, physical properties, animations...\n\nRather than place the properties directly inside the VMT (which would prevent them from being assigned directly to entities like legacy materials could), surface properties were added, which can be selected in the VMT using the `$surfaceprop` key. Surface properties are what determine impact sounds, buoyancy, friction, and other such properties. These do not use letters as identifiers and instead use string names. You can view the surface properties Garry's Mod loads by looking in the [`GarrysMod/sourceengine/scripts/surfaceproperties.txt`](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/scripts/surfaceproperties.txt) file.\n\nHowever, legacy materials still exist in Source. They are called game materials or material types to separate them from the new material system where confusion between the two is a concern. For example, surface property definitions contain a `gamematerial` parameter; this field assigns a legacy game material to a surface property, which is then assigned to VMTs and entities.\n\nThe main thing legacy game materials are used for nowadays are picking impact effects and decals, like in GoldSrc. Otherwise, surface properties and VMTs replace most other functionality."},"items":{"item":[{"text":"Antlions","key":"MAT_ANTLION","value":"65"},{"text":"Similar to MAT_FLESH, only used by \"bloodyflesh\" surface property, has different impact sound","key":"MAT_BLOODYFLESH","value":"66"},{"text":"Concrete","key":"MAT_CONCRETE","value":"67"},{"text":"Dirt","key":"MAT_DIRT","value":"68"},{"text":"The egg sacs in the antlion tunnels in HL2: EP2","key":"MAT_EGGSHELL","value":"69"},{"text":"Flesh","key":"MAT_FLESH","value":"70"},{"text":"Grates, chainlink fences","key":"MAT_GRATE","value":"71"},{"text":"Alien flesh - headcrabs and vortigaunts","key":"MAT_ALIENFLESH","value":"72"},{"text":"Unused","key":"MAT_CLIP","value":"73"},{"text":"Snow","key":"MAT_SNOW","value":"74"},{"text":"Plastic","key":"MAT_PLASTIC","value":"76"},{"text":"Metal","key":"MAT_METAL","value":"77"},{"text":"Sand","key":"MAT_SAND","value":"78"},{"text":"Plants, only used by the \"foliage\" surface property","key":"MAT_FOLIAGE","value":"79"},{"text":"Electronics, only used by \"computer\" surface property","key":"MAT_COMPUTER","value":"80"},{"text":"Water, slime","key":"MAT_SLOSH","value":"83"},{"text":"Floor tiles","key":"MAT_TILE","value":"84"},{"text":"Grass","key":"MAT_GRASS","value":"85"},{"text":"Metallic vents","key":"MAT_VENT","value":"86"},{"text":"Wood","key":"MAT_WOOD","value":"87"},{"text":"Skybox or nodraw texture","key":"MAT_DEFAULT","value":"88"},{"text":"Glass","key":"MAT_GLASS","value":"89"},{"text":"\"wierd-looking jello effect for advisor shield.\"","key":"MAT_WARPSHIELD","value":"90"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Client","description":"Enumerations used by mesh.Begin to control what type of vertex information it should expect. Clientside only.\n\n\t\tFor more information, see the Mesh Primitives reference page.","items":{"item":[{"text":"For more information, see Point Primitives","key":"MATERIAL_POINTS","value":"0","warning":"The primitive type `MATERIAL_POINTS` does not currently work and will not produce any visual effect if used."},{"text":"For more information, see Line Primitives","key":"MATERIAL_LINES","value":"1","warning":"The primitive type `MATERIAL_LINES` does not currently work and will not produce any visual effect if used."},{"text":"Creates triangles from groupings of 3 vertices.  \n\t\t\t\n\t\t\tTThe `primitiveCount` argument of mesh.Begin should be the total number of triangles that the Mesh will contain.  \nE.g. `(vertexCount / 3)`\n\n\t\t\tFor more information, see Triangle Primitives","key":"MATERIAL_TRIANGLES","value":"2"},{"text":"Creates a set of triangles that each share two vertices with the previous triangle in the sequence.\n\n\t\t\tThe `primitiveCount` argument of mesh.Begin should be the total number of triangles that the Mesh will contain.  \n\t\t\tE.g. `(vertexCount - 2)`\n\n\t\t\tFor more information, see Triangle Strip Primitives","key":"MATERIAL_TRIANGLE_STRIP","value":"3"},{"text":"For more information, see Line Strip Primitives","key":"MATERIAL_LINE_STRIP","value":"4","warning":"The primitive type `MATERIAL_LINE_STRIP` does not currently work and will not produce any visual effect if used."},{"text":"For more information, see Line Loop Primitives","key":"MATERIAL_LINE_LOOP","value":"5","warning":"The primitive type `MATERIAL_LINE_LOOP` does not currently work and will not produce any visual effect if used."},{"text":"Creates a set of triangles that all share a single vertex and each share a vertex with the previous triangle.\n\n\t\t\tThe `primitiveCount` argument of mesh.Begin should be the total number of vertices that the Mesh will contain.  \n\t\t\tE.g. `(vertexCount)`\n\n\t\t\tFor more information, see Polygon Primitives","key":"MATERIAL_POLYGON","value":"6"},{"text":"Creates pairs of triangles that share two vertices.\n\n\t\t\tThe `primitiveCount` argument of mesh.Begin should be the total number of quads that the Mesh will contain.  \n\t\t\tE.g. `(vertexCount / 4)`\n\n\t\t\tFor more information, see Quad Primitives","key":"MATERIAL_QUADS","value":"7"}]}},"realms":["Client"],"type":"Enum"},
{"enum":{"realm":"Client","description":"Enumerations used by render.CullMode. Clientside only.","items":{"item":[{"text":"Cull back faces with counterclockwise vertices.","key":"MATERIAL_CULLMODE_CCW","value":"0"},{"text":"Cull back faces with clockwise vertices.","key":"MATERIAL_CULLMODE_CW","value":"1"},{"text":"Do not cull back faces at all.","key":"MATERIAL_CULLMODE_NONE","value":"2","added":"2025.09.23"}]}},"realms":["Client"],"type":"Enum"},
{"enum":{"realm":"Client","description":"Enumerations used by render.GetFogMode and render.FogMode. Clientside only.","items":{"item":[{"text":"No fog","key":"MATERIAL_FOG_NONE","value":"0"},{"text":"Linear fog","key":"MATERIAL_FOG_LINEAR","value":"1"},{"text":"For use in conjunction with render.SetFogZ. Does not work if start distance is bigger than end distance. Ignores density setting. Seems to be broken? Used for underwater fog by the engine.","key":"MATERIAL_FOG_LINEAR_BELOW_FOG_Z","value":"2"}]}},"realms":["Client"],"type":"Enum"},
{"enum":{"realm":"Client","description":"Enumerations used by render.SetLocalModelLights. Clientside only.","items":{"item":[{"text":"No light","key":"MATERIAL_LIGHT_DISABLE","value":"0"},{"text":"Point light","key":"MATERIAL_LIGHT_POINT","value":"1"},{"text":"Directional light","key":"MATERIAL_LIGHT_DIRECTIONAL","value":"2"},{"text":"Spot light","key":"MATERIAL_LIGHT_SPOT","value":"3"}]}},"realms":["Client"],"type":"Enum"},
{"enum":{"realm":"Client","description":{"text":"Enumerations used by Global.GetRenderTargetEx. Clientside only.","warning":"When Anti Aliasing is enabled then `MATERIAL_RT_DEPTH_SHARED` and `MATERIAL_RT_DEPTH_SEPARATE` will always create a new depth-stencil buffer because Render Targets do not have Anti Aliasing."},"items":{"item":[{"text":"Do not create a depth-stencil buffer.\nUse the default depth-stencil buffer if used as render target 0.","key":"MATERIAL_RT_DEPTH_SHARED","value":"0"},{"text":"Create a depth-stencil buffer.\nUse the created depth-stencil buffer if used as render target 0.","key":"MATERIAL_RT_DEPTH_SEPARATE","value":"1"},{"text":"Do not create a depth-stencil buffer.\nDisable depth and stencil buffer usage if used as render target 0.","key":"MATERIAL_RT_DEPTH_NONE","value":"2"},{"text":"Create a depth-stencil buffer.\nUse the created depth-stencil buffer if used as render target 0.\n\nCreates a color texture despite the name.\n\nSeems to behave the same as MATERIAL_RT_DEPTH_SEPARATE.","key":"MATERIAL_RT_DEPTH_ONLY","value":"3"}]}},"realms":["Client"],"type":"Enum"},
{"enum":{"realm":"Shared and Menu","description":"Enumerations used by:\n* input.IsMouseDown\n* input.WasMousePressed\n* input.WasMouseDoublePressed\n\nIt's also part of the Enums/BUTTON_CODE.\n# Catch mouse wheel\nYou can catch the mouse wheel's value by:\n```\nlocal testVal = 0\nhook.Add(\"InputMouseApply\", \"testMouseWheel\", function(cmd, x, y, ang)\n    testVal = testVal + cmd:GetMouseWheel() * 2 --any scale number you want to use\n    print(testVal)\nend)\n```","items":{"item":[{"text":"First mouse button","key":"MOUSE_FIRST","value":"107"},{"text":"Left mouse button","key":"MOUSE_LEFT","value":"107"},{"text":"Right mouse button","key":"MOUSE_RIGHT","value":"108"},{"text":"Middle mouse button, aka the wheel press","key":"MOUSE_MIDDLE","value":"109"},{"text":"Mouse 4 button ( Sometimes, mouse wheel tilt left )","key":"MOUSE_4","value":"110"},{"text":"Mouse 5 button ( Sometimes, mouse wheel tilt right )","key":"MOUSE_5","value":"111"},{"text":"Mouse wheel scroll up","key":"MOUSE_WHEEL_UP","value":"112"},{"text":"Mouse wheel scroll down","key":"MOUSE_WHEEL_DOWN","value":"113"},{"text":"Last mouse button","key":"MOUSE_LAST","value":"113"},{"text":"Mouse button count","key":"MOUSE_COUNT","value":"7"}]},"fieldsonly":""},"realms":["Server","Client","Menu"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by Entity:SetMoveCollide and Entity:GetMoveCollide.","items":{"item":[{"text":"Default behavior","key":"MOVECOLLIDE_DEFAULT","value":"0"},{"text":"Entity bounces, reflects, based on elasticity of surface and object - applies friction (adjust velocity)","key":"MOVECOLLIDE_FLY_BOUNCE","value":"1"},{"text":"ENTITY:ResolveCustomFlyCollision will modify the velocity however it likes","key":"MOVECOLLIDE_FLY_CUSTOM","value":"2"},{"text":"Entity slides along surfaces (no bounce) - applies friciton (adjusts velocity)","key":"MOVECOLLIDE_FLY_SLIDE","value":"3"},{"text":"Number of different movecollides","key":"MOVECOLLIDE_COUNT","value":"4"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by Entity:SetMoveType and Entity:GetMoveType.","items":{"item":[{"text":"Don't move","key":"MOVETYPE_NONE","value":"0"},{"text":"For players, in TF2 commander view, etc","key":"MOVETYPE_ISOMETRIC","value":"1"},{"text":"Player only, moving on the ground","key":"MOVETYPE_WALK","value":"2"},{"text":"Monster/NPC movement","key":"MOVETYPE_STEP","value":"3"},{"text":"Fly, no gravity","key":"MOVETYPE_FLY","value":"4"},{"text":"Fly, with gravity","key":"MOVETYPE_FLYGRAVITY","value":"5"},{"text":"Physics movetype","key":"MOVETYPE_VPHYSICS","value":"6"},{"text":"Doesn't collide with the world, but does push and crush entities.  \n\tThis is what is used by the engine for elevators, trains, doors, moving water, etc.\n\n\tIn order to work properly, the entity needs to have specific Save Values/Internal Variables set which tell it how long it should be moving for.\n\t\n\t**Note:** This same process can be done for both position and angle.\n\n\t1. You'll need to Get an existing Save Value called `ltime`  \n\t2. Calculate how long (in seconds) the entity will be moving before it reaches its destination.  \n\tAs a simple example, this can be done via `duration = distance / speed`  \n\t3. Set the Save Value for `m_flMoveDoneTime` to the value you retrieved for `ltime` plus the duration calculated in step 2.  \n\tPut more simply: `m_flMoveDoneTime = ltime + duration`  \n\t4. Set the entity's velocity to move it to the destination at the speed used in step 2.\n\n\tOnce the duration of the move has elapsed, the entity will stop moving.  If you have done your calculations correctly, it should stop exactly at the desired destination.","key":"MOVETYPE_PUSH","value":"7","note":"MOVETYPE_PUSH entities only move during Entity:Think so if you want smooth movement, you need to set Entity:NextThink to Global.CurTime, which instructs the entity to execute Entity:Think as quickly as possible."},{"text":"Noclip","key":"MOVETYPE_NOCLIP","value":"8"},{"text":"For players, when moving on a ladder","key":"MOVETYPE_LADDER","value":"9"},{"text":"Spectator movetype. DO **NOT** use this to make player spectate","key":"MOVETYPE_OBSERVER","value":"10"},{"text":"Custom movetype, can be applied to the player to prevent the default movement code from running, while still calling the related hooks","key":"MOVETYPE_CUSTOM","value":"11"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Server","added":"2021.03.31","description":"Used by NPC:SetNavType and NPC:GetNavType.","items":{"item":[{"text":"Error condition.","key":"NAV_NONE","value":"-1"},{"text":"walk/run","key":"NAV_GROUND","value":"0"},{"text":"jump/leap","key":"NAV_JUMP","value":"1"},{"text":"can fly, move all around","key":"NAV_FLY","value":"2"},{"text":"climb ladders","key":"NAV_CLIMB","value":"3"}]}},"realms":["Server"],"type":"Enum"},
{"enum":{"realm":"Server","description":"Enumerations used by CNavArea:GetAttributes and CNavArea:HasAttributes.","items":{"item":[{"text":"The nav area is invalid.","key":"NAV_MESH_INVALID","value":"0"},{"text":"Must crouch to use this node/area","key":"NAV_MESH_CROUCH","value":"1"},{"text":"Must jump to traverse this area (only used during generation)","key":"NAV_MESH_JUMP","value":"2"},{"text":"Do not adjust for obstacles, just move along area","key":"NAV_MESH_PRECISE","value":"4"},{"text":"Inhibit discontinuity jumping","key":"NAV_MESH_NO_JUMP","value":"8"},{"text":"Must stop when entering this area","key":"NAV_MESH_STOP","value":"16"},{"text":"Must run to traverse this area","key":"NAV_MESH_RUN","value":"32"},{"text":"Must walk to traverse this area","key":"NAV_MESH_WALK","value":"64"},{"text":"Avoid this area unless alternatives are too dangerous","key":"NAV_MESH_AVOID","value":"128"},{"text":"Area may become blocked, and should be periodically checked","key":"NAV_MESH_TRANSIENT","value":"256"},{"text":"Area should not be considered for hiding spot generation","key":"NAV_MESH_DONT_HIDE","value":"512"},{"text":"Bots hiding in this area should stand","key":"NAV_MESH_STAND","value":"1024"},{"text":"Hostages shouldn't use this area","key":"NAV_MESH_NO_HOSTAGES","value":"2048"},{"text":"This area represents stairs, do not attempt to climb or jump them - just walk up","key":"NAV_MESH_STAIRS","value":"4096"},{"text":"Don't merge this area with adjacent areas","key":"NAV_MESH_NO_MERGE","value":"8192"},{"text":"This nav area is the climb point on the tip of an obstacle","key":"NAV_MESH_OBSTACLE_TOP","value":"16384"},{"text":"This nav area is adjacent to a drop of at least `CliffHeight` (300 hammer units). Unused by base game.","key":"NAV_MESH_CLIFF","value":"32768"},{"text":"Whether the area is blocked via CNavArea:MarkAsBlocked.","key":"NAV_MESH_BLOCKED_LUA","value":"65536"},{"text":"Whether the area has a `prop_door_rotating` that is blocking it (because the door is closed)","key":"NAV_MESH_BLOCKED_PROPDOOR","value":"268435456"},{"text":"Area has designer specified cost controlled by `func_nav_cost` entities","key":"NAV_MESH_FUNC_COST","value":"536870912"},{"text":"Area is in an elevator's path","key":"NAV_MESH_HAS_ELEVATOR","value":"1073741824"},{"text":"Whether the area is blocked by a `func_nav_blocker` entity and is impassible.","key":"NAV_MESH_NAV_BLOCKER","value":"-2147483648"}]}},"realms":["Server"],"type":"Enum"},
{"enum":{"realm":"Server","description":{"text":"Enumerations used by CNavArea methods.\nThese Enums correspond to each corner of a CNavArea","warning":"These enumerations do not exist in game and are listed here only for reference"},"items":{"item":[{"text":"North West Corner","key":"NORTH_WEST","value":"0"},{"text":"North East Corner","key":"NORTH_EAST","value":"1"},{"text":"South East Corner","key":"SOUTH_EAST","value":"2"},{"text":"South West Corner","key":"SOUTH_WEST","value":"3"},{"text":"Represents all corners, only applicable to certain functions, such as CNavArea:PlaceOnGround.","key":"NUM_CORNERS","value":"4"}]}},"realms":["Server"],"type":"Enum"},
{"enum":{"realm":"Server","description":{"text":"Enumerations used by CNavArea methods.\nThese Enums correspond to each side of a CNavArea","warning":"These enumerations do not exist in game and are listed here only for reference"},"items":{"item":[{"text":"North from given CNavArea","key":"NORTH","value":"0"},{"text":"East from given CNavArea","key":"EAST","value":"1"},{"text":"South from given CNavArea","key":"SOUTH","value":"2"},{"text":"West from given CNavArea","key":"WEST","value":"3"}]}},"realms":["Server"],"type":"Enum"},
{"enum":{"realm":"Server","description":{"text":"Enumerations used by CNavArea:GetParentHow.","warning":"These enumerations do not exist in game and are listed here only for reference"},"items":{"item":[{"key":"GO_NORTH","value":"0"},{"key":"GO_EAST","value":"1"},{"key":"GO_SOUTH","value":"2"},{"key":"GO_WEST","value":"3"},{"key":"GO_LADDER_UP","value":"4"},{"key":"GO_LADDER_DOWN","value":"5"},{"key":"GO_JUMP","value":"6"},{"key":"GO_ELEVATOR_UP","value":"7"},{"key":"GO_ELEVATOR_DOWN","value":"8"}]}},"realms":["Server"],"type":"Enum"},
{"enum":{"realm":"Client and Menu","description":"Enumerations used by notification.AddLegacy. Clientside only.","items":{"item":[{"text":"Generic notification","key":"NOTIFY_GENERIC","value":"0","image":{"src":"NOTIFY_GENERIC_PREVIEW.png","alt":"middle"}},{"text":"Error notification","key":"NOTIFY_ERROR","value":"1","image":{"src":"NOTIFY_ERROR_PREVIEW.png","alt":"middle"}},{"text":"Undo notification","key":"NOTIFY_UNDO","value":"2","image":{"src":"NOTIFY_UNDO_PREVIEW.png","alt":"middle"}},{"text":"Hint notification","key":"NOTIFY_HINT","value":"3","image":{"src":"NOTIFY_HINT_PREVIEW.png","alt":"middle"}},{"text":"Cleanup notification","key":"NOTIFY_CLEANUP","value":"4","image":{"src":"NOTIFY_CLEANUP_PREVIEW.png","alt":"middle"}}]}},"realms":["Client","Menu"],"type":"Enum"},
{"enum":{"realm":"Server","description":"Enumerations used by NPC:SetNPCState. Serverside only.","items":{"item":[{"text":"Invalid state","key":"NPC_STATE_INVALID","value":"-1"},{"text":"NPC default state","key":"NPC_STATE_NONE","value":"0"},{"text":"NPC is idle","key":"NPC_STATE_IDLE","value":"1"},{"text":"NPC is alert and searching for enemies","key":"NPC_STATE_ALERT","value":"2"},{"text":"NPC is in combat","key":"NPC_STATE_COMBAT","value":"3"},{"text":"NPC is executing scripted sequence","key":"NPC_STATE_SCRIPT","value":"4"},{"text":"NPC is playing dead (used for expressions)","key":"NPC_STATE_PLAYDEAD","value":"5"},{"text":"NPC is prone to death","key":"NPC_STATE_PRONE","value":"6"},{"text":"NPC is dead","key":"NPC_STATE_DEAD","value":"7"}]}},"realms":["Server"],"type":"Enum"},
{"enum":{"realm":"Server","description":"Various count enums.","items":{"item":[{"text":"Amount of Enums/CLASS. Used by Global.Add_NPC_Class.","key":"NUM_AI_CLASSES","value":"36"},{"text":"Amount of Enums/HULL.","key":"NUM_HULLS","value":"10"}]}},"realms":["Server"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by Player:SetObserverMode, Player:GetObserverMode and Player:Spectate.","items":{"item":[{"text":"Not spectating","key":"OBS_MODE_NONE","value":"0"},{"text":"Camera doesn't move, but adjusts camera angles to follow the spectated target","key":"OBS_MODE_DEATHCAM","value":"1"},{"text":"TF2-like freeze-cam, then acts like `OBS_MODE_FIXED`.","key":"OBS_MODE_FREEZECAM","value":"2"},{"text":"Same as OBS_MODE_CHASE, but you can't rotate the view","key":"OBS_MODE_FIXED","value":"3"},{"text":"Spectate a specific player from first person view.","key":"OBS_MODE_IN_EYE","value":"4"},{"text":"Chase cam, 3rd person cam, free rotation around the spectated target","key":"OBS_MODE_CHASE","value":"5"},{"text":"Free roam/noclip-alike. Does not work from GM:PlayerDeath","key":"OBS_MODE_ROAMING","value":"6"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by Global.ParticleEffectAttach.","items":{"item":[{"text":"Particle spawns in entity's origin and does not follow it","key":"PATTACH_ABSORIGIN","value":"0"},{"text":"Particle attaches to entity's origin and follows the entity","key":"PATTACH_ABSORIGIN_FOLLOW","value":"1"},{"text":"Create at a custom origin, but don't follow","key":"PATTACH_CUSTOMORIGIN","value":"2"},{"text":"Particle attaches to passed to Global.ParticleEffectAttach attachment id, but does not follow the entity","key":"PATTACH_POINT","value":"3"},{"text":"Particle attaches to passed to Global.ParticleEffectAttach attachment id and follows the entity","key":"PATTACH_POINT_FOLLOW","value":"4"},{"text":"Particle spawns in the beginning of coordinates ( Vector( 0, 0, 0 ) ), used for control points that don't attach to an entity","key":"PATTACH_WORLDORIGIN","value":"5"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by Entity:SetAnimation","items":{"item":[{"key":"PLAYER_IDLE","value":"0"},{"key":"PLAYER_WALK","value":"1"},{"key":"PLAYER_JUMP","value":"2"},{"key":"PLAYER_SUPERJUMP","value":"3"},{"key":"PLAYER_DIE","value":"4"},{"text":"Player attack according to current hold type, used in SWEPs","key":"PLAYER_ATTACK1","value":"5"},{"key":"PLAYER_IN_VEHICLE","value":"6"},{"text":"Player reload according to current hold type, used in SWEPs","key":"PLAYER_RELOAD","value":"7"},{"key":"PLAYER_START_AIMING","value":"8"},{"key":"PLAYER_LEAVE_AIMING","value":"9"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Used by GM:DoAnimationEvent and Player:DoCustomAnimEvent.","items":{"item":[{"text":"Primary attack","key":"PLAYERANIMEVENT_ATTACK_PRIMARY","value":"0"},{"text":"Secondary attack","key":"PLAYERANIMEVENT_ATTACK_SECONDARY","value":"1"},{"text":"Grenade throw","key":"PLAYERANIMEVENT_ATTACK_GRENADE","value":"2"},{"text":"Reload","key":"PLAYERANIMEVENT_RELOAD","value":"3"},{"text":"Looping reload (single-reload shotguns)","key":"PLAYERANIMEVENT_RELOAD_LOOP","value":"4"},{"text":"Looping reload end","key":"PLAYERANIMEVENT_RELOAD_END","value":"5"},{"text":"Jump","key":"PLAYERANIMEVENT_JUMP","value":"6"},{"text":"Swim","key":"PLAYERANIMEVENT_SWIM","value":"7"},{"text":"Die","key":"PLAYERANIMEVENT_DIE","value":"8"},{"key":"PLAYERANIMEVENT_FLINCH_CHEST","value":"9"},{"key":"PLAYERANIMEVENT_FLINCH_HEAD","value":"10"},{"key":"PLAYERANIMEVENT_FLINCH_LEFTARM","value":"11"},{"key":"PLAYERANIMEVENT_FLINCH_RIGHTARM","value":"12"},{"key":"PLAYERANIMEVENT_FLINCH_LEFTLEG","value":"13"},{"key":"PLAYERANIMEVENT_FLINCH_RIGHTLEG","value":"14"},{"key":"PLAYERANIMEVENT_DOUBLEJUMP","value":"15"},{"key":"PLAYERANIMEVENT_CANCEL","value":"16"},{"text":"Spawn","key":"PLAYERANIMEVENT_SPAWN","value":"17"},{"key":"PLAYERANIMEVENT_SNAP_YAW","value":"18"},{"text":"Custom activity","key":"PLAYERANIMEVENT_CUSTOM","value":"19"},{"text":"Play activity in gesture slot","key":"PLAYERANIMEVENT_CUSTOM_GESTURE","value":"20"},{"text":"Play sequence","key":"PLAYERANIMEVENT_CUSTOM_SEQUENCE","value":"21"},{"text":"Play sequence in gesture slot","key":"PLAYERANIMEVENT_CUSTOM_GESTURE_SEQUENCE","value":"22"},{"text":"Cancel reload animation","key":"PLAYERANIMEVENT_CANCEL_RELOAD","value":"23"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by Global.ClientsideModel, `ENT.RenderGroup` in Structures/ENT and Entity:GetRenderGroup.","items":{"item":[{"text":"Huge static prop, possibly leftover from goldsrc","key":"RENDERGROUP_STATIC_HUGE","value":"0"},{"text":"Huge opaque entity, possibly leftover from goldsrc","key":"RENDERGROUP_OPAQUE_HUGE","value":"1"},{"text":"Static props?","key":"RENDERGROUP_STATIC","value":"6"},{"text":"For non transparent/solid entities.\n\n\nFor scripted entities, this will have ENTITY:Draw called","key":"RENDERGROUP_OPAQUE","value":"7"},{"text":"For translucent/transparent entities\n\n\nFor scripted entities, this will have ENTITY:DrawTranslucent called","key":"RENDERGROUP_TRANSLUCENT","value":"8"},{"text":"For both translucent/transparent and opaque/solid anim entities\n\n\nFor scripted entities, this will have both, ENTITY:Draw and ENTITY:DrawTranslucent called","key":"RENDERGROUP_BOTH","value":"9"},{"text":"Solid weapon view models","key":"RENDERGROUP_VIEWMODEL","value":"10"},{"text":"Transparent overlays etc","key":"RENDERGROUP_VIEWMODEL_TRANSLUCENT","value":"11"},{"text":"For brush entities","key":"RENDERGROUP_OPAQUE_BRUSH","value":"12"},{"text":"Unclassfied. Won't get drawn.","key":"RENDERGROUP_OTHER","value":"13"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by Entity:SetRenderMode and Entity:GetRenderMode.","items":{"item":[{"text":"Default render mode. Transparently has no effect.","key":"RENDERMODE_NORMAL","value":"0"},{"text":"Supports transparency.\n\nUse this to make alpha of Global.Color work for your entity. For players, it must be set for their active weapon aswell.","key":"RENDERMODE_TRANSCOLOR","value":"1"},{"key":"RENDERMODE_TRANSTEXTURE","value":"2"},{"text":"Intended for glowing sprites. Allows transparency, and forces the sprite or model to be rendered unlit.\n\nThe size of a sprite rendered with Glow is consistent with the screen size (unlike the alternative World Space Glow), making it appear larger at a distance, in comparison to the world.\n\nThe GlowProxySize keyvalue affects this Render Mode on sprites.","key":"RENDERMODE_GLOW","value":"3"},{"text":"Enables Alphatesting. Legacy port from Goldsource. Obsolete in Source due to Alphatesting being handled in materials. Does not allow transparency.","key":"RENDERMODE_TRANSALPHA","value":"4"},{"text":"Add the material's color values to the existing image, instead of performing a multiplication. Sprites will appear through world geometry and the sprite/model will always brighten the world. Allows transparency.","key":"RENDERMODE_TRANSADD","value":"5"},{"text":"Causes the material to be not be drawn at all, similarly to Don't Render.","key":"RENDERMODE_ENVIROMENTAL","value":"6"},{"text":"Functions like Additive, but also blends between animation frames. Requires the material to have a functioning animating texture. Allows transparency.","key":"RENDERMODE_TRANSADDFRAMEBLEND","value":"7"},{"text":"Functions similarly to Additive, except that the alpha channel controls the opacity of the sprite. An example of use is for dark sprites, with an example material being sprites/strider_blackball.vmt.","key":"RENDERMODE_TRANSALPHADD","value":"8"},{"text":"Functions similarly to Glow, with the exception that the size of the sprite is relative to the world rather than the screen.\n\nThe GlowProxySize keyvalue affects this Render Mode on sprites.","key":"RENDERMODE_WORLDGLOW","value":"9"},{"text":"The entity is still being drawn and networked albeit invisible, therefore not making this Render Mode ideal for performance reasons.\n\nTo completely avoid drawing and networking an entity, see EF_NODRAW.","key":"RENDERMODE_NONE","value":"10"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Client","description":"Enumerations used by Global.GetRenderTargetEx. Clientside only.","items":{"item":[{"text":"Only allowed for render targets that don't want a depth buffer (because if they have a depth buffer, the render target must be less than or equal to the size of the framebuffer).","key":"RT_SIZE_NO_CHANGE","value":"0"},{"text":"Don't play with the specified width and height other than making sure it fits in the framebuffer.","key":"RT_SIZE_DEFAULT","value":"1"},{"text":"Apply picmip to the render target's width and height.","key":"RT_SIZE_PICMIP","value":"2"},{"text":"frame_buffer_width / 4","key":"RT_SIZE_HDR","value":"3"},{"text":"Same size as frame buffer, or next lower power of 2 if we can't do that.","key":"RT_SIZE_FULL_FRAME_BUFFER","value":"4"},{"text":"Target of specified size, don't mess with dimensions","key":"RT_SIZE_OFFSCREEN","value":"5"},{"text":"Same size as the frame buffer, rounded up if necessary for systems that can't do non-power of two textures.","key":"RT_SIZE_FULL_FRAME_BUFFER_ROUNDED_UP","value":"6"},{"text":"Rounded down to power of 2, essentially","key":"RT_SIZE_REPLAY_SCREENSHOT","value":"7"},{"text":"Use the size passed in. Don't clamp it to the frame buffer size. Really.","key":"RT_SIZE_LITERAL","value":"8"},{"text":"Use the size passed in, don't clamp to the frame buffer size, but do apply picmip restrictions.","key":"RT_SIZE_LITERAL_PICMIP","value":"9"}]}},"realms":["Client"],"type":"Enum"},
{"enum":{"realm":"Server","description":"Enumerations for NPC schedules, used by ENTITY:StartEngineSchedule, ENTITY:TranslateSchedule and NPC:SetSchedule. Serverside only.","items":{"item":[{"text":"The schedule enum limit","key":"LAST_SHARED_SCHEDULE","value":"88"},{"text":"Begins AI script based on NPC's `m_hCine` save value.","key":"SCHED_AISCRIPT","value":"56"},{"text":"Idle stance and face ideal yaw angles.","key":"SCHED_ALERT_FACE","value":"5"},{"key":"SCHED_ALERT_FACE_BESTSOUND","value":"6"},{"key":"SCHED_ALERT_REACT_TO_COMBAT_SOUND","value":"7"},{"text":"Rotate 180 degrees and back to check for enemies.","key":"SCHED_ALERT_SCAN","value":"8"},{"text":"Remain idle until an enemy is heard or found.","key":"SCHED_ALERT_STAND","value":"9"},{"text":"Walk until an enemy is heard or found.","key":"SCHED_ALERT_WALK","value":"10"},{"text":"Remain idle until provoked or an enemy is found.","key":"SCHED_AMBUSH","value":"52"},{"text":"Performs ACT_ARM.","key":"SCHED_ARM_WEAPON","value":"48"},{"text":"Back away from enemy. If not possible to back away then go behind enemy.","key":"SCHED_BACK_AWAY_FROM_ENEMY","value":"24"},{"text":"Requires valid enemy, backs away from SaveValue: m_vSavePosition","key":"SCHED_BACK_AWAY_FROM_SAVE_POSITION","value":"26"},{"text":"Heavy damage was taken for the first time in a while.","key":"SCHED_BIG_FLINCH","value":"23"},{"text":"Begin chasing an enemy.","key":"SCHED_CHASE_ENEMY","value":"17"},{"text":"Failed to chase enemy.","key":"SCHED_CHASE_ENEMY_FAILED","value":"18"},{"text":"Face current enemy.","key":"SCHED_COMBAT_FACE","value":"12"},{"text":"Will walk around patrolling an area until an enemy is found.","key":"SCHED_COMBAT_PATROL","value":"75"},{"key":"SCHED_COMBAT_STAND","value":"15"},{"key":"SCHED_COMBAT_SWEEP","value":"13"},{"key":"SCHED_COMBAT_WALK","value":"16"},{"text":"When not moving, will perform ACT_COWER.","key":"SCHED_COWER","value":"40"},{"text":"Regular NPC death.","key":"SCHED_DIE","value":"53"},{"text":"Plays NPC death sound (doesn't kill NPC).","key":"SCHED_DIE_RAGDOLL","value":"54"},{"text":"Holsters active weapon. (Only works with NPC's that can holster weapons)","key":"SCHED_DISARM_WEAPON","value":"49"},{"key":"SCHED_DROPSHIP_DUSTOFF","value":"79"},{"text":"Preform Ducking animation. (Only works with npc_alyx)","key":"SCHED_DUCK_DODGE","value":"84"},{"text":"Search for a place to shoot current enemy.","key":"SCHED_ESTABLISH_LINE_OF_FIRE","value":"35"},{"text":"Fallback from an established line of fire.","key":"SCHED_ESTABLISH_LINE_OF_FIRE_FALLBACK","value":"36"},{"text":"Failed doing current schedule.","key":"SCHED_FAIL","value":"81"},{"text":"Failed to establish a line of fire.","key":"SCHED_FAIL_ESTABLISH_LINE_OF_FIRE","value":"38"},{"key":"SCHED_FAIL_NOSTOP","value":"82"},{"text":"Failed to take cover.","key":"SCHED_FAIL_TAKE_COVER","value":"31"},{"text":"Fall to ground when in the air.","key":"SCHED_FALL_TO_GROUND","value":"78"},{"text":"Will express fear face. (Only works on NPCs with expressions)","key":"SCHED_FEAR_FACE","value":"14"},{"key":"SCHED_FLEE_FROM_BEST_SOUND","value":"29"},{"text":"Plays ACT_FLINCH_PHYSICS.","key":"SCHED_FLINCH_PHYSICS","value":"80"},{"text":"Force walk to SaveValue: m_vecLastPosition (debug).","key":"SCHED_FORCED_GO","value":"71"},{"text":"Force run to SaveValue: m_vecLastPosition (debug).","key":"SCHED_FORCED_GO_RUN","value":"72"},{"text":"Pick up item if within a radius of 5 units.","key":"SCHED_GET_HEALTHKIT","value":"66"},{"text":"Take cover and reload weapon.","key":"SCHED_HIDE_AND_RELOAD","value":"50"},{"text":"Idle stance","key":"SCHED_IDLE_STAND","value":"1"},{"text":"Walk to position.","key":"SCHED_IDLE_WALK","value":"2"},{"text":"Walk to random position within a radius of 200 units.","key":"SCHED_IDLE_WANDER","value":"3"},{"key":"SCHED_INTERACTION_MOVE_TO_PARTNER","value":"85"},{"key":"SCHED_INTERACTION_WAIT_FOR_PARTNER","value":"86"},{"key":"SCHED_INVESTIGATE_SOUND","value":"11"},{"key":"SCHED_MELEE_ATTACK1","value":"41"},{"key":"SCHED_MELEE_ATTACK2","value":"42"},{"text":"Move away from player.","key":"SCHED_MOVE_AWAY","value":"68"},{"text":"Stop moving and continue enemy scan.","key":"SCHED_MOVE_AWAY_END","value":"70"},{"text":"Failed to move away; stop moving.","key":"SCHED_MOVE_AWAY_FAIL","value":"69"},{"text":"Move away from enemy while facing it and checking for new enemies.","key":"SCHED_MOVE_AWAY_FROM_ENEMY","value":"25"},{"text":"Move to the range the weapon is preferably used at.","key":"SCHED_MOVE_TO_WEAPON_RANGE","value":"34"},{"text":"Pick up a new weapon if within a radius of 5 units.","key":"SCHED_NEW_WEAPON","value":"63"},{"text":"Fail safe: Create the weapon that the NPC went to pick up if it was removed during pick up schedule.","key":"SCHED_NEW_WEAPON_CHEAT","value":"64"},{"text":"No schedule is being performed.","key":"SCHED_NONE","value":"0"},{"text":"Prevents movement until COND.NPC_UNFREEZE(68) is set.","key":"SCHED_NPC_FREEZE","value":"73"},{"text":"Run to random position and stop if enemy is heard or found.","key":"SCHED_PATROL_RUN","value":"76"},{"text":"Walk to random position and stop if enemy is heard or found.","key":"SCHED_PATROL_WALK","value":"74"},{"key":"SCHED_PRE_FAIL_ESTABLISH_LINE_OF_FIRE","value":"37"},{"key":"SCHED_RANGE_ATTACK1","value":"43"},{"key":"SCHED_RANGE_ATTACK2","value":"44"},{"text":"Stop moving and reload until danger is heard.","key":"SCHED_RELOAD","value":"51"},{"text":"Retreat from the established enemy.","key":"SCHED_RUN_FROM_ENEMY","value":"32"},{"key":"SCHED_RUN_FROM_ENEMY_FALLBACK","value":"33"},{"key":"SCHED_RUN_FROM_ENEMY_MOB","value":"83"},{"text":"Run to random position within a radius of 500 units.","key":"SCHED_RUN_RANDOM","value":"77"},{"key":"SCHED_SCENE_GENERIC","value":"62"},{"key":"SCHED_SCRIPTED_CUSTOM_MOVE","value":"59"},{"key":"SCHED_SCRIPTED_FACE","value":"61"},{"key":"SCHED_SCRIPTED_RUN","value":"58"},{"key":"SCHED_SCRIPTED_WAIT","value":"60"},{"key":"SCHED_SCRIPTED_WALK","value":"57"},{"text":"Shoot cover that the enemy is behind.","key":"SCHED_SHOOT_ENEMY_COVER","value":"39"},{"text":"Sets the NPC to a sleep-like state.","key":"SCHED_SLEEP","value":"87"},{"key":"SCHED_SMALL_FLINCH","value":"22"},{"key":"SCHED_SPECIAL_ATTACK1","value":"45"},{"key":"SCHED_SPECIAL_ATTACK2","value":"46"},{"key":"SCHED_STANDOFF","value":"47"},{"key":"SCHED_SWITCH_TO_PENDING_WEAPON","value":"65"},{"key":"SCHED_TAKE_COVER_FROM_BEST_SOUND","value":"28"},{"text":"Take cover from current enemy.","key":"SCHED_TAKE_COVER_FROM_ENEMY","value":"27"},{"text":"Flee from SaveValue: vLastKnownLocation","key":"SCHED_TAKE_COVER_FROM_ORIGIN","value":"30"},{"text":"Chase set NPC target.","key":"SCHED_TARGET_CHASE","value":"21"},{"text":"Face NPC target.","key":"SCHED_TARGET_FACE","value":"20"},{"text":"Human victory dance.","key":"SCHED_VICTORY_DANCE","value":"19"},{"key":"SCHED_WAIT_FOR_SCRIPT","value":"55"},{"key":"SCHED_WAIT_FOR_SPEAK_FINISH","value":"67"},{"text":"Spot an enemy and go from an idle state to combat state.","key":"SCHED_WAKE_ANGRY","value":"4"}]}},"realms":["Server"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Bitflags used by Player:ScreenFade.","items":{"item":[{"text":"Instant fade in, wait for hold time AND fade time, instant fade out.\n\nNot a real flag, but rather describes what happens when given none.","key":"","value":"0"},{"text":"Instant fade in, slowly fade out (based on fade time given) after the hold time has passed","key":"SCREENFADE.IN","value":"1"},{"text":"Slowly fade in (based on fade time given), hold time passes, instantly disappear","key":"SCREENFADE.OUT","value":"2"},{"text":"Instead of blending multiple active screen fades, modulate them. (TODO: What does this mean?) Internally this flag switches what material will be used to render the screen fade. Practically it forces the color to black.","key":"SCREENFADE.MODULATE","value":"4"},{"text":"Never disappear. Does nothing by itself, as if no flags were given.","key":"SCREENFADE.STAYOUT","value":"8"},{"text":"Used to purge all currently active screen fade effects, meant to be used in conjunction with flags above as a \"priority effect\".\n\nDoes nothing by itself, acts as if no flags were given","key":"SCREENFADE.PURGE","value":"16"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by Kinect SDK bindings.","items":{"item":[{"key":"SENSORBONE.SHOULDER_RIGHT","value":"8"},{"key":"SENSORBONE.SHOULDER_LEFT","value":"4"},{"key":"SENSORBONE.HIP","value":"0"},{"key":"SENSORBONE.ELBOW_RIGHT","value":"9"},{"key":"SENSORBONE.KNEE_RIGHT","value":"17"},{"key":"SENSORBONE.WRIST_RIGHT","value":"10"},{"key":"SENSORBONE.ANKLE_LEFT","value":"14"},{"key":"SENSORBONE.FOOT_LEFT","value":"15"},{"key":"SENSORBONE.WRIST_LEFT","value":"6"},{"key":"SENSORBONE.FOOT_RIGHT","value":"19"},{"key":"SENSORBONE.HAND_RIGHT","value":"11"},{"key":"SENSORBONE.SHOULDER","value":"2"},{"key":"SENSORBONE.HIP_LEFT","value":"12"},{"key":"SENSORBONE.HIP_RIGHT","value":"16"},{"key":"SENSORBONE.HAND_LEFT","value":"7"},{"key":"SENSORBONE.ANKLE_RIGHT","value":"18"},{"key":"SENSORBONE.SPINE","value":"1"},{"key":"SENSORBONE.ELBOW_LEFT","value":"5"},{"key":"SENSORBONE.KNEE_LEFT","value":"13"},{"key":"SENSORBONE.HEAD","value":"3"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Server","description":{"text":"Enumerations describing certain spawnflags. Everything except for SF_PHYS* and SF_WEAPON* is serverside only.\n\nSpawnflags are set using Entity:SetKeyValue with **\"spawnflags\"** as the key, or using Entity:SetSpawnFlags, Entity:AddSpawnFlags, Entity:RemoveSpawnFlags.\n\n* SF_CITIZEN_* spawnflags represent spawnflags only usable on [npc_citizen](https://developer.valvesoftware.com/wiki/Npc_citizen).\n* SF_NPC_* - Usable on all NPCs\n* SF_PHYSBOX_* - Usable on [func_physbox](https://developer.valvesoftware.com/wiki/Func_physbox)\n* SF_PHYSPROP_* - Usable on [prop_physics](https://developer.valvesoftware.com/wiki/Prop_physics) entities\n* SF_WEAPON_* - Usable on Weapons","note":"This is not a full list of available spawnflags, there are **a lot** more, each unique to each entity, you can find out more on the [Valve Developer Community](https://developer.valvesoftware.com/wiki/Main_Page) website for the entities in question."},"items":{"item":[{"text":"Citizen that resupplies ammo","key":"SF_CITIZEN_AMMORESUPPLIER","value":"524288"},{"text":"\"Follow the player as soon as I spawn\"","key":"SF_CITIZEN_FOLLOW","value":"65536"},{"text":"\"Work outside the speech semaphore system\"","key":"SF_CITIZEN_IGNORE_SEMAPHORE","value":"2097152"},{"text":"Makes the citizen a medic","key":"SF_CITIZEN_MEDIC","value":"131072"},{"text":"Citizen cannot join players squad, and will not able to be commanded by the Half-Life 2 command system for Citizens","key":"SF_CITIZEN_NOT_COMMANDABLE","value":"1048576"},{"text":"Gives the citizen a random head","key":"SF_CITIZEN_RANDOM_HEAD","value":"262144"},{"text":"Gives the citizen a random female head","key":"SF_CITIZEN_RANDOM_HEAD_FEMALE","value":"8388608"},{"text":"Gives the citizen a random male head","key":"SF_CITIZEN_RANDOM_HEAD_MALE","value":"4194304"},{"text":"\"Use render bounds instead of human hull for guys sitting in chairs, etc\". Must be set before Spawn() is called to take effect","key":"SF_CITIZEN_USE_RENDER_BOUNDS","value":"16777216"},{"text":"Makes the floor turret friendly","key":"SF_FLOOR_TURRET_CITIZEN","value":"512"},{"text":"Do Alternate collision for this NPC (player avoidance)","key":"SF_NPC_ALTCOLLISION","value":"4096"},{"text":"[Think outside PVS](https://developer.valvesoftware.com/wiki/NPC_Sensing)","key":"SF_NPC_ALWAYSTHINK","value":"1024"},{"text":"NPC Drops health kit when it dies. Also works on player.","key":"SF_NPC_DROP_HEALTHKIT","value":"8"},{"text":"Fade Corpse","key":"SF_NPC_FADE_CORPSE","value":"512"},{"text":"If not set, means *teleport* to ground","key":"SF_NPC_FALL_TO_GROUND","value":"4"},{"text":"No IDLE sounds until angry","key":"SF_NPC_GAG","value":"2"},{"text":"Long Visibility/Shoot","key":"SF_NPC_LONG_RANGE","value":"256"},{"text":"Ignore player push - Don't give way to player","key":"SF_NPC_NO_PLAYER_PUSHAWAY","value":"16384"},{"text":"NPC Doesn't drop weapon on death","key":"SF_NPC_NO_WEAPON_DROP","value":"8192"},{"text":"Don't acquire enemies or avoid obstacles","key":"SF_NPC_START_EFFICIENT","value":"16"},{"text":"This entity is a template for the [npc_template_maker](https://developer.valvesoftware.com/wiki/Npc_template_maker). It will not spawn automatically and cannot be used with [point_template](https://developer.valvesoftware.com/wiki/Point_template).","key":"SF_NPC_TEMPLATE","value":"2048"},{"text":"Wait for script","key":"SF_NPC_WAIT_FOR_SCRIPT","value":"128"},{"text":"Wait till seen","key":"SF_NPC_WAIT_TILL_SEEN","value":"1"},{"text":"If set, calls PhysObj:EnableMotion( false ) on the func_physbox when the physics are created","key":"SF_PHYSBOX_MOTIONDISABLED","value":"32768"},{"text":"Gravity gun is ALWAYS allowed to pick this up.","key":"SF_PHYSBOX_ALWAYS_PICK_UP","value":"1048576"},{"text":"Gravity gun is NOT allowed to pick this up.","key":"SF_PHYSBOX_NEVER_PICK_UP","value":"2097152"},{"text":"Gravity gun is NOT allowed to punt this entity.","key":"SF_PHYSBOX_NEVER_PUNT","value":"4194304"},{"text":"If set, calls PhysObj:EnableMotion( false ) on the func_physbox when the physics are created. See [Physics optimization](https://developer.valvesoftware.com/wiki/Physics_optimization).","key":"SF_PHYSPROP_MOTIONDISABLED","value":"8"},{"text":"Prevent that physbox from being picked up.","key":"SF_PHYSPROP_PREVENT_PICKUP","value":"512"},{"text":"This flag is set if the entity is gib.","key":"SF_PHYSPROP_IS_GIB","value":"4194304"},{"text":"Makes the rollermine friendly.","key":"SF_ROLLERMINE_FRIENDLY","value":"65536"},{"text":"If set before Entity:Spawn, the weapon will be constrained and will not simply fall to the ground.","key":"SF_WEAPON_START_CONSTRAINED","value":"1"},{"text":"Player is NOT allowed to pick this up.","key":"SF_WEAPON_NO_PLAYER_PICKUP","value":"2"},{"text":"Physgun is NOT allowed to pick this up.","key":"SF_WEAPON_NO_PHYSCANNON_PUNT","value":"4"}]}},"realms":["Server"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Used by GM:ClientSignOnStateChanged.","items":{"item":[{"key":"SIGNONSTATE_NONE","value":"0"},{"key":"SIGNONSTATE_CHALLENGE","value":"1"},{"key":"SIGNONSTATE_CONNECTED","value":"2"},{"key":"SIGNONSTATE_NEW","value":"3"},{"key":"SIGNONSTATE_PRESPAWN","value":"4"},{"key":"SIGNONSTATE_SPAWN","value":"5"},{"key":"SIGNONSTATE_FULL","value":"6"},{"key":"SIGNONSTATE_CHANGELEVEL","value":"7"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by ENTITY:PhysicsSimulate.","items":{"item":[{"text":"Don't simulate physics","key":"SIM_NOTHING","value":"0"},{"text":"Vectors in local coordinate system","key":"SIM_LOCAL_ACCELERATION","value":"1"},{"text":"Vectors in local coordinate system","key":"SIM_LOCAL_FORCE","value":"2"},{"text":"Vectors in world coordinate system","key":"SIM_GLOBAL_ACCELERATION","value":"3"},{"text":"Vectors in world coordinate system","key":"SIM_GLOBAL_FORCE","value":"4"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Sound flags used by Global.EmitSound and Entity:EmitSound.","items":{"item":[{"text":"To keep the compiler happy","key":"SND_NOFLAGS","value":"0"},{"text":"Change sound volume. If the sound is already being emitted by the entity, its volume will be changed, instead of playing another sound.","key":"SND_CHANGE_VOL","value":"1"},{"text":"Change sound pitch. If the sound is already being emitted by the entity, its pitch will be changed, instead of playing another sound.","key":"SND_CHANGE_PITCH","value":"2"},{"text":"Stop the sound. Used internally for Entity:StopSound.","key":"SND_STOP","value":"4"},{"text":"We're spawning, used in some cases for ambients. Not sent over net, only a param between dll and server.","key":"SND_SPAWNING","value":"8"},{"text":"Sound has an initial delay.","key":"SND_DELAY","value":"16"},{"text":"Stop all looping sounds on the entity.","key":"SND_STOP_LOOPING","value":"32"},{"text":"This sound should be paused if the game is paused.","key":"SND_SHOULDPAUSE","value":"128"},{"text":"If the sound has any associated phoneme (character lip-sync) data, ignore it.","key":"SND_IGNORE_PHONEMES","value":"256"},{"text":"Used to change all sounds (e.g. with SND_CHANGE_VOL) emitted by an entity, regardless of scriptname.","key":"SND_IGNORE_NAME","value":"512"},{"text":"Unused/legacy; does nothing.","key":"SND_DO_NOT_OVERWRITE_EXISTING_ON_CHANNEL","value":"1024"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":{"text":"The sound's attenuation, or how fast it drops away. Enumerations used by Global.EmitSound and Entity:EmitSound. Information taken from [soundflags.h in Source SDK 2013](https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/soundflags.h#L53)\n\nThe engine starts running into trouble below 60dB.","warning":"These enumerations are not provided in Garry's Mod Lua and are listed here only for reference. Use the raw number values instead."},"items":{"item":[{"text":"Sound plays everywhere","key":"SNDLVL_NONE","value":"0"},{"text":"Rustling leaves","key":"SNDLVL_20dB","value":"20"},{"text":"Whispering","key":"SNDLVL_25dB","value":"25"},{"text":"Library","key":"SNDLVL_30dB","value":"30"},{"key":"SNDLVL_35dB","value":"35"},{"key":"SNDLVL_40dB","value":"40"},{"text":"Refrigerator","key":"SNDLVL_45dB","value":"45"},{"text":"Average home","key":"SNDLVL_50dB","value":"50"},{"key":"SNDLVL_55dB","value":"55"},{"text":"Normal conversation, clothes dryer","key":"SNDLVL_60dB","value":"60"},{"text":"*The same as SNDLVL_60dB*","key":"SNDLVL_IDLE","value":"60"},{"text":"Washing machine, dishwasher","key":"SNDLVL_65dB","value":"65"},{"key":"SNDLVL_STATIC","value":"66"},{"text":"Car, vacuum cleaner, mixer, electric sewing machine","key":"SNDLVL_70dB","value":"70"},{"text":"Busy traffic","key":"SNDLVL_75dB","value":"75"},{"text":"*The same as SNDLVL_75dB*","key":"SNDLVL_NORM","value":"75"},{"text":"Mini-bike, alarm clock, noisy restaurant, office tabulator, outboard motor, passing snowmobile","key":"SNDLVL_80dB","value":"80"},{"text":"*The same as SNDLVL_80dB*","key":"SNDLVL_TALKING","value":"80"},{"text":"Average factory, electric shaver","key":"SNDLVL_85dB","value":"85"},{"text":"Screaming child, passing motorcycle, convertible ride on freeway","key":"SNDLVL_90dB","value":"90"},{"key":"SNDLVL_95dB","value":"95"},{"text":"Subway train, diesel truck, woodworking shop, pneumatic drill, boiler shop, jackhammer","key":"SNDLVL_100dB","value":"100"},{"text":"Helicopter, power mower","key":"SNDLVL_105dB","value":"105"},{"text":"Snowmobile (drivers seat), inboard motorboat, sandblasting","key":"SNDLVL_110dB","value":"110"},{"text":"Car horn, propeller aircraft","key":"SNDLVL_120dB","value":"120"},{"text":"Air raid siren","key":"SNDLVL_130dB","value":"130"},{"text":"Threshold of pain, gunshot, jet engine","key":"SNDLVL_140dB","value":"140"},{"text":"*The same as SNDLVL_140dB*","key":"SNDLVL_GUNFIRE","value":"140"},{"key":"SNDLVL_150dB","value":"150"},{"text":"Rocket launching","key":"SNDLVL_180dB","value":"180"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"For use with Entity:PhysicsInit, Entity:SetSolid and Entity:GetSolid.","items":{"item":[{"text":"Does not collide with anything.","key":"SOLID_NONE","value":"0","note":"No physics object will be created when using this with Entity:PhysicsInit."},{"text":"The entity has a brush model defined by the map. Does not collide with other SOLID_BSP entities.","key":"SOLID_BSP","value":"1"},{"text":"Uses the entity's axis-aligned bounding box for collisions.","key":"SOLID_BBOX","value":"2"},{"text":"Uses the entity's object-aligned bounding box for collisions.","key":"SOLID_OBB","value":"3"},{"text":"Same as SOLID_OBB but restricts orientation to the Z-axis.","key":"SOLID_OBB_YAW","value":"4","note":"Seems to be broken."},{"text":"Always call the entity's `ICollideable::TestCollision` method for traces regardless of the presence of `FSOLID_CUSTOMRAYTEST` or `FSOLID_CUSTOMBOXTEST`. This will only be called back to Lua as ENTITY:TestCollision for `\"anim\"` type SENTs.","key":"SOLID_CUSTOM","value":"5"},{"text":"Uses the PhysObjects of the entity.","key":"SOLID_VPHYSICS","value":"6"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Server","description":"Enumerations used by sound.EmitHint.","items":{"item":[{"key":"SOUND_NONE","value":"0"},{"key":"SOUND_COMBAT","value":"1"},{"key":"SOUND_WORLD","value":"2"},{"key":"SOUND_PLAYER","value":"4"},{"key":"SOUND_DANGER","value":"8"},{"key":"SOUND_BULLET_IMPACT","value":"16"},{"text":"Considered a scent.","key":"SOUND_CARCASS","value":"32"},{"text":"Considered a scent.","key":"SOUND_MEAT","value":"64"},{"text":"Considered a scent.","key":"SOUND_GARBAGE","value":"128"},{"text":"Keeps certain creatures at bay, such as Antlions.","key":"SOUND_THUMPER","value":"256"},{"text":"Gets the antlion's attention.","key":"SOUND_BUGBAIT","value":"512"},{"key":"SOUND_PHYSICS_DANGER","value":"1024"},{"text":"Only scares the sniper NPC.","key":"SOUND_DANGER_SNIPERONLY","value":"2048"},{"key":"SOUND_MOVE_AWAY","value":"4096"},{"key":"SOUND_PLAYER_VEHICLE","value":"8192"},{"text":"Changes listener's readiness (Player Companion only)","key":"SOUND_READINESS_LOW","value":"16384"},{"key":"SOUND_READINESS_MEDIUM","value":"32768"},{"key":"SOUND_READINESS_HIGH","value":"65536"},{"text":"Additional context for SOUND_DANGER","key":"SOUND_CONTEXT_FROM_SNIPER","value":"1048576"},{"text":"Added to SOUND_COMBAT","key":"SOUND_CONTEXT_GUNFIRE","value":"2097152"},{"text":"Explosion going to happen here.","key":"SOUND_CONTEXT_MORTAR","value":"4194304"},{"text":"Only combine can hear sounds marked this way.","key":"SOUND_CONTEXT_COMBINE_ONLY","value":"8388608"},{"text":"React to sound source's origin, not sound's location","key":"SOUND_CONTEXT_REACT_TO_SOURCE","value":"16777216"},{"text":"Context added to SOUND_COMBAT, usually.","key":"SOUND_CONTEXT_EXPLOSION","value":"33554432"},{"text":"Combine do NOT hear this","key":"SOUND_CONTEXT_EXCLUDE_COMBINE","value":"67108864"},{"text":"Treat as a normal danger sound if you see the source, otherwise turn to face source.","key":"SOUND_CONTEXT_DANGER_APPROACH","value":"134217728"},{"text":"Only player allies can hear this sound.","key":"SOUND_CONTEXT_ALLIES_ONLY","value":"268435456"},{"text":"HACK: need this because we're not treating the SOUND_xxx values as true bit values! See switch in OnListened.","key":"SOUND_CONTEXT_PLAYER_VEHICLE","value":"536870912"}]}},"realms":["Server"],"type":"Enum"},
{"enum":[{"realm":"Client","description":"Enumerations for use with render.SetStencilCompareFunction.\n\nThe comparison is between the reference value set by render.SetStencilReferenceValue, and the value of each pixel in the stencil buffer.\n\nThese enumerations are mirrors of Enums/STENCILCOMPARISONFUNCTION.\n\nAlso see this corresponding MSDN entry: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476101%28v=vs.85%29.aspx.","items":{"item":[{"text":"Never passes.","key":"STENCIL_NEVER","value":"1"},{"text":"Passes where the reference value is less than the stencil value.","key":"STENCIL_LESS","value":"2"},{"text":"Passes where the reference value is equal to the stencil value.","key":"STENCIL_EQUAL","value":"3"},{"text":"Passes where the reference value is less than or equal to the stencil value.","key":"STENCIL_LESSEQUAL","value":"4"},{"text":"Passes where the reference value is greater than the stencil value.","key":"STENCIL_GREATER","value":"5"},{"text":"Passes where the reference value is not equal to the stencil value.","key":"STENCIL_NOTEQUAL","value":"6"},{"text":"Passes where the reference value is greater than or equal to the stencil value.","key":"STENCIL_GREATEREQUAL","value":"7"},{"text":"Always passes.","key":"STENCIL_ALWAYS","value":"8"}]}},{"realm":"Client","description":"Enumerations for use with render.SetStencilPassOperation, render.SetStencilFailOperation and render.SetStencilZFailOperation.\n\nThese enumerations are mirrors of Enums/STENCILOPERATION.","items":{"item":[{"text":"Preserves the existing stencil buffer value.","key":"STENCIL_KEEP","value":"1"},{"text":"Sets the value in the stencil buffer to 0.","key":"STENCIL_ZERO","value":"2"},{"text":"Sets the value in the stencil buffer to the reference value, set using render.SetStencilReferenceValue.","key":"STENCIL_REPLACE","value":"3"},{"text":"Increments the value in the stencil buffer by 1, clamping the result.","key":"STENCIL_INCRSAT","value":"4"},{"text":"Decrements the value in the stencil buffer by 1, clamping the result.","key":"STENCIL_DECRSAT","value":"5"},{"text":"Inverts the value in the stencil buffer.","key":"STENCIL_INVERT","value":"6"},{"text":"Increments the value in the stencil buffer by 1, wrapping around on overflow.","key":"STENCIL_INCR","value":"7"},{"text":"Decrements the value in the stencil buffer by 1, wrapping around on overflow.","key":"STENCIL_DECR","value":"8"}]}}],"realms":["Client"],"type":"Enum"},
{"enum":{"realm":"Client","description":{"text":"Enumerations for use with render.SetStencilCompareFunction.\n\nThe comparison is between the reference value set by render.SetStencilReferenceValue, and the value of each pixel in the stencil buffer.\n\nClientside only.\n\n\nAlso see this corresponding MSDN entry: http://msdn.microsoft.com/en-us/library/windows/desktop/ff476101%28v=vs.85%29.aspx.","note":"These enumerations are also mirrored as Enums/STENCIL."},"items":{"item":[{"text":"Never passes.","key":"STENCILCOMPARISONFUNCTION_NEVER","value":"1"},{"text":"Passes where the reference value is less than the stencil value.","key":"STENCILCOMPARISONFUNCTION_LESS","value":"2"},{"text":"Passes where the reference value is equal to the stencil value.","key":"STENCILCOMPARISONFUNCTION_EQUAL","value":"3"},{"text":"Passes where the reference value is less than or equal to the stencil value.","key":"STENCILCOMPARISONFUNCTION_LESSEQUAL","value":"4"},{"text":"Passes where the reference value is greater than the stencil value.","key":"STENCILCOMPARISONFUNCTION_GREATER","value":"5"},{"text":"Passes where the reference value is not equal to the stencil value.","key":"STENCILCOMPARISONFUNCTION_NOTEQUAL","value":"6"},{"text":"Passes where the reference value is greater than or equal to the stencil value.","key":"STENCILCOMPARISONFUNCTION_GREATEREQUAL","value":"7"},{"text":"Always passes.","key":"STENCILCOMPARISONFUNCTION_ALWAYS","value":"8"}]}},"realms":["Client"],"type":"Enum"},
{"enum":{"realm":"Client","description":{"text":"Enumerations for use with render.SetStencilPassOperation, render.SetStencilFailOperation and render.SetStencilZFailOperation. Clientside only.\n\n\nAlso see this corresponding MSDN entry: http://msdn.microsoft.com/en-us/library/windows/desktop/ff476219%28v=vs.85%29.aspx.","note":"These enumerations are also mirrored as Enums/STENCIL."},"items":{"item":[{"text":"Preserves the existing stencil buffer value.","key":"STENCILOPERATION_KEEP","value":"1"},{"text":"Sets the value in the stencil buffer to 0.","key":"STENCILOPERATION_ZERO","value":"2"},{"text":"Sets the value in the stencil buffer to the reference value, set using render.SetStencilReferenceValue.","key":"STENCILOPERATION_REPLACE","value":"3"},{"text":"Increments the value in the stencil buffer by 1, clamping the result.","key":"STENCILOPERATION_INCRSAT","value":"4"},{"text":"Decrements the value in the stencil buffer by 1, clamping the result.","key":"STENCILOPERATION_DECRSAT","value":"5"},{"text":"Inverts the value in the stencil buffer.","key":"STENCILOPERATION_INVERT","value":"6"},{"text":"Increments the value in the stencil buffer by 1, wrapping around on overflow.","key":"STENCILOPERATION_INCR","value":"7"},{"text":"Decrements the value in the stencil buffer by 1, wrapping around on overflow.","key":"STENCILOPERATION_DECR","value":"8"}]}},"realms":["Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used in GM:PlayerStepSoundTime hook.","items":{"item":[{"text":"Normal step","key":"STEPSOUNDTIME_NORMAL","value":"0"},{"text":"Step on ladder","key":"STEPSOUNDTIME_ON_LADDER","value":"1"},{"text":"Step in water, with water reaching knee","key":"STEPSOUNDTIME_WATER_KNEE","value":"2"},{"text":"Step in water, with water reaching foot","key":"STEPSOUNDTIME_WATER_FOOT","value":"3"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Client","description":"Used by:\n* Entity:DrawModel\n* ENTITY:Draw\n* ENTITY:DrawTranslucent\n* WEAPON:PreDrawViewModel\n* WEAPON:PostDrawViewModel\n* WEAPON:ViewModelDrawn\n* GM:PreDrawPlayerHands\n* GM:PostDrawPlayerHands\n* GM:PreDrawViewModel\n* GM:PostDrawViewModel\n* GM:PrePlayerDraw\n* GM:PostPlayerDraw","items":{"item":[{"text":"The current render is for opaque renderables only","key":"STUDIO_RENDER","value":"1"},{"key":"STUDIO_VIEWXFORMATTACHMENTS","value":"2"},{"text":"The current render is for translucent renderables only","key":"STUDIO_DRAWTRANSLUCENTSUBMODELS","value":"4"},{"text":"The current render is for both opaque and translucent renderables","key":"STUDIO_TWOPASS","value":"8"},{"key":"STUDIO_STATIC_LIGHTING","value":"16"},{"key":"STUDIO_WIREFRAME","value":"32"},{"key":"STUDIO_ITEM_BLINK","value":"64"},{"key":"STUDIO_NOSHADOWS","value":"128"},{"key":"STUDIO_WIREFRAME_VCOLLIDE","value":"256"},{"text":"Not a studio flag, but used to flag when we want studio stats","key":"STUDIO_GENERATE_STATS","value":"16777216"},{"text":"Not a studio flag, but used to flag model as using shadow depth material override","key":"STUDIO_SSAODEPTHTEXTURE","value":"134217728"},{"text":"Not a studio flag, but used to flag model as using shadow depth material override","key":"STUDIO_SHADOWDEPTHTEXTURE","value":"1073741824"},{"text":"Not a studio flag, but used to flag model as a non-sorting brush model","key":"STUDIO_TRANSPARENCY","value":"2147483648"},{"text":"Do not update/apply flexes. (Entity:SetFlexWeight)","key":"STUDIO_SKIP_FLEXES","value":"1024","added":"2026.05.19"},{"text":"Do not render decals.","key":"STUDIO_SKIP_DECALS","value":"268435456","added":"2026.05.19"}]}},"realms":["Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Surface flags, used by the Structures/TraceResult.","items":{"item":[{"text":"Value will hold the light strength","key":"SURF_LIGHT","value":"1"},{"text":"The surface is a 2D skybox","key":"SURF_SKY2D","value":"2"},{"text":"This surface is a skybox, equivalent to HitSky in Structures/TraceResult","key":"SURF_SKY","value":"4"},{"text":"This surface is animated water","key":"SURF_WARP","value":"8"},{"text":"This surface is translucent","key":"SURF_TRANS","value":"16"},{"text":"This surface cannot have portals placed on, used by Portal's gun","key":"SURF_NOPORTAL","value":"32"},{"text":"This surface is a trigger","key":"SURF_TRIGGER","value":"64"},{"text":"This surface is an invisible entity, equivalent to HitNoDraw in Structures/TraceResult","key":"SURF_NODRAW","value":"128"},{"text":"Make a primary bsp splitter","key":"SURF_HINT","value":"256"},{"text":"This surface can be ignored by impact effects","key":"SURF_SKIP","value":"512"},{"text":"This surface has no lights calculated","key":"SURF_NOLIGHT","value":"1024"},{"text":"Calculate three lightmaps for the surface for bumpmapping","key":"SURF_BUMPLIGHT","value":"2048"},{"text":"No shadows are cast on this surface","key":"SURF_NOSHADOWS","value":"4096"},{"text":"No decals are applied to this surface","key":"SURF_NODECALS","value":"8192"},{"text":"Don't subdivide patches on this surface","key":"SURF_NOCHOP","value":"16384"},{"text":"This surface is part of an entity's hitbox","key":"SURF_HITBOX","value":"32768"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Server","description":"Used by NPC:GetTaskStatus and NPC:SetTaskStatus.","items":{"item":[{"text":"Just started","key":"TASKSTATUS_NEW","value":"0"},{"text":"Running task & movement.","key":"TASKSTATUS_RUN_MOVE_AND_TASK","value":"1"},{"text":"Just running movement.","key":"TASKSTATUS_RUN_MOVE","value":"2"},{"text":"Just running task.","key":"TASKSTATUS_RUN_TASK","value":"3"},{"text":"Completed, get next task.","key":"TASKSTATUS_COMPLETE","value":"4"}]}},"realms":["Server"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Default defined teams in Garry's Mod. This does not include any custom teams created in custom gamemodes. Enumerations to use with Player:Team","items":{"item":[{"text":"Connecting team ID, set when player connects to the server","key":"TEAM_CONNECTING","value":"0"},{"text":"Unassigned team ID, set right after player connected","key":"TEAM_UNASSIGNED","value":"1001"},{"text":"Spectator team ID","key":"TEAM_SPECTATOR","value":"1002"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared and Menu","description":"Enumerations used by render.PushFilterMin and render.PushFilterMag.\n\nSee [this](https://msdn.microsoft.com/en-us/library/windows/desktop/bb172615(v=vs.85).aspx) and [this page](https://en.wikipedia.org/wiki/Texture_filtering) for more information on texture filtering.","items":{"item":[{"text":"Disables any filter override.","key":"TEXFILTER.NONE","value":"0"},{"text":"Point sampling, no interpolation.","key":"TEXFILTER.POINT","value":"1"},{"text":"Basic interpolation between 2 samples.","key":"TEXFILTER.LINEAR","value":"2"},{"text":"Highest quality filter. Most useful for textures on 3D geometry.","key":"TEXFILTER.ANISOTROPIC","value":"3"}]}},"realms":["Server","Client","Menu"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by draw.SimpleText, draw.DrawText and in Structures/TextData.","items":{"item":[{"text":"Align the text on the left","key":"TEXT_ALIGN_LEFT","value":"0"},{"text":"Align the text in center","key":"TEXT_ALIGN_CENTER","value":"1"},{"text":"Align the text on the right","key":"TEXT_ALIGN_RIGHT","value":"2"},{"text":"Align the text on the top","key":"TEXT_ALIGN_TOP","value":"3"},{"text":"Align the text on the bottom","key":"TEXT_ALIGN_BOTTOM","value":"4"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Client","added":"2022.02.02","description":"Used by util.FilterText.","items":{"item":[{"text":"Unknown context.","key":"TEXT_FILTER_UNKNOWN","value":"0"},{"text":"Game content, only legally required filtering is performed.","key":"TEXT_FILTER_GAME_CONTENT","value":"1"},{"text":"Chat from another player.","key":"TEXT_FILTER_CHAT","value":"2"},{"text":"Character or item name.","key":"TEXT_FILTER_NAME","value":"3"}]}},"realms":["Client"],"type":"Enum"},
{"enum":{"realm":"Client","description":{"text":"Bit flags used by Global.GetRenderTargetEx. Information taken from [VTF (Valve Texture Format) - Texture flags](https://developer.valvesoftware.com/wiki/Valve_Texture_Format#Texture_flags)","warning":"These enumerations do not exist in game and are listed here only for reference"},"items":{"item":[{"text":"Low quality, \"pixel art\" texture filtering.","key":"TEXTUREFLAGS_POINTSAMPLE","value":"1"},{"text":"Medium quality texture filtering.","key":"TEXTUREFLAGS_TRILINEAR","value":"2"},{"text":"Clamp S coordinates.","key":"TEXTUREFLAGS_CLAMPS","value":"4"},{"text":"Clamp T coordinates.","key":"TEXTUREFLAGS_CLAMPT","value":"8"},{"text":"High quality texture filtering.","key":"TEXTUREFLAGS_ANISOTROPIC","value":"16"},{"text":"Used in skyboxes. Makes sure edges are seamless.","key":"TEXTUREFLAGS_HINT_DXT5","value":"32"},{"text":"Purpose unknown.","key":"TEXTUREFLAGS_PWL_CORRECTED","value":"64"},{"text":"Texture is a normal map.","key":"TEXTUREFLAGS_NORMAL","value":"128"},{"text":"Render largest mipmap only. (Does not delete existing mipmaps, just disables them.)","key":"TEXTUREFLAGS_NOMIP","value":"256"},{"text":"Not affected by texture resolution settings.","key":"TEXTUREFLAGS_NOLOD","value":"512"},{"text":"No Minimum Mipmap","key":"TEXTUREFLAGS_ALL_MIPS","value":"1024"},{"text":"Texture is an procedural texture (code can modify it).","key":"TEXTUREFLAGS_PROCEDURAL","value":"2048"},{"text":"One bit alpha channel used.","key":"TEXTUREFLAGS_ONEBITALPHA","value":"4096"},{"text":"Eight bit alpha channel used.","key":"TEXTUREFLAGS_EIGHTBITALPHA","value":"8192"},{"text":"Texture is an environment map.","key":"TEXTUREFLAGS_ENVMAP","value":"16384"},{"text":"Texture is a render target.","key":"TEXTUREFLAGS_RENDERTARGET","value":"32768"},{"text":"Texture is a depth render target.","key":"TEXTUREFLAGS_DEPTHRENDERTARGET","value":"65536"},{"key":"TEXTUREFLAGS_NODEBUGOVERRIDE","value":"131072"},{"key":"TEXTUREFLAGS_SINGLECOPY","value":"262144"},{"text":"Aka TEXTUREFLAGS_UNUSED_00080000","key":"TEXTUREFLAGS_STAGING_MEMORY","value":"524288","deprecated":{"notag":"true"}},{"text":"Immediately destroy this texture when its reference count hits zero.\n\nAka TEXTUREFLAGS_UNUSED_00100000","key":"TEXTUREFLAGS_IMMEDIATE_CLEANUP","value":"1048576","deprecated":{"notag":"true"}},{"text":"Aka TEXTUREFLAGS_UNUSED_00200000","key":"TEXTUREFLAGS_IGNORE_PICMIP","value":"2097152","deprecated":{"notag":"true"}},{"key":"TEXTUREFLAGS_UNUSED_00400000","value":"4194304"},{"text":"Do not buffer for Video Processing, generally render distance.","key":"TEXTUREFLAGS_NODEPTHBUFFER","value":"8388608"},{"key":"TEXTUREFLAGS_UNUSED_01000000","value":"16777216"},{"text":"Clamp U coordinates (for volumetric textures).","key":"TEXTUREFLAGS_CLAMPU","value":"33554432"},{"text":"Usable as a vertex texture","key":"TEXTUREFLAGS_VERTEXTEXTURE","value":"67108864"},{"text":"Texture is a SSBump. (SSB)","key":"TEXTUREFLAGS_SSBUMP","value":"134217728"},{"key":"TEXTUREFLAGS_UNUSED_10000000","value":"268435456"},{"text":"Clamp to border colour on all texture coordinates","key":"TEXTUREFLAGS_BORDER","value":"536870912"},{"text":"Aka TEXTUREFLAGS_UNUSED_40000000","key":"TEXTUREFLAGS_STREAMABLE_COARSE","value":"1073741824","deprecated":{"notag":"true"}},{"text":"Aka TEXTUREFLAGS_UNUSED_80000000","key":"TEXTUREFLAGS_STREAMABLE_FINE","value":"2147483648","deprecated":{"notag":"true"}}]}},"realms":["Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by Structures/AmmoData.","items":{"item":[{"text":"Generates no tracer effects","key":"TRACER_NONE","value":"0"},{"text":"Generates tracer effects","key":"TRACER_LINE","value":"1"},{"text":"Unused.","key":"TRACER_RAIL","value":"2"},{"text":"Unused.","key":"TRACER_BEAM","value":"3"},{"text":"Generates tracer and makes whizzing noises if the bullet flies past the player being shot at","key":"TRACER_LINE_AND_WHIZ","value":"4"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used in ENTITY:UpdateTransmitState hook.","items":{"item":[{"text":"Always transmit the entity","key":"TRANSMIT_ALWAYS","value":"0"},{"text":"Never transmit the entity, default for point entities","key":"TRANSMIT_NEVER","value":"1"},{"text":"Transmit when entity is in players [PVS (Potential Visibility Set)](https://developer.valvesoftware.com/wiki/PVS \"PVS - Valve Developer Community\")","key":"TRANSMIT_PVS","value":"2"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Shared and Menu","description":"Enumerations used by net.ReadType and returned by Global.TypeID","items":{"item":[{"text":"Invalid type","key":"TYPE_NONE","value":"-1"},{"key":"TYPE_INVALID","value":"-1","deprecated":{"text":"Use TYPE_NONE","notag":"true"}},{"text":"nil","key":"TYPE_NIL","value":"0"},{"text":"boolean","key":"TYPE_BOOL","value":"1"},{"text":"light userdata","key":"TYPE_LIGHTUSERDATA","value":"2"},{"text":"number","key":"TYPE_NUMBER","value":"3"},{"text":"string","key":"TYPE_STRING","value":"4"},{"text":"table","key":"TYPE_TABLE","value":"5"},{"text":"function","key":"TYPE_FUNCTION","value":"6"},{"text":"userdata","key":"TYPE_USERDATA","value":"7"},{"text":"thread","key":"TYPE_THREAD","value":"8"},{"text":"Entity and entity sub-classes including Player, Weapon, NPC, Vehicle, CSEnt, and NextBot","key":"TYPE_ENTITY","value":"9"},{"text":"Vector","key":"TYPE_VECTOR","value":"10"},{"text":"Angle","key":"TYPE_ANGLE","value":"11"},{"text":"PhysObj","key":"TYPE_PHYSOBJ","value":"12"},{"text":"ISave","key":"TYPE_SAVE","value":"13"},{"text":"IRestore","key":"TYPE_RESTORE","value":"14"},{"text":"CTakeDamageInfo","key":"TYPE_DAMAGEINFO","value":"15"},{"text":"CEffectData","key":"TYPE_EFFECTDATA","value":"16"},{"text":"CMoveData","key":"TYPE_MOVEDATA","value":"17"},{"text":"CRecipientFilter","key":"TYPE_RECIPIENTFILTER","value":"18"},{"text":"CUserCmd","key":"TYPE_USERCMD","value":"19"},{"key":"TYPE_SCRIPTEDVEHICLE","value":"20","deprecated":{"text":"Leftover from GMod 13 Beta","notag":"true"}},{"text":"IMaterial","key":"TYPE_MATERIAL","value":"21"},{"text":"Panel","key":"TYPE_PANEL","value":"22"},{"text":"CLuaParticle","key":"TYPE_PARTICLE","value":"23"},{"text":"CLuaEmitter","key":"TYPE_PARTICLEEMITTER","value":"24"},{"text":"ITexture","key":"TYPE_TEXTURE","value":"25"},{"text":"bf_read","key":"TYPE_USERMSG","value":"26"},{"text":"ConVar","key":"TYPE_CONVAR","value":"27"},{"text":"IMesh","key":"TYPE_IMESH","value":"28"},{"text":"VMatrix","key":"TYPE_MATRIX","value":"29"},{"text":"CSoundPatch","key":"TYPE_SOUND","value":"30"},{"text":"pixelvis_handle_t","key":"TYPE_PIXELVISHANDLE","value":"31"},{"text":"dlight_t. Metatable of a Structures/DynamicLight","key":"TYPE_DLIGHT","value":"32"},{"text":"IVideoWriter","key":"TYPE_VIDEO","value":"33"},{"text":"File","key":"TYPE_FILE","value":"34"},{"text":"CLuaLocomotion","key":"TYPE_LOCOMOTION","value":"35"},{"text":"PathFollower","key":"TYPE_PATH","value":"36"},{"text":"CNavArea","key":"TYPE_NAVAREA","value":"37"},{"text":"IGModAudioChannel","key":"TYPE_SOUNDHANDLE","value":"38"},{"text":"CNavLadder","key":"TYPE_NAVLADDER","value":"39"},{"text":"CNewParticleEffect","key":"TYPE_PARTICLESYSTEM","value":"40"},{"text":"ProjectedTexture","key":"TYPE_PROJECTEDTEXTURE","value":"41"},{"text":"PhysCollide","key":"TYPE_PHYSCOLLIDE","value":"42"},{"text":"SurfaceInfo","key":"TYPE_SURFACEINFO","value":"43"},{"text":"Amount of TYPE_* enums","key":"TYPE_COUNT","value":"44"},{"text":"Metatable of a Color.","key":"TYPE_COLOR","value":"255","note":"This doesn't actually represent a unique type returned by Global.TypeID, but instead is a hack for networking colors with net.WriteType."}]}},"realms":["Server","Client","Menu"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by ENTITY:Use.\n\nNot to be confused with Enums/_USE used by Entity:SetUseType.","items":{"item":[{"key":"USE_OFF","value":"0"},{"key":"USE_ON","value":"1"},{"key":"USE_SET","value":"2"},{"key":"USE_TOGGLE","value":"3"}]}},"realms":["Server","Client"],"type":"Enum"},
{"enum":{"realm":"Client","description":"Enumerations used by render.RenderView inside of Structures/ViewData.","items":{"item":[{"text":"Default value","key":"VIEW_MAIN","value":"0"},{"text":"3D skybox","key":"VIEW_3DSKY","value":"1"},{"text":"Rendering for `_rt_Camera` base texture material (`func_monitor`, `info_camera_link`).","key":"VIEW_MONITOR","value":"2"},{"text":"Water reflection","key":"VIEW_REFLECTION","value":"3"},{"text":"Water refraction","key":"VIEW_REFRACTION","value":"4"},{"text":"Used by `script_intro` entity.","key":"VIEW_INTRO_PLAYER","value":"5"},{"text":"Used by `script_intro` entity.","key":"VIEW_INTRO_CAMERA","value":"6"},{"text":"Internally used for Global.ProjectedTexture and flashlight.","key":"VIEW_SHADOW_DEPTH_TEXTURE","value":"7"},{"text":"For SSAO depth. Can be accessed via render.GetResolvedFullFrameDepth.","key":"VIEW_SSAO","value":"8"}]}},"realms":["Client"],"type":"Enum"},
{"enum":{"realm":"Shared","description":"Enumerations used by NPC:SetCurrentWeaponProficiency and  \nNPC:GetCurrentWeaponProficiency.","items":{"item":[{"text":"The NPC will miss a large majority of their shots.","key":"WEAPON_PROFICIENCY_POOR","value":"0"},{"text":"The NPC will miss about half of their shots.","key":"WEAPON_PROFICIENCY_AVERAGE","value":"1"},{"text":"The NPC will sometimes miss their shots.","key":"WEAPON_PROFICIENCY_GOOD","value":"2"},{"text":"The NPC will rarely miss their shots.","key":"WEAPON_PROFICIENCY_VERY_GOOD","value":"3"},{"text":"The NPC will almost never miss their shots.","key":"WEAPON_PROFICIENCY_PERFECT","value":"4"}]}},"realms":["Server","Client"],"type":"Enum"}
]