-
Notifications
You must be signed in to change notification settings - Fork 0
New library: ents
The ents library provides functions for creating and finding entities in the game.
dounai_lib.ents.Create(classname)Creates an entity. This function does not spawn the entity, use entity:Spawn() for that.
Return: entity or nil
classname: string
dounai_lib.ents.CreateBrush(classname, origin, mins, maxs, keyvalues, ...)Creates an brush entity.
Return: entity or nil
classname: string
origin: vector
mins: vector
maxs: vector
keyvalues: string
dounai_lib.ents.CreateWithKeyValues(classname, origin, angles, model, keyvalues, ...)A advanced version of dounai_lib.ents.Create(), creates an entity with given values.
Return: entity or nil
classname: string
origin: vector (can be nil)
angles: angle
model: string
keyvalues: string
dounai_lib.ents.FindByClass(class)Gets all entities with the given class, supports wildcards.
Return: table
class: string
dounai_lib.ents.FindByName(name, first_result)Gets all entities with the given hammer targetname. If first_result is true, only the first found entity will be returns.
NOTE: Using first_result is always recommended as it will have better performance.
Return: table, entity or nil
name: string
first_result: bool
dounai_lib.ents.FindByPos(pos, class)Gets all entities with the same pos as given one. If class is set, only the entities with classname matches will be returns.
Return: table
pos: vector
class: string
dounai_lib.ents.GetAll()Returns a table of all existing entities.
Return: table
dounai_lib.ents.GetByHandle(handle)Gets a entity by a entity handle.
Return: entity or nil
handle: string
dounai_lib.ents.GetByIndex(index)
-- Wrapper
Entity(index)This is advanced version of original GetEntityByIndex(), and will automatic convert entity to it's proper type.
Return: entity, player, weapon and mathCounter or nil
dounai_lib.ents.GetWorld()Returns the worldspawn entity.
Return: entity