Added some expansions

pull/11/head
Nicholas Hope 2022-06-22 13:17:38 -04:00
parent 4953d787d7
commit b5b6fe8da3
1 changed files with 54 additions and 1 deletions

View File

@ -38,11 +38,64 @@ def branch(keyName, bindContent, bindType):
return repeat(keyName, bindContent)
def impulse(key, instruction):
splitCommand = instruction.split(' ')
cmd = splitCommand[0]
shortcuts = {
"primary": "slot1",
"secondary": "slot2",
"melee": "slot3"
}
if cmd in shortcuts:
for sc, expansion in shortcuts.items():
if cmd == shortcut:
splitCommand[0] = expansion
break
instruction = ' '.join(splitCommand)
restOfCmd = ' '.join(splitCommand[1:])
if cmd == "voice":
instruction = voice(restOfCmd)
elif cmd == "build":
instruction = "build "+expandBuildings(restOfCmd)
elif cmd == "destroy":
instruction = "destroy "+expandBuildings(restOfCmd)
return f'bind {key} {instruction}\n'
def voice(keyword):
keyword = keyword.lower()
allLists = [
["medic", "thanks", "go", "move up", "go left", "go right", "yes", "no", "pass to me"],
["incoming", "spy", "sentry ahead", "teleporter here", "dispenser here", "sentry here", "uber (ask)", "uber (ready)"],
["help", "battle cry", "cheers", "jeers", "positive", "negative", "nice shot", "good job"]
]
for menu, voiceList in enumerate(allLists):
for selection, shortcut in enumerate(voiceList):
if keyword == shortcut:
return f'voicemenu {menu} {selection}'
def expandBuildings(building):
buildingNums = {
"dispenser": "0 0",
"entrance": "1 0",
"exit": "1 1",
"sentry": "2 0"
}
for shortBuild, num in buildingNums.items():
if building == shortBuild:
return num
def simpleHold(key, instruction):
# This isn't quite right, fix later!
return f'bind {key} +{instruction}\n'
if instruction[0] != '+':
return f'bind {key} +{instruction}\n'
else:
return f'bind {key} {instruction}\n'
# return f'placeholder for {key} (single instruction hold)\n'
def listHold(key, options):