Revision Difference
ENTITY:PassesTriggerFilters#516131
<function name="PassesTriggerFilters" parent="ENTITY" type="hook">
<ishook>yes</ishook>
<description>
Polls whenever the entity should trigger the brush.
<warning>This hook is broken and will not work without code below</warning>
</description>
<realm>Server</realm>
<predicted>No</predicted>
<args>
<arg name="ent" type="Entity">The entity that is about to trigger.</arg>
</args>
<rets>
<ret name="" type="boolean">Should trigger or not.</ret>
</rets>
</function>
<example>
<description>How this is supposed to work internally</description>
<code>
ENT.Entities = {}
function ENT:IsTouchedBy( ent )
return self.Entities[ent]⤶
return table.HasValue( self.Entities, ent )⤶
end
function ENT:StartTouch( ent )
if ( !self:PassesTriggerFilters( ent ) ) then return end
self.Entities[ent] = true⤶
table.insert( self.Entities, ent )⤶
/* Code */
end
function ENT:Touch( ent )
if ( !self:PassesTriggerFilters( ent ) ) then return end
if ( !self:IsTouchedBy(ent) ) ) then self.Entities[ent] = true 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
self.Entities[ent] = nil⤶
table.RemoveByValue( self.Entities, ent )⤶
/* Code */
end
</code>
</example>