-
Notifications
You must be signed in to change notification settings - Fork 0
Extended: CBaseEntity
How to get this userdata:
Entity()
GetEntityByIndex()
FindEntityByName()
CreateEntity()
CreateEntityNoSpawn()tostring(entity)Format entity to a proper string "Entity [{index}][{classname}]".
When formating "worldspawn" entity, string "Entity" will be replaced with "Worldspawn".
entity:Activate()Activate the entity. In internal, this call Activate() of the entity.
entity:AddFlags(flag)Adds flags to the entity.
flag: number
entity:AddSolidFlags(solidflag)Adds solid flag(s) to the entity.
solidflag: number
entity:AddSpawnFlags(spawnflag)Adds onto the current spawnflags of an entity.
spawnflag: number
entity:CanTakeDamage()Check if current entity can take damage.
Return: true or false
entity:EntIndex()Same with entity:entindex(). Return the index of entity.
Return: number
entity:EyeAngles()Returns the direction a player, npc or ragdoll is looking as a world-oriented angle.
Return: angle
entity:EyePos()Returns the position of an Player/NPC's view.
Return: vector
entity:Fire(input, value, delay, activator)Fires an entity's input, conforming to the map IO event queue system.
input: string
value: string or nil
delay: number
activator: player
entity:GetAngles()Gets the angles of given entity.
Return: angle
entity:GetClassname()Returns the classname of a entity.
Return: string
entity:GetCollisionBounds()Returns an entity's collision bounding box.
Return: vector, vector
entity:GetCollisionGroup()Returns the entity's collision group.
Return: number
entity:GetEffects()Returns a bit flag of all engine effect flags of the entity.
Return: number
entity:GetGravity()Gets the gravity multiplier of the entity.
Return: number
entity:GetGroundEntity()Returns the object the entity is standing on.
Return: entity or nil
entity:GetKeyValue(key, isstring)Gets the Hammer key value on an entity.
BUG: If isstring is set to true, but the value isn't a string, game will crash.
Return: string
key: string. Example: origin
isstring: bool
entity:GetLocalAngularVelocity()Returns the non-VPhysics angular velocity of the entity relative to its parent entity.
Return: angle
entity:GetModel()Gets the model of given entity.
Return: string
entity:GetModelBounds()Returns the entity's model bounds, not scaled by entity:SetModelScale().
Return: vector, vector
entity:GetModelScale()Gets the selected entity's model scale.
Return: number
entity:GetName()Returns the map/hammer targetname of this entity.
Return: string
entity:GetOwner()Returns the owner entity of this entity.
Return: entity or nil
entity:GetParent()Returns the parent entity of this entity.
Return: entity or nil
entity:GetPhysicsObject()NOT FINISHED: This part of code is not finished yet, using this most likely won't help you.
Returns the entity's physics object, if the entity has physics.
Return: number
entity:GetPointer()Return the entity pointer address.
Return: number
entity:GetPos()Gets the position of given entity in the world.
Return: vector
entity:GetRenderMode()Returns the render mode of the entity.
Return: number
entity:GetSolid()Returns solid type of an entity.
Return: number
entity:GetSolidFlags()Returns solid flag(s) of an entity.
Return: number
entity:GetSpawnFlags()Returns the bitwise spawn flags used by the entity.
Return: number
entity:GetVelocity()Returns the entity's velocity.
Return: vector
entity:HasSpawnFlags(spawnflag)Returns whether this entity has the specified spawnflags bits set.
Return: true or false
spawnflag: number
entity:Health()Returns the health of the entity.
Return: number
entity:Ignite(length)Sets the entity on fire.
length: number
entity:IsEffectActive(effectflag)Returns whether an entity has engine effect applied or not.
Return: true or false
effectflag: number
entity:IsFlagSet(flag)Checks if given flag(s) is set or not.
Return: true or false
flag: number
entity:IsOnFire()Returns whether the entity is on fire.
Return: true or false
entity:IsOnGround()Returns whether the entity is on ground or not.
Return: true or false
entity:IsValid()Returns whether the entity is a valid entity or not.
An entity is valid if:
- It is not a nil.
- It is not the worldspawn entity.
Return: true or false
entity:IsWeapon()Checks if the entity is a weapon or not.
Return: true or false
entity:IsWorld()Returns if this entity is the map entity Entity[0] worldspawn.
Return: true or false
entity:OnGround()Returns true if the entity is on the ground, and false if it isn't.
Return: true or false
entity:ReadNetvar(type, address, ispointer)Read the networked variable of entity. ispointer is only for string variables.
Return: any
type: string. Example: int, float or vector
address: number. Example: 0xF4
ispointer: bool
entity:RemoveFlags(flag)Removes specified flag(s) from the entity.
flag: number
entity:RemoveSolidFlags(solidflag)Removes solid flag(s) from the entity.
solidflag: number
entity:RemoveSpawnFlags(spawnflag)Removes a spawnflag from the current spawnflags of an entity.
spawnflag: number
entity:SetAbsVelocity(velocity)Sets the entity's velocity.
velocity: vector
entity:SetAngles(angle)Sets the angles of the entity.
angle: angle
entity:SetCollisionBounds(mins, maxs, nofire)Sets the collision bounds for the entity.
If nofire is true, it will not fire the event and doesn't make game update variables.
mins: vector
maxs: vector
nofire: bool
entity:SetCollisionGroup(group)Sets the entity's collision group.
group: number
entity:SetGravity(gravity)Sets the gravity multiplier of the entity.
gravity: number
entity:SetKeyValue(key, value)Sets Hammer key values on an entity.
key: string
value: string
entity:SetLocalAngularVelocity(angvel)Sets the entity's angular velocity (rotation speed).
angvel: angle
entity:SetName(targetname)Sets the mapping name (targetname) of the entity.
targetname: string
entity:SetParent(parent)Sets the parent of this entity, making it move with its parent. This will make the child entity non solid, nothing can interact with them, including traces.
parent: entity
entity:SetPos(pos)Moves the entity to the specified position.
pos: vector
entity:SetRenderMode(rendermode)Sets the render mode of the entity.
rendermode: number
entity:SetSolid(solid)Sets the solidity of an entity.
solid: number
entity:SetSolidFlags(solidflag)Sets solid flag(s) for the entity. This overrides any other flags the entity might have had. Use entity:AddSolidFlags() for adding flags.
solidflag: number
entity:SetSpawnFlags(spawnflag)Sets the spawnflags to set of an entity. This overrides any other flags the entity might have had. Use entity:AddSpawnFlags() for adding flags.
spawnflag: number
entity:SetTakeDamage(takedamage)Sets the entity's take damage flag.
takedamage: number
entity:SetTeam(team)Sets the entity or player to the chosen team.
team: number
entity:SetVelocity(velocity)Sets the entity's velocity.
velocity: vector
entity:Spawn()Initializes the entity and starts its networking. If called on a player, it will respawn them.
entity:TakeDamage(damage)Applies the specified amount of damage to the entity.
damage: number
entity:Team()Returns the entity or player's team ID.
entity:WaterLevel()Returns an integer that represents how deep in water the entity is.
0: The entity isn't in water.
1: Slightly submerged (at least to the feet).
2: The majority of the entity is submerged (at least to the waist).
3: Completely submerged.
Return: number
entity:WriteNetvar(type, address, value, ispointer)Write the networked variable of entity to given value. ispointer is only for string variables.
type: string. Example: int, float or vector
address: number. Example: 0xF4
value: any
ispointer: bool