def _enable(self, state, isFirstInit): if isFirstInit: return else: ts = state['target'] if ts['startTime'] is not None: self._setTarget(ts['name'], ts['vType'], ts['isFriend']) Aim._flashCall(self, 'updateTarget', [ts['dist']]) self._clearTarget(BigWorld.time() - ts['startTime']) hs = state['health'] self._setHealth(hs['cur'], hs['max']) ammoCtrl = g_sessionProvider.getAmmoCtrl() if ammoCtrl.isGunReloadTimeInPercent(): self.setReloadingInPercent(ammoCtrl.getGunReloadTime(), False) elif self._reloadingHndl.state['startTime'] is not None: self._setReloading( self._reloadingHndl.state['duration'], startTime=BigWorld.time() - self._reloadingHndl.state['startTime'], correction=self._reloadingHndl.state['correction']) else: self._setReloading(self._reloadingHndl.state['duration'], 0, False) capacity, burst = state['clip'] self._setClipParams(capacity, burst) self._setAmmoStock(*self._reloadingHndl.ammoStock) return
def _update(self): Aim._update(self) if self.__vID is not None: vehicle = BigWorld.entity(self.__vID) if vehicle is not None: playerName = g_sessionProvider.getCtx().getFullPlayerName(vID=self.__vID, showVehShortName=False) type = vehicle.typeDescriptor.type.userString healthPercent = math.ceil(100.0 * max(0, vehicle.health) / vehicle.typeDescriptor.maxHealth) self.__setText(playerName, type, healthPercent) Aim._flashCall(self, 'updateTarget', [_g_aimState['target']['dist']])
def __setText(self, name, type, health): isPlayer = self.__vID == BigWorld.player().playerVehicleID caption = makeHtmlString( 'html_templates:battle/postmortemMessages', 'player' if isPlayer else 'ally', { 'message': i18n.makeString( INGAME_GUI.PLAYER_MESSAGES_POSTMORTEM_CAPTION_SELF) if isPlayer else self.__msgCaption }) Aim._flashCall( self, 'updatePlayerInfo', [caption % { 'name': name, 'type': type, 'health': health }])
def _enable(self, state, isFirstInit): self.__damageCtrl.enable() if isFirstInit: return Aim._flashCall(self, 'updateDistance', [self._getAimDistance()]) hs = state['health'] self._setHealth(hs['cur'], hs['max']) ammoCtrl = g_sessionProvider.getAmmoCtrl() if ammoCtrl.isGunReloadTimeInPercent(): self.setReloadingInPercent(ammoCtrl.getGunReloadTime(), False) else: rs = state['reload'] if rs['startTime'] is not None: self._setReloading(rs['duration'], startTime=BigWorld.time() - rs['startTime'], correction=rs['correction']) else: self._setReloading(rs['duration'], 0, False) (capacity, burst,) = state['clip'] if capacity > 1: self._setClipParams(capacity, burst) self._setAmmoStock(*state['ammo'])
def _enable(self, state, isFirstInit): if isFirstInit: return ts = state['target'] if ts['startTime'] is not None: self._setTarget(ts['name'], ts['vType'], ts['isFriend']) Aim._flashCall(self, 'updateTarget', [ts['dist']]) self._clearTarget(BigWorld.time() - ts['startTime']) hs = state['health'] self._setHealth(hs['cur'], hs['max']) ammoCtrl = g_sessionProvider.getAmmoCtrl() if ammoCtrl.isGunReloadTimeInPercent(): self.setReloadingInPercent(ammoCtrl.getGunReloadTime(), False) elif self._reloadingHndl.state['startTime'] is not None: self._setReloading(self._reloadingHndl.state['duration'], startTime=BigWorld.time() - self._reloadingHndl.state['startTime'], correction=self._reloadingHndl.state['correction']) else: self._setReloading(self._reloadingHndl.state['duration'], 0, False) capacity, burst = state['clip'] self._setClipParams(capacity, burst) self._setAmmoStock(*self._reloadingHndl.ammoStock)
def _update(self): distance = Aim._update(self) if distance is not None: Aim._flashCall(self, 'updateTarget', [distance]) return
def __setText(self, name, type, health): isPlayer = self.__vID == BigWorld.player().playerVehicleID caption = makeHtmlString('html_templates:battle/postmortemMessages', 'player' if isPlayer else 'ally', {'message': i18n.makeString(INGAME_GUI.PLAYER_MESSAGES_POSTMORTEM_CAPTION_SELF) if isPlayer else self.__msgCaption}) Aim._flashCall(self, 'updatePlayerInfo', [caption % {'name': name, 'type': type, 'health': health}])
def _update(self): Aim._update(self) Aim._flashCall(self, 'updateTarget', [_g_aimState['target']['dist']])
def __setText(self, name, type, health): text = i18n.convert(self.__msgCaption % {'name': name, 'type': type, 'health': health}) Aim._flashCall(self, 'updatePlayerInfo', [text])
def _update(self): Aim._update(self) Aim._flashCall(self, 'updateDistance', [self._getAimDistance()])
def _update(self): distance = Aim._update(self) if distance is not None: Aim._flashCall(self, 'updateTarget', [distance])