Ejemplo n.º 1
0
    def handleMessage(self, m):

        if isinstance(m, bs.PlayerSpazDeathMessage):

            bs.TeamGameActivity.handleMessage(self, m)  # (augment standard behavior)

            deathTime = bs.getGameTime()

            # record the player's moment of death
            m.spaz.getPlayer().gameData['deathTime'] = deathTime

            # in co-op mode, end the game the instant everyone dies (more accurate looking)
            # in teams/ffa, allow a one-second fudge-factor so we can get more draws
            if isinstance(self.getSession(), bs.CoopSession):
                # teams will still show up if we check now.. check in the next cycle
                bs.pushCall(self._checkEndGame)
                self._lastPlayerDeathTime = deathTime  # also record this for a final setting of the clock..
            else:
                bs.gameTimer(1000, self._checkEndGame)
        elif isinstance(m, KillerGetScoreMessage):
            bs.screenMessage(m.text,
                             top=True, color=m.killer.color,
                             image=m.killer.getIcon())
            m.killer.getTeam().gameData['arrows'] = min(
                m.killer.getTeam().gameData['arrows'] + m.score, self._maxArrows)
            self._updateScoreBoard()
        else:
            # default handler:
            bs.TeamGameActivity.handleMessage(self, m)
Ejemplo n.º 2
0
    def handleMessage(self, m):

        if isinstance(m, bs.PlayerSpazDeathMessage):

            bs.TeamGameActivity.handleMessage(self, m)  # (augment standard behavior)

            deathTime = bs.getGameTime()

            # record the player's moment of death
            m.spaz.getPlayer().gameData['deathTime'] = deathTime

            # in co-op mode, end the game the instant everyone dies (more accurate looking)
            # in teams/ffa, allow a one-second fudge-factor so we can get more draws
            if isinstance(self.getSession(), bs.CoopSession):
                # teams will still show up if we check now.. check in the next cycle
                bs.pushCall(self._checkEndGame)
                self._lastPlayerDeathTime = deathTime  # also record this for a final setting of the clock..
            else:
                bs.gameTimer(1000, self._checkEndGame)

        elif isinstance(m, CheckNeedNewMadMessage):
            self._checkNeedMad()
        else:
            # default handler:
            bs.TeamGameActivity.handleMessage(self, m)
    def handleMessage(self, m):

        # a player has died
        if isinstance(m, bs.PlayerSpazDeathMessage):
            bs.TeamGameActivity.handleMessage(self, m)  # do standard stuff
            self.respawnPlayer(m.spaz.getPlayer())  # kick off a respawn

        # One of bases were destroyed
        elif isinstance(m, BaseDestroyedMessage):
            bs.pushCall(self._checkIfWon)
Ejemplo n.º 4
0
 def onPlayerLeave(self, player):
     # augment default behavior...
     bs.TeamGameActivity.onPlayerLeave(self, player)
     #end the game if everyone left the party.
     deathTime = bs.getGameTime()
     if isinstance(self.getSession(), bs.FreeForAllSession):
         bs.pushCall(self._checkEndGame)
         self._lastPlayerDeathTime = deathTime  # also record this for a final setting of the clock..
     else:
         bs.gameTimer(1000, self._checkEndGame)
Ejemplo n.º 5
0
    def handleMessage(self, m):
        if isinstance(m, bs.PlayerSpazDeathMessage):

            deathTime = bs.getGameTime()

            bs.TeamGameActivity.handleMessage(self,
                                              m)  # (augment standard behavior)
            m.spaz.getPlayer().gameData['deathTime'] = deathTime
            if isinstance(self.getSession(), bs.FreeForAllSession):
                bs.pushCall(self._checkEndGame)
                self._lastPlayerDeathTime = deathTime  # also record this for a final setting of the clock..
            else:
                bs.gameTimer(1000, self._checkEndGame)

        else:
            bs.TeamGameActivity.handleMessage(self, m)
Ejemplo n.º 6
0
    def handleMessage(self, m):

        # a player has died
        if isinstance(m, bs.PlayerSpazDeathMessage):
            bs.TeamGameActivity.handleMessage(self, m)  # do standard stuff
            self.respawnPlayer(m.spaz.getPlayer())  # kick off a respawn

        # a spaz-bot has died
        elif isinstance(m, bs.SpazBotDeathMessage):
            # unfortunately the bot-set will always tell us there are living
            # bots if we ask here (the currently-dying bot isn't officially marked dead yet)
            # ..so lets push a call into the event loop to check once this guy has finished dying.
            bs.pushCall(self._checkIfWon)

        else:
            # let the base class handle anything we don't..
            bs.TeamGameActivity.handleMessage(self, m)
    def handleMessage(self,m):

        # a player has died
        if isinstance(m,bs.PlayerSpazDeathMessage):
            bs.TeamGameActivity.handleMessage(self,m) # do standard stuff
            self.respawnPlayer(m.spaz.getPlayer()) # kick off a respawn

        # a spaz-bot has died
        elif isinstance(m,bs.SpazBotDeathMessage):
            # unfortunately the bot-set will always tell us there are living
            # bots if we ask here (the currently-dying bot isn't officially marked dead yet)
            # ..so lets push a call into the event loop to check once this guy has finished dying.
            bs.pushCall(self._checkIfWon)

        else:
            # let the base class handle anything we don't..
            bs.TeamGameActivity.handleMessage(self,m)
Ejemplo n.º 8
0
    def handleMessage(self, m):

        if isinstance(m, bs.PlayerSpazDeathMessage):

            bs.TeamGameActivity.handleMessage(self, m)

            deathTime = bs.getGameTime()

            m.spaz.getPlayer().gameData['deathTime'] = deathTime

            if isinstance(self.getSession(), bs.CoopSession):
                bs.pushCall(self._checkEndGame)
                self._lastPlayerDeathTime = deathTime
            else:
                bs.gameTimer(1000, self._checkEndGame)

        else:
            bs.TeamGameActivity.handleMessage(self, m)
	def handleMessage(self,m):
		if isinstance(m, bs.PlayerSpazDeathMessage):

			super(self.__class__, self).handleMessage(m)#bs.TeamGameActivity.handleMessage(self,m) # (augment standard behavior)

			deathTime = bs.getGameTime()

			# record the player's moment of death
			m.spaz.getPlayer().gameData['deathTime'] = deathTime

			# in co-op mode, end the game the instant everyone dies (more accurate looking)
			# in teams/ffa, allow a one-second fudge-factor so we can get more draws
			if isinstance(self.getSession(), bs.CoopSession):
				# teams will still show up if we check now.. check in the next cycle
				bs.pushCall(self._checkEndGame)
				self._lastPlayerDeathTime = deathTime # also record this for a final setting of the clock..
			else:
				bs.gameTimer(1000, self._checkEndGame)

		else:
			# default handler:
			super(self.__class__, self).handleMessage(m)#bs.TeamGameActivity.handleMessage(self,m)