From af2aede9b8e6d2f03029aa1516de1be366f34bd0 Mon Sep 17 00:00:00 2001 From: Blixibon Date: Mon, 1 Jun 2020 09:37:10 -0500 Subject: [PATCH] Updated VScript in Mapbase (markdown) --- VScript-in-Mapbase.md | 74 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/VScript-in-Mapbase.md b/VScript-in-Mapbase.md index 67deed9..530485a 100644 --- a/VScript-in-Mapbase.md +++ b/VScript-in-Mapbase.md @@ -41,8 +41,11 @@ For more information on VScript itself, [click here](https://developer.valvesoft * [CPropVehicle](VScript-in-Mapbase#CPropVehicle) * [CPropVehicleDriveable](VScript-in-Mapbase#CPropVehicleDriveable) * [CFourWheelVehiclePhysics](VScript-in-Mapbase#CFourWheelVehiclePhysics) + * [CBaseFilter](VScript-in-Mapbase#CBaseFilter) * [CGlobalState](VScript-in-Mapbase#CGlobalState) * [CMapbaseSystem](VScript-in-Mapbase#CMapbaseSystem) + * [CTakeDamageInfo](VScript-in-Mapbase#CTakeDamageInfo) + * [CGameTrace](VScript-in-Mapbase#CGameTrace) * [CLogicExternalData](VScript-in-Mapbase#CLogicExternalData) * [Modified VScript Classes](VScript-in-Mapbase#Modified-VScript-Classes) * [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: * `Entities` * `Convars` + * `NetProps` * 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` @@ -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* 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. | +| *void* printcl(string *text*)| Version of printl() which takes a color before the message. | + ## 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* 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* 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 @@ -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* 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. | +| *int* TakeDamage(handle *info*)| Apply damage to this entity with a given info handle | | *int* Classify()| Get Class_T class ID | +| *string* GetKeyValue(string *key*)| Get a keyvalue | | *int* GetSpawnFlags()| Get spawnflags | | *void* AddSpawnFlags()| Add spawnflag(s) | | *void* RemoveSpawnFlags()| Remove spawnflag(s) |