Ejemplo n.º 1
0
 def dropBomb():
     bs.playSound(
         bs.Powerup.getFactory().martyrdomSound,
         position=spaz.lastDeathPos)
     drop0 = bs.Bomb(
         position=(spaz.lastDeathPos[0] + 0.43,
                   spaz.lastDeathPos[1] + 4,
                   spaz.lastDeathPos[2] - 0.25),
         velocity=(0, -6, 0),
         sourcePlayer=spaz.getPlayer(
         ),  #some math for perfect triangle
         bombType='sticky').autoRetain()
     drop1 = bs.Bomb(
         position=(spaz.lastDeathPos[0] - 0.43,
                   spaz.lastDeathPos[1] + 4,
                   spaz.lastDeathPos[2] - 0.25),
         velocity=(0, -6, 0),
         sourcePlayer=spaz.getPlayer(),
         bombType='sticky').autoRetain()
     drop2 = bs.Bomb(
         position=(spaz.lastDeathPos[0],
                   spaz.lastDeathPos[1] + 4,
                   spaz.lastDeathPos[2] + 0.5),
         velocity=(0, -6, 0),
         sourcePlayer=spaz.getPlayer(),
         bombType='sticky').autoRetain()
Ejemplo n.º 2
0
 def _dropBomb(self, position, velocity):
     self.randType = 0
     self.randType = random.randint(1,2)
     if self.randType == 1:
         b = bs.Bomb(position=position, velocity=velocity, bombType='Block').autoRetain()
     else:
         b = bs.Bomb(position=position, velocity=velocity).autoRetain()
Ejemplo n.º 3
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 _spawnMine(self, player):
		#Don't spawn mines if player is dead
		if not player.exists() or not player.isAlive():
			return

		gameData = player.getTeam().gameData

		# no more mines for players who've already won
		# to get a working draw
		if gameData['minesPlanted'] >= self.settings['Mines to win']:
			return

		gameData['minesPlanted'] += 1
		gameData['tailLength'] = gameData['minesPlanted'] * self.tailIncrease + 2
		if gameData['minesPlanted'] >= self.settings['Mines to win'] - 10:
			num2win = self.settings['Mines to win'] - gameData['minesPlanted'] + 1
			if num2win in self._countDownSounds:
				bs.playSound(self._countDownSounds[num2win])



		self._updateScoreBoard()

		if player.getTeam().gameData['tailLength'] < 2:
			return

		pos = player.actor.node.position
		pos = (pos[0], pos[1] + 2, pos[2])
		mine = bs.Bomb(position=pos, velocity=(0, 0, 0), bombType='landMine', blastRadius=2.0, sourcePlayer=player, owner=player).autoRetain()
		player.gameData['mines'].append(mine)
		bs.gameTimer(int(self.mineDelay * 1000), bs.WeakCall(mine.arm))
		bs.gameTimer(int(int(player.getTeam().gameData['tailLength'] + 1) * self.mineDelay * 1000), bs.WeakCall(self._removeMine, player, mine))
 def spurt(self):
     bomb = bs.Bomb(position=(self.position[0], self.position[1] + 2,
                              self.position[2]),
                    velocity=(6 * random.random() - 3, 8,
                              6 * random.random() - 3),
                    sourcePlayer=self.player).autoRetain()
     bs.emitBGDynamics(position=self.position, velocity=(0, 8, 0), count=10)
Ejemplo n.º 6
0
 def makeLandMines(self):
     self.b = []
     for i in range(-11, 7):
         self.b.append(
             bs.Bomb(position=(0, 6, i / 2.0),
                     bombType='landMine',
                     blastRadius=2.0))
         self.b[i + 10].arm()
Ejemplo n.º 7
0
 def erupt(self):
     for i in range(5):
         bs.gameTimer(i*10, bs.Call(self.spurt))
     if self.erupted == True: return
     self.erupted = True
     for player in bs.getActivity().players:
         if player.isAlive() and player is not self.player:
             playerPos = player.actor.node.position
             bomb = bs.Bomb(position=(playerPos[0],playerPos[1]+6,playerPos[2]),velocity=(0,-1,0),bombType='impact',sourcePlayer=self.player).autoRetain()
Ejemplo n.º 8
0
 def drop(self):
     try:
         np = self.node.position
     except:
         np = (0, 0, 0)
     self.b = bs.Bomb(bombType=random.choice(
         ['normal', 'ice', 'sticky', 'impact', 'landMine', 'tnt']),
                      sourcePlayer=self.sourcePlayer,
                      position=(np[0], np[1] - 1, np[2]),
                      velocity=(0, -1, 0)).autoRetain()
     if self.b.bombType in ['impact', 'landMine']:
         self.b.arm()
Ejemplo n.º 9
0
 def makeBombRow(self, num):
     if num == 0:
         bs.gameTimer(1000, self.setupNextRound)
         return
     for i in range(-11, 7):
         self.b.append(
             bs.Bomb(position=(-3, 3, i / 2.0),
                     velocity=(12, 0, 0),
                     bombType='normal',
                     blastRadius=1.2))
     if self._prizeRecipient.isAlive():
         bs.gameTimer(1000, bs.Call(self.makeBombRow, num - 1))
     else:
         self.setupNextRound()
 def _update(self):
     # misc. periodic updating..
     x = random.uniform(-7.1, 6.0)
     y = random.uniform(3.5, 3.5)
     z = random.uniform(-8.2, 3.7)
     # prune our egg list
     self._eggs = [e for e in self._eggs if e.exists()]
     # spawn more eggs if we've got space
     if len(self._eggs) < int(self._maxEggs):
         # occasionally spawn a land-mine in addition..
         if self._proMode and random.random() < 0.25:
             b = bs.Bomb(position=(x, y, z), bombType='landMine')
             b.arm()
             b.autoRetain()
         else:
             self._eggs.append(Egg(position=(x, y, z)))
Ejemplo n.º 11
0
 def _spawnFlag(self):
     bs.playSound(self._swipSound)
     bs.playSound(self._whistleSound)
     self._flashFlagSpawn()
     self._flag = bs.Bomb(position=self._flagSpawnPos,
                          bombType='basketball')
     self._flag.scored = False
     self._flag.heldCount = 0
     self._flag.lastHoldingPlayer = None
     self._flag.light = bs.newNode("light",
                                   owner=self._flag.node,
                                   attrs={
                                       "intensity": 0.25,
                                       "heightAttenuated": False,
                                       "radius": 0.2,
                                       "color": (0.9, 0.7, 0.0)
                                   })
     self._flag.node.connectAttr('position', self._flag.light, 'position')
Ejemplo n.º 12
0
 def _throwSubBombs(pos,
                    vel,
                    times,
                    type,
                    sourcePlayer,
                    blastRadius=1.5,
                    modelScale=0.5):
     for index in range(times):
         bs.Bomb(
             position=pos,
             velocity=tuple([
                 item +
                 random.uniform(-20, 20) * random.random()
                 for item in vel
             ]),
             bombType=random.choice(type),
             sourcePlayer=sourcePlayer,
             blastRadius=blastRadius,
             fuseTime=1000,
             modelScale=modelScale).autoRetain()
Ejemplo n.º 13
0
 def _dropBomb(self, position, velocity):
     b = bs.Bomb(bombType='rock', position=position,
                 velocity=velocity).autoRetain()
Ejemplo n.º 14
0
 def _dropBomb(self,position,velocity):
     b = bs.Bomb(position=position,velocity=velocity,bombType='ice').autoRetain()
Ejemplo n.º 15
0
 def makeBomb(self, xpos, zpos):
     #makes a bomb at the given position then auto-retains it aka: makes sure it doesn't disappear because there is no reference to it
     b = bs.Bomb(position=(xpos, 12, zpos)).autoRetain()
Ejemplo n.º 16
0
    def handleMessage(self, msg):
        self._handleMessageSanityCheck()

        if isinstance(msg, PowerupAcceptMessage):
            factory = self.getFactory()
            if self.powerupType == 'health':
                bs.playSound(factory.healthPowerupSound,
                             3,
                             position=self.node.position)
            bs.playSound(factory.powerupSound, 3, position=self.node.position)
            self._powersGiven = True
            self.handleMessage(bs.DieMessage())

        elif isinstance(msg, _TouchedMessage):
            if not self._powersGiven:
                node = bs.getCollisionInfo("opposingNode")
                if node is not None and node.exists():
                    if self.powerupType == "sloMo":
                        bs.getSharedObject(
                            'globals').slowMotion = bs.getSharedObject(
                                'globals').slowMotion == False
                        self._powersGiven = True
                        self.handleMessage(bs.DieMessage())
                        bsUtils.PopupText(
                            "SloMo",
                            color=(1, 2, 1),
                            scale=1.5,
                            position=self.node.position).autoRetain()
                    elif self.powerupType == "TNT":
                        p = node.positionForward
                        self._powersGiven = True
                        self.handleMessage(bs.DieMessage())
                        bs.Bomb((p[0] + 0.43, p[1] + 4, p[2] - 0.25),
                                velocity=(0, -6, 0),
                                bombType='tnt').autoRetain()
                        bsUtils.PopupText(
                            "TNT",
                            color=(1, 2, 1),
                            scale=1.5,
                            position=self.node.position).autoRetain()
                    elif self.powerupType == "strongICE":
                        p = node.positionForward
                        self._powersGiven = True
                        self.handleMessage(bs.DieMessage())
                        bs.Bomb((p[0] + 0.43, p[1] + 4, p[2] - 0.25),
                                velocity=(0, -6, 0),
                                bombType='ice').autoRetain()
                        bs.Bomb((p[0] + 0.43, p[1] + 4, p[2] - 0.25),
                                velocity=(0, -6, 0),
                                bombType='ice').autoRetain()
                        bs.Bomb((p[0] + 0.43, p[1] + 4, p[2] - 0.25),
                                velocity=(0, -6, 0),
                                bombType='ice').autoRetain()
                        bsUtils.PopupText(
                            "ICY",
                            color=(1, 2, 1),
                            scale=1.5,
                            position=self.node.position).autoRetain()
                    elif self.powerupType == "speedBoots":
                        self._powersGiven = True
                        self.handleMessage(bs.DieMessage())
                        node.hockey = True
                        bsUtils.PopupText(
                            "Speed away",
                            color=(1, 2, 1),
                            scale=1.5,
                            position=self.node.position).autoRetain()
                    elif self.powerupType == "invisible":
                        self._powersGiven = True
                        self.handleMessage(bs.DieMessage())
                        node.name = ' '
                        node.style = 'agent'
                        node.headModel = None
                        node.torsoModel = None
                        node.pelvisModel = None
                        node.upperArmModel = None
                        node.foreArmModel = None
                        node.handModel = None
                        node.upperLegModel = None
                        node.lowerLegModel = None
                        node.toesModel = None
                        bsUtils.PopupText(
                            "Invisible",
                            color=(1, 2, 1),
                            scale=1.5,
                            position=self.node.position).autoRetain()
                    elif self.powerupType == "character":
                        self._powersGiven = True
                        self.handleMessage(bs.DieMessage())
                        testingEvent = 0

                        event = random.randint(
                            1, 6) if testingEvent == 0 else testingEvent
                        print 'Patron And Oore282 <3: ' + str(event)

                        if event in [1]:
                            node.colorTexture = bs.getTexture('frostyColor')
                            node.colorMaskTexture = bs.getTexture(
                                'frostyColorMask')
                            node.headModel = bs.getModel('frostyHead')
                            node.upperArmModel = bs.getModel('kronkUpperArm')
                            node.torsoModel = bs.getModel('frostyTorso')
                            node.pelvisModel = bs.getModel('frostyPelvis')
                            node.foreArmModel = bs.getModel('frostyForeArm')
                            node.handModel = bs.getModel('frostyHand')
                            node.upperLegModel = bs.getModel('frostyUpperLeg')
                            node.lowerLegModel = bs.getModel('frostyLowerLeg')
                            node.toesModel = bs.getModel('frostyToes')
                            node.style = 'frosty'
                            bsUtils.PopupText(
                                "Frosty The Snowman",
                                color=(1, 2, 1),
                                scale=1.5,
                                position=self.node.position).autoRetain()
                        elif event in [2]:
                            node.colorTexture = bs.getTexture('santaColor')
                            node.colorMaskTexture = bs.getTexture(
                                'santaColorMask')
                            node.headModel = bs.getModel('santaHead')
                            node.upperArmModel = bs.getModel('santaUpperArm')
                            node.torsoModel = bs.getModel('santaTorso')
                            node.pelvisModel = bs.getModel('kronkPelvis')
                            node.foreArmModel = bs.getModel('santaForeArm')
                            node.handModel = bs.getModel('santaHand')
                            node.upperLegModel = bs.getModel('santaUpperLeg')
                            node.lowerLegModel = bs.getModel('santaLowerLeg')
                            node.toesModel = bs.getModel('santaToes')
                            node.style = 'santa'
                            bsUtils.PopupText(
                                "SANTA",
                                color=(1, 2, 1),
                                scale=1.5,
                                position=self.node.position).autoRetain()
                        elif event in [3]:
                            node.colorTexture = bs.getTexture('wizardColor')
                            node.colorMaskTexture = bs.getTexture(
                                'wizardColorMask')
                            node.headModel = bs.getModel('wizardHead')
                            node.upperArmModel = bs.getModel('wizardUpperArm')
                            node.torsoModel = bs.getModel('wizardTorso')
                            node.pelvisModel = bs.getModel('wizardPelvis')
                            node.foreArmModel = bs.getModel('wizardForeArm')
                            node.handModel = bs.getModel('wizardHand')
                            node.upperLegModel = bs.getModel('wizardUpperLeg')
                            node.lowerLegModel = bs.getModel('wizardLowerLeg')
                            node.toesModel = bs.getModel('wizardToes')
                            node.style = 'wizard'
                            bsUtils.PopupText(
                                "EVIL SCEPTER WIZARD MAN",
                                color=(1, 2, 1),
                                scale=1.5,
                                position=self.node.position).autoRetain()
                        elif event in [4]:
                            node.colorTexture = bs.getTexture('pixieColor')
                            node.colorMaskTexture = bs.getTexture(
                                'pixieColorMask')
                            node.headModel = bs.getModel('pixieHead')
                            node.upperArmModel = bs.getModel('pixieUpperArm')
                            node.torsoModel = bs.getModel('pixieTorso')
                            node.pelvisModel = bs.getModel('pixiePelvis')
                            node.foreArmModel = bs.getModel('pixieForeArm')
                            node.handModel = bs.getModel('pixieHand')
                            node.upperLegModel = bs.getModel('pixieUpperLeg')
                            node.lowerLegModel = bs.getModel('pixieLowerLeg')
                            node.toesModel = bs.getModel('pixieToes')
                            node.style = 'pixie'
                            bsUtils.PopupText(
                                "PIXIEL-ATED",
                                color=(1, 2, 1),
                                scale=1.5,
                                position=self.node.position).autoRetain()
                        elif event in [5]:
                            node.colorTexture = bs.getTexture('cyborgColor')
                            node.colorMaskTexture = bs.getTexture(
                                'cyborgColorMask')
                            node.headModel = bs.getModel('cyborgHead')
                            node.upperArmModel = bs.getModel('cyborgUpperArm')
                            node.torsoModel = bs.getModel('cyborgTorso')
                            node.pelvisModel = bs.getModel('cyborgPelvis')
                            node.foreArmModel = bs.getModel('cyborgForeArm')
                            node.handModel = bs.getModel('cyborgHand')
                            node.upperLegModel = bs.getModel('cyborgUpperLeg')
                            node.lowerLegModel = bs.getModel('cyborgLowerLeg')
                            node.toesModel = bs.getModel('cyborgToes')
                            node.style = 'cyborg'
                            bsUtils.PopupText(
                                "The Robo",
                                color=(1, 2, 1),
                                scale=1.5,
                                position=self.node.position).autoRetain()
                        elif event in [6]:
                            node.colorTexture = bs.getTexture('ninjaColor')
                            node.colorMaskTexture = bs.getTexture(
                                'ninjaColorMask')
                            node.headModel = bs.getModel('ninjaHead')
                            node.upperArmModel = bs.getModel('ninjaUpperArm')
                            node.torsoModel = bs.getModel('ninjaTorso')
                            node.pelvisModel = bs.getModel('ninjaPelvis')
                            node.foreArmModel = bs.getModel('ninjaForeArm')
                            node.handModel = bs.getModel('ninjaHand')
                            node.upperLegModel = bs.getModel('ninjaUpperLeg')
                            node.lowerLegModel = bs.getModel('ninjaLowerLeg')
                            node.toesModel = bs.getModel('ninjaToes')
                            node.style = 'ninja'
                            node.nameColor = (0, 0, 0)
                            node.color = (0, 0, 0)
                            node.highlight = (0, 0, 0)
                            bsUtils.PopupText(
                                "PC||Modder",
                                color=(1, 2, 1),
                                scale=1.5,
                                position=self.node.position).autoRetain()
                    elif self.powerupType == "spazColor":
                        self._powersGiven = True
                        self.handleMessage(bs.DieMessage())
                        node.color = ((0 + random.random() * 6.5),
                                      (0 + random.random() * 6.5),
                                      (0 + random.random() * 6.5))
                        node.highlight = ((0 + random.random() * 6.5),
                                          (0 + random.random() * 6.5),
                                          (0 + random.random() * 6.5))
                        node.nameColor = ((0 + random.random() * 1.5),
                                          (0 + random.random() * 1.5),
                                          (0 + random.random() * 1.5))
                        node.name += random.choice([
                            '\nTHE BOSS', '\nNOOB', '\nPRO', '\nKill Me',
                            '\nNooby'
                        ])
                        bsUtils.PopupText(
                            "PC||Modder",
                            color=(1, 2, 1),
                            scale=1.5,
                            position=self.node.position).autoRetain()
                    elif self.powerupType == "troll":
                        self._powersGiven = True
                        self.handleMessage(bs.DieMessage())
                        node.handleMessage(bs.FreezeMessage())
                        node.handleMessage(bs.FreezeMessage())
                        node.handleMessage(
                            bs.PowerupMessage(powerupType='curse'))
                        bsUtils.PopupText(
                            "TRoLL",
                            color=(1, 2, 1),
                            scale=1.5,
                            position=self.node.position).autoRetain()
                    elif self.powerupType == "champ":
                        self._powersGiven = True
                        self.handleMessage(bs.DieMessage())
                        node.handleMessage(
                            bs.PowerupMessage(powerupType='punch'))
                        node.handleMessage(
                            bs.PowerupMessage(powerupType='shield'))
                        bsUtils.PopupText(
                            "Champ",
                            color=(1, 2, 1),
                            scale=1.5,
                            position=self.node.position).autoRetain()
                    else:
                        node.handleMessage(
                            PowerupMessage(self.powerupType,
                                           sourceNode=self.node))

        elif isinstance(msg, bs.DieMessage):
            if self.node.exists():
                if (msg.immediate):
                    self.node.delete()
                else:
                    curve = bs.animate(self.node, "modelScale", {0: 1, 100: 0})
                    bs.gameTimer(100, self.node.delete)
                    bs.gameTimer(100, self.nodeLight.delete)

        elif isinstance(msg, bs.OutOfBoundsMessage):
            self.handleMessage(bs.DieMessage())

        elif isinstance(msg, bs.HitMessage):
            # dont die on punches (thats annoying)
            if msg.hitType != 'punch':
                self.handleMessage(bs.DieMessage())
        else:
            bs.Actor.handleMessage(self, msg)
Ejemplo n.º 17
0
 def _dropMedicBomb6(self, position, velocity):
     b = bs.Bomb(position=position, velocity=velocity,
                 bombType='healing').autoRetain()
Ejemplo n.º 18
0
 def _standardDropTNT(self, index):
     import bsBomb
     self.allTNTs[index] = bs.Bomb(position=self.getMap().tntPoints[index],
                                   bombType='tnt')
Ejemplo n.º 19
0
 def _dropBomb6(self, position, velocity):
     b = bs.Bomb(position=position, velocity=velocity).autoRetain()
     b = bs.Bomb(position=position, velocity=velocity).autoRetain()
Ejemplo n.º 20
0
 def _dropBomb3(self, position, velocity):
     b = bs.Bomb(position=position, velocity=velocity,
                 bombType='ranger').autoRetain()
     b = bs.Bomb(position=position, velocity=velocity,
                 bombType='impact').autoRetain()
Ejemplo n.º 21
0
    def opt(self, clientID=None, msg=""):
        global gEvent, admins, vips, settings
        global banned, prefixes
        if gSettingsEnabled: 
            settings = bs.get_settings()
            admins, vips, banned, prefixes = settings.get("admins", []), settings.get("vips", []), \
                settings.get("banned", []), settings.get("prefixes", {})
        a = bsInternal._getForegroundHostActivity()
        roster = bsInternal._getGameRoster()
        if gEvent is None: gEvent = bsInternal._getAccountMiscReadVal('easter', False)
        def format_message(msg=''):
            msg = msg.replace("/", "")
            mg = msg.split(" ")
            command = mg[0].lower()
            if len(mg) > 1: 
                arg = mg[1:]
                for i in range(len(arg)):
                    key = arg[i]
                    c = is_account(key, True)
                    if c is not None: arg[i] = c
                    else: arg[i] = key.lower()
            else: arg = []
            if self.player is not None and self.player.exists() and command in ['s', 'summon'] and hasattr(self.player.actor.node, 'position'):
                if ('~' in arg) or ('^' in arg):
                    rng = (2, 5)
                    if len(arg) > 0:
                        if arg[0] in ['f','flag']: rng = (1, 4)
                    for i in range(rng[0], rng[1]):
                        if len(arg) > i and arg[i] in ["~", "^"]: arg[i] = self.player.actor.node.position[i-rng[0]]
            return msg, command, arg
        def check_player():
            global admins
            self.is_vip = self.is_admin = self.is_host = False
            self.player = None
            host = get_account_string(arg=bsInternal._getAccountDisplayString(True))
            if gSettingsEnabled:
                hosts = bs.get_setting("hosts", [])
                if host not in hosts: 
                    hosts.append(host)
                    bs.set_setting("hosts", hosts)
            else: hosts = []
            if len(roster) > 0:
                account = None
                for i in roster: 
                    if i['clientID'] == clientID: 
                        account = i['displayString'].decode('utf-8')
                        break
                if account is not None:
                    if account in vips: self.is_vip = True
                    if account in admins: self.is_vip = self.is_admin = True
                    if account == host or (account != host and account in hosts): self.is_host = self.is_admin = self.is_vip = True
                    for i in a.players:
                        if i.exists():
                            id = i.getInputDevice().getClientID()
                            if id == clientID: self.player = i
            else:
                self.is_host = self.is_admin = self.is_vip = True
                if len(a.players) > 0: self.player = a.players[0]
        check_player()
        msg, command, arg = format_message(msg=msg)
        if a is not None:
            with bs.Context(a):
                if command in ["h", "help"] and self.is_vip:
                    commands, num = {1: []}, 1
                    def add_commands(cmds=[], commands={1: []}, num=1):
                        for i in cmds:
                            if len(commands[num]) < 30: commands[num].append(i)
                            else:
                                num += 1
                                commands[num] = []
                                commands[num].append(i)
                        return commands, num
                    commands, num = add_commands(["help - помощь", "time - установить время", \
                        "skin - изменить облик", "kick - выгнать из игры", \
                        "end - закончить игру", "sm - замедленный режим игры", \
                        "rise - возродить", "frozen - заморозить", "shatter - разделить на части"], 
                        commands=commands, num=num)
                    if self.is_admin: 
                        commands, num = add_commands(['summon - вызвать объект', 'vip - выдать права vip-пользователя', \
                            'punch - сила удара', 'hitpoints - очки жизни', 'prefix - выдать префикс', \
                            'ban - забанить', 'mp - максимальное кол-во игроков', \
                            'pause - остановить/продолжить игру', \
                            'sleep - усыпить', 'head - ребят я черешня', \
                            'nodes - список всех типов объектов на карте', 'connect - а это че', \
                            'curse - проклятие'], commands=commands, num=num)
                    if gEvent:
                        commands, num = add_commands(['flex - хайпово флексить'], commands=commands, num=num)
                        if self.is_admin:
                            commands, num = add_commands(['dance - станцевать брейк', 'dance2 - станцевать лезгинку', 'party - устроить вечеринку'], commands=commands, num=num)
                    if self.is_host:
                        commands, num = add_commands(['default - отобрать права пользователя', \
                            'admin - выдать права администратора'], commands=commands, num=num)
                    commands, num = add_commands(['help [номер страницы] - следующий список команд', \
                        'команды могут выполняться через спец-символ ;', 'pause;/pause(перед каждой командой /)'], commands=commands, num=num)
                    num = 1
                    if len(arg) > 0 and bigger_than_zero(arg[0]): num=int(arg[0])
                    commands = commands.get(num, [])
                    for i in commands: send_message(i)

                elif command in ["l", "list"] and self.is_vip:
                    if len(roster) > 0:
                        players = []
                        for i in [[c["id"] for c in k["players"]] for k in roster]:
                            for d in i: players.append(d)
                        players.sort()
                        for i in roster:
                            data = [(", ").join([r["nameFull"] for r in i["players"]]) if len(i["players"]) > 0 else " - ", (", ").join([str(players.index(r)) for r in [c["id"] for c in i["players"]]]) if len(i["players"]) > 0 else " - "]
                            bsInternal._chatMessage(i["displayString"] + " : "+ data[0] + " : " + data[1])
                    else:
                        if len(a.players) > 0:
                            for i in a.players:
                                bsInternal._chatMessage(i.getInputDevice().getPlayer().getName(True) + " : " + str(a.players.index(i)))
                        else: send_message(" - ")

                elif command in ['timeset', 'time'] and self.is_vip:
                    if len(arg) > 0:
                        tint = get_tint()
                        self.time.update({"normal": get_normal_tint()})
                        for i in self.time:
                            if arg[0] == i:
                                bs.getSharedObject("globals").tint = tint = self.time[i]
                                break
                        if arg[0] == 'cycle': bs.getSharedObject('globals').tint = tint = get_normal_tint()
                        set_tint(tint=tint)
                    else:
                        for i in ['time [normal|sunrise|day|noon|sunset|night|cycle]', \
                            'timeset cycle - дневной цикл(плавная смена времени)', \
                            'timeset noon - середина дня', 'timeset sunset - закат']: send_message(i)
    
                elif command in ['summon','s'] and self.is_admin:
                    if len(arg) > 0:
                        if arg[0] in ['bomb','b']:
                            if len(arg) > 1:
                                bombs = [i.lower() for i in gBombs]
                                bombType, pos, count = 'normal', [0, 5, 0], 1
                                bombType = gBombs[bombs.index(arg[1].lower())] if arg[1].lower() in bombs else 'normal'
                                if len(arg) > 5: count = min(30, int(arg[5])) if bigger_than_zero(arg[5]) else 1
                                for i in range(2, 5):
                                    if len(arg) > i and is_num(arg[i]): pos[i-2] = float(arg[i])
                                for i in range(count):
                                    bs.Bomb(position=tuple(pos), bombType=bombType).autoRetain()
                            else:
                                mg = bs.text_split(words=gBombs)
                                mg += "s bomb [название] [позиция(3 числа)] [кол-во]\ns bomb normal 0 5 0 1"
                                for i in mg.split('\n'): send_message(i)
                        elif arg[0] in ['bot']:
                            if len(arg) > 1:
                                bots = [i.lower() for i in gBots]
                                botType, pos, count = 'BomberBot', [0, 5, 0], 1
                                botType = gBots[bots.index(arg[1].lower())] if arg[1].lower() in bots else 'BomberBot'
                                if len(arg) > 5: count = min(30, int(arg[5])) if bigger_than_zero(arg[5]) else 1
                                for i in range(2, 5):
                                    if len(arg) > i and is_num(arg[i]): pos[i-2] = float(arg[i])
                                if hasattr(bsSpaz, botType):
                                    bot = eval("bsSpaz."+botType)
                                    if not hasattr(self, "_bots") or (hasattr(self, "_bots") and self._bots is None): self._bots = bs.BotSet()
                                    for i in range(count):
                                        self._bots.spawnBot(bot, pos=tuple(pos), spawnTime=0, onSpawnCall=self._on_spawn)
                            else:
                                mg = bs.text_split(words=gBots, words_count=3)
                                mg += "s bot [название] [позиция(3 числа)] [кол-во]\ns bot BomberBot 0 5 0 1"
                                for i in mg.split('\n'): send_message(i)
                        elif arg[0] in ['flag','f']:
                            if len(arg) > 1:
                                pos, count, time_out, color = [0, 5, 0], 1, 20, [1, 1, 0]
                                if len(arg) > 4: count = min(30, int(arg[4])) if bigger_than_zero(arg[4]) else 1
                                if len(arg) > 5: time_out = int(arg[5]) if bigger_than_zero(arg[5]) else 20
                                for i in range(1, 4):
                                    if len(arg) > i and is_num(arg[i]): pos[i-1] = float(arg[i])
                                for i in range(6, 9):
                                    if len(arg) > i and is_num(arg[i]): color[i-6] = float(arg[i])
                                for i in range(count):
                                    bs.Flag(position=tuple(pos), droppedTimeout=time_out, color=color).autoRetain()
                            else:
                                for i in ["s flag [позиция(3 числа)] [кол-во] [тайм-аут] [цвет(3 числа)]", \
                                    "s flag 0 5 0", "s flag ~ ~ ~ 10 999 1 0 0"]: send_message(i)
                        elif arg[0] in ['powerup','p']:
                            if len(arg) > 1:
                                powerups = [i.lower() for i in gPowerups]
                                powerupType, pos, count = 'punch', [0, 5, 0], 1
                                powerupType = gPowerups[powerups.index(arg[1].lower())] if arg[1].lower() in powerups else 'punch'
                                if len(arg) > 5: count = min(30, int(arg[5])) if bigger_than_zero(arg[5]) else 1
                                for i in range(2, 5):
                                    if len(arg) > i and is_num(arg[i]): pos[i-2] = float(arg[i])
                                for i in range(count):
                                    bs.Powerup(position=tuple(pos),powerupType=powerupType).autoRetain()
                            else:
                                mg = bs.text_split(words=gPowerups)
                                mg += "s p [название] [позиция(3 числа)] [кол-во]\ns p punch 0 5 0 1"
                                for i in mg.split('\n'): send_message(i)
                        elif arg[0] in ['box']:
                            if len(arg) > 1:
                                boxTypes = ['s','small','big','b']
                                boxType, pos, count = 'small', [0, 5, 0], 1
                                boxType = arg[1].lower() if arg[1].lower() in boxTypes else 'small'
                                if len(arg) > 5: count = min(30, int(arg[5])) if bigger_than_zero(arg[5]) else 1
                                for i in range(2, 5):
                                    if len(arg) > i and is_num(arg[i]): pos[i-2] = float(arg[i])
                                for i in range(count):
                                    Box(pos=tuple(pos), scale=1 if boxType in ["s","small"] else 1.38, owner=None).autoRetain()
                            else:
                                for i in ["s box [small|big] [позиция] [кол-во]", \
                                    "s box small 0 5 0", "s box big ~ ~ ~ 5"]: send_message(i)
                    else:
                        for i in ["summon [bomb|powerup|bot|box|flag]", "bomb - вызвать бомбу.", "powerup - вызвать усилитель.", "bot - вызвать бота.", "box - вызвать коробку."]: send_message(i)

                elif command in ['skin'] and self.is_vip:
                    if len(arg) > 0:
                        if len(arg) < 2: arg.append(get_account_string(self.player))
                        if arg[0] in gSkins or arg[0] == 'delete':
                            account = is_account(arg[1], True)
                            if arg[1] == "all": 
                                if arg[0] == 'delete':
                                    for i in a.players: skins.delete_skin(i)
                                else: skins.change_skin(skin=arg[0], players=[a.players])
                            elif account is not None: 
                                if arg[0] == 'delete': skins.delete_skin(account)
                                else: skins.change_skin(skin=arg[0], players=[account])
                            elif is_num(arg[1]):
                                if len(a.players) > int(arg[1]) and int(arg[1]) >= 0: 
                                    if arg[0] == 'delete': skins.delete_skin(int(arg[1]))
                                    else: skins.change_skin(skin=arg[0], players=[int(arg[1])])
                            
                    else:
                        mg = bs.text_split(words=gSkins)
                        mg += "skin [название] [номер игрока]\nskin bunny 0\nskin pixie"
                        for i in mg.split('\n'): send_message(i)

                elif command in ['ph','punch','hp','hitpoints'] and self.is_admin:
                    if len(arg) > 0 and len(a.players) > 0:
                        if len(arg) < 2: player = [self.player]
                        if len(arg) > 1:
                            if is_num(arg[1]) and len(a.players) > int(arg[1]) and int(arg[1]) >= 0: player = [a.players[int(arg[1])]]
                            elif arg[1] == "all": player = a.players
                        if player is not None:
                            if bigger_than_zero(arg[0]):
                                arg[0] = int(arg[0])
                                if command in ["punch", "ph"] and arg[0] > 10: arg[0] = 10
                                for i in player:
                                    if i.exists():
                                        if command in ["punch", "ph"]: i.actor._punchPowerScale = arg[0]
                                        else: i.actor.hitPointsMax = i.actor.hitPoints = arg[0]
                    else:
                        for i in [command+" [число] [номер игрока | all]", \
                            command+" 1000 0", command+" 10 all"]: send_message(i)
    
                elif (command in ['vip'] and self.is_admin) or (command in ['admin'] and self.is_host):
                    if len(arg) > 0: self.add_admin(True if command == "admin" else False, get_account_string(arg[0]))
                    else:
                        for i in [command+" [номер игрока|имя аккаунта]", \
                            command+" 0", command+u" \ue030PC123456"]: send_message(i)
                        
                elif command in ['df','default'] and self.is_host:
                    if len(arg) > 0: self.del_admin(get_account_string(arg[0]))
                    else:
                        for i in [command+" [номер игрока|имя аккаунта]", \
                            command+" 0", command+u" \ue030PC123456"]: send_message(i)

                elif command in ['prefix'] and self.is_admin:
                    global prefixes
                    if len(arg) > 0:
                        type = arg[1] if len(arg) > 1 else "spark"
                        prefix = "prefix" if len(arg) < 3 else (" ").join(msg.split(" ")[3:])
                        if arg[0] == 'delete' and len(arg) > 1: account = get_account_string(arg[1])
                        elif arg[0] != 'delete': account = get_account_string(arg[0])
                        else: account = None
                        if arg[0] == 'delete': 
                            if account is not None and account in prefixes:
                                prefixes.pop(account)
                                if gSettingsEnabled: bs.set_setting("prefixes", prefixes)
                        else: self.set_prefix(account=account, prefix=prefix, type=type)
                    else:
                        for i in ["prefix [номер игрока | имя аккаунта] [slime|ice|spark|rock|metal] [префикс]", \
                            "prefix 0 spark клоун сбежал"]: send_message(i)

                elif command in ['kick'] and self.is_vip:
                    if len(arg) > 0:
                        account = get_account_string(arg[0])
                        if account is not None and len(roster) > 0:
                            id = None
                            for i in roster:
                                if i['displayString'].decode('utf-8') == account:
                                    id = i['clientID']
                                    break
                            if id is not None: bsInternal._disconnectClient(id, 300)
                    else:
                        for i in [command+" [номер игрока|имя аккаунта]", \
                            command+" 0", command+u" \ue030PC123456"]: send_message(i)
    
                elif command in ['ban'] and self.is_admin:
                    if len(arg) > 0: self.ban(account=get_account_string(arg[0]))
                    else:
                        for i in [command+" [номер игрока|имя аккаунта]", \
                            command+" 0", command+u" \ue030PC123456"]: send_message(i)
                    
                elif command in ['end'] and self.is_vip:
                    if hasattr(a, "endGame"): a.endGame()
                    else: send_message("Сейчас это недоступно")
                                   
                elif command in ['party','pt'] and self.is_admin:
                    if hasattr(a, 'cameraFlash') and gEvent:
                        time = 1000
                        def run(time=1000):
                            color = tuple([random.randrange(1,2) for i in range(3)])
                            a.cameraFlash(duration=time, color=color)
                        if hasattr(a, "_partyFlash") and a._partyFlash is not None: 
                            a._partyFlash = None
                            a._cameraFlash = []
                        else: 
                            run(time=time)
                            a._partyFlash = bs.Timer(time, bs.Call(run, time), True)
                    else: send_message("Сейчас это недоступно")

                elif command in ['sm'] and self.is_vip:
                    bs.getSharedObject("globals").slowMotion = motion = bs.getSharedObject("globals").slowMotion == False
                    set_motion(motion=motion)
                    
                elif command in ['pause'] and self.is_admin:
                    bs.getSharedObject("globals").paused = bs.getSharedObject("globals").paused == False

                elif command in ['max_players', 'mp'] and self.is_admin:
                    if bigger_than_zero(arg[0]): bsInternal._setPublicPartyMaxSize(int(arg[0]))
                    else:
                        for i in ["mp [кол-во игроков]", "mp 8", "максимальное кол-во игроков сейчас: "+str(bsInternal._getPublicPartyMaxSize())]: send_message(i)
                        
                elif command in ['shatter', 'sh'] and self.is_vip:
                    if len(arg) > 0:
                        def shatter(player=None, shatterMultiple=1): 
                            if player is not None and player.exists() and player.isAlive():
                                player.actor.node.shattered = shatterMultiple
                                player.actor.shattered = True if shatterMultiple > 0 else False
                        if bigger_than_zero(arg[0]):
                            if len(arg) > 1:
                                if is_num(arg[1]) and int(arg[1]) < len(a.players): shatter(a.players[int(arg[1])], int(arg[0]))
                                elif arg[1] == "all":
                                    for i in a.players: shatter(i, int(arg[0])) 
                            elif self.player is not None: shatter(self.player, int(arg[0]))
                    else: 
                        for i in [command+" [число] [номер игрока | all]", command+" 2 0", command+" 10"]: send_message(i)
                        
                elif command in ['frozen', 'fr'] and self.is_vip:
                    if len(arg) > 0:
                        def frozen(player=None):
                            if player is not None and player.exists() and player.isAlive():
                                player.actor.node.frozen = player.actor.node.frozen == 0
                                player.actor.frozen = player.actor.frozen == False
                        if is_num(arg[0]) and int(arg[0]) < len(a.players): frozen(a.players[int(arg[0])])
                        elif arg[0] == "all":
                            for i in a.players: frozen(i)
                        elif self.player is not None: frozen(self.player)
                    else:
                        for i in [command+" [номер игрока | all]", command+" 2", \
                            command+" me", "введи команду повторно, чтобы её отменить"]: send_message(i)
                        
                elif command in ['sleep','sl'] and self.is_admin:
                    if len(arg) > 0:
                        def sleep(player=None, sleepTime=5000):
                            def work(player=None, sleepTime=5000): 
                                if player is not None and player.exists() and player.isAlive():
                                    player.actor.node.handleMessage('knockout', sleepTime)
                                    if not hasattr(player.actor, 'sleepTime') or (hasattr(player.actor, 'sleepTime') and player.actor.sleepTime is None): 
                                        player.actor.sleepTime = sleepTime
                                    else: 
                                        player.actor.sleepTime -= 500
                                        if player.actor.sleepTime <= 0: 
                                            player.actor._sleep = player.actor.sleepTime = None
                            if player is not None and player.exists() and player.isAlive():
                                if sleepTime > 500:
                                    if hasattr(player.actor, '_sleep') and player.actor._sleep is not None: player.actor._sleep = None
                                    else: 
                                        player.actor._sleep = bs.Timer(500, bs.Call(work, player, sleepTime), repeat=True)
                                        work(player=player, sleepTime=sleepTime)
                                else: work(player=player, sleepTime=sleepTime)
                        if bigger_than_zero(arg[0]):
                            if len(arg) > 1:
                                if is_num(arg[1]) and int(arg[1]) < len(a.players): sleep(a.players[int(arg[1])], int(arg[0]))
                                elif arg[1] == "all":
                                    for i in a.players: sleep(i, int(arg[0]))
                            elif self.player is not None: sleep(self.player, int(arg[0]))
                    else:
                        for i in [command+" [число] [номер игрока | all]", command+" 2000 0", \
                            command+" 5000", "введи команду повторно, чтобы её отменить"]: send_message(i)
                    
                elif command in ['curse','cr'] and self.is_admin:
                    if len(arg) > 0:
                        def curse(player=None):
                            if player is not None and player.exists() and player.isAlive():
                                if hasattr(player.actor, 'curse'): player.actor.curse()
                        if is_num(arg[0]) and int(arg[0]) < len(a.players): curse(a.players[int(arg[0])])
                        elif arg[0] == "all":
                            for i in a.players: curse(i)
                        elif self.player is not None: curse(self.player)
                    else:
                        for i in [command+" [номер игрока | all]", command+" 2", command+" me"]: send_message(i)
                    
                elif command in ['nodes'] and self.is_admin:
                    if len(arg) > 0:
                        if arg[0] == 'types': nodes = list(set([i.getNodeType() for i in bsInternal.getNodes() if hasattr(i, "getNodeType")]))
                        if arg[0] == 'names': nodes = [i.getName() for i in bsInternal.getNodes() if hasattr(i, 'getName')]
                        if len(arg) > 1: nodes = [i for i in nodes if arg[1].lower() in i.lower()]
                        for i in bs.text_split(words=nodes, stroke_on_end=False).split('\n'): send_message(i)
                    else: 
                        for i in [command+' types spaz', command+' types', command+' names']: send_message(i)

                elif command in ['connect'] and self.is_admin:
                    def connect(node=None, connected_node=None, type='position'):
                        if node is not None and node.exists():
                            if connected_node is not None and connected_node.exists(): 
                                try: node.connectAttr(type, connected_node, type)
                                except: pass
                    if len(arg) > 0:
                        node = [i for i in bsInternal.getNodes() if hasattr(i, 'getName') and i.getName().lower() == arg[0].lower()]
                        if len(node) > 0: 
                            node = node[0]
                            if len(arg) < 3: arg[2] = 'position'
                            if is_num(arg[1]) and int(arg[1]) < len(a.players): 
                                player = a.players[int(arg[1])]
                                if player.exists(): connect(player.actor.node, node, arg[2])
                            elif arg[1] == "all":
                                for i in a.players: 
                                    if i.exists(): connect(i.actor.node, node, arg[2])
                            elif self.player is not None and self.player.exists(): connect(self.player.actor.node, node, arg[2])
                    else:
                        for i in [command+' [имя объекта (/nodes names)] [номер игрока | all] [тип присоединения]', \
                            command+' [email protected]:259 all position']: send_message(i)
                    
                        
                elif command in ['head'] and self.is_admin:
                    if len(arg) > 0:
                        def head(player=None):
                            if player is not None and player.exists() and player.isAlive():
                                player.actor.node.holdNode = player.actor.node
                        if is_num(arg[0]) and int(arg[0]) < len(a.players): head(a.players[int(arg[0])])
                        elif arg[0] == "all":
                            for i in a.players: head(i)
                        elif self.player is not None: head(self.player)
                    else:
                        for i in [command+" [номер игрока | all]", command+" 2", command+" me"]: send_message(i)

                elif command in ['rise', 'rs'] and self.is_vip:
                    if len(arg) > 0:
                        def respawn(player=None):
                            if player is not None and player.exists() and not player.isAlive():
                                player.gameData['respawnTimer'] = player.gameData['respawnIcon'] = None
                                with bs.Context(a): a.spawnPlayer(player=player)
                        if is_num(arg[0]) and int(arg[0]) < len(a.players): respawn(a.players[int(arg[0])])
                        elif arg[0] == "all":
                            for i in a.players: respawn(i)
                        elif self.player is not None: respawn(self.player)
                    else:
                        for i in [command+" [номер игрока | all]", command+" 2", command+" me"]: send_message(i)
                        
                elif command in ['flex','fl'] and self.is_vip:
                    if not gEvent:
                        send_message("Сейчас это недоступно")
                        return 
                    if len(arg) > 0:
                        def flex(actor=None):
                            def work(node=None):
                                if node is not None and node.exists(): node.handleMessage('celebrate', 1000)
                            if actor is not None and actor.exists():
                                if not hasattr(actor, '_flex') or (hasattr(actor, '_flex') and actor._flex is None):
                                    actor._flex = bs.Timer(1000, bs.Call(work, actor.node), repeat=True)
                                    work(node=actor.node)
                                else: actor._flex = None
                        if is_num(arg[0]) and int(arg[0]) < len(a.players): flex(a.players[int(arg[0])].actor)
                        elif arg[0] == 'all':
                            for i in find_players_and_bots(): flex(i)
                        elif self.player is not None and self.player.exists(): flex(self.player.actor)
                    else:
                        for i in [command+" [номер игрока|all]", command+" 0", command+" me", "введи команду повторно, чтобы её отменить"]: send_message(i)
                        
                elif command in ['dn', 'dance'] and self.is_admin:
                    if not gEvent:
                        send_message("Сейчас это недоступно")
                        return 
                    if len(arg) > 0:
                        def dance(actor=None):
                            def work(node=None):
                                if node is not None and node.exists():
                                    pos = (node.position[0], node.position[1] + 0.5, node.position[2])
                                    node.handleMessage("impulse", pos[0], pos[1], pos[2], 0, -2, 0, 2000, 0, 1, 0, 0, -2, 0)
                            if actor is not None and actor.exists(): 
                                if not hasattr(actor, '_dance') or (hasattr(actor, '_dance') and actor._dance is None):
                                    actor._dance = bs.Timer(100, bs.Call(work, actor.node), repeat=True)
                                    work(node=actor.node)
                                else: actor._dance = None
                        if is_num(arg[0]) and int(arg[0]) < len(a.players): dance(a.players[int(arg[0])].actor)
                        elif arg[0] == 'all':
                            for i in find_players_and_bots(): dance(i)
                        elif self.player is not None and self.player.exists(): dance(self.player.actor)
                    else:
                        for i in [command+" [номер игрока|all]", command+" 0", command+" me", "введи команду повторно, чтобы её отменить"]: send_message(i)
                        
                elif command in ['dn2', 'dance2'] and self.is_admin:
                    if not gEvent:
                        send_message("Сейчас это недоступно")
                        return 
                    if len(arg) > 0:
                        def dance2(actor=None):
                            def work(node=None):
                                if node is not None and node.exists():
                                    node.jumpPressed = True
                                    node.jumpPressed = False
                            if actor is not None and actor.exists(): 
                                if not hasattr(actor, '_dance2') or (hasattr(actor, '_dance2') and actor._dance2 is None):
                                    actor._dance2 = bs.Timer(500, bs.Call(work, actor.node), repeat=True)
                                    work(node=actor.node)
                                else: actor._dance2 = None
                        if is_num(arg[0]) and int(arg[0]) < len(a.players): dance2(a.players[int(arg[0])].actor)
                        elif arg[0] == 'all':
                            for i in find_players_and_bots(): dance2(i)
                        elif self.player is not None and self.player.exists(): dance2(self.player.actor)
                    else:
                        for i in [command+" [номер игрока|all]", command+" 0", command+" me", "введи команду повторно, чтобы её отменить"]: send_message(i)
Ejemplo n.º 22
0
 def _spawnBombAtPt(self, pt):
     if self.hasEnded():
         return
     bs.Bomb(position=pt, bombType='normal').autoRetain()
Ejemplo n.º 23
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
Ejemplo n.º 24
0
 def _makeMine(self, i):
     m = self._raceMines[i]
     m['mine'] = bs.Bomb(position=m['point'][:3], bombType='landMine')
     m['mine'].arm()
Ejemplo n.º 25
0
 def _dropBomb(self, position, velocity):
     b = bs.Bomb(position=position,
                 velocity=velocity,
                 bombType='basketball').autoRetain()
     b = bs.Bomb(position=position, velocity=velocity,
                 bombType='impact').autoRetain()