Garry's Mod Wiki

Revision Difference

ENTITY:PassesTriggerFilters#514608

<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 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⤶ </code>⤶ ⤶ </example>