Example #1
0
 def delete(self):
     self.request('Off')
     self.state = None
     self.locked = None
     self.wait = None
     self.moveDuration = None
     DistributedEntityAI.delete(self)
 def delete(self):
     self.stopPosHprBroadcast()
     if self.brain:
         self.brain.stop()
         self.brain = None
     DistributedEntityAI.delete(self)
     DistributedAvatarAI.delete(self)
Example #3
0
 def __init__(self, air, dispatch):
     DistributedEntityAI.__init__(self, air, dispatch)
     FSM.__init__(self, 'DButtonAI')
     self.state = 0
     self.locked = 0
     self.wait = 0.0
     self.moveDuration = 0.0
 def __init__(self, air, dispatch):
     DistributedEntityAI.__init__(self, air, dispatch)
     DistributedAvatarAI.__init__(self, air)
     BaseNPCAI.__init__(self, dispatch)
     
     self.patrolTime = 0.0
     self.patrolDur = 10.0
     
     self.activities = {ACT_WAKE_ANGRY   :   2.0,
                        ACT_DIE          :   -1,
                        ACT_GOON_SCAN    :   6.0}
                        
     self.schedules.update({
         "SCAN_AREA" :   Schedule(
             [
                 Task_StopMoving(self),
                 Task_GetRandomPath(self),
                 Task_RunPath(self),
                 Task_AwaitMovement(self),
                 Task_SetActivity(self, ACT_GOON_SCAN),
                 Task_AwaitActivity(self)
             ],
             interruptMask = COND_NEW_TARGET|COND_LIGHT_DAMAGE|COND_HEAVY_DAMAGE
         )
     
     })
     
     self.brain = None
     self.spawnflags = 0
     
     self.health = 25
     self.maxHealth = 25
Example #5
0
    def announceGenerate(self):
        npcName = self.getEntityValue("name")
        if len(npcName) == 0:
            npcId = self.getEntityValueInt("npcId")
        else:
            npcId = NPCGlobals.getNPCIDByName(npcName)

        name = NPCGlobals.NPCToonDict[npcId][1]
        dna = NPCGlobals.NPCToonDict[npcId][2]
        self.b_setName(name)
        self.b_setDNAStrand(dna)
        self.b_setHealth(self.getMaxHealth())

        self.setPos(self.cEntity.getOrigin())
        self.setHpr(self.cEntity.getAngles())

        DistributedEntityAI.announceGenerate(self)
        DistributedToonAI.announceGenerate(self)

        #self.b_setParent(CIGlobals.SPRender)
        self.startPosHprBroadcast()

        self.startAI()

        self.accept(self.getHealthChangeEvent(), self.__hpChange)
    def announceGenerate(self):
        entnum = self.cEntity.getBspEntnum()
        suitId = self.getEntityValueInt("suitPlan")
        suitPlan = SuitBank.getSuitById(suitId)
        level = self.getEntityValueInt("level")
        variant = self.getEntityValueInt("variant")
        self.b_setLevel(level)
        self.b_setSuit(suitPlan, variant)
        self.b_setPlace(self.zoneId)
        self.b_setName(suitPlan.getName())

        self.setPos(self.cEntity.getOrigin())
        self.setHpr(self.cEntity.getAngles())
        pos = self.getPos()
        hpr = self.getHpr()
        self.d_setPosHpr(pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2])

        DistributedEntityAI.announceGenerate(self)
        DistributedSuitAI.announceGenerate(self)
        self.stopAI()

        self.b_setParent(CIGlobals.SPRender)
        taskMgr.add(self.monitorHealth, self.uniqueName('monitorHealth'))
        self.startPosHprBroadcast()

        spawnflags = self.getEntityValueInt("spawnflags")
        if spawnflags & self.StartsActive:
            self.Activate()
Example #7
0
 def delete(self):
     self.died = None
     self.hpBarrel = None
     taskMgr.remove(self.uniqueName('npcToonDie'))
     BaseNPCAI.delete(self)
     DistributedToonAI.delete(self)
     DistributedEntityAI.delete(self)
 def announceGenerate(self):
     DistributedAvatarAI.announceGenerate(self)
     DistributedEntityAI.announceGenerate(self)
     
     self.setPos(self.cEntity.getOrigin())
     self.setHpr(self.cEntity.getAngles() - (180, 0, 0))
     pos = self.getPos()
     hpr = self.getHpr()
     self.d_setPosHpr(pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2])
     
     self.startPosHprBroadcast()
     
     self.startAI()
     
     if self.spawnflags & self.StartsAsleep:
         self.setNPCState(STATE_IDLE)
     else:
         self.setNPCState(STATE_ALERT)
Example #9
0
    def __init__(self, air, dispatch):
        DistributedEntityAI.__init__(self, air, dispatch)
        DistributedToonAI.__init__(self, air)
        BaseNPCAI.__init__(self, dispatch)
        self.setBattleZone(dispatch)

        from src.coginvasion.attack.Attacks import ATTACK_GAG_WHOLECREAMPIE
        self.attackIds = [ATTACK_GAG_WHOLECREAMPIE]

        self.died = False

        self.hpBarrel = None

        self.schedules.update({
            "GET_HP_FROM_BARREL":
            Schedule(
                [
                    Task_StopMoving(self),
                    Task_StopAttack(self),
                    Task_RememberPosition(
                        self
                    ),  # remember where we were, we will return there after grabbing some HP
                    Task_FindBestHPBarrel(self),
                    Task_GetPathToHPBarrel(self),
                    Task_Speak(self, 0.5, [
                        "I need more Laff points.",
                        "I'm grabbing a Laff barrel!",
                        "Hang on, I need this Laff barrel.", "I need Laff!"
                    ]),
                    Task_RunPath(self),
                    Task_AwaitMovement(self),
                    Task_GrabHPBarrel(self),
                    Task_ClearHPBarrel(self),
                    Task_SetSchedule(self, "RETURN_TO_MEMORY_POSITION")
                ],
                interruptMask=COND_HEAVY_DAMAGE)
        })
 def __init__(self, air, dispatch):
     DistributedEntityAI.__init__(self, air, dispatch)
     self.cutsceneId = ""
     self.length = 0.0
     self.inProgress = False
Example #11
0
 def __init__(self, air, dispatch):
     DistributedEntityAI.__init__(self, air, dispatch)
     FSM.__init__(self, 'FuncDoorAI')
     self.state = DOORSTATE_CLOSED
     self.wait = 0.0
     self.moveDuration = 0.0
 def delete(self):
     self.request('Off')
     self.state = None
     self.timeToWind = None
     self.spawnflags = None
     DistributedEntityAI.delete(self)
 def delete(self):
     taskMgr.remove(self.taskName("handleCutsceneOver"))
     self.cutsceneId = None
     self.length = None
     self.inProgress = None
     DistributedEntityAI.delete(self)
 def announceGenerate(self):
     DistributedEntityAI.announceGenerate(self)
     if self.spawnflags & self.StartsRotating:
         self.b_setState(1)
 def __init__(self, air, dispatch):
     DistributedEntityAI.__init__(self, air, dispatch)
     FSM.__init__(self, 'func_rotating_ai')
     self.state = 0
     self.timeToWind = 5.0
     self.spawnflags = 0
 def delete(self):
     self.songName = None
     self.volume = None
     self.looping = None
     DistributedEntityAI.delete(self)
 def __init__(self, air, dispatch):
     DistributedEntityAI.__init__(self, air, dispatch)
     self.songName = ""
     self.volume = 1.0
     self.looping = False
 def delete(self):
     taskMgr.remove(self.uniqueName('monitorHealth'))
     DistributedEntityAI.delete(self)
     DistributedSuitAI.delete(self)
     self.battleZone = None
 def __init__(self, air, dispatch):
     DistributedEntityAI.__init__(self, air, dispatch)
     self.lightState = 0
     self.lightColor = (1.0, 1.0, 0.75)
Example #20
0
 def __init__(self, air, dispatch):
     DistributedEntityAI.__init__(self, air, dispatch)
     FSM.__init__(self, 'DGeneratorAI')
     self.state = 0
 def delete(self):
     DistributedEntityAI.delete(self)
     self.enabled = None
 def __init__(self, air, dispatch):
     DistributedEntityAI.__init__(self, air, dispatch)
     self.enabled = False
 def load(self):
     DistributedEntityAI.load(self)
     self.enabled = not bool(self.getEntityValueInt("StartDisabled"))
Example #24
0
 def announceGenerate(self):
     DistributedEntityAI.announceGenerate(self)
     if self.spawnflags & self.StartsPressed:
         self.b_setState(2)
 def __init__(self, air, dispatch):
     DistributedEntityAI.__init__(self, air, dispatch)
     DistributedSuitAI.__init__(self, air)
     self.setBattleZone(dispatch)
     dispatch.suits.append(self)
Example #26
0
 def delete(self):
     self.request('Off')
     self.state = 0
     DistributedEntityAI.delete(self)