engines.trace module

Provides ray tracing functionality.

class engines.trace.BaseTrace

Bases: Boost.Python.instance

__init__((object)arg1) → None
all_solid
contents
displacement_flags
end_position
fraction
plane
start_position
start_solid
class engines.trace.ContentFlags[source]

Bases: enum.IntEnum

Content flags wrapper enumerator.

_member_type_

alias of int

_generate_next_value_(name, start, count, last_values)
ALL_VISIBLE = <ContentFlags.ALL_VISIBLE: 255>
AREAPORTAL = <ContentFlags.AREAPORTAL: 32768>
AUX = <ContentFlags.AUX: 4>
BLOCKLOS = <ContentFlags.BLOCKLOS: 64>
CURRENT_0 = <ContentFlags.CURRENT_0: 262144>
CURRENT_180 = <ContentFlags.CURRENT_180: 1048576>
CURRENT_270 = <ContentFlags.CURRENT_270: 2097152>
CURRENT_90 = <ContentFlags.CURRENT_90: 524288>
CURRENT_DOWN = <ContentFlags.CURRENT_DOWN: 8388608>
CURRENT_UP = <ContentFlags.CURRENT_UP: 4194304>
DEBRIS = <ContentFlags.DEBRIS: 67108864>
DETAIL = <ContentFlags.DETAIL: 134217728>
EMPTY = <ContentFlags.EMPTY: 0>
GRATE = <ContentFlags.GRATE: 8>
HITBOX = <ContentFlags.HITBOX: 1073741824>
IGNORE_NODRAW_OPAQUE = <ContentFlags.IGNORE_NODRAW_OPAQUE: 8192>
LADDER = <ContentFlags.LADDER: 536870912>
LAST_VISIBLE = <ContentFlags.OPAQUE: 128>
MONSTER = <ContentFlags.MONSTER: 33554432>
MONSTERCLIP = <ContentFlags.MONSTERCLIP: 131072>
MOVEABLE = <ContentFlags.MOVEABLE: 16384>
OPAQUE = <ContentFlags.OPAQUE: 128>
ORIGIN = <ContentFlags.ORIGIN: 16777216>
PLAYERCLIP = <ContentFlags.PLAYERCLIP: 65536>
SLIME = <ContentFlags.SLIME: 16>
SOLID = <ContentFlags.SOLID: 1>
TEAM1 = <ContentFlags.TEAM1: 2048>
TEAM2 = <ContentFlags.TEAM2: 4096>
TESTFOGVOLUME = <ContentFlags.TESTFOGVOLUME: 256>
TRANSLUCENT = <ContentFlags.TRANSLUCENT: 268435456>
UNUSED = <ContentFlags.UNUSED: 512>
WATER = <ContentFlags.WATER: 32>
WINDOW = <ContentFlags.WINDOW: 2>
_member_map_ = OrderedDict([('EMPTY', <ContentFlags.EMPTY: 0>), ('SOLID', <ContentFlags.SOLID: 1>), ('WINDOW', <ContentFlags.WINDOW: 2>), ('AUX', <ContentFlags.AUX: 4>), ('GRATE', <ContentFlags.GRATE: 8>), ('SLIME', <ContentFlags.SLIME: 16>), ('WATER', <ContentFlags.WATER: 32>), ('BLOCKLOS', <ContentFlags.BLOCKLOS: 64>), ('OPAQUE', <ContentFlags.OPAQUE: 128>), ('LAST_VISIBLE', <ContentFlags.OPAQUE: 128>), ('ALL_VISIBLE', <ContentFlags.ALL_VISIBLE: 255>), ('TESTFOGVOLUME', <ContentFlags.TESTFOGVOLUME: 256>), ('UNUSED', <ContentFlags.UNUSED: 512>), ('TEAM1', <ContentFlags.TEAM1: 2048>), ('TEAM2', <ContentFlags.TEAM2: 4096>), ('IGNORE_NODRAW_OPAQUE', <ContentFlags.IGNORE_NODRAW_OPAQUE: 8192>), ('MOVEABLE', <ContentFlags.MOVEABLE: 16384>), ('AREAPORTAL', <ContentFlags.AREAPORTAL: 32768>), ('PLAYERCLIP', <ContentFlags.PLAYERCLIP: 65536>), ('MONSTERCLIP', <ContentFlags.MONSTERCLIP: 131072>), ('CURRENT_0', <ContentFlags.CURRENT_0: 262144>), ('CURRENT_90', <ContentFlags.CURRENT_90: 524288>), ('CURRENT_180', <ContentFlags.CURRENT_180: 1048576>), ('CURRENT_270', <ContentFlags.CURRENT_270: 2097152>), ('CURRENT_UP', <ContentFlags.CURRENT_UP: 4194304>), ('CURRENT_DOWN', <ContentFlags.CURRENT_DOWN: 8388608>), ('ORIGIN', <ContentFlags.ORIGIN: 16777216>), ('MONSTER', <ContentFlags.MONSTER: 33554432>), ('DEBRIS', <ContentFlags.DEBRIS: 67108864>), ('DETAIL', <ContentFlags.DETAIL: 134217728>), ('TRANSLUCENT', <ContentFlags.TRANSLUCENT: 268435456>), ('LADDER', <ContentFlags.LADDER: 536870912>), ('HITBOX', <ContentFlags.HITBOX: 1073741824>)])
_member_names_ = ['EMPTY', 'SOLID', 'WINDOW', 'AUX', 'GRATE', 'SLIME', 'WATER', 'BLOCKLOS', 'OPAQUE', 'ALL_VISIBLE', 'TESTFOGVOLUME', 'UNUSED', 'TEAM1', 'TEAM2', 'IGNORE_NODRAW_OPAQUE', 'MOVEABLE', 'AREAPORTAL', 'PLAYERCLIP', 'MONSTERCLIP', 'CURRENT_0', 'CURRENT_90', 'CURRENT_180', 'CURRENT_270', 'CURRENT_UP', 'CURRENT_DOWN', 'ORIGIN', 'MONSTER', 'DEBRIS', 'DETAIL', 'TRANSLUCENT', 'LADDER', 'HITBOX']
_value2member_map_ = {0: <ContentFlags.EMPTY: 0>, 1: <ContentFlags.SOLID: 1>, 2: <ContentFlags.WINDOW: 2>, 4: <ContentFlags.AUX: 4>, 8: <ContentFlags.GRATE: 8>, 16: <ContentFlags.SLIME: 16>, 32: <ContentFlags.WATER: 32>, 64: <ContentFlags.BLOCKLOS: 64>, 128: <ContentFlags.OPAQUE: 128>, 255: <ContentFlags.ALL_VISIBLE: 255>, 256: <ContentFlags.TESTFOGVOLUME: 256>, 512: <ContentFlags.UNUSED: 512>, 2048: <ContentFlags.TEAM1: 2048>, 4096: <ContentFlags.TEAM2: 4096>, 8192: <ContentFlags.IGNORE_NODRAW_OPAQUE: 8192>, 16384: <ContentFlags.MOVEABLE: 16384>, 32768: <ContentFlags.AREAPORTAL: 32768>, 65536: <ContentFlags.PLAYERCLIP: 65536>, 131072: <ContentFlags.MONSTERCLIP: 131072>, 262144: <ContentFlags.CURRENT_0: 262144>, 524288: <ContentFlags.CURRENT_90: 524288>, 1048576: <ContentFlags.CURRENT_180: 1048576>, 2097152: <ContentFlags.CURRENT_270: 2097152>, 4194304: <ContentFlags.CURRENT_UP: 4194304>, 8388608: <ContentFlags.CURRENT_DOWN: 8388608>, 16777216: <ContentFlags.ORIGIN: 16777216>, 33554432: <ContentFlags.MONSTER: 33554432>, 67108864: <ContentFlags.DEBRIS: 67108864>, 134217728: <ContentFlags.DETAIL: 134217728>, 268435456: <ContentFlags.TRANSLUCENT: 268435456>, 536870912: <ContentFlags.LADDER: 536870912>, 1073741824: <ContentFlags.HITBOX: 1073741824>}
class engines.trace.ContentMasks[source]

Bases: enum.IntEnum

Content masks wrapper enumerator.

_member_type_

alias of int

_generate_next_value_(name, start, count, last_values)
ALL = <ContentMasks.ALL: 4294967295>
BLOCKLOS = <ContentMasks.BLOCKLOS: 16449>
BLOCKLOS_AND_NPCS = <ContentMasks.BLOCKLOS_AND_NPCS: 33570881>
CURRENT = <ContentMasks.CURRENT: 16515072>
DEAD_SOLID = <ContentMasks.DEAD_SOLID: 65547>
NPC_SOLID = <ContentMasks.NPC_SOLID: 33701899>
NPC_WORLD_STATIC = <ContentMasks.NPC_WORLD_STATIC: 131083>
OPAQUE = <ContentMasks.OPAQUE: 16513>
OPAQUE_AND_NPCS = <ContentMasks.OPAQUE_AND_NPCS: 33570945>
PLAYER_SOLID = <ContentMasks.PLAYER_SOLID: 33636363>
PLAYER_SOLID_BRUSH_ONLY = <ContentMasks.PLAYER_SOLID_BRUSH_ONLY: 81931>
SHOT = <ContentMasks.SHOT: 1174421507>
SHOT_HULL = <ContentMasks.SHOT_HULL: 100679691>
SHOT_PORTAL = <ContentMasks.SHOT_PORTAL: 33570819>
SOLID = <ContentMasks.SOLID: 33570827>
SOLID_BRUSH_ONLY = <ContentMasks.SOLID_BRUSH_ONLY: 16395>
SPLIT_AREA_PORTAL = <ContentMasks.SPLIT_AREA_PORTAL: 48>
VISIBLE = <ContentMasks.VISIBLE: 24705>
VISIBLE_AND_NPCS = <ContentMasks.VISIBLE_AND_NPCS: 33579137>
WATER = <ContentMasks.WATER: 16432>
_member_map_ = OrderedDict([('ALL', <ContentMasks.ALL: 4294967295>), ('SOLID', <ContentMasks.SOLID: 33570827>), ('PLAYER_SOLID', <ContentMasks.PLAYER_SOLID: 33636363>), ('NPC_SOLID', <ContentMasks.NPC_SOLID: 33701899>), ('WATER', <ContentMasks.WATER: 16432>), ('OPAQUE', <ContentMasks.OPAQUE: 16513>), ('OPAQUE_AND_NPCS', <ContentMasks.OPAQUE_AND_NPCS: 33570945>), ('BLOCKLOS', <ContentMasks.BLOCKLOS: 16449>), ('BLOCKLOS_AND_NPCS', <ContentMasks.BLOCKLOS_AND_NPCS: 33570881>), ('VISIBLE', <ContentMasks.VISIBLE: 24705>), ('VISIBLE_AND_NPCS', <ContentMasks.VISIBLE_AND_NPCS: 33579137>), ('SHOT', <ContentMasks.SHOT: 1174421507>), ('SHOT_HULL', <ContentMasks.SHOT_HULL: 100679691>), ('SHOT_PORTAL', <ContentMasks.SHOT_PORTAL: 33570819>), ('SOLID_BRUSH_ONLY', <ContentMasks.SOLID_BRUSH_ONLY: 16395>), ('PLAYER_SOLID_BRUSH_ONLY', <ContentMasks.PLAYER_SOLID_BRUSH_ONLY: 81931>), ('NPC_WORLD_STATIC', <ContentMasks.NPC_WORLD_STATIC: 131083>), ('SPLIT_AREA_PORTAL', <ContentMasks.SPLIT_AREA_PORTAL: 48>), ('CURRENT', <ContentMasks.CURRENT: 16515072>), ('DEAD_SOLID', <ContentMasks.DEAD_SOLID: 65547>)])
_member_names_ = ['ALL', 'SOLID', 'PLAYER_SOLID', 'NPC_SOLID', 'WATER', 'OPAQUE', 'OPAQUE_AND_NPCS', 'BLOCKLOS', 'BLOCKLOS_AND_NPCS', 'VISIBLE', 'VISIBLE_AND_NPCS', 'SHOT', 'SHOT_HULL', 'SHOT_PORTAL', 'SOLID_BRUSH_ONLY', 'PLAYER_SOLID_BRUSH_ONLY', 'NPC_WORLD_STATIC', 'SPLIT_AREA_PORTAL', 'CURRENT', 'DEAD_SOLID']
_value2member_map_ = {4294967295: <ContentMasks.ALL: 4294967295>, 33570827: <ContentMasks.SOLID: 33570827>, 33636363: <ContentMasks.PLAYER_SOLID: 33636363>, 33701899: <ContentMasks.NPC_SOLID: 33701899>, 16432: <ContentMasks.WATER: 16432>, 16513: <ContentMasks.OPAQUE: 16513>, 33570945: <ContentMasks.OPAQUE_AND_NPCS: 33570945>, 16449: <ContentMasks.BLOCKLOS: 16449>, 33570881: <ContentMasks.BLOCKLOS_AND_NPCS: 33570881>, 24705: <ContentMasks.VISIBLE: 24705>, 33579137: <ContentMasks.VISIBLE_AND_NPCS: 33579137>, 1174421507: <ContentMasks.SHOT: 1174421507>, 100679691: <ContentMasks.SHOT_HULL: 100679691>, 33570819: <ContentMasks.SHOT_PORTAL: 33570819>, 16395: <ContentMasks.SOLID_BRUSH_ONLY: 16395>, 81931: <ContentMasks.PLAYER_SOLID_BRUSH_ONLY: 81931>, 131083: <ContentMasks.NPC_WORLD_STATIC: 131083>, 48: <ContentMasks.SPLIT_AREA_PORTAL: 48>, 16515072: <ContentMasks.CURRENT: 16515072>, 65547: <ContentMasks.DEAD_SOLID: 65547>}
class engines.trace.DisplacementFlags

Bases: Boost.Python.enum

BUILDABLE = _engines._trace.DisplacementFlags.BUILDABLE
SURFACE = _engines._trace.DisplacementFlags.SURFACE
SURFPROP1 = _engines._trace.DisplacementFlags.SURFPROP1
SURFPROP2 = _engines._trace.DisplacementFlags.SURFPROP2
WALKABLE = _engines._trace.DisplacementFlags.WALKABLE
names = {'SURFACE': _engines._trace.DisplacementFlags.SURFACE, 'WALKABLE': _engines._trace.DisplacementFlags.WALKABLE, 'BUILDABLE': _engines._trace.DisplacementFlags.BUILDABLE, 'SURFPROP1': _engines._trace.DisplacementFlags.SURFPROP1, 'SURFPROP2': _engines._trace.DisplacementFlags.SURFPROP2}
values = {1: _engines._trace.DisplacementFlags.SURFACE, 2: _engines._trace.DisplacementFlags.WALKABLE, 4: _engines._trace.DisplacementFlags.BUILDABLE, 8: _engines._trace.DisplacementFlags.SURFPROP1, 16: _engines._trace.DisplacementFlags.SURFPROP2}
class engines.trace.EntityEnumerator

Bases: Boost.Python.instance

__init__((object)arg1) → None
enum_entity((EntityEnumerator)arg1, (HandleEntity)arg2) → bool :

Gets called with each handle.

enum_entity( (EntityEnumerator)arg1, (HandleEntity)arg2) -> None

class engines.trace.GameTrace

Bases: _engines._trace.BaseTrace

__init__((object)arg1) → None
did_hit((GameTrace)arg1) → bool :

Returns true if there was any kind of impact at all

did_hit_world((GameTrace)arg1) → bool :

Returns True if the ray hit the world entity.

entity
entity_index

Returns the index of the entity that was hit.

fraction_left_solid
hitbox
hitgroup
physicsbone
surface
class engines.trace.Ray

Bases: Boost.Python.instance

__init__((object)arg1, (Vector)arg2, (Vector)arg3) → object

__init__( (object)arg1, (Vector)arg2, (Vector)arg3, (Vector)arg4, (Vector)arg5) -> object

class engines.trace.Surface

Bases: Boost.Python.instance

__init__((object)arg1) → None
flags
name
surface_props
class engines.trace.SurfaceFlags

Bases: Boost.Python.enum

BUMPLIGHT = _engines._trace.SurfaceFlags.BUMPLIGHT
HINT = _engines._trace.SurfaceFlags.HINT
HITBOX = _engines._trace.SurfaceFlags.HITBOX
LIGHT = _engines._trace.SurfaceFlags.LIGHT
NOCHOP = _engines._trace.SurfaceFlags.NOCHOP
NODECALS = _engines._trace.SurfaceFlags.NODECALS
NODRAW = _engines._trace.SurfaceFlags.NODRAW
NOLIGHT = _engines._trace.SurfaceFlags.NOLIGHT
NOPORTAL = _engines._trace.SurfaceFlags.NOPORTAL
NOSHADOWS = _engines._trace.SurfaceFlags.NOSHADOWS
SKIP = _engines._trace.SurfaceFlags.SKIP
SKY = _engines._trace.SurfaceFlags.SKY
SKY2D = _engines._trace.SurfaceFlags.SKY2D
TRANS = _engines._trace.SurfaceFlags.TRANS
TRIGGER = _engines._trace.SurfaceFlags.TRIGGER
WARP = _engines._trace.SurfaceFlags.WARP
names = {'LIGHT': _engines._trace.SurfaceFlags.LIGHT, 'SKY2D': _engines._trace.SurfaceFlags.SKY2D, 'SKY': _engines._trace.SurfaceFlags.SKY, 'WARP': _engines._trace.SurfaceFlags.WARP, 'TRANS': _engines._trace.SurfaceFlags.TRANS, 'NOPORTAL': _engines._trace.SurfaceFlags.NOPORTAL, 'TRIGGER': _engines._trace.SurfaceFlags.TRIGGER, 'NODRAW': _engines._trace.SurfaceFlags.NODRAW, 'HINT': _engines._trace.SurfaceFlags.HINT, 'SKIP': _engines._trace.SurfaceFlags.SKIP, 'NOLIGHT': _engines._trace.SurfaceFlags.NOLIGHT, 'BUMPLIGHT': _engines._trace.SurfaceFlags.BUMPLIGHT, 'NOSHADOWS': _engines._trace.SurfaceFlags.NOSHADOWS, 'NODECALS': _engines._trace.SurfaceFlags.NODECALS, 'NOCHOP': _engines._trace.SurfaceFlags.NOCHOP, 'HITBOX': _engines._trace.SurfaceFlags.HITBOX}
values = {1: _engines._trace.SurfaceFlags.LIGHT, 2: _engines._trace.SurfaceFlags.SKY2D, 4: _engines._trace.SurfaceFlags.SKY, 8: _engines._trace.SurfaceFlags.WARP, 16: _engines._trace.SurfaceFlags.TRANS, 32: _engines._trace.SurfaceFlags.NOPORTAL, 64: _engines._trace.SurfaceFlags.TRIGGER, 128: _engines._trace.SurfaceFlags.NODRAW, 256: _engines._trace.SurfaceFlags.HINT, 512: _engines._trace.SurfaceFlags.SKIP, 1024: _engines._trace.SurfaceFlags.NOLIGHT, 2048: _engines._trace.SurfaceFlags.BUMPLIGHT, 4096: _engines._trace.SurfaceFlags.NOSHADOWS, 8192: _engines._trace.SurfaceFlags.NODECALS, 16384: _engines._trace.SurfaceFlags.NOCHOP, 32768: _engines._trace.SurfaceFlags.HITBOX}
class engines.trace.TraceFilter

Bases: Boost.Python.instance

__init__((object)arg1) → None
get_trace_type((TraceFilter)arg1) → TraceType :

Returns the trace type.

get_trace_type( (TraceFilter)arg1) -> None

should_hit_entity((TraceFilter)arg1, (HandleEntity)arg2, (Channel)arg3) → bool :

Returns True if the a should hit the entity.

should_hit_entity( (TraceFilter)arg1, (HandleEntity)arg2, (Channel)arg3) -> None

class engines.trace.TraceFilterSimple(ignore=(), trace_type=_engines._trace.TraceType.EVERYTHING)[source]

Bases: _engines._trace.TraceFilter

A simple trace filter.

__init__(ignore=(), trace_type=_engines._trace.TraceType.EVERYTHING)[source]

Initialize the filter.

Parameters:
  • ignore (iterable) – An iterable of entity indexes to ignore. The trace will not hit these entities.
  • trace_type (TraceType) – The trace type that should be used.
get_trace_type()[source]

Return the trace type.

Return type:TraceType
should_hit_entity(entity, mask)[source]

Called when a trace is about to hit an entity.

Parameters:
  • entity (HandleEntity) – The entity that should be hit.
  • mask (int) – The mask that was used to intialize the trace.
Return type:

bool

class engines.trace.TraceType

Bases: Boost.Python.enum

ENTITIES_ONLY = _engines._trace.TraceType.ENTITIES_ONLY
EVERYTHING = _engines._trace.TraceType.EVERYTHING
EVERYTHING_FILTER_PROPS = _engines._trace.TraceType.EVERYTHING_FILTER_PROPS
WORLD_ONLY = _engines._trace.TraceType.WORLD_ONLY
names = {'EVERYTHING': _engines._trace.TraceType.EVERYTHING, 'WORLD_ONLY': _engines._trace.TraceType.WORLD_ONLY, 'ENTITIES_ONLY': _engines._trace.TraceType.ENTITIES_ONLY, 'EVERYTHING_FILTER_PROPS': _engines._trace.TraceType.EVERYTHING_FILTER_PROPS}
values = {0: _engines._trace.TraceType.EVERYTHING, 1: _engines._trace.TraceType.WORLD_ONLY, 2: _engines._trace.TraceType.ENTITIES_ONLY, 3: _engines._trace.TraceType.EVERYTHING_FILTER_PROPS}