-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeyboardMouseEmulator.py
More file actions
27 lines (20 loc) · 967 Bytes
/
KeyboardMouseEmulator.py
File metadata and controls
27 lines (20 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import pydirectinput
import keyboard
import pyinsim
SPARE_KEY = "m"
def use_keyboard_collision_warning(game_object):
game_object.insim.send(pyinsim.ISP_MST,
Msg=b"/key " + game_object.settings.SPARE_KEY_1.encode() + b" brake")
game_object.insim.send(pyinsim.ISP_MST,
Msg=b"/key " + game_object.settings.SPARE_KEY_2.encode() + b" throttle")
pydirectinput.keyDown(SPARE_KEY)
if not game_object.holding_brake:
game_object.holding_brake = True
def release_brake(game_object):
if game_object.holding_brake:
game_object.insim.send(pyinsim.ISP_MST,
Msg=b"/key " + game_object.settings.BRAKE_KEY.encode() + b" brake")
game_object.insim.send(pyinsim.ISP_MST,
Msg=b"/key " + game_object.settings.ACC_KEY.encode() + b" throttle")
pydirectinput.keyUp(SPARE_KEY)
game_object.holding_brake = False