Updated VScript in Mapbase (markdown)

Blixibon 2020-06-11 23:49:54 -05:00
parent 7ab03f388b
commit 9b498a0186

@ -33,6 +33,7 @@ For more information on VScript itself, [click here](https://developer.valvesoft
* [CBaseCombatWeapon](VScript-in-Mapbase#CBaseCombatWeapon) * [CBaseCombatWeapon](VScript-in-Mapbase#CBaseCombatWeapon)
* [CBaseCombatCharacter](VScript-in-Mapbase#CBaseCombatCharacter) * [CBaseCombatCharacter](VScript-in-Mapbase#CBaseCombatCharacter)
* [CBasePlayer](VScript-in-Mapbase#CBasePlayer) * [CBasePlayer](VScript-in-Mapbase#CBasePlayer)
* [CHL2_Player](VScript-in-Mapbase#CHL2_Player)
* [CAI_BaseNPC](VScript-in-Mapbase#CAI_BaseNPC) * [CAI_BaseNPC](VScript-in-Mapbase#CAI_BaseNPC)
* [Hooks](VScript-in-Mapbase#CAI_BaseNPC-Hooks) * [Hooks](VScript-in-Mapbase#CAI_BaseNPC-Hooks)
* [CAI_BaseActor](VScript-in-Mapbase#CAI_BaseActor) * [CAI_BaseActor](VScript-in-Mapbase#CAI_BaseActor)
@ -101,6 +102,8 @@ This article will only list functions and classes introduced as a part of Mapbas
Some of Mapbase's script functions coincide with Source 2's script functions. For example, `CTakeDamageInfo` is available in Mapbase's VScript, but it's also available in Half-Life: Alyx's VScript in almost the exact same way. This is usually a matter of either inspiration or evolutionary convergence, but none of Mapbase's counterparts are actually from Source 2's code and they will still be listed here. Some of Mapbase's script functions coincide with Source 2's script functions. For example, `CTakeDamageInfo` is available in Mapbase's VScript, but it's also available in Half-Life: Alyx's VScript in almost the exact same way. This is usually a matter of either inspiration or evolutionary convergence, but none of Mapbase's counterparts are actually from Source 2's code and they will still be listed here.
**Note:** This only includes serverside script functions. Clientside scripting (e.g. through the `VScriptProxy` material proxy) may be limited to fewer/different functions. Use `script_help_client` in-game to get documentation for clientside VScript.
## Global Functions ## Global Functions
These are functions that can be accessed globally and without a class. These are functions that can be accessed globally and without a class.
@ -177,6 +180,11 @@ Root class of all server-side entities. This class was already exposed to VScrip
| *void* ClearEffects()| Clear effect(s) | | *void* ClearEffects()| Clear effect(s) |
| *void* SetEffects(int *flags*)| Set effect(s) | | *void* SetEffects(int *flags*)| Set effect(s) |
| *void* IsEffectActive(int *flags*)| Check if an effect is active | | *void* IsEffectActive(int *flags*)| Check if an effect is active |
| *Vector* EyeAngles()| Get eye pitch, yaw, roll as a vector |
| *bool* IsPlayer()| Returns true if this entity is a player. |
| *bool* IsNPC()| Returns true if this entity is a NPC. |
| *bool* IsCombatCharacter()| Returns true if this entity is a combat character (player or NPC). |
| *bool* IsWeapon()| Returns true if this entity is a weapon. |
*** ***
@ -258,6 +266,29 @@ The player entity. This class was already exposed to VScript, but it has new fea
| Signature | Description | | Signature | Description |
|:------------- | :-----| |:------------- | :-----|
| *handle* GetExpresser()| Get a handle for this player's expresser. | | *handle* GetExpresser()| Get a handle for this player's expresser. |
| *int* FragCount()| Gets the number of frags (kills) this player has in a multiplayer game. |
| *int* DeathCount()| Gets the number of deaths this player has had in a multiplayer game. |
| *bool* IsConnected()| Returns true if this player is connected. |
| *bool* IsDisconnecting()| Returns true if this player is disconnecting. |
| *bool* IsSuitEquipped()| Returns true if this player had the HEV suit equipped. |
| *int* GetArmor()| Gets the player's armor. |
| *void* SetArmor(*int* value)| Sets the player's armor. |
| *bool* FlashlightIsOn()| Returns true if the flashlight is on. |
| *void* FlashlightTurnOn()| Turns on the flashlight. |
| *void* FlashlightTurnOff()| Turns off the flashlight. |
***
### CHL2_Player
The HL2 player entity.
| Signature | Description |
|:------------- | :-----|
| *void* RemoveAuxPower(float *value*)| Removes from the player's available aux power. |
| *void* AddAuxPower(float *value*)| Adds to the player's available aux power. |
| *void* SetAuxPower(float *value*)| Sets the player's available aux power. |
| *float* GetAuxPower()| Gets the player's available aux power. |
| *float* GetFlashlightBattery()| Gets the energy available in the player's flashlight. If the legacy (aux power-based) flashlight is enabled, this returns the aux power. |
*** ***