def setup_player(self, id, name, color, local): """Sets up a new Player instance and adds him to the active world. @param local: bool, whether the player is the one sitting on front of this machine.""" inv = self.session.db.get_player_start_res() player = None if local: player = HumanPlayer(self.session, id, name, color, inventory=inv) self.player = player self.session.ingame_gui.resbar.update_gold() self.player.inventory.add_change_listener( self.session.ingame_gui.resbar.update_gold) else: player = Player(self.session, id, name, color, inventory=inv) self.players.append(player)
def setup_player(self, id, name, color, clientid, local, is_ai, difficulty_level): """Sets up a new Player instance and adds her to the active world. Only used for new games. Loading old players is done in _init(). @param local: bool, whether the player is the one sitting on front of this machine.""" inv = self.session.db.get_player_start_res() player = None if is_ai: # a human controlled AI player player = AIPlayer(self.session, id, name, color, clientid, difficulty_level) else: player = HumanPlayer(self.session, id, name, color, clientid, difficulty_level) player.initialize(inv) # Componentholder init if local: self.player = player self.players.append(player)
def setup_player(self, id, name, color, local): """Sets up a new Player instance and adds him to the active world. Only used for new games. Loading old players is done in _init(). @param local: bool, whether the player is the one sitting on front of this machine.""" inv = self.session.db.get_player_start_res() player = None if local: player = HumanPlayer(self.session, id, name, color, inventory=inv) self.player = player self.player.inventory.add_change_listener(self.session.ingame_gui.update_gold, \ call_listener_now=True) else: player = Player(self.session, id, name, color, inventory=inv) self.players.append(player)