1
|
|
|
""" |
2
|
|
|
Primitive actor data structures. |
3
|
|
|
|
4
|
|
|
""" |
5
|
|
|
|
6
|
1 |
|
from il2fb.commons.structures import BaseStructure |
7
|
|
|
|
8
|
|
|
|
9
|
1 |
|
class Actor(BaseStructure): |
10
|
|
|
|
11
|
|
|
def __repr__(self): |
12
|
|
|
return "<Actor>" |
13
|
|
|
|
14
|
|
|
|
15
|
1 |
|
class Human(Actor): |
16
|
1 |
|
__slots__ = ['callsign', ] |
17
|
|
|
|
18
|
1 |
|
def __init__(self, callsign): |
19
|
|
|
self.callsign = callsign |
20
|
|
|
|
21
|
|
|
def __repr__(self): |
22
|
|
|
return "<Human '{0}'>".format(self.callsign) |
23
|
|
|
|
24
|
|
|
|
25
|
1 |
|
class HumanAircraft(Human): |
26
|
1 |
|
__slots__ = Human.__slots__ + ['aircraft', ] |
27
|
|
|
|
28
|
1 |
|
def __init__(self, callsign, aircraft): |
29
|
|
|
super(HumanAircraft, self).__init__(callsign) |
30
|
|
|
self.aircraft = aircraft |
31
|
|
|
|
32
|
|
|
def __repr__(self): |
33
|
|
|
return "<Human aircraft '{0}:{1}'>".format(self.callsign, self.aircraft) |
34
|
|
|
|
35
|
|
|
|
36
|
1 |
|
class HumanAircraftCrewMember(HumanAircraft): |
37
|
1 |
|
__slots__ = HumanAircraft.__slots__ + ['index', ] |
38
|
|
|
|
39
|
1 |
|
def __init__(self, callsign, aircraft, index): |
40
|
|
|
super(HumanAircraftCrewMember, self).__init__(callsign, aircraft) |
41
|
|
|
self.index = index |
42
|
|
|
|
43
|
|
|
def __repr__(self): |
44
|
|
|
return ( |
45
|
|
|
"<Human aircraft crew member #{0} in '{1}:{2}'>" |
46
|
|
|
.format(self.index, self.callsign, self.aircraft) |
47
|
|
|
) |
48
|
|
|
|
49
|
|
|
|
50
|
1 |
|
class AIAircraft(Actor): |
51
|
1 |
|
__slots__ = ['flight', 'aircraft', ] |
52
|
|
|
|
53
|
1 |
|
def __init__(self, flight, aircraft): |
54
|
|
|
self.flight = flight |
55
|
|
|
self.aircraft = aircraft |
56
|
|
|
|
57
|
|
|
def __repr__(self): |
58
|
|
|
return "<AI aircraft '{0}:{1}'>".format(self.flight, self.aircraft) |
59
|
|
|
|
60
|
|
|
|
61
|
1 |
|
class AIAircraftCrewMember(AIAircraft): |
62
|
1 |
|
__slots__ = AIAircraft.__slots__ + ['index', ] |
63
|
|
|
|
64
|
1 |
|
def __init__(self, flight, aircraft, index): |
65
|
|
|
super(AIAircraftCrewMember, self).__init__(flight, aircraft) |
66
|
|
|
self.index = index |
67
|
|
|
|
68
|
|
|
def __repr__(self): |
69
|
|
|
return ( |
70
|
|
|
"<AI aircraft crew member #{0} in '{1}:{2}'>" |
71
|
|
|
.format(self.index, self.flight, self.aircraft) |
72
|
|
|
) |
73
|
|
|
|
74
|
|
|
|
75
|
1 |
|
class Unit(Actor): |
76
|
1 |
|
__slots__ = ['id', ] |
77
|
|
|
|
78
|
1 |
|
def __init__(self, id): |
79
|
|
|
self.id = id |
80
|
|
|
|
81
|
|
|
def __repr__(self): |
82
|
|
|
return "<Unit '{0}'>".format(self.id) |
83
|
|
|
|
84
|
|
|
|
85
|
1 |
|
class StationaryUnit(Unit): |
86
|
|
|
|
87
|
|
|
def __repr__(self): |
88
|
|
|
return "<Stationary unit '{0}'>".format(self.id) |
89
|
|
|
|
90
|
|
|
|
91
|
1 |
|
class MovingUnit(Unit): |
92
|
|
|
|
93
|
|
|
def __repr__(self): |
94
|
|
|
return "<Moving unit '{0}'>".format(self.id) |
95
|
|
|
|
96
|
|
|
|
97
|
1 |
|
class MovingUnitMember(MovingUnit): |
98
|
1 |
|
__slots__ = MovingUnit.__slots__ + ['index', ] |
99
|
|
|
|
100
|
1 |
|
def __init__(self, id, index): |
101
|
|
|
super(MovingUnitMember, self).__init__(id) |
102
|
|
|
self.index = index |
103
|
|
|
|
104
|
|
|
def __repr__(self): |
105
|
|
|
return "<Moving unit member #{0} in '{1}'>".format(self.index, self.id) |
106
|
|
|
|
107
|
|
|
|
108
|
1 |
|
class Building(Actor): |
109
|
1 |
|
__slots__ = ['name', ] |
110
|
|
|
|
111
|
1 |
|
def __init__(self, name): |
112
|
|
|
self.name = name |
113
|
|
|
|
114
|
|
|
def __repr__(self): |
115
|
|
|
return "<Building '{0}'>".format(self.name) |
116
|
|
|
|
117
|
|
|
|
118
|
1 |
|
class Bridge(Actor): |
119
|
1 |
|
__slots__ = ['id', ] |
120
|
|
|
|
121
|
1 |
|
def __init__(self, id): |
122
|
|
|
self.id = id |
123
|
|
|
|
124
|
|
|
def __repr__(self): |
125
|
|
|
return "<Bridge '{0}'>".format(self.id) |
126
|
|
|
|