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 construct(self, isPlayer, resourceRefs): super(CompoundAppearance, self).construct(isPlayer, resourceRefs) if self.damageState.effect is not None: self.playEffect(self.damageState.effect, SpecialKeyPointNames.STATIC) self.highlighter = Highlighter(self.isAlive) if isPlayer and BigWorld.player().isInTutorial: self.tutorialMatKindsController = TutorialMatKindsController() self.tutorialMatKindsController.terrainGroundTypesLink = lambda: self.terrainGroundType self.__isConstructed = True 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