mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +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:
|
else:
|
||||||
return event.name == self.player_name
|
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):
|
def pass_turn(self, no_action=False, ignored_cps: typing.Collection[ControlPoint] = None):
|
||||||
logging.info("Pass turn")
|
logging.info("Pass turn")
|
||||||
self.informations.append(Information("End of turn #" + str(self.turn), "-" * 40, 0))
|
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)
|
self.setup_group_activation_trigger(flight, group)
|
||||||
|
|
||||||
def setup_group_activation_trigger(self, 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
|
group.late_activation = True
|
||||||
activation_trigger = TriggerOnce(Event.NoEvent, "LiberationActivationTriggerForGroup" + str(group.id))
|
activation_trigger = TriggerOnce(Event.NoEvent, "LiberationActivationTriggerForGroup" + str(group.id))
|
||||||
activation_trigger.add_condition(TimeAfter(seconds=flight.scheduled_in*60))
|
activation_trigger.add_condition(TimeAfter(seconds=flight.scheduled_in*60))
|
||||||
|
|
||||||
if(flight.from_cp.cptype == ControlPointType.AIRBASE):
|
if(flight.from_cp.cptype == ControlPointType.AIRBASE):
|
||||||
if not flight.from_cp.captured:
|
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:
|
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))
|
activation_trigger.add_action(ActivateGroup(group.id))
|
||||||
@ -475,11 +475,15 @@ class AircraftConflictGenerator:
|
|||||||
for point in flight.points:
|
for point in flight.points:
|
||||||
group.add_waypoint(Point(point.x,point.y), point.alt)
|
group.add_waypoint(Point(point.x,point.y), point.alt)
|
||||||
if not bombing_point_found:
|
if not bombing_point_found:
|
||||||
for t in point.targets:
|
for j, t in enumerate(point.targets):
|
||||||
if hasattr(t, "obj_name"):
|
if hasattr(t, "obj_name"):
|
||||||
buildings = self.game.theater.find_ground_objects_by_obj_name(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))
|
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:
|
else:
|
||||||
group.points[i].tasks.append(Bombing(t.position))
|
group.points[i].tasks.append(Bombing(t.position))
|
||||||
bombing_point_found = True
|
bombing_point_found = True
|
||||||
|
|||||||
@ -30,7 +30,7 @@ class FlightType(Enum):
|
|||||||
EWAR = 16
|
EWAR = 16
|
||||||
|
|
||||||
|
|
||||||
class FlightWaypoint():
|
class FlightWaypoint:
|
||||||
|
|
||||||
def __init__(self, x: float, y: float, alt=0):
|
def __init__(self, x: float, y: float, alt=0):
|
||||||
self.x = x
|
self.x = x
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user