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

        if isinstance(m, 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(m, _TouchedMessage):
            if not self._powersGiven and not self.picked:
                node = bs.getCollisionInfo("opposingNode")
                if node is not None and node.exists():
                    node.handleMessage(
                        PowerupMessage(self.powerupType, sourceNode=self.node))

        elif isinstance(m, bs.DieMessage):
            if self.node.exists():
                if (m.immediate):
                    self.node.delete()
                else:
                    curve = bs.animate(self.node, "modelScale", {0: 1, 100: 0})
                    if some.show_powerup_name: curve1 = bs.animate(self._powText, "scale", {
                        0: 0.01,
                        100: 0
                    })
                    if hasattr(self, 'nodeLight'):
                        curve2 = bs.animate(self.nodeLight, "radius", {
                            0: 0.5,
                            100: 0
                        })
                    bs.gameTimer(100, self.node.delete)

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

        elif isinstance(m, bs.PickedUpMessage):
            self.picked = True

        elif isinstance(m, bs.DroppedMessage):
            self.picked = False

        elif isinstance(m, bs.HitMessage):
            # dont die on punches (thats annoying)
            msg = m
            if some.interactive_powerups:
	            self.node.handleMessage("impulse", msg.pos[0], msg.pos[1],
	                                    msg.pos[2], msg.velocity[0],
	                                    msg.velocity[1], msg.velocity[2],
	                                    msg.magnitude, msg.velocityMagnitude,
	                                    msg.radius, 0, msg.velocity[0],
	                                    msg.velocity[1], msg.velocity[2])
            if m.hitType != 'punch':
                self.handleMessage(bs.DieMessage())
        else:
            bs.Actor.handleMessage(self, m)
Ejemplo n.º 2
0
    def handleMessage(self, m):
        self._handleMessageSanityCheck()

        if isinstance(m, 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(m, _TouchedMessage):
            if not self._powersGiven:
                node = bs.getCollisionInfo("opposingNode")
                if node is not None and node.exists():
                    # We won't tell the spaz about the bunny.  It'll just happen.
                    if self.powerupType == 'bunny':
                        p = node.getDelegate().getPlayer()
                        if not 'bunnies' in p.gameData:
                            p.gameData['bunnies'] = BuddyBunny.BunnyBotSet(p)
                        p.gameData['bunnies'].doBunny()
                        self._powersGiven = True
                        self.handleMessage(bs.DieMessage())
                    # a Spaz doesn't know what to do with a snoball powerup. All the snowball functionality
                    # is handled through SnoBallz.py to minimize modifications to the original game files
                    elif self.powerupType == 'snoball':
                        spaz = node.getDelegate()
                        SnoBallz.snoBall().getFactory().giveBallz(spaz)
                        self._powersGiven = True
                        self.handleMessage(bs.DieMessage())
                    elif self.powerupType == 'randomDoor':
                        spaz = node.getDelegate()
                        random_door.randomDoor().getFactory().giveRD(spaz)
                        self._powersGiven = True
                        self.handleMessage(bs.DieMessage())
                    else:
                        node.handleMessage(
                            PowerupMessage(self.powerupType,
                                           sourceNode=self.node))

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

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

        elif isinstance(m, bs.HitMessage):
            # dont die on punches (thats annoying)
            if m.hitType != 'punch':
                self.handleMessage(bs.DieMessage())
        else:
            bs.Actor.handleMessage(self, m)
Ejemplo n.º 3
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())

            if self.powerupType == 'blast':
                radius = random.choice([0.5, 1.0, 1.5, 2.0])
                type = random.choice(['ice', 'normal', 'sticky', 'tnt'])
                pos = self.node.position
                bs.Blast(position=pos, blastRadius=radius,
                         blastType=type).autoRetain()
                self._blast = True
                if self._blast == True:
                    if type == 'ice':
                        bs.screenMessage("Type: Ice", color=(3.5, 0, 0))
                    if type == 'normal':
                        bs.screenMessage("Type: Normal", color=(3.5, 0, 0))
                    if type == 'sticky':
                        bs.screenMessage("Type: Sticky", color=(3.5, 0, 0))
                    if type == 'tnt':
                        bs.screenMessage("Type: Tnt", color=(3.5, 0, 0))
                    if radius == 0.5:
                        bs.screenMessage("Radius: 0.5", color=(0, 0, 3.5))
                    if radius == 1.0:
                        bs.screenMessage("Radius: 1.0", color=(0, 0, 3.5))
                    if radius == 1.5:
                        bs.screenMessage("Radius: 1.5", color=(0, 0, 3.5))
                    if radius == 2.0:
                        bs.screenMessage("Radius: 2.0", color=(0, 0, 3.5))

            if self.powerupType == 'mix':
                pow = random.choice([
                    'tripleBombs', 'iceBombs', 'punch', 'impactBombs',
                    'landMines', 'stickyBombs', 'shield', 'health', 'curse'
                ])
                pos = self.node.position
                bs.Powerup(position=pos, powerupType=pow).autoRetain()
                bs.emitBGDynamics(position=self.node.position,
                                  velocity=self.node.velocity,
                                  count=int(14.0 + random.random() * 70),
                                  scale=1.4,
                                  spread=3.5,
                                  chunkType='spark')
                self._mix = True
                if self._mix == True:
                    if pow == 'tripleBombs':
                        bs.screenMessage("Triple Bombs", color=(1, 1, 0))
                    if pow == 'iceBombs':
                        bs.screenMessage("Ice Bombs", color=(0, 0.2, 1))
                    if pow == 'punch':
                        bs.screenMessage("Boxing Gloves", color=(1, 0.3, 0.3))
                    if pow == 'impactBombs':
                        bs.screenMessage("Impact Bombs", color=(0.3, 0.3, 0.3))
                    if pow == 'landMines':
                        bs.screenMessage("Land Mines", color=(0.1, 0.7, 0))
                    if pow == 'stickyBombs':
                        bs.screenMessage("Sticky Bombs", color=(0, 1, 0))
                    if pow == 'shield':
                        bs.screenMessage("Energy Shield", color=(0.7, 0.5, 1))
                    if pow == 'health':
                        bs.screenMessage("Health Kit", color=(1, 1, 1))
                    if pow == 'curse':
                        bs.screenMessage("Curse", color=(0.1, 0.1, 0.1))
                    self._light = True
                if self._light == True:
                    color = random.choice([(5.0, 0.2, 0.2), (0.2, 5.0, 0.2),
                                           (0.2, 0.2, 5.0)])
                    self.light = bs.newNode('light',
                                            attrs={
                                                'position': self.node.position,
                                                'color': color,
                                                'volumeIntensityScale': 0.35
                                            })
                    bs.animate(self.light,
                               'intensity', {
                                   0: 0,
                                   70: 0.5,
                                   350: 0
                               },
                               loop=False)
                    bs.gameTimer(500, self.light.delete)

        elif isinstance(msg, _TouchedMessage):
            if not self._powersGiven:
                node = bs.getCollisionInfo("opposingNode")
                if node is not None and node.exists():
                    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':
                self.handleMessage(bs.DieMessage())
        else:
            bs.Actor.handleMessage(self, msg)
Ejemplo n.º 4
0
    def handleMessage(self, m):
        self._handleMessageSanityCheck()

        if isinstance(m, 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(m, _TouchedMessage):
            if not self._powersGiven:
                node = bs.getCollisionInfo("opposingNode")
                if node is not None and node.exists():
                    #We won't tell the spaz about the bunny.  It'll just happen.
                    if self.powerupType == 'bunny':
                        p = node.getDelegate().getPlayer()
                        if 'bunnies' not in p.gameData:
                            p.gameData['bunnies'] = BuddyBunny.BunnyBotSet(p)
                        p.gameData['bunnies'].doBunny()
                        self._powersGiven = True
                        self.handleMessage(bs.DieMessage())
                    #a Spaz doesn't know what to do with a snoball powerup. All the snowball functionality
                    #is handled through SnoBallz.py to minimize modifications to the original game files
                    elif self.powerupType == 'snoball':
                        spaz = node.getDelegate()
                        SnoBallz.snoBall().getFactory().giveBallz(spaz)
                        self._powersGiven = True
                        self.handleMessage(bs.DieMessage())
                    elif self.powerupType == 'portal':
                        t = bsSpaz.gPowerupWearOffTime
                        if Portal.currentnum < Portal.maxportals:
                            Portal.currentnum += 1
                            if self.node.position in Portal.lastpos:
                                self.port = Portal.Portal(
                                    position1=None,
                                    r=0.9,
                                    color=(random.random(), random.random(),
                                           random.random()),
                                    activity=bs.getActivity())
                                bs.gameTimer(t, bs.Call(self.delpor))
                            else:
                                m = self.node.position
                                Portal.lastpos.append(m)
                                self.port = Portal.Portal(
                                    position1=self.node.position,
                                    r=0.9,
                                    color=(random.random(), random.random(),
                                           random.random()),
                                    activity=bs.getActivity())
                                bs.gameTimer(t, bs.Call(self.delpor))
                        self._powersGiven = True
                        self.handleMessage(bs.DieMessage())
                    else:
                        node.handleMessage(
                            PowerupMessage(self.powerupType,
                                           sourceNode=self.node))

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

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

        elif isinstance(m, bs.HitMessage):
            # dont die on punches (thats annoying)
            if m.hitType != 'punch':
                self.handleMessage(bs.DieMessage())
        else:
            bs.Actor.handleMessage(self, m)
Ejemplo n.º 5
0
    def handleMessage(self, msg):
        self._handleMessageSanityCheck()

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

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

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

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

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

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

        elif isinstance(msg, bs.HitMessage):
            # dont die on punches (thats annoying)
            if msg.hitType != 'punch':
                self.handleMessage(bs.DieMessage())
        else:
            bs.Actor.handleMessage(self, msg)
Ejemplo n.º 6
0
    def handleMessage(self, m):
        self._handleMessageSanityCheck()

        if isinstance(m, 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(m, _TouchedMessage):
            if not self._powersGiven:
                node = bs.getCollisionInfo("opposingNode")
                spaz = node.getDelegate()
                if spaz is not None and spaz.exists() and spaz.isAlive(
                ):  # pass deadbodies error
                    if self.powerupType == 'superStar':
                        tex = bs.Powerup.getFactory().texSuperStar
                        self._flashBillboard(tex, spaz)

                        def colorChanger():
                            if spaz.isAlive():
                                spaz.node.color = (random.random() * 2,
                                                   random.random() * 2,
                                                   random.random() * 2)
                                spaz.node.highlight = (random.random() * 2,
                                                       random.random() * 2,
                                                       random.random() * 2)

                        def checkStar(val):
                            self._powersGiven = True
                            if spaz.isAlive():
                                setattr(spaz.node, 'invincible', val)
                            if val and spaz.isAlive():
                                if spaz.node.frozen:
                                    spaz.node.handleMessage(bs.ThawMessage())
                                bs.playSound(
                                    bs.Powerup.getFactory().superStarSound,
                                    position=spaz.node.position)
                                spaz.colorSet = bs.Timer(100,
                                                         bs.Call(colorChanger),
                                                         repeat=True)
                                if spaz._cursed:
                                    spaz._cursed = False
                                    # remove cursed material
                                    factory = spaz.getFactory()
                                    for attr in [
                                            'materials', 'rollerMaterials'
                                    ]:
                                        materials = getattr(spaz.node, attr)
                                        if factory.curseMaterial in materials:
                                            setattr(
                                                spaz.node, attr,
                                                tuple(m for m in materials
                                                      if m !=
                                                      factory.curseMaterial))
                                    spaz.node.curseDeathTime = 0
                            if not val and spaz.isAlive():
                                spaz.node.color = spaz.getPlayer().color
                                spaz.node.highlight = spaz.getPlayer(
                                ).highlight
                                spaz.colorSet = None
                                bs.playSound(
                                    bs.Powerup.getFactory().powerdownSound,
                                    position=spaz.node.position)
                                spaz.node.billboardOpacity = 0.0

                        checkStar(True)
                        if self._powersGiven == True:
                            spaz.node.miniBillboard1Texture = tex
                            t = bs.getGameTime()
                            spaz.node.miniBillboard1StartTime = t
                            spaz.node.miniBillboard1EndTime = t + gMythBPowerUpsWearOffTime
                            spaz._starWearOffTimer = bs.Timer(
                                gMythBPowerUpsWearOffTime,
                                bs.Call(checkStar, False))
                            spaz._starWearOffFlashTimer = bs.Timer(
                                gMythBPowerUpsWearOffTime - 2000,
                                bs.WeakCall(self._powerUpWearOffFlash, tex,
                                            spaz))
                            self.handleMessage(bs.DieMessage())
                    elif self.powerupType == 'speed':
                        if bs.getActivity(
                        )._map.isHockey:  #dont give speed if map is already hockey.
                            self.handleMessage(bs.DieMessage(immediate=True))
                        if not bs.getActivity()._map.isHockey:
                            spaz = node.getDelegate()
                            tex = bs.Powerup.getFactory().texSpeed
                            self._flashBillboard(tex, spaz)

                            def checkSpeed(val):
                                self._powersGiven = True
                                if spaz.isAlive():
                                    setattr(spaz.node, 'hockey', val)
                                if val and spaz.isAlive():
                                    bs.playSound(
                                        bs.Powerup.getFactory().speedSound,
                                        position=spaz.node.position)
                                if not val and spaz.isAlive():
                                    bs.playSound(
                                        bs.Powerup.getFactory().powerdownSound,
                                        position=spaz.node.position)
                                    spaz.node.billboardOpacity = 0.0

                            checkSpeed(True)
                            if self._powersGiven == True:
                                spaz.node.miniBillboard3Texture = tex
                                t = bs.getGameTime()
                                spaz.node.miniBillboard3StartTime = t
                                spaz.node.miniBillboard3EndTime = t + gMythBPowerUpsWearOffTime
                                spaz._speedWearOffTimer = bs.Timer(
                                    gMythBPowerUpsWearOffTime,
                                    bs.Call(checkSpeed, False))
                                spaz._speedWearOffFlashTimer = bs.Timer(
                                    gMythBPowerUpsWearOffTime - 2000,
                                    bs.WeakCall(self._powerUpWearOffFlash, tex,
                                                spaz))
                                self.handleMessage(bs.DieMessage())
                    elif self.powerupType == 'iceCube':
                        spaz = node.getDelegate()

                        def checkFreezer(val):
                            self._powersGiven = True
                            if spaz.isAlive() and spaz.node.invincible:
                                bs.playSound(
                                    bs.Powerup.getFactory().blockSound,
                                    position=spaz.node.position)
                            if spaz.isAlive() and not spaz.node.invincible:
                                setattr(spaz, 'frozen', val)
                            if val and spaz.isAlive(
                            ) and not spaz.node.invincible:
                                spaz.node.frozen = 1
                                m = bs.newNode('math',
                                               owner=spaz,
                                               attrs={
                                                   'input1': (0, 1.3, 0),
                                                   'operation': 'add'
                                               })
                                spaz.node.connectAttr('torsoPosition', m,
                                                      'input2')
                                opsText = bsUtils.PopupText(
                                    "Oops!",
                                    color=(1, 1, 1),
                                    scale=0.9,
                                    offset=(0, -1, 0)).autoRetain()
                                m.connectAttr('output', opsText.node,
                                              'position')
                                bs.playSound(
                                    bs.Powerup.getFactory().iceCubeSound,
                                    position=spaz.node.position)
                            if not val and spaz.isAlive():
                                spaz.node.frozen = 0

                        checkFreezer(True)
                        if self._powersGiven == True:
                            spaz._iceCubeWearOffTimer = bs.Timer(
                                gMythBPowerUpsWearOffTime,
                                bs.Call(checkFreezer, False))
                            self.handleMessage(bs.DieMessage())
                    elif self.powerupType == 'surprise':
                        self._powersGiven = True
                        spaz = node.getDelegate()
                        if spaz.isAlive():
                            bs.shakeCamera(1)
                            bsUtils.PopupText(
                                "Surprise!",
                                color=(1, 1, 1),
                                scale=0.9,
                                offset=(0, -1, 0),
                                position=(spaz.node.position[0],
                                          spaz.node.position[1] - 1,
                                          spaz.node.position[2])).autoRetain()
                            bs.playSound(bs.Powerup.getFactory().surpriseSound,
                                         position=spaz.node.position)
                            bs.emitBGDynamics(position=spaz.node.position,
                                              velocity=(0, 1, 0),
                                              count=random.randrange(30, 70),
                                              scale=0.5,
                                              chunkType='spark')
                            spaz.node.handleMessage("knockout", 3000)
                            spaz.node.handleMessage(
                                "impulse", spaz.node.position[0],
                                spaz.node.position[1], spaz.node.position[2],
                                -spaz.node.velocity[0], -spaz.node.velocity[1],
                                -spaz.node.velocity[2], 400, 400, 0, 0,
                                -spaz.node.velocity[0], -spaz.node.velocity[1],
                                -spaz.node.velocity[2])
                        if self._powersGiven == True:
                            self.handleMessage(bs.DieMessage())
                    elif self.powerupType == 'martyrdom':
                        spaz = node.getDelegate()
                        tex = bs.Powerup.getFactory().texMartyrdom
                        self._flashBillboard(tex, spaz)

                        def checkDead():  #FIXME
                            if spaz.hitPoints <= 0 and (
                                (spaz.lastPlayerHeldBy is not None
                                 and spaz.lastPlayerHeldBy.exists()) or
                                (spaz.lastPlayerAttackedBy is not None
                                 and spaz.lastPlayerAttackedBy.exists()
                                 and bs.getGameTime() - spaz.lastAttackedTime <
                                 4000)):
                                try:
                                    spaz.lastDeathPos = spaz.node.position  #FIXME
                                except Exception:
                                    spaz.dropss = None
                                else:
                                    if not spaz.lastPlayerAttackedBy == spaz.getPlayer(
                                    ):
                                        dropBomb()
                                        spaz.dropss = None

                        def dropBomb():
                            bs.playSound(
                                bs.Powerup.getFactory().martyrdomSound,
                                position=spaz.lastDeathPos)
                            drop0 = bs.Bomb(
                                position=(spaz.lastDeathPos[0] + 0.43,
                                          spaz.lastDeathPos[1] + 4,
                                          spaz.lastDeathPos[2] - 0.25),
                                velocity=(0, -6, 0),
                                sourcePlayer=spaz.getPlayer(
                                ),  #some math for perfect triangle
                                bombType='sticky').autoRetain()
                            drop1 = bs.Bomb(
                                position=(spaz.lastDeathPos[0] - 0.43,
                                          spaz.lastDeathPos[1] + 4,
                                          spaz.lastDeathPos[2] - 0.25),
                                velocity=(0, -6, 0),
                                sourcePlayer=spaz.getPlayer(),
                                bombType='sticky').autoRetain()
                            drop2 = bs.Bomb(
                                position=(spaz.lastDeathPos[0],
                                          spaz.lastDeathPos[1] + 4,
                                          spaz.lastDeathPos[2] + 0.5),
                                velocity=(0, -6, 0),
                                sourcePlayer=spaz.getPlayer(),
                                bombType='sticky').autoRetain()

                        def checkVal(val):
                            self._powersGiven = True
                            if val and spaz.isAlive():
                                m = bs.newNode('math',
                                               owner=spaz,
                                               attrs={
                                                   'input1': (0, 1.3, 0),
                                                   'operation': 'add'
                                               })
                                spaz.node.connectAttr('torsoPosition', m,
                                                      'input2')
                                activatedText = bsUtils.PopupText(
                                    "ACTIVATED",
                                    color=(1, 1, 1),
                                    scale=0.7,
                                    offset=(0, -1, 0)).autoRetain()
                                m.connectAttr('output', activatedText.node,
                                              'position')
                                bs.playSound(
                                    bs.Powerup.getFactory().martyrdomPickSound,
                                    position=spaz.node.position)
                                spaz.isDropped = True
                                spaz.dropss = bs.Timer(1,
                                                       bs.Call(checkDead),
                                                       repeat=True)

                        checkVal(True)
                        if self._powersGiven == True:
                            self.handleMessage(bs.DieMessage())
                    else:
                        node.handleMessage(
                            PowerupMessage(self.powerupType,
                                           sourceNode=self.node))

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

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

        elif isinstance(m, bs.HitMessage):
            # dont die on punches (thats annoying)
            if m.hitType != 'punch':
                self.handleMessage(bs.DieMessage())
        else:
            bs.Actor.handleMessage(self, m)