This repository has been archived by the owner on Dec 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
object_manager.py
159 lines (131 loc) · 3.72 KB
/
object_manager.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
"""
IronicMTA object manager
"""
from .vectors import Vector3
from typing import Literal, Tuple
T = Literal[True]
class Dimension:
def __init__(self, id: int) -> None:
self._id = id
@property
def id(self) -> int:
return self._id
class Interior:
def __init__(self, id: int) -> None:
self._id = id
@property
def id(self) -> int:
return self._id
@property
def name(self) -> str:
return ""
class ElementID(object):
def __init__(self, value: int) -> None:
self.value = value
class ObjBase(object):
"""
Base objects for any object
"""
def __init__(
self,
__id: ElementID,
position: Vector3,
rotation: Vector3,
dimension: int | float = 0,
interior: int | float = 1,
alpha: float | int = 100,
isfrozen: bool = False,
) -> None:
self.__id = __id
self._position = position
self._rotation = rotation
self._dimension = dimension
self._interior = interior
self._alpha = alpha
self._isfrozen = isfrozen
def getID(self) -> ElementID:
return self.__id
def setPosition(self, position: Vector3) -> T:
"""
Set Player Position
`Params:` Vector3
>>> myobj.setPosition(Vector3(0, 0, 5))
"""
self._position = position
assert self._position == position
return True
def setRotation(self, rotation: Vector3) -> T:
"""
Set Object rotation
`Params:` Vector3
>>> myobj.setRotation(Vector3(0, 0, 5))
"""
self._rotation = rotation
assert self._rotation == rotation
return True
def setDimension(self, dimension: Dimension) -> T:
"""
Set Object dimension
`Params:` Dimension
>>> myobj.setRotation(Vector3(0, 0, 5))
"""
self._dimension = dimension
assert self._dimension == dimension
return True
def getDimension(self) -> int:
"""
Get Object Dimension
>>> dimension = myobj.getDimension()
"""
return self._dimension
def getInterior(self) -> int:
"""
Get Object Interior
>>> interior = myobj.getInterior()
"""
return self._interior
def getPosition(self) -> Vector3:
"""
Get Player Position
>>> position = myobj.getPosition()
"""
return self._position
def getRotation(self) -> Vector3:
"""
Get Player Rotation
>>> roration = myobj.getRotation()
"""
return self._rotation
def getDimension(self) -> Vector3:
"""
Get Player Dimension
>>> dimension = myobj.getDimension()
"""
return self._rotation
class Object(ObjBase):
def __init__(
self,
position: Vector3,
rotation: Vector3,
dimension: int | float = 0,
interior: int | float = 1,
scale: float | int = 1,
alpha: float | int = 100,
isfrozen: bool = False
) -> None:
super(Object, self).__init__(
position,
rotation,
dimension,
interior,
alpha,
isfrozen
)
class Color:
def __init__(self, red: float | int, green: float | int, blue: float | int, alpha: float | int) -> None:
self.red = red
self.green = green
self.blue = blue
self.alpha = alpha
def get(self) -> Tuple[float | int, float | int, float | int, float | int]:
return (self.red, self.green, self.blue, self.alpha)