def __onVehicleControlling(self, vehicle): vTypeDesc = vehicle.typeDescriptor vType = vTypeDesc.type yawLimits = vehicle_getter.getYawLimits(vTypeDesc) if yawLimits: inDegrees = (math.degrees(-yawLimits[0]), math.degrees(yawLimits[1])) else: inDegrees = None self.__isAutoRotationOn = True self.__isAutoRotationShown = False if vehicle.isPlayerVehicle or BigWorld.player().isObserver(): flag = vehicle_getter.getAutoRotationFlag(vTypeDesc) if flag != AUTO_ROTATION_FLAG.IGNORE_IN_UI: self.__isAutoRotationOn = flag == AUTO_ROTATION_FLAG.TURN_ON self.__isAutoRotationShown = True self.__maxHealth = vTypeDesc.maxHealth health = vehicle.health healthStr = formatHealthProgress(health, self.__maxHealth) healthProgress = normalizeHealthPercent(health, self.__maxHealth) self.as_setupS( healthStr, healthProgress, vehicle_getter.getVehicleIndicatorType(vTypeDesc), vehicle_getter.getCrewMainRolesWithIndexes(vType.crewRoles), inDegrees, vehicle_getter.hasTurretRotator(vTypeDesc), self.__isAutoRotationOn) self._updatePlayerInfo(vehicle.id) if self.__tankIndicator is not None: self.__tankIndicator.setup(vehicle, yawLimits) self.__setupDevicesStates() return
def __getTurretYawForAnchor(self, anchorId, defaultYaw): turretYaw = defaultYaw if anchorId is not None and hasTurretRotator(self.__vDesc): anchorHelper = self.__getAnchorHelperById(anchorId) if anchorHelper is not None: if anchorHelper.turretYaw is not None: turretYaw = anchorHelper.turretYaw else: if anchorHelper.attachedPartIdx == TankPartIndexes.HULL: needsCorrection = anchorId.slotType in ( GUI_ITEM_TYPE.EMBLEM, GUI_ITEM_TYPE.INSCRIPTION ) or anchorId.slotType == GUI_ITEM_TYPE.PROJECTION_DECAL and anchorHelper.descriptor.showOn == ApplyArea.HULL if needsCorrection: turretYaw = self.__correctTurretYaw( anchorHelper, defaultYaw) anchorHelper = AnchorHelper(anchorHelper.location, anchorHelper.descriptor, turretYaw, anchorHelper.partIdx, anchorHelper.attachedPartIdx) self.__updateAnchorHelperWithId(anchorId, anchorHelper) turretYawLimits = self.__vDesc.gun.turretYawLimits if turretYawLimits is not None: turretYaw = math_utils.clamp(turretYawLimits[0], turretYawLimits[1], turretYaw) return turretYaw
def getAppliedRegionsForCurrentHangarVehicle(areaId, slotId): if areaId == TankPartIndexes.TURRET and not hasTurretRotator(g_currentVehicle.item.descriptor): return () outfit = g_currentVehicle.item.getCustomOutfit(SeasonType.SUMMER) area = outfit.getContainer(areaId) if area: slot = area.slotFor(slotId) if slot: if slotId != GUI_ITEM_TYPE.PAINT: if slotId in (GUI_ITEM_TYPE.INSCRIPTION, GUI_ITEM_TYPE.EMBLEM): descriptor = g_currentVehicle.hangarSpace.getVehicleEntity().typeDescriptor allDecalesSlots = () if areaId == TankPartIndexes.HULL: allDecalesSlots = descriptor.hull.emblemSlots elif areaId == TankPartIndexes.TURRET and not descriptor.turret.showEmblemsOnGun or areaId == TankPartIndexes.GUN and descriptor.turret.showEmblemsOnGun: allDecalesSlots = descriptor.turret.emblemSlots if slotId == GUI_ITEM_TYPE.INSCRIPTION: slotType = 'inscription' else: slotType = 'player' decalesSlots = tuple((slt for slt in allDecalesSlots if slt.type == slotType)) return tuple(range(min(len(decalesSlots), len(slot.getRegions())))) return tuple(range(len(slot.getRegions()))) if areaId != TankPartIndexes.GUN: if slot.getRegions(): return (0,) return () if 'GUN_2' in g_currentVehicle.item.descriptor.type.customizableVehicleAreas: return (0, C11N_MASK_REGION) return (0,)
def __onVehicleControlling(self, vehicle): vTypeDesc = vehicle.typeDescriptor vType = vTypeDesc.type yawLimits = vehicle_getter.getYawLimits(vTypeDesc) if yawLimits: inDegrees = (math.degrees(-yawLimits[0]), math.degrees(yawLimits[1])) else: inDegrees = None if vehicle.isPlayerVehicle: isAutoRotationOn = vehicle_getter.isAutoRotationOn(vTypeDesc) else: isAutoRotationOn = None self._maxHealth = vTypeDesc.maxHealth helthStr, helthProgress = _getHealthParams(vehicle.health, self._maxHealth) self.as_setupS( helthStr, helthProgress, vehicle_getter.getVehicleIndicatorType(vTypeDesc), vehicle_getter.getCrewMainRolesWithIndexes(vType.crewRoles), inDegrees, vehicle_getter.hasTurretRotator(vTypeDesc), isAutoRotationOn) if self.__tankIndicator: app = g_appLoader.getDefBattleApp() self.__tankIndicator.setup(app, vehicle, yawLimits) return
def __onVehicleControlling(self, vehicle): vTypeDesc = vehicle.typeDescriptor vType = vTypeDesc.type yawLimits = vehicle_getter.getYawLimits(vTypeDesc) if yawLimits: inDegrees = (math.degrees(-yawLimits[0]), math.degrees(yawLimits[1])) else: inDegrees = None self.__isAutoRotationShown = False if vehicle.isPlayerVehicle or avatar_getter.isObserver(): flag = vehicle_getter.getAutoRotationFlag(vTypeDesc) if flag != AUTO_ROTATION_FLAG.IGNORE_IN_UI: self.__isAutoRotationOff = flag != AUTO_ROTATION_FLAG.TURN_ON self.__isAutoRotationShown = True self.__isWheeledTech = vehicle.isWheeledTech self.__isTrackWithinVehicle = vehicle.isTrackWithinTrack prebattleVehicle = self.sessionProvider.shared.prebattleSetups.getPrebattleSetupsVehicle( ) if prebattleVehicle is not None: self.__maxHealth = prebattleVehicle.descriptor.maxHealth health = self.__maxHealth else: self.__maxHealth = vehicle.maxHealth health = vehicle.health healthStr = formatHealthProgress(health, self.__maxHealth) healthProgress = normalizeHealthPercent(health, self.__maxHealth) self.as_setupS( healthStr, healthProgress, vehicle_getter.getVehicleIndicatorType(vTypeDesc), vehicle_getter.getCrewMainRolesWithIndexes(vType.crewRoles), inDegrees, vehicle_getter.hasTurretRotator(vTypeDesc), self.__isWheeledTech, not self.__isAutoRotationOff, self.__isTrackWithinVehicle) if self.__isWheeledTech: self.as_setupWheeledS( vTypeDesc.chassis.generalWheelsAnimatorConfig. getNonTrackWheelsCount()) self._updatePlayerInfo(vehicle.id) if self.__tankIndicator is not None: self.__tankIndicator.setup(vehicle, yawLimits) self.__setupDevicesStates() self._updateRepairTimesState() return
def __onVehicleControlling(self, vehicle): self.__vehicleID = vehicle.id vTypeDesc = vehicle.typeDescriptor vType = vTypeDesc.type yawLimits = vehicle_getter.getYawLimits(vTypeDesc) if yawLimits: inDegrees = (math.degrees(-yawLimits[0]), math.degrees(yawLimits[1])) else: inDegrees = None if vehicle.isPlayerVehicle: isAutoRotationOn = vehicle_getter.isAutoRotationOn(vTypeDesc) else: isAutoRotationOn = None self.as_setupS( (vTypeDesc.maxHealth, vehicle.health), vehicle_getter.getVehicleIndicatorType(vTypeDesc), vehicle_getter.getCrewMainRolesWoIndexes(vType.crewRoles), inDegrees, vehicle_getter.hasTurretRotator(vTypeDesc), isAutoRotationOn) if self.__tankIndicator: self.__tankIndicator.setup(self.__ui, vehicle, yawLimits) return
def __onVehicleControlling(self, vehicle): vTypeDesc = vehicle.typeDescriptor vType = vTypeDesc.type yawLimits = vehicle_getter.getYawLimits(vTypeDesc) if yawLimits: inDegrees = (math.degrees(-yawLimits[0]), math.degrees(yawLimits[1])) else: inDegrees = None if vehicle.isPlayer: isAutoRotationOn = vehicle_getter.isAutoRotationOn(vTypeDesc) else: isAutoRotationOn = None self.as_setupS( (vTypeDesc.maxHealth, vehicle.health), vehicle_getter.getVehicleIndicatorType(vTypeDesc), vehicle_getter.getCrewMainRolesWoIndexes(vType.crewRoles), inDegrees, vehicle_getter.hasTurretRotator(vTypeDesc), isAutoRotationOn, ) if self.__tankIndicator: self.__tankIndicator.setup(self.__ui, vehicle, yawLimits) return
def __onVehicleControlling(self, vehicle): vTypeDesc = vehicle.typeDescriptor vType = vTypeDesc.type yawLimits = vehicle_getter.getYawLimits(vTypeDesc) if yawLimits: inDegrees = (math.degrees(-yawLimits[0]), math.degrees(yawLimits[1])) else: inDegrees = None if vehicle.isPlayerVehicle: isAutoRotationOn = vehicle_getter.isAutoRotationOn(vTypeDesc) else: isAutoRotationOn = None self._maxHealth = vTypeDesc.maxHealth helthStr, helthProgress = _getHealthParams(vehicle.health, self._maxHealth) self.as_setupS(helthStr, helthProgress, vehicle_getter.getVehicleIndicatorType(vTypeDesc), vehicle_getter.getCrewMainRolesWithIndexes(vType.crewRoles), inDegrees, vehicle_getter.hasTurretRotator(vTypeDesc), isAutoRotationOn) if self.__tankIndicator: app = g_appLoader.getDefBattleApp() self.__tankIndicator.setup(app, vehicle, yawLimits) return
def __onVehicleControlling(self, vehicle): vTypeDesc = vehicle.typeDescriptor vType = vTypeDesc.type yawLimits = vehicle_getter.getYawLimits(vTypeDesc) if yawLimits: inDegrees = (math.degrees(-yawLimits[0]), math.degrees(yawLimits[1])) else: inDegrees = None self.__isAutoRotationOn = True self.__isAutoRotationShown = False if vehicle.isPlayerVehicle: flag = vehicle_getter.getAutoRotationFlag(vTypeDesc) if flag != AUTO_ROTATION_FLAG.IGNORE_IN_UI: self.__isAutoRotationOn = flag == AUTO_ROTATION_FLAG.TURN_ON self.__isAutoRotationShown = True self.__maxHealth = vTypeDesc.maxHealth health = vehicle.health healthStr = formatHealthProgress(health, self.__maxHealth) healthProgress = normalizeHealthPercent(health, self.__maxHealth) self.as_setupS(healthStr, healthProgress, vehicle_getter.getVehicleIndicatorType(vTypeDesc), vehicle_getter.getCrewMainRolesWithIndexes(vType.crewRoles), inDegrees, vehicle_getter.hasTurretRotator(vTypeDesc), self.__isAutoRotationOn) if self.__tankIndicator is not None: self.__tankIndicator.setup(vehicle, yawLimits) return