Utils Common
scripts/vscripts/alyxlib/utils/common.lua
Global variables
| Name | Value |
|---|---|
Util |
table |
Methods
GetHandIdFromTip
Convert vr_tip_attachment from a game event [1,2] into a hand id [0,1] taking into account left handedness.
Parameters
vr_tip_attachment
1,2
Returns
- 0|1
FindKeyFromValue
This method is deprecated.
Attempt to find a key in tbl pointing to value.
Parameters
tbl
table
The table to search.value
any
The value to search for.
Returns
- unknown|nil
The key in tbl or nil if no value was found.
TableSize
Returns the size of any table.
Parameters
tbl
table
Returns
- integer
Delay
Delay some code.
Parameters
func
functiondelay(optional)
number
QAngleFromVector
Get a new QAngle from a Vector.
This simply transfers the raw values from one to the other.
Parameters
vec
Vector
Returns
- QAngle
CreateConstraint
Create a constraint between two entity handles.
Parameters
entity1
EntityHandle
First entity to attach.entity2
EntityHandle,nil
Second entity to attach. Set nil to attach to world.class(optional)
string
Class of constraint, default isphys_constraint.properties(optional)
table
Key/value property table.
Returns
- EntityHandle
CreateExplosion
Create a damaging explosion effect at a position.
Parameters
origin
VectorexplosionType(optional)
ExplosionTypemagnitude(optional)
numberradiusOverride(optional)
numberignoredEntity(optional)
EntityHandle,string
If the entity passed does not have a unique name, all entities with that name will be ignored.ignoredClass(optional)
string
Choose
Choose and return a random argument.
Parameters
...
Returns
- T
VectorFromString
Turns a string of up to three numbers into a vector.
Parameters
str
string
Should have a format of "x y z"
Returns
- Vector
Aliases
ExplosionType
| Value | Description |
|---|---|
"" |
"Default" |
"grenade" |
"Grenade" |
"molotov" |
"Molotov" |
"fireworks" |
"Fireworks" |
"gascan" |
"Gasoline Can" |
"gascylinder" |
"Pressurized Gas Cylinder" |
"explosivebarrel" |
"Explosive Barrel" |
"electrical" |
"Electrical" |
"emp" |
"EMP" |
"shrapnel" |
"Shrapnel" |
"smoke" |
"Smoke Grenade" |
"flashbang" |
"Flashbang" |
"tripmine" |
"Tripmine" |
"ice" |
"Ice" |
"none" |
"None" |
"custom" |
"Custom" |