Updated VScript in Mapbase (markdown)

Blixibon 2020-06-01 09:37:10 -05:00
parent acfb4c6308
commit af2aede9b8

@ -41,8 +41,11 @@ For more information on VScript itself, [click here](https://developer.valvesoft
* [CPropVehicle](VScript-in-Mapbase#CPropVehicle) * [CPropVehicle](VScript-in-Mapbase#CPropVehicle)
* [CPropVehicleDriveable](VScript-in-Mapbase#CPropVehicleDriveable) * [CPropVehicleDriveable](VScript-in-Mapbase#CPropVehicleDriveable)
* [CFourWheelVehiclePhysics](VScript-in-Mapbase#CFourWheelVehiclePhysics) * [CFourWheelVehiclePhysics](VScript-in-Mapbase#CFourWheelVehiclePhysics)
* [CBaseFilter](VScript-in-Mapbase#CBaseFilter)
* [CGlobalState](VScript-in-Mapbase#CGlobalState) * [CGlobalState](VScript-in-Mapbase#CGlobalState)
* [CMapbaseSystem](VScript-in-Mapbase#CMapbaseSystem) * [CMapbaseSystem](VScript-in-Mapbase#CMapbaseSystem)
* [CTakeDamageInfo](VScript-in-Mapbase#CTakeDamageInfo)
* [CGameTrace](VScript-in-Mapbase#CGameTrace)
* [CLogicExternalData](VScript-in-Mapbase#CLogicExternalData) * [CLogicExternalData](VScript-in-Mapbase#CLogicExternalData)
* [Modified VScript Classes](VScript-in-Mapbase#Modified-VScript-Classes) * [Modified VScript Classes](VScript-in-Mapbase#Modified-VScript-Classes)
* [CBaseEntity](VScript-in-Mapbase#CBaseEntity) * [CBaseEntity](VScript-in-Mapbase#CBaseEntity)
@ -66,6 +69,7 @@ Some features from Valve's games are not available in Mapbase's implementation o
* Notable singletons which are in Mapbase's implementation: * Notable singletons which are in Mapbase's implementation:
* `Entities` * `Entities`
* `Convars` * `Convars`
* `NetProps`
* It is currently not possible to use in-game documentation methods, such as `script_help`. * It is currently not possible to use in-game documentation methods, such as `script_help`.
* In the source code, the following `IScriptVM` functions are currently unsupported: `ConnectDebugger`, `DisconnectDebugger`, `AddSearchPath`, `Frame`, `DumpState`, `SetOutputCallback`, `SetErrorCallback` * In the source code, the following `IScriptVM` functions are currently unsupported: `ConnectDebugger`, `DisconnectDebugger`, `AddSearchPath`, `Frame`, `DumpState`, `SetOutputCallback`, `SetErrorCallback`
@ -95,9 +99,12 @@ These are functions that can be accessed globally and without a class.
| *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. | | *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. | | *bool* MegaPhyscannonActive()| Checks if supercharged gravity gun mode is enabled. |
| *void* printc(string *text*)| Version of print() which takes a color before the message. |
| *void* printcl(string *text*)| Version of printl() which takes a color before the message. |
## New VScript Classes ## New VScript Classes
These are classes Mapbase exposes to VScript. These are classes Mapbase exposes to VScript. These are listed relative to L4D2 and Portal 2's script functions; some of Mapbase's script functions coincide with Source 2 script functions (e.g. `CTakeDamageInfo` is also exposed to Half-Life: Alyx's VScript in the same way), but they will still be listed here (keep in mind they aren't actually from Source 2's code).
*** ***
@ -380,6 +387,19 @@ Handler for four-wheel vehicle physics. Can be accessed through `GetPhysics()` o
| *float* GetSteering()| Gets the steeering. | | *float* GetSteering()| Gets the steeering. |
| *float* GetSteeringDegrees()| Gets the degrees of steeering. | | *float* GetSteeringDegrees()| Gets the degrees of steeering. |
***
### CBaseFilter
All entities which could be used as filters.
| Signature | Description |
|:------------- | :-----|
| *bool* PassesFilter(handle *caller*, handle *entity*)| Check if the given caller and entity pass the filter. |
| *bool* PassesDamageFilter(handle *caller*, handle *info*)| Check if the given caller and damage info pass the damage filter. |
| *bool* PassesFinalDamageFilter(handle *caller*, handle *info*)| Used by filter_damage_redirect to distinguish between standalone filter calls and actually damaging an entity. Returns true if there's no unique behavior. |
| *bool* BloodAllowed(handle *caller*, handle *info*)| Check if the given caller and damage info allow for the production of blood. |
| *bool* DamageMod(handle *caller*, handle *info*)| Mods the damage info with the given caller. |
*** ***
*** ***
@ -408,6 +428,56 @@ All-purpose Mapbase system primarily used for map-specific files. Can be accesse
| *void* LoadTalkerFile(string *fileName*)| Loads a custom talker file. | | *void* LoadTalkerFile(string *fileName*)| Loads a custom talker file. |
| *void* LoadActbusyFile(string *fileName*)| Loads a custom actbusy file. | | *void* LoadActbusyFile(string *fileName*)| Loads a custom actbusy file. |
***
***
### CTakeDamageInfo
Damage information handler.
| Signature | Description |
|:------------- | :-----|
| *handle* GetInflictor()| Gets the inflictor. |
| *void* SetInflictor(handle *target*)| Sets the inflictor. |
| *handle* GetWeapon()| Gets the weapon. |
| *void* SetWeapon(handle *target*)| Sets the weapon. |
| *handle* GetAttacker()| Gets the attacker. |
| *void* SetAttacker(handle *target*)| Sets the attacker. |
| *float* GetDamage()| Gets the damage. |
| *void* SetDamage(handle *damage*)| Sets the damage. |
| *float* GetMaxDamage()| Gets the max damage. |
| *void* SetMaxDamage(float *damage*)| Sets the max damage. |
| *void* ScaleDamage(float *scale*)| Scales the damage. |
| *void* AddDamage(float *damage*)| Adds to the damage. |
| *void* SubtractDamage(float *damage*)| Removes from the damage. |
| *float* GetDamageBonus()| Gets the damage bonus. |
| *void* SetDamageBonus(float *damage*)| Sets the damage bonus. |
| *float* GetBaseDamage()| Gets the base damage. |
| *bool* BaseDamageIsValid()| Checks if the base damage is valid. |
| *Vector* GetDamageForce()| Gets the damage force. |
| *void* SetDamageForce(Vector *force*)| Sets the damage force. |
| *void* ScaleDamageForce(float *scale*)| Scales the damage force. |
| *Vector* GetDamagePosition()| Gets the damage position. |
| *void* SetDamagePosition(Vector *position*)| Sets the damage position. |
| *Vector* GetReportedPosition()| Gets the reported damage position. |
| *void* SetReportedPosition(Vector *position*)| Sets the reported damage position. |
| *int* GetDamageType()| Gets the damage type. |
| *void* SetDamageType(int *type*)| Sets the damage type. |
| *void* AddDamageType(int *type*)| Adds to the damage type. |
| *int* GetDamageCustom()| Gets the damage custom. |
| *void* SetDamageCustom(int *custom*)| Sets the damage custom. |
| *int* GetDamageStats()| Gets the damage stats. |
| *void* SetDamageStats(int *stats*)| Sets the damage stats. |
| *bool* IsForceFriendlyFire()| Gets force friendly fire. |
| *void* SetForceFriendlyFire(bool *toggle*)| Sets force friendly fire. |
| *int* GetAmmoType()| Gets the ammo type. |
| *void* SetAmmoType(int *type*)| Sets the ammo type. |
| *string* GetAmmoName()| Gets the ammo type name. |
| *int* GetPlayerPenetrationCount()| Gets the player penetration count. |
| *void* SetPlayerPenetrationCount(int *count*)| Sets the player penetration count. |
| *bool* GetDamagedOtherPlayers()| Gets whether other players have been damaged. |
| *void* SetDamagedOtherPlayers(bool *toggle*)| Sets whether other players have been damaged. |
***
*** ***
### CLogicExternalData ### CLogicExternalData
@ -437,7 +507,9 @@ Root class of all server-side entities.
| *bool* IsVisible(Vector *target*)| Check if the specified position can be visible to this entity. | | *bool* IsVisible(Vector *target*)| Check if the specified position can be visible to this entity. |
| *bool* IsEntVisible(handle *target*)| Check if the specified entity can be visible to this entity. | | *bool* IsEntVisible(handle *target*)| Check if the specified entity can be visible to this entity. |
| *bool* IsVisibleWithMask(Vector *target*, int *traceMask*)| Check if the specified position can be visible to this entity with a specific trace mask. | | *bool* IsVisibleWithMask(Vector *target*, int *traceMask*)| Check if the specified position can be visible to this entity with a specific trace mask. |
| *int* TakeDamage(handle *info*)| Apply damage to this entity with a given info handle |
| *int* Classify()| Get Class_T class ID | | *int* Classify()| Get Class_T class ID |
| *string* GetKeyValue(string *key*)| Get a keyvalue |
| *int* GetSpawnFlags()| Get spawnflags | | *int* GetSpawnFlags()| Get spawnflags |
| *void* AddSpawnFlags()| Add spawnflag(s) | | *void* AddSpawnFlags()| Add spawnflag(s) |
| *void* RemoveSpawnFlags()| Remove spawnflag(s) | | *void* RemoveSpawnFlags()| Remove spawnflag(s) |