mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add rmul to distance and speeds, so that reversed operands work
This commit is contained in:
parent
08365bcbda
commit
8f5b6f58d1
@ -62,6 +62,8 @@ class Distance:
|
|||||||
def __mul__(self, other: Union[float, int]) -> Distance:
|
def __mul__(self, other: Union[float, int]) -> Distance:
|
||||||
return meters(self.meters * other)
|
return meters(self.meters * other)
|
||||||
|
|
||||||
|
__rmul__ = __mul__
|
||||||
|
|
||||||
def __truediv__(self, other: Union[float, int]) -> Distance:
|
def __truediv__(self, other: Union[float, int]) -> Distance:
|
||||||
return meters(self.meters / other)
|
return meters(self.meters / other)
|
||||||
|
|
||||||
@ -147,6 +149,8 @@ class Speed:
|
|||||||
def __mul__(self, other: Union[float, int]) -> Speed:
|
def __mul__(self, other: Union[float, int]) -> Speed:
|
||||||
return kph(self.kph * other)
|
return kph(self.kph * other)
|
||||||
|
|
||||||
|
__rmul__ = __mul__
|
||||||
|
|
||||||
def __truediv__(self, other: Union[float, int]) -> Speed:
|
def __truediv__(self, other: Union[float, int]) -> Speed:
|
||||||
return kph(self.kph / other)
|
return kph(self.kph / other)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user