Committed.
New functions list:
Code:
#where R is a ranger trace
R:pos() #Returns the position of the trace. This function is different from R:position() in the way that R:pos() works like Lua's trace and R:position() returns the positionLeftSolid() if it was started inside the world.)
R:fraction() # Returns a number between 0-1 (this is like the percentage of the distance between the start/endpos of the trace that the trace went. Hard to explain)
R:hitWorld() #Returns 1 if the trace hit the world, else 0
R:hitSky() #Returns 1 if the trace hit the skybox, else 0
R:positionLeftSolid() #Returns the position at which it left the world, if the trace was started inside the world. If it was started inside the world, this function returns the same position as R:position().
R:fractionLeftSolid() #Same as R:fraction, but indicating the distance to the left solid position instead of the distance to the hitpos
R:startSolid() #Returns 1 if the trace started inside the world, else 0
R:matType() #Returns the material type (Can be used to see if a ranger hit water, for example)
R:hitGroup() #If aimed at a player or bot (Possibly also works for NPCs, haven't tested), it returns the hit "group" that the trace hit (ie "stomach, head, left hand, right leg" etc)
R:toTable() #Converts the trace data into an E2-style table. Remember that this returns the raw data, so for matType and hitGroup, I recommend using the functions instead of this table.
I also made rangerFilter cost A LOT if you spam it, in order to prevent abuse (the function could previously be used to pretty much lag any server to death almost instantly - Now it'll just crash your E2 of tick quota.)
We can has wiki update: http://wiki.garrysmod.com/?title=Wir...uilt-In_Ranger
Bookmarks