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