mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fixed a bug in generate_pretense_zone_connection().
This commit is contained in:
parent
9edb4ecc45
commit
9be06d9601
@ -517,11 +517,11 @@ class PretenseLuaGenerator(LuaGenerator):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def generate_pretense_zone_connection(
|
def generate_pretense_zone_connection(
|
||||||
lua_string_connman: str,
|
|
||||||
connected_points: dict[str, list[str]],
|
connected_points: dict[str, list[str]],
|
||||||
cp_name: str,
|
cp_name: str,
|
||||||
other_cp_name: str,
|
other_cp_name: str,
|
||||||
) -> str:
|
) -> str:
|
||||||
|
lua_string_connman = ""
|
||||||
try:
|
try:
|
||||||
connected_points[cp_name]
|
connected_points[cp_name]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@ -535,7 +535,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
|||||||
other_cp_name not in connected_points[cp_name]
|
other_cp_name not in connected_points[cp_name]
|
||||||
and cp_name not in connected_points[other_cp_name]
|
and cp_name not in connected_points[other_cp_name]
|
||||||
):
|
):
|
||||||
lua_string_connman += (
|
lua_string_connman = (
|
||||||
f" cm: addConnection('{cp_name}', '{other_cp_name}')\n"
|
f" cm: addConnection('{cp_name}', '{other_cp_name}')\n"
|
||||||
)
|
)
|
||||||
connected_points[cp_name].append(other_cp_name)
|
connected_points[cp_name].append(other_cp_name)
|
||||||
@ -618,13 +618,12 @@ class PretenseLuaGenerator(LuaGenerator):
|
|||||||
connected_points: dict[str, list[str]] = {}
|
connected_points: dict[str, list[str]] = {}
|
||||||
for cp in self.game.theater.controlpoints:
|
for cp in self.game.theater.controlpoints:
|
||||||
for other_cp in cp.connected_points:
|
for other_cp in cp.connected_points:
|
||||||
self.generate_pretense_zone_connection(
|
lua_string_connman += self.generate_pretense_zone_connection(
|
||||||
lua_string_connman, connected_points, cp.name, other_cp.name
|
connected_points, cp.name, other_cp.name
|
||||||
)
|
)
|
||||||
for sea_connection in cp.shipping_lanes:
|
for sea_connection in cp.shipping_lanes:
|
||||||
if sea_connection.is_friendly_to(cp):
|
if sea_connection.is_friendly_to(cp):
|
||||||
self.generate_pretense_zone_connection(
|
lua_string_connman += self.generate_pretense_zone_connection(
|
||||||
lua_string_connman,
|
|
||||||
connected_points,
|
connected_points,
|
||||||
cp.name,
|
cp.name,
|
||||||
sea_connection.name,
|
sea_connection.name,
|
||||||
@ -643,17 +642,17 @@ class PretenseLuaGenerator(LuaGenerator):
|
|||||||
):
|
):
|
||||||
break
|
break
|
||||||
|
|
||||||
self.generate_pretense_zone_connection(
|
lua_string_connman += self.generate_pretense_zone_connection(
|
||||||
lua_string_connman, connected_points, cp.name, other_cp.name
|
connected_points, cp.name, other_cp.name
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# Finally, connect remaining non-connected points
|
# Finally, connect remaining non-connected points
|
||||||
closest_cps = self.game.theater.closest_friendly_control_points_to(cp)
|
closest_cps = self.game.theater.closest_friendly_control_points_to(cp)
|
||||||
self.generate_pretense_zone_connection(
|
lua_string_connman += self.generate_pretense_zone_connection(
|
||||||
lua_string_connman, connected_points, cp.name, closest_cps[0].name
|
connected_points, cp.name, closest_cps[0].name
|
||||||
)
|
)
|
||||||
self.generate_pretense_zone_connection(
|
lua_string_connman += self.generate_pretense_zone_connection(
|
||||||
lua_string_connman, connected_points, cp.name, closest_cps[1].name
|
connected_points, cp.name, closest_cps[1].name
|
||||||
)
|
)
|
||||||
|
|
||||||
lua_string_supply = "local redSupply = {\n"
|
lua_string_supply = "local redSupply = {\n"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user