mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-24 04:37:57 +03:00
Updated VScript in Mapbase (markdown)
parent
dff04e0ae1
commit
4813c79a35
@ -26,6 +26,7 @@ For more information on VScript itself, [click here](https://developer.valvesoft
|
||||
* [Tutorials](VScript-in-Mapbase#Tutorials)
|
||||
* [Documentation](VScript-in-Mapbase#Documentation)
|
||||
* [Global Functions](VScript-in-Mapbase#Global-Functions)
|
||||
* [Math](VScript-in-Mapbase#Math)
|
||||
* [Entity Classes](VScript-in-Mapbase#Entity-Classes)
|
||||
* [CBaseEntity](VScript-in-Mapbase#CBaseEntity)
|
||||
* [Hooks](VScript-in-Mapbase#CBaseEntity-Hooks)
|
||||
@ -103,7 +104,7 @@ These are functions that can be accessed globally and without a class.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *handle* SpawnEntityFromKeyValues(string *className*, handle *keyValues)| Spawns an entity with the keyvalues in a CScriptKeyValues handle. |
|
||||
| *handle* SpawnEntityFromKeyValues(string *className*, handle *keyValues*)| Spawns an entity with the keyvalues in a CScriptKeyValues handle. |
|
||||
| *handle* GameOver(string *message*, float *delay*, float *fadeTime*, float *loadTime*, int *r*, int *g*, int *b*)| Ends the game and reloads the last save. |
|
||||
| *bool* MegaPhyscannonActive()| Checks if supercharged gravity gun mode is enabled. |
|
||||
| *void* printc(string *text*)| Version of print() which takes a color before the message. |
|
||||
@ -111,6 +112,43 @@ These are functions that can be accessed globally and without a class.
|
||||
| *CTakeDamageInfo* CreateDamageInfo(handle *inflictor*, handle *attacker*, Vector *force*, Vector *damagePos*, float *damage*, int *type*)| Creates damage info. |
|
||||
| *void* DestroyDamageInfo(CTakeDamageInfo *info*)| Destroys damage info. |
|
||||
|
||||
***
|
||||
|
||||
### Math
|
||||
These global functions are related to math or math-related classes.
|
||||
|
||||
#### Angle
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *float* ApproachAngle(float *target*, float *value*, float *speed*)| Returns an angle which approaches the target angle from the input angle with the specified speed. |
|
||||
| *float* AngleDiff(float *destAngle*, float *srcAngle*)| Returns the degrees difference between two yaw angles. |
|
||||
| *float* AngleDistance(float *next*, float *cur*)| Returns the distance between two angles. |
|
||||
| *float* AngleNormalize(float *angle*)| Clamps an angle to be in between -360 and 360. |
|
||||
| *float* AngleNormalizePositive(float *angle*)| Clamps an angle to be in between 0 and 360. |
|
||||
| *bool* AnglesAreEqual(float *a*, float *b*, float *tolerance*)| Checks if two angles are equal based on a given tolerance value. |
|
||||
|
||||
#### Vector
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *Vector* AngleVectors(Vector *angles*)| Turns an angle into a direction vector. |
|
||||
| *Vector* VectorAngles(Vector *direction*)| Turns a direction vector into an angle. |
|
||||
| *float* CalcSqrDistanceToAABB(Vector *mins*, Vector *maxs*, Vector *point*)| Returns the squared distance to a bounding box. |
|
||||
| *Vector* CalcClosestPointOnAABB(Vector *mins*, Vector *maxs*, Vector *point*)| Returns the closest point on a bounding box. |
|
||||
| *float* CalcDistanceToLine(Vector *point*, Vector *vLineA*, Vector *vLineB*)| Returns the distance to a line. |
|
||||
| *Vector* CalcClosestPointOnLine(Vector *point*, Vector *vLineA*, Vector *vLineB*)| Returns the closest point on a line. |
|
||||
| *float* CalcDistanceToLineSegment(Vector *point*, Vector *vLineA*, Vector *vLineB*)| Returns the distance to a line segment. |
|
||||
| *Vector* CalcClosestPointOnLineSegment(Vector *point*, Vector *vLineA*, Vector *vLineB*)| Returns the closest point on a line segment. |
|
||||
|
||||
#### Misc.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *float* Approach(*float* target, *float* value, *float* speed)| Returns a value which approaches the target value from the input value with the specified speed. |
|
||||
| *float* PredictedPosition(*CBaseEntity* target, *float* flTimeDelta)| Predicts what an entity's position will be in a given amount of time. |
|
||||
|
||||
***
|
||||
|
||||
## Entity Classes
|
||||
These are entity-based classes Mapbase exposes to VScript. Entities based on one class (e.g. `CAI_BaseNPC` for all NPCs) can use any function from that base class. `CBaseEntity` is the "root" class of all entities and all base classes, so any entity can use its functions.
|
||||
|
Loading…
x
Reference in New Issue
Block a user