listeners package

Module contents

Provides listener based functionality.

class listeners.ButtonStatus[source]

Bases: enum.IntEnum

Indicate whether a button has been pressed or released.

PRESSED = <ButtonStatus.PRESSED: 1>
RELEASED = <ButtonStatus.RELEASED: 0>
class listeners.ListenerManager

Bases: Boost.Python.instance

__init__((object)arg1) → None
clear((ListenerManager)arg1) → None :

Remove all registered callbacks.

finalize((ListenerManager)arg1) → None :

Called when the last callback is being unregistered.

initialize((ListenerManager)arg1) → None :

Called when the first callback is being registered.

notify()
object notify(tuple args, dict kwds) :
Notifies all registered listeners.
register_listener((ListenerManager)arg1, (object)callable) → None :

Registers a callable object. If it was already registered it will be ignored.

unregister_listener((ListenerManager)arg1, (object)callable) → None :

Removes a callable object. If it was not registered nothing will happen.

class listeners.ListenerManagerDecorator(callback)[source]

Bases: core.AutoUnload

Base decorator class used to register/unregister a listener.

__init__(callback)[source]

Store the callback and register the listener.

manager

Return a ListenerManager object.

name

Return the class name of the instance.

class listeners.OnClientActive(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a ClientActive listener.

manager = <_listeners.ListenerManager object>
class listeners.OnClientConnect(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a ClientConnect listener.

manager = <_listeners.ListenerManager object>
class listeners.OnClientDisconnect(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a ClientDisconnect listener.

manager = <_listeners.ListenerManager object>
class listeners.OnClientFullyConnect(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a ClientFullyConnect listener.

manager = <_listeners.ListenerManager object>
class listeners.OnClientPutInServer(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a ClientPutInServer listener.

manager = <_listeners.ListenerManager object>
class listeners.OnClientSettingsChanged(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a ClientSettingsChanged listener.

manager = <_listeners.ListenerManager object>
class listeners.OnCombinerPreCache(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a OnCombinerPreCache listener.

manager = <_listeners.ListenerManager object>
class listeners.OnConVarChanged(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a ConVar listener.

manager = <_listeners.ListenerManager object>
class listeners.OnDataLoaded(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a OnDataLoaded listener.

manager = <_listeners.ListenerManager object>
class listeners.OnDataUnloaded(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a OnDataUnloaded listener.

manager = <_listeners.ListenerManager object>
class listeners.OnEdictAllocated(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister an OnEdictAllocated listener.

manager = <_listeners.ListenerManager object>
class listeners.OnEdictFreed(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister an OnEdictFreed listener.

manager = <_listeners.ListenerManager object>
class listeners.OnEntityCreated(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a OnEntityCreated listener.

manager = <_listeners.ListenerManager object>
class listeners.OnNetworkedEntityCreated(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a OnNetworkedEntityCreated listener.

manager = <_listeners.ListenerManager object>
class listeners.OnEntityDeleted(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a OnEntityDeleted listener.

manager = <_listeners.ListenerManager object>
class listeners.OnNetworkedEntityDeleted(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a OnNetworkedEntityDeleted listener.

manager = <_listeners.ListenerManager object>
class listeners.OnEntityCollision(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a OnEntityCollision listener.

manager = <_listeners.ListenerManager object>
class listeners.OnEntityTransmit(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a OnEntityTransmit listener.

manager = <_listeners.ListenerManager object>
class listeners.OnEntityOutput(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister an EntityOutput listener.

manager = <listeners.OnEntityOutputListenerManager object>
class listeners.OnEntityOutputListenerManager[source]

Bases: _listeners.ListenerManager

Register/unregister an EntityOutput listener.

finalize()[source]

Called when the last callback is being unregistered.

initialize()[source]

Called when the first callback is being registered.

class listeners.OnEntityPreSpawned(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a OnEntityPreSpawned listener.

manager = <_listeners.ListenerManager object>
class listeners.OnNetworkedEntityPreSpawned(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a OnNetworkedEntityPreSpawned listener.

manager = <_listeners.ListenerManager object>
class listeners.OnEntitySpawned(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a OnEntitySpawned listener.

manager = <_listeners.ListenerManager object>
class listeners.OnNetworkedEntitySpawned(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a OnNetworkedEntitySpawned listener.

manager = <_listeners.ListenerManager object>
class listeners.OnLevelInit(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a LevelInit listener.

manager = <_listeners.ListenerManager object>
class listeners.OnLevelShutdown(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a LevelShutdown listener.

manager = <_listeners.ListenerManager object>
class listeners.OnLevelEnd(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a map end listener.

manager = <_listeners.ListenerManager object>
class listeners.OnNetworkidValidated(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a NetworkidValidated listener.

manager = <_listeners.ListenerManager object>
class listeners.OnButtonStateChanged(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a button state change listener.

manager = <_listeners.ListenerManager object>
class listeners.OnPlayerCollision(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a OnPlayerCollision listener.

manager = <_listeners.ListenerManager object>
class listeners.OnPlayerTransmit(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a OnPlayerTransmit listener.

manager = <_listeners.ListenerManager object>
class listeners.OnPlayerRunCommand(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a run command listener.

manager = <_listeners.ListenerManager object>
class listeners.OnPlayerPostRunCommand(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a post run command listener.

manager = <_listeners.ListenerManager object>
class listeners.OnPluginLoaded(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a plugin loaded listener.

manager = <_listeners.ListenerManager object>
class listeners.OnPluginLoading(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a plugin loading listener.

manager = <_listeners.ListenerManager object>
class listeners.OnPluginUnloaded(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a plugin unloaded listener.

manager = <_listeners.ListenerManager object>
class listeners.OnPluginUnloading(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a plugin unloading listener.

manager = <_listeners.ListenerManager object>
class listeners.OnQueryCvarValueFinished(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister an OnQueryCvarValueFinished listener.

manager = <_listeners.ListenerManager object>
class listeners.OnServerActivate(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a ServerActivate listener.

manager = <_listeners.ListenerManager object>
class listeners.OnTick(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a Tick listener.

manager = <_listeners.ListenerManager object>
class listeners.OnVersionUpdate(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a version update listener.

manager = <_listeners.ListenerManager object>
class listeners.OnServerOutput(callback)[source]

Bases: listeners.ListenerManagerDecorator

Register/unregister a server output listener.

manager = <_listeners.ListenerManager object>
listeners.get_button_combination_status(old_buttons, new_buttons, combination)[source]

Return the status of a button combination.

Parameters:
Returns:

Return the status of the button combination. If the combination was neither pressed nor released, None will be returned.

Return type:

ButtonStatus

Example:

@OnButtonStateChanged
def on_buttons_state_changed(player, old_buttons, new_buttons):
    status = get_button_combination_status(old_buttons, new_buttons,
        PlayerButtons.ATTACK|PlayerButtons.JUMP)

    if status == ButtonStatus.PRESSED:
        SayText2(
            '{} is jumping and attacking.'.format(player.name)).send()

    elif status == ButtonStatus.RELEASED:
        SayText2(
            '{} stopped jumping and attacking at the same time.'.format(
            player.name)).send()