mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fixed the bug of not generating opposing force ground unit groups at Pretense zones. Added the country name to ground vehicle group names to avoid duplicates.
This commit is contained in:
parent
64e425012c
commit
2808d0f72c
@ -347,6 +347,9 @@ class PretenseGroundObjectGenerator(GroundObjectGenerator):
|
||||
cp_name_trimmed = "".join(
|
||||
[i for i in self.ground_object.control_point.name.lower() if i.isalnum()]
|
||||
)
|
||||
country_name_trimmed = "".join(
|
||||
[i for i in self.country.shortname.lower() if i.isalnum()]
|
||||
)
|
||||
|
||||
for group in self.ground_object.groups:
|
||||
vehicle_units: list[TheaterUnit] = []
|
||||
@ -355,7 +358,7 @@ class PretenseGroundObjectGenerator(GroundObjectGenerator):
|
||||
if unit.is_static:
|
||||
# Add supply convoy
|
||||
group_role = "supply"
|
||||
group_name = f"{cp_name_trimmed}-{group_role}-{group.id}"
|
||||
group_name = f"{cp_name_trimmed}-{country_name_trimmed}-{group_role}-{group.id}"
|
||||
group.name = group_name
|
||||
|
||||
self.generate_ground_unit_of_class(
|
||||
@ -369,7 +372,7 @@ class PretenseGroundObjectGenerator(GroundObjectGenerator):
|
||||
elif unit.is_vehicle and unit.alive:
|
||||
# Add armor group
|
||||
group_role = "assault"
|
||||
group_name = f"{cp_name_trimmed}-{group_role}-{group.id}"
|
||||
group_name = f"{cp_name_trimmed}-{country_name_trimmed}-{group_role}-{group.id}"
|
||||
group.name = group_name
|
||||
|
||||
self.generate_ground_unit_of_class(
|
||||
@ -430,7 +433,6 @@ class PretenseGroundObjectGenerator(GroundObjectGenerator):
|
||||
PRETENSE_GROUND_UNIT_GROUP_SIZE,
|
||||
)
|
||||
elif unit.is_ship and unit.alive:
|
||||
print(f"Generating amphibious group at {unit.unit_name}")
|
||||
# Attach this group to the closest naval group, if available
|
||||
control_point = self.ground_object.control_point
|
||||
for (
|
||||
@ -467,7 +469,7 @@ class PretenseGroundObjectGenerator(GroundObjectGenerator):
|
||||
if number_of_supply_groups == 0:
|
||||
# Add supply convoy
|
||||
group_role = "supply"
|
||||
group_name = f"{cp_name_trimmed}-{group_role}-{group.id}"
|
||||
group_name = f"{cp_name_trimmed}-{country_name_trimmed}-{group_role}-{group.id}"
|
||||
group.name = group_name
|
||||
|
||||
self.generate_amphibious_unit_of_class(
|
||||
@ -481,7 +483,7 @@ class PretenseGroundObjectGenerator(GroundObjectGenerator):
|
||||
else:
|
||||
# Add armor group
|
||||
group_role = "assault"
|
||||
group_name = f"{cp_name_trimmed}-{group_role}-{group.id}"
|
||||
group_name = f"{cp_name_trimmed}-{country_name_trimmed}-{group_role}-{group.id}"
|
||||
group.name = group_name
|
||||
|
||||
self.generate_amphibious_unit_of_class(
|
||||
@ -578,7 +580,7 @@ class PretenseGroundObjectGenerator(GroundObjectGenerator):
|
||||
self.set_alarm_state(vehicle_group)
|
||||
GroundForcePainter(faction, vehicle_group.units[0]).apply_livery()
|
||||
|
||||
group_role = group_name.split("-")[1]
|
||||
group_role = group_name.split("-")[2]
|
||||
if group_role == "supply":
|
||||
self.game.pretense_ground_supply[side][cp_name_trimmed].append(
|
||||
f"{vehicle_group.name}"
|
||||
@ -746,6 +748,7 @@ class PretenseTgoGenerator(TgoGenerator):
|
||||
is_fob_structure=ground_object.is_fob_structure,
|
||||
task=ground_object.task,
|
||||
)
|
||||
new_ground_object.groups = ground_object.groups
|
||||
generator = PretenseGroundObjectGenerator(
|
||||
new_ground_object, country, self.game, self.m, self.unit_map
|
||||
)
|
||||
@ -760,6 +763,7 @@ class PretenseTgoGenerator(TgoGenerator):
|
||||
control_point=ground_object.control_point,
|
||||
task=ground_object.task,
|
||||
)
|
||||
new_ground_object.groups = ground_object.groups
|
||||
generator = PretenseGroundObjectGenerator(
|
||||
new_ground_object, country, self.game, self.m, self.unit_map
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user