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.IntFlag

Content flags wrapper enumerator.

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>
class engines.trace.ContentMasks[source]

Bases: enum.IntFlag

Content masks wrapper enumerator.

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>
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}