Beispiel #1
0
 def setupNameTag(self, tempName = None):
     Avatar.setupNameTag(self, tempName = tempName)
     if self.nametag:
         if self.level > 0:
             self.nametag.setText(self.nametag.getText() + '\n%s\nLevel %s %s' % (self.dept.getName(), self.level, self.suitPlan.getCogClassName()))
         else:
             self.nametag.setText(self.nametag.getText() + '\n%s' % (self.dept.getName()))
Beispiel #2
0
    def disable(self):
        base.taskMgr.remove(self.uniqueName('monitorRange'))
        self.stopBlink()
        self.fsm.requestFinalState()
        self.fsm = None
        self.neutralFSM.requestFinalState()
        self.neutralFSM = None
        self.charId = None
        self.geoEyes = None
        self.avatarType = None
        self.isInRange = None
        self.currentPointLetter = None
        self.walkIval = None
        self.currentChat = None
        self.talkEnabled = None
        self.speechSound = None
        self.chatsSinceLastNoise = None

        if self.santaHat:
            self.santaHat.removeNode()
            self.santaHat = None

        if self.headNode:
            self.headNode.removeNode()
            self.headNode = None

        self.eyes = None
        self.lpupil = None
        self.rpupil = None
        self.eyesOpen = None
        self.eyesClosed = None
        DistributedAvatar.disable(self)
        Avatar.disable(self)
Beispiel #3
0
 def disable(self):
     if self.suitTrack:
         self.suitTrack.finish()
         DelayDelete.cleanupDelayDeletes(self.suitTrack)
         self.suitTrack = None
     self.animFSM.requestFinalState()
     self.cleanup()
     Avatar.disable(self)
Beispiel #4
0
 def doRagdollMode(self):
     self.stopSmooth()
     Avatar.doRagdollMode(self)
     #self.brain.stop()
     self.doUndetectGlow()
     if self.dieSound:
         self.dieSound.play()
     self.request('Off')
     self.setEyeColor(self.DeadEyeColor)
Beispiel #5
0
    def generateCog(self, isLose = 0, nameTag = True):
        self.cleanup()
        if not isLose:
            if self.variant == Variant.SKELETON or self.variant == Variant.ZOMBIE:
                self.loadModel('phase_5/models/char/cog%s_robot-zero.bam' % (str(self.suit)), 'body')
            else:
                self.loadModel('phase_3.5/models/char/suit%s-mod.bam' % (str(self.suit)), 'body')
            animations = SuitGlobals.animations
            anims = {}
            for anim in animations:
                if not self.suit in anim.getSuitTypes():
                    continue
                path = 'phase_%s/models/char/suit%s-%s.bam' % (anim.getPhase(), self.suit, anim.getFile())
                anims[anim.getName()] = path
            self.loadAnims(anims, 'body')
            self.generateHealthBar()

            if self.suitPlan.suitType == SuitType.A:
                self.footstepSound = base.audio3d.loadSfx("phase_5/audio/sfx/ENC_cogafssm.ogg")
            elif self.suitPlan.suitType == SuitType.B:
                self.footstepSound = base.audio3d.loadSfx("phase_5/audio/sfx/ENC_cogbfssm.ogg")
            elif self.suitPlan.suitType == SuitType.C:
                self.footstepSound = base.audio3d.loadSfx("phase_5/audio/sfx/ENC_cogcfssm.ogg")
            if self.footstepSound:
                base.audio3d.attachSoundToObject(self.footstepSound, self)

        else:
            if self.variant == Variant.SKELETON or self.variant == Variant.ZOMBIE:
                self.loadModel('phase_5/models/char/cog%s_robot-lose-mod.bam' % (str(self.suit)), 'body')
            else:
                self.loadModel('phase_4/models/char/suit%s-lose-mod.bam' % (str(self.suit)), 'body')
            self.loadAnims({'lose' : 'phase_4/models/char/suit%s-lose.bam' % (str(self.suit))}, 'body')
        if self.variant != Variant.SKELETON:
            self.headModel = self.head.generate()
            self.headModel.reparentTo(self.find("**/joint_head"))
        if self.suitPlan.getName() == SuitGlobals.VicePresident:
            self.headModel.setScale(0.35)
            self.headModel.setHpr(270, 0, 270)
            self.headModel.setZ(-0.10)
            self.headModel.loop('neutral')
        self.setClothes()

        classScale = 1.0#self.suitPlan.getCogClassAttrs().scaleMod
        self.setAvatarScale((self.suitPlan.getScale() / SuitGlobals.scaleFactors[self.suit]) * classScale)
        #self.setHeight(self.suitPlan.getHeight())
        if nameTag:
            self.setupNameTag()

        Avatar.initShadow(self)

        # We've already done all manipulating to the cog, we can just flatten it.
        self.getPart('body').flattenStrong()
        self.postFlatten()
        self.headModel.flattenStrong()
        if isinstance(self.headModel, Actor):
            self.headModel.postFlatten()
Beispiel #6
0
    def __init__(self, hatType=Nothing):
        Avatar.__init__(self, 0)
        FSM.__init__(self, 'Goon')
        self.hatType = hatType
        self.shootTrack = None
        self.shootSound = None
        self.detectSound = None
        self.whipSound = None
        self.idleSound = None
        self.dieSound = None
        self.hat = None
        self.brain = None

        self.lightScanIval = None

        self.scannerMdl = None
        self.scanBeginSound = None
        self.scanLoopSound = None
        self.scanEndSound = None
        self.scanLight = None
        self.lightGlow = None

        self.height = 3.5

        #self.shapeGroup = Globals.EnemyGroup

        self.eyeLaser = None

        self.ragdoll = None

        self.anims = {
            "walk": "phase_9/models/char/Cog_Goonie-walk.bam",
            "idle": "phase_9/models/char/Cog_Goonie-recovery.bam",
            "scan": "phase_9/models/char/Cog_Goonie-recovery.bam",
            "wakeup": "phase_9/models/char/Cog_Goonie-recovery.bam",
            "collapse": "phase_9/models/char/Cog_Goonie-collapse.bam",
            "zero": "phase_9/models/char/Cog_Goonie-zero.bam"
        }

        self.baseBlendAnim = 'walk'

        self.standWalkRunReverse = [('idle', 'walk', 0.0, 5.0, 1.0, 1.0)]

        self.activities = {
            ACT_DIE: Goon_Die(self),
            ACT_WAKE_ANGRY: Goon_WakeAngry(self),
            ACT_GOON_SCAN: Goon_Scan(self)
        }
Beispiel #7
0
    def setSpeed(self, forwardSpeed, rotateSpeed, strafeSpeed=0.0):
        Avatar.setSpeed(self, forwardSpeed, rotateSpeed, strafeSpeed)

        currSpeed = self.currentSpeed
        if self.doingActivity:
            currSpeed = 0

        if self.footstepSound and self.standWalkRunReverse is not None:
            action = self.getMoveAction(forwardSpeed, rotateSpeed, strafeSpeed)
            minSpeed = self.standWalkRunReverse[action][2]
            maxSpeed = self.standWalkRunReverse[action][3]
            self.footstepSound.setVolume(
                CIGlobals.clamp(
                    CIGlobals.remapVal(currSpeed, minSpeed, maxSpeed, 0, 1), 0,
                    1))
            self.footstepSound.setPlayRate(max(1, currSpeed / maxSpeed))
 def setName(self, name):
     Avatar.setName(self, name)
 def __init__(self, cr):
     Avatar.__init__(self)
     DistributedSmoothNode.__init__(self, cr)
Beispiel #10
0
 def delete(self):
     Avatar.delete(self)
     self.cleanup()
Beispiel #11
0
 def setChat(self, chat):
     self.clearChatbox()
     Avatar.setChat(self, chat)
     self.chat = chat
Beispiel #12
0
 def setName(self, nameString, charName):
     Avatar.setName(self, nameString, charName=charName, createNow=1)
Beispiel #13
0
 def disable(self):
     self.attachmentInterps = None
     DistributedEntity.disable(self)
     Avatar.disable(self)
     self.detachNode()
     return
 def disable(self):
     DistributedSmoothNode.disable(self)
     Avatar.disable(self)
     self.detachNode()
     return
 def getName(self):
     return Avatar.getName(self)
Beispiel #16
0
 def delete(self):
     DistributedEntity.delete(self)
     Avatar.delete(self)
Beispiel #17
0
    def __init__(self, cr):
        DistributedEntity.__init__(self, cr, False)
        Avatar.__init__(self)

        # joint name -> [X,Y,Z,H,P,R,TIME]
        self.attachmentInterps = {}
 def setChat(self, chat):
     Avatar.setChat(self, chat)
Beispiel #19
0
    def __init__(self):
        Avatar.__init__(self)
        self.dept = None
        self.suit = None
        self.head = None
        self.headModel = None
        self.variant = None
        self.handColor = None
        self.voice = None
        self.chat = None
        self.chatDial = None
        self.shadow = None
        self.deathSound = None
        self.propeller = None
        self.smallExp = None
        self.largeExp = None
        self.explosion = None
        self.hasSpawned = False
        self.suitTrack = None
        self.timestampAnimTrack = None
        self.propellerSounds = {}
        self.healthBar = None
        self.healthBarGlow = None
        self.condition = 0
        self.avatarType = CIGlobals.Suit
        self.suitPlan = None
        self.footstepSound = None
        self.showNametagInMargins = False
        self.surfaceProp = "metal"

        self.activities = {
            ACT_WAKE_ANGRY: WakeAngry(self),
            ACT_SMALL_FLINCH: Flinch(self),
            ACT_DIE: Die(self),
            ACT_VICTORY_DANCE: VictoryDance(self),
            ACT_COG_FLY_DOWN: FlyDown(self),
            ACT_SIT: Sit(self),
            ACT_STUN: Stun(self)
        }

        self.standWalkRunReverse = [('neutral', 'walk', 0.0, 5.0, 1.0, 1.0)]

        self.gruntSound = base.audio3d.loadSfx(
            "phase_14/audio/sfx/cog_grunt.ogg")
        base.audio3d.attachSoundToObject(self.gruntSound, self)

        self.animFSM = ClassicFSM('Suit', [
            State('off', self.enterOff, self.exitOff),
            State('neutral', self.enterNeutral, self.exitNeutral),
            State('walk', self.enterWalk, self.exitWalk),
            State('die', self.enterDie, self.exitDie),
            State('win', self.enterWin, self.exitWin),
            State('flail', self.enterFlail, self.exitFlail),
            State('flyDown', self.enterFlyDown, self.exitFlyDown),
            State('flyAway', self.enterFlyAway, self.exitFlyAway),
            State('flyNeutral', self.enterFlyNeutral, self.exitFlyNeutral),
            State('trayWalk', self.enterTrayWalk, self.exitTrayWalk),
            State('trayNeutral', self.enterTrayNeutral, self.exitTrayNeutral),
            State('stunned', self.enterStunned, self.exitStunned),
            State('pie', self.enterPie, self.exitPie),
            State('drop', self.enterDrop, self.exitDrop),
            State('drop-react', self.enterDropReact, self.exitDropReact),
            State('soak', self.enterSoak, self.exitSoak),
            State('squirt-small', self.enterSquirtSmall, self.exitSquirtSmall)
        ], 'off', 'off')
        self.animFSM.enterInitialState()
 def delete(self):
     DistributedSmoothNode.delete(self)
     Avatar.delete(self)
Beispiel #21
0
    def generateCog(self, isLose=0, nameTag=True):
        #startTime = globalClock.getRealTime()

        generateCollector.start()

        cleanupCollector.start()
        self.cleanup()
        cleanupCollector.stop()

        if not isLose:

            if self.suitPlan in SuitBank.suitSetups:
                setup = SuitBank.suitSetups[self.suitPlan]
            else:
                setup = SuitBank.SuitSetup()
                SuitBank.suitSetups[self.suitPlan] = setup

            if not self.variant in setup.actor:
                setupActor = Actor()
                if self.variant == Variant.SKELETON or self.variant == Variant.ZOMBIE:
                    setupActor.loadModel(
                        'phase_5/models/char/cog%s_robot-zero.bam' %
                        (str(self.suit)), 'body')
                else:
                    setupActor.loadModel(
                        'phase_3.5/models/char/suit%s-mod.bam' %
                        (str(self.suit)), 'body')
                animations = SuitGlobals.animations
                anims = {}
                for anim in animations:
                    if not self.suit in anim.getSuitTypes():
                        continue
                    path = 'phase_%s/models/char/suit%s-%s.bam' % (
                        anim.getPhase(), self.suit, anim.getFile())
                    anims[anim.getName()] = path
                setupActor.loadAnims(anims, 'body')
                setup.actor[self.variant] = setupActor

            actorCollector.start()
            self.copyActor(setup.actor[self.variant])
            actorCollector.stop()

            healthBarCollector.start()
            self.generateHealthBar()
            healthBarCollector.stop()

            footstepCollector.start()
            if self.suitPlan.suitType == SuitType.A:
                self.footstepSound = base.audio3d.loadSfx(
                    "phase_5/audio/sfx/ENC_cogafssm.ogg")
            elif self.suitPlan.suitType == SuitType.B:
                self.footstepSound = base.audio3d.loadSfx(
                    "phase_5/audio/sfx/ENC_cogbfssm.ogg")
            elif self.suitPlan.suitType == SuitType.C:
                self.footstepSound = base.audio3d.loadSfx(
                    "phase_5/audio/sfx/ENC_cogcfssm.ogg")
            if self.footstepSound:
                base.audio3d.attachSoundToObject(self.footstepSound, self)
                self.footstepSound.setVolume(0.0)
                self.footstepSound.setLoop(True)
                self.footstepSound.play()
            footstepCollector.stop()

        else:
            if self.variant == Variant.SKELETON or self.variant == Variant.ZOMBIE:
                self.loadModel(
                    'phase_5/models/char/cog%s_robot-lose-mod.bam' %
                    (str(self.suit)), 'body')
            else:
                self.loadModel(
                    'phase_4/models/char/suit%s-lose-mod.bam' %
                    (str(self.suit)), 'body')
            self.loadAnims(
                {
                    'lose':
                    'phase_4/models/char/suit%s-lose.bam' % (str(self.suit))
                }, 'body')

        genHeadCollector.start()
        if self.variant != Variant.SKELETON:
            self.headModel = self.head.generate()
            self.headModel.reparentTo(self.find("**/joint_head"))
        if self.suitPlan.getName() == SuitGlobals.VicePresident:
            self.headModel.setScale(0.35)
            self.headModel.setHpr(270, 0, 270)
            self.headModel.setZ(-0.10)
            self.headModel.loop('neutral')
        if self.variant == Variant.SKELETON:
            self.headModel = self.find("**/joint_head")
        #antenna = loader.loadModel("models/police_antenna.bam")
        ##antenna.reparentTo(self.find("**/joint_head"))
        #antenna.setPos(0.5, -0.5, 0)
        #antenna.setScale(1.25)
        #antenna.clearModelNodes()
        #antenna.flattenStrong()
        genHeadCollector.stop()

        self.setClothes()

        classScale = 1.0  #self.suitPlan.getCogClassAttrs().scaleMod
        self.setAvatarScale(
            (self.suitPlan.getScale() / SuitGlobals.scaleFactors[self.suit]) *
            classScale)
        self.setHeight(self.suitPlan.getHeight())

        nametagCollector.start()
        if nameTag:
            self.setupNameTag()
        nametagCollector.stop()

        Avatar.initShadow(self)

        if self.variant != Variant.SKELETON:
            # We've already done all manipulating to the cog, we can just flatten it.
            self.getPart('body').flattenStrong()
            self.postFlatten()
            self.headModel.flattenStrong()
            if isinstance(self.headModel, Actor):
                self.headModel.postFlatten()

        #endTime = globalClock.getRealTime()
        #print("GenerateCog took {0} seconds".format(endTime - startTime))

        generateCollector.stop()