srctools.const

This module contains various constants and enums that are useful for multiple modules.

srctools.const.add_unknown(
ns: MutableMapping[str, Any],
long: bool = False,
) None

Add dummy members for enum.Flag to allow all bits to be set.

It should be called at the end of the class body. This is useful to allow for some compatibility with unhandled games, ensuring extra bits are preserved when resaving. All existing bits will be skipped.

Parameters:
  • ns – The class namespace to add members to. This should be set to locals() or vars().

  • long – If set, extend to 64 bits, not 32 bits.

class srctools.const.GameID(
value,
names=None,
*,
module=None,
qualname=None,
type=None,
start=1,
boundary=None,
)

Bases: Enum

Steam appIDs for Source Engine games.

BASE_SOURCE_ENGINE_2 = '212'
SOURCE_BASE_2007 = '216'

Alias: SRC_2007

ORANGE_BOX_MULTIPLAYER = '217'

Alias: OBOX_MP

HALF_LIFE_2 = '220'

Alias: HL2

COUNTER_STRIKE_SOURCE = '240'

Alias: CS

HALF_LIFE_SOURCE = '280'

Alias: HL1

DAY_OF_DEFEAT_SOURCE = '300'

Alias: DOD

ALL_SOURCE_ENGINE_PATHS_HL2 = '312'
HALF_LIFE_2_DEATHMATCH = '320'

Alias: HL2_DM

HALF_LIFE_2_LOST_COAST = '340'

Alias: HL2_LC

HALF_LIFE_DEATHMATCH_SOURCE = '360'

Alias: HL_DM

HALF_LIFE_2_EPISODE_1 = '380'

Alias: HL2_EP1

PORTAL = '400'

Alias: P1

HALF_LIFE_2_EPISODE_TWO = '420'

Alias: HL2_EP2

TEAM_FORTRESS_2 = '440'

Alias: TF2

LEFT_4_DEAD = '500'

Alias: L4D

DOTA_2 = '570'

Alias: DOTA2

PORTAL_2 = '620'

Alias: P2

APERTURE_TAG = '280740'

Alias: TAG

THINKING_WITH_TIME_MACHINE = '286080'

Alias: TWTM

PORTAL_STORIES_MEL = '317400'

Alias: MEL

REXAURA = '317790'
ALIEN_SWARM = '630'

Alias: ASW

COUNTER_STRIKE_GLOBAL_OFFENSIVE = '730'

Alias: CSGO

SIN_EPISODES_EMERGENCE = '1300'
SIN_EPISODES_ARENA = '1308'
SIN_EPISODES_UNABRIDGED = '1316'
DARK_MESSIAH_OF_MIGHT_AND_MAGIC = '2100'

Alias: DM_MAM

DARK_MESSIAH_MIGHT_AND_MAGIC_MULTIPLAYER = '2130'

Alias: DM_MAM_MP

THE_SHIP = '2400'

Alias: SHIP

BLOODY_GOOD_TIME = '2450'

Alias: BGT

VAMPIRE_THE_MASQUERADE_BLOODLINES = '2600'

Alias: VTMB

GARRYS_MOD = '4000'

Alias: GARRY

ZOMBIE_PANIC_SOURCE = '17500'

Alias: ZP

AGE_OF_CHIVALRY = '17510'

Alias: AOC

SYNERGY = '17520'
DIPRIP = '17530'
ETERNAL_SILENCE = '17550'
PIRATES_VIKINGS_KNIGHTS_II = '17570'

Alias: PVKII

DYSTOPIA = '17580'
INSURGENCY = '17700'
NUCLEAR_DAWN = '17710'
SMASHBALL = '17730'
INSURGENCY_2 = '222880'
CONTAGION = '238430'
class srctools.const.BSPContents(
value,
names=None,
*,
module=None,
qualname=None,
type=None,
start=1,
boundary=None,
)

Bases: Flag

The various CONTENTS_* flags, indicating different collision types.

This is normally for brushes, but is also used on other things like models.

EMPTY = 0x0
SOLID = 0x1

Regular solid brush. Player camera is not valid inside here.

WINDOW = 0x2

Translucent glass.

AUX = 0x4
GRATE = 0x8

Grating, bullets/LOS pass, objects do not.

SLIME = 0x10

Slime-style liquid, opaque.

WATER = 0x20

Is a water brush

MIST = 0x40
OPAQUE = 0x80

Blocks LOS

TEST_FOG_VOLUME = 0x100

May be non-solid, but cannot be seen through.

TEAM1 = 0x800

Special team-only clips.

TEAM2 = 0x1000

Special team-only clips.

IGNORE_NODRAW_OPAQUE = 0x2000

“Ignore CONTENTS_OPAQUE on surfaces that have SURF_NODRAW.

MOVABLE = 0x4000
AREAPORTAL = 0x8000

Is an areaportal brush.

PLAYER_CLIP = 0x10000

Functions like tools/toolsplayerclip.

NPC_CLIP = 0x20000

Functions like tools/toolsclip.

CURRENT_0 = 0x40000

Specifies water currents, can be mixed.

CURRENT_90 = 0x80000
CURRENT_180 = 0x100000
CURRENT_270 = 0x200000
CURRENT_UP = 0x400000
CURRENT_DOWN = 0x800000
ORIGIN = 0x1000000

Behaves like a tools/toolsorigin brush, used to set origin. This is Goldsource era and is very deprecated.

NPC = 0x2000000

This shouldn’t be on brushes, it’s used for NPCs.

DEBRIS = 0x4000000
DETAIL = 0x8000000

The brush is marked as func_detail.

TRANSLUCENT = 0x10000000

A face uses $translucent, $alphatest, $alpha, etc.

LADDER = 0x20000000
HITBOX = 0x40000000
class srctools.const.SurfFlags(
value,
names=None,
*,
module=None,
qualname=None,
type=None,
start=1,
boundary=None,
)

Bases: Flag

The various SURF_* flags, indicating different attributes for faces.

NONE = 0x0
LIGHT = 0x1

The face has lighting info.

SKYBOX_2D = 0x2

Nodraw, but when visible 2D skybox should be rendered.

SKYBOX_3D = 0x4

Nodraw, but when visible 2D and 3D skybox should be rendered.

WATER_WARP = 0x8

According to the header, “turbulent water warp”.

TRANSLUCENT = 0x10

Translucent material.

NOPORTAL = 0x20

Portalgun blocking material.

TRIGGER = 0x40

XBox only - is a trigger surface.

NODRAW = 0x80

Texture isn’t used, it’s invisible.

HINT = 0x100

A hint brush.

SKIP = 0x200

Skip brush, removed from map.

NOLIGHT = 0x400

No light needs to be calculated for the surface.

BUMPLIGHT = 0x800

Needs three lightmaps for bumpmapping.

NO_SHADOWS = 0x1000

Doesn’t receive shadows.

NO_DECALS = 0x2000

Rejects decals.

NO_SUBDIVIDE = 0x4000

Not allowed to split up the brush face.

HITBOX = 0x8000

According to the header, “Part of a hitbox”.