entities.entity module

Provides a class used to interact with a specific entity.

class entities.entity.BaseEntity

Bases: _entities.ServerEntity

__init__((object)arg1, (int)entity_index) → object
static create((str)arg1) → object :

Create an entity by its class name.

Return type:BaseEntity
static find((str)arg1) → object :

Return the first entity that has a matching class name.

Return type:BaseEntity
static find_or_create((str)arg1) → object :

Try to find an entity that has a matching class name. If no entity has been found, it will be created.

Return type:BaseEntity
get_datamap_property_bool((BaseEntity)arg1, (str)arg2) → bool :

Return the value of the given data map field name.

Return type:bool
get_datamap_property_char((BaseEntity)arg1, (str)arg2) → str :

Return the value of the given data map field name.

Return type:str
get_datamap_property_color((BaseEntity)arg1, (str)arg2) → Color :

Return the value of the given data map field name.

Return type:Color
get_datamap_property_double((BaseEntity)arg1, (str)arg2) → float :

Return the value of the given data map field name.

Return type:float
get_datamap_property_float((BaseEntity)arg1, (str)arg2) → float :

Return the value of the given data map field name.

Return type:float
get_datamap_property_int((BaseEntity)arg1, (str)arg2) → int :

Return the value of the given data map field name.

Return type:int
get_datamap_property_interval((BaseEntity)arg1, (str)arg2) → Interval :

Return the value of the given data map field name.

Return type:Interval
get_datamap_property_long((BaseEntity)arg1, (str)arg2) → int :

Return the value of the given data map field name.

Return type:int
get_datamap_property_long_long((BaseEntity)arg1, (str)arg2) → int :

Return the value of the given data map field name.

Return type:int
get_datamap_property_pointer((BaseEntity)arg1, (str)arg2) → object :

Return the value of the given data map field name.

Return type:Pointer
get_datamap_property_quaternion((BaseEntity)arg1, (str)arg2) → Quaternion :

Return the value of the given data map field name.

Return type:Quaternion
get_datamap_property_short((BaseEntity)arg1, (str)arg2) → int :

Return the value of the given data map field name.

Return type:int
get_datamap_property_string_array((BaseEntity)arg1, (str)arg2) → str :

Return the value of the given data map field name.

Return type:bstrool
get_datamap_property_string_pointer((BaseEntity)arg1, (str)arg2) → str :

Return the value of the given data map field name.

Return type:str
get_datamap_property_uchar((BaseEntity)arg1, (str)arg2) → int :

Return the value of the given data map field name.

Return type:int
get_datamap_property_uint((BaseEntity)arg1, (str)arg2) → int :

Return the value of the given data map field name.

Return type:int
get_datamap_property_ulong((BaseEntity)arg1, (str)arg2) → int :

Return the value of the given data map field name.

Return type:int
get_datamap_property_ulong_long((BaseEntity)arg1, (str)arg2) → int :

Return the value of the given data map field name.

Return type:int
get_datamap_property_ushort((BaseEntity)arg1, (str)arg2) → int :

Return the value of the given data map field name.

Return type:int
get_datamap_property_vector((BaseEntity)arg1, (str)arg2) → Vector :

Return the value of the given data map field name.

Return type:Vector
get_eye_location((BaseEntity)arg1) → Vector :

Return the entitiy’s eye location.

Return type:Vector
get_key_value_bool((BaseEntity)arg1, (str)field_name) → bool :

Returns the value of the given field name.

Return type:bool
get_key_value_color((BaseEntity)arg1, (str)field_name) → Color :

Returns the value of the given field name.

Return type:Color
get_key_value_float((BaseEntity)arg1, (str)field_name) → float :

Returns the value of the given field name.

Return type:float
get_key_value_int((BaseEntity)arg1, (str)field_name) → int :

Returns the value of the given field name.

Return type:int
get_key_value_qangle((BaseEntity)arg1, (str)field_name) → QAngle :

Returns the value of the given field name.

Return type:QAngle
get_key_value_string((BaseEntity)arg1, (str)field_name) → str :

Returns the value of the given field name.

Return type:str
get_key_value_vector((BaseEntity)arg1, (str)field_name) → Vector :

Returns the value of the given field name.

Return type:Vector
get_network_property_bool((BaseEntity)arg1, (str)arg2) → bool :

Return the value of the given server class field name.

Return type:bool
get_network_property_char((BaseEntity)arg1, (str)arg2) → str :

Return the value of the given server class field name.

Return type:str
get_network_property_color((BaseEntity)arg1, (str)arg2) → Color :

Return the value of the given server class field name.

Return type:Color
get_network_property_double((BaseEntity)arg1, (str)arg2) → float :

Return the value of the given server class field name.

Return type:float
get_network_property_float((BaseEntity)arg1, (str)arg2) → float :

Return the value of the given server class field name.

Return type:float
get_network_property_int((BaseEntity)arg1, (str)arg2) → int :

Return the value of the given server class field name.

Return type:int
get_network_property_interval((BaseEntity)arg1, (str)arg2) → Interval :

Return the value of the given server class field name.

Return type:Interval
get_network_property_long((BaseEntity)arg1, (str)arg2) → int :

Return the value of the given server class field name.

Return type:int
get_network_property_long_long((BaseEntity)arg1, (str)arg2) → int :

Return the value of the given server class field name.

Return type:int
get_network_property_pointer((BaseEntity)arg1, (str)arg2) → object :

Return the value of the given server class field name.

Return type:Pointer
get_network_property_quaternion((BaseEntity)arg1, (str)arg2) → Quaternion :

Return the value of the given server class field name.

Return type:Quaternion
get_network_property_short((BaseEntity)arg1, (str)arg2) → int :

Return the value of the given server class field name.

Return type:int
get_network_property_string_array((BaseEntity)arg1, (str)arg2) → str :

Return the value of the given server class field name.

Return type:str
get_network_property_string_pointer((BaseEntity)arg1, (str)arg2) → str :

Return the value of the given server class field name.

Return type:str
get_network_property_uchar((BaseEntity)arg1, (str)arg2) → int :

Return the value of the given server class field name.

Return type:int
get_network_property_uint((BaseEntity)arg1, (str)arg2) → int :

Return the value of the given server class field name.

Return type:int
get_network_property_ulong((BaseEntity)arg1, (str)arg2) → int :

Return the value of the given server class field name.

Return type:int
get_network_property_ulong_long((BaseEntity)arg1, (str)arg2) → int :

Return the value of the given server class field name.

Return type:int
get_network_property_ushort((BaseEntity)arg1, (str)arg2) → int :

Return the value of the given server class field name.

Return type:int
get_network_property_vector((BaseEntity)arg1, (str)arg2) → Vector :

Return the value of the given server class field name.

Return type:Vector
is_player((BaseEntity)arg1) → bool :

Return True if the entity is a player.

Return type:bool
remove((BaseEntity)arg1) → None :

Remove the entity.

set_datamap_property_bool((BaseEntity)arg1, (str)arg2, (bool)arg3) → None :

Set the value of the given data map field name.

set_datamap_property_char((BaseEntity)arg1, (str)arg2, (str)arg3) → None :

Set the value of the given data map field name.

set_datamap_property_color((BaseEntity)arg1, (str)arg2, (Color)arg3) → None :

Set the value of the given data map field name.

set_datamap_property_double((BaseEntity)arg1, (str)arg2, (float)arg3) → None :

Set the value of the given data map field name.

set_datamap_property_float((BaseEntity)arg1, (str)arg2, (float)arg3) → None :

Set the value of the given data map field name.

set_datamap_property_int((BaseEntity)arg1, (str)arg2, (Channel)arg3) → None :

Set the value of the given data map field name.

set_datamap_property_interval((BaseEntity)arg1, (str)arg2, (Interval)arg3) → None :

Set the value of the given data map field name.

set_datamap_property_long((BaseEntity)arg1, (str)arg2, (int)arg3) → None :

Set the value of the given data map field name.

set_datamap_property_long_long((BaseEntity)arg1, (str)arg2, (int)arg3) → None :

Set the value of the given data map field name.

set_datamap_property_pointer((BaseEntity)arg1, (str)arg2, (object)arg3) → None :

Set the value of the given data map field name.

set_datamap_property_quaternion((BaseEntity)arg1, (str)arg2, (Quaternion)arg3) → None :

Set the value of the given data map field name.

set_datamap_property_short((BaseEntity)arg1, (str)arg2, (int)arg3) → None :

Set the value of the given data map field name.

set_datamap_property_string_array((BaseEntity)arg1, (str)arg2, (str)arg3) → None :

Set the value of the given data map field name.

set_datamap_property_string_pointer((BaseEntity)arg1, (str)arg2, (str)arg3) → None :

Set the value of the given data map field name.

set_datamap_property_uchar((BaseEntity)arg1, (str)arg2, (int)arg3) → None :

Set the value of the given data map field name.

set_datamap_property_uint((BaseEntity)arg1, (str)arg2, (int)arg3) → None :

Set the value of the given data map field name.

set_datamap_property_ulong((BaseEntity)arg1, (str)arg2, (int)arg3) → None :

Set the value of the given data map field name.

set_datamap_property_ulong_long((BaseEntity)arg1, (str)arg2, (int)arg3) → None :

Set the value of the given data map field name.

set_datamap_property_ushort((BaseEntity)arg1, (str)arg2, (int)arg3) → None :

Set the value of the given data map field name.

set_datamap_property_vector((BaseEntity)arg1, (str)arg2, (Vector)arg3) → None :

Set the value of the given data map field name.

set_key_value_bool((BaseEntity)arg1, (str)field_name, (bool)value) → None :

Sets a field to the given value.

set_key_value_color((BaseEntity)arg1, (str)field_name, (Color)value) → None :

Sets a field to the given value.

set_key_value_float((BaseEntity)arg1, (str)field_name, (float)value) → None :

Sets a field to the given value.

set_key_value_int((BaseEntity)arg1, (str)field_name, (Channel)value) → None :

Sets a field to the given value.

set_key_value_qangle((BaseEntity)arg1, (str)field_name, (QAngle)value) → None :

Sets a field to the given value.

set_key_value_string((BaseEntity)arg1, (str)field_name, (str)value) → None :

Sets a field to the given value.

set_key_value_vector((BaseEntity)arg1, (str)field_name, (Vector)value) → None :

Sets a field to the given value.

set_network_property_bool((BaseEntity)arg1, (str)arg2, (bool)arg3) → None :

Set the value of the given server class field name.

set_network_property_char((BaseEntity)arg1, (str)arg2, (str)arg3) → None :

Set the value of the given server class field name.

set_network_property_color((BaseEntity)arg1, (str)arg2, (Color)arg3) → None :

Set the value of the given server class field name.

set_network_property_double((BaseEntity)arg1, (str)arg2, (float)arg3) → None :

Set the value of the given server class field name.

set_network_property_float((BaseEntity)arg1, (str)arg2, (float)arg3) → None :

Set the value of the given server class field name.

set_network_property_int((BaseEntity)arg1, (str)arg2, (Channel)arg3) → None :

Set the value of the given server class field name.

set_network_property_interval((BaseEntity)arg1, (str)arg2, (Interval)arg3) → None :

Set the value of the given server class field name.

set_network_property_long((BaseEntity)arg1, (str)arg2, (int)arg3) → None :

Set the value of the given server class field name.

set_network_property_long_long((BaseEntity)arg1, (str)arg2, (int)arg3) → None :

Set the value of the given server class field name.

set_network_property_pointer((BaseEntity)arg1, (str)arg2, (object)arg3) → None :

Set the value of the given server class field name.

set_network_property_quaternion((BaseEntity)arg1, (str)arg2, (Quaternion)arg3) → None :

Set the value of the given server class field name.

set_network_property_short((BaseEntity)arg1, (str)arg2, (int)arg3) → None :

Set the value of the given server class field name.

set_network_property_string_array((BaseEntity)arg1, (str)arg2, (str)arg3) → None :

Set the value of the given server class field name.

set_network_property_string_pointer((BaseEntity)arg1, (str)arg2, (str)arg3) → None :

Set the value of the given server class field name.

set_network_property_uchar((BaseEntity)arg1, (str)arg2, (int)arg3) → None :

Set the value of the given server class field name.

set_network_property_uint((BaseEntity)arg1, (str)arg2, (int)arg3) → None :

Set the value of the given server class field name.

set_network_property_ulong((BaseEntity)arg1, (str)arg2, (int)arg3) → None :

Set the value of the given server class field name.

set_network_property_ulong_long((BaseEntity)arg1, (str)arg2, (int)arg3) → None :

Set the value of the given server class field name.

set_network_property_ushort((BaseEntity)arg1, (str)arg2, (int)arg3) → None :

Set the value of the given server class field name.

set_network_property_vector((BaseEntity)arg1, (str)arg2, (Vector)arg3) → None :

Set the value of the given server class field name.

spawn((BaseEntity)arg1) → None :

Spawn the entity.

stop_sound((BaseEntity)arg1, (str)sample[, (Channel)channel=0]) → None :

Stop the given sound from being emitted by this entity.

Parameters:
  • sample (str) – Sound file relative to the sounds directory.
  • channel (Channel) – The channel of the sound.
angles

Get/set the entity’s angles.

Return type:QAngle
avelocity

Get/set the entity’s avelocity.

Return type:Vector
base_velocity

Get/set the entity’s base velocity.

Return type:Vector
collision_group

Get/set the entity’s collision group.

Return type:CollisionGroup
color

Get/set the entity’s color.

Return type:Color
damage_filter

Get/set the entity’s damage filter.

Return type:str
datamap

The data map of this entity (read-only).

Return type:DataMap
edict

Return the edict of the entity.

Return type:Edict
effects

Get/set the entity’s effects.

Return type:int
elasticity

Get/set the entity’s elasticity.

Return type:float
factory

Return the entity’s factory.

Return type:EntityFactory
friction

Get/set the entity’s friction.

Return type:float
global_name

Get/set the entity’s global name.

Return type:str
gravity

Get/set the entity’s gravity. This is a multiplicator of sv_gravity. E. g. set the value to 0.0 or 1.0 for normal gravity. 0.5 halves the gravity.

Return type:float
ground_entity

Get/set the entity’s ground entity.

Returns:-1 if the entity has no ground entity (does not stand on an entity). The returned value is an int handle.
Return type:int
hammerid

Get/set the entity’s Hammer ID.

Return type:int
health

Get/set the entity’s health.

Return type:int
index

Return the index of the entity.

Raises:ValueError – Raised if the entity does not have an index.
Return type:int
inthandle

Return the handle of the entity.

Return type:int
local_time

Get/set the entity’s local time.

Return type:float
max_health

Get/set the entity’s maximum health.

Return type:int
maxs

Get/set the entity’s maximum dimension.

Return type:Vector
mins

Get/set the entity’s minimum dimension.

Return type:Vector
move_type

Get/set the entity’s move type.

Return type:MoveType
origin

Get/set the entity’s origin.

Return type:Vector
owner_handle

Get/set the entity’s owner handle.

Returns:-1 if the entity has no owner entity. The returned value is an int handle.
Return type:int
parent_inthandle

Get/set the entity’s parent handle.

Returns:-1 if the entity has no parent entity. The returned value is an int handle.
Return type:int
physics_object

Return the physics object of the entity.

Return type:PhysicsObject
pointer

Return the pointer of the entity.

Return type:Pointer
render_color

Get/set the entity’s render color.

Return type:Color
render_fx

Get/set the entity’s render effects.

Return type:RenderEffects
render_mode

Get/set the entity’s render mode.

Return type:RenderMode
rotation

Get/set the entity’s rotation.

Return type:QAngle
server_class

The server class of this entity (read-only).

Return type:ServerClass
shadow_cast_distance

Get/set the entity’s shadow cast distance.

Return type:float
solid_flags

Get/set the entity’s solid flags.

Return type:SolidFlags
solid_type

Get/set the entity’s solid type.

Return type:SolidType
spawn_flags

Get/set the entity’s spawn flags.

Return type:int
speed

Get/set the entity’s speed.

Return type:float
target

Get/set the entity’s target.

Return type:str
target_name

Get/set the entity’s target name.

Return type:str
team_index

Get/set the entity’s team index.

Return type:int
velocity

Get/set the entity’s velocity.

Return type:Vector
view_offset

Get/set the entity’s view offset.

Return type:Vector
water_level

Get/set the entity’s water level.

The water level is a value between 0 - 3 and indicates how far the entity is covered with water:

  1. Entity is completely dry.
  2. Entity has contact with water.
  3. Entity is half inside of water.
  4. Entity is completely under water.
Return type:int
class entities.entity.Entity(index)[source]

Bases: _entities._entity.BaseEntity

Class used to interact directly with entities.

Beside the standard way of doing stuff via methods and properties this class also provides dynamic attributes that depend on the entity that is being accessed with this class. You can print all dynamic properties by iterating over the following generators:

  1. properties
  2. inputs
  3. outputs
  4. keyvalues
__init__(index)[source]

Initialize the Entity instance.

Parameters:index (int) – The entity index to wrap.
call_input(name, *args, **kwargs)[source]

Call the input function matching the given name.

Parameters:
  • name (str) – Name of the input function.
  • args – Optional arguments that should be passed to the input function.
  • kwargs – Optional keyword arguments that should be passed to the input function.
Raises:

ValueError – Raised if the input function wasn’t found.

classmethod create(classname)[source]

Create a new networked entity with the given classname.

Parameters:classname (str) – Classname of the entity to create.
Raises:ValueError – Raised if the given classname is not a networked entity.
delay(delay, callback, args=(), kwargs=None, cancel_on_level_end=False)[source]

Execute a callback after the given delay.

Parameters:
  • delay (float) – The delay in seconds.
  • callback – A callable object that should be called after the delay expired.
  • args (tuple) – Arguments that should be passed to the callback.
  • kwargs (dict) – Keyword arguments that should be passed to the callback.
  • cancel_on_level_end (bool) – Whether or not to cancel the delay at the end of the map.
Raises:

ValueError – If the given callback is not callable.

Returns:

The delay instance.

Return type:

Delay

emit_sound(sample, recipients=(), volume=1.0, attenuation=<Attenuation.NONE: 0.0>, channel=_engines._sound.Channel.AUTO, flags=_engines._sound.SoundFlags.NO_FLAGS, pitch=_engines._sound.Pitch.NORMAL, origin=Vector(0.0, 0.0, 0.0), direction=Vector(0.0, 0.0, 0.0), origins=(), update_positions=True, sound_time=0.0, speaker_entity=-1, download=False, stream=False)[source]

Emit a sound from this entity.

Parameters:
  • sample (str) – Sound file relative to the sounds directory.
  • recipients (RecipientFilter) – Recipients to emit the sound to.
  • index (int) – Index of the entity to emit the sound from.
  • volume (float) – Volume of the sound.
  • attenuation (Attenuation) – How far the sound should reaches.
  • channel (int) – Channel to emit the sound with.
  • flags (SoundFlags) – Flags of the sound.
  • pitch (Pitch) – Pitch of the sound.
  • origin (Vector) – Origin of the sound.
  • direction (Vector) – Direction of the sound.
  • origins (tuple) – Origins of the sound.
  • update_positions (bool) – Whether or not the positions should be updated.
  • sound_time (float) – Time to play the sound for.
  • speaker_entity (int) – Index of the speaker entity.
  • download (bool) – Whether or not the sample should be added to the downloadables.
  • stream (bool) – Whether or not the sound should be streamed.
classmethod find(classname)[source]

Try to find an entity with the given classname.

If not entity has been found, None will be returned.

Parameters:classname (str) – The classname of the entity.
Returns:Return the found entity.
Return type:Entity
classmethod find_or_create(classname)[source]

Try to find an entity with the given classname.

If no entity has been found, it will be created.

Parameters:classname (str) – The classname of the entity.
Returns:Return the found or created entity.
Return type:Entity
get_input(name)[source]

Return the input function matching the given name.

Parma str name:Name of the input function.
Return type:InputFunction
Raises:ValueError – Raised if the input function wasn’t found.
get_model()[source]

Return the entity’s model.

Returns:None if the entity has no model.
Return type:Model
get_parent()[source]

Return the entity’s parent.

Return type:Entity
get_property_bool(name)[source]

Return the boolean property.

Parameters:name (str) – Name of the property to retrieve.
Return type:bool
get_property_char(name)[source]

Return the char property.

Parameters:name (str) – Name of the property to retrieve.
Return type:str
get_property_color(name)[source]

Return the Color property.

Parameters:name (str) – Name of the property to retrieve.
Return type:Color
get_property_edict(name)[source]

Return the Edict property.

Parameters:name (str) – Name of the property to retrieve.
Return type:Edict
get_property_float(name)[source]

Return the float property.

Parameters:name (str) – Name of the property to retrieve.
Return type:float
get_property_int(name)[source]

Return the integer property.

Parameters:name (str) – Name of the property to retrieve.
Return type:int
get_property_interval(name)[source]

Return the Interval property.

Parameters:name (str) – Name of the property to retrieve.
Return type:Interval
get_property_pointer(name)[source]

Return the pointer property.

Parameters:name (str) – Name of the property to retrieve.
Return type:Pointer
get_property_quaternion(name)[source]

Return the Quaternion property.

Parameters:name (str) – Name of the property to retrieve.
Return type:Quaternion
get_property_short(name)[source]

Return the short property.

Parameters:name (str) – Name of the property to retrieve.
Return type:int
get_property_string(name)[source]

Return the string property.

Parameters:name (str) – Name of the property to retrieve.
Return type:str
get_property_string_pointer(name)[source]

Return the string property.

Parameters:name (str) – Name of the property to retrieve.
Return type:str
get_property_uchar(name)[source]

Return the uchar property.

Parameters:name (str) – Name of the property to retrieve.
Return type:int
get_property_uint(name)[source]

Return the uint property.

Parameters:name (str) – Name of the property to retrieve.
Return type:int
get_property_ushort(name)[source]

Return the ushort property.

Parameters:name (str) – Name of the property to retrieve.
Return type:int
get_property_vector(name)[source]

Return the Vector property.

Parameters:name (str) – Name of the property to retrieve.
Return type:Vector
is_in_solid(mask=<ContentMasks.ALL: 4294967295>, generator=<class '_entities.BaseEntityGenerator'>)[source]

Return whether or not the entity is in solid.

Parameters:
  • mask (ContentMasks) – Contents the ray can possibly collide with.
  • generator – A callable that returns an iterable which contains BaseEntity instances that are ignored by the ray.
Return type:

bool

set_model(model)[source]

Set the entity’s model to the given model.

Parameters:model (Model) – The model to set.
set_property_bool(name, value)[source]

Set the boolean property.

Parameters:
  • name (str) – Name of the property to set.
  • value (bool) – The value to set.
set_property_char(name, value)[source]

Set the char property.

Parameters:
  • name (str) – Name of the property to set.
  • value (str) – The value to set.
set_property_color(name, value)[source]

Set the Color property.

Parameters:
  • name (str) – Name of the property to set.
  • value (Color) – The value to set.
set_property_edict(name, value)[source]

Set the Edict property.

Parameters:
  • name (str) – Name of the property to set.
  • value (Edict) – The value to set.
set_property_float(name, value)[source]

Set the float property.

Parameters:
  • name (str) – Name of the property to set.
  • value (float) – The value to set.
set_property_int(name, value)[source]

Set the integer property.

Parameters:
  • name (str) – Name of the property to set.
  • value (int) – The value to set.
set_property_interval(name, value)[source]

Set the Interval property.

Parameters:
  • name (str) – Name of the property to set.
  • value (Interval) – The value to set.
set_property_pointer(name, value)[source]

Set the pointer property.

Parameters:
  • name (str) – Name of the property to set.
  • value (Pointer) – The value to set.
set_property_quaternion(name, value)[source]

Set the Quaternion property.

Parameters:
  • name (str) – Name of the property to set.
  • value (Quaternion) – The value to set.
set_property_short(name, value)[source]

Set the short property.

Parameters:
  • name (str) – Name of the property to set.
  • value (int) – The value to set.
set_property_string(name, value)[source]

Set the string property.

Parameters:
  • name (str) – Name of the property to set.
  • value (str) – The value to set.
set_property_string_pointer(name, value)[source]

Set the string property.

Parameters:
  • name (str) – Name of the property to set.
  • value (str) – The value to set.
set_property_uchar(name, value)[source]

Set the uchar property.

Parameters:
  • name (str) – Name of the property to set.
  • value (int) – The value to set.
set_property_uint(name, value)[source]

Set the uint property.

Parameters:
  • name (str) – Name of the property to set.
  • value (int) – The value to set.
set_property_ushort(name, value)[source]

Set the ushort property.

Parameters:
  • name (str) – Name of the property to set.
  • value (int) – The value to set.
set_property_vector(name, value)[source]

Set the Vector property.

Parameters:
  • name (str) – Name of the property to set.
  • value (Vector) – The value to set.
take_damage(damage, damage_type=<DamageTypes.GENERIC: 0>, attacker_index=None, weapon_index=None, hitgroup=<HitGroup.GENERIC: 0>, skip_hooks=False, **kwargs)[source]

Deal damage to the entity.

Parameters:
  • damage (int) – Amount of damage to deal.
  • damage_type (DamageTypes) – Type of the dealed damage.
  • attacker_index (int) – If not None, the index will be used as the attacker.
  • weapon_index (int) – If not None, the index will be used as the weapon. This method also tries to retrieve the attacker from the weapon, if attacker_index wasn’t set.
  • hitgroup (HitGroup) – The hitgroup where the damage should be applied.
  • skip_hooks (bool) – If True, the damage will be dealed directly by skipping any registered hooks.
index

Return the entity’s index.

Return type:int
inputs

Iterate over all inputs available for the entity.

keyvalues

Iterate over all entity keyvalues available for the entity.

Note

An entity might also have hardcoded keyvalues that can’t be listed with this property.

model

Property to get/set the entity’s model.

See also

get_model() and set_model()

outputs

Iterate over all outputs available for the entity.

owner

Return the entity’s owner.

Returns:None if the entity has no owner.
Return type:Entity
parent

Property to get/set the parent of the entity.

See also

get_parent() and set_parent()

properties

Iterate over all descriptors available for the entity.

server_classes

Yield all server classes for the entity.

set_parent

Set the parent of the entity.

Parameters:
  • parent (Pointer) – The parent.
  • attachment (str) – The attachment name/index.
teleport

Change the origin, angle and/or velocity of the entity.

Parameters:
  • origin (Vector) – New location of the entity.
  • angle (QAngle) – New angle of the entity.
  • velocity (Vector) – New velocity of the entity.