def getMaterial(self, i):
        self.materialHealth = bs.Material()
        self.materialFreeze = bs.Material()
        self.materialCurse = bs.Material()

        # Setup Health
        self.materialHealth.addActions(
            conditions=((('theyAreOlderThan', 100), 'and',
                         ('theyHaveMaterial',
                          bs.getSharedObject('playerMaterial')))),
            actions=('message', 'theirNode', 'atConnect',
                     bs.PowerupMessage('health')))
        # Setup Freeze
        self.materialFreeze.addActions(
            conditions=((('theyAreOlderThan', 100), 'and',
                         ('theyHaveMaterial',
                          bs.getSharedObject('playerMaterial')))),
            actions=('message', 'theirNode', 'atConnect', bs.FreezeMessage()))
        # Setup Curse
        self.materialCurse.addActions(
            conditions=((('theyAreOlderThan', 100), 'and',
                         ('theyHaveMaterial',
                          bs.getSharedObject('playerMaterial')))),
            actions=('message', 'theirNode', 'atConnect',
                     bs.PowerupMessage('curse')))
        self.materials = [
            self.materialHealth, self.materialFreeze, self.materialCurse
        ]
        return self.materials[i]
Esempio n. 2
0
 def givePowers(self):
     for player in self.players:
         if not player.actor is None:
             if player.actor.isAlive():
                 #This teleport the player
                 if player.actor.landMineCount == 1:
                     pos = self.getMap().getFFAStartPosition(self.players)
                     player.actor.handleMessage(bs.StandMessage(pos))
                     bs.Blast(position=pos,
                              blastRadius=1.0,
                              blastType='smoke').autoRetain()
                     bs.playSound(bs.getSound('shieldDown'))
                     player.actor.landMineCount = 0
                 #The player will be fly with the explosions
                 elif player.actor.landMineCount == 2:
                     pos = player.actor.node.position
                     bs.Blast(position=(pos[0], pos[1] - 0.5, pos[2]),
                              blastRadius=1.0,
                              blastType='smoke').autoRetain()
                     player.actor.handleMessage(bs.PowerupMessage('health'))
                     player.actor.landMineCount = 0
                 elif player.actor.landMineCount == 3:
                     mPlayer = player.actor
                     self.freezeAll(mPlayer)
                     player.actor.landMineCount = 0
Esempio n. 3
0
 def cheat(self):
     self.spaz.node.invincible = True
     self.spaz.node.hockey = True
     self.spaz._punchPowerScale = 11
     self.spaz.defaultBombType = 'forceBomb'
     self.spaz.bombType = 'forceBomb'
     self.spaz.bombCount = 100000
     self.spaz.node.handleMessage(bs.PowerupMessage(powerupType = 'health'))
     
     bs.gameTimer(10,bs.Call(bs.Blast,blastRadius = 10000))
Esempio n. 4
0
def pow(a, b):
    if b == 'h':
        try:
            bsInternal._getForegroundHostActivity().players[int(
                a)].actor.node.handleMessage(
                    bs.PowerupMessage(powerupType='health'))
        except:
            bs.screenMessage('Error!', color=(1, 0, 0))
    elif b == 's':
        try:
            bsInternal._getForegroundHostActivity().players[int(
                a)].actor.node.handleMessage(
                    bs.PowerupMessage(powerupType='shield'))
        except:
            bs.screenMessage('Error!', color=(1, 0, 0))
    elif b == 'p':
        try:
            bsInternal._getForegroundHostActivity().players[int(
                a)].actor.node.handleMessage(
                    bs.PowerupMessage(powerupType='punch'))
        except:
            bs.screenMessage('Error!', color=(1, 0, 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():
                    bs.gameTimer(100, self.nodeLight.delete)
                    if self.powerupType == 'snoball':
                        spaz = node.getDelegate()
                        SnoBallz.snoBall().getFactory().giveBallz(spaz)
                        self._powersGiven = True
                        self.handleMessage(bs.DieMessage())
                    elif self.powerupType == 'TouchMe':
                        p = node.positionForward
                        self._powersGiven = True
                        self.handleMessage(bs.DieMessage())
                        bsSomething.Something(
                            (p[0], p[1] + 2, p[2])).autoRetain()
                    elif self.powerupType == 'BlackHole':
                        p = node.positionForward
                        self._powersGiven = True
                        self.handleMessage(bs.DieMessage())
                        bsSomething.BlackHole(
                            (p[0], p[1] + 2, p[2])).autoRetain()
                    elif self.powerupType == 'Slippery':
                        p = node.positionForward
                        self._powersGiven = True
                        self.handleMessage(bs.DieMessage())
                        bsSomething.MagicSpell(
                            (p[0], p[1] + 2, p[2])).autoRetain()
                    elif self.powerupType == 'Box':
                        self._powersGiven = True
                        self.handleMessage(bs.DieMessage())
                        node.handleMessage(
                            bs.PowerupMessage(powerupType='Box'))
                    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)

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

        elif isinstance(msg, bs.HitMessage):
            if msg.hitType == 'punch':
                if self.powerupType == 'curse':
                    bs.Blast(position=self.node.position,
                             velocity=(0, 0, 0),
                             blastRadius=1,
                             blastType="normal",
                             sourcePlayer=None,
                             hitType='explosion',
                             hitSubType='normal').autoRetain()
                    self.handleMessage(bs.DieMessage())
                elif self.powerupType == 'health':
                    bs.Blast(position=self.node.position,
                             velocity=(0, 0, 0),
                             blastRadius=1,
                             blastType="normal",
                             sourcePlayer=None,
                             hitType='explosion',
                             hitSubType='normal').autoRetain()
                    self.handleMessage(bs.DieMessage())
            else:
                self.handleMessage(bs.DieMessage())
        else:
            bs.Actor.handleMessage(self, msg)
Esempio n. 6
0
    def _setChosenOnePlayer(self, player):
        try:
            for p in self.players:
                p.gameData['FrozenLight'] = None
            bs.playSound(self._swipSound)
            if player is None or not player.exists():
                self._flag = bs.Flag(color=(1, 0.9, 0.2),
                                     position=self._flagSpawnPos,
                                     touchable=False)
                self._chosenOnePlayer = None

                l = bs.newNode('light',
                               owner=self._flag.node,
                               attrs={
                                   'position': self._flagSpawnPos,
                                   'intensity': 0.6,
                                   'heightAttenuated': False,
                                   'volumeIntensityScale': 0.1,
                                   'radius': 0.1,
                                   'color': (1.2, 1.2, 0.4)
                               })

                self._flashFlagSpawn()
            else:
                if player.actor is not None:
                    self._flag = None
                    self._chosenOnePlayer = player

                    if player.actor.node.exists():
                        if self.settings['Frozen One Gets Gloves']:
                            player.actor.handleMessage(
                                bs.PowerupMessage('punch'))

                        player.actor.frozen = True
                        player.actor.node.frozen = 1
                        # use a color that's partway between their team color and white
                        color = [
                            0.3 + c * 0.7 for c in bs.getNormalizedColor(
                                player.getTeam().color)
                        ]
                        l = player.gameData['FrozenLight'] = bs.NodeActor(
                            bs.newNode('light',
                                       attrs={
                                           "intensity": 0.6,
                                           "heightAttenuated": False,
                                           "volumeIntensityScale": 0.1,
                                           "radius": 0.13,
                                           "color": color
                                       }))

                        bs.animate(l.node,
                                   'intensity', {
                                       0: 1.0,
                                       200: 0.4,
                                       400: 1.0
                                   },
                                   loop=True)
                        player.actor.node.connectAttr('position', l.node,
                                                      'position')
        except Exception, e:
            import traceback
            print 'EXC in _setChosenOnePlayer'
            traceback.print_exc(e)
            traceback.print_stack()
    def opt(self, nick, msg):
        if self.checkDevice(nick):
            m = msg.split(' ')[0]  # command
            a = msg.split(' ', 1)[1:]  # arguments

            activity = bsInternal._getForegroundHostActivity()
            with bs.Context(activity):
                if m == '/kick':  #just remove from the game
                    if a == []:
                        bsInternal._chatMessage("MUST USE KICK ID")
                    else:
                        try:
                            kickedPlayerID = int(a[0])
                        except Exception:
                            bsInternal._chatMessage("PLAYER NOT FOUND")
                        else:
                            if not kickedPlayerID == -1:
                                bsInternal._disconnectClient(kickedPlayerID)
                                bsInternal._chatMessage(
                                    bs.getSpecialChar('logoFlat'))
                            else:
                                bsInternal._chatMessage("CANT KICK HOST")

                elif m == '/list':  #list of current players id
                    bsInternal._chatMessage(
                        "==========PLAYER KICK IDS==========")
                    for i in bsInternal._getGameRoster():
                        try:
                            bsInternal._chatMessage(
                                i['players'][0]['nameFull'] + "     kick ID " +
                                str(i['clientID']))
                        except Exception:
                            pass
                    bsInternal._chatMessage(
                        "==========PLAYER IDS=============")
                    for s in bsInternal._getForegroundHostSession().players:
                        bsInternal._chatMessage(
                            s.getName() + "  ID = " +
                            str(bsInternal._getForegroundHostSession().players.
                                index(s)))

                elif m == '/ban':  # add id to banlist=autokick list
                    if a == []:
                        bsInternal._chatMessage(
                            "MUST USE PLAYER ID OR NICK"
                        )  #also FIX this every time bsInternal ChatMessage thing!! for stop loops "update-FIXED"
                    else:  #firstly try nick if nick len is more then 2 else try as player id FIX ME
                        if len(a[0]) > 2:
                            for i in bs.getActivity().players:
                                try:
                                    if (i.getName()).encode('utf-8') == (a[0]):
                                        bannedClient = i.getInputDevice(
                                        ).getClientID()
                                        bannedName = i.getName().encode(
                                            'utf-8')
                                        bannedPlayerID = i.get_account_id()
                                        foolist = []
                                        foolist = mbal.autoKickList
                                        if bannedPlayerID not in foolist:
                                            foolist.append(bannedPlayerID)
                                            bsInternal._chatMessage(
                                                str(bannedName) + " Banned")
                                            i.removeFromGame()
                                        else:
                                            bsInternal._chatMessage(
                                                str(bannedName) +
                                                " Already Banned")
                                        with open(
                                                bs.getEnvironment()
                                            ['systemScriptsDirectory'] +
                                                "/MythBAdminList.py") as file:
                                            s = [row for row in file]
                                            s[7] = 'autoKickList = ' + str(
                                                foolist) + '\n'
                                            f = open(
                                                bs.getEnvironment()
                                                ['systemScriptsDirectory'] +
                                                "/MythBAdminList.py", 'w')
                                            for i in s:
                                                f.write(i)
                                            f.close()
                                            reload(mbal)
                                except Exception:
                                    pass
                            bsInternal._chatMessage(
                                bs.getSpecialChar('logoFlat'))
                        else:
                            try:
                                bannedClient = bsInternal._getForegroundHostSession(
                                ).players[int(a[0])]
                            except Exception:
                                bsInternal._chatMessage("PLAYER NOT FOUND")
                            else:
                                foolist = []
                                foolist = mbal.autoKickList
                                bannedPlayerID = bannedClient.get_account_id()
                                if bannedPlayerID not in foolist:
                                    foolist.append(bannedPlayerID)
                                    bsInternal._chatMessage(
                                        str(bannedClient) + " Banned")
                                    bannedClient.removeFromGame()
                                else:
                                    bsInternal._chatMessage(
                                        str(bannedClient) + " Already Banned")
                                with open(bs.getEnvironment()
                                          ['systemScriptsDirectory'] +
                                          "/MythBAdminList.py") as file:
                                    s = [row for row in file]
                                    s[7] = 'autoKickList = ' + str(
                                        foolist) + '\n'
                                    f = open(
                                        bs.getEnvironment()
                                        ['systemScriptsDirectory'] +
                                        "/MythBAdminList.py", 'w')
                                    for i in s:
                                        f.write(i)
                                    f.close()
                                    reload(mbal)

                elif m == '/unban':  # remove id from banlist=autokick list
                    if a == []:
                        bsInternal._chatMessage("MUST USE PLAYER ID OR NICK")
                    else:
                        if len(a[0]) > 2:
                            for i in bs.getActivity().players:
                                try:
                                    if (i.getName()).encode('utf-8') == (a[0]):
                                        bannedClient = i.getInputDevice(
                                        ).getClientID()
                                        bannedName = i.getName().encode(
                                            'utf-8')
                                        bannedPlayerID = i.get_account_id()
                                        foolist = []
                                        foolist = mbal.autoKickList
                                        if bannedPlayerID in foolist:
                                            foolist.remove(bannedPlayerID)
                                            bsInternal._chatMessage(
                                                str(bannedName) +
                                                " be free now!")
                                        else:
                                            bsInternal._chatMessage(
                                                str(bannedName) +
                                                " Already Not Banned")
                                        with open(
                                                bs.getEnvironment()
                                            ['systemScriptsDirectory'] +
                                                "/MythBAdminList.py") as file:
                                            s = [row for row in file]
                                            s[7] = 'autoKickList = ' + str(
                                                foolist) + '\n'
                                            f = open(
                                                bs.getEnvironment()
                                                ['systemScriptsDirectory'] +
                                                "/MythBAdminList.py", 'w')
                                            for i in s:
                                                f.write(i)
                                            f.close()
                                            reload(mbal)
                                except Exception:
                                    pass
                            bsInternal._chatMessage(
                                bs.getSpecialChar('logoFlat'))
                        else:
                            try:
                                bannedClient = bsInternal._getForegroundHostSession(
                                ).players[int(a[0])]
                            except Exception:
                                bsInternal._chatMessage("PLAYER NOT FOUND")
                            else:
                                foolist = []
                                foolist = mbal.autoKickList
                                bannedPlayerID = bannedClient.get_account_id()
                                if bannedPlayerID in foolist:
                                    foolist.remove(bannedPlayerID)
                                    bsInternal._chatMessage(
                                        str(bannedClient) + " be free now!")
                                else:
                                    bsInternal._chatMessage(
                                        str(bannedClient) +
                                        " Already Not Banned")
                                with open(bs.getEnvironment()
                                          ['systemScriptsDirectory'] +
                                          "/MythBAdminList.py") as file:
                                    s = [row for row in file]
                                    s[7] = 'autoKickList = ' + str(
                                        foolist) + '\n'
                                    f = open(
                                        bs.getEnvironment()
                                        ['systemScriptsDirectory'] +
                                        "/MythBAdminList.py", 'w')
                                    for i in s:
                                        f.write(i)
                                    f.close()
                                    reload(mbal)

                elif m == '/amnesty':  # reset blacklist
                    foolist = []
                    bsInternal._chatMessage(
                        "==========FREEDOM TO ALL==========")
                    bsInternal._chatMessage(
                        "=========BLACKLİST WIPED=========")
                    with open(bs.getEnvironment()['systemScriptsDirectory'] +
                              "/MythBAdminList.py") as file:
                        s = [row for row in file]
                        s[7] = 'autoKickList = ' + str(foolist) + '\n'
                        f = open(
                            bs.getEnvironment()['systemScriptsDirectory'] +
                            "/MythBAdminList.py", 'w')
                        for i in s:
                            f.write(i)
                        f.close()
                        reload(mbal)

                elif m == '/camera':  #change camera mode
                    bsInternal._chatMessage(bs.getSpecialChar('logoFlat'))
                    try:
                        if bs.getSharedObject(
                                'globals').cameraMode == 'follow':
                            bs.getSharedObject('globals').cameraMode = 'rotate'
                        else:
                            bs.getSharedObject('globals').cameraMode = 'follow'
                    except Exception:
                        bsInternal._chatMessage('AN ERROR OCCURED')

                elif m == '/maxplayers':  #set maxplayers limit
                    if a == []:
                        bsInternal._chatMessage('MUST USE NUMBERS')
                    else:
                        try:
                            bsInternal._getForegroundHostSession(
                            )._maxPlayers = int(a[0])
                            bsInternal._setPublicPartyMaxSize(int(a[0]))
                            bsInternal._chatMessage('MaxPlayers = ' +
                                                    str(int(a[0])))
                        except Exception:
                            bsInternal._chatMessage('AN ERROR OCCURED')

                elif m == '/help':  #show help
                    bsInternal._chatMessage(
                        "=====================COMMANDS=====================")
                    bsInternal._chatMessage(
                        "list-kick-remove-ban-unban-amnesty-kill-curse-end-heal"
                    )
                    bsInternal._chatMessage(
                        "freeze-thaw-headless-shield-punch-maxplayers-headlessall"
                    )
                    bsInternal._chatMessage(
                        "killall-freezeall-shieldall-punchall-camera-slow")

                elif m == '/remove':  #remove from game
                    if a == []:
                        bsInternal._chatMessage('MUST USE PLAYER ID OR NICK')
                    else:
                        if len(a[0]) > 2:
                            for i in bs.getActivity().players:
                                try:
                                    if (i.getName()).encode('utf-8') == (a[0]):
                                        i.removeFromGame()
                                except Exception:
                                    pass
                            bsInternal._chatMessage(
                                bs.getSpecialChar('logoFlat'))
                        else:
                            try:
                                bs.getActivity().players[int(
                                    a[0])].removeFromGame()
                                bsInternal._chatMessage(
                                    bs.getSpecialChar('logoFlat'))
                            except Exception:
                                bsInternal._chatMessage('PLAYER NOT FOUND')

                elif m == '/curse':  #curse
                    if a == []:
                        bsInternal._chatMessage('MUST USE PLAYER ID OR NICK')
                    else:
                        if len(a[0]) > 2:
                            for i in bs.getActivity().players:
                                try:
                                    if (i.getName()).encode('utf-8') == (a[0]):
                                        if i.actor.exists():
                                            i.actor.curse()
                                except Exception:
                                    pass
                            bsInternal._chatMessage(
                                bs.getSpecialChar('logoFlat'))
                        else:
                            try:
                                bs.getActivity().players[int(
                                    a[0])].actor.curse()
                                bsInternal._chatMessage(
                                    bs.getSpecialChar('logoFlat'))
                            except Exception:
                                bsInternal._chatMessage('PLAYER NOT FOUND')

                elif m == '/curseall':  #curse all
                    for i in bs.getActivity().players:
                        try:
                            if i.actor.exists():
                                i.actor.curse()
                        except Exception:
                            pass
                    bsInternal._chatMessage(bs.getSpecialChar('logoFlat'))

                elif m == '/kill':  #kill
                    if a == []:
                        bsInternal._chatMessage('MUST USE PLAYER ID OR NICK')
                    else:
                        if len(a[0]) > 2:
                            for i in bs.getActivity().players:
                                try:
                                    if (i.getName()).encode('utf-8') == (a[0]):
                                        if i.actor.exists():
                                            i.actor.node.handleMessage(
                                                bs.DieMessage())
                                except Exception:
                                    pass
                            bsInternal._chatMessage(
                                bs.getSpecialChar('logoFlat'))
                        else:
                            try:
                                bs.getActivity().players[int(
                                    a[0])].actor.node.handleMessage(
                                        bs.DieMessage())
                                bsInternal._chatMessage(
                                    bs.getSpecialChar('logoFlat'))
                            except Exception:
                                bsInternal._chatMessage('PLAYER NOT FOUND')

                elif m == '/killall':  #kill all
                    for i in bs.getActivity().players:
                        try:
                            if i.actor.exists():
                                i.actor.node.handleMessage(bs.DieMessage())
                        except Exception:
                            pass
                    bsInternal._chatMessage(bs.getSpecialChar('logoFlat'))

                elif m == '/freeze':  #freeze
                    if a == []:
                        bsInternal._chatMessage('MUST USE PLAYER ID OR NICK')
                    else:
                        if len(a[0]) > 2:
                            for i in bs.getActivity().players:
                                try:
                                    if (i.getName()).encode('utf-8') == (a[0]):
                                        if i.actor.exists():
                                            i.actor.node.handleMessage(
                                                bs.FreezeMessage())
                                except Exception:
                                    pass
                            bsInternal._chatMessage(
                                bs.getSpecialChar('logoFlat'))
                        else:
                            try:
                                bs.getActivity().players[int(
                                    a[0])].actor.node.handleMessage(
                                        bs.FreezeMessage())
                                bsInternal._chatMessage(
                                    bs.getSpecialChar('logoFlat'))
                            except Exception:
                                bsInternal._chatMessage('PLAYER NOT FOUND')

                elif m == '/freezeall':  #freeze all
                    for i in bs.getActivity().players:
                        try:
                            if i.actor.exists():
                                i.actor.node.handleMessage(bs.FreezeMessage())
                        except Exception:
                            pass
                    bsInternal._chatMessage(bs.getSpecialChar('logoFlat'))

                elif m == '/thaw':  #thaw
                    if a == []:
                        bsInternal._chatMessage('MUST USE PLAYER ID OR NICK')
                    else:
                        if len(a[0]) > 2:
                            for i in bs.getActivity().players:
                                try:
                                    if (i.getName()).encode('utf-8') == (a[0]):
                                        if i.actor.exists():
                                            i.actor.node.handleMessage(
                                                bs.ThawMessage())
                                except Exception:
                                    pass
                            bsInternal._chatMessage(
                                bs.getSpecialChar('logoFlat'))
                        else:
                            try:
                                bs.getActivity().players[int(
                                    a[0])].actor.node.handleMessage(
                                        bs.ThawMessage())
                                bsInternal._chatMessage(
                                    bs.getSpecialChar('logoFlat'))
                            except Exception:
                                bsInternal._chatMessage('PLAYER NOT FOUND')

                elif m == '/thawall':  #thaw all
                    for i in bs.getActivity().players:
                        try:
                            if i.actor.exists():
                                i.actor.node.handleMessage(bs.ThawMessage())
                        except Exception:
                            pass
                    bsInternal._chatMessage(bs.getSpecialChar('logoFlat'))

                elif m == '/headless':  #headless
                    if a == []:
                        bsInternal._chatMessage('MUST USE PLAYER ID OR NICK')
                    else:
                        if len(a[0]) > 2:
                            for i in bs.getActivity().players:
                                try:
                                    if (i.getName()).encode('utf-8') == (a[0]):
                                        if i.actor.exists():
                                            i.actor.node.headModel = None
                                            i.actor.node.style = "cyborg"
                                except Exception:
                                    pass
                            bsInternal._chatMessage(
                                bs.getSpecialChar('logoFlat'))
                        else:
                            try:
                                bs.getActivity().players[int(
                                    a[0])].actor.node.headModel = None
                                bs.getActivity().players[int(
                                    a[0])].actor.node.style = "cyborg"
                                bsInternal._chatMessage(
                                    bs.getSpecialChar('logoFlat'))
                            except Exception:
                                bsInternal._chatMessage('PLAYER NOT FOUND')

                elif m == '/headlessall':  #headless all
                    for i in bs.getActivity().players:
                        try:
                            if i.actor.exists():
                                i.actor.node.headModel = None
                                i.actor.node.style = "cyborg"
                        except Exception:
                            pass
                    bsInternal._chatMessage(bs.getSpecialChar('logoFlat'))

                elif m == '/heal':  #heal
                    if a == []:
                        bsInternal._chatMessage('MUST USE PLAYER ID OR NICK')
                    else:
                        if len(a[0]) > 2:
                            for i in bs.getActivity().players:
                                try:
                                    if (i.getName()).encode('utf-8') == (a[0]):
                                        if i.actor.exists():
                                            i.actor.node.handleMessage(
                                                bs.PowerupMessage(
                                                    powerupType='health'))
                                except Exception:
                                    pass
                            bsInternal._chatMessage(
                                bs.getSpecialChar('logoFlat'))
                        else:
                            try:
                                bs.getActivity().players[int(
                                    a[0])].actor.node.handleMessage(
                                        bs.PowerupMessage(
                                            powerupType='health'))
                                bsInternal._chatMessage(
                                    bs.getSpecialChar('logoFlat'))
                            except Exception:
                                bsInternal._chatMessage('PLAYER NOT FOUND')

                elif m == '/healall':  #heal all
                    for i in bs.getActivity().players:
                        try:
                            if i.actor.exists():
                                i.actor.node.handleMessage(
                                    bs.PowerupMessage(powerupType='health'))
                        except Exception:
                            pass
                    bsInternal._chatMessage(bs.getSpecialChar('logoFlat'))

                elif m == '/shield':  #shield
                    if a == []:
                        bsInternal._chatMessage('MUST USE PLAYER ID OR NICK')
                    else:
                        if len(a[0]) > 2:
                            for i in bs.getActivity().players:
                                try:
                                    if (i.getName()).encode('utf-8') == (a[0]):
                                        if i.actor.exists():
                                            i.actor.node.handleMessage(
                                                bs.PowerupMessage(
                                                    powerupType='shield'))
                                except Exception:
                                    pass
                            bsInternal._chatMessage(
                                bs.getSpecialChar('logoFlat'))
                        else:
                            try:
                                bs.getActivity().players[int(
                                    a[0])].actor.node.handleMessage(
                                        bs.PowerupMessage(
                                            powerupType='shield'))
                                bsInternal._chatMessage(
                                    bs.getSpecialChar('logoFlat'))
                            except Exception:
                                bsInternal._chatMessage('PLAYER NOT FOUND')

                elif m == '/shieldall':  #shield all
                    for i in bs.getActivity().players:
                        try:
                            if i.actor.exists():
                                i.actor.node.handleMessage(
                                    bs.PowerupMessage(powerupType='shield'))
                        except Exception:
                            pass
                    bsInternal._chatMessage(bs.getSpecialChar('logoFlat'))

                elif m == '/punch':  #punch
                    if a == []:
                        bsInternal._chatMessage('MUST USE PLAYER ID OR NICK')
                    else:
                        if len(a[0]) > 2:
                            for i in bs.getActivity().players:
                                try:
                                    if (i.getName()).encode('utf-8') == (a[0]):
                                        if i.actor.exists():
                                            i.actor.node.handleMessage(
                                                bs.PowerupMessage(
                                                    powerupType='punch'))
                                except Exception:
                                    pass
                            bsInternal._chatMessage(
                                bs.getSpecialChar('logoFlat'))
                        else:
                            try:
                                bs.getActivity().players[int(
                                    a[0])].actor.node.handleMessage(
                                        bs.PowerupMessage(powerupType='punch'))
                                bsInternal._chatMessage(
                                    bs.getSpecialChar('logoFlat'))
                            except Exception:
                                bsInternal._chatMessage('PLAYER NOT FOUND')

                elif m == '/punchall':  #punch all
                    for i in bs.getActivity().players:
                        try:
                            if i.actor.exists():
                                i.actor.node.handleMessage(
                                    bs.PowerupMessage(powerupType='punch'))
                        except Exception:
                            pass
                    bsInternal._chatMessage(bs.getSpecialChar('logoFlat'))

                elif m == '/knock':  #knock him
                    if a == []:
                        bsInternal._chatMessage('MUST USE PLAYER ID OR NICK')
                    else:
                        if len(a[0]) > 2:
                            for i in bs.getActivity().players:
                                try:
                                    if (i.getName()).encode('utf-8') == (a[0]):
                                        if i.actor.exists():
                                            i.actor.node.handleMessage(
                                                "knockout", 5000)
                                except Exception:
                                    pass
                            bsInternal._chatMessage(
                                bs.getSpecialChar('logoFlat'))
                        else:
                            try:
                                bs.getActivity().players[int(
                                    a[0])].actor.node.handleMessage(
                                        "knockout", 5000)
                                bsInternal._chatMessage(
                                    bs.getSpecialChar('logoFlat'))
                            except Exception:
                                bsInternal._chatMessage('PLAYER NOT FOUND')

                elif m == '/knockall':  #knock all
                    for i in bs.getActivity().players:
                        try:
                            if i.actor.exists():
                                i.actor.node.handleMessage("knockout", 5000)
                        except Exception:
                            pass
                    bsInternal._chatMessage(bs.getSpecialChar('logoFlat'))

                elif m == '/celebrate':  #celebrate him
                    if a == []:
                        bsInternal._chatMessage('MUST USE PLAYER ID OR NICK')
                    else:
                        if len(a[0]) > 2:
                            for i in bs.getActivity().players:
                                try:
                                    if (i.getName()).encode('utf-8') == (a[0]):
                                        if i.actor.exists():
                                            i.actor.node.handleMessage(
                                                'celebrate', 30000)
                                except Exception:
                                    pass
                            bsInternal._chatMessage(
                                bs.getSpecialChar('logoFlat'))
                        else:
                            try:
                                bs.getActivity().players[int(
                                    a[0])].actor.node.handleMessage(
                                        'celebrate', 30000)
                                bsInternal._chatMessage(
                                    bs.getSpecialChar('logoFlat'))
                            except Exception:
                                bsInternal._chatMessage('PLAYER NOT FOUND')

                elif m == '/celebrateall':  #celebrate
                    for i in bs.getActivity().players:
                        try:
                            if i.actor.exists():
                                i.actor.node.handleMessage('celebrate', 30000)
                        except Exception:
                            pass
                    bsInternal._chatMessage(bs.getSpecialChar('logoFlat'))

                elif m == '/slow':  # slow-mo
                    bsInternal._chatMessage(bs.getSpecialChar('logoFlat'))
                    try:
                        if bs.getSharedObject('globals').slowMotion == True:
                            bs.getSharedObject('globals').slowMotion = False
                        else:
                            bs.getSharedObject('globals').slowMotion = True
                    except Exception:
                        bsInternal._chatMessage('AN ERROR OCCURED')

                elif m == '/end':  # just end game
                    try:
                        bsInternal._getForegroundHostActivity().endGame()
                        bsInternal._chatMessage('THE END')
                    except Exception:
                        bsInternal._chatMessage('AN ERROR OCCURED')
Esempio n. 8
0
    def _handleScore(self):
        """ a point has been scored """

        # our ball might stick around for a second or two
        # we dont want it to be able to score again
        if self._ball.scored: return

        region = bs.getCollisionInfo("sourceNode")
        for i in range(len(self._scoreRegions)):
            if region == self._scoreRegions[i].node:
                break;

        scoringTeam = None
        for team in self.teams:
            if team.getID() == i:
                scoringTeam = team
                team.gameData['score'] += 1

                # tell scored team players to celebrate and give them to boxing gloves
                for player in team.players:
                    try: player.actor.node.handleMessage('celebrate',2000) or player.actor.node.handleMessage(bs.PowerupMessage('punch'))
                    except Exception: pass

                # if weve got the player from the scoring team that last touched us, give them points
                if scoringTeam.getID() in self._ball.lastPlayersToTouch and self._ball.lastPlayersToTouch[scoringTeam.getID()].exists():
                    self.scoreSet.playerScored(self._ball.lastPlayersToTouch[scoringTeam.getID()],100,bigMessage=True)

                # end game if we won
                if team.gameData['score'] >= self.settings['Score to Win']:
                    bs.gameTimer(1250,self.endGame)	

        scoringTeam = None
        for team in self.teams:
            if not team.getID() == i:
                scoringTeam = team
                team.gameData['score'] += 0

                # give non-scored team players to shield for balance
                for player in team.players:
                    try: player.actor.node.handleMessage(bs.PowerupMessage('shield'))
                    except Exception: pass
                    

        bs.playSound(self._scoreSound)
        bs.playSound(self._cheerSound)

        self._ball.scored = True

        # kill the ball (it'll respawn itself shortly)
        bs.gameTimer(1000,self._killBall)

        light = bs.newNode('light',
                           attrs={'position': bs.getCollisionInfo('position'),
                                  'heightAttenuated':False,
                                  'color': (1,0,0)})
        bs.animate(light,'intensity',{0:0,500:1,1000:0},loop=True)
        bs.gameTimer(1000,light.delete)

        self.cameraFlash(duration=10)
        self._updateScoreBoard()
        
        #pretty celebrate
        if scoringTeam.getID() == 1:
                bs.emitBGDynamics(position=(12.66, 0.03986567039, 2.075),
                                  velocity=(0,0,0),
                                  count=random.randrange(20,70),scale=1.0,chunkType='spark')
                bs.emitBGDynamics(position=(12.66, 0.03986567039, -2.075),
                                  velocity=(0,0,0),
                                  count=random.randrange(20,70),scale=1.0,chunkType='spark')
                                  
        if scoringTeam.getID() == 0:
                bs.emitBGDynamics(position=(-12.45, 0.05744967453, -2.075),
                                  velocity=(0,0,0),
                                  count=random.randrange(20,70),scale=1.0,chunkType='spark')
                bs.emitBGDynamics(position=(-12.45, 0.05744967453, 2.075),
                                  velocity=(0,0,0),
                                  count=random.randrange(20,70),scale=1.0,chunkType='spark')
    def opt(self, nick, msg):
        if self.checkDevice(nick):
            m = msg.split(' ')[0]  # command
            a = msg.split(' ')[1:]  # arguments

            activity = bsInternal._getForegroundHostActivity()
            with bs.Context(activity):
                if m == '/kick':
                    if a == []:
                        bsInternal._chatMessage(
                            'Using: /kick name or clientID')
                    else:
                        if len(a[0]) > 3:
                            self.kickByNick(a[0])
                            bsInternal._chatMessage('Player Kicked By Admin')
                        else:
                            try:
                                s = int(a[0])
                                bsInternal._chatMessage(
                                    'Player Kicked By Admin')
                                bsInternal._disconnectClient(int(a[0]))
                            except:
                                self.kickByNick(a[0])
                elif m == '/admin':
                    clID = int(a[0])
                    for client in bsInternal._getGameRoster():
                        if client['clientID'] == clID:
                            if a[1] == 'add':
                                newadmin = client['displayString']
                                updated_admins = gph.adminHashes.append(
                                    newadmin)
                            elif a[1] == 'remove':
                                newadmin = client['displayString']
                                if newadmin in gph.adminHashes:
                                    updated_admins = gph.adminHashes.remove(
                                        newadmin)

                    with open(bs.getEnvironment()['systemScriptsDirectory'] +
                              "/getPermissionsHashes.py") as file:
                        s = [row for row in file]
                        s[0] = 'vipHashes = []' + '\n'
                        s[1] = 'adminHashes = ' + updated_admins + '\n'
                        f = open(
                            bs.getEnvironment()['systemScriptsDirectory'] +
                            "/getPermissionsHashes.py", 'w')
                        for i in s:
                            f.write(i)
                        f.close()
                elif m == '/ban':
                    clID = int(a[0])
                    for client in bsInternal._getGameRoster():
                        if client['clientID'] == clID:
                            if a[1] == 'add':
                                ban = client['displayString']
                                updated_ban = gph.ban.append(ban)
                                bs.screenMessage('Banning...')
                            elif a[1] == 'remove':
                                ban = client['displayString']
                                if ban in gph.ban:
                                    updated_ban = gph.ban.remove(ban)

                    with open(bs.getEnvironment()['systemScriptsDirectory'] +
                              "/getPermissionsHashes.py") as file:
                        s = [row for row in file]
                        s[0] = 'vipHashes = []' + '\n'
                        s[1] = 'admin = []' + '\n'
                        s[2] = 'ass = []' + '\n'
                        s[3] = 'ban = ' + updated_ban + '\n'
                        f = open(
                            bs.getEnvironment()['systemScriptsDirectory'] +
                            "/getPermissionsHashes.py", 'w')
                        for i in s:
                            f.write(i)
                        f.close()
                elif m == '/ass':
                    clID = int(a[0])
                    for client in bsInternal._getGameRoster():
                        if client['clientID'] == clID:
                            if a[1] == 'add':
                                ass = client['displayString']
                                updated_ass = gph.ass.append(ass)
                            elif a[1] == 'remove':
                                ass = client['displayString']
                                if ass in gph.ass:
                                    updated_ass = gph.ass.remove(ass)

                    with open(bs.getEnvironment()['systemScriptsDirectory'] +
                              "/getPermissionsHashes.py") as file:
                        s = [row for row in file]
                        s[0] = 'vipHashes = []' + '\n'
                        s[1] = 'admin= []' + '\n'
                        s[2] = 'ass = ' + updated_admins + '\n'
                        f = open(
                            bs.getEnvironment()['systemScriptsDirectory'] +
                            "/getPermissionsHashes.py", 'w')
                        for i in s:
                            f.write(i)
                        f.close()
                elif m == '/vip':
                    clID = int(a[0])
                    for client in bsInternal._getGameRoster():
                        if client['clientID'] == clID:
                            if a[1] == 'add':
                                vip = client['displayString']
                                updated_vip = gph.vip.append(vip)
                            elif a[1] == 'remove':
                                vip = client['displayString']
                                if vip in gph.vip:
                                    updated_vip = gph.vip.remove(vip)

                    with open(bs.getEnvironment()['systemScriptsDirectory'] +
                              "/getPermissionsHashes.py") as file:
                        s = [row for row in file]
                        s[0] = 'vip = ' + updated_admins + '\n'
                        f = open(
                            bs.getEnvironment()['systemScriptsDirectory'] +
                            "/getPermissionsHashes.py", 'w')
                        for i in s:
                            f.write(i)
                        f.close()

                elif m == '/list':
                    bsInternal._chatMessage(
                        "======== FOR /kick ONLY: ========")
                    for i in bsInternal._getGameRoster():
                        try:
                            bsInternal._chatMessage(
                                i['players'][0]['nameFull'] + "     (/kick " +
                                str(i['clientID']) + ")")
                        except:
                            pass
                    bsInternal._chatMessage(
                        "==================================")
                    bsInternal._chatMessage(
                        "======= For other commands: =======")
                    for s in bsInternal._getForegroundHostSession().players:
                        bsInternal._chatMessage(
                            s.getName() +
                            "     " + str(bsInternal._getForegroundHostSession(
                            ).players.index(s)))
                elif m == '/ooh':
                    if a is not None and len(a) > 0:
                        s = int(a[0])

                        def oohRecurce(c):
                            bs.playSound(bs.getSound('ooh'), volume=2)
                            c -= 1
                            if c > 0:
                                bs.gameTimer(
                                    int(a[1]) if len(a) > 1
                                    and a[1] is not None else 1000,
                                    bs.Call(oohRecurce, c=c))

                        oohRecurce(c=s)
                    else:
                        bs.playSound(bs.getSound('ooh'), volume=2)
                elif m == '/playSound':
                    if a is not None and len(a) > 1:
                        s = int(a[1])

                        def oohRecurce(c):
                            bs.playSound(bs.getSound(str(a[0])), volume=2)
                            c -= 1
                            if c > 0:
                                bs.gameTimer(
                                    int(a[2]) if len(a) > 2
                                    and a[2] is not None else 1000,
                                    bs.Call(oohRecurce, c=c))

                        oohRecurce(c=s)
                    else:
                        bs.playSound(bs.getSound(str(a[0])), volume=2)
                elif m == '/quit':
                    bsInternal.quit()
                elif m == '/nv':
                    if self.tint is None:
                        self.tint = bs.getSharedObject('globals').tint
                    bs.getSharedObject('globals').tint = (
                        0.5, 0.7,
                        1) if a == [] or not a[0] == u'off' else self.tint
                elif m == '/freeze':
                    if a == []:
                        bsInternal._chatMessage(
                            'Using: /freeze all or number of list')
                    else:
                        if a[0] == 'all':
                            for i in bs.getSession().players:
                                try:
                                    i.actor.node.handleMessage(
                                        bs.FreezeMessage())
                                except:
                                    pass
                        else:
                            bs.getSession().players[int(
                                a[0])].actor.node.handleMessage(
                                    bs.FreezeMessage())
                elif m == '/thaw':
                    if a == []:
                        bsInternal._chatMessage(
                            'Using: /thaw all or number of list')
                    else:
                        if a[0] == 'all':
                            for i in bs.getSession().players:
                                try:
                                    i.actor.node.handleMessage(
                                        bs.ThawMessage())
                                except:
                                    pass
                        else:
                            bs.getSession().players[int(
                                a[0])].actor.node.handleMessage(
                                    bs.ThawMessage())
                elif m == '/sleep':
                    if a == []:
                        bsInternal._chatMessage('Using: number of list')
                    else:
                        if a[0] == 'all':
                            for i in bs.getSession().players:
                                try:
                                    i.actor.node.handleMessage(
                                        "knockout", 5000)
                                except:
                                    pass
                        else:
                            bs.getSession().players[int(
                                a[0])].actor.node.handleMessage(
                                    "knockout", 5000)

                elif m == '/kill':
                    if a == []:
                        bsInternal._chatMessage(
                            'Using: /kill all or number of list')
                    else:
                        if a[0] == 'all':
                            for i in bs.getSession().players:
                                try:
                                    i.actor.node.handleMessage(bs.DieMessage())
                                except:
                                    pass
                        else:
                            bs.getSession().players[int(
                                a[0])].actor.node.handleMessage(
                                    bs.DieMessage())
                elif m == '/curse':
                    if a == []:
                        bsInternal._chatMessage(
                            'Using: /curse all or number of list')
                    else:
                        if a[0] == 'all':
                            for i in bs.getSession().players:
                                try:
                                    i.actor.curse()
                                except:
                                    pass
                        else:
                            bs.getSession().players[int(a[0])].actor.curse()
                elif m == '/box':
                    if a == []:
                        bsInternal._chatMessage(
                            'Using: /box all or number of list')
                    else:
                        try:
                            if a[0] == 'all':
                                for i in bs.getSession().players:
                                    try:
                                        i.actor.node.torsoModel = bs.getModel(
                                            "tnt")
                                    except:
                                        print 'error'
                                for i in bs.getSession().players:
                                    try:
                                        i.actor.node.colorMaskTexture = bs.getTexture(
                                            "tnt")
                                    except:
                                        print 'error'
                                for i in bs.getSession().players:
                                    try:
                                        i.actor.node.colorTexture = bs.getTexture(
                                            "tnt")
                                    except:
                                        print 'error'
                                for i in bs.getSession().players:
                                    try:
                                        i.actor.node.highlight = (1, 1, 1)
                                    except:
                                        print 'error'
                                for i in bs.getSession().players:
                                    try:
                                        i.actor.node.color = (1, 1, 1)
                                    except:
                                        print 'error'
                                for i in bs.getSession().players:
                                    try:
                                        i.actor.node.headModel = None
                                    except:
                                        print 'error'
                                for i in bs.getSession().players:
                                    try:
                                        i.actor.node.style = "cyborg"
                                    except:
                                        print 'error'
                            else:
                                n = int(a[0])
                                bs.getSession().players[
                                    n].actor.node.torsoModel = bs.getModel(
                                        "tnt")
                                bs.getSession().players[
                                    n].actor.node.colorMaskTexture = bs.getTexture(
                                        "tnt")
                                bs.getSession().players[
                                    n].actor.node.colorTexture = bs.getTexture(
                                        "tnt")
                                bs.getSession(
                                ).players[n].actor.node.highlight = (1, 1, 1)
                                bs.getSession().players[n].actor.node.color = (
                                    1, 1, 1)
                                bs.getSession(
                                ).players[n].actor.node.headModel = None
                                bs.getSession(
                                ).players[n].actor.node.style = "cyborg"
                        except:
                            bs.screenMessage('Ошибка!', color=(1, 0, 0))
                elif m == '/spaz':
                    if a == []:
                        bsInternal._chatMessage(
                            'Using: /spaz all or number of list')
                    else:
                        try:
                            if a[0] == 'all':
                                for i in bs.getSession().players:
                                    t = i.actor.node
                                    try:

                                        t.colorTexture = bs.getTexture(a[1] +
                                                                       "Color")
                                        t.colorMaskTexture = bs.getTexture(
                                            a[1] + "ColorMask")

                                        t.headModel = bs.getModel(a[1] +
                                                                  "Head")
                                        t.torsoModel = bs.getModel(a[1] +
                                                                   "Torso")
                                        t.pelvisModel = bs.getModel(a[1] +
                                                                    "Pelvis")
                                        t.upperArmModel = bs.getModel(
                                            a[1] + "UpperArm")
                                        t.foreArmModel = bs.getModel(a[1] +
                                                                     "ForeArm")
                                        t.handModel = bs.getModel(a[1] +
                                                                  "Hand")
                                        t.upperLegModel = bs.getModel(
                                            a[1] + "UpperLeg")
                                        t.lowerLegModel = bs.getModel(
                                            a[1] + "LowerLeg")
                                        t.toesModel = bs.getModel(a[1] +
                                                                  "Toes")
                                        t.style = a[1]
                                    except:
                                        print 'error'
                            else:
                                n = int(a[0])
                                t = bs.getSession().players[n].actor.node
                                t.colorTexture = bs.getTexture(a[1] + "Color")
                                t.colorMaskTexture = bs.getTexture(a[1] +
                                                                   "ColorMask")

                                t.headModel = bs.getModel(a[1] + "Head")
                                t.torsoModel = bs.getModel(a[1] + "Torso")
                                t.pelvisModel = bs.getModel(a[1] + "Pelvis")
                                t.upperArmModel = bs.getModel(a[1] +
                                                              "UpperArm")
                                t.foreArmModel = bs.getModel(a[1] + "ForeArm")
                                t.handModel = bs.getModel(a[1] + "Hand")
                                t.upperLegModel = bs.getModel(a[1] +
                                                              "UpperLeg")
                                t.lowerLegModel = bs.getModel(a[1] +
                                                              "LowerLeg")
                                t.toesModel = bs.getModel(a[1] + "Toes")
                                t.style = a[1]
                        except:
                            bs.screenMessage('error', color=(1, 0, 0))
                elif m == '/inv':
                    if a == []:
                        bsInternal._chatMessage(
                            'Using: /spaz all or number of list')
                    else:
                        try:
                            if a[0] == 'all':
                                for i in bs.getSession().players:
                                    t = i.actor.node
                                    try:

                                        t.headModel = None
                                        t.torsoModel = None
                                        t.pelvisModel = None
                                        t.upperArmModel = None
                                        t.foreArmModel = None
                                        t.handModel = None
                                        t.upperLegModel = None
                                        t.lowerLegModel = None
                                        t.toesModel = None
                                        t.style = "cyborg"
                                    except:
                                        print 'error'
                            else:
                                n = int(a[0])
                                t = bs.getSession().players[n].actor.node

                                t.headModel = None
                                t.torsoModel = None
                                t.pelvisModel = None
                                t.upperArmModel = None
                                t.foreArmModel = None
                                t.handModel = None
                                t.upperLegModel = None
                                t.lowerLegModel = None
                                t.toesModel = None
                                t.style = "cyborg"
                        except:
                            bs.screenMessage('error', color=(1, 0, 0))

                elif m == '/tex':
                    if a == []:
                        bsInternal._chatMessage(
                            'Using: /tex all or number of list')
                    else:
                        try:
                            if a[0] == 'all':
                                for i in bs.getSession().players:
                                    try:
                                        i.actor.node.colorMaskTexture = bs.getTexture(
                                            "egg1")
                                    except:
                                        print 'error'
                                for i in bs.getSession().players:
                                    try:
                                        i.actor.node.colorTexture = bs.getTexture(
                                            "egg1")
                                    except:
                                        print 'error'
                            else:
                                n = int(a[0])
                                bs.getSession().players[
                                    n].actor.node.colorMaskTexture = bs.getTexture(
                                        "egg1")
                                bs.getSession().players[
                                    n].actor.node.colorTexture = bs.getTexture(
                                        "egg1")
                        except:
                            bs.screenMessage('Ошибка!', color=(1, 0, 0))

                elif m == '/remove':
                    if a == []:
                        bsInternal._chatMessage(
                            'Using: /remove all or number of list')
                    else:
                        if a[0] == 'all':
                            for i in bs.getSession().players:
                                try:
                                    i.removeFromGame()
                                except:
                                    pass
                        else:
                            bs.getSession().players[int(a[0])].removeFromGame()
                elif m == '/end':
                    try:
                        bsInternal._getForegroundHostActivity().endGame()
                    except:
                        pass
                elif m == '/hug':
                    if a == []:
                        bsInternal._chatMessage(
                            'Using: /hug all or number of list')
                    else:
                        try:
                            if a[0] == 'all':
                                try:
                                    bsInternal._getForegroundHostActivity(
                                    ).players[
                                        0].actor.node.holdNode = bsInternal._getForegroundHostActivity(
                                        ).players[1].actor.node
                                except:
                                    pass
                                try:
                                    bsInternal._getForegroundHostActivity(
                                    ).players[
                                        1].actor.node.holdNode = bsInternal._getForegroundHostActivity(
                                        ).players[0].actor.node
                                except:
                                    pass
                                try:
                                    bsInternal._getForegroundHostActivity(
                                    ).players[
                                        3].actor.node.holdNode = bsInternal._getForegroundHostActivity(
                                        ).players[2].actor.node
                                except:
                                    pass
                                try:
                                    bsInternal._getForegroundHostActivity(
                                    ).players[
                                        4].actor.node.holdNode = bsInternal._getForegroundHostActivity(
                                        ).players[3].actor.node
                                except:
                                    pass
                                try:
                                    bsInternal._getForegroundHostActivity(
                                    ).players[
                                        5].actor.node.holdNode = bsInternal._getForegroundHostActivity(
                                        ).players[6].actor.node
                                except:
                                    pass
                                try:
                                    bsInternal._getForegroundHostActivity(
                                    ).players[
                                        6].actor.node.holdNode = bsInternal._getForegroundHostActivity(
                                        ).players[7].actor.node
                                except:
                                    pass
                            else:
                                bsInternal._getForegroundHostActivity(
                                ).players[int(
                                    a[0]
                                )].actor.node.holdNode = bsInternal._getForegroundHostActivity(
                                ).players[int(a[1])].actor.node
                        except:
                            bs.screenMessage('Ошибка!', color=(1, 0, 0))
                elif m == '/gm':
                    if a == []:
                        for i in range(len(activity.players)):
                            if activity.players[i].getName().encode(
                                    'utf-8').find(
                                        nick.encode('utf-8').replace(
                                            '...', '').replace(':', '')) != -1:
                                activity.players[
                                    i].actor.node.hockey = activity.players[
                                        i].actor.node.hockey == False
                                activity.players[
                                    i].actor.node.invincible = activity.players[
                                        i].actor.node.invincible == False
                                activity.players[
                                    i].actor._punchPowerScale = 5 if activity.players[
                                        i].actor._punchPowerScale == 1.2 else 1.2
                    else:
                        activity.players[int(
                            a[0])].actor.node.hockey = activity.players[int(
                                a[0])].actor.node.hockey == False
                        activity.players[int(
                            a[0])].actor.node.invincible = activity.players[
                                int(a[0])].actor.node.invincible == False
                        activity.players[int(
                            a[0]
                        )].actor._punchPowerScale = 5 if activity.players[int(
                            a[0])].actor._punchPowerScale == 1.2 else 1.2
                elif m == '/tint':
                    if a == []:
                        bsInternal._chatMessage('Using: /tint R G B')
                        bsInternal._chatMessage('OR')
                        bsInternal._chatMessage('Using: /tint r bright speed')
                    else:
                        if a[0] == 'r':
                            m = 1.3 if a[1] is None else float(a[1])
                            s = 1000 if a[2] is None else float(a[2])
                            bsUtils.animateArray(
                                bs.getSharedObject('globals'), 'tint', 3, {
                                    0: (1 * m, 0, 0),
                                    s: (0, 1 * m, 0),
                                    s * 2: (0, 0, 1 * m),
                                    s * 3: (1 * m, 0, 0)
                                }, True)
                        else:
                            try:
                                if a[1] is not None:
                                    bs.getSharedObject('globals').tint = (
                                        float(a[0]), float(a[1]), float(a[2]))
                                else:
                                    bs.screenMessage('Error!', color=(1, 0, 0))
                            except:
                                bs.screenMessage('Error!', color=(1, 0, 0))
                elif m == 'pause':
                    bs.getSharedObject('globals').paused = bs.getSharedObject(
                        'globals').paused == False
                elif m == '/sm':
                    bs.getSharedObject(
                        'globals').slowMotion = bs.getSharedObject(
                            'globals').slowMotion == False
                elif m == '/bunny':
                    if a == []:
                        bsInternal._chatMessage(
                            'Using: /bunny count owner(number of list)')
                    import BuddyBunny
                    for i in range(int(a[0])):
                        p = bs.getSession().players[int(a[1])]
                        if not 'bunnies' in p.gameData:
                            p.gameData['bunnies'] = BuddyBunny.BunnyBotSet(p)
                        p.gameData['bunnies'].doBunny()
                elif m == '/cameraMode':
                    try:
                        if bs.getSharedObject(
                                'globals').cameraMode == 'follow':
                            bs.getSharedObject('globals').cameraMode = 'rotate'
                        else:
                            bs.getSharedObject('globals').cameraMode = 'follow'
                    except:
                        pass
                elif m == '/lm':
                    arr = []
                    for i in range(100):
                        try:
                            arr.append(bsInternal._getChatMessages()[-1 - i])
                        except:
                            pass
                    arr.reverse()
                    for i in arr:
                        bsInternal._chatMessage(i)
                elif m == '/gp':
                    if a == []:
                        bsInternal._chatMessage('Using: /gp number of list')
                    else:
                        s = bsInternal._getForegroundHostSession()
                        for i in s.players[int(
                                a[0])].getInputDevice()._getPlayerProfiles():
                            try:
                                bsInternal._chatMessage(i)
                            except:
                                pass
                elif m == '/icy':
                    bsInternal._getForegroundHostActivity().players[int(
                        a[0]
                    )].actor.node = bsInternal._getForegroundHostActivity(
                    ).players[int(a[1])].actor.node
                elif m == '/fly':
                    if a == []:
                        bsInternal._chatMessage(
                            'Using: /fly all or number of list')
                    else:
                        if a[0] == 'all':
                            for i in bsInternal._getForegroundHostActivity(
                            ).players:
                                i.actor.node.fly = True
                        else:
                            bsInternal._getForegroundHostActivity(
                            ).players[int(
                                a[0]
                            )].actor.node.fly = bsInternal._getForegroundHostActivity(
                            ).players[int(a[0])].actor.node.fly == False
                elif m == '/floorReflection':
                    bs.getSharedObject(
                        'globals').floorReflection = bs.getSharedObject(
                            'globals').floorReflection == False
                elif m == '/ac':
                    if a == []:
                        bsInternal._chatMessage('Using: /ac R G B')
                        bsInternal._chatMessage('OR')
                        bsInternal._chatMessage('Using: /ac r bright speed')
                    else:
                        if a[0] == 'r':
                            m = 1.3 if a[1] is None else float(a[1])
                            s = 1000 if a[2] is None else float(a[2])
                            bsUtils.animateArray(
                                bs.getSharedObject('globals'), 'ambientColor',
                                3, {
                                    0: (1 * m, 0, 0),
                                    s: (0, 1 * m, 0),
                                    s * 2: (0, 0, 1 * m),
                                    s * 3: (1 * m, 0, 0)
                                }, True)
                        else:
                            try:
                                if a[1] is not None:
                                    bs.getSharedObject(
                                        'globals').ambientColor = (float(a[0]),
                                                                   float(a[1]),
                                                                   float(a[2]))
                                else:
                                    bs.screenMessage('Error!', color=(1, 0, 0))
                            except:
                                bs.screenMessage('Error!', color=(1, 0, 0))
                elif m == '/iceOff':
                    try:
                        activity.getMap().node.materials = [
                            bs.getSharedObject('footingMaterial')
                        ]
                        activity.getMap().isHockey = False
                    except:
                        pass
                    try:
                        activity.getMap().floor.materials = [
                            bs.getSharedObject('footingMaterial')
                        ]
                        activity.getMap().isHockey = False
                    except:
                        pass
                    for i in activity.players:
                        i.actor.node.hockey = False
                elif m == '/maxPlayers':
                    if a == []:
                        bsInternal._chatMessage(
                            'Using: /maxPlayers count of players')
                    else:
                        try:
                            bsInternal._getForegroundHostSession(
                            )._maxPlayers = int(a[0])
                            bsInternal._setPublicPartyMaxSize(int(a[0]))
                            bsInternal._chatMessage('Players limit set to ' +
                                                    str(int(a[0])))
                        except:
                            bs.screenMessage('Error!', color=(1, 0, 0))
                elif m == '/heal':
                    if a == []:
                        bsInternal._chatMessage(
                            'Using: /heal all or number of list')
                    else:
                        try:
                            bsInternal._getForegroundHostActivity().players[
                                int(a[0])].actor.node.handleMessage(
                                    bs.PowerupMessage(powerupType='health'))
                        except:
                            bs.screenMessage('Error!', color=(1, 0, 0))
                elif m == '/reflections':
                    if a == [] or len(a) < 2:
                        bsInternal._chatMessage(
                            'Using: /reflections type(1/0) scale')
                    rs = [int(a[1])]
                    type = 'soft' if int(a[0]) == 0 else 'powerup'
                    try:
                        bsInternal._getForegroundHostActivity().getMap(
                        ).node.reflection = type
                        bsInternal._getForegroundHostActivity().getMap(
                        ).node.reflectionScale = rs
                    except:
                        pass
                    try:
                        bsInternal._getForegroundHostActivity().getMap(
                        ).bg.reflection = type
                        bsInternal._getForegroundHostActivity().getMap(
                        ).bg.reflectionScale = rs
                    except:
                        pass
                    try:
                        bsInternal._getForegroundHostActivity().getMap(
                        ).floor.reflection = type
                        bsInternal._getForegroundHostActivity().getMap(
                        ).floor.reflectionScale = rs
                    except:
                        pass
                    try:
                        bsInternal._getForegroundHostActivity().getMap(
                        ).center.reflection = type
                        bsInternal._getForegroundHostActivity().getMap(
                        ).center.reflectionScale = rs
                    except:
                        pass
                elif m == '/shatter':
                    if a == []:
                        bsInternal._chatMessage(
                            'Using: /shatter all or number of list')
                    else:
                        if a[0] == 'all':
                            for i in bsInternal._getForegroundHostActivity(
                            ).players:
                                i.actor.node.shattered = int(a[1])
                        else:
                            bsInternal._getForegroundHostActivity().players[
                                int(a[0])].actor.node.shattered = int(a[1])
                elif m == '/cm':
                    if a == []:
                        time = 8000
                    else:
                        time = int(a[0])

                        op = 0.08
                        std = bs.getSharedObject('globals').vignetteOuter
                        bsUtils.animateArray(
                            bs.getSharedObject('globals'), 'vignetteOuter', 3,
                            {
                                0: bs.getSharedObject('globals').vignetteOuter,
                                17000: (0, 1, 0)
                            })

                    try:
                        bsInternal._getForegroundHostActivity().getMap(
                        ).node.opacity = op
                    except:
                        pass
                    try:
                        bsInternal._getForegroundHostActivity().getMap(
                        ).bg.opacity = op
                    except:
                        pass
                    try:
                        bsInternal._getForegroundHostActivity().getMap(
                        ).bg.node.opacity = op
                    except:
                        pass
                    try:
                        bsInternal._getForegroundHostActivity().getMap(
                        ).node1.opacity = op
                    except:
                        pass
                    try:
                        bsInternal._getForegroundHostActivity().getMap(
                        ).node2.opacity = op
                    except:
                        pass
                    try:
                        bsInternal._getForegroundHostActivity().getMap(
                        ).node3.opacity = op
                    except:
                        pass
                    try:
                        bsInternal._getForegroundHostActivity().getMap(
                        ).steps.opacity = op
                    except:
                        pass
                    try:
                        bsInternal._getForegroundHostActivity().getMap(
                        ).floor.opacity = op
                    except:
                        pass
                    try:
                        bsInternal._getForegroundHostActivity().getMap(
                        ).center.opacity = op
                    except:
                        pass

                    def off():
                        op = 1
                        try:
                            bsInternal._getForegroundHostActivity().getMap(
                            ).node.opacity = op
                        except:
                            pass
                        try:
                            bsInternal._getForegroundHostActivity().getMap(
                            ).bg.opacity = op
                        except:
                            pass
                        try:
                            bsInternal._getForegroundHostActivity().getMap(
                            ).bg.node.opacity = op
                        except:
                            pass
                        try:
                            bsInternal._getForegroundHostActivity().getMap(
                            ).node1.opacity = op
                        except:
                            pass
                        try:
                            bsInternal._getForegroundHostActivity().getMap(
                            ).node2.opacity = op
                        except:
                            pass
                        try:
                            bsInternal._getForegroundHostActivity().getMap(
                            ).node3.opacity = op
                        except:
                            pass
                        try:
                            bsInternal._getForegroundHostActivity().getMap(
                            ).steps.opacity = op
                        except:
                            pass
                        try:
                            bsInternal._getForegroundHostActivity().getMap(
                            ).floor.opacity = op
                        except:
                            pass
                        try:
                            bsInternal._getForegroundHostActivity().getMap(
                            ).center.opacity = op
                        except:
                            pass
                        bsUtils.animateArray(
                            bs.getSharedObject('globals'), 'vignetteOuter', 3,
                            {
                                0: bs.getSharedObject('globals').vignetteOuter,
                                100: std
                            })

                    bs.gameTimer(time, bs.Call(off))

                elif m == 'help':
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help1').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help2').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help3').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help4').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help5').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help6').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help7').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help8').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help9').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help10').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help11').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help12').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help13').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help14').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help15').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help16').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help17').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help18').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help19').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help20').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help21').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help22').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help23').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help24').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help25').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help26').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help27').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help28').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help29').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help30').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help31').evaluate())
                    bsInternal._chatMessage(
                        bs.Lstr(resource='help32').evaluate())
Esempio n. 10
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)