Beispiel #1
0
    def dropBomb(self):
        lifespan = 3000

        if (self.bombCount <= 0) or self.frozen:
            return
        p = self.node.positionForward
        v = self.node.velocity

        bombType = "normal"

        bomb = bs.Bomb(position=(p[0], p[1] - 0.0, p[2]),
                       velocity=(v[0], v[1], v[2]),
                       bombType=bombType,
                       blastRadius=self.blastRadius,
                       sourcePlayer=self.sourcePlayer,
                       owner=self.node).autoRetain()

        bsUtils.animate(bomb.node, 'modelScale', {
            0: 0.0,
            lifespan * 0.1: 1.5,
            lifespan * 0.5: 1.0
        })

        self.bombCount -= 1
        bomb.node.addDeathAction(
            bs.WeakCall(self.handleMessage, _BombDiedMessage()))

        self._pickUp(bomb.node)

        for meth in self._droppedBombCallbacks:
            meth(self, bomb)

        return bomb
	def dropBomb(self):
		lifespan = 3000

		if (self.bombCount <= 0) or self.frozen:
			return
		p = self.node.positionForward
		v = self.node.velocity

		bombType = "normal"

		bomb = bs.Bomb(position=(p[0], p[1] - 0.0, p[2]),
					   velocity=(v[0], v[1], v[2]),
					   bombType=bombType,
					   blastRadius=self.blastRadius,
					   sourcePlayer=self.sourcePlayer,
					   owner=self.node).autoRetain()

		bsUtils.animate(bomb.node, 'modelScale', {0:0.0,
								   lifespan*0.1:1.5,
								   lifespan*0.5:1.0})



		self.bombCount -= 1
		bomb.node.addDeathAction(bs.WeakCall(self.handleMessage, _BombDiedMessage()))

		self._pickUp(bomb.node)

		for meth in self._droppedBombCallbacks:
			meth(self, bomb)

		return bomb
    def dropBomb(self):
        """
		Tell the spaz to drop one of his bombs, and returns
		the resulting bomb object.
		If the spaz has no bombs or is otherwise unable to
		drop a bomb, returns None.
		"""

        if (self.landMineCount <= 0 and self.bombCount <= 0) or self.frozen:
            return
        p = self.node.positionForward
        v = self.node.velocity

        if self.landMineCount > 0:
            droppingBomb = False
            self.setLandMineCount(self.landMineCount - 1)
            bombType = "landMine"
        else:
            droppingBomb = True
            bombType = self.bombType

        bomb = Bomb(
            position=(p[0], p[1] - 0.0, p[2]),
            velocity=(v[0], v[1], v[2]),
            bombType=bombType,
            blastRadius=self.blastRadius,
            sourcePlayer=self.sourcePlayer,
            owner=self.node,
        ).autoRetain()

        if droppingBomb:
            self.bombCount -= 1
            bomb.node.addDeathAction(bs.WeakCall(self.handleMessage, bsSpaz._BombDiedMessage()))

        self._pickUp(bomb.node)

        for c in self._droppedBombCallbacks:
            c(self, bomb)

        return bomb
Beispiel #4
0
    def dropBomb(self):
        """
		Tell the spaz to drop one of his bombs, and returns
		the resulting bomb object.
		If the spaz has no bombs or is otherwise unable to
		drop a bomb, returns None.
		"""

        if (self.landMineCount <= 0 and self.bombCount <= 0) or self.frozen:
            return
        p = self.node.positionForward
        v = self.node.velocity

        if self.landMineCount > 0:
            droppingBomb = False
            self.setLandMineCount(self.landMineCount - 1)
            bombType = 'landMine'
        else:
            droppingBomb = True
            bombType = self.bombType

        bomb = Bomb(position=(p[0], p[1] - 0.0, p[2]),
                    velocity=(v[0], v[1], v[2]),
                    bombType=bombType,
                    blastRadius=self.blastRadius,
                    sourcePlayer=self.sourcePlayer,
                    owner=self.node).autoRetain()

        if droppingBomb:
            self.bombCount -= 1
            bomb.node.addDeathAction(
                bs.WeakCall(self.handleMessage, bsSpaz._BombDiedMessage()))

        self._pickUp(bomb.node)

        for c in self._droppedBombCallbacks:
            c(self, bomb)

        return bomb
Beispiel #5
0
    def dropBomb(self):
        """
        Tell the spaz to drop one of his bombs, and returns
        the resulting bomb object.
        If the spaz has no bombs or is otherwise unable to
        drop a bomb, returns None.
        
        Overridden for Land Grab: 
        -Add condition for mineTimeout,
        -make it create myMine instead of regular mine
        -set this spaz's last mine time to current time
        -Don't decrement LandMineCount.  We'll set to 0 when spaz double-punches.
        """
        t = bs.getGameTime()
        if ((self.landMineCount <= 0 or t-self.lastMine < self.mineTimeout) and self.bombCount <= 0) or self.frozen: return
        p = self.node.positionForward
        v = self.node.velocity

        if self.landMineCount > 0:
            droppingBomb = False
            #self.setLandMineCount(self.landMineCount-1) #Don't decrement mine count. Unlimited mines.
            if t - self.lastMine < self.mineTimeout:
                return #Last time we dropped  mine was too short ago. Don't drop another one.
            else:
                self.lastMine = t
                self.node.billboardCrossOut = True
                bs.gameTimer(self.mineTimeout,bs.WeakCall(self.unCrossBillboard))
                bomb = myMine(pos=(p[0],p[1] - 0.0,p[2]),
                           vel=(v[0],v[1],v[2]),
                           bRad=self.blastRadius,
                           sPlay=self.sourcePlayer,
                           own=self.node).autoRetain()
                self.getPlayer().gameData['mines'].append(bomb)
        elif self.dropEggs:
            if len(self.getPlayer().gameData['bots']) > 0 : return #Only allow one snowman at a time.
            droppingBomb = True
            bomb = Egg(position=(p[0],p[1] - 0.0,p[2]), sourcePlayer=self.sourcePlayer,owner=self.node).autoRetain()
            
        else:
            droppingBomb = True
            bombType = self.bombType

            bomb = bs.Bomb(position=(p[0],p[1] - 0.0,p[2]),
                       velocity=(v[0],v[1],v[2]),
                       bombType=bombType,
                       blastRadius=self.blastRadius,
                       sourcePlayer=self.sourcePlayer,
                       owner=self.node).autoRetain()

        if droppingBomb:
            self.bombCount -= 1
            bomb.node.addDeathAction(bs.WeakCall(self.handleMessage,bsSpaz._BombDiedMessage()))
            if not self.eggsHatch:
                bomb.hatch = False
            else:
                bomb.hatch = True
        self._pickUp(bomb.node)

        for c in self._droppedBombCallbacks: c(self,bomb)
        
        return bomb