sourcemod.halflife — Engine Interaction

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

Module Contents

sourcemod.halflife.SOURCE_SDK_UNKNOWN
sourcemod.halflife.SOURCE_SDK_ORIGINAL
sourcemod.halflife.SOURCE_SDK_DARKMESSIAH
sourcemod.halflife.SOURCE_SDK_EPISODE1
sourcemod.halflife.SOURCE_SDK_EPISODE2
sourcemod.halflife.SOURCE_SDK_LEFT4DEAD
Constants that identify Source Engine versions.
sourcemod.halflife.get_current_map()
Returns the current map name, excluding the “.bsp” extension
sourcemod.halflife.get_engine_time()

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

Return type:float
sourcemod.halflife.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.
sourcemod.halflife.get_game_folder_name()
Returns the name of game’s directory, e.g. ‘cstrike’ or ‘tf’
sourcemod.halflife.get_game_time()

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

Return type:float
sourcemod.halflife.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.

sourcemod.halflife.is_decal_precached(decal)
Returns whether or not the given decal is precached.
sourcemod.halflife.is_dedicated_server()
Returns whether the server is dedicated.
sourcemod.halflife.is_generic_precached(generic)
Returns whether the given generic file is precached.
sourcemod.halflife.is_map_valid(map)
Returns whether the given map is valid or not. map should contain a map name, excluding the “.bsp” extension.
sourcemod.halflife.is_model_precached(model)
Returns whether the given model is precached.
sourcemod.halflife.is_sound_precached(sound)
Returns whether the sound is precached.
sourcemod.halflife.precache_decal(decal[, preload=False])
sourcemod.halflife.precache_generic(generic[, preload=False])
sourcemod.halflife.precache_model(model[, preload=False])
sourcemod.halflife.precache_sentence_file(sentence_file[, preload=False])
sourcemod.halflife.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