mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Also connect carrier and LHA control points to adjacent friendly points in Pretense. Enlarged the carrier trigger zones.
This commit is contained in:
parent
f4a239aaad
commit
5621649f10
@ -93,9 +93,9 @@ class PretenseLuaGenerator(LuaGenerator):
|
|||||||
max_resource = 30000
|
max_resource = 30000
|
||||||
if isinstance(cp, Airfield) or cp.has_ground_spawns:
|
if isinstance(cp, Airfield) or cp.has_ground_spawns:
|
||||||
lua_string_zones += f"zones.{cp_name_trimmed}.isPlaneSpawn = true\n"
|
lua_string_zones += f"zones.{cp_name_trimmed}.isPlaneSpawn = true\n"
|
||||||
if cp.has_ground_spawns:
|
if cp.has_ground_spawns or cp.is_lha:
|
||||||
max_resource = 40000
|
max_resource = 40000
|
||||||
if isinstance(cp, Airfield):
|
if isinstance(cp, Airfield) or cp.is_carrier:
|
||||||
max_resource = 50000
|
max_resource = 50000
|
||||||
lua_string_zones += (
|
lua_string_zones += (
|
||||||
f"zones.{cp_name_trimmed}.maxResource = {max_resource}\n"
|
f"zones.{cp_name_trimmed}.maxResource = {max_resource}\n"
|
||||||
@ -114,7 +114,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
|||||||
lua_string_zones += " }),\n"
|
lua_string_zones += " }),\n"
|
||||||
lua_string_zones += " presets.upgrades.basic.comPost:extend({\n"
|
lua_string_zones += " presets.upgrades.basic.comPost:extend({\n"
|
||||||
lua_string_zones += f" name = '{cp_name_trimmed}-com-red',\n"
|
lua_string_zones += f" name = '{cp_name_trimmed}-com-red',\n"
|
||||||
lua_string_zones += " products = {"
|
lua_string_zones += " products = {\n"
|
||||||
lua_string_zones += (
|
lua_string_zones += (
|
||||||
" presets.special.red.infantry:extend({ name='"
|
" presets.special.red.infantry:extend({ name='"
|
||||||
+ cp_name_trimmed
|
+ cp_name_trimmed
|
||||||
@ -307,10 +307,19 @@ class PretenseLuaGenerator(LuaGenerator):
|
|||||||
|
|
||||||
lua_string_connman = " cm = ConnectionManager:new()"
|
lua_string_connman = " cm = ConnectionManager:new()"
|
||||||
|
|
||||||
|
# Generate ConnectionManager connections
|
||||||
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:
|
||||||
lua_string_connman += (
|
lua_string_connman += (
|
||||||
f" cm: addConnection('{cp.name}', '{other_cp.name}')"
|
f" cm: addConnection('{cp.name}', '{other_cp.name}')\n"
|
||||||
|
)
|
||||||
|
# Also connect carrier and LHA control points to adjacent friendly points
|
||||||
|
if cp.is_fleet and len(cp.connected_points) == 0:
|
||||||
|
for other_cp in self.game.theater.closest_friendly_control_points_to(
|
||||||
|
cp
|
||||||
|
):
|
||||||
|
lua_string_connman += (
|
||||||
|
f" cm: addConnection('{cp.name}', '{other_cp.name}')\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
init_body_1_file = open("./resources/plugins/pretense/init_body_1.lua", "r")
|
init_body_1_file = open("./resources/plugins/pretense/init_body_1.lua", "r")
|
||||||
|
|||||||
@ -53,6 +53,7 @@ TRIGGER_RADIUS_CLEAR_SCENERY = 1000
|
|||||||
TRIGGER_RADIUS_PRETENSE_TGO = 500
|
TRIGGER_RADIUS_PRETENSE_TGO = 500
|
||||||
TRIGGER_RADIUS_PRETENSE_SUPPLY = 500
|
TRIGGER_RADIUS_PRETENSE_SUPPLY = 500
|
||||||
TRIGGER_RADIUS_PRETENSE_HELI = 1000
|
TRIGGER_RADIUS_PRETENSE_HELI = 1000
|
||||||
|
TRIGGER_RADIUS_PRETENSE_CARRIER = 50000
|
||||||
|
|
||||||
|
|
||||||
class Silence(Option):
|
class Silence(Option):
|
||||||
@ -157,12 +158,16 @@ class PretenseTriggerGenerator:
|
|||||||
Directly appends to the global `base_capture_events` var declared by `dcs_libaration.lua`
|
Directly appends to the global `base_capture_events` var declared by `dcs_libaration.lua`
|
||||||
"""
|
"""
|
||||||
for cp in self.game.theater.controlpoints:
|
for cp in self.game.theater.controlpoints:
|
||||||
|
if cp.is_fleet:
|
||||||
|
trigger_radius = TRIGGER_RADIUS_PRETENSE_CARRIER
|
||||||
|
else:
|
||||||
|
trigger_radius = TRIGGER_RADIUS_CAPTURE
|
||||||
if not isinstance(cp, OffMapSpawn):
|
if not isinstance(cp, OffMapSpawn):
|
||||||
|
|
||||||
zone_color = {1: 0.0, 2: 0.0, 3: 0.0, 4: 0.15}
|
zone_color = {1: 0.0, 2: 0.0, 3: 0.0, 4: 0.15}
|
||||||
trigger_zone = self.mission.triggers.add_triggerzone(
|
trigger_zone = self.mission.triggers.add_triggerzone(
|
||||||
cp.position,
|
cp.position,
|
||||||
radius=TRIGGER_RADIUS_CAPTURE,
|
radius=trigger_radius,
|
||||||
hidden=False,
|
hidden=False,
|
||||||
name=cp.name,
|
name=cp.name,
|
||||||
color=zone_color,
|
color=zone_color,
|
||||||
|
|||||||
@ -195,6 +195,34 @@ class ConflictTheater:
|
|||||||
assert closest_red is not None
|
assert closest_red is not None
|
||||||
return closest_blue, closest_red
|
return closest_blue, closest_red
|
||||||
|
|
||||||
|
def closest_friendly_control_points_to(
|
||||||
|
self, cp: ControlPoint
|
||||||
|
) -> Tuple[ControlPoint, ControlPoint]:
|
||||||
|
"""
|
||||||
|
Returns a tuple of the two nearest friendly ControlPoints in theater to ControlPoint cp.
|
||||||
|
(closest_cp, second_closest_cp)
|
||||||
|
"""
|
||||||
|
seen = set()
|
||||||
|
min_distance = math.inf
|
||||||
|
closest_cp = None
|
||||||
|
second_closest_cp = None
|
||||||
|
if cp.captured:
|
||||||
|
control_points = self.player_points()
|
||||||
|
else:
|
||||||
|
control_points = self.enemy_points()
|
||||||
|
for other_cp in control_points:
|
||||||
|
if cp == other_cp:
|
||||||
|
continue
|
||||||
|
dist = other_cp.position.distance_to_point(cp.position)
|
||||||
|
if dist < min_distance:
|
||||||
|
second_closest_cp = closest_cp
|
||||||
|
closest_cp = other_cp
|
||||||
|
min_distance = dist
|
||||||
|
|
||||||
|
assert closest_cp is not None
|
||||||
|
assert second_closest_cp is not None
|
||||||
|
return closest_cp, second_closest_cp
|
||||||
|
|
||||||
def find_control_point_by_id(self, cp_id: UUID) -> ControlPoint:
|
def find_control_point_by_id(self, cp_id: UUID) -> ControlPoint:
|
||||||
for i in self.controlpoints:
|
for i in self.controlpoints:
|
||||||
if i.id == cp_id:
|
if i.id == cp_id:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user