Exemple #1
0
def exec_all_registered(event_name):
    import es

    exec_cmd = execmd_cvar.get_string()
    script_dir = scriptdir_cvar.get_string()

    # Execute root scripts
    cfg_path = '{}/{}.cfg'.format(script_dir, event_name)
    if GAME_PATH.joinpath('cfg', cfg_path).exists():
        es.dbgmsg(2, 'Sending {} command for {}.'.format(exec_cmd, event_name))
        queue_server_command(exec_cmd, cfg_path)

    # Execute cfg scripts
    es.dbgmsg(2, 'Script pack registration scanning...')
    for scriptpack, enabled in cfg_scripts.items():
        if not enabled:
            continue

        cfg_path = '{}/{}/{}.cfg'.format(script_dir, scriptpack, event_name)
        if GAME_PATH.joinpath('cfg', cfg_path).exists():
            es.dbgmsg(2,
                      'Sending {} command for {}.'.format(exec_cmd, cfg_path))
            queue_server_command(exec_cmd, cfg_path)
        else:
            es.dbgmsg(1, 'File doesn\'t exist: {}'.format(cfg_path))

    # Execute Python addons
    es.dbgmsg(2, 'Checking all scripts...')
    es.addons.triggerEvent(event_name)
def exec_all_registered(event_name):
    import es

    exec_cmd = execmd_cvar.get_string()
    script_dir = scriptdir_cvar.get_string()

    # Execute root scripts
    cfg_path = '{}/{}.cfg'.format(script_dir, event_name)
    if GAME_PATH.joinpath('cfg', cfg_path).exists():
        es.dbgmsg(2, 'Sending {} command for {}.'.format(exec_cmd, event_name))
        engine_server.server_command('{} {}'.format(exec_cmd, cfg_path))

    # Execute cfg scripts
    es.dbgmsg(2, 'Script pack registration scanning...')
    for scriptpack, enabled in cfg_scripts.items():
        if not enabled:
            continue

        cfg_path = '{}/{}/{}.cfg'.format(script_dir, scriptpack, event_name)
        if GAME_PATH.joinpath('cfg', cfg_path).exists():
            es.dbgmsg(2, 'Sending {} command for {}.'.format(exec_cmd, cfg_path))
            engine_server.server_command('{} {}'.format(exec_cmd, cfg_path))
        else:
            es.dbgmsg(1, 'File doesn\'t exist: {}'.format(cfg_path))

    # Execute Python addons
    es.dbgmsg(2, 'Checking all scripts...')
    es.addons.triggerEvent(event_name)
Exemple #3
0
    def add_directory(self, directory):
        """Add all files in the given directory to the downloadables.

        :param str directory: The directory to add to the downloadables.
        """
        # Loop through all files in the directory
        for file in GAME_PATH.joinpath(directory).walkfiles():

            # Add the current file to the downloadables
            self.add(file.replace(GAME_PATH, '').replace('\\', '/'))
Exemple #4
0
    def add_directory(self, directory):
        """Add all files in the given directory to the downloadables.

        :param str directory: The directory to add to the downloadables.
        """
        # Loop through all files in the directory
        for file in GAME_PATH.joinpath(directory).walkfiles():

            # Add the current file to the downloadables
            self.add(file.replace(GAME_PATH, '').replace('\\', '/'))
    def add_directory(self, directory):
        """Add all files in the given directory to the downloadables.

        :param str directory:
            The directory to add to the downloadables.
        :return:
            Return the number of files that have been added.
        :rtype: int
        """
        index = 0
        for index, file in enumerate(GAME_PATH.joinpath(directory).walkfiles(), 1):
            self.add(file.replace(GAME_PATH, '').replace('\\', '/').lstrip('/'))

        return index
Exemple #6
0
    def add_directory(self, directory):
        """Add all files in the given directory to the downloadables.

        :param str directory:
            The directory to add to the downloadables.
        :return:
            Return the number of files that have been added.
        :rtype: int
        """
        index = 0
        for index, file in enumerate(GAME_PATH.joinpath(directory).walkfiles(), 1):
            self.add(file.replace(GAME_PATH, '').replace('\\', '/'))

        return index