def start(self):
        PetBrain.notify.debug('start: %s' % self.pet.doId)
        self.lookers = {}
        self.lookees = {}
        self.accept(PetLookerAI.getStartLookedAtByOtherEvent(self.pet.doId), self._handleLookedAtByOtherStart)
        self.accept(PetLookerAI.getStopLookedAtByOtherEvent(self.pet.doId), self._handleLookedAtByOtherStop)
        self.accept(PetLookerAI.getStartLookingAtOtherEvent(self.pet.doId), self._handleLookingAtOtherStart)
        self.accept(PetLookerAI.getStopLookingAtOtherEvent(self.pet.doId), self._handleLookingAtOtherStop)
        self.globalGoals = [PetGoal.Wander()]
        for goal in self.globalGoals:
            self.goalMgr.addGoal(goal)

        for doId in self.pet._getNearbyAvatarDict():
            self._handleAvatarArrive(doId)

        self.tLastLonelinessUpdate = globalClock.getFrameTime()
        taskMgr.doMethodLater(simbase.petThinkPeriod * random.random(), self._think, self.getThinkTaskName())
        self.started = 1
    def stop(self):
        PetBrain.notify.debug('stop: %s' % self.pet.doId)
        if not self.started:
            return
        self.started = 0
        del self.lookers
        del self.lookees
        for doId in self.pet._getNearbyAvatarDict():
            self._handleAvatarLeave(doId)

        for goal in self.globalGoals:
            self.goalMgr.removeGoal(goal)
            goal.destroy()

        del self.globalGoals
        self.clearFocus()
        taskMgr.remove(self.getThinkTaskName())
        self.ignore(PetLookerAI.getStartLookedAtByOtherEvent(self.pet.doId))
        self.ignore(PetLookerAI.getStopLookedAtByOtherEvent(self.pet.doId))
        self.ignore(PetLookerAI.getStartLookingAtOtherEvent(self.pet.doId))
        self.ignore(PetLookerAI.getStopLookingAtOtherEvent(self.pet.doId))
Example #3
0
    def stop(self):
        PetBrain.notify.debug('stop: %s' % self.pet.doId)
        if not self.started:
            return
        self.started = 0
        del self.lookers
        del self.lookees
        for doId in self.pet._getNearbyAvatarDict():
            self._handleAvatarLeave(doId)

        for goal in self.globalGoals:
            self.goalMgr.removeGoal(goal)
            goal.destroy()

        del self.globalGoals
        self.clearFocus()
        taskMgr.remove(self.getThinkTaskName())
        self.ignore(PetLookerAI.getStartLookedAtByOtherEvent(self.pet.doId))
        self.ignore(PetLookerAI.getStopLookedAtByOtherEvent(self.pet.doId))
        self.ignore(PetLookerAI.getStartLookingAtOtherEvent(self.pet.doId))
        self.ignore(PetLookerAI.getStopLookingAtOtherEvent(self.pet.doId))
Example #4
0
    def start(self):
        PetBrain.notify.debug('start: %s' % self.pet.doId)
        self.lookers = {}
        self.lookees = {}
        self.accept(PetLookerAI.getStartLookedAtByOtherEvent(self.pet.doId),
                    self._handleLookedAtByOtherStart)
        self.accept(PetLookerAI.getStopLookedAtByOtherEvent(self.pet.doId),
                    self._handleLookedAtByOtherStop)
        self.accept(PetLookerAI.getStartLookingAtOtherEvent(self.pet.doId),
                    self._handleLookingAtOtherStart)
        self.accept(PetLookerAI.getStopLookingAtOtherEvent(self.pet.doId),
                    self._handleLookingAtOtherStop)
        self.globalGoals = [PetGoal.Wander()]
        for goal in self.globalGoals:
            self.goalMgr.addGoal(goal)

        for doId in self.pet._getNearbyAvatarDict():
            self._handleAvatarArrive(doId)

        self.tLastLonelinessUpdate = globalClock.getFrameTime()
        taskMgr.doMethodLater(simbase.petThinkPeriod * random.random(),
                              self._think, self.getThinkTaskName())
        self.started = 1