mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Calculate orientation of specific TGOs automatically
This will allow to automatically calculate the orientation of TGOs which are required to head to the conflict if the campaign designer has not defined a specific heading in the campaign miz. This is for example required for silkworm, scuds or some SAM systems like the SA-11. Added the should_head_to_conflict property to the TGO
This commit is contained in:
12
game/game.py
12
game/game.py
@@ -286,6 +286,18 @@ class Game:
|
||||
for tgo in control_point.connected_objectives:
|
||||
self.db.tgos.add(tgo.id, tgo)
|
||||
|
||||
# Correct the heading of specifc TGOs, can only be done after init turn 0
|
||||
for tgo in self.theater.ground_objects:
|
||||
# If heading is 0 then we change the orientation to head towards the
|
||||
# closest conflict. Heading of 0 means that the campaign designer wants
|
||||
# to determine the heading automatically by liberation. Values other
|
||||
# than 0 mean it is custom defined.
|
||||
if tgo.should_head_to_conflict and tgo.heading.degrees == 0:
|
||||
# Calculate the heading to conflict
|
||||
heading = self.theater.heading_to_conflict_from(tgo.position)
|
||||
# Rotate the whole TGO with the new heading
|
||||
tgo.rotate(heading or tgo.heading)
|
||||
|
||||
self.blue.preinit_turn_0()
|
||||
self.red.preinit_turn_0()
|
||||
# We don't need to actually stream events for turn zero because we haven't given
|
||||
|
||||
Reference in New Issue
Block a user