Compare commits
3 Commits
e105a06534
...
73d3867fce
Author | SHA1 | Date |
---|---|---|
Nicholas Hope | 73d3867fce | |
Nicholas Hope | ca0920fb44 | |
Nicholas Hope | c9e710ab9b |
|
@ -0,0 +1,116 @@
|
|||
default:
|
||||
# voice-based doubles
|
||||
e:
|
||||
double:
|
||||
primary:
|
||||
impulse: voice medic
|
||||
secondary:
|
||||
impulse: voice activate uber
|
||||
condition: mouse4
|
||||
t:
|
||||
double:
|
||||
primary:
|
||||
impulse: voice thanks
|
||||
secondary:
|
||||
impulse: voice nice shot
|
||||
condition: mouse4
|
||||
v:
|
||||
double:
|
||||
primary:
|
||||
impulse: voice spy
|
||||
secondary:
|
||||
impulse: voice help
|
||||
condition: mouse4
|
||||
|
||||
# hold doubles
|
||||
r:
|
||||
double:
|
||||
primary:
|
||||
hold: "class_action"
|
||||
secondary:
|
||||
hold: "reload"
|
||||
condition: mouse4
|
||||
cancel both: yes
|
||||
|
||||
# other
|
||||
y:
|
||||
double:
|
||||
primary:
|
||||
impulse: say
|
||||
secondary:
|
||||
impulse: say_team
|
||||
condition: mouse4
|
||||
=:
|
||||
double:
|
||||
primary:
|
||||
impulse: kill
|
||||
secondary:
|
||||
impulse: explode
|
||||
condition: "-"
|
||||
|
||||
# toggle
|
||||
capslock:
|
||||
toggle: voicerecord
|
||||
|
||||
# hold: null-cancelled movement
|
||||
a:
|
||||
hold:
|
||||
press:
|
||||
- "-moveright"
|
||||
- "+moveleft"
|
||||
- "alias maybeMoveLeft +moveleft"
|
||||
release:
|
||||
- "-moveleft"
|
||||
- "maybeMoveRight"
|
||||
- "alias maybeMoveLeft "
|
||||
d:
|
||||
hold:
|
||||
press:
|
||||
- "-moveleft"
|
||||
- "+moveright"
|
||||
- "alias maybeMoveRight +moveright"
|
||||
release:
|
||||
- "-moveright"
|
||||
- "maybeMoveLeft"
|
||||
- "alias maybeMoveRight "
|
||||
|
||||
classAction:
|
||||
alias: yes
|
||||
hold:
|
||||
press:
|
||||
- "slot2"
|
||||
- "wait 10"
|
||||
- "slot1"
|
||||
release: ""
|
||||
|
||||
load0:
|
||||
alias: yes
|
||||
impulse: "load_itempreset 0"
|
||||
load1:
|
||||
alias: yes
|
||||
impulse: "load_itempreset 1"
|
||||
load2:
|
||||
alias: yes
|
||||
impulse: "load_itempreset 2"
|
||||
load3:
|
||||
alias: yes
|
||||
impulse: "load_itempreset 3"
|
||||
|
||||
INS:
|
||||
impulse:
|
||||
- "load0"
|
||||
- "alias reload_presets load0"
|
||||
HOME:
|
||||
impulse:
|
||||
- "load1"
|
||||
- "alias reload_presets load1"
|
||||
DEL:
|
||||
impulse:
|
||||
- "load2"
|
||||
- "alias reload_presets load2"
|
||||
END:
|
||||
impulse:
|
||||
- "load3"
|
||||
- "alias reload_presets load3"
|
||||
backspace:
|
||||
impulse: "reload_presets"
|
|
@ -136,7 +136,11 @@ def main() -> int:
|
|||
targetDir = getTargetDir(systemName)
|
||||
if targetDir is not None:
|
||||
# Supported OS: add steamapps path
|
||||
targetDir += normpath("/steamapps/common/Team Fortress 2/tf/cfg/")
|
||||
targetDir += normpath("/steamapps/common/Team Fortress 2/tf/cfg")
|
||||
if systemName == "Windows":
|
||||
targetDir += '\\'
|
||||
else:
|
||||
targetDir += '/'
|
||||
elif args.force:
|
||||
# Unsupported OS but -f specified
|
||||
if args.debug:
|
||||
|
@ -152,7 +156,8 @@ def main() -> int:
|
|||
|
||||
fileNames = parseConfig(config, defaults)
|
||||
fileList = writing.replaceFiles(targetDir, fileNames, args)
|
||||
writing.appendToActuals(targetDir, fileList, args)
|
||||
defaultsGiven = (defaults is not None)
|
||||
writing.appendToActuals(targetDir, fileList, defaultsGiven, args)
|
||||
|
||||
return 0
|
||||
|
||||
|
|
|
@ -72,25 +72,42 @@ def replaceFiles(targetDir, fileNames, args):
|
|||
|
||||
return list(fileNames.values())
|
||||
|
||||
def appendToActuals(targetDir, fileList, args):
|
||||
def appendToActuals(targetDir, fileList, defaultsGiven, args):
|
||||
if defaultsGiven:
|
||||
classList = [
|
||||
"scout",
|
||||
"soldier",
|
||||
"pyro",
|
||||
"demo",
|
||||
"engi",
|
||||
"heavy",
|
||||
"medic",
|
||||
"sniper",
|
||||
"spy"
|
||||
]
|
||||
for cclass in classList:
|
||||
addCallIfUncalled('exec default_script_1', targetDir, cclass, args)
|
||||
fileList = onlyFirsts(fileList)
|
||||
for currFile in fileList:
|
||||
execStr = f'exec {currFile.split(".")[0]}'
|
||||
realFilePath = targetDir + getRealName(currFile)
|
||||
addCallIfUncalled(execStr, targetDir, currFile, args)
|
||||
|
||||
realExists = exists(realFilePath)
|
||||
def addCallIfUncalled(execStr, targetDir, fileName, args):
|
||||
realFilePath = targetDir + getRealName(fileName)
|
||||
|
||||
# creates if it doesn't exist, so must come after the exists() call
|
||||
cfgFile = open(realFilePath, 'a+')
|
||||
if not realExists:
|
||||
if args.debug:
|
||||
print( f"DEBUG: Created file {targetDir}{realFilePath}" )
|
||||
cfgFile.write(execStr)
|
||||
realExists = exists(realFilePath)
|
||||
|
||||
elif not strInFile(execStr, cfgFile):
|
||||
cfgFile.write('\n' + execStr)
|
||||
# creates if it doesn't exist, so must come after the exists() call
|
||||
cfgFile = open(realFilePath, 'r+')
|
||||
if not realExists:
|
||||
if args.debug:
|
||||
print( f"DEBUG: Created file {targetDir}{realFilePath}" )
|
||||
cfgFile.write(execStr + '\n')
|
||||
|
||||
cfgFile.close()
|
||||
elif not strInFile(execStr, cfgFile):
|
||||
cfgFile.write('\n' + execStr + '\n')
|
||||
|
||||
cfgFile.close()
|
||||
|
||||
def onlyFirsts(fileList):
|
||||
for i, fileName in enumerate(fileList):
|
||||
|
@ -115,13 +132,11 @@ def getRealName(fileName):
|
|||
return className + '.cfg'
|
||||
|
||||
def strInFile(execStr, f):
|
||||
while True:
|
||||
line = f.readline()
|
||||
if line == "":
|
||||
# eof
|
||||
break
|
||||
lineList = [ ' '.join(line.split()) for line in f.readlines() ]
|
||||
for line in lineList:
|
||||
# Remove indent and outdent, including trailing newline
|
||||
if execStr in line.strip():
|
||||
print(line)
|
||||
if execStr == line:
|
||||
return True
|
||||
|
||||
return False
|
Loading…
Reference in New Issue