예제 #1
0
def remove_entities_listener():
    """Remove entities listener."""
    from _core import _sp_plugin
    from memory.manager import manager

    manager.get_global_pointer('GlobalEntityList').remove_entity_listener(
        _sp_plugin)
예제 #2
0
def setup_global_pointers():
    """Set up global pointers."""
    _sp_logger.log_debug('Setting up global pointers...')

    from core import GameConfigObj
    from memory.manager import manager
    from paths import SP_DATA_PATH

    manager.create_global_pointers_from_file(GameConfigObj(
        SP_DATA_PATH / 'memory' / 'global_pointers.ini'))

    _sp_logger.log_debug('Setting up global "server" variables...')
    from engines import server
    try:
        server.server = server.engine_server.server
    except NotImplementedError:
        server.server = manager.get_global_pointer('Server')

    _sp_logger.log_debug('Setting up global "factory_dictionary" variables...')
    from entities import factories
    try:
        from _entities._factories import factory_dictionary
    except ImportError:
        factory_dictionary = manager.get_global_pointer('EntityFactoryDictionary')

    factories.factory_dictionary = factory_dictionary
예제 #3
0
def remove_entities_listener():
    """Remove entities listener."""
    _sp_logger.log_debug("Removing entities listener...")

    from _core import _sp_plugin
    from memory.manager import manager

    manager.get_global_pointer("GlobalEntityList").remove_entity_listener(_sp_plugin)
예제 #4
0
def remove_entities_listener():
    """Remove entities listener."""
    _sp_logger.log_debug('Removing entities listener...')

    from _core import _sp_plugin
    from memory.manager import manager

    manager.get_global_pointer('GlobalEntityList').remove_entity_listener(
        _sp_plugin)
예제 #5
0
def setup_entities_listener():
    """Set up entities listener."""
    _sp_logger.log_debug('Setting up entities listener...')

    from _core import _sp_plugin
    from memory.manager import manager

    manager.get_global_pointer('GlobalEntityList').add_entity_listener(
        _sp_plugin)
예제 #6
0
def setup_entities_listener():
    """Set up entities listener."""
    _sp_logger.log_debug('Setting up entities listener...')

    from _core import _sp_plugin
    from memory.manager import manager

    manager.get_global_pointer('GlobalEntityList').add_entity_listener(
        _sp_plugin)
def remove_entities_listener():
    """Remove entities listener."""
    _sp_logger.log_debug('Removing entities listener...')

    from _core import _sp_plugin
    from memory.manager import manager

    with suppress(NameError):
        manager.get_global_pointer('GlobalEntityList').remove_entity_listener(
            _sp_plugin)
예제 #8
0
def setup_entities_listener():
    """Set up entities listener."""
    from _core import _sp_plugin
    from core import SOURCE_ENGINE

    from memory.manager import manager
    from paths import SP_DATA_PATH

    manager.get_global_pointer('GlobalEntityList').add_entity_listener(
        _sp_plugin)
예제 #9
0
def setup_entities_listener():
    """Set up entities listener."""
    _sp_logger.log_debug("Setting up entities listener...")

    import sys
    from warnings import warn
    from _core import _sp_plugin
    from memory.manager import manager

    try:
        manager.get_global_pointer("GlobalEntityList").add_entity_listener(_sp_plugin)
    except NameError:
        warn(str(sys.exc_info()[1]))
예제 #10
0
def setup_entities_listener():
    """Set up entities listener."""
    _sp_logger.log_debug('Setting up entities listener...')

    import sys
    from warnings import warn
    from _core import _sp_plugin
    from memory.manager import manager

    try:
        manager.get_global_pointer('GlobalEntityList').add_entity_listener(
            _sp_plugin)
    except NameError:
        warn(str(sys.exc_info()[1]))
예제 #11
0
def setup_global_pointers():
    """Set up global pointers."""
    _sp_logger.log_debug('Setting up global pointers...')

    import sys
    from warnings import warn
    from core import GameConfigObj
    from memory.manager import manager
    from paths import SP_DATA_PATH

    manager.create_global_pointers_from_file(GameConfigObj(
        SP_DATA_PATH / 'memory' / 'global_pointers.ini'))

    _sp_logger.log_debug('Setting up global "server" variables...')
    from engines import server
    try:
        server.server = server.engine_server.server
    except NotImplementedError:
        try:
            server.server = manager.get_global_pointer('Server')
        except NameError:
            warn(str(sys.exc_info()[1]))

    _sp_logger.log_debug('Setting up global "factory_dictionary" variables...')
    from entities import factories
    try:
        from _entities._factories import factory_dictionary
    except ImportError:
        try:
            factory_dictionary = manager.get_global_pointer(
                'EntityFactoryDictionary'
            )
        except NameError:
            warn(str(sys.exc_info()[1]))
            return

    factories.factory_dictionary = factory_dictionary
예제 #12
0
def setup_global_pointers():
    """Set up global pointers."""
    _sp_logger.log_debug("Setting up global pointers...")

    import sys
    from warnings import warn
    from core import GameConfigObj
    from memory.manager import manager
    from paths import SP_DATA_PATH

    manager.create_global_pointers_from_file(GameConfigObj(SP_DATA_PATH / "memory" / "global_pointers.ini"))

    _sp_logger.log_debug('Setting up global "server" variables...')
    from engines import server

    try:
        server.server = server.engine_server.server
    except NotImplementedError:
        try:
            server.server = manager.get_global_pointer("Server")
        except NameError:
            warn(str(sys.exc_info()[1]))

    _sp_logger.log_debug('Setting up global "factory_dictionary" variables...')
    from entities import factories

    try:
        from _entities._factories import factory_dictionary
    except ImportError:
        try:
            factory_dictionary = manager.get_global_pointer("EntityFactoryDictionary")
        except NameError:
            warn(str(sys.exc_info()[1]))
            return

    factories.factory_dictionary = factory_dictionary
예제 #13
0
def setup_global_pointers():
    """Set up global pointers."""
    _sp_logger.log_debug('Setting up global pointers...')

    from core import GameConfigObj
    from memory.manager import manager
    from paths import SP_DATA_PATH

    manager.create_global_pointers_from_file(
        GameConfigObj(SP_DATA_PATH / 'memory' / 'global_pointers.ini'))

    _sp_logger.log_debug('Setting up global "server" variables...')
    from engines import server
    try:
        server.server = server.engine_server.server
    except NotImplementedError:
        server.server = manager.get_global_pointer('Server')
예제 #14
0
#   Memory
from memory.manager import manager


# =============================================================================
# >> FORWARD IMPORTS
# =============================================================================
# Source.Python Imports
#   Entities
from _entities._factories import EntityFactory
from _entities._factories import EntityFactoryDictionary


# =============================================================================
# >> ALL DECLARATION
# =============================================================================
__all__ = ('EntityFactory',
           'EntityFactoryDictionary',
           'factory_dictionary',
           )


# ============================================================================
# >> GLOBAL VARIABLES
# ============================================================================
# Get the factory_dictionary instance...
try:
    from _entities._factories import factory_dictionary
except ImportError:
    factory_dictionary = manager.get_global_pointer('EntityFactoryDictionary')
예제 #15
0
    'ShatterSurface',
    'ball',
    'beam',
    'box',
    'polygon',
    'square',
)

# ============================================================================
# >> GLOBAL VARIABLES
# ============================================================================
# Get the first temp entity in the chain...
try:
    from _effects._base import _first_temp_entity
except ImportError:
    _first_temp_entity = manager.get_global_pointer('BaseTempEntity')


# =============================================================================
# >> FUNCTIONS
# =============================================================================
def beam(recipients, start, end, parent=False, **kwargs):
    """A simple wrapper for the temporary effect ``BeamEntPoint``.

    :param RecipientFilter recipients:
        Players that should see the beam.
    :param int/BaseEntity/Vector start:
        The start location of the beam.
    :param int/BaseEntity/Vector end:
        The end location of the beam.
    :param bool parent:
예제 #16
0
           'beam',
           'box',
           'polygon',
           'square',
           'temp_entities',
           )


# ============================================================================
# >> GLOBAL VARIABLES
# ============================================================================
# Get the temp_entities instance...
try:
    from _effects import temp_entities
except ImportError:
    temp_entities = manager.get_global_pointer('_TempEntities')


# =============================================================================
# >> FUNCTIONS
# =============================================================================
def beam(
        recipients, delay, start, end, model_index, halo_index, start_frame,
        frame_rate, life, width, end_width, fade_length, amplitude, red,
        green, blue, alpha, speed, parent=False):
    """A simple wrapper for _TempEntities.beam_ent_point().

    <start> and <end> can be entity indexes or Vector objects.

    If you set <parent> to True, the beam is parented to the given entity
    index(es).
예제 #17
0
# Get the _WeaponDatabase class...
try:
    from _weapons._scripts import _WeaponDatabase

    # Make sure the manager is able to find us...
    manager['_WeaponDatabase'] = _WeaponDatabase
except ImportError:
    _WeaponDatabase = manager.create_type_from_dict(
        '_WeaponDatabase', GameConfigObj(
            SP_DATA_PATH / 'weapons' / 'scripts' / 'WeaponDatabase.ini'))

# Get the global _WeaponDatabase pointer...
manager.create_global_pointers_from_file(GameConfigObj(
    SP_DATA_PATH / 'weapons' / 'scripts' / 'global_pointers.ini'))
_weapon_scripts = manager.get_global_pointer('_WeaponDatabase')


# =============================================================================
# >> CLASSES
# =============================================================================
class WeaponDatabase(object):
    """WeaponDatabase accessor class."""

    def __len__(self):
        """Return the length of the database."""
        return _weapon_scripts._length

    def __getitem__(self, item):
        """Return the WeaponInfo instance matching the given class name."""
        # Loop through all WeaponInfo instances...
예제 #18
0
           'beam',
           'box',
           'polygon',
           'square',
           'temp_entities',
           )


# ============================================================================
# >> GLOBAL VARIABLES
# ============================================================================
# Get the temp_entities instance...
try:
    from _effects import temp_entities
except ImportError:
    temp_entities = manager.get_global_pointer('_TempEntities')

# Get the first temp entity in the chain...
try:
    from _effects._base import _first_temp_entity
except ImportError:
    _first_temp_entity = manager.get_global_pointer('BaseTempEntity')


# =============================================================================
# >> FUNCTIONS
# =============================================================================
def beam(
        recipients, delay, start, end, model_index, halo_index, start_frame,
        frame_rate, life, width, end_width, fade_length, amplitude, red,
        green, blue, alpha, speed, parent=False):
예제 #19
0
# ============================================================================
# Source.Python Imports
#   Memory
from memory.manager import manager

# =============================================================================
# >> FORWARD IMPORTS
# =============================================================================
# Source.Python Imports
#   Entities
from _entities._factories import EntityFactory
from _entities._factories import EntityFactoryDictionary

# =============================================================================
# >> ALL DECLARATION
# =============================================================================
__all__ = (
    'EntityFactory',
    'EntityFactoryDictionary',
    'factory_dictionary',
)

# ============================================================================
# >> GLOBAL VARIABLES
# ============================================================================
# Get the factory_dictionary instance...
try:
    from _entities._factories import factory_dictionary
except ImportError:
    factory_dictionary = manager.get_global_pointer('EntityFactoryDictionary')
예제 #20
0
#   Globals
from _globals import global_vars
from _globals import MapLoadType
#   Memory
from memory.manager import manager


# =============================================================================
# >> ALL DECLARATION
# =============================================================================
__all__ = ('MapLoadType',
           'QueryCvarStatus',
           'Server',
           'engine_server',
           'global_vars',
           'server',
           'server_game_dll',
           )


# =============================================================================
# >> GLOBAL VARIABLES
# =============================================================================
try:
    # Try to get the server using the exposed method. If that fails, because
    # it isn't implemented for this game ...
    server = engine_server.get_server()
except NotImplementedError:
    # ... fall back to the sig-scanned server
    server = manager.get_global_pointer('Server')