mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Add option to limit convoy travel distances.
CPU load seems to scale with route length, so add an option to limit the length of the convoy route. The tradeoff is that the performance sensitive route won't necessarily be a correct route.
This commit is contained in:
parent
dfcc458479
commit
54bf9357bf
@ -378,6 +378,12 @@ class Settings:
|
|||||||
section=PERFORMANCE_SECTION,
|
section=PERFORMANCE_SECTION,
|
||||||
default=True,
|
default=True,
|
||||||
)
|
)
|
||||||
|
convoys_travel_full_distance: bool = boolean_option(
|
||||||
|
"Convoys drive the full distance between control points",
|
||||||
|
page=MISSION_GENERATOR_PAGE,
|
||||||
|
section=PERFORMANCE_SECTION,
|
||||||
|
default=True,
|
||||||
|
)
|
||||||
perf_infantry: bool = boolean_option(
|
perf_infantry: bool = boolean_option(
|
||||||
"Generate infantry squads alongside vehicles",
|
"Generate infantry squads alongside vehicles",
|
||||||
page=MISSION_GENERATOR_PAGE,
|
page=MISSION_GENERATOR_PAGE,
|
||||||
|
|||||||
@ -10,6 +10,7 @@ from dcs.unit import Vehicle
|
|||||||
from dcs.unitgroup import VehicleGroup
|
from dcs.unitgroup import VehicleGroup
|
||||||
|
|
||||||
from game.dcs.groundunittype import GroundUnitType
|
from game.dcs.groundunittype import GroundUnitType
|
||||||
|
from game.theater import FrontLine
|
||||||
from game.transfers import Convoy
|
from game.transfers import Convoy
|
||||||
from game.unitmap import UnitMap
|
from game.unitmap import UnitMap
|
||||||
from game.utils import kph
|
from game.utils import kph
|
||||||
@ -38,11 +39,26 @@ class ConvoyGenerator:
|
|||||||
convoy.units,
|
convoy.units,
|
||||||
convoy.player_owned,
|
convoy.player_owned,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if self.game.settings.convoys_travel_full_distance:
|
||||||
|
end_point = convoy.route_end
|
||||||
|
else:
|
||||||
|
# convoys_travel_full_distance is disabled, so have the convoy only move the first segment on the route.
|
||||||
|
# This option aims to remove long routes for ground vehicles between control points,
|
||||||
|
# since the CPU load for pathfinding long routes on DCS can be pretty heavy.
|
||||||
|
frontline = FrontLine(convoy.origin, convoy.destination)
|
||||||
|
|
||||||
|
# Select the first route segment from the origin towards the destination
|
||||||
|
# so the convoy spawns at the origin CP. This allows the convoy to be
|
||||||
|
# targeted by BAI flights and starts it within the protection umbrella of the CP.
|
||||||
|
end_point = frontline.segments[0].point_b
|
||||||
|
|
||||||
group.add_waypoint(
|
group.add_waypoint(
|
||||||
convoy.route_end,
|
end_point,
|
||||||
speed=kph(40).kph,
|
speed=kph(40).kph,
|
||||||
move_formation=PointAction.OnRoad,
|
move_formation=PointAction.OnRoad,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.make_drivable(group)
|
self.make_drivable(group)
|
||||||
self.unit_map.add_convoy_units(group, convoy)
|
self.unit_map.add_convoy_units(group, convoy)
|
||||||
return group
|
return group
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user