ENTITY:PassesTriggerFilters

From Garry's Mod
Jump to: navigation, search
 ENTITY:PassesTriggerFilters( )

Contents

Description

Polls whenever the entity should trigger the brush.

WARNING This hook is broken and will not work without code below

Arguments

Entity ent

The entity that is about to trigger.

Returns

boolean

Should trigger or not.

Examples

Example

How this is supposed to work internally

ENT.Entities = {}

function ENT:IsTouchedBy( ent )
	return table.HasValue( self.Entities, ent )
end

function ENT:StartTouch( ent )
	if ( !self:PassesTriggerFilters( ent ) ) then return end
	table.insert( self.Entities, ent )

	/* Code */
end

function ENT:Touch( ent )
	if ( !self:PassesTriggerFilters( ent ) ) then return end
	if ( !table.HasValue( ent ) ) then table.insert( self.Entities, ent ) end

	/* Code */
end

function ENT:EndTouch( ent )
	if ( !self:IsTouchedBy( ent ) ) then return end
	table.RemoveByValue( self.Entities, ent )

	/* Code */
end


Personal tools
Navigation