VSLib
Simple, powerful VScript Library for L4D2
|
Provides many helpful entity functions. More...
Private Member Functions | |
bool | IsEntityValid () |
int | GetHealth () |
int | GetRawHealth () |
void | Hurt (int value, int dmgtype=0, string weapon="", Entity attacker=null, double radius=64.0) |
void | HurtAround (int value, int dmgtype=0, string weapon="", Entity attacker=null, double radius=64.0, object[] ignoreEntities=null) |
void | Input (string input, string value="", double delay=0, Entity activator=null) |
void | Break () |
void | SetKeyValue (string key, object value) |
void | HurtTime (int value, int dmgtype, double interval, double time, string weapon="", Entity attacker=null, double radius=64.0) |
void | SetRawHealth (int value) |
void | SetHealth (int value) |
void | SetMaxHealth (int value) |
void | Vomit () |
string | GetClassname () |
void | SetGlobalName (string name) |
void | SetParentName (string name) |
void | SetSpeed (double value) |
void | SetRenderEffects (int value) |
void | SetRenderMode (int value) |
void | SetNextThinkTime (double value) |
void | SetEffects (int value) |
void | SetColor (int red, int green, int blue, int alpha) |
void | SetVisible (bool canSee) |
void | SetModelIndex (int value) |
void | SetResponseContext (object value) |
void | SetTarget (string value) |
void | SetDamageFilter (object value) |
void | SetShadowCastDistance (double value) |
void | Push (Vector vec) |
void | Spin (Vector vec) |
void | SetGravity (double value) |
void | SetFriction (double value) |
Vector | GetVelocity () |
void | SetVelocity (Vector vec) |
void | SetVelocityKV (object vec) |
void | SetBaseVelocity (object vec) |
void | SetAngularVelocity (object vec) |
void | SetWaterLevel (int lvl) |
void | SetSpawnFlags (int flags) |
QAngle | GetEyeAngles () |
object | GetBaseEntity () |
int | GetIndex () |
Vector | GetLocation () |
void | SetLocation (vec) |
void | SetPosition (double x, double y, double z) |
Vector | GetPosition () |
void | Teleport (Vector vec) |
void | TeleportTo (Entity otherEntity) |
int | GetTeam () |
void | Kill () |
QAngle | GetAngles () |
void | SetAngles (double x, double y, double z) |
void | KillHierarchy () |
void | Use (Entity otherEntity) |
void | UseOther (Entity otherEntity) |
void | UsedByOther (Entity otherEntity) |
void | SetAlpha (int value) |
void | InputColor (int red, int green, int blue) |
void | AttachOther (Entity otherEntity, bool teleportOther) |
void | SetAttachmentPoint (Entity otherEntity, string attachment, bool bShouldMaintainOffset) |
void | RemoveAttached (Entity otherEntity) |
Vector | GetEyePosition () |
Entity | GetLookingEntity () |
int | GetBaseIndex () |
void | KillDelayed (double seconds) |
Vector | GetLookingLocation () |
void | Ignite (double time) |
Entity | AttachParticle (string particleName, double duration) |
bool | IsPlayer () |
bool | IsAlive () |
string | GetName () |
double | GetDistanceToGround () |
bool | IsEntityInAir () |
int | GetPressedButtons () |
bool | IsPressingButton (int btn) |
bool | IsPressingAttack () |
bool | IsPressingJump () |
bool | IsPressingDuck () |
bool | IsPressingForward () |
bool | IsPressingBackward () |
bool | IsPressingUse () |
bool | IsPressingLeft () |
bool | IsPressingRight () |
bool | IsPressingShove () |
bool | IsPressingReload () |
bool | IsPressingWalk () |
bool | IsPressingZoom () |
Entity | GetOwnerEntity () |
void | BotMoveToLocation (Vector newpos) |
void | BotMoveToOther (Entity otherEntity) |
void | BotMoveOtherToThis (Entity otherEntity) |
void | BotAttack (Entity otherEntity) |
void | BotRetreatFrom (Entity otherEntity) |
void | BotReset () |
bool | IsBot () |
void | SetSenseFlags (int flags) |
void | ChangeBotEyes (bool hasEyes) |
int | GetSenseFlags () |
bool | IsHuman () |
void | AddThinkFunction (function func) |
object | GetScriptScope () |
void | ConnectOutput (string output, function func) |
void | SetEntityRenderAmt (int value) |
bool | CanTraceToOtherEntity (Entity otherEntity, double height=5.0) |
Provides many helpful entity functions.
The Entity class wraps many Valve functions as well as provide numerous helper functions that aid in the development of maps, mods, and mutations.
|
private |
Adds to the entity's THINK function. You can use "this.ent" when you need to use the VSLib::Entity.
func | A function to add to the think timer. |
|
private |
Parents an entity to this entity. In other words, attaches an entity to this entity. Cool for attaching bumper cars or other objects to players. If teleportOther is TRUE, the other entity is teleported to this entity. If it is FALSE, the entity is parented without teleporting.
|
private |
Attaches a particle to this entity. E.g. "gas_fireball" or "elevatorsparks". Internally spawns an info_particle_system, so all effects that can be shown with that entity can be shown with this function. This function will return the particle system that was created, so if you need to attach it to a specific attachment point or whatever, you can.
|
private |
Commands this Entity to attack a particular entity (only applies to bots).
|
private |
Commands the other bot entity to move to this entity's location (only applies to bots).
|
private |
Commands this Entity to move to a particular location (only applies to bots).
|
private |
Commands this Entity to move to another entity's location (only applies to bots).
|
private |
Returns the bot to normal after it is commanded.
|
private |
Commands this Entity to retreat from a particular entity (only applies to bots).
|
private |
Breaks the entity (if it is breakable)
|
private |
Returns true if this entity can trace to another entity without hitting anything. I.e. if a line can be drawn from this entity to the other entity without any collision.
|
private |
Sets if the target can see.
|
private |
Connects an output to a function
output | The output name (string) |
func | Function to fire (pass in a function, not a string name) |
|
private |
Returns the base angles.
|
private |
Returns the base entity (in case you need to access Valve's CBaseEntity/CBaseAnimating functions manually)
|
private |
Returns the numerical index of the entity. Because Valve didn't provide a function to convert a base entity back to an index, we go the long way around by using an entity loop.
|
private |
Gets the entity's classname. If the entity is valid, the entity's class is returned; otherwise, null is returned. For example, "prop_dynamic" or "weapon_rifle_ak47"
|
private |
Returns the distance (in units) to the ground from the entity's origin.
|
private |
Gets the direction that the entity's eyes are facing.
|
private |
Estimates the eye position.
|
private |
Gets the entity's real health. If the entity is valid, the entity's health is returned; otherwise, null is returned. The health includes any adrenaline or pill health.
|
private |
Returns the initial index or name passed to the entity.
|
private |
Gets the entity's current location.
|
private |
Gets the entity that this entity is pointing at, or null if this entity is not pointing at a valid entity. This is useful for things like detecting what entity a player may be looking at.
|
private |
Returns a vector position of where the entity is looking.
|
private |
Returns the name of the entity.
|
private |
Returns the entity's owner, or null if the owner does not exist
|
private |
Gets the entity's current position (basically calls GetLocation() internally).
|
private |
Returns the entity's button mask
|
private |
Gets the entity's raw health. If the entity is valid, the entity's health is returned; otherwise, null is returned. Raw health does not include temporary health.
|
private |
Returns the entity's script scope.
|
private |
Gets the sense flags for this player.
|
private |
Tries to guess what team the player might be on. Returns either INFECTED or SURVIVORS.
|
private |
Returns the entity's current velocity vector.
|
private |
Hurts the entity.
value | Amount of damage to inflict. |
dmgtype | The type of damage to inflict (e.g. DMG_GENERIC) |
weapon | The classname of the weapon (if set, the point hurt will "pretend" to be the weapon) |
attacker | If set, the damage will be done by the specified VSLib::Entity or VSLib::Player |
radius | The radius of damage |
|
private |
Hurts AROUND the entity without hurting the entity itself.
value | Amount of damage to inflict. |
dmgtype | The type of damage to inflict (e.g. DMG_GENERIC) |
weapon | The classname of the weapon (if set, the point hurt will "pretend" to be the weapon) |
attacker | If set, the damage will be done by the specified VSLib::Entity or VSLib::Player |
radius | The radius of damage |
ignoreEntities | An array of Entities to not damage |
|
private |
Same as Hurt(), except it keeps hurting for the specified time. It hurts at the specified interval for the specified time.
|
private |
Ingites the entity for the specified time. Fractions can be used (e.g. 1.5 seconds).
|
private |
Fires a specific input
|
private |
Inputs a color to an entity. This is an alternative to SetColor().
|
private |
|
private |
Returns true if the entity is a bot.
|
private |
Returns true if the entity is in the air.
|
private |
Returns true if the entity is valid or false otherwise. Sometimes, just because an entity or edict exists doesn't mean that it hasn't freed up or become invalidated. Luckily, you will rarely use this function since VSLib uses it automatically.
|
private |
Returns true if the entity is a real human (non-bot).
|
private |
Returns true if the entity is a player.
|
private |
Returns true if this player is currently firing a weapon (either a gun, bat, etc). Note that it doesn't check if the gun has any ammo (just checks for key press).
|
private |
Returns true if this player is pressing backward (or pressing the S key for example).
|
private |
Returns if the client is pressing the specified button. For a list of buttons, see the VSLib/Entity.nut file.
|
private |
Returns true if this player is ducking (or pressing the CTRL key for example).
|
private |
Returns true if this player is pressing forward (or pressing the W key for example).
|
private |
Returns true if this player is jumping (or pressing the space bar button for example).
|
private |
Returns true if this player is pressing the Left key (or pressing the A key for example).
|
private |
Returns true if this player is pressing the reload key (or pressing the R key for example).
|
private |
Returns true if this player is pressing the Right key (or pressing the D key for example).
|
private |
Returns true if this player is pressing the shove key (or pressing right-click for example).
|
private |
Returns true if this player is pressing the USE key (or pressing the E key for example).
|
private |
Returns true if this player is pressing the walk key (or pressing the shift key for example).
|
private |
Returns true if this player is pressing the zoom key.
|
private |
Kills/removes the entity from the map.
|
private |
Kills the entity after the specified delay in seconds; fractions may be used if needed (e.g. 1.5 seconds).
|
private |
Kills/removes the entity and associated/attached entities from the map.
|
private |
Applies an absolute velocity impulse to an entity. An impulse is given to the entity. In this function, by setting a value negative to an entity's trajectory, the entity may or may not change paths depending on the scalar value of the vector. All we are doing is "pushing" an entity in the given direction. The higher the dimensional value, the stronger the "push" (to put it very simply). There are a lot of uses for this function.
|
private |
Remove the parenting.
|
private |
Set the alpha value of the entity. Only seems to work for players.
|
private |
Sets the base angles.
|
private |
Sets the entity's current angular velocity vector KV.
|
private |
Attaches another entity to a specific point. Call this function after AttachOther() to parent at a specific attachment point. For example, if attachment equals "rhand", the object will be attached to the player's or entity's right hand. "forward" to attach to head etc. Search for player or entity attachment points on Google (i.e. "L4D2 survivor attachment points" or something along those lines). If ShouldMaintainOffset is true, then the initial distance between the object is maintained, and the angles usually point in the direction of the parent.
|
private |
Sets the entity's current base velocity vector KV.
|
private |
Sets the entity's render color. Changes the overall color of the entity. For example, a value of (255, 0, 0, 255) will give the entity a red hue. The alpha property really doesn't affect much unless the render mode also changes. If you are looking to change the visibility, use Entity.SetVisible() instead.
|
private |
Sets the damage filter name of the entity. Provided for completeness. This function sets the m_iszDamageFilterName KV, which is later used in InputSetDamageFilter() in the c++ backend to find the name stored in m_iszDamageFilterName to set m_hDamageFilter, which is later used in PassesDamageFilter() to see if the CTakeDamageInfo object passes the damage filter. In simple terms, this function is as good as useless for us.
|
private |
Sets the entity's secondary effects. Depending on the value, effects like light projection (i.e. flashlight) can be enabled and disabled (for player entities). See Player class for a function already made for that purpose.
|
private |
Sets the entity's alpha
value | An integer value between 0 and 255 |
|
private |
Sets the entity's friction.
|
private |
Sets the entity's global name. If the entity is valid, the global name of the entity is set. The global name of the entity corresponds to the "Global Name" field of the entity in the Property Window in Hammer. Global entities may carry over onto future maps in a campaign, so setting an entity's global name may be helpful in certain situations.
|
private |
Sets the entity's gravity.
|
private |
Sets the entity's health. If the entity is valid, the entity's health is set. This will also incapacitate the player if the input value is less than or equal to 0.
|
private |
Dispatches a keyvalue to the entity
|
private |
Sets the entity's current location vector (i.e. teleports the entity).
|
private |
Sets the entity's maximum possible health without modifying the entity's current health. If the entity is valid, the entity's max health is set.
|
private |
Sets the entity's model index. If the entity has more than one model associated with it (i.e. it has more than one model index), then you can instantly change the model index with this function. This function is useful for those who would like to have an entity have more than one model.
|
private |
Sets the entity's next Think time. To be totally honest, I can't think of a reason for this function. Provided just for those who may need it.
|
private |
Sets the entity's parent name. If the entity is valid, the name of the entity is set. Note that this function does NOT parent an entity; only the parent's targetname is set. This is equivalent to setting the "Parent" field in Hammer.
|
private |
Sets the entity's current position (basically calls SetLocation() internally).
|
private |
Sets the entity's raw health. If the entity is valid, the entity's health is set. Setting raw health removes any existing temp health.
|
private |
Sets the entity's render effect. The entity can be given a special effect (like fading, pulsing, etc). If the entity is valid, the render effect is set. Here are the possible values: 0 -> No effect 1 -> Slow pulse 2 -> Fast pulse 3 -> Slow, wide pulse 4 -> Fast, wide pulse 5 -> Slow fade 6 -> Fast fade 7 -> Slow solidify (no you can't make ice) 8 -> Fast solidify 9 -> Slow strobe 10 -> Fast strobe 11 -> Strobe even faster 12 -> Slow flicker 13 -> Fast flicker 14 -> No dissipation 15 -> Distort entity 16 -> Hologram effect 17 -> Super scale; become huge 18 -> Glowing shell 19 -> Clamp sprite (prevents sprites from getting smaller when increasing disatance) 20 -> Rain effect (for environments) 21 -> Snow effect (for environments again) 22 -> Valve's experimental spotlight effect 23 -> Ragdoll effect 24 -> Pulse faster and wider (dunno why Valve put the value all the way down here)
|
private |
Sets the entity's render mode. The render mode allows you to change how an entity should render. With specific values, you can make entities invisible, change the object's buffer checks, blending, and more. Here are the possible values: 0 -> Normal (no render mode modification) 1 -> Transcolor 2 -> Transtexture 3 -> Glow 4 -> Transalpha 5 -> Transadd 6 -> Environmental 7 -> Transadd Frame Blend 8 -> Transalpha add 9 -> World glow 10 -> Rend None
|
private |
Sets the entity's response context. This function deals more with AI criteria sets and dispatching responses. Practically useless for what we do, since the entity would need to be re-activated and there's no plausible way to do that via VScripts. If your mod needs to deal with m_iszResponseContext, use another scripting engine like SourceMod.
|
private |
Sets the sense flags for this player.
|
private |
Sets the shadow cast distance. I honestly cannot think of any good use for this, unless you want to change the shadow distance over time or something. Granted, it may not even work. Provided for completeness.
|
private |
Sets the entity's spawn flags.
|
private |
Sets the entity's speed. If the entity is valid, the speed of the entity is set. The speed cannot be set for player entities.
|
private |
Sets the m_target netprop of the entity. Provided for completeness, but the function doesn't seem to do much on L4D2. The prop has taken a back seat to m_iName from the looks of it.
|
private |
Sets the entity's current velocity vector. This can be used to force an entity to move in a particular direction.
|
private |
Sets the entity's current velocity vector KV.
|
private |
Changes the entity's visibility. If the visible parameter is true, the entity will become visible to all players. If the visible paramater is false, the entity will become invisible to all players.
|
private |
Sets the entity's current water level.
|
private |
Applies an angular velocity impulse to an entity. Using this function, we can make physics props spin around or rotate.
|
private |
Does the same thing as SetLocation() in that it teleports the entity. Internally the function just calls SetLocation(). Provided for simplicity, as a lot of mappers seem to have difficulty understanding various terms.
|
private |
Teleports the entity to another VSLib.Entity.
|
private |
Attempts to "Use" or pick up another entity.
|
private |
Attempts to be "used" or picked up BY another entity.
|
private |
Attempts to "Use" or pick up another entity.
|
private |
Vomits on the Entity