-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathon_track_repair.py
83 lines (53 loc) · 1.92 KB
/
on_track_repair.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# ASSETTO CORSA ON-TRACK REPAIRS
#
# This app allows you to fix your car without having to restart from the box,
# which could be useful on large open-world maps
#
# -- MediJaster --
import ac, acsys, itertools
from third_party.sim_info import SimInfo, c_float
from random import randint
info = SimInfo()
app_name = "On Track Repair"
width, height = 200 , 170 # Window x,y
def acMain(ac_version):
# Actual App Object
global appWindow
appWindow = ac.newApp(app_name)
ac.setTitle(appWindow, app_name)
ac.setSize(appWindow, width, height)
# Variables
global title_labels, value_labels, car_repair_array
car_repair_array = (c_float * 5)(0,0,0,0,0)
title_labels_text = ["Front Bumper", "Rear Bumper", "Left Skirt", "Right Skirt"]
title_labels, value_labels = [], []
default_string = "0"
# Title Labels
increment = 30
x_pos = 20
y_pos = 40
for label in title_labels_text:
current_label = ac.addLabel(appWindow, label)
ac.setPosition(current_label, x_pos, y_pos)
y_pos += increment
title_labels.append(current_label)
# Number Labels
x_pos = 180
y_pos = 40
value_labels = []
for label in title_labels_text:
current_label = ac.addLabel(appWindow, default_string)
ac.setPosition(current_label, x_pos, y_pos)
ac.setFontAlignment(current_label, "right")
y_pos += increment
value_labels.append(current_label)
ac.addRenderCallback(appWindow, acUpdate) # -> links this app's window to an OpenGL render function
return app_name
def acUpdate(deltaT):
physics_struct = info.physics
damage_list = physics_struct.carDamage
for (label, part_damage) in zip(value_labels, damage_list):
ac.setText(label,str(round(part_damage,2)))
physics_struct.carDamage = car_repair_array
info._acpmf_physics[:] = physics_struct
info._acpmf_physics.flush()