Add orientation info and allow user to rotate TGO

- Give user information about the heading of a TGO
- Add a button to change the heading to head to conflic
- Change the orientation of a TGO during Buy
- Run the heading to conflict calculation to change the orientation of the newly bought group. It will then head to the center of the conflict
This commit is contained in:
RndName
2022-03-22 19:43:55 +01:00
parent 274f689f70
commit bbb08aa1db
5 changed files with 68 additions and 5 deletions

View File

@@ -260,6 +260,18 @@ class TheaterGroundObject(MissionTarget, SidcDescribable, ABC):
return group
return None
def rotate(self, heading: Heading) -> None:
"""Rotate the whole TGO clockwise to the new heading"""
rotation = heading - self.heading
if rotation.degrees < 0:
rotation = Heading.from_degrees(rotation.degrees + 360)
self.heading = heading
# Rotate the whole TGO to match the new heading
for unit in self.units:
unit.position.heading += rotation
unit.position.rotate(self.position, rotation)
class BuildingGroundObject(TheaterGroundObject):
def __init__(