mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Added multiple settings (external views, map views) and added marker generators.
This commit is contained in:
parent
a7824039e3
commit
397164e667
@ -7,9 +7,12 @@
|
||||
* **[Mission Generator]** Add PP points for JF-17 on STRIKE missions
|
||||
* **[Mission Generator]** Add ST point for F-14B on STRIKE missions
|
||||
* **[Mission Generator]** Flights with client slots will never be delayed
|
||||
* **[Mission Generator]** AI units can start from parking (Added a new setting)
|
||||
* **[Mission Generator]** AI units can start from parking (With a new setting in Settings Window to disable it)
|
||||
* **[Mission Generator]** Tacan for carrier will only be in Mode X from now
|
||||
* **[Mission Generator]** RTB waypoints for autogenerated flights
|
||||
* **[Settings]** Added settings to disallow external views
|
||||
* **[Settings]** Added settings to choose F10 Map mode (All, Allies only, Player only, Fog of War, Map Only)
|
||||
* **[Settings]** Added settings to choose whether to auto-generate objective marks on the map
|
||||
* **[Info Panel]** Added information about destroyed buildings in info panel
|
||||
* **[Info Panel]** Added information about destroyed units at SAM site in info panel
|
||||
* **[Info Panel]** Added information about units destroyed outside the frontline in the debriefing window
|
||||
|
||||
@ -595,7 +595,7 @@ CARRIER_TAKEOFF_BAN = [
|
||||
]
|
||||
|
||||
"""
|
||||
Units separated by country. Currently only Russia and USA are supported.
|
||||
Units separated by country.
|
||||
country : DCS Country name
|
||||
"""
|
||||
FACTIONS = {
|
||||
|
||||
@ -156,11 +156,7 @@ class Operation:
|
||||
cp = self.conflict.from_cp
|
||||
else:
|
||||
cp = self.conflict.to_cp
|
||||
|
||||
self.triggersgen.generate(player_cp=cp,
|
||||
is_quick=False,
|
||||
activation_trigger_radius=self.trigger_radius,
|
||||
awacs_enabled=self.is_awacs_enabled)
|
||||
self.triggersgen.generate()
|
||||
|
||||
# env settings
|
||||
if self.environment_settings is None:
|
||||
|
||||
@ -9,8 +9,10 @@ class Settings:
|
||||
labels = "Full"
|
||||
only_player_takeoff = True # Legacy parameter do not use
|
||||
night_disabled = False
|
||||
external_views_allowed = True
|
||||
supercarrier = False
|
||||
multiplier = 1
|
||||
generate_marks = True
|
||||
sams = True # Legacy parameter do not use
|
||||
cold_start = False # Legacy parameter do not use
|
||||
version = None
|
||||
|
||||
@ -22,15 +22,22 @@ class ForcedOptionsGenerator:
|
||||
self.game = game
|
||||
|
||||
def _set_options_view(self):
|
||||
if self.game.settings.map_coalition_visibility == "All Units":
|
||||
|
||||
if self.game.settings.map_coalition_visibility == ForcedOptions.Views.All:
|
||||
self.mission.forced_options.options_view = ForcedOptions.Views.All
|
||||
elif self.game.settings.map_coalition_visibility == "Allied Units":
|
||||
elif self.game.settings.map_coalition_visibility == ForcedOptions.Views.Allies:
|
||||
self.mission.forced_options.options_view = ForcedOptions.Views.Allies
|
||||
elif self.game.settings.map_coalition_visibility == "Own Aircraft":
|
||||
elif self.game.settings.map_coalition_visibility == ForcedOptions.Views.OnlyAllies:
|
||||
self.mission.forced_options.options_view = ForcedOptions.Views.OnlyAllies
|
||||
elif self.game.settings.map_coalition_visibility == ForcedOptions.Views.MyAircraft:
|
||||
self.mission.forced_options.options_view = ForcedOptions.Views.MyAircraft
|
||||
elif self.game.settings.map_coalition_visibility == "None":
|
||||
elif self.game.settings.map_coalition_visibility == ForcedOptions.Views.OnlyMap:
|
||||
self.mission.forced_options.options_view = ForcedOptions.Views.OnlyMap
|
||||
|
||||
def _set_external_views(self):
|
||||
if not self.game.settings.external_views_allowed:
|
||||
self.mission.forced_options.external_views = self.game.settings.external_views_allowed
|
||||
|
||||
def _set_labels(self):
|
||||
if self.game.settings.labels == "Abbreviated":
|
||||
self.mission.forced_options.labels = int(Labels.Abbreviated)
|
||||
@ -41,5 +48,8 @@ class ForcedOptionsGenerator:
|
||||
|
||||
def generate(self):
|
||||
self._set_options_view()
|
||||
self._set_external_views()
|
||||
self._set_labels()
|
||||
|
||||
|
||||
|
||||
@ -42,100 +42,19 @@ class TriggersGenerator:
|
||||
self.conflict = conflict
|
||||
self.game = game
|
||||
|
||||
def _gen_activation_trigger(self, radius: int, player_cp: ControlPoint, player_coalition: str, enemy_coalition: str):
|
||||
conflict_distance = player_cp.position.distance_to_point(self.conflict.position)
|
||||
minimum_radius = max(conflict_distance - TRIGGER_MIN_DISTANCE_FROM_START, TRIGGER_RADIUS_MINIMUM)
|
||||
if minimum_radius < 0:
|
||||
minimum_radius = 0
|
||||
radius = min(minimum_radius, radius)
|
||||
activation_trigger_zone = self.mission.triggers.add_triggerzone(
|
||||
self.conflict.position,
|
||||
radius,
|
||||
name="Activation zone",
|
||||
)
|
||||
activation_trigger = TriggerOnce(Event.NoEvent, "Activation trigger")
|
||||
activation_trigger.add_condition(PartOfCoalitionInZone(player_coalition, activation_trigger_zone.id))
|
||||
activation_trigger.add_condition(FlagIsTrue())
|
||||
activate_by_trigger = []
|
||||
flag_id = 2
|
||||
for coalition_name, coalition in self.mission.coalition.items():
|
||||
for country in coalition.countries.values():
|
||||
if coalition_name == enemy_coalition:
|
||||
for plane_group in country.plane_group + country.helicopter_group:
|
||||
plane_group.late_activation = True
|
||||
self.delayed_trigger(
|
||||
plane_group,
|
||||
flag_id,
|
||||
flag_lower_limit=180,
|
||||
flag_upper_limit=2400,
|
||||
)
|
||||
flag_id += 1
|
||||
|
||||
for vehicle_group in country.vehicle_group:
|
||||
vehicle_group.late_activation = True
|
||||
activate_by_trigger.append(vehicle_group)
|
||||
|
||||
for group in activate_by_trigger:
|
||||
activation_trigger.add_action(ActivateGroup(group.id))
|
||||
|
||||
self.mission.triggerrules.triggers.append(activation_trigger)
|
||||
|
||||
def _gen_push_trigger(self, player_cp: ControlPoint, player_coalition: str):
|
||||
push_by_trigger = []
|
||||
for coalition_name, coalition in self.mission.coalition.items():
|
||||
for country in coalition.countries.values():
|
||||
if coalition_name == player_coalition:
|
||||
for group in country.plane_group + country.helicopter_group:
|
||||
if group.task == AWACS.name or group.task == Refueling.name:
|
||||
continue
|
||||
|
||||
push_by_trigger.append(group)
|
||||
|
||||
"""if not group.units[0].is_human():
|
||||
regroup_heading = self.conflict.to_cp.position.heading_between_point(player_cp.position)
|
||||
|
||||
pos1 = group.position.point_from_heading(regroup_heading, REGROUP_ZONE_DISTANCE)
|
||||
pos2 = group.position.point_from_heading(regroup_heading, REGROUP_ZONE_DISTANCE+5000)
|
||||
w1 = group.add_waypoint(pos1, REGROUP_ALT)
|
||||
w2 = group.add_waypoint(pos2, REGROUP_ALT)
|
||||
|
||||
group.points.remove(w1)
|
||||
group.points.remove(w2)
|
||||
|
||||
group.points.insert(1, w2)
|
||||
group.points.insert(1, w1)
|
||||
|
||||
w1.tasks.append(Silence(True))
|
||||
|
||||
switch_waypoint_task = ControlledTask(SwitchWaypoint(from_waypoint=3, to_waypoint=2))
|
||||
switch_waypoint_task.start_if_user_flag(1, False)
|
||||
w2.tasks.append(switch_waypoint_task)
|
||||
group.points[3].tasks.append(Silence(False))
|
||||
|
||||
group.add_trigger_action(SwitchWaypoint(to_waypoint=4))"""
|
||||
|
||||
push_trigger = TriggerOnce(Event.NoEvent, "Push trigger")
|
||||
|
||||
for group in push_by_trigger:
|
||||
for unit in group.units:
|
||||
push_trigger.add_condition(UnitAltitudeHigherAGL(unit.id, PUSH_TRIGGER_ACTIVATION_AGL))
|
||||
|
||||
if not group.units[0].is_human():
|
||||
push_trigger.add_action(AITaskPush(group.id, 1))
|
||||
|
||||
message_string = self.mission.string("Task force is in the air, proceed with the objective.")
|
||||
push_trigger.add_action(MessageToAll(message_string, clearview=True))
|
||||
push_trigger.add_action(SetFlagValue())
|
||||
|
||||
self.mission.triggerrules.triggers.append(push_trigger)
|
||||
|
||||
def _set_allegiances(self, player_coalition: str, enemy_coalition: str):
|
||||
"""
|
||||
Set airbase initial coalition
|
||||
"""
|
||||
for cp in self.game.theater.controlpoints:
|
||||
if cp.is_global:
|
||||
continue
|
||||
self.mission.terrain.airport_by_id(cp.at.id).set_coalition(cp.captured and player_coalition or enemy_coalition)
|
||||
|
||||
def _set_skill(self, player_coalition: str, enemy_coalition: str):
|
||||
"""
|
||||
Set skill level for all aircraft in the mission
|
||||
"""
|
||||
for coalition_name, coalition in self.mission.coalition.items():
|
||||
if coalition_name == player_coalition:
|
||||
skill_level = self.game.settings.player_skill, self.game.settings.player_skill
|
||||
@ -153,40 +72,29 @@ class TriggersGenerator:
|
||||
for vehicle_group in country.vehicle_group:
|
||||
vehicle_group.set_skill(Skill(skill_level[1]))
|
||||
|
||||
def delayed_trigger(self, group, flag_id, flag_lower_limit, flag_upper_limit):
|
||||
def _gen_markers(self):
|
||||
"""
|
||||
Create an activation trigger a randomized amount after the main activation occurs
|
||||
:param group:
|
||||
group to activate
|
||||
:param flag_id:
|
||||
ID of the flag to use
|
||||
:param flag_lower_limit:
|
||||
lower limit of what the random time can be (shouldn't be negative)
|
||||
:param flag_upper_limit:
|
||||
uopper limit of what the random time can be
|
||||
:return:
|
||||
N/A
|
||||
Generate markers on F10 map for each existing objective
|
||||
"""
|
||||
trigger_one = TriggerOnce(Event.NoEvent, "Activation trigger")
|
||||
trigger_one.add_condition(FlagEquals(1, 1))
|
||||
trigger_one.add_action(SetFlagValue(flag_id, 1))
|
||||
if self.game.settings.generate_marks:
|
||||
mark_trigger = TriggerOnce(Event.NoEvent, "Marks generator")
|
||||
mark_trigger.add_condition(TimeAfter(1))
|
||||
v = 10
|
||||
for cp in self.game.theater.controlpoints:
|
||||
added = []
|
||||
for ground_object in cp.ground_objects:
|
||||
if ground_object.obj_name not in added:
|
||||
zone = self.mission.triggers.add_triggerzone(ground_object.position, radius=10, hidden=True, name="MARK")
|
||||
if cp.captured:
|
||||
name = ground_object.obj_name + " [ALLY]"
|
||||
else:
|
||||
name = ground_object.obj_name + " [ENEMY]"
|
||||
mark_trigger.add_action(MarkToAll(v, zone.id, String(name)))
|
||||
v = v + 1
|
||||
added.append(ground_object.obj_name)
|
||||
self.mission.triggerrules.triggers.append(mark_trigger)
|
||||
|
||||
trigger_two = TriggerCondition()
|
||||
trigger_two.add_condition(
|
||||
TimeSinceFlag(
|
||||
flag_id,
|
||||
seconds=random.randint(
|
||||
flag_lower_limit,
|
||||
flag_upper_limit
|
||||
)
|
||||
)
|
||||
)
|
||||
trigger_two.add_action(ActivateGroup(group.id))
|
||||
|
||||
self.mission.triggerrules.triggers.append(trigger_one)
|
||||
self.mission.triggerrules.triggers.append(trigger_two)
|
||||
|
||||
def generate(self, player_cp: ControlPoint, is_quick: bool, activation_trigger_radius: int, awacs_enabled: bool):
|
||||
def generate(self):
|
||||
player_coalition = self.game.player_country in db.BLUEFOR_FACTIONS and "blue" or "red"
|
||||
enemy_coalition = player_coalition == "blue" and "red" or "blue"
|
||||
|
||||
@ -197,9 +105,5 @@ class TriggersGenerator:
|
||||
|
||||
self._set_skill(player_coalition, enemy_coalition)
|
||||
self._set_allegiances(player_coalition, enemy_coalition)
|
||||
|
||||
#if not is_quick:
|
||||
# # TODO: waypoint parts of this should not be post-hacked but added in airgen
|
||||
# self._gen_activation_trigger(activation_trigger_radius, player_cp, player_coalition, enemy_coalition)
|
||||
# self._gen_push_trigger(player_cp, player_coalition)
|
||||
self._gen_markers()
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ from PySide2.QtCore import QSize, Qt, QItemSelectionModel, QPoint
|
||||
from PySide2.QtGui import QStandardItemModel, QStandardItem
|
||||
from PySide2.QtWidgets import QLabel, QDialog, QGridLayout, QListView, QStackedLayout, QComboBox, QWidget, \
|
||||
QAbstractItemView, QPushButton, QGroupBox, QCheckBox, QVBoxLayout
|
||||
from dcs.forcedoptions import ForcedOptions
|
||||
|
||||
import qt_ui.uiconstants as CONST
|
||||
from game.game import Game
|
||||
@ -118,6 +119,32 @@ class QSettingsWindow(QDialog):
|
||||
self.difficultyLayout.addWidget(QLabel("No night missions"), 4, 0)
|
||||
self.difficultyLayout.addWidget(self.noNightMission, 4, 1, Qt.AlignRight)
|
||||
|
||||
self.mapVisibiitySelection = QComboBox()
|
||||
self.mapVisibiitySelection.addItem("All", ForcedOptions.Views.All)
|
||||
if self.game.settings.map_coalition_visibility == ForcedOptions.Views.All:
|
||||
self.mapVisibiitySelection.setCurrentIndex(0)
|
||||
self.mapVisibiitySelection.addItem("Fog of War", ForcedOptions.Views.Allies)
|
||||
if self.game.settings.map_coalition_visibility == ForcedOptions.Views.Allies:
|
||||
self.mapVisibiitySelection.setCurrentIndex(1)
|
||||
self.mapVisibiitySelection.addItem("Allies Only", ForcedOptions.Views.OnlyAllies)
|
||||
if self.game.settings.map_coalition_visibility == ForcedOptions.Views.OnlyAllies:
|
||||
self.mapVisibiitySelection.setCurrentIndex(2)
|
||||
self.mapVisibiitySelection.addItem("Own Aircraft Only", ForcedOptions.Views.MyAircraft)
|
||||
if self.game.settings.map_coalition_visibility == ForcedOptions.Views.MyAircraft:
|
||||
self.mapVisibiitySelection.setCurrentIndex(3)
|
||||
self.mapVisibiitySelection.addItem("Map Only", ForcedOptions.Views.OnlyMap)
|
||||
if self.game.settings.map_coalition_visibility == ForcedOptions.Views.OnlyMap:
|
||||
self.mapVisibiitySelection.setCurrentIndex(4)
|
||||
self.mapVisibiitySelection.currentIndexChanged.connect(self.applySettings)
|
||||
self.difficultyLayout.addWidget(QLabel("Map visibility options"), 5, 0)
|
||||
self.difficultyLayout.addWidget(self.mapVisibiitySelection, 5, 1, Qt.AlignRight)
|
||||
|
||||
self.ext_views = QCheckBox()
|
||||
self.ext_views.setChecked(self.game.settings.external_views_allowed)
|
||||
self.ext_views.toggled.connect(self.applySettings)
|
||||
self.difficultyLayout.addWidget(QLabel("Allow external views"), 6, 0)
|
||||
self.difficultyLayout.addWidget(self.ext_views, 6, 1, Qt.AlignRight)
|
||||
|
||||
|
||||
def initGeneratorLayout(self):
|
||||
self.generatorPage = QWidget()
|
||||
@ -134,8 +161,14 @@ class QSettingsWindow(QDialog):
|
||||
self.supercarrier.setChecked(self.game.settings.supercarrier)
|
||||
self.supercarrier.toggled.connect(self.applySettings)
|
||||
|
||||
self.generate_marks = QCheckBox()
|
||||
self.generate_marks.setChecked(self.game.settings.generate_marks)
|
||||
self.generate_marks.toggled.connect(self.applySettings)
|
||||
|
||||
self.gameplayLayout.addWidget(QLabel("Use Supercarrier Module"), 0, 0)
|
||||
self.gameplayLayout.addWidget(self.supercarrier, 0, 1, Qt.AlignRight)
|
||||
self.gameplayLayout.addWidget(QLabel("Put Objective Markers on Map"), 1, 0)
|
||||
self.gameplayLayout.addWidget(self.generate_marks, 1, 1, Qt.AlignRight)
|
||||
|
||||
self.performance = QGroupBox("Performance")
|
||||
self.performanceLayout = QGridLayout();
|
||||
@ -229,6 +262,12 @@ class QSettingsWindow(QDialog):
|
||||
self.game.settings.enemy_vehicle_skill = CONST.SKILL_OPTIONS[self.enemyAASkill.currentIndex()]
|
||||
self.game.settings.labels = CONST.LABELS_OPTIONS[self.difficultyLabel.currentIndex()]
|
||||
self.game.settings.night_disabled = self.noNightMission.isChecked()
|
||||
self.game.settings.map_coalition_visibility = self.mapVisibiitySelection.currentData()
|
||||
self.game.settings.external_views_allowed = self.ext_views.isChecked()
|
||||
self.game.settings.generate_marks = self.generate_marks.isChecked()
|
||||
|
||||
print(self.game.settings.map_coalition_visibility)
|
||||
|
||||
self.game.settings.supercarrier = self.supercarrier.isChecked()
|
||||
|
||||
self.game.settings.perf_red_alert_state = self.red_alert.isChecked()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user