Esempio n. 1
0
 def vehicleRemoved(self, vId):
     if vId == self.__vId:
         if avatar_getter.isObserver():
             vehicle = BigWorld.entities.get(vId)
             if vehicle is not None and vehicle.isAlive():
                 return
         staticHullMatrix = Math.Matrix(self.__component.wg_hullMatProv)
         staticTurretMatrix = Math.Matrix(self.__component.wg_turretMatProv)
         self.__component.wg_hullMatProv = staticHullMatrix
         self.__component.wg_turretMatProv = staticTurretMatrix
     return
Esempio n. 2
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
     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
Esempio n. 3
0
 def __setVehicleInfo(self, marker, vInfo, guiProps, nameParts):
     markerID = marker.getMarkerID()
     vType = vInfo.vehicleType
     if avatar_getter.isVehiclesColorized():
         guiPropsName = 'team{}'.format(vInfo.team)
     else:
         if avatar_getter.isObserver():
             arenaDP = self.sessionProvider.getArenaDP()
             obsVehId = BigWorld.player().observedVehicleID
             vehId = vInfo.vehicleID
             if vehId == obsVehId or arenaDP.isSquadMan(vehId, arenaDP.getVehicleInfo(obsVehId).prebattleID):
                 guiProps = PLAYER_GUI_PROPS.squadman
         guiPropsName = guiProps.name()
     if self._isSquadIndicatorEnabled and vInfo.squadIndex:
         squadIndex = vInfo.squadIndex
     else:
         squadIndex = 0
     hunting = VehicleActions.isHunting(vInfo.events)
     self._invokeMarker(markerID, 'setVehicleInfo', vType.classTag, vType.iconPath, nameParts.vehicleName, vType.level, nameParts.playerFullName, nameParts.playerName, nameParts.clanAbbrev, nameParts.regionCode, vType.maxHealth, guiPropsName, hunting, squadIndex, backport.text(R.strings.ingame_gui.stun.seconds()))
     self._invokeMarker(markerID, 'update')
    def __filterRibbons(self, ribbons):
        if self.__isInPostmortemMode and not avatar_getter.isObserver():
            for rType in _RIBBON_TYPES_EXCLUDED_IN_POSTMORTEM:
                if rType in ribbons:
                    del ribbons[rType]

        if BATTLE_EFFICIENCY_TYPES.DESTRUCTION in ribbons:
            killRibbons = dict(
                ((r.getVehicleID(), r)
                 for r in ribbons[BATTLE_EFFICIENCY_TYPES.DESTRUCTION]))
            damageRibbons = dict(
                ((t, ribbons[t])
                 for t in _RIBBON_TYPES_AGGREGATED_WITH_KILL_RIBBON
                 if t in ribbons))
            for rType, tmpRibbons in damageRibbons.iteritems():
                filteredRibbons = []
                for tmpRibbon in tmpRibbons:
                    if tmpRibbon.getVehicleID() in killRibbons:
                        killRibbon = killRibbons[tmpRibbon.getVehicleID()]
                        if not killRibbon.aggregate(tmpRibbon):
                            filteredRibbons.append(tmpRibbon)
                    filteredRibbons.append(tmpRibbon)

                ribbons[rType] = filteredRibbons

            excludedRibbons = dict(
                ((t, ribbons[t]) for t in _RIBBON_TYPES_EXCLUDED_IF_KILL_RIBBON
                 if t in ribbons))
            for rType, tmpRibbons in excludedRibbons.iteritems():
                filteredRibbons = [
                    r for r in tmpRibbons
                    if r.getVehicleID() not in killRibbons
                ]
                ribbons[rType] = filteredRibbons

        return ribbons
Esempio n. 5
0
 def __onVehicleStateUpdated(self, state, value):
     if state == VEHICLE_VIEW_STATE.SWITCHING and avatar_getter.isObserver():
         self.__removeActiveCommands()