Skip to content
Deyan Dobromirov edited this page Feb 20, 2021 · 54 revisions

What does this extension include?

Tracers with hit and ray configuration. The difference with wire rangers is that this is a dedicated class being initialized once and used as many times as it is needed, not creating an instance on every E2 tick and later wipe that instance out. It can extract every aspect of the trace result structure returned and it can be sampled locally ( origin and direction relative to entity or pos/dir/ang ) or globally ( entity is not available and pos/dir/ang are treated world-space data ). Also, it has better performance than the regular wire rangers.

What is this thing designed for?

The FTrace class consists of fast performing traces object-oriented instance that is designed to be @persistand initialized in expression first() || dupefinished(). That way you create the tracer instance once and you can use it as many times as you need, without creating a new one.

What console variables can be used to setup it?

wire_expression2_ftrace_skip > Contains trace generator blacklisted methods ( ex. GetSkin/GetModel/IsVehicle )
wire_expression2_ftrace_only > Contains trace generator whitelisted methods ( ex. GetSkin/GetModel/IsVehicle )
wire_expression2_ftrace_dprn > Stores the default status output messages streaming destination
wire_expression2_ftrace_enst > Contains flag that enables status output messages

How to create an instance then?

You can create a trace object by calling one of the dedicated creators newFTrace below whenever you prefer to attach it to an entity or you prefer not to use the feature. When sampled locally, it will use the attachment entity to orient its direction and length in pure Lua. You can also call the class constructor without an entity to make it world-space based. Remember that negating the trace length will result in negating the trace direction. That is used because the trace length must always be positive so the direction is reversed instead.

How can I configure the trace filter?

There are currently three types of trace filters in Garry's mod that you can put in the trace data.filter value. Utilizing the method getFilterMode will return the current tracer filter operation mode. The filter configuration is NIL by default

  1. Entity reference directly written to the filter. This entity is skipped by the trace This filter mode is activated by utilizing the setFilterEnt method by Ent as entity
  2. Entity sequential table ( array ) in the filter. Every item is skipped by the trace This filter mode is activated by utilizing the setFilterEar method by Ear as entity array
  3. Finction callback routine. This is slower but the most uiversal method available This filter mode is activated by utilizing the setFilterFnc method by Fnc as function
  4. User can also clear the filter entierly by utilizing the remFilter method

Do you have an example by any chance?

The internal type of the class is xft and internal expression type ftrace, so to create a tracer instance you can take a look at the example.

Can you show me the methods of the class?

The description of the API is provided in the table below.

        Instance creator          Out   Description 
newFTrace(image) image Returns flash tracer relative to the world by zero origin position, up direction vector and direction length distance
newFTrace(image) image Returns flash tracer relative to the world by zero origin position, up direction vector and length distance
newFTrace(image) image Returns flash tracer relative to the world by origin position, up direction vector and direction length distance
newFTrace(image,image) image Returns flash tracer relative to the world by origin position, up direction vector and length distance
newFTrace(image,image) image Returns flash tracer relative to the world by origin position, direction vector and direction length distance
newFTrace(image,image,image) image Returns flash tracer relative to the world by origin position, direction vector, length distance
noFTrace(image) image Returns invalid flash tracer object
           Class methods             Out   Description 
image:cpyFilterEar(image) image Copies other flash tracer entity array filtering data
image:cpyFilterFnc(image) image Copies other flash tracer function filtering data
image:dumpItem(image) image Dumps the flash tracer to the chat area by number identifier
image:dumpItem(image) image Dumps the flash tracer to the chat area by string identifier
image:dumpItem(image,image) image Dumps the flash tracer by number identifier in the specified area by first argument
image:dumpItem(image,image) image Dumps the flash tracer by string identifier in the specified area by first argument
image:getBase(image) image Returns the flash tracer base attachment entity if available
image:getChip(image) image Returns the flash tracer auto assigned expression chip entity
image:getCollideGroup(image) image Returns flash tracer trace collision group enums COLLISION_GROUP
image:getCopy(image) image Returns flash tracer copy instance of the current object
image:getCopy(image) image Returns flash tracer copy instance of the current object with other entity
image:getCopy(image,image) image Returns flash tracer copy instance of the current object with other entity and length
image:getCopy(image,image) image Returns flash tracer copy instance of the current object with other entity and origin
image:getCopy(image,image,image) image Returns flash tracer copy instance of the current object with other entity, origin and length
image:getCopy(image,image,image) image Returns flash tracer copy instance of the current object with other entity, origin and direction
image:getCopy(image,image,image,image) image Returns flash tracer copy instance of the current object with other entity, origin, direction and length
image:getCopy(image) image Returns flash tracer copy instance of the current object with other length
image:getCopy(image) image Returns flash tracer copy instance of the current object with other origin
image:getCopy(image,image) image Returns flash tracer copy instance of the current object with other origin and length
image:getCopy(image,image) image Returns flash tracer copy instance of the current object with other origin and direction
image:getCopy(image,image,image) image Returns flash tracer copy instance of the current object with other origin, direction and length
image:getDir(image) image Returns flash tracer direction vector
image:getDirLocal(image) image Returns flash tracer world direction vector converted to base attachment entity local axis
image:getDirLocal(image) image Returns flash tracer world direction vector converted to angle local axis
image:getDirLocal(image) image Returns flash tracer world direction vector converted to entity local axis
image:getDirWorld(image) image Returns flash tracer local direction vector converted to base attachment entity world axis
image:getDirWorld(image) image Returns flash tracer local direction vector converted to angle world axis
image:getDirWorld(image) image Returns flash tracer local direction vector converted to entity world axis
image:getDisplaceFlags(image) image Returns the flash tracer trace result DispFlags DISPSURF bitmask
image:getEar(image) image Returns the configuration used by the entity array filter
image:getEarID(image) image Returns the configuration used by the entity array filter as ID indices
image:getEarSZ(image) image Returns the flash tracer entity filter array size
image:getEntity(image) image Returns the flash tracer trace result Entity entity
image:getEnu(image) image Returns the configuration used by the entity unit filter
image:getFilterMode(image) image Returns flash tracerr filter working mode
image:getFraction(image) image Returns the flash tracer trace result Fraction in the interval [0-1] number
image:getFractionLS(image) image Returns the flash tracer trace result FractionLeftSolid in the interval [0-1] number
image:getFractionLen(image) image Returns the flash tracer trace result Fraction multiplied by its length distance number
image:getFractionLenLS(image) image Returns the flash tracer trace result FractionLeftSolid multiplied by its length distance number
image:getHitBox(image) image Returns the flash tracer trace result HitBox number
image:getHitContents(image) image Returns the flash tracer trace result hit surface Contents CONTENTS bitmask
image:getHitGroup(image) image Returns the flash tracer trace result HitGroup group ID number
image:getHitNormal(image) image Returns flash tracer trace result surface HitNormal vector
image:getHitPos(image) image Returns the flash tracer trace result HitPos location vector
image:getHitTexture(image) image Returns the flash tracer trace result HitTexture string
image:getLen(image) image Returns flash tracer length distance
image:getMask(image) image Returns flash tracer trace hit mask enums MASK
image:getMatType(image) image Returns the flash tracer trace result MatType material type number
image:getNormal(image) image Returns the flash tracer trace result Normal aim vector
image:getPhysicsBoneID(image) image Returns the flash tracer trace result PhysicsBone ID number
image:getPlayer(image) image Returns the flash tracer auto assigned expression chip player
image:getPos(image) image Returns flash tracer origin position
image:getPosLocal(image) image Returns flash tracer world origin position converted to base attachment entity local axis
image:getPosLocal(image) image Returns flash tracer world origin position converted to entity local axis
image:getPosLocal(image,image) image Returns flash tracer world origin position converted to position/angle local axis
image:getPosWorld(image) image Returns flash tracer local origin position converted to base attachment entity world axis
image:getPosWorld(image) image Returns flash tracer local origin position converted to entity world axis
image:getPosWorld(image,image) image Returns flash tracer local origin position converted to position/angle world axis
image:getStart(image) image Returns flash tracer trace start position sent to trace line
image:getStartPos(image) image Returns the flash tracer trace result StartPos vector
image:getStop(image) image Returns flash tracer trace stop position sent to trace line
image:getSurfPropsID(image) image Returns the flash tracer trace result SurfaceProps ID type number
image:getSurfPropsName(image) image Returns the flash tracer trace result SurfaceProps ID type name string
image:getSurfaceFlags(image) image Returns the flash tracer trace result SurfaceFlags SURF bitmask
image:insEar(image) image Inserts the argument in the entity array filter list
image:insEar(image) image Inserts the entities from the array in the filter list
image:insEar(image) image Inserts the entities from the table in the filter list
image:insEarID(image) image Inserts the entity ID in the filter list
image:insEarID(image) image Inserts the entity ID from the array in the filter list
image:insEarID(image) image Inserts the entity ID from the table in the filter list
image:insEnu(image) image Inserts the argument in the entity unit filter
image:insFncOnly(image,image) image Inserts an option to the function flash tracer internal only list
image:insFncOnly(image,image) image Inserts an option to the function flash tracer internal only list
image:insFncOnlyEnt(image) image Inserts the entity to the function flash tracer internal only list
image:insFncSkip(image,image) image Inserts an option to the function flash tracer internal ignore list
image:insFncSkip(image,image) image Inserts an option to the function flash tracer internal ignore list
image:insFncSkipEnt(image) image Inserts the entity to the function flash tracer internal ignore list
image:isAllSolid(image) image Returns the flash tracer trace result AllSolid flag
image:isHit(image) image Returns the flash tracer trace result Hit flag
image:isHitNoDraw(image) image Returns the flash tracer trace result HitNoDraw flag
image:isHitNonWorld(image) image Returns the flash tracer trace result HitNonWorld flag
image:isHitSky(image) image Returns the flash tracer trace result HitSky flag
image:isHitWorld(image) image Returns the flash tracer trace result HitWorld flag
image:isIgnoreWorld(image) image Returns the flash tracer trace IgnoreWorld flag
image:isStartSolid(image) image Returns the flash tracer trace result StartSolid flag
image:rayAim(image,image,image) image Aims the flash tracer ray at a given position using three numbers
image:rayAim(image) image Aims the flash tracer ray at a given position using a vector
image:rayAmend(image,image,image) image Amends the flash tracer ray direction using three numbers
image:rayAmend(image) image Amends the flash tracer ray direction using a vector
image:rayAmend(image,image) image Amends the flash tracer ray direction using vector and magnitude
image:rayDiv(image) image Contracts the flash tracer ray with a number
image:rayDiv(image,image,image) image Contracts the flash tracer ray each component individually using three numbers
image:rayDiv(image) image Contracts the flash tracer ray each component individually using a vector
image:rayMove(image) image Moves the flash tracer ray with its own direction and magnitude
image:rayMove(image) image Moves the flash tracer ray with its own direction and magnitude length
image:rayMove(image,image,image) image Moves the flash tracer ray with displacement as three numbers
image:rayMove(image) image Moves the flash tracer ray with displacement vector
image:rayMove(image,image) image Moves the flash tracer ray with direction vector, magnitude length
image:rayMul(image) image Expands the flash tracer ray with a number
image:rayMul(image,image,image) image Expands the flash tracer ray each component individually using three numbers
image:rayMul(image) image Expands the flash tracer ray each component individually using a vector
image:remBase(image) image Removes the base attachment entity of the flash tracer
image:remEar(image) image Removes all entities from the filter list
image:remEar(image) image Removes the specified entity from the filter list
image:remEarID(image) image Removes the specified entity by ID from the filter list
image:remEarN(image) image Removes an entity using the specified sequential number
image:remEnu(image) image Removes the configuration used by the entity unit filter
image:remFilter(image) image Removes the filter from the trace configuration
image:remFnc(image) image Removes all the options from the function flash tracer internal preferences
image:remFnc(image) image Removes the option from the function flash tracer internal preferences
image:remFncEnt(image) image Removes all the entities from the function flash tracer internal list
image:remFncOnly(image,image) image Removes the option from the function flash tracer internal only list
image:remFncOnly(image,image) image Removes the option from the function flash tracer internal only list
image:remFncOnlyEnt(image) image Removes all the entities from the function flash tracer internal only list
image:remFncOnlyEnt(image) image Removes the entity from the function flash tracer internal only list
image:remFncSkip(image,image) image Removes the option from the function flash tracer internal ignore list
image:remFncSkip(image,image) image Removes the option from the function flash tracer internal ignore list
image:remFncSkipEnt(image) image Removes all the entities from the function flash tracer internal ignore list
image:remFncSkipEnt(image) image Removes the entity from the function flash tracer internal ignore list
image:setBase(image) image Updates the flash tracer base attachment entity
image:setCollideGroup(image) image Updates flash tracer trace collision group enums COLLISION_GROUP
image:setDir(image,image,image) image Updates the flash tracer direction using three numbers
image:setDir(image) image Updates the flash tracer direction using an array
image:setDir(image) image Updates the flash tracer direction using a vector
image:setFilterEar(image) image Changes the filtering mode to entity array
image:setFilterEnu(image) image Changes the filtering mode to entity unit
image:setFilterFnc(image) image Changes the filtering mode to function routine
image:setIsIgnoreWorld(image) image Updates the flash tracer trace IgnoreWorld flag
image:setLen(image) image Updates flash tracer length distance
image:setMask(image) image Updates flash tracer trace hit mask enums MASK
image:setPos(image,image,image) image Updates the flash tracer origin position using three numbers
image:setPos(image) image Updates the flash tracer origin position using an array
image:setPos(image) image Updates the flash tracer origin position using a vector
image:smpLocal(image) image Samples the flash tracer and updates the trace result by base attachment entity local axis
image:smpLocal(image) image Samples the flash tracer and updates the trace result by base position, angle
image:smpLocal(image) image Samples the flash tracer and updates the trace result by entity position and forward vectors
image:smpLocal(image,image) image Samples the flash tracer and updates the trace result by entity position, angle
image:smpLocal(image,image) image Samples the flash tracer and updates the trace result by position, entity angle
image:smpLocal(image) image Samples the flash tracer and updates the trace result by position, base angle
image:smpLocal(image,image) image Samples the flash tracer and updates the trace result by position, angle
image:smpWorld(image) image Samples the flash tracer and updates the trace result by the world axis
image:smpWorld(image) image Samples the flash tracer and updates the trace result by entity position and angle forward
image:smpWorld(image) image Samples the flash tracer and updates the trace result by entity position and forward vectors
image:smpWorld(image,image) image Samples the flash tracer and updates the trace result by entity position, angle
image:smpWorld(image,image) image Samples the flash tracer and updates the trace result by position, entity angle
image:smpWorld(image) image Samples the flash tracer and updates the trace result by position vector and entity forward
image:smpWorld(image,image) image Samples the flash tracer and updates the trace result by position, angle
image:updEarSZ(image) image Performs flash tracer entity array filter list refresh
image:useFilterEar(image) image Uses other flash tracer entity array filtering by reference
image:useFilterEnu(image) image Uses other flash tracer entity unit filtering by reference
image:useFilterFnc(image) image Uses other flash tracer function filtering by reference
    General functions      Out   Description 
image:setFTrace(image) image Returns flash tracer relative to the entity by zero origin position, up direction vector and direction length distance
image:setFTrace(image) image Returns flash tracer relative to the entity by zero origin position, up direction vector and length distance
image:setFTrace(image) image Returns flash tracer relative to the entity by origin position, up direction vector and direction length distance
image:setFTrace(image,image) image Returns flash tracer relative to the entity by origin position, up direction vector and length distance
image:setFTrace(image,image) image Returns flash tracer relative to the entity by origin position, direction vector and direction length distance
image:setFTrace(image,image,image) image Returns flash tracer relative to the entity by origin position, direction vector, length distance
Clone this wiki locally