def __init__(self, id=None): """ BoomBoomItem constructor. """ EventListener.__init__(self, "evt_") EventLauncher.__init__(self) self.visual = None self.launchEvent("graphical", "item", self) self.id = id
def __init__(self, type, gateway, **args): EventLauncher.__init__(self) EventListener.__init__(self) ActionAgent.__init__(self, prefix="msg_") self._gateway = gateway self.type = type self.__debug = args.get("debug", False) self.sendBroadcast = self.sendBroadcastMessage
def __init__(self, protocol, arg): EventLauncher.__init__(self) self.server = None self.__protocol = protocol self.__io = IO_TCP(is_server=True) self.__io.debug = arg.get("debug", False) self.__io.verbose = arg.get("verbose", False) self.__debug = arg.get("debug", False) self.__verbose = arg.get("verbose", False) self.max_clients = arg.get("max_clients", 2) self.client_port = arg.get("client_port", 12430) self.__supported_features = {} self.__clients = {} self.__clients_lock = thread.allocate_lock() self.gateway = None self.presentation = None
def __init__(self, protocol, args): EventLauncher.__init__(self) EventListener.__init__(self, "evt_") self.protocol = protocol self.launchEvent("happyboom", "register", "connection", self.processConnection) self.launchEvent("happyboom", "register", "disconnection", self.processDisconnection) self.launchEvent("happyboom", "register", "create_item", self.processCreateItem) self.launchEvent("happyboom", "register", "destroy_item", self.processDestroyItem) self.launchEvent("happyboom", "register", "recv_event", self.processEvent) self.registerEvent("happyboom") self.verbose = args.get("verbose", False) self.debug = args.get("debug", False) self.features = {} for feat in args.get("features", ()): self.features[feat] = None self.items = {} itemPath = args["item_path"] dirs = itemPath.split(os.path.sep) if dirs[-1] == "": dirs = dirs[:-1] packagePath = None try: for d in dirs: #print "imp.find_module(%s, %s)" %(repr(modName), repr(modDir)) f, fname, desc = imp.find_module(d, packagePath) self.module = imp.load_module(d, f, fname, desc) packagePath = self.module.__path__ except: raise Exception("[HAPPYBOOM] Invalid item path : %s" % itemPath) import types for attr in self.module.__dict__: if type(self.module.__dict__[attr]) == types.ClassType: itemClass = self.module.__dict__[attr] if hasattr(itemClass, "feature"): feat = getattr(itemClass, "feature") if feat != None: if feat in self.features: raise Exception( "[HAPPYBOOM] Duplicated feature %s in %s and %s classes" % (feat, itemClass.__name__, self.features[feat].__name__)) self.features[feat] = itemClass
def __init__(self, args): EventListener.__init__(self) EventLauncher.__init__(self) self.host = args.get("host", "127.0.0.1") self.port = args.get("port", 12430) self.verbose = args.get("verbose", False) self.debug = args.get("debug", False) protocol = args.get("protocol", None) self._io = IO_TCP() self._io.verbose = False # self.verbose self._io.debug = False # self.debug self.__stopped = False self.__stoplock = thread.allocate_lock() self.signature = None self.presentation = HappyboomProtocol(protocol, args) self.gateway = Gateway(protocol, args) self.registerEvent("happyboom")
def __init__(self, arg): """ BoomBoomInput constructor. @param host: Server hostname. @type host: C{str} @param port: Server port for "input" connection. @type port: C{int} @param name: Name of the client (as known by the server). @type name: C{string} @param verbose: Verbose mode flag. @type verbose: C{bool} @param debug: Debug mode flag. @type debug: C{bool} """ EventLauncher.__init__(self) EventListener.__init__(self) self.weapon_angle = None self.weapon_strength = None self.registerEvent("weapon")
def __init__(self, protocol, args): EventLauncher.__init__(self) EventListener.__init__(self, "evt_") self.protocol = protocol self.launchEvent("happyboom", "register", "connection", self.processConnection) self.launchEvent("happyboom", "register", "disconnection", self.processDisconnection) self.launchEvent("happyboom", "register", "create_item", self.processCreateItem) self.launchEvent("happyboom", "register", "destroy_item", self.processDestroyItem) self.launchEvent("happyboom", "register", "recv_event", self.processEvent) self.registerEvent("happyboom") self.verbose = args.get("verbose", False) self.debug = args.get("debug", False) self.features = {} for feat in args.get("features", ()): self.features[feat] = None self.items = {} itemPath = args["item_path"] dirs = itemPath.split(os.path.sep) if dirs[-1] == "": dirs = dirs[:-1] packagePath = None try: for d in dirs: #print "imp.find_module(%s, %s)" %(repr(modName), repr(modDir)) f, fname, desc = imp.find_module(d, packagePath) self.module = imp.load_module(d, f, fname, desc) packagePath = self.module.__path__ except: raise Exception("[HAPPYBOOM] Invalid item path : %s" %itemPath) import types for attr in self.module.__dict__: if type(self.module.__dict__[attr]) == types.ClassType: itemClass = self.module.__dict__[attr] if hasattr(itemClass, "feature"): feat = getattr(itemClass, "feature") if feat != None: if feat in self.features: raise Exception("[HAPPYBOOM] Duplicated feature %s in %s and %s classes" %(feat, itemClass.__name__, self.features[feat].__name__)) self.features[feat] = itemClass