Exemplo n.º 1
0
 def activate(self):
     if self.__activated or self._vehicle is None:
         return
     else:
         player = BigWorld.player()
         isPlayerVehicle = self._vehicle.isPlayerVehicle or self._vehicle.id == player.observedVehicleID
         self.__originalFilter = self._vehicle.filter
         if isPlayerVehicle and self.collisions is not None:
             colliderData = (self.collisions.getColliderID(),
                             (TankPartNames.getIdx(TankPartNames.HULL),
                              TankPartNames.getIdx(TankPartNames.TURRET),
                              TankPartNames.getIdx(TankPartNames.GUN)))
             BigWorld.appendCameraCollider(colliderData)
             self.__inSpeedTreeCollision = True
             BigWorld.setSpeedTreeCollisionBody(
                 self.compoundModel.getBoundsForPart(TankPartIndexes.HULL))
         self.__linkCompound()
         self.__createTerrainCircle()
         super(CompoundAppearance, self).activate()
         self.onModelChanged()
         if not self.isObserver:
             self.__dirtUpdateTime = BigWorld.time()
         BigWorld.player().arena.onPeriodChange += self.__arenaPeriodChanged
         BigWorld.player().arena.onVehicleUpdated += self.__vehicleUpdated
         BigWorld.player(
         ).inputHandler.onCameraChanged += self._onCameraChanged
         if self.detailedEngineState is not None:
             engine_state.checkEngineStart(self.detailedEngineState,
                                           BigWorld.player().arena.period)
         self.__activated = True
         return
 def activate(self):
     if self.__activated or self.__vehicle is None:
         return
     else:
         super(CompoundAppearance, self).activate()
         isPlayerVehicle = self.__vehicle.isPlayerVehicle
         isObserver = 'observer' in self.__typeDesc.type.tags
         player = BigWorld.player()
         self.__originalFilter = self.__vehicle.filter
         self.__vehicle.filter = self.__filter
         self.__vehicle.filter.enableStabilisedMatrix(isPlayerVehicle)
         self.__filter.isStrafing = self.__vehicle.isStrafing
         self.__filter.vehicleCollisionCallback = player.handleVehicleCollidedVehicle
         self.__compoundModel.isHighPriorityReflection = isPlayerVehicle
         if isPlayerVehicle:
             if player.inputHandler is not None:
                 player.inputHandler.addVehicleToCameraCollider(
                     self.__vehicle)
             self.__inSpeedTreeCollision = True
             BigWorld.setSpeedTreeCollisionBody(
                 self.__compoundModel.getBoundsForPart(
                     TankPartIndexes.HULL))
         self.__linkCompound()
         if not isObserver:
             self.__chassisDecal.attach()
         self.__createAndAttachStickers()
         self.__startSystems()
         self.setupGunMatrixTargets()
         if not isObserver:
             self.__vehicle.filter.enableLagDetection(
                 not self.__currentDamageState.isCurrentModelDamaged)
         self.onModelChanged()
         if self.lodCalculator is not None:
             self.lodCalculator.setupPosition(
                 DataLinks.linkMatrixTranslation(
                     self.__compoundModel.matrix))
         if hasattr(self.filter, 'placingCompensationMatrix'
                    ) and self.swingingAnimator is not None:
             self.swingingAnimator.placingCompensationMatrix = self.filter.placingCompensationMatrix
             self.swingingAnimator.worldMatrix = self.__compoundModel.matrix
         if self.__periodicTimerID is not None:
             BigWorld.cancelCallback(self.__periodicTimerID)
         self.__periodicTimerID = BigWorld.callback(_PERIODIC_TIME,
                                                    self.__onPeriodicTimer)
         if self.fashion is not None:
             self.fashion.activate()
         if isObserver:
             self.__compoundModel.visible = False
         BigWorld.player().arena.onPeriodChange += self.__arenaPeriodChanged
         BigWorld.player(
         ).inputHandler.onCameraChanged += self.__onCameraChanged
         if self.detailedEngineState is not None:
             engine_state.checkEngineStart(self.detailedEngineState,
                                           BigWorld.player().arena.period)
         self.__activated = True
         return
 def activate(self):
     if self.__activated or self.__vehicle is None:
         return
     else:
         if self.collisions is not None and self.__vehicle.isTurretDetached:
             self.collisions.removeAttachment(
                 TankPartNames.getIdx(TankPartNames.TURRET))
             self.collisions.removeAttachment(
                 TankPartNames.getIdx(TankPartNames.GUN))
         super(CompoundAppearance, self).activate()
         isPlayerVehicle = self.__vehicle.isPlayerVehicle
         self.__isObserver = 'observer' in self.__typeDesc.type.tags
         player = BigWorld.player()
         self.__originalFilter = self.__vehicle.filter
         self.__vehicle.filter = self.__filter
         self.__vehicle.filter.enableStabilisedMatrix(isPlayerVehicle)
         self.__filter.isStrafing = self.__vehicle.isStrafing
         self.__filter.vehicleCollisionCallback = player.handleVehicleCollidedVehicle
         if isPlayerVehicle and self.collisions is not None:
             colliderData = (self.collisions.getColliderID(),
                             (TankPartNames.getIdx(TankPartNames.HULL),
                              TankPartNames.getIdx(TankPartNames.TURRET)))
             BigWorld.appendCameraCollider(colliderData)
             self.__inSpeedTreeCollision = True
             BigWorld.setSpeedTreeCollisionBody(
                 self.__compoundModel.getBoundsForPart(
                     TankPartIndexes.HULL))
         self.__linkCompound()
         if not self.__isObserver:
             self.__chassisDecal.attach()
         self.__createAndAttachStickers()
         if self.__currentDamageState.isCurrentModelDamaged:
             self.__chassisColisionMatrix.target = self.__compoundModel.matrix
             gunNodeName = 'gun'
         else:
             self.__chassisColisionMatrix.target = self.__vehicle.filter.groundPlacingMatrix
             gunNodeName = TankNodeNames.GUN_INCLINATION
         if not self.__isObserver:
             self.__startSystems()
         self.setupGunMatrixTargets()
         if not self.__isObserver:
             self.__vehicle.filter.enableLagDetection(
                 not self.__currentDamageState.isCurrentModelDamaged)
         self.onModelChanged()
         if self.lodCalculator is not None:
             self.lodCalculator.setupPosition(
                 DataLinks.linkMatrixTranslation(
                     self.__compoundModel.matrix))
         if hasattr(self.filter, 'placingCompensationMatrix'
                    ) and self.swingingAnimator is not None:
             self.swingingAnimator.placingCompensationMatrix = self.filter.placingCompensationMatrix
             self.swingingAnimator.worldMatrix = self.__compoundModel.matrix
         if not self.__isObserver:
             if self.__periodicTimerID is not None:
                 BigWorld.cancelCallback(self.__periodicTimerID)
             self.__periodicTimerID = BigWorld.callback(
                 _PERIODIC_TIME, self.__onPeriodicTimer)
             self.__dirtUpdateTime = BigWorld.time()
         if self.fashion is not None:
             self.fashion.activate()
         if self.__isObserver:
             self.__compoundModel.visible = False
         BigWorld.player().arena.onPeriodChange += self.__arenaPeriodChanged
         BigWorld.player(
         ).inputHandler.onCameraChanged += self.__onCameraChanged
         if self.detailedEngineState is not None:
             engine_state.checkEngineStart(self.detailedEngineState,
                                           BigWorld.player().arena.period)
         if self.collisions is not None:
             collisionData = ((TankPartNames.getIdx(TankPartNames.HULL),
                               self.compoundModel.node(TankPartNames.HULL)),
                              (TankPartNames.getIdx(TankPartNames.TURRET),
                               self.compoundModel.node(
                                   TankPartNames.TURRET)),
                              (TankPartNames.getIdx(TankPartNames.CHASSIS),
                               self.__chassisColisionMatrix),
                              (TankPartNames.getIdx(TankPartNames.GUN),
                               self.compoundModel.node(gunNodeName)))
             self.collisions.connect(self.id,
                                     ColliderTypes.VEHICLE_COLLIDER,
                                     collisionData)
         self.__activated = True
         return