-
Notifications
You must be signed in to change notification settings - Fork 1
/
structures.py
95 lines (72 loc) · 2.04 KB
/
structures.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
84
85
86
87
88
89
90
91
92
93
94
95
# coding: utf-8
from collections import namedtuple
from typing import Optional
from il2fb.commons.spatial import Point2D, Point3D
from il2fb.commons.structures import BaseStructure
from .constants import HouseStatus
PreparsedActorPosition = namedtuple(
'PreparsedActorPosition', ['index', 'data'],
)
class ActorPosition(BaseStructure):
def __repr__(self) -> str:
return f"{self.__class__.__name__}({self.to_primitive()})"
class MovingAircraftPosition(ActorPosition):
__slots__ = ['index', 'id', 'pos', 'is_human', 'member_index', ]
def __init__(
self,
index: int,
id: str,
is_human: bool,
member_index: Optional[int],
pos: Point3D,
):
self.index = index
self.id = id
self.pos = pos
self.is_human = is_human
self.member_index = member_index
class MovingGroundUnitPosition(ActorPosition):
__slots__ = ['index', 'id', 'member_index', 'pos', ]
def __init__(
self,
index: int,
id: str,
member_index: int,
pos: Point3D,
):
self.index = index
self.id = id
self.member_index = member_index
self.pos = pos
class ShipPosition(ActorPosition):
__slots__ = ['index', 'id', 'pos', 'is_stationary', ]
def __init__(
self,
index: int,
id: str,
is_stationary: bool,
pos: Point2D,
):
self.index = index
self.id = id
self.is_stationary = is_stationary
self.pos = pos
class StationaryObjectPosition(ActorPosition):
__slots__ = ['index', 'id', 'pos', ]
def __init__(self, index: int, id: str, pos: Point3D):
self.index = index
self.id = id
self.pos = pos
class HousePosition(ActorPosition):
__slots__ = ['index', 'id', 'pos', 'status', ]
def __init__(
self,
index: int,
id: str,
pos: Point2D,
status: HouseStatus,
):
self.index = index
self.id = id
self.pos = pos
self.status = status