def setCannonWillFire(self, cannonId, zRot, angle): self.notify.debug('setCannonWillFire: %d %d %d' % (cannonId, zRot, angle)) cannon = base.cr.doId2do.get(cannonId) if cannon is None: self.notify.warning( "Cannon has not been created, but we got this message. Don't show firing." ) return if not cannon.getToonInside(): self.notify.warning( "setCannonWillFire, but no toon insde. Don't show firing") return if self.isLocalToon(cannon.getToonInside()): self.localFlyingToon = base.localAvatar self.localFlyingToonId = base.localAvatar.doId self.localFiringCannon = cannon self.flyingToonCloudsHit = 0 cannon.updateModel(zRot, angle) toonId = cannon.getToonInside().doId task = Task(self.__fireCannonTask) task.toonId = toonId task.cannon = cannon taskMgr.add(task, self.taskNameFireCannon) self.toonIds.append(toonId) return
def setCannonWillFire(self, cannonId, zRot, angle): """ AI is telling us that a cannon needs to fire, so make sure that cannon is updated and spawn the the fire cannon task. """ self.notify.debug("setCannonWillFire: %d %d %d" % (cannonId, zRot, angle)) cannon = base.cr.doId2do.get(cannonId) # we might get this message from the server before we even get a # chance to place the toon inside the cannon... for instance if we just # walked in the zone. If this is the case, don't create a fire task if cannon is None: self.notify.warning( "Cannon has not been created, but we got this message. Don't show firing." ) return if not cannon.getToonInside(): self.notify.warning( "setCannonWillFire, but no toon insde. Don't show firing") return if self.isLocalToon(cannon.getToonInside()): self.localFlyingToon = base.localAvatar self.localFlyingToonId = base.localAvatar.doId self.localFiringCannon = cannon self.flyingToonCloudsHit = 0 # Set final cannon position. # NOTE: do this for the local toon; cannon angles may have been # modified by conversion to and from fixed-point, and we want # to have the same values that all the other clients have cannon.updateModel(zRot, angle) toonId = cannon.getToonInside().doId # create a task to fire off the cannon task = Task(self.__fireCannonTask) task.toonId = toonId task.cannon = cannon taskMgr.add(task, self.taskNameFireCannon) self.toonIds.append(toonId)
def setCannonWillFire(self, cannonId, zRot, angle): self.notify.debug('setCannonWillFire: %d %d %d' % (cannonId, zRot, angle)) cannon = base.cr.doId2do.get(cannonId) if cannon is None: self.notify.warning("Cannon has not been created, but we got this message. Don't show firing.") return if not cannon.getToonInside(): self.notify.warning("setCannonWillFire, but no toon insde. Don't show firing") return if self.isLocalToon(cannon.getToonInside()): self.localFlyingToon = base.localAvatar self.localFlyingToonId = base.localAvatar.doId self.localFiringCannon = cannon self.flyingToonCloudsHit = 0 cannon.updateModel(zRot, angle) toonId = cannon.getToonInside().doId task = Task(self.__fireCannonTask) task.toonId = toonId task.cannon = cannon taskMgr.add(task, self.taskNameFireCannon) self.toonIds.append(toonId)