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

@@ -27,8 +27,6 @@ from game.layout.layout import (
TgoLayout,
TgoLayoutGroup,
)
from game.server import EventStream
from game.sim.gameupdateevents import GameUpdateEvents
from game.theater import TheaterGroundObject
from game.theater.theatergroundobject import (
EwrGroundObject,
@@ -36,7 +34,6 @@ from game.theater.theatergroundobject import (
VehicleGroupGroundObject,
)
from qt_ui.uiconstants import EVENT_ICONS
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
@dataclass
@@ -208,6 +205,12 @@ class QGroundObjectTemplateLayout(QGroupBox):
# Something went wrong. Buy button should be disabled!
logging.error("Not enough money to buy the group")
return
# Change the heading of the new group to head to the conflict
self.ground_object.heading = (
self.game.theater.heading_to_conflict_from(self.ground_object.position)
or self.ground_object.heading
)
self.game.blue.budget -= price - self.current_group_value
self.ground_object.groups = []
for group_name, groups in self.layout_model.groups.items():