Completed
Push — master ( 4d01d8...bd7567 )
by Oleksandr
01:05
created

il2fb.parsers.mission.Point3D   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%
Metric Value
wmc 2
dl 0
loc 10
ccs 8
cts 8
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A il2fb.parsers.mission.StaticCamera.__init__() 0 3 1
1
# -*- coding: utf-8 -*-
2
3 1
from il2fb.commons.structures import BaseStructure
4
5
6 1
class GroundRoutePoint(BaseStructure):
7 1
    __slots__ = ['pos', 'is_checkpoint', 'delay', 'section_length', 'speed', ]
8
9 1
    def __init__(self, pos, is_checkpoint, delay=None, section_length=None,
10
                 speed=None):
11 1
        self.pos = pos
12 1
        self.is_checkpoint = is_checkpoint
13 1
        self.delay = delay
14 1
        self.section_length = section_length
15 1
        self.speed = speed
16
17 1
    def __repr__(self):
18 1
        return "<GroundRoutePoint '{0};{1}'>".format(self.pos.x, self.pos.y)
19
20
21 1
class Building(BaseStructure):
22 1
    __slots__ = ['id', 'belligerent', 'code', 'pos', 'rotation_angle', ]
23
24 1
    def __init__(self, id, belligerent, code, pos, rotation_angle):
25 1
        self.id = id
26 1
        self.belligerent = belligerent
27 1
        self.code = code
28 1
        self.pos = pos
29 1
        self.rotation_angle = rotation_angle
30
31 1
    def __repr__(self):
32 1
        return "<Building '{0}'>".format(self.id)
33
34
35 1
class StaticCamera(BaseStructure):
36 1
    __slots__ = ['belligerent', 'pos', ]
37
38 1
    def __init__(self, belligerent, pos):
39 1
        self.belligerent = belligerent
40 1
        self.pos = pos
41
42 1
    def __repr__(self):
43 1
        return (
44
            "<StaticCamera '{0};{1};{2}'>"
45
            .format(self.pos.x, self.pos.y, self.pos.z)
46
        )
47
48
49 1
class FrontMarker(BaseStructure):
50 1
    __slots__ = ['id', 'belligerent', 'pos', ]
51
52 1
    def __init__(self, id, belligerent, pos):
53 1
        self.id = id
54 1
        self.belligerent = belligerent
55 1
        self.pos = pos
56
57 1
    def __repr__(self):
58 1
        return "<FrontMarker '{0}'>".format(self.id)
59
60
61 1
class Rocket(BaseStructure):
62 1
    __slots__ = [
63
        'id', 'code', 'belligerent', 'pos', 'rotation_angle', 'delay', 'count',
64
        'period', 'destination',
65
    ]
66
67 1
    def __init__(self, id, code, belligerent, pos, rotation_angle, delay,
68
                 count, period, destination):
69 1
        self.id = id
70 1
        self.code = code
71 1
        self.belligerent = belligerent
72 1
        self.pos = pos
73 1
        self.rotation_angle = rotation_angle
74 1
        self.delay = delay
75 1
        self.count = count
76 1
        self.period = period
77 1
        self.destination = destination
78
79 1
    def __repr__(self):
80 1
        return "<Rocket '{0}'>".format(self.id)
81
82
83 1
class StationaryObject(BaseStructure):
84 1
    __slots__ = [
85
        'id', 'belligerent', 'code', 'pos', 'rotation_angle', 'type',
86
    ]
87
88 1
    def __init__(self, id, belligerent, code, pos, rotation_angle, type):
89 1
        self.id = id
90 1
        self.belligerent = belligerent
91 1
        self.code = code
92 1
        self.pos = pos
93 1
        self.rotation_angle = rotation_angle
94 1
        self.type = type
95
96 1
    def __repr__(self):
97 1
        return "<StationaryObject '{0}'>".format(self.id)
98
99
100 1
class StationaryArtillery(StationaryObject):
101 1
    __slots__ = StationaryObject.__slots__ + [
102
        'awakening_time', 'range', 'skill', 'use_spotter',
103
    ]
104
105 1
    def __init__(self, id, belligerent, code, pos, rotation_angle, type,
106
                 awakening_time, range, skill, use_spotter):
107 1
        super(StationaryArtillery, self).__init__(
108
            id, belligerent, code, pos, rotation_angle, type)
109 1
        self.awakening_time = awakening_time
110 1
        self.range = range
111 1
        self.skill = skill
112 1
        self.use_spotter = use_spotter
113
114
115 1
class StationaryAircraft(StationaryObject):
116 1
    __slots__ = StationaryObject.__slots__ + [
117
        'air_force', 'allows_spawning', 'is_restorable', 'skin',
118
        'show_markings',
119
    ]
120
121 1
    def __init__(self, id, belligerent, code, pos, rotation_angle, type,
122
                 air_force, allows_spawning, is_restorable, skin,
123
                 show_markings):
124 1
        super(StationaryAircraft, self).__init__(
125
            id, belligerent, code, pos, rotation_angle, type)
126 1
        self.air_force = air_force
127 1
        self.allows_spawning = allows_spawning
128 1
        self.is_restorable = is_restorable
129 1
        self.skin = skin
130 1
        self.show_markings = show_markings
131
132
133 1
class StationaryShip(StationaryObject):
134 1
    __slots__ = StationaryObject.__slots__ + [
135
        'awakening_time', 'recharge_time', 'skill',
136
    ]
137
138 1
    def __init__(self, id, belligerent, code, pos, rotation_angle, type,
139
                 awakening_time, recharge_time, skill):
140 1
        super(StationaryShip, self).__init__(
141
            id, belligerent, code, pos, rotation_angle, type)
142 1
        self.awakening_time = awakening_time
143 1
        self.recharge_time = recharge_time
144 1
        self.skill = skill
145
146
147 1
class FlightRoutePoint(BaseStructure):
148 1
    __slots__ = ['type', 'pos', 'speed', 'formation', 'radio_silence', ]
149
150 1
    def __init__(self, type, pos, speed, formation, radio_silence):
151 1
        self.type = type
152 1
        self.pos = pos
153 1
        self.speed = speed
154 1
        self.formation = formation
155 1
        self.radio_silence = radio_silence
156
157 1
    def __repr__(self):
158 1
        return (
159
            "<FlightRoutePoint '{0};{1};{2}'>"
160
            .format(self.pos.x, self.pos.y, self.pos.z)
161
        )
162
163
164 1
class FlightRouteTakeoffPoint(FlightRoutePoint):
165 1
    __slots__ = FlightRoutePoint.__slots__ + ['delay', 'spacing', ]
166
167 1
    def __init__(self, type, pos, speed, formation, radio_silence, delay,
168
                 spacing):
169 1
        super(FlightRouteTakeoffPoint, self).__init__(
170
            type, pos, speed, formation, radio_silence)
171 1
        self.delay = delay
172 1
        self.spacing = spacing
173
174
175 1
class FlightRoutePatrolPoint(FlightRoutePoint):
176 1
    __slots__ = FlightRoutePoint.__slots__ + [
177
        'patrol_cycles', 'patrol_timeout',
178
        'pattern_angle', 'pattern_side_size', 'pattern_altitude_difference',
179
    ]
180
181 1
    def __init__(self, type, pos, speed, formation, radio_silence,
182
                 patrol_cycles, patrol_timeout, pattern_angle,
183
                 pattern_side_size, pattern_altitude_difference):
184 1
        super(FlightRoutePatrolPoint, self).__init__(
185
            type, pos, speed, formation, radio_silence)
186 1
        self.patrol_cycles = patrol_cycles
187 1
        self.patrol_timeout = patrol_timeout
188 1
        self.pattern_angle = pattern_angle
189 1
        self.pattern_side_size = pattern_side_size
190 1
        self.pattern_altitude_difference = pattern_altitude_difference
191
192
193 1
class FlightRouteAttackPoint(FlightRoutePoint):
194 1
    __slots__ = FlightRoutePoint.__slots__ + [
195
        'target_id', 'target_route_point',
196
    ]
197
198 1
    def __init__(self, type, pos, speed, formation, radio_silence, target_id,
199
                 target_route_point):
200 1
        super(FlightRouteAttackPoint, self).__init__(
201
            type, pos, speed, formation, radio_silence)
202 1
        self.target_id = target_id
203
        self.target_route_point = target_route_point
204