Beispiel #1
0
 def _assembleParts(self, isPlayer, appearance):
     if appearance.isAlive:
         appearance.detailedEngineState = self.__assembleEngineState(
             isPlayer)
         if not appearance.isPillbox and not gEffectsDisabled():
             appearance.engineAudition = self.__assembleEngineAudition(
                 isPlayer, appearance)
             appearance.detailedEngineState.onEngineStart += appearance.engineAudition.onEngineStart
             appearance.detailedEngineState.onStateChanged += appearance.engineAudition.onStateChanged
             createEffects(appearance)
         if isPlayer:
             gunRotatorConnector = GunRotatorConnector(appearance)
             appearance.addComponent(gunRotatorConnector)
             appearance.frictionAudition = Vehicular.FrictionAudition(
                 TANK_FRICTION_EVENT)
     self.__createTrackCrashControl(appearance)
     appearance.highlighter = Highlighter()
     isLodTopPriority = isPlayer
     lodCalcInst = Vehicular.LodCalculator(
         DataLinks.linkMatrixTranslation(appearance.compoundModel.matrix),
         True, VEHICLE_PRIORITY_GROUP, isLodTopPriority)
     appearance.lodCalculator = lodCalcInst
     lodLink = DataLinks.createFloatLink(lodCalcInst, 'lodDistance')
     lodStateLink = lodCalcInst.lodStateLink
     if not appearance.damageState.isCurrentModelDamaged:
         model_assembler.assembleRecoil(appearance, lodLink)
         model_assembler.assembleLeveredSuspensionIfNeed(
             appearance, lodStateLink)
         _assembleSwinging(appearance, lodLink)
         model_assembler.assembleSuspensionSound(appearance, lodLink,
                                                 isPlayer)
         model_assembler.assembleSuspensionController(appearance)
     model_assembler.setupTurretRotations(appearance)
Beispiel #2
0
 def _assembleParts(self, isPlayer, appearance):
     appearance.filter = model_assembler.createVehicleFilter(
         appearance.typeDescriptor)
     if appearance.isAlive:
         appearance.detailedEngineState = model_assembler.assembleDetailedEngineState(
             appearance.compoundModel, appearance.filter,
             appearance.typeDescriptor, isPlayer)
         if not gEffectsDisabled():
             model_assembler.assembleVehicleAudition(isPlayer, appearance)
             model_assembler.subscribeEngineAuditionToEngineState(
                 appearance.engineAudition, appearance.detailedEngineState)
             createEffects(appearance)
         if isPlayer:
             gunRotatorConnector = GunRotatorConnector(appearance)
             appearance.addComponent(gunRotatorConnector)
             appearance.frictionAudition = Vehicular.FrictionAudition(
                 TANK_FRICTION_EVENT)
             appearance.peripheralsController = PeripheralsController()
     self.__createTrackCrashControl(appearance)
     appearance.highlighter = Highlighter()
     isLodTopPriority = isPlayer
     lodCalcInst = Vehicular.LodCalculator(
         DataLinks.linkMatrixTranslation(appearance.compoundModel.matrix),
         True, VEHICLE_PRIORITY_GROUP, isLodTopPriority)
     appearance.lodCalculator = lodCalcInst
     lodLink = DataLinks.createFloatLink(lodCalcInst, 'lodDistance')
     lodStateLink = lodCalcInst.lodStateLink
     isDamaged = appearance.damageState.isCurrentModelDamaged
     if not isDamaged:
         self.__assembleNonDamagedOnly(appearance, isPlayer, lodLink,
                                       lodStateLink)
     model_assembler.setupTurretRotations(appearance)
     if appearance.fashion is not None:
         appearance.fashion.movementInfo = appearance.filter.movementInfo
     appearance.waterSensor = model_assembler.assembleWaterSensor(
         appearance.typeDescriptor, appearance, lodStateLink)
     if appearance.engineAudition is not None:
         appearance.engineAudition.setIsUnderwaterInfo(
             DataLinks.createBoolLink(appearance.waterSensor,
                                      'isUnderWater'))
         appearance.engineAudition.setIsInWaterInfo(
             DataLinks.createBoolLink(appearance.waterSensor, 'isInWater'))
     if isPlayer and BigWorld.player().isInTutorial:
         tutorialMatKindsController = TutorialMatKindsController()
         tutorialMatKindsController.terrainMatKindsLink = lambda: appearance.terrainMatKind
         appearance.addComponent(tutorialMatKindsController)
     self.__postSetupFilter(appearance)
     return
    def _assembleParts(self, isPlayer, appearance, resourceRefs):
        appearance.filter = model_assembler.createVehicleFilter(
            appearance.typeDescriptor)
        if appearance.isAlive:
            appearance.detailedEngineState = model_assembler.assembleDetailedEngineState(
                appearance.compoundModel, appearance.filter,
                appearance.typeDescriptor, isPlayer)
            if not gEffectsDisabled():
                model_assembler.assembleVehicleAudition(isPlayer, appearance)
                model_assembler.subscribeEngineAuditionToEngineState(
                    appearance.engineAudition, appearance.detailedEngineState)
                createEffects(appearance)
            if isPlayer:
                gunRotatorConnector = GunRotatorConnector(appearance)
                appearance.addComponent(gunRotatorConnector)
                appearance.frictionAudition = Vehicular.FrictionAudition(
                    TANK_FRICTION_EVENT)
                appearance.peripheralsController = PeripheralsController()
        self.__createTrackCrashControl(appearance)
        appearance.highlighter = Highlighter()
        compoundModel = appearance.compoundModel
        isLodTopPriority = isPlayer
        lodCalcInst = Vehicular.LodCalculator(
            DataLinks.linkMatrixTranslation(appearance.compoundModel.matrix),
            True, VEHICLE_PRIORITY_GROUP, isLodTopPriority)
        appearance.lodCalculator = lodCalcInst
        lodLink = DataLinks.createFloatLink(lodCalcInst, 'lodDistance')
        lodStateLink = lodCalcInst.lodStateLink
        matrixBinding = BigWorld.player(
        ).consistentMatrices.onVehicleMatrixBindingChanged
        appearance.shadowManager = VehicleShadowManager(
            compoundModel, matrixBinding)
        isDamaged = appearance.damageState.isCurrentModelDamaged
        if not isDamaged:
            self.__assembleNonDamagedOnly(appearance, isPlayer, lodLink,
                                          lodStateLink)
            dirtEnabled = BigWorld.WG_dirtEnabled(
            ) and 'HD' in appearance.typeDescriptor.type.tags
            fashions = appearance.fashions
            if dirtEnabled and fashions is not None:
                dirtHandlers = [
                    BigWorld.PyDirtHandler(
                        True,
                        compoundModel.node(TankPartNames.CHASSIS).position.y),
                    BigWorld.PyDirtHandler(
                        False,
                        compoundModel.node(TankPartNames.HULL).position.y),
                    BigWorld.PyDirtHandler(
                        False,
                        compoundModel.node(TankPartNames.TURRET).position.y),
                    BigWorld.PyDirtHandler(
                        False,
                        compoundModel.node(TankPartNames.GUN).position.y)
                ]
                modelHeight, _ = appearance.computeVehicleHeight()
                appearance.dirtComponent = Vehicular.DirtComponent(
                    dirtHandlers, modelHeight)
                for fashionIdx, _ in enumerate(TankPartNames.ALL):
                    fashions[fashionIdx].addMaterialHandler(
                        dirtHandlers[fashionIdx])

        model_assembler.setupTurretRotations(appearance)
        if appearance.fashion is not None:
            appearance.fashion.movementInfo = appearance.filter.movementInfo
        appearance.waterSensor = model_assembler.assembleWaterSensor(
            appearance.typeDescriptor, appearance, lodStateLink)
        if appearance.engineAudition is not None:
            appearance.engineAudition.setIsUnderwaterInfo(
                DataLinks.createBoolLink(appearance.waterSensor,
                                         'isUnderWater'))
            appearance.engineAudition.setIsInWaterInfo(
                DataLinks.createBoolLink(appearance.waterSensor, 'isInWater'))
        if isPlayer and BigWorld.player().isInTutorial:
            tutorialMatKindsController = TutorialMatKindsController()
            tutorialMatKindsController.terrainMatKindsLink = lambda: appearance.terrainMatKind
            appearance.addComponent(tutorialMatKindsController)
        self.__postSetupFilter(appearance)
        compoundModel.setPartBoundingBoxAttachNode(
            TankPartIndexes.GUN, TankNodeNames.GUN_INCLINATION)
        return