Revision Difference
Structures/TOOL#517083
<cat>struct</cat>
<structure>
<description>
The TOOL table is used in Sandbox tool creation. You can find a list of callbacks on the page and a list of methods on the page. Do note that some of the fields below have no effect on server-side operations.
The tool information box drawn on the HUD while your tool is selected has 2 values that are set by <page>language.Add</page>.&lt;br /&gt;
"tool.[tool mode].name" - The tool name (Note this is NOT the same as TOOL.Name)&lt;br /&gt;
"tool.[tool mode].desc" - The tool description
Ensure that all tool file names are entirely lowercase. Including capital letters can lead to unintended behavior.
</description>
<fields>{{StructureField|boolean|AddToMenu|If set to false, the tool won't be added to the tool menu and players will have to access it by other means.|true</fields>⤶
⤶
</structure>⤶
⤶
⤶
{{StructureField|string|Category|The tool menu category under which the tool should be listed.|"New Category"}}⤶
{{StructureField|string|Command|The console command to execute upon being selected in the Q menu.|"gmod_toolmode [tool]"}}{{StructureField|string|Name|The name of the tool in the Q menu.
Common practice is to set this to "#tool.[lua filename].name" to match the name displayed in the tool information box.|"#[tool mode]"⤶
}}
<item name="ClientConVar" type="table">A key-value ( convar name-default value ) table containing the client-side convars to create. All convars will be prefixed with the filename of the tool.⤶
<fields>⤶
<item name="AddToMenu" type="boolean" default="true">If set to false, the tool won't be added to the tool menu and players will have to access it by other means.</item>⤶
⤶
<item name="Category" type="string" default="\u0022New Category\u0022">The tool menu category under which the tool should be listed.</item>⤶
⤶
<item name="Command" type="string" default="\u0022gmod_toolmode [tool]\u0022">The console command to execute upon being selected in the Q menu.</item>⤶
<item name="Name" type="string" default="\u0022#[tool mode]\u0022">The name of the tool in the Q menu.
Common practice is to set this to "#tool.[lua filename].name" to match the name displayed in the tool information box.</item>⤶
⤶
<item name="ClientConVar" type="table">A key-value ( convar name-default value ) table containing the client-side convars to create. All convars will be prefixed with the filename of the tool.
You can later use <page>Tool:GetClientNumber</page> or <page>Tool:GetClientInfo</page> to retrieve these values.</item>
<item name="ServerConVar" type="table">Same as above, but created server-side instead.</item>
<item name="BuildCPanel" type="function">The function that is called to build the context menu for your tool. It has one argument, namely the context menu's base panel to which all of your custom panels are going to be parented to.
While it might sound like a hook, it isn't - you won't receive a self argument inside the function.</item>
<item name="Information" type="table">Allows you to override the tool usage information shown when the tool is equipped.
See <page>Tool Information Display</page> for more information.</item>
<item name="Mode" type="string">Class name of the tool. (name of the .lua file)
This is set automatically.</item>
⤶
}} </fields>⤶
⤶
</structure>⤶
⤶