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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#[derive(Copy, Clone)]
pub enum SystemState {
Class,
Seed,
Orders,
PositionX,
PositionY,
VelocityX,
VelocityY,
Heading,
AngularVelocity,
AccelerateX,
AccelerateY,
Torque,
Gun0Aim,
Gun0Fire,
Gun1Aim,
Gun1Fire,
Gun2Aim,
Gun2Fire,
Gun3Aim,
Gun3Fire,
Missile0Launch,
Missile0Orders,
Missile1Launch,
Missile1Orders,
Missile2Launch,
Missile2Orders,
Missile3Launch,
Missile3Orders,
Explode,
RadarHeading,
RadarWidth,
RadarContactFound,
RadarContactClass,
RadarContactPositionX,
RadarContactPositionY,
RadarContactVelocityX,
RadarContactVelocityY,
DebugTextPointer,
DebugTextLength,
MaxAccelerationX,
MaxAccelerationY,
MaxAngularAcceleration,
RadioChannel,
RadioSend,
RadioReceive,
DebugLinesPointer,
DebugLinesLength,
RadarMinDistance,
RadarMaxDistance,
CurrentTick,
Energy,
Size,
MaxSize = 128,
}
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum Class {
Fighter,
Frigate,
Cruiser,
Asteroid,
Target,
Missile,
Torpedo,
Unknown,
}
impl Class {
pub fn from_f64(v: f64) -> Class {
match v as u32 {
0 => Class::Fighter,
1 => Class::Frigate,
2 => Class::Cruiser,
3 => Class::Asteroid,
4 => Class::Target,
5 => Class::Missile,
6 => Class::Torpedo,
_ => Class::Unknown,
}
}
}
#[derive(Default, Clone)]
pub struct Line {
pub x0: f64,
pub y0: f64,
pub x1: f64,
pub y1: f64,
pub color: u32,
}