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
classmethod create((object)arg1, (str)arg2) → object :

Create an entity by its class name.

Return type:BaseEntity
classmethod find((object)arg1, (str)arg2) → object :

Return the first entity that has a matching class name.

Return type:BaseEntity
classmethod find_or_create((object)arg1, (str)arg2) → 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_edict((BaseEntity)arg1, (str)arg2) → Edict :

Return the value of the given data map field name.

Return type:Edict
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_edict((BaseEntity)arg1, (str)arg2) → Edict :

Return the value of the given server class field name.

Return type:Edict
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
get_output((BaseEntity)arg1, (str)arg2) → BaseEntityOutput :

Return the output instance matching the given name.

Parameters:name (str) – The name of the output.
Return type:BaseEntityOutput
get_property_bool((BaseEntity)arg1, (str)arg2) → bool :

Return the value of the given field name.

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

Return the value of the given field name.

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

Return the value of the given field name.

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

Return the value of the given field name.

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

Return the value of the given field name.

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

Return the value of the given field name.

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

Return the value of the given field name.

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

Return the value of the given field name.

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

Return the value of the given field name.

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

Return the value of the given field name.

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

Return the value of the given field name.

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

Return the value of the given field name.

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

Return the value of the given field name.

Return type:int
get_property_string()
get_property_string_array( (BaseEntity)arg1, (str)arg2) -> str :

Return the value of the given field name.

rtype:str
get_property_string_array((BaseEntity)arg1, (str)arg2) → str :

Return the value of the given field name.

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

Return the value of the given field name.

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

Return the value of the given field name.

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

Return the value of the given field name.

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

Return the value of the given field name.

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

Return the value of the given field name.

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

Return the value of the given field name.

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

Return the value of the given field name.

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

Returns whether the entity is marked for deletion.

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

Return True if the entity is a player.

Return type:bool
is_weapon((BaseEntity)arg1) → bool :

Return True if the entity is a weapon.

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_edict((BaseEntity)arg1, (str)arg2, (Edict)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_edict((BaseEntity)arg1, (str)arg2, (Edict)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.

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

Set the value of the given field name.

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

Set the value of the given field name.

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

Set the value of the given field name.

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

Set the value of the given field name.

set_property_edict((BaseEntity)arg1, (str)arg2, (Edict)arg3) → None :

Set the value of the given field name.

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

Set the value of the given field name.

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

Set the value of the given field name.

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

Set the value of the given field name.

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

Set the value of the given field name.

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

Set the value of the given field name.

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

Set the value of the given field name.

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

Set the value of the given field name.

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

Set the value of the given field name.

set_property_string()
set_property_string_array( (BaseEntity)arg1, (str)arg2, (str)arg3) -> None :
Set the value of the given field name.
set_property_string_array((BaseEntity)arg1, (str)arg2, (str)arg3) → None :

Set the value of the given field name.

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

Set the value of the given field name.

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

Set the value of the given field name.

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

Set the value of the given field name.

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

Set the value of the given field name.

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

Set the value of the given field name.

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

Set the value of the given field name.

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

Set the value of the given 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
entity_flags

Get/set the entity’s flags.

Return type:int
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
parent_name

Get/set the entity’s parent name.

Return type:str
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, caching=True)[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
Variables:
  • cache

    A read-only attribute that returns a dictionary containing the cached instances of this class.

    Note

    This is not an instance property, so it can only be accessed through the class itself.

  • caching – A read-only attribute that returns whether this class is caching its instances by default.
__init__(index, caching=True)[source]

Initialize the Entity instance.

Parameters:
  • index (int) – The entity index to wrap.
  • caching (bool) – Whether to lookup the cache for an existing instance or not.
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.

delay(delay, callback, args=(), kwargs=None, cancel_on_level_end=False)[source]

Create the delay which will be stopped after removing the entity.

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 from_inthandle(inthandle, caching=None)[source]

Create an entity instance from an inthandle.

Parameters:
  • inthandle (int) – The inthandle.
  • caching (bool) – Whether to lookup the cache for an existing instance or not.
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:KeyError – 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_output(name)[source]

Return the output instance matching the given name.

Parma str name:Name of the output.
Return type:BaseEntityOutput
Raises:KeyError – Raised if the output instance wasn’t found.
get_parent()[source]

Return the entity’s parent.

Return type:Entity
is_in_solid(mask=<ContentMasks.ALL: 4294967295>, generator=None)[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

is_networked()[source]

Return True if the entity is networked.

Return type:bool
repeat(callback, args=(), kwargs=None, cancel_on_level_end=False)[source]

Create the repeat which will be stopped after removing the entity. :param callback:

A callable object that should be called at the end of each loop.
Parameters:
  • 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 – Raised if the given callback is not callable.

Returns:

The repeat instance.

Return type:

Repeat

set_model(model)[source]

Set the entity’s model to the given model.

Parameters:model (Model) – The model 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.
dynamic_attributes
inputs
keyvalues
model

Property to get/set the entity’s model.

See also

get_model() and set_model()

outputs
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
server_classes
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.