mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
WIP for possibility to select player and ennemy faction
This commit is contained in:
374
gen/aaa.py
374
gen/aaa.py
@@ -52,7 +52,7 @@ def determine_positions(position, heading, num_units, launcher_distance, coverag
|
||||
|
||||
|
||||
def aaa_vehicle_group(self, country, name, _type: unittype.VehicleType, position: mapping.Point,
|
||||
heading=0, group_size=1,
|
||||
heading=0,
|
||||
formation=unitgroup.VehicleGroup.Formation.Line,
|
||||
move_formation: PointAction=PointAction.OffRoad):
|
||||
"""
|
||||
@@ -62,208 +62,208 @@ def aaa_vehicle_group(self, country, name, _type: unittype.VehicleType, position
|
||||
"""
|
||||
vg = unitgroup.VehicleGroup(self.next_group_id(), self.string(name))
|
||||
|
||||
for i in range(1, group_size + 1):
|
||||
heading = randint(0, 359)
|
||||
if _type == AirDefence.SAM_SA_3_S_125_LN_5P73:
|
||||
# 4 launchers (180 degrees all facing the same direction), 1 SR, 1 TR
|
||||
num_launchers = 4
|
||||
# search radar
|
||||
heading = randint(0, 359)
|
||||
if _type == AirDefence.SAM_SA_3_S_125_LN_5P73:
|
||||
# 4 launchers (180 degrees all facing the same direction), 1 SR, 1 TR
|
||||
num_launchers = 4
|
||||
# search radar
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=1),
|
||||
AirDefence.SAM_SR_P_19,
|
||||
)
|
||||
v.position.x = position.x
|
||||
v.position.y = position.y
|
||||
v.heading = heading
|
||||
vg.add_unit(v)
|
||||
# track radar
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=2),
|
||||
AirDefence.SAM_SA_3_S_125_TR_SNR,
|
||||
)
|
||||
|
||||
center_x = position.x + randint(20, 40)
|
||||
center_y = position.y
|
||||
|
||||
v.position.x = center_x
|
||||
v.position.y = center_y
|
||||
v.heading = heading
|
||||
vg.add_unit(v)
|
||||
plop_positions = determine_positions(
|
||||
position,
|
||||
heading,
|
||||
num_launchers,
|
||||
launcher_distance=100,
|
||||
coverage=180,
|
||||
)
|
||||
for x in range(0, num_launchers):
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=i),
|
||||
AirDefence.SAM_SR_P_19,
|
||||
name + " Unit #{nr}".format(nr=3+x),
|
||||
AirDefence.SAM_SA_3_S_125_LN_5P73,
|
||||
)
|
||||
v.position.x = position.x
|
||||
v.position.y = position.y + (i - 1) * 20
|
||||
v.heading = heading
|
||||
|
||||
v.position.x = plop_positions[x][0]
|
||||
v.position.y = plop_positions[x][1]
|
||||
v.heading = plop_positions[x][2]
|
||||
vg.add_unit(v)
|
||||
# track radar
|
||||
|
||||
elif _type == AirDefence.SAM_SA_6_Kub_LN_2P25:
|
||||
# 6 launchers (360 degree coverage)
|
||||
# 1 S/TR
|
||||
# search/track radar
|
||||
num_launchers = 6
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=1),
|
||||
AirDefence.SAM_SA_6_Kub_STR_9S91,
|
||||
)
|
||||
v.position.x = position.x
|
||||
v.position.y = position.y
|
||||
v.heading = heading
|
||||
vg.add_unit(v)
|
||||
|
||||
plop_positions = determine_positions(
|
||||
position,
|
||||
heading,
|
||||
num_launchers,
|
||||
launcher_distance=100,
|
||||
coverage=360,
|
||||
)
|
||||
for x in range(0, num_launchers):
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=i),
|
||||
AirDefence.SAM_SA_3_S_125_TR_SNR,
|
||||
name + " Unit #{nr}".format(nr=1+x),
|
||||
AirDefence.SAM_SA_6_Kub_LN_2P25,
|
||||
)
|
||||
|
||||
center_x = position.x + randint(20, 40)
|
||||
center_y = position.y + (i - 1) * 20
|
||||
|
||||
v.position.x = center_x
|
||||
v.position.y = center_y
|
||||
v.heading = heading
|
||||
v.position.x = plop_positions[x][0]
|
||||
v.position.y = plop_positions[x][1]
|
||||
v.heading = plop_positions[x][2]
|
||||
vg.add_unit(v)
|
||||
plop_positions = determine_positions(
|
||||
position,
|
||||
heading,
|
||||
num_launchers,
|
||||
launcher_distance=100,
|
||||
coverage=180,
|
||||
)
|
||||
for x in range(0, num_launchers):
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=i),
|
||||
AirDefence.SAM_SA_3_S_125_LN_5P73,
|
||||
)
|
||||
elif _type == AirDefence.SAM_SA_10_S_300PS_LN_5P85C:
|
||||
# 8 launchers - 4 directions, two in each direction
|
||||
# 1 SR (offset)
|
||||
# 1 TR (center)
|
||||
# search radar
|
||||
num_launchers = 8
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=1),
|
||||
AirDefence.SAM_SA_10_S_300PS_SR_5N66M,
|
||||
)
|
||||
v.position.x = position.x
|
||||
v.position.y = position.y
|
||||
v.heading = heading
|
||||
vg.add_unit(v)
|
||||
# track radar
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=2),
|
||||
AirDefence.SAM_SA_10_S_300PS_TR_30N6,
|
||||
)
|
||||
|
||||
v.position.x = plop_positions[x][0]
|
||||
v.position.y = plop_positions[x][1]
|
||||
v.heading = plop_positions[x][2]
|
||||
vg.add_unit(v)
|
||||
center_x = position.x + randint(20, 40)
|
||||
center_y = position.y
|
||||
|
||||
elif _type == AirDefence.SAM_SA_6_Kub_LN_2P25:
|
||||
# 6 launchers (360 degree coverage)
|
||||
# 1 S/TR
|
||||
# search/track radar
|
||||
num_launchers = 6
|
||||
v.position.x = center_x
|
||||
v.position.y = center_y
|
||||
v.heading = heading
|
||||
vg.add_unit(v)
|
||||
# command center
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=3),
|
||||
AirDefence.SAM_SA_10_S_300PS_CP_54K6,
|
||||
)
|
||||
|
||||
center_x = position.x + randint(40, 60)
|
||||
center_y = position.y
|
||||
|
||||
v.position.x = center_x
|
||||
v.position.y = center_y
|
||||
v.heading = heading
|
||||
vg.add_unit(v)
|
||||
|
||||
plop_positions = determine_positions(
|
||||
position,
|
||||
heading,
|
||||
num_launchers,
|
||||
launcher_distance=150,
|
||||
coverage=360,
|
||||
)
|
||||
for x in range(0, num_launchers):
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=i),
|
||||
AirDefence.SAM_SA_6_Kub_STR_9S91,
|
||||
name + " Unit #{nr}".format(nr=3+x),
|
||||
AirDefence.SAM_SA_10_S_300PS_LN_5P85C,
|
||||
)
|
||||
v.position.x = position.x
|
||||
v.position.y = position.y + (i - 1) * 20
|
||||
v.heading = heading
|
||||
|
||||
v.position.x = plop_positions[x][0]
|
||||
v.position.y = plop_positions[x][1]
|
||||
v.heading = plop_positions[x][2]
|
||||
vg.add_unit(v)
|
||||
|
||||
plop_positions = determine_positions(
|
||||
position,
|
||||
heading,
|
||||
num_launchers,
|
||||
launcher_distance=100,
|
||||
coverage=360,
|
||||
)
|
||||
for x in range(0, num_launchers):
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=i),
|
||||
AirDefence.SAM_SA_6_Kub_LN_2P25,
|
||||
)
|
||||
elif _type == AirDefence.SAM_SA_10_S_300PS_CP_54K6:
|
||||
# 8 launchers - 4 directions, two in each direction
|
||||
# 1 SR (offset)
|
||||
# 1 TR (center)
|
||||
# search radar
|
||||
num_launchers = 8
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=1),
|
||||
AirDefence.SAM_SA_10_S_300PS_SR_64H6E,
|
||||
)
|
||||
v.position.x = position.x
|
||||
v.position.y = position.y
|
||||
v.heading = heading
|
||||
vg.add_unit(v)
|
||||
# track radar
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=2),
|
||||
AirDefence.SAM_SA_10_S_300PS_TR_30N6,
|
||||
)
|
||||
|
||||
v.position.x = plop_positions[x][0]
|
||||
v.position.y = plop_positions[x][1]
|
||||
v.heading = plop_positions[x][2]
|
||||
vg.add_unit(v)
|
||||
elif _type == AirDefence.SAM_SA_10_S_300PS_LN_5P85C:
|
||||
# 8 launchers - 4 directions, two in each direction
|
||||
# 1 SR (offset)
|
||||
# 1 TR (center)
|
||||
# search radar
|
||||
num_launchers = 8
|
||||
center_x = position.x + randint(20, 40)
|
||||
center_y = position.y
|
||||
|
||||
v.position.x = center_x
|
||||
v.position.y = center_y
|
||||
v.heading = heading
|
||||
vg.add_unit(v)
|
||||
# command center
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=3),
|
||||
AirDefence.SAM_SA_10_S_300PS_CP_54K6,
|
||||
)
|
||||
|
||||
center_x = position.x + randint(40, 60)
|
||||
center_y = position.y
|
||||
|
||||
v.position.x = center_x
|
||||
v.position.y = center_y
|
||||
v.heading = heading
|
||||
vg.add_unit(v)
|
||||
|
||||
plop_positions = determine_positions(
|
||||
position,
|
||||
heading,
|
||||
num_units=num_launchers,
|
||||
launcher_distance=150,
|
||||
coverage=360,
|
||||
)
|
||||
for x in range(0, num_launchers):
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=i),
|
||||
AirDefence.SAM_SA_10_S_300PS_SR_5N66M,
|
||||
name + " Unit #{nr}".format(nr=3+x),
|
||||
AirDefence.SAM_SA_10_S_300PS_LN_5P85D,
|
||||
)
|
||||
v.position.x = position.x
|
||||
v.position.y = position.y + (i - 1) * 20
|
||||
v.heading = heading
|
||||
vg.add_unit(v)
|
||||
# track radar
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=i),
|
||||
AirDefence.SAM_SA_10_S_300PS_TR_30N6,
|
||||
)
|
||||
|
||||
center_x = position.x + randint(20, 40)
|
||||
center_y = position.y + (i - 1) * 20
|
||||
|
||||
v.position.x = center_x
|
||||
v.position.y = center_y
|
||||
v.heading = heading
|
||||
vg.add_unit(v)
|
||||
# command center
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=i),
|
||||
AirDefence.SAM_SA_10_S_300PS_CP_54K6,
|
||||
)
|
||||
|
||||
center_x = position.x + randint(40, 60)
|
||||
center_y = position.y + (i - 1) * 20
|
||||
|
||||
v.position.x = center_x
|
||||
v.position.y = center_y
|
||||
v.heading = heading
|
||||
vg.add_unit(v)
|
||||
|
||||
plop_positions = determine_positions(
|
||||
position,
|
||||
heading,
|
||||
num_launchers,
|
||||
launcher_distance=150,
|
||||
coverage=360,
|
||||
)
|
||||
for x in range(0, num_launchers):
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=i),
|
||||
AirDefence.SAM_SA_10_S_300PS_LN_5P85C,
|
||||
)
|
||||
|
||||
v.position.x = plop_positions[x][0]
|
||||
v.position.y = plop_positions[x][1]
|
||||
v.heading = plop_positions[x][2]
|
||||
vg.add_unit(v)
|
||||
|
||||
elif _type == AirDefence.SAM_SA_10_S_300PS_CP_54K6:
|
||||
# 8 launchers - 4 directions, two in each direction
|
||||
# 1 SR (offset)
|
||||
# 1 TR (center)
|
||||
# search radar
|
||||
num_launchers = 8
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=i),
|
||||
AirDefence.SAM_SA_10_S_300PS_SR_64H6E,
|
||||
)
|
||||
v.position.x = position.x
|
||||
v.position.y = position.y + (i - 1) * 20
|
||||
v.heading = heading
|
||||
vg.add_unit(v)
|
||||
# track radar
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=i),
|
||||
AirDefence.SAM_SA_10_S_300PS_TR_30N6,
|
||||
)
|
||||
|
||||
center_x = position.x + randint(20, 40)
|
||||
center_y = position.y + (i - 1) * 20
|
||||
|
||||
v.position.x = center_x
|
||||
v.position.y = center_y
|
||||
v.heading = heading
|
||||
vg.add_unit(v)
|
||||
# command center
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=i),
|
||||
AirDefence.SAM_SA_10_S_300PS_CP_54K6,
|
||||
)
|
||||
|
||||
center_x = position.x + randint(40, 60)
|
||||
center_y = position.y + (i - 1) * 20
|
||||
|
||||
v.position.x = center_x
|
||||
v.position.y = center_y
|
||||
v.heading = heading
|
||||
vg.add_unit(v)
|
||||
|
||||
plop_positions = determine_positions(
|
||||
position,
|
||||
heading,
|
||||
num_units=num_launchers,
|
||||
launcher_distance=150,
|
||||
coverage=360,
|
||||
)
|
||||
for x in range(0, num_launchers):
|
||||
v = self.vehicle(
|
||||
name + " Unit #{nr}".format(nr=i),
|
||||
AirDefence.SAM_SA_10_S_300PS_LN_5P85D,
|
||||
)
|
||||
|
||||
v.position.x = plop_positions[x][0]
|
||||
v.position.y = plop_positions[x][1]
|
||||
v.heading = plop_positions[x][2]
|
||||
vg.add_unit(v)
|
||||
else:
|
||||
v = self.vehicle(name + " Unit #{nr}".format(nr=i), _type)
|
||||
v.position.x = position.x
|
||||
v.position.y = position.y + (i - 1) * 20
|
||||
v.heading = heading
|
||||
|
||||
v.position.x = plop_positions[x][0]
|
||||
v.position.y = plop_positions[x][1]
|
||||
v.heading = plop_positions[x][2]
|
||||
vg.add_unit(v)
|
||||
else:
|
||||
v = self.vehicle(name + " Unit #{nr}".format(nr=1), _type)
|
||||
v.position.x = position.x
|
||||
v.position.y = position.y # + (i - 1) * 20
|
||||
v.heading = heading
|
||||
vg.add_unit(v)
|
||||
|
||||
wp = vg.add_waypoint(vg.units[0].position, move_formation, 0)
|
||||
wp.ETA_locked = True
|
||||
|
||||
if _type.eplrs:
|
||||
wp.tasks.append(task.EPLRS(self.next_eplrs("vehicle")))
|
||||
|
||||
@@ -301,12 +301,12 @@ class AAConflictGenerator:
|
||||
|
||||
|
||||
class ExtraAAConflictGenerator:
|
||||
def __init__(self, mission: Mission, conflict: Conflict, game, player_name: Country, enemy_name: Country):
|
||||
def __init__(self, mission: Mission, conflict: Conflict, game, player_country: Country, enemy_country: Country):
|
||||
self.mission = mission
|
||||
self.game = game
|
||||
self.conflict = conflict
|
||||
self.player_name = player_name
|
||||
self.enemy_name = enemy_name
|
||||
self.player_country = player_country
|
||||
self.enemy_country = enemy_country
|
||||
|
||||
def generate(self):
|
||||
from theater.conflicttheater import ControlPoint
|
||||
@@ -327,7 +327,7 @@ class ExtraAAConflictGenerator:
|
||||
if cp.position.distance_to_point(self.conflict.position) > EXTRA_AA_MAX_DISTANCE:
|
||||
continue
|
||||
|
||||
country_name = cp.captured and self.player_name or self.enemy_name
|
||||
country_name = cp.captured and self.player_country or self.enemy_country
|
||||
position = cp.position.point_from_heading(0, EXTRA_AA_POSITION_FROM_CP)
|
||||
|
||||
self.mission.vehicle_group(
|
||||
|
||||
Reference in New Issue
Block a user