Skip to content
Deyan Dobromirov edited this page Jun 13, 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 XFT:useUnit() methods after adding the entity.
  2. Entity sequential table ( array ) in the filter. Every item is skipped by the trace This filter mode is activated by utilizing the XFT:useArray() after filling the entity array.
  3. Finction callback routine. This is slower but the most uiversal method available This filter mode is activated by utilizing the XFT:useAction() method to enable the routine.
  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:addEntHitOnly(image) image Deprecated. Please use the alias putActionOnlyEnt(xft:e) instead !
image:addEntHitSkip(image) image Deprecated. Please use the alias putActionSkipEnt(xft:e) instead !
image:addHitOnly(image,image) image Deprecated. Please use the alias putActionOnly(xft:sn) instead !
image:addHitOnly(image,image) image Deprecated. Please use the alias putActionOnly(xft:ss) instead !
image:addHitSkip(image,image) image Deprecated. Please use the alias putActionSkip(xft:sn) instead !
image:addHitSkip(image,image) image Deprecated. Please use the alias putActionSkip(xft:ss) instead !
image:cpyAction(image) image Copies other flash tracer function filtering data
image:cpyArray(image) image Copies other flash tracer entity array 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:getArray(image) image Returns the configuration used by the entity array filter
image:getArrayID(image) image Returns the configuration used by the entity array filter as ID indices
image:getArraySZ(image) image Returns the flash tracer entity filter array size
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:getContents(image) image Returns the flash tracer trace result hit surface Contents CONTENTS bitmask
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:getDispFlags(image) image Returns the flash tracer trace result DispFlags DISPSURF bitmask
image:getDisplaceFlags(image) image Deprecated. Please use the alias getDispFlags(xft:) instead !
image:getDisplacementFlags(image) image Deprecated. Please use the alias getDispFlags(xft:) instead !
image:getEntity(image) image Returns the flash tracer trace result Entity entity
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 Deprecated. Please use the alias getContents(xft:) instead !
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:getMode(image) image Returns flash tracer filter working mode. Function FN , array AR, entity EU, none NA, invalid XX
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 Deprecated. Please use the alias getSurfacePropsID(xft:) instead !
image:getSurfPropsName(image) image Deprecated. Please use the alias getSurfacePropsName(xft:) instead !
image:getSurfaceFlags(image) image Returns the flash tracer trace result SurfaceFlags SURF bitmask
image:getSurfacePropsID(image) image Returns the flash tracer trace result SurfaceProps ID type number
image:getSurfacePropsName(image) image Returns the flash tracer trace result SurfaceProps ID type name string
image:getUnit(image) image Returns the configuration used by the entity unit filter
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:putActionOnly(image,image) image Inserts an option to the function flash tracer internal only list
image:putActionOnly(image,image) image Inserts an option to the function flash tracer internal only list
image:putActionOnlyEnt(image) image Inserts the entity to the function flash tracer internal only list
image:putActionSkip(image,image) image Inserts an option to the function flash tracer internal ignore list
image:putActionSkip(image,image) image Inserts an option to the function flash tracer internal ignore list
image:putActionSkipEnt(image) image Inserts the entity to the function flash tracer internal ignore list
image:putArray(image) image Inserts the argument in the entity array filter list
image:putArray(image) image Inserts the entities from the array in the filter list
image:putArray(image) image Inserts the entities from the table in the filter list
image:putArrayID(image) image Inserts the entity ID in the filter list
image:putArrayID(image) image Inserts the entity ID from the array in the filter list
image:putArrayID(image) image Inserts the entity ID from the table in the filter list
image:putUnit(image) image Inserts the argument in the entity unit filter
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:remAction(image) image Removes all the options from the function flash tracer internal preferences
image:remAction(image) image Removes the option from the function flash tracer internal preferences
image:remActionEnt(image) image Removes all the entities from the function flash tracer internal list
image:remActionOnly(image,image) image Removes the option from the function flash tracer internal only list
image:remActionOnly(image,image) image Removes the option from the function flash tracer internal only list
image:remActionOnlyEnt(image) image Removes all the entities from the function flash tracer internal only list
image:remActionOnlyEnt(image) image Removes the entity from the function flash tracer internal only list
image:remActionSkip(image,image) image Removes the option from the function flash tracer internal ignore list
image:remActionSkip(image,image) image Removes the option from the function flash tracer internal ignore list
image:remActionSkipEnt(image) image Removes all the entities from the function flash tracer internal ignore list
image:remActionSkipEnt(image) image Removes the entity from the function flash tracer internal ignore list
image:remArray(image) image Removes all entities from the filter list
image:remArray(image) image Removes the specified entity from the filter list
image:remArrayID(image) image Removes the specified entity by ID from the filter list
image:remArrayN(image) image Removes an entity using the specified sequential number
image:remBase(image) image Removes the base attachment entity of the flash tracer
image:remEntHit(image) image Deprecated. Please use the alias remActionEnt(xft:) instead !
image:remEntHitOnly(image) image Deprecated. Please use the alias remActionOnlyEnt(xft:) instead !
image:remEntHitOnly(image) image Deprecated. Please use the alias remActionOnlyEnt(xft:e) instead !
image:remEntHitSkip(image) image Deprecated. Please use the alias remActionSkipEnt(xft:) instead !
image:remEntHitSkip(image) image Deprecated. Please use the alias remActionSkipEnt(xft:e) instead !
image:remFilter(image) image Removes the filter from the trace configuration
image:remHit(image) image Deprecated. Please use the alias remAction(xft:) instead !
image:remHit(image) image Deprecated. Please use the alias remAction(xft:s) instead !
image:remHitOnly(image,image) image Deprecated. Please use the alias remActionOnly(xft:sn) instead !
image:remHitOnly(image,image) image Deprecated. Please use the alias remActionOnly(xft:ss) instead !
image:remHitSkip(image,image) image Deprecated. Please use the alias remActionSkip(xft:sn) instead !
image:remHitSkip(image,image) image Deprecated. Please use the alias remActionSkip(xft:ss) instead !
image:remUnit(image) image Removes the configuration used by the entity unit filter
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: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:updArraySZ(image) image Performs flash tracer entity array filter list refresh
image:useAction(image) image Changes the filtering mode to function routine
image:useAction(image) image Uses other flash tracer function filtering by reference
image:useArray(image) image Changes the filtering mode to entity array
image:useArray(image) image Uses other flash tracer entity array filtering by reference
image:useUnit(image) image Changes the filtering mode to entity unit
image:useUnit(image) image Uses other flash tracer entity unit 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