mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Implemented adding ground unit groups to pretense data containers.
This commit is contained in:
parent
d8b0283efe
commit
8253d41d37
@ -225,8 +225,9 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
for cp in self.game.theater.controlpoints:
|
||||
cp_name_trimmed = "".join([i for i in cp.name.lower() if i.isalnum()])
|
||||
cp_side = 2 if cp.captured else 1
|
||||
if cp_name_trimmed not in self.game.pretense_air[cp_side]:
|
||||
self.game.pretense_air[cp_side][cp_name_trimmed] = {}
|
||||
for side in range(1, 3):
|
||||
if cp_name_trimmed not in self.game.pretense_air[cp_side]:
|
||||
self.game.pretense_air[side][cp_name_trimmed] = {}
|
||||
# if flight_type not in self.flight.coalition.game.pretense_air[cp_side][cp_name_trimmed]:
|
||||
# self.flight.coalition.game.pretense_air[cp_side][cp_name_trimmed][flight_type] = list()
|
||||
|
||||
@ -248,14 +249,26 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
lua_string += " presets.upgrades.basic.tent:extend({\n"
|
||||
lua_string += f" name='{cp_name_trimmed}-tent-red',\n"
|
||||
lua_string += " products = {\n"
|
||||
lua_string += " presets.special.red.infantry:extend({ name='mike-defense-red'})\n"
|
||||
lua_string += (
|
||||
" presets.special.red.infantry:extend({ name='"
|
||||
+ cp_name_trimmed
|
||||
+ "-defense-red'})\n"
|
||||
)
|
||||
lua_string += " }\n"
|
||||
lua_string += " }),\n"
|
||||
lua_string += " presets.upgrades.basic.comPost:extend({\n"
|
||||
lua_string += f" name = '{cp_name_trimmed}-com-red',\n"
|
||||
lua_string += " products = {"
|
||||
lua_string += " presets.special.red.infantry:extend({ name='batumi-defense-red'}),\n"
|
||||
lua_string += " presets.defenses.red.infantry:extend({ name='batumi-garrison-red' })\n"
|
||||
lua_string += (
|
||||
" presets.special.red.infantry:extend({ name='"
|
||||
+ cp_name_trimmed
|
||||
+ "-defense-red'}),\n"
|
||||
)
|
||||
lua_string += (
|
||||
" presets.defenses.red.infantry:extend({ name='"
|
||||
+ cp_name_trimmed
|
||||
+ "-garrison-red' })\n"
|
||||
)
|
||||
lua_string += " }\n"
|
||||
lua_string += " }),\n"
|
||||
lua_string += " },\n"
|
||||
@ -264,18 +277,32 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
lua_string += " presets.upgrades.basic.tent:extend({\n"
|
||||
lua_string += f" name='{cp_name_trimmed}-tent-blue',\n"
|
||||
lua_string += " products = {\n"
|
||||
lua_string += " presets.special.blue.infantry:extend({ name='mike-defense-blue'})\n"
|
||||
lua_string += (
|
||||
" presets.special.blue.infantry:extend({ name='"
|
||||
+ cp_name_trimmed
|
||||
+ "-defense-blue'})\n"
|
||||
)
|
||||
lua_string += " }\n"
|
||||
lua_string += " }),\n"
|
||||
lua_string += " presets.upgrades.basic.comPost:extend({\n"
|
||||
lua_string += f" name = '{cp_name_trimmed}-com-blue',\n"
|
||||
lua_string += " products = {"
|
||||
lua_string += " presets.special.blue.infantry:extend({ name='batumi-defense-blue'}),\n"
|
||||
lua_string += " presets.defenses.blue.infantry:extend({ name='batumi-garrison-blue' })\n"
|
||||
lua_string += " products = {\n"
|
||||
lua_string += (
|
||||
" presets.special.blue.infantry:extend({ name='"
|
||||
+ cp_name_trimmed
|
||||
+ "-defense-blue'}),\n"
|
||||
)
|
||||
lua_string += (
|
||||
" presets.defenses.blue.infantry:extend({ name='"
|
||||
+ cp_name_trimmed
|
||||
+ "-garrison-blue' })\n"
|
||||
)
|
||||
lua_string += " }\n"
|
||||
lua_string += " }),\n"
|
||||
lua_string += " presets.upgrades.supply.fuelTank:extend({\n"
|
||||
lua_string += " name = 'batumi-fueltank-blue',\n"
|
||||
lua_string += (
|
||||
" name = '" + cp_name_trimmed + "-fueltank-blue',\n"
|
||||
)
|
||||
lua_string += " products = {\n"
|
||||
lua_string += " presets.missions.supply.convoy_escorted:extend({ name='batumi-supply-convoy-1'}),\n"
|
||||
lua_string += " presets.missions.supply.helo:extend({ name='batumi-supply-blue-1' }),\n"
|
||||
|
||||
@ -168,37 +168,55 @@ class PretenseGroundObjectGenerator(GroundObjectGenerator):
|
||||
def generate(self) -> None:
|
||||
if self.culled:
|
||||
return
|
||||
cp_name_trimmed = "".join(
|
||||
[i for i in self.ground_object.control_point.name.lower() if i.isalnum()]
|
||||
)
|
||||
cp_side = 2 if self.ground_object.control_point.captured else 1
|
||||
for side in range(1, 3):
|
||||
if cp_name_trimmed not in self.game.pretense_ground_supply[cp_side]:
|
||||
self.game.pretense_ground_supply[side][cp_name_trimmed] = list()
|
||||
if cp_name_trimmed not in self.game.pretense_ground_assault[cp_side]:
|
||||
self.game.pretense_ground_assault[side][cp_name_trimmed] = list()
|
||||
print(self.game.pretense_ground_supply[cp_side][cp_name_trimmed])
|
||||
for group in self.ground_object.groups:
|
||||
vehicle_units: list[TheaterUnit] = []
|
||||
ship_units: list[TheaterUnit] = []
|
||||
# Split the different unit types to be compliant to dcs limitation
|
||||
for unit in group.units:
|
||||
cp_name_trimmed = "".join(
|
||||
[
|
||||
i
|
||||
for i in self.ground_object.control_point.name.lower()
|
||||
if i.isalnum()
|
||||
]
|
||||
)
|
||||
|
||||
if unit.is_static:
|
||||
# Add supply convoy
|
||||
group_id = self.game.next_group_id()
|
||||
group_role = "supply"
|
||||
group_name = f"{cp_name_trimmed}-{group_role}-{group_id}"
|
||||
group.name = group_name
|
||||
self.game.pretense_ground_supply[cp_side][cp_name_trimmed].append(
|
||||
group_name
|
||||
)
|
||||
|
||||
self.generate_ground_unit_of_class(
|
||||
UnitClass.LOGISTICS,
|
||||
group,
|
||||
vehicle_units,
|
||||
cp_name_trimmed,
|
||||
"supply",
|
||||
group_role,
|
||||
PRETENSE_GROUND_UNIT_GROUP_SIZE,
|
||||
)
|
||||
elif unit.is_vehicle and unit.alive:
|
||||
# Add armor group
|
||||
group_id = self.game.next_group_id()
|
||||
group_role = "assault"
|
||||
group_name = f"{cp_name_trimmed}-{group_role}-{group_id}"
|
||||
group.name = group_name
|
||||
self.game.pretense_ground_supply[cp_side][cp_name_trimmed].append(
|
||||
group_name
|
||||
)
|
||||
|
||||
self.generate_ground_unit_of_class(
|
||||
UnitClass.TANK,
|
||||
group,
|
||||
vehicle_units,
|
||||
cp_name_trimmed,
|
||||
"assault",
|
||||
group_role,
|
||||
PRETENSE_GROUND_UNIT_GROUP_SIZE - 3,
|
||||
)
|
||||
self.generate_ground_unit_of_class(
|
||||
@ -206,7 +224,7 @@ class PretenseGroundObjectGenerator(GroundObjectGenerator):
|
||||
group,
|
||||
vehicle_units,
|
||||
cp_name_trimmed,
|
||||
"assault",
|
||||
group_role,
|
||||
PRETENSE_GROUND_UNIT_GROUP_SIZE - 2,
|
||||
)
|
||||
self.generate_ground_unit_of_class(
|
||||
@ -214,7 +232,7 @@ class PretenseGroundObjectGenerator(GroundObjectGenerator):
|
||||
group,
|
||||
vehicle_units,
|
||||
cp_name_trimmed,
|
||||
"assault",
|
||||
group_role,
|
||||
PRETENSE_GROUND_UNIT_GROUP_SIZE - 1,
|
||||
)
|
||||
self.generate_ground_unit_of_class(
|
||||
@ -222,7 +240,7 @@ class PretenseGroundObjectGenerator(GroundObjectGenerator):
|
||||
group,
|
||||
vehicle_units,
|
||||
cp_name_trimmed,
|
||||
"assault",
|
||||
group_role,
|
||||
PRETENSE_GROUND_UNIT_GROUP_SIZE,
|
||||
)
|
||||
self.generate_ground_unit_of_class(
|
||||
@ -230,7 +248,7 @@ class PretenseGroundObjectGenerator(GroundObjectGenerator):
|
||||
group,
|
||||
vehicle_units,
|
||||
cp_name_trimmed,
|
||||
"assault",
|
||||
group_role,
|
||||
PRETENSE_GROUND_UNIT_GROUP_SIZE,
|
||||
)
|
||||
self.generate_ground_unit_of_class(
|
||||
@ -238,7 +256,7 @@ class PretenseGroundObjectGenerator(GroundObjectGenerator):
|
||||
group,
|
||||
vehicle_units,
|
||||
cp_name_trimmed,
|
||||
"assault",
|
||||
group_role,
|
||||
PRETENSE_GROUND_UNIT_GROUP_SIZE,
|
||||
)
|
||||
if random.randrange(0, 100) > 75:
|
||||
@ -247,14 +265,13 @@ class PretenseGroundObjectGenerator(GroundObjectGenerator):
|
||||
group,
|
||||
vehicle_units,
|
||||
cp_name_trimmed,
|
||||
"assault",
|
||||
group_role,
|
||||
PRETENSE_GROUND_UNIT_GROUP_SIZE,
|
||||
)
|
||||
elif unit.is_ship and unit.alive:
|
||||
# All alive Ships
|
||||
ship_units.append(unit)
|
||||
if vehicle_units:
|
||||
print(f"Generating vehicle group {vehicle_units}")
|
||||
self.create_vehicle_group(group.group_name, vehicle_units)
|
||||
if ship_units:
|
||||
self.create_ship_group(group.group_name, ship_units)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user