Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # Online post:
- # https://pastebin.com/NMFSUWwL
- # https://www.reddit.com/r/EscapefromTarkov/comments/159rv3i/turn_speed/jtho4dq/
- ALIGN_LEFT = '<'
- ALIGN_RIGHT = '>'
- ALIGN_CENTER = '^'
- DIVIDER = '┃'
- SEPARATOR = ' → '
- COLUMNS = 3
- def printCounterTurningSpeedHipfireSensTable(adsSensitivity, maxTurningSpeedDelay = 99):
- print(f' Turning Speed Penalty{SEPARATOR}Mouse Sensitivity (Hip Fire)\n')
- TURNING_SPEED_PENALTY_MAX_WIDTH = len(str(-maxTurningSpeedDelay))
- HIPFIRE_SENSITIVITY_MAX_WIDTH = len(roundStr(calculateCounterTurningSpeedHipfireSens(adsSensitivity, maxTurningSpeedDelay), 2))
- for turningSpeedDelay in range(1, maxTurningSpeedDelay + 1):
- hipfireSensitivity = calculateCounterTurningSpeedHipfireSens(adsSensitivity, turningSpeedDelay)
- print(f' {DIVIDER} {-turningSpeedDelay:{ALIGN_LEFT}{TURNING_SPEED_PENALTY_MAX_WIDTH}}{SEPARATOR}{roundStr(hipfireSensitivity, 2):{ALIGN_RIGHT}{HIPFIRE_SENSITIVITY_MAX_WIDTH}}', end='')
- if turningSpeedDelay % COLUMNS == 0 or turningSpeedDelay == maxTurningSpeedDelay:
- print(f' {DIVIDER}')
- # SOURCE: https://www.reddit.com/r/EscapefromTarkov/comments/epc7ly/turn_speed_spreadsheet/
- # SOURCE: https://drive.google.com/file/d/1iiGsLmaxB-Ijagh17ibg94dymToH7nT9/view
- def calculateCounterTurningSpeedHipfireSens(adsSensitivity, turningSpeedDelay):
- turningSpeedDelayPercent = turningSpeedDelay / 100
- inputTurningSpeedBoostPercent = 1 - turningSpeedDelayPercent
- hipfireSensitivity = adsSensitivity / inputTurningSpeedBoostPercent
- return hipfireSensitivity
- def roundStr(number, digits=0):
- return ('{{:.{}f}}'.format(digits)).format(roundHalfAwayFromZero(number, digits))
- # Round half-away-from-zero.
- # SOURCE: https://realpython.com/python-rounding/
- # SOURCE: https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero
- import math
- def roundHalfAwayFromZero(number, decimals=0):
- multiplier = 10 ** decimals
- if number >= 0:
- return math.floor(number * multiplier + 0.5) / multiplier
- else:
- return math.ceil(number * multiplier - 0.5) / multiplier
- import os
- def clear():
- os.system('cls' if os.name in ('nt', 'dos') else 'clear')
- def wait_for_enter_keypress():
- import getpass
- getpass.getpass('Press ENTER to continue . . . ')
- def main():
- while True:
- try:
- adsSensitivity = float(input(' Mouse Sensitivity (ADS): '))
- except:
- clear()
- else:
- break
- print()
- printCounterTurningSpeedHipfireSensTable(adsSensitivity)
- print()
- wait_for_enter_keypress()
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement