spawnmenu.AddPropCategory
spawnmenu.AddPropCategory( string classname, string name, table contents, string icon, number id = 1000, number parentID = 0, string needsApp = "" )
Description
Used to add addon spawnlists to the spawnmenu tree. This function should be called within SANDBOX:PopulatePropMenu.
Addon spawnlists will not save to disk if edited.
You should never try to modify player customized spawnlists!
Arguments
3 table contents
A table of entries for the spawn menu. It must be numerically indexed.
Each member of the table is a sub-table containing a type member, and other members depending on the type.
New content types can be added via spawnmenu.AddContentType.
string type | Description | Other members |
---|---|---|
"header" | a simple header for organization | string text - The text that the header will display |
"model" | spawns a model where the player is looking | string model - The path to the model file number skin - The skin for the model to use (optional) string body - The bodygroups for the model (optional) number wide - The width of the spawnicon (optional) number tall - The height of the spawnicon (optional) |
"entity" | spawns an entity where the player is looking (appears in the Entities tab by default) |
string spawnname - The filename of the entity, for example "sent_ball" string nicename - The name of the entity to display string material - The icon to display, this should be set to entities/[sent_name].png boolean admin - Whether the entity is only spawnable by admins (optional) |
"vehicle" | spawns a vehicle where the player is looking (appears in the Vehicles tab by default) |
string spawnname - The filename of the vehicle string nicename - The name of the vehicle to display string material - The icon to display boolean admin - Whether the vehicle is only spawnable by admins (optional) |
"npc" | spawns an NPC where the player is looking (appears in the NPCs tab by default) |
string spawnname - The spawn name of the NPC string nicename - The name to display string material - The icon to display table weapon - A table of potential weapons (each a string) to give to the NPC. When spawned, one of these will be chosen randomly each time. boolean admin - Whether the NPC is only spawnable by admins (optional) |
"weapon" | When clicked, gives the player a weapon; When middle-clicked, spawns a weapon where the player is looking (appears in the Weapons tab by default) |
string spawnname - The spawn name of the weapon string nicename - The name to display string material - The icon to display boolean admin - Whether the weapon is only spawnable by admins (optional) |
5 number id = 1000
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.
6 number parentID = 0
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
).7 string needsApp = ""
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.Example
Create a spawn menu with two icons for each type
Output: