constraint.GetAllConstrainedEntities

From Garry's Mod
Revision as of 17:26, 26 February 2013 by Facepunch bot (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
 constraint.GetAllConstrainedEntities( )

Contents

Description

Returns a table of all entities recursively constrained to an entitiy.

Arguments

Entity ent

The entity to check

Returns

table

ents

Examples

Example

Adapted from stools/remover.lua

-- Remove this entity and everything constrained
function TOOL:RightClick( trace )
 if ( !IsValid( trace.Entity ) or trace.Entity:IsPlayer() ) then return false end
 -- Loop through all the entities in the system
 for _, Entity in pairs( constraint.GetAllConstrainedEntities( trace.Entity ) ) do
 DoRemoveEntity( Entity )
 end
 return true
end


Personal tools
Navigation