Compare commits

..

9 Commits

Author SHA1 Message Date
walterroach
6f65637f6b Fix bug #353 2020-11-27 17:47:19 -06:00
Dan Albert
cceb3da693 Resurrect force multiplier option.
Fixes https://github.com/Khopa/dcs_liberation/issues/440

(cherry picked from commit 611f04ab5a)
2020-11-25 14:13:54 -08:00
walterroach
a357bf3c08 Fix bug #400 2020-11-22 17:32:05 -06:00
walterroach
3f251c38d8 Set AGL altitude on target waypoints 2020-11-22 16:42:22 -06:00
walterroach
01702f046e Add missing P-47 icons 2020-11-22 02:12:15 -06:00
Ignacio Muñoz Fernandez
d394d01ea8 fix: conditional value at passTurn on QTopPanel 2020-11-20 17:12:13 -08:00
Ignacio Muñoz Fernandez
70d982b0ed fix: Pass Turn and Take Off Buttons when no game is loaded 2020-11-20 17:12:13 -08:00
Ignacio Muñoz Fernandez
c3b028ef4b fix: fixes #325 for version 2.2.x 2020-11-20 03:50:58 -08:00
Dan Albert
206d09f7f8 Maybe correct fishbed radios.
Maybe fixes https://github.com/Khopa/dcs_liberation/issues/377
2020-11-20 00:20:01 -08:00
12 changed files with 73 additions and 17 deletions

View File

@@ -154,7 +154,7 @@ class Game:
reward = PLAYER_BUDGET_BASE * len(self.theater.player_points()) reward = PLAYER_BUDGET_BASE * len(self.theater.player_points())
for cp in self.theater.player_points(): for cp in self.theater.player_points():
for g in cp.ground_objects: for g in cp.ground_objects:
if g.category in REWARDS.keys(): if g.category in REWARDS.keys() and not g.is_dead:
reward = reward + REWARDS[g.category] reward = reward + REWARDS[g.category]
return reward return reward
else: else:
@@ -277,7 +277,7 @@ class Game:
production = 0.0 production = 0.0
for enemy_point in self.theater.enemy_points(): for enemy_point in self.theater.enemy_points():
for g in enemy_point.ground_objects: for g in enemy_point.ground_objects:
if g.category in REWARDS.keys(): if g.category in REWARDS.keys() and not g.is_dead:
production = production + REWARDS[g.category] production = production + REWARDS[g.category]
production = production * 0.75 production = production * 0.75

View File

@@ -21,7 +21,7 @@ class Settings:
self.night_disabled = False self.night_disabled = False
self.external_views_allowed = True self.external_views_allowed = True
self.supercarrier = False self.supercarrier = False
self.multiplier = 1 self.multiplier = 1.0
self.generate_marks = True self.generate_marks = True
self.sams = True # Legacy parameter do not use self.sams = True # Legacy parameter do not use
self.cold_start = False # Legacy parameter do not use self.cold_start = False # Legacy parameter do not use

View File

@@ -144,6 +144,16 @@ class Conflict:
position = middle_point.point_from_heading(attack_heading, strength_delta * attack_distance / 2 - FRONTLINE_MIN_CP_DISTANCE) position = middle_point.point_from_heading(attack_heading, strength_delta * attack_distance / 2 - FRONTLINE_MIN_CP_DISTANCE)
return position, _opposite_heading(attack_heading) return position, _opposite_heading(attack_heading)
@classmethod
def flight_frontline_vector(cls, from_cp: ControlPoint, to_cp: ControlPoint, theater: ConflictTheater) -> Tuple[Point, int, int]:
"""Returns the frontline vector without regard for exclusion zones, used in CAS flight plan"""
frontline = cls.frontline_position(theater, from_cp, to_cp)
center_position, heading = frontline
left_position = center_position.point_from_heading(_heading_sum(heading, -90), int(FRONTLINE_LENGTH/2))
right_position = center_position.point_from_heading(_heading_sum(heading, 90), int(FRONTLINE_LENGTH/2))
return left_position, _heading_sum(heading, 90), int(right_position.distance_to_point(left_position))
@classmethod @classmethod
def frontline_vector(cls, from_cp: ControlPoint, to_cp: ControlPoint, theater: ConflictTheater) -> Tuple[Point, int, int]: def frontline_vector(cls, from_cp: ControlPoint, to_cp: ControlPoint, theater: ConflictTheater) -> Tuple[Point, int, int]:

View File

@@ -803,7 +803,7 @@ class FlightPlanBuilder:
if not isinstance(location, FrontLine): if not isinstance(location, FrontLine):
raise InvalidObjectiveLocation(flight.flight_type, location) raise InvalidObjectiveLocation(flight.flight_type, location)
ingress, heading, distance = Conflict.frontline_vector( ingress, heading, distance = Conflict.flight_frontline_vector(
location.control_points[0], location.control_points[1], location.control_points[0], location.control_points[1],
self.game.theater self.game.theater
) )

View File

@@ -183,6 +183,7 @@ class WaypointBuilder:
waypoint.description = description waypoint.description = description
waypoint.pretty_name = description waypoint.pretty_name = description
waypoint.name = target.name waypoint.name = target.name
waypoint.alt_type = "RADIO"
# The target waypoints are only for the player's benefit. AI tasks for # The target waypoints are only for the player's benefit. AI tasks for
# the target are set on the ingress point so they begin their attack # the target are set on the ingress point so they begin their attack
# *before* reaching the target. # *before* reaching the target.
@@ -209,6 +210,7 @@ class WaypointBuilder:
waypoint.description = name waypoint.description = name
waypoint.pretty_name = name waypoint.pretty_name = name
waypoint.name = name waypoint.name = name
waypoint.alt_type = "RADIO"
# The target waypoints are only for the player's benefit. AI tasks for # The target waypoints are only for the player's benefit. AI tasks for
# the target are set on the ingress point so they begin their attack # the target are set on the ingress point so they begin their attack
# *before* reaching the target. # *before* reaching the target.

View File

@@ -134,7 +134,7 @@ RADIOS: List[Radio] = [
Radio("RSIU-4V", MHz(100), MHz(150), step=MHz(1)), Radio("RSIU-4V", MHz(100), MHz(150), step=MHz(1)),
# MiG-21bis # MiG-21bis
Radio("RSIU-5V", MHz(100), MHz(150), step=MHz(1)), Radio("RSIU-5V", MHz(118), MHz(140), step=MHz(1)),
# Ka-50 # Ka-50
# Note: Also capable of 100MHz-150MHz, but we can't model gaps. # Note: Also capable of 100MHz-150MHz, but we can't model gaps.

View File

@@ -1,3 +1,5 @@
from __future__ import annotations
from dcs.action import MarkToAll from dcs.action import MarkToAll
from dcs.condition import TimeAfter from dcs.condition import TimeAfter
from dcs.mission import Mission from dcs.mission import Mission
@@ -5,7 +7,7 @@ from dcs.task import Option
from dcs.translation import String from dcs.translation import String
from dcs.triggers import Event, TriggerOnce from dcs.triggers import Event, TriggerOnce
from dcs.unit import Skill from dcs.unit import Skill
from dcs.unitgroup import FlyingGroup
from .conflictgen import Conflict from .conflictgen import Conflict
PUSH_TRIGGER_SIZE = 3000 PUSH_TRIGGER_SIZE = 3000
@@ -73,8 +75,9 @@ class TriggersGenerator:
continue continue
for country in coalition.countries.values(): for country in coalition.countries.values():
for plane_group in country.plane_group: flying_groups = country.plane_group + country.helicopter_group # type: FlyingGroup
for plane_unit in plane_group.units: for flying_group in flying_groups:
for plane_unit in flying_group.units:
if plane_unit.skill != Skill.Client and plane_unit.skill != Skill.Player: if plane_unit.skill != Skill.Client and plane_unit.skill != Skill.Player:
plane_unit.skill = Skill(skill_level[0]) plane_unit.skill = Skill(skill_level[0])

View File

@@ -48,12 +48,14 @@ class QTopPanel(QFrame):
self.passTurnButton.setIcon(CONST.ICONS["PassTurn"]) self.passTurnButton.setIcon(CONST.ICONS["PassTurn"])
self.passTurnButton.setProperty("style", "btn-primary") self.passTurnButton.setProperty("style", "btn-primary")
self.passTurnButton.clicked.connect(self.passTurn) self.passTurnButton.clicked.connect(self.passTurn)
if not self.game:
self.passTurnButton.setEnabled(False)
self.proceedButton = QPushButton("Take off") self.proceedButton = QPushButton("Take off")
self.proceedButton.setIcon(CONST.ICONS["Proceed"]) self.proceedButton.setIcon(CONST.ICONS["Proceed"])
self.proceedButton.setProperty("style", "start-button") self.proceedButton.setProperty("style", "start-button")
self.proceedButton.clicked.connect(self.launch_mission) self.proceedButton.clicked.connect(self.launch_mission)
if self.game and self.game.turn == 0: if not self.game or self.game.turn == 0:
self.proceedButton.setEnabled(False) self.proceedButton.setEnabled(False)
self.factionsInfos = QFactionsInfos(self.game) self.factionsInfos = QFactionsInfos(self.game)
@@ -101,6 +103,8 @@ class QTopPanel(QFrame):
self.budgetBox.setGame(game) self.budgetBox.setGame(game)
self.factionsInfos.setGame(game) self.factionsInfos.setGame(game)
self.passTurnButton.setEnabled(True)
if game and game.turn == 0: if game and game.turn == 0:
self.proceedButton.setEnabled(False) self.proceedButton.setEnabled(False)
else: else:

View File

@@ -62,7 +62,9 @@ class NewGameWizard(QtWidgets.QWizard):
timePeriod = db.TIME_PERIODS[list(db.TIME_PERIODS.keys())[self.field("timePeriod")]] timePeriod = db.TIME_PERIODS[list(db.TIME_PERIODS.keys())[self.field("timePeriod")]]
midGame = self.field("midGame") midGame = self.field("midGame")
multiplier = self.field("multiplier") # QSlider forces integers, so we use 1 to 50 and divide by 10 to give
# 0.1 to 5.0.
multiplier = self.field("multiplier") / 10
no_carrier = self.field("no_carrier") no_carrier = self.field("no_carrier")
no_lha = self.field("no_lha") no_lha = self.field("no_lha")
supercarrier = self.field("supercarrier") supercarrier = self.field("supercarrier")
@@ -324,6 +326,44 @@ class BudgetInputs(QtWidgets.QGridLayout):
self.addWidget(self.starting_money, 1, 1) self.addWidget(self.starting_money, 1, 1)
class ForceMultiplierSpinner(QtWidgets.QSpinBox):
def __init__(self, minimum: Optional[int] = None,
maximum: Optional[int] = None,
initial: Optional[int] = None) -> None:
super().__init__()
if minimum is not None:
self.setMinimum(minimum)
if maximum is not None:
self.setMaximum(maximum)
if initial is not None:
self.setValue(initial)
def textFromValue(self, val: int) -> str:
return f"X {val / 10:.1f}"
class ForceMultiplierInputs(QtWidgets.QGridLayout):
def __init__(self) -> None:
super().__init__()
self.addWidget(QtWidgets.QLabel("Enemy forces multiplier"), 0, 0)
minimum = 1
maximum = 50
initial = 10
slider = QtWidgets.QSlider(Qt.Horizontal)
slider.setMinimum(minimum)
slider.setMaximum(maximum)
slider.setValue(initial)
self.multiplier = ForceMultiplierSpinner(minimum, maximum, initial)
slider.valueChanged.connect(lambda x: self.multiplier.setValue(x))
self.multiplier.valueChanged.connect(lambda x: slider.setValue(x))
self.addWidget(slider, 1, 0)
self.addWidget(self.multiplier, 1, 1)
class MiscOptions(QtWidgets.QWizardPage): class MiscOptions(QtWidgets.QWizardPage):
def __init__(self, parent=None): def __init__(self, parent=None):
super(MiscOptions, self).__init__(parent) super(MiscOptions, self).__init__(parent)
@@ -334,14 +374,12 @@ class MiscOptions(QtWidgets.QWizardPage):
QtGui.QPixmap('./resources/ui/wizard/logo1.png')) QtGui.QPixmap('./resources/ui/wizard/logo1.png'))
midGame = QtWidgets.QCheckBox() midGame = QtWidgets.QCheckBox()
multiplier = QtWidgets.QSpinBox() multiplier_inputs = ForceMultiplierInputs()
multiplier.setEnabled(False) self.registerField('multiplier', multiplier_inputs.multiplier)
multiplier.setMinimum(1)
multiplier.setMaximum(5)
miscSettingsGroup = QtWidgets.QGroupBox("Misc Settings") miscSettingsGroup = QtWidgets.QGroupBox("Misc Settings")
self.registerField('midGame', midGame) self.registerField('midGame', midGame)
self.registerField('multiplier', multiplier)
# Campaign settings # Campaign settings
generatorSettingsGroup = QtWidgets.QGroupBox("Generator Settings") generatorSettingsGroup = QtWidgets.QGroupBox("Generator Settings")
@@ -359,8 +397,7 @@ class MiscOptions(QtWidgets.QWizardPage):
layout = QtWidgets.QGridLayout() layout = QtWidgets.QGridLayout()
layout.addWidget(QtWidgets.QLabel("Start at mid game"), 1, 0) layout.addWidget(QtWidgets.QLabel("Start at mid game"), 1, 0)
layout.addWidget(midGame, 1, 1) layout.addWidget(midGame, 1, 1)
layout.addWidget(QtWidgets.QLabel("Ennemy forces multiplier [Disabled for Now]"), 2, 0) layout.addLayout(multiplier_inputs, 2, 0)
layout.addWidget(multiplier, 2, 1)
miscSettingsGroup.setLayout(layout) miscSettingsGroup.setLayout(layout)
generatorLayout = QtWidgets.QGridLayout() generatorLayout = QtWidgets.QGridLayout()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1010 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1010 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1010 B