engines.precache module

Provides classes to automatically precache models and decals.

class engines.precache.Decal(path, preload=False, download=False)[source]

Bases: engines.precache._PrecacheBase

Class used to handle a specific decal.

_precache_method()
precache_decal( (_EngineServer)arg1, (str)arg2 [, (bool)preload=False]) -> int :
Precaches a decal file and returns an integer containing its index.
precache_table = 'decalprecache'
class engines.precache.Generic(path, preload=False, download=False)[source]

Bases: engines.precache._PrecacheBase

Class used to handle generic precaching.

_precache_method()
precache_generic( (_EngineServer)arg1, (str)arg2 [, (bool)preload=False]) -> int :
Precaches a generic asset file and returns an integer containing its index.
precache_table = 'genericprecache'
class engines.precache.Model(path, preload=False, download=False)[source]

Bases: engines.precache._PrecacheBase

Class used to handle a specific model.

_precache_method()
precache_model( (_EngineServer)arg1, (str)arg2 [, (bool)preload=False]) -> int :
Precaches a model and returns an integer containing its index.
precache_table = 'modelprecache'
class engines.precache._PrecacheBase(path, preload=False, download=False)[source]

Bases: core.AutoUnload

Base precache class used to interact with a specific object.

__init__(path, preload=False, download=False)[source]

Add the file to downloadables if download is True.

Parameters:
  • path (str) – Path to file to use.
  • preload (bool) – If True the file will be pre-loaded.
  • download (bool) – If True the file will be added to the downloadables string table.
_precache()[source]

Precache the path.

_server_spawn(game_event)[source]

Precache the object on map change.

_unload_instance()[source]

Remove from the downloads list and unregister server_spawn.

_downloads = None
_precache_method

Return a method to precache the file.

index

Return the precached index of the object.

Return type:int
path

Return the path.

Return type:str
precache_table

Return the name of the precache table.

Return type:str