Garry's Mod Wiki

ENT

Description

Information about the ENT structure, which represents a Scripted Entity class definition.

To learn more about scripted entities, see this page.

See also ENTITY Hooks for a list of events scripted entities can have. See Custom Entity Fields for a list of events and fields all entities can have.

While some of the fields may be serverside or clientside only, it is recommended to provide them on both so addons could use their values.

Values defined in ENT table can't be changed per instance. Initialize default values in ENTITY:Initialize or other hook.

Members

string Base
The base entity to derive from. This must be a valid Lua entity
string Type
Type of the entity. This must be one of these:
  • anim
  • brush
  • point
  • ai
  • nextbot
  • filter

See Scripted Entities for a more detailed explanation of what each one is.

string ClassName
The class name of the entity (File or folder name of your entity). This is set automatically after the entity file is loaded.
string ClassNameOverride
If set, overrides the classname of the SWEP.
string Folder
The folder from where the entity was loaded. This should always be "entity/ent_myentity", regardless whether your entity is stored as a file, or multiple files in a folder. This is set automatically before the entity file is loaded.
boolean AutomaticFrameAdvance
Set this to true if your entity has animations. You should also apply changes to the ENTITY:Think function from the example on that page.

Default: false

string Category
Spawnmenu category to put the entity into

Default: "Other"

boolean Spawnable
Whether this entity should be displayed and is spawnable in the spawn menu

Default: false

boolean Editable
Whether the entity supports Editing. See Editable Entities for more info.

Default: false

boolean AdminOnly
Whether or not only admins can spawn the entity from their spawn menu

Default: false

string PrintName
Nice name of the entity to appear in the spawn menu

Default: ""

string Author
The author of the entity

Default: ""

string Contact
The contacts of the entity creator

Default: ""

string Purpose
The purpose of the entity creation

Default: ""

string Instructions
How to use your entity

Default: ""

number RenderGroup
The entity's render group, see RENDERGROUP enum. If unset, the engine will decide the render group based on the entity's model.
boolean WantsTranslucency
If set and RenderGroup is not, will switch the render group to RENDERGROUP_BOTH when appropriate.

Default: false

boolean DisableDuplicator
Disable the ability for players to duplicate this entity.

Default: false

string ScriptedEntityType
Sets the spawnmenu content icon type for the entity, used by spawnmenu in the Sandbox-derived gamemodes. See spawnmenu.AddContentType for more information.

Default: ""

boolean DoNotDuplicate
If set, the entity will not be duplicated via the built-in duplicator system.

Default: false

string IconOverride
If set, overrides the icon path to be displayed in the Spawnmenu for this entity.

Like many functions, this expects a path relative to the materials/ folder, do not include materials/ in the provided string.

Default: "entities/<ClassName>.png"

boolean PhysgunDisabled
If set, the entity forbid physgun interaction.

Default: false

number PhysicsSolidMask
If set, a bitflag for the physics solidity of the entity. See CONTENTS enum.

Can be used to make the entity pass though certain otherwise solid meshes, such as grates, or special clip brushes.

This only works for nextbot, anim and ai type SENTs.
This was recently added in version (2024.07.20). It might only be available on the Dev Branch right now.

Default: nil

boolean PhysicsSounds
For anim type entities, if set, enables physics collision sounds.
This was recently added in version (2024.07.20). It might only be available on the Dev Branch right now.

Default: false