Example #1
0
 def setupNameTag(self, tempName=None):
     DistributedToon.setupNameTag(self, tempName)
     self.nametag.setNametagColor(
         NametagGlobals.NametagColors[NametagGlobals.CCLocal])
     self.nametag.unmanage(base.marginManager)
     self.nametag.setActive(0)
     self.nametag.updateAll()
Example #2
0
 def __init__(self, cr):
     try:
         self.LocalToon_initialized
         return
     except:
         self.LocalToon_initialized = 1
     DistributedToon.__init__(self, cr)
     self.avatarChoice = cr.localAvChoice
     self.smartCamera = SmartCamera()
     self.chatInput = ChatInput()
     self.moneyGui = MoneyGui()
     self.pieGui = PieGui(self.pies)
     self.laffMeter = LaffOMeter()
     self.runSfx = base.loadSfx(
         "phase_3.5/audio/sfx/AV_footstep_runloop.ogg")
     self.runSfx.setLoop(True)
     self.walkSfx = base.loadSfx(
         "phase_3.5/audio/sfx/AV_footstep_walkloop.ogg")
     self.walkSfx.setLoop(True)
     self.controlManager = ControlManager.ControlManager(True, False)
     self.offset = 3.2375
     self.movementKeymap = {
         "forward": 0,
         "backward": 0,
         "left": 0,
         "right": 0,
         "jump": 0
     }
     self.avatarMovementEnabled = False
     self.isMoving_forward = False
     self.isMoving_side = False
     self.isMoving_back = False
     self.isMoving_jump = False
     base.cTrav = CollisionTraverser()
Example #3
0
 def announceGenerate(self):
     DistributedToon.announceGenerate(self)
     self.setupControls()
     self.createChatInput()
     self.startLookAround()
     taskMgr.add(self.monitorHealth, "localToon-monitorHealth")
     self.accept("gotLookSpot", self.handleLookSpot)
Example #4
0
 def b_setAnimState(self, anim, callback=None, extraArgs=[]):
     if self.anim != anim:
         self.d_setAnimState(anim)
         DistributedToon.setAnimState(self,
                                      anim,
                                      callback=callback,
                                      extraArgs=extraArgs)
Example #5
0
 def disable(self):
     base.camLens.setMinFov(CIGlobals.OriginalCameraFov / (4. / 3.))
     if self.jumpHardLandIval:
         self.ignore('LT::zend-done')
         self.jumpHardLandIval.finish()
         self.jumpHardLandIval = None
     self.friendsList.destroy()
     self.friendsList = None
     self.panel.cleanup()
     self.panel = None
     self.positionExaminer.delete()
     self.positionExaminer = None
     self.disablePicking()
     self.stopMonitoringHP()
     taskMgr.remove("resetHeadColorAfterFountainPen")
     taskMgr.remove("LT.attackReactionDone")
     self.stopLookAround()
     DistributedToon.disable(self)
     self.disableAvatarControls()
     self.disableLaffMeter()
     self.disableGags()
     self.disableChatInput()
     self.weaponType = None
     self.myBattle = None
     self.ignore("gotLookSpot")
     self.ignore("clickedWhisper")
     self.ignore('f2')
     return
Example #6
0
 def announceGenerate(self):
     DistributedToon.announceGenerate(self)
     self.setupPicker()
     self.setupControls()
     self.startLookAround()
     self.friendRequestManager.watch()
     self.accept('gotLookSpot', self.handleLookSpot)
Example #7
0
    def handleSuitAttack(self, attack_id, suit_id):
        DistributedToon.handleSuitAttack(self, attack_id, suit_id)

        if not self.isDead() and base.config.GetBool('want-sa-reactions'):
            base.taskMgr.remove('LT.attackReactionDone')
            attack = SuitAttacks.SuitAttackLengths.keys()[attack_id]
            suit = self.cr.doId2do.get(suit_id)
            animToPlay = None
            timeToWait = 3.0
            if not attack in ["pickpocket", "fountainpen"]:
                suitH = suit.getH(render) % 360
                myH = self.getH(render) % 360
                if -90.0 <= (suitH - myH) <= 90.0:
                    animToPlay = "fallFWD"
                else:
                    animToPlay = "fallBCK"
            elif attack in ["pickpocket"]:
                animToPlay = "cringe"
            elif attack in ["fountainpen"]:
                animToPlay = "conked"
                timeToWait = 5.0
            self.cr.playGame.getPlace().fsm.request('stop')
            self.b_setAnimState(animToPlay)
            base.taskMgr.doMethodLater(timeToWait, self.__attackReactionDone,
                                       'LT.attackReactionDone')
 def __init__(self, cr):
     DistributedToon.__init__(self, cr)
     self.collisionNodePath = None
     self.cameraTrack = None
     self.originIndex = None
     self.npcId = None
     self.currentChatIndex = 0
     self.chatArray = None
Example #9
0
 def __init__(self, cr):
     DistributedToon.__init__(self, cr)
     self.collisionNodePath = None
     self.cameraTrack = None
     self.originIndex = None
     self.npcId = None
     self.currentChatIndex = 0
     self.chatArray = None
     return
Example #10
0
 def announceGenerate(self):
     DistributedToon.announceGenerate(self)
     self.setupControls()
     self.startLookAround()
     self.friendRequestManager.watch()
     self.accept('gotLookSpot', self.handleLookSpot)
     self.accept('clickedWhisper', self.handleClickedSentWhisper)
     self.accept('f2', self.toggleAspect2d)
     self.invGui = InventoryGui()
Example #11
0
 def setLoadout(self, gagIds):
     DistributedToon.setLoadout(self, gagIds)
     if base.cr.playGame.getPlace() and base.cr.playGame.getPlace(
     ).fsm.getCurrentState().getName() == 'shtickerBook':
         if hasattr(base.cr.playGame.getPlace(), 'shtickerBookStateData'):
             if base.cr.playGame.getPlace(
             ).shtickerBookStateData.fsm.getCurrentState().getName(
             ) == 'inventoryPage':
                 base.cr.playGame.getPlace(
                 ).shtickerBookStateData.gui.fsm.request('idle')
 def announceGenerate(self):
     DistributedToon.announceGenerate(self)
     self.startLookAround()
     self.__setupCollisions()
     npcOrigin = render.find('**/npc_origin_' + str(self.originIndex))
     if not npcOrigin.isEmpty():
         self.reparentTo(npcOrigin)
     else:
         self.startNPCOriginPoll()
     self.acceptCollisions()
Example #13
0
 def disable(self):
     taskMgr.remove("localToon-monitorHealth")
     taskMgr.remove("fallDone")
     DistributedToon.disable(self)
     self.disableAvatarControls()
     self.disableLaffMeter()
     self.disablePies()
     self.disableChatInput()
     self.stopLookAround()
     self.ignore("gotLookSpot")
     return
Example #14
0
 def announceGenerate(self):
     DistributedToon.announceGenerate(self)
     self.startLookAround()
     self.__setupCollisions()
     npcOrigin = render.find('**/npc_origin_' + str(self.originIndex))
     if not npcOrigin.isEmpty():
         self.reparentTo(npcOrigin)
     else:
         self.startNPCOriginPoll()
     self.acceptCollisions()
     self.nameTag.setClickable(0)
 def disable(self):
     self.ignore('mouse1-up')
     self.stopLookAround()
     self.stopNPCOriginPoll()
     self.chatArray = None
     self.originIndex = None
     self.npcId = None
     self.stopCameraTrack()
     self.ignoreCollisions()
     self.__removeCollisions()
     DistributedToon.disable(self)
Example #16
0
 def disable(self):
     self.ignore('mouse1-up')
     self.stopLookAround()
     self.stopNPCOriginPoll()
     self.chatArray = None
     self.originIndex = None
     self.npcId = None
     self.stopCameraTrack()
     self.ignoreCollisions()
     self.__removeCollisions()
     DistributedToon.disable(self)
     return
 def announceGenerate(self):
     DistributedToon.announceGenerate(self)
     self.startLookAround()
     self.__setupCollisions()
     npcOrigin = render.find('**/npc_origin_' + str(self.originIndex))
     if not npcOrigin.isEmpty():
         self.reparentTo(npcOrigin)
     else:
         self.startNPCOriginPoll()
     self.generateQuestEmblem()
     self.acceptCollisions()
     self.accept(QUEST_DATA_UPDATE_EVENT, self.__handleQuestDataUpdate)
 def __init__(self, cr):
     DistributedToon.__init__(self, cr)
     self.collisionNodePath = None
     self.cameraTrack = None
     self.originIndex = None
     self.npcId = None
     self.currentChatIndex = 0
     self.chatArray = None
     self.interacting = False
     
     self.questEmblem = None
     self.questEmblemSequence = Sequence()
Example #19
0
    def announceGenerate(self):
        DistributedToon.announceGenerate(self)
        self.setupControls()
        self.startLookAround()
        self.friendRequestManager.watch()
        self.accept("gotLookSpot", self.handleLookSpot)
        self.accept("clickedWhisper", self.handleClickedSentWhisper)
        self.accept('f2', self.toggleAspect2d)

        #self.accept('c', self.walkControls.setCollisionsActive, [0])

        self.invGui = InventoryGui()
 def disable(self):
     self.ignore('mouse1-up')
     self.ignore(QUEST_DATA_UPDATE_EVENT)
     self.questEmblem.destroy()
     self.stopLookAround()
     self.stopNPCOriginPoll()
     self.chatArray = None
     self.originIndex = None
     self.npcId = None
     self.stopCameraTrack()
     self.ignoreCollisions()
     self.__removeCollisions()
     DistributedToon.disable(self)
Example #21
0
    def __init__(self, cr):
        try:
            self.LocalToon_initialized
            return
        except:
            self.LocalToon_initialized = 1

        DistributedToon.__init__(self, cr)
        self.avatarChoice = cr.localAvChoice
        self.smartCamera = SmartCamera()
        self.chatInput = ChatInput()
        self.moneyGui = MoneyGui()
        self.laffMeter = LaffOMeter()
        self.positionExaminer = PositionExaminer()
        self.friendRequestManager = FriendRequestManager()
        self.friendsList = FriendsList()
        self.panel = ToonPanel()
        friendsgui = loader.loadModel('phase_3.5/models/gui/friendslist_gui.bam')
        self.friendButton = DirectButton(geom=(friendsgui.find('**/FriendsBox_Closed'), friendsgui.find('**/FriendsBox_Rollover'), friendsgui.find('**/FriendsBox_Rollover')), text=('', 'Friends', 'Friends', ''), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), text_scale=0.065, text_pos=(0, -0.2), relief=None, parent=base.a2dTopRight, pos=(-0.18, 0.0, -0.17), command=self.friendsButtonClicked, scale=0.75)
        friendsgui.removeNode()
        del friendsgui
        self.hideFriendButton()
        self.runSfx = base.loadSfx('phase_3.5/audio/sfx/AV_footstep_runloop.wav')
        self.runSfx.setLoop(True)
        self.walkSfx = base.loadSfx('phase_3.5/audio/sfx/AV_footstep_walkloop.wav')
        self.walkSfx.setLoop(True)
        self.controlManager = ControlManager.ControlManager(True, False)
        self.offset = 3.2375
        self.movementKeymap = {'forward': 0,
         'backward': 0,
         'left': 0,
         'right': 0,
         'jump': 0}
        self.avatarMovementEnabled = False
        self.isMoving_forward = False
        self.isMoving_side = False
        self.isMoving_back = False
        self.isMoving_jump = False
        self.pieThrowBtn = None
        self.myBattle = None
        self.invGui = None
        self.pickerTrav = None
        self.pickerRay = None
        self.pickerRayNode = None
        self.pickerHandler = None
        self.rolledOverTag = None
        self.inTutorial = False
        self.hasDoneJump = False
        self.lastState = None
        self.lastAction = None
        return
Example #22
0
 def setHealth(self, hp):
     if hp > 0 and self.getHealth() < 1:
         if self.cr.playGame.getPlace():
             if self.cr.playGame.getPlace().fsm.getCurrentState().getName() == 'walk':
                 if self.cr.playGame.getPlace().walkStateData.fsm.getCurrentState().getName() == 'deadWalking':
                     self.cr.playGame.getPlace().walkStateData.fsm.request('walking')
         if self.animFSM.getCurrentState().getName() == 'deadNeutral':
             self.playMovementSfx(None)
             self.b_setAnimState('neutral')
         elif self.animFSM.getCurrentState().getName() == 'deadWalk':
             self.playMovementSfx('run')
             self.b_setAnimState('run')
     DistributedToon.setHealth(self, hp)
     return
    def b_setChat(self, chat):
        if self.interacting:
            self.nametag.setActive(1)
            length = len(chat.split("\x07"))
            btn = NametagGlobals.pageButton
            if length == 1:
                btn = NametagGlobals.quitButton
            self.nametag.setChatButton(btn)
            self.nametag.updateAll()

            self.nametag.getNametag3d().setClickEvent(self.uniqueName('chatClicked'))
            self.nametag.getNametag2d().setClickEvent(self.uniqueName('chatClicked'))

            self.accept(self.uniqueName('chatClicked'), self.__handlePageChatClicked)

        DistributedToon.b_setChat(self, chat)
Example #24
0
 def enablePieKeys(self):
     if self.pieThrowBtn:
         if not self.backpack:
             self.backpack = DistributedToon.getBackpack(self)
         self.pieThrowBtn.bind(DGG.B1PRESS, self.startGag)
         self.pieThrowBtn.bind(DGG.B1RELEASE, self.throwGag)
     self.accept('delete', self.startGag)
     self.accept('delete-up', self.throwGag)
Example #25
0
 def setHealth(self, hp):
     if hp > 0 and self.getHealth() < 1:
         if self.cr.playGame and self.cr.playGame.getPlace():
             if self.cr.playGame.getPlace().fsm.getCurrentState().getName(
             ) == 'walk':
                 if self.cr.playGame.getPlace(
                 ).walkStateData.fsm.getCurrentState().getName(
                 ) == 'deadWalking':
                     self.cr.playGame.getPlace().walkStateData.fsm.request(
                         'walking')
         if self.animFSM.getCurrentState().getName() == 'deadNeutral':
             self.playMovementSfx(None)
             self.b_setAnimState("neutral")
         elif self.animFSM.getCurrentState().getName() == 'deadWalk':
             self.playMovementSfx("run")
             self.b_setAnimState("run")
     DistributedToon.setHealth(self, hp)
Example #26
0
 def disable(self):
     base.camLens.setMinFov(CIGlobals.OriginalCameraFov / (4.0 / 3.0))
     self.friendsList.destroy()
     self.friendsList = None
     self.positionExaminer.delete()
     self.positionExaminer = None
     self.disablePicking()
     self.stopMonitoringHP()
     taskMgr.remove('resetHeadColorAfterFountainPen')
     taskMgr.remove('LT.attackReactionDone')
     self.stopLookAround()
     DistributedToon.disable(self)
     self.disableAvatarControls()
     self.disableLaffMeter()
     self.disablePies()
     self.disableChatInput()
     self.weaponType = None
     self.pieType = None
     self.myBattle = None
     self.ignore('gotLookSpot')
     return
Example #27
0
    def enablePies(self, andKeys = 0):
        if self.avatarMovementEnabled and andKeys:
            self.enablePieKeys()
        self.backpack = DistributedToon.getBackpack(self)
        self.invGui = InventoryGui()
        self.invGui.createGui()
        self.invGui.setBackpack(self.backpack)
        for gag in self.backpack.getGags():
            gag.setAvatar(self)

        self.backpack.setGagGUI(self.invGui)
        if self.backpack.getCurrentGag():
            self.invGui.setWeapon(self.backpack.getCurrentGag().getName(), playSound=False)
Example #28
0
 def handleSuitAttack(self, attack_id, suit_id):
     DistributedToon.handleSuitAttack(self, attack_id, suit_id)
     if not self.isDead() and base.config.GetBool('want-sa-reactions'):
         base.taskMgr.remove('LT.attackReactionDone')
         attack = SuitAttacks.SuitAttackLengths.keys()[attack_id]
         suit = self.cr.doId2do.get(suit_id)
         animToPlay = None
         timeToWait = 3.0
         if attack not in ('pickpocket', 'fountainpen'):
             suitH = suit.getH(render) % 360
             myH = self.getH(render) % 360
             if -90.0 <= suitH - myH <= 90.0:
                 animToPlay = 'fallFWD'
             else:
                 animToPlay = 'fallBCK'
         elif attack in ('pickpocket',):
             animToPlay = 'cringe'
         elif attack in ('fountainpen',):
             animToPlay = 'conked'
             timeToWait = 5.0
         self.cr.playGame.getPlace().fsm.request('stop')
         self.b_setAnimState(animToPlay)
         base.taskMgr.doMethodLater(timeToWait, self.__attackReactionDone, 'LT.attackReactionDone')
     return
Example #29
0
    def __init__(self, cr):
        try:
            self.LocalToon_initialized
            return
        except:
            self.LocalToon_initialized = 1
        DistributedToon.__init__(self, cr)
        self.gagStartKey = config.GetString('gag-start-key')
        self.gagThrowKey = config.GetString('gag-throw-key')
        self.avatarChoice = cr.localAvChoice
        self.smartCamera = SmartCamera()
        self.chatInput = ChatInput()
        self.moneyGui = MoneyGui()
        self.laffMeter = LaffOMeter()
        self.positionExaminer = PositionExaminer()
        self.friendRequestManager = FriendRequestManager()
        self.friendsList = FriendsList()
        self.panel = ToonPanel()
        friendsgui = loader.loadModel(
            'phase_3.5/models/gui/friendslist_gui.bam')
        self.friendButton = DirectButton(
            geom=(friendsgui.find('**/FriendsBox_Closed'),
                  friendsgui.find('**/FriendsBox_Rollover'),
                  friendsgui.find('**/FriendsBox_Rollover')),
            text=("", "Friends", "Friends", ""),
            text_fg=(1, 1, 1, 1),
            text_shadow=(0, 0, 0, 1),
            text_scale=0.065,
            text_pos=(0, -0.2),
            relief=None,
            parent=base.a2dTopRight,
            pos=(-0.18, 0.0, -0.17),
            command=self.friendsButtonClicked,
            scale=0.75)
        friendsgui.removeNode()
        del friendsgui
        self.hideFriendButton()
        self.runSfx = base.loadSfx(
            "phase_3.5/audio/sfx/AV_footstep_runloop.ogg")
        self.runSfx.setLoop(True)
        self.walkSfx = base.loadSfx(
            "phase_3.5/audio/sfx/AV_footstep_walkloop.ogg")
        self.walkSfx.setLoop(True)
        self.controlManager = ControlManager.ControlManager(True, False)
        self.offset = 3.2375
        self.firstPersonCamPos = None
        self.movementKeymap = {
            "forward": 0,
            "backward": 0,
            "left": 0,
            "right": 0,
            "jump": 0
        }
        self.avatarMovementEnabled = False
        self.isMoving_forward = False
        self.isMoving_side = False
        self.isMoving_back = False
        self.isMoving_jump = False
        self.gagThrowBtn = None
        self.myBattle = None
        self.gagsTimedOut = False
        self.needsToSwitchToGag = None
        self.gagsEnabled = False

        self.pickerTrav = None
        self.pickerRay = None
        self.pickerRayNode = None
        self.pickerHandler = None
        self.rolledOverTag = None

        self.inTutorial = False
        self.hasDoneJump = False
        self.lastState = None
        self.lastAction = None

        self.jumpHardLandIval = None
Example #30
0
 def generate(self):
     DistributedToon.generate(self)
Example #31
0
 def setDNAStrand(self, dnaStrand):
     DistributedToon.setDNAStrand(self, dnaStrand)
     self.initCollisions()
     self.setupCamera()
Example #32
0
 def setMoney(self, money):
     DistributedToon.setMoney(self, money)
     self.moneyGui.update()
Example #33
0
 def enterReadBook(self, ts=0, callback=None, extraArgs=[]):
     self.stopLookAround()
     self.b_lookAtObject(0, -45, 0)
     DistributedToon.enterReadBook(self, ts, callback, extraArgs)
Example #34
0
 def getBackpack(self):
     return DistributedToon.getBackpack(self)
Example #35
0
 def b_setAnimState(self, anim, callback = None, extraArgs = []):
     if self.anim != anim:
         self.d_setAnimState(anim)
         DistributedToon.setAnimState(self, anim, callback=callback, extraArgs=extraArgs)
Example #36
0
 def exitReadBook(self):
     DistributedToon.exitReadBook(self)
     self.startLookAround()
Example #37
0
 def setMoney(self, money):
     DistributedToon.setMoney(self, money)
     self.moneyGui.update(money)
Example #38
0
 def setupNameTag(self, tempName = None):
     DistributedToon.setupNameTag(self, tempName)
     if self.nameTag:
         self.nameTag.setColorLocal()
Example #39
0
 def setDNAStrand(self, dnaStrand):
     DistributedToon.setDNAStrand(self, dnaStrand)
     self.initCollisions()
     self.setupCamera()
Example #40
0
 def exitReadBook(self):
     DistributedToon.exitReadBook(self)
     self.startLookAround()
Example #41
0
 def enterReadBook(self, ts = 0, callback = None, extraArgs = []):
     self.stopLookAround()
     self.b_lookAtObject(0, -45, 0)
     DistributedToon.enterReadBook(self, ts, callback, extraArgs)
Example #42
0
 def delete(self):
     DistributedToon.delete(self)
     self.deleteLaffMeter()
Example #43
0
 def setFriendsList(self, friends):
     DistributedToon.setFriendsList(self, friends)
     self.cr.friendsManager.d_requestFriendsList()
     self.panel.maybeUpdateFriendButton()
Example #44
0
 def setGagAmmo(self, ammoList):
     DistributedToon.setGagAmmo(self, ammoList)
     self.pieGui.update()
Example #45
0
 def generate(self):
     DistributedToon.generate(self)
 def setupNameTag(self, tempName=None):
     DistributedToon.setupNameTag(self, tempName)
     self.nametag.setNametagColor(
         NametagGlobals.NametagColors[NametagGlobals.CCNPC])
     self.nametag.setActive(0)
     self.nametag.updateAll()
Example #47
0
 def setLoadout(self, gagIds):
     DistributedToon.setLoadout(self, gagIds)
     if base.cr.playGame.getPlace() and base.cr.playGame.getPlace().fsm.getCurrentState().getName() == 'shtickerBook':
         if hasattr(base.cr.playGame.getPlace(), 'shtickerBookStateData'):
             if base.cr.playGame.getPlace().shtickerBookStateData.fsm.getCurrentState().getName() == 'inventoryPage':
                 base.cr.playGame.getPlace().shtickerBookStateData.gui.fsm.request('idle')
Example #48
0
 def getBackpack(self):
     return DistributedToon.getBackpack(self)
Example #49
0
 def setFriendsList(self, friends):
     DistributedToon.setFriendsList(self, friends)
     self.cr.friendsManager.d_requestFriendsList()
     self.panel.maybeUpdateFriendButton()
Example #50
0
 def delete(self):
     DistributedToon.delete(self)
     self.deleteLaffMeter()
     return
Example #51
0
 def setupNameTag(self):
     DistributedToon.setupNameTag(self)
     if self.tag:
         self.tag['text_fg'] = CIGlobals.LocalNameTagColor