sourcemod.halflife — Engine Interaction

The halflife module contains functions that interact with the HL2 engine.

Module Contents

SOURCE_SDK_UNKNOWN
SOURCE_SDK_ORIGINAL
SOURCE_SDK_DARKMESSIAH
SOURCE_SDK_EPISODE1
SOURCE_SDK_EPISODE2
SOURCE_SDK_EPISODE2VALVE
SOURCE_SDK_LEFT4DEAD
SOURCE_SDK_LEFT4DEAD2
SOURCE_SDK_ALIENSWARM

Constants that identify Source Engine versions.

get_current_map()

Returns the current map name, excluding the ”.bsp” extension

get_engine_time()

Returns a float containing a high-precision time value for profiling the engine.

Return type:float
get_game_description([original=False])

Returns the game description of the mod. If original is True, it retrieves the original game description, ignoring any potential hooks from plug-ins.

get_game_folder_name()

Returns the name of game’s directory, e.g. ‘cstrike’ or ‘tf’

get_game_time()

Returns the game time based on the game tick as a float.

Return type:float
guess_sdk_version()

Guesses the SDK version a mod was compiled against. If nothing specific is known about the game, the engine version is used instead. The return values are guaranteed to increase chronologically (that is, a later release will have a higher value).

Returns a SOURCE_SDK constant identifying the engine version.

is_decal_precached(decal)

Returns whether or not the given decal is precached.

is_dedicated_server()

Returns whether the server is dedicated.

is_generic_precached(generic)

Returns whether the given generic file is precached.

is_map_valid(map)

Returns whether the given map is valid or not. map should contain a map name, excluding the ”.bsp” extension.

is_model_precached(model)

Returns whether the given model is precached.

is_sound_precached(sound)

Returns whether the sound is precached.

precache_decal(decal[, preload=False])
precache_generic(generic[, preload=False])
precache_model(model[, preload=False])
precache_sentence_file(sentence_file[, preload=False])
precache_sound(sound[, preload=False])

Precaches the passed decal, generic file, etc. If preload is True, the file will be precached before level startup.

Table Of Contents

Previous topic

sourcemod.forwards — Collections of Callbacks

Next topic

sourcemod.keyvalues — Valve KeyValues

This Page