mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Nav Target point for JF-17 and F-14.
Fix activation trigger using wrong coalition when playing REDFOR side.
This commit is contained in:
parent
a022f9c2e1
commit
c73290eebb
12
game/game.py
12
game/game.py
@ -168,6 +168,18 @@ class Game:
|
||||
else:
|
||||
return event.name == self.player_name
|
||||
|
||||
def get_player_coalition_id(self):
|
||||
if self.player_country in db.BLUEFOR_FACTIONS:
|
||||
return 2
|
||||
else:
|
||||
return 1
|
||||
|
||||
def get_enemy_coalition_id(self):
|
||||
if self.get_player_coalition_id() == 1:
|
||||
return 2
|
||||
else:
|
||||
return 1
|
||||
|
||||
def pass_turn(self, no_action=False, ignored_cps: typing.Collection[ControlPoint] = None):
|
||||
logging.info("Pass turn")
|
||||
self.informations.append(Information("End of turn #" + str(self.turn), "-" * 40, 0))
|
||||
|
||||
@ -353,16 +353,16 @@ class AircraftConflictGenerator:
|
||||
self.setup_group_activation_trigger(flight, group)
|
||||
|
||||
def setup_group_activation_trigger(self, flight, group):
|
||||
if flight.scheduled_in > 0:
|
||||
if flight.scheduled_in > 0 and flight.client_count == 0:
|
||||
group.late_activation = True
|
||||
activation_trigger = TriggerOnce(Event.NoEvent, "LiberationActivationTriggerForGroup" + str(group.id))
|
||||
activation_trigger.add_condition(TimeAfter(seconds=flight.scheduled_in*60))
|
||||
|
||||
if(flight.from_cp.cptype == ControlPointType.AIRBASE):
|
||||
if not flight.from_cp.captured:
|
||||
activation_trigger.add_condition(CoalitionHasAirdrome(1, flight.from_cp.id))
|
||||
activation_trigger.add_condition(CoalitionHasAirdrome(self.game.get_player_coalition_id(), flight.from_cp.id))
|
||||
else:
|
||||
activation_trigger.add_condition(CoalitionHasAirdrome(2, flight.from_cp.id))
|
||||
activation_trigger.add_condition(CoalitionHasAirdrome(self.game.get_enemy_coalition_id(), flight.from_cp.id))
|
||||
|
||||
|
||||
activation_trigger.add_action(ActivateGroup(group.id))
|
||||
@ -475,11 +475,15 @@ class AircraftConflictGenerator:
|
||||
for point in flight.points:
|
||||
group.add_waypoint(Point(point.x,point.y), point.alt)
|
||||
if not bombing_point_found:
|
||||
for t in point.targets:
|
||||
for j, t in enumerate(point.targets):
|
||||
if hasattr(t, "obj_name"):
|
||||
buildings = self.game.theater.find_ground_objects_by_obj_name(t.obj_name)
|
||||
for building in buildings:
|
||||
for j, building in enumerate(buildings):
|
||||
group.points[i].tasks.append(Bombing(building.position))
|
||||
if group.units[0].unit_type == JF_17 and j < 4:
|
||||
group.add_nav_target_point(building.position, "PP" + str(j+1))
|
||||
if group.units[0].unit_type == F_14B and j == 0:
|
||||
group.add_nav_target_point(building.position, "ST")
|
||||
else:
|
||||
group.points[i].tasks.append(Bombing(t.position))
|
||||
bombing_point_found = True
|
||||
|
||||
@ -30,7 +30,7 @@ class FlightType(Enum):
|
||||
EWAR = 16
|
||||
|
||||
|
||||
class FlightWaypoint():
|
||||
class FlightWaypoint:
|
||||
|
||||
def __init__(self, x: float, y: float, alt=0):
|
||||
self.x = x
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user