Esempio n. 1
0
    def __init__(self):

        # Load all the available conditions and actions as plugins.
        condition_plugins = plugin.load_directory(prepare.BASEDIR + "core/components/event/conditions")
        self.conditions = plugin.get_available_methods(condition_plugins)
        action_plugins = plugin.load_directory(prepare.BASEDIR + "core/components/event/actions")
        self.actions = plugin.get_available_methods(action_plugins)

        self.name = "Event"
        self.current_map = None
        self.state = "running"
        self.timer = 0.0
        self.wait = 0.0
        self.button = None
Esempio n. 2
0
    def __init__(self):

        # Load all the available conditions and actions as plugins.
        condition_plugins = plugin.load_directory(prepare.BASEDIR + "core/components/event/conditions")
        self.conditions = plugin.get_available_methods(condition_plugins)
        action_plugins = plugin.load_directory(prepare.BASEDIR + "core/components/event/actions")
        self.actions = plugin.get_available_methods(action_plugins)

        self.name = "Event"
        self.current_map = None
        self.state = "running"
        self.timer = 0.0
        self.wait = 0.0
        self.button = None
Esempio n. 3
0
    def load_classes_from_plugins(path, category="plugin"):
        """ Load classes using plugin system

        :param path: where plugins are stored
        :param category: optional string for debugging info

        :type path: str
        :type category: str

        :rtype: dict
        """
        classes = dict()
        plugins = plugin.load_directory(path)

        for cls in plugin.get_available_classes(plugins):

            # TODO: enforce a template for plugins; make this generic
            name = getattr(cls, "name", None)
            if name is None:
                logger.error("found incomplete {}: {}".format(category, cls.__name__))
                continue
            classes[name] = cls
            logger.info("loaded {}: {}".format(category, cls.name))

        return classes
Esempio n. 4
0
import traceback
import random
import re
import pprint

from core.components import map
from core.components import player
from core.components import pyganim
from core.components import item
from core.components import db
from core.components import monster
from core.components import ai
from core.components import plugin

# Load all the available conditions and actions as plugins.
condition_plugins = plugin.load_directory("core/components/event/conditions")
condition_methods = plugin.get_available_methods(condition_plugins)
action_plugins = plugin.load_directory("core/components/event/actions")
action_methods = plugin.get_available_methods(action_plugins)

# Create a logger for optional handling of debug messages.
logger = logging.getLogger(__name__)
logger.debug("components.event successfully imported")


class EventEngine(object):
    """A class for the event engine. The event engine checks to see if a group of conditions have
    been met and then executes a set of actions.

    """
Esempio n. 5
0
import traceback
import random
import re
import pprint

from core.components import map
from core.components import player
from core.components import pyganim
from core.components import item
from core.components import db
from core.components import monster
from core.components import ai
from core.components import plugin

# Load all the available conditions and actions as plugins.
condition_plugins = plugin.load_directory("core/components/event/conditions")
condition_methods = plugin.get_available_methods(condition_plugins)
action_plugins = plugin.load_directory("core/components/event/actions")
action_methods = plugin.get_available_methods(action_plugins)

# Create a logger for optional handling of debug messages.
logger = logging.getLogger(__name__)
logger.debug("components.event successfully imported")


class EventEngine(object):
    """A class for the event engine. The event engine checks to see if a group of conditions have
    been met and then executes a set of actions.

    """
    def __init__(self):