mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Possible to mix factions side. Player will always be blue.
This commit is contained in:
parent
456a82acaa
commit
a4e93276b8
@ -206,10 +206,10 @@ class Event:
|
|||||||
|
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
# Captured bases
|
# Captured bases
|
||||||
if self.game.player_country in db.BLUEFOR_FACTIONS:
|
#if self.game.player_country in db.BLUEFOR_FACTIONS:
|
||||||
coalition = 2 # Value in DCS mission event for BLUE
|
coalition = 2 # Value in DCS mission event for BLUE
|
||||||
else:
|
#else:
|
||||||
coalition = 1 # Value in DCS mission event for RED
|
# coalition = 1 # Value in DCS mission event for RED
|
||||||
|
|
||||||
for captured in debriefing.base_capture_events:
|
for captured in debriefing.base_capture_events:
|
||||||
try:
|
try:
|
||||||
|
|||||||
18
game/game.py
18
game/game.py
@ -379,37 +379,19 @@ class Game:
|
|||||||
|
|
||||||
# 1 = red, 2 = blue
|
# 1 = red, 2 = blue
|
||||||
def get_player_coalition_id(self):
|
def get_player_coalition_id(self):
|
||||||
if self.player_country in db.BLUEFOR_FACTIONS:
|
|
||||||
return 2
|
return 2
|
||||||
else:
|
|
||||||
return 1
|
|
||||||
|
|
||||||
def get_enemy_coalition_id(self):
|
def get_enemy_coalition_id(self):
|
||||||
if self.get_player_coalition_id() == 1:
|
|
||||||
return 2
|
|
||||||
else:
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
def get_player_coalition(self):
|
def get_player_coalition(self):
|
||||||
if self.player_country in db.BLUEFOR_FACTIONS:
|
|
||||||
return dcs.action.Coalition.Blue
|
return dcs.action.Coalition.Blue
|
||||||
else:
|
|
||||||
return dcs.action.Coalition.Red
|
|
||||||
|
|
||||||
def get_enemy_coalition(self):
|
def get_enemy_coalition(self):
|
||||||
if self.player_country == 1:
|
|
||||||
return dcs.action.Coalition.Blue
|
|
||||||
else:
|
|
||||||
return dcs.action.Coalition.Red
|
return dcs.action.Coalition.Red
|
||||||
|
|
||||||
def get_player_color(self):
|
def get_player_color(self):
|
||||||
if self.get_player_coalition_id() == 1:
|
|
||||||
return "red"
|
|
||||||
else:
|
|
||||||
return "blue"
|
return "blue"
|
||||||
|
|
||||||
def get_enemy_color(self):
|
def get_enemy_color(self):
|
||||||
if self.get_player_coalition_id() == 1:
|
|
||||||
return "blue"
|
|
||||||
else:
|
|
||||||
return "red"
|
return "red"
|
||||||
@ -88,12 +88,21 @@ class Operation:
|
|||||||
# Setup coalition :
|
# Setup coalition :
|
||||||
self.current_mission.coalition["blue"] = Coalition("blue")
|
self.current_mission.coalition["blue"] = Coalition("blue")
|
||||||
self.current_mission.coalition["red"] = Coalition("red")
|
self.current_mission.coalition["red"] = Coalition("red")
|
||||||
if self.game.player_country and self.game.player_country in db.BLUEFOR_FACTIONS:
|
|
||||||
self.current_mission.coalition["blue"].add_country(country_dict[db.country_id_from_name(self.game.player_country)]())
|
p_country = self.game.player_country
|
||||||
self.current_mission.coalition["red"].add_country(country_dict[db.country_id_from_name(self.game.enemy_country)]())
|
e_country = self.game.enemy_country
|
||||||
|
if self.game.player_country == self.game.enemy_country:
|
||||||
|
if self.game.player_country != "USAF Aggresors":
|
||||||
|
e_country = "USAF Aggresors"
|
||||||
else:
|
else:
|
||||||
self.current_mission.coalition["blue"].add_country(country_dict[db.country_id_from_name(self.game.enemy_country)]())
|
if self.game.player_country != "Russia":
|
||||||
self.current_mission.coalition["red"].add_country(country_dict[db.country_id_from_name(self.game.player_country)]())
|
e_country = "Russia"
|
||||||
|
else:
|
||||||
|
e_country = "USA"
|
||||||
|
|
||||||
|
self.current_mission.coalition["blue"].add_country(country_dict[db.country_id_from_name(p_country)]())
|
||||||
|
self.current_mission.coalition["red"].add_country(country_dict[db.country_id_from_name(e_country)]())
|
||||||
|
|
||||||
print([c for c in self.current_mission.coalition["blue"].countries.keys()])
|
print([c for c in self.current_mission.coalition["blue"].countries.keys()])
|
||||||
print([c for c in self.current_mission.coalition["red"].countries.keys()])
|
print([c for c in self.current_mission.coalition["red"].countries.keys()])
|
||||||
|
|
||||||
|
|||||||
@ -95,8 +95,8 @@ class TriggersGenerator:
|
|||||||
self.mission.triggerrules.triggers.append(mark_trigger)
|
self.mission.triggerrules.triggers.append(mark_trigger)
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
player_coalition = self.game.player_country in db.BLUEFOR_FACTIONS and "blue" or "red"
|
player_coalition = "blue"
|
||||||
enemy_coalition = player_coalition == "blue" and "red" or "blue"
|
enemy_coalition = "red"
|
||||||
|
|
||||||
self.mission.coalition["blue"].bullseye = {"x": self.conflict.position.x,
|
self.mission.coalition["blue"].bullseye = {"x": self.conflict.position.x,
|
||||||
"y": self.conflict.position.y}
|
"y": self.conflict.position.y}
|
||||||
|
|||||||
@ -89,10 +89,7 @@ class QMapControlPoint(QGraphicsRectItem):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def brush_color(self)->QColor:
|
def brush_color(self)->QColor:
|
||||||
if self.parent.game.player_country in db.BLUEFOR_FACTIONS:
|
|
||||||
return self.model.captured and CONST.COLORS["blue"] or CONST.COLORS["super_red"]
|
return self.model.captured and CONST.COLORS["blue"] or CONST.COLORS["super_red"]
|
||||||
else:
|
|
||||||
return self.model.captured and CONST.COLORS["super_red"] or CONST.COLORS["blue"]
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pen_color(self) -> QColor:
|
def pen_color(self) -> QColor:
|
||||||
|
|||||||
@ -42,12 +42,9 @@ class QMapGroundObject(QGraphicsRectItem):
|
|||||||
|
|
||||||
def paint(self, painter, option, widget=None):
|
def paint(self, painter, option, widget=None):
|
||||||
#super(QMapControlPoint, self).paint(painter, option, widget)
|
#super(QMapControlPoint, self).paint(painter, option, widget)
|
||||||
if self.parent.game.player_country in db.BLUEFOR_FACTIONS:
|
|
||||||
playerIcons = "_blue"
|
playerIcons = "_blue"
|
||||||
enemyIcons = ""
|
enemyIcons = ""
|
||||||
else:
|
|
||||||
playerIcons = ""
|
|
||||||
enemyIcons = "_blue"
|
|
||||||
|
|
||||||
if self.parent.get_display_rule("go"):
|
if self.parent.get_display_rule("go"):
|
||||||
painter.save()
|
painter.save()
|
||||||
|
|||||||
@ -30,9 +30,8 @@ class NewGameWizard(QtWidgets.QWizard):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
|
|
||||||
blueFaction = [c for c in db.FACTIONS if db.FACTIONS[c]["side"] == "blue"][self.field("blueFaction")]
|
blueFaction = [c for c in db.FACTIONS][self.field("blueFaction")]
|
||||||
redFaction = [c for c in db.FACTIONS if db.FACTIONS[c]["side"] == "red"][self.field("redFaction")]
|
redFaction = [c for c in db.FACTIONS][self.field("redFaction")]
|
||||||
playerIsBlue = self.field("playerIsBlue")
|
|
||||||
isTerrainPg = self.field("isTerrainPg")
|
isTerrainPg = self.field("isTerrainPg")
|
||||||
isTerrainNttr = self.field("isTerrainNttr")
|
isTerrainNttr = self.field("isTerrainNttr")
|
||||||
isTerrainCaucasusSmall = self.field("isTerrainCaucasusSmall")
|
isTerrainCaucasusSmall = self.field("isTerrainCaucasusSmall")
|
||||||
@ -48,8 +47,8 @@ class NewGameWizard(QtWidgets.QWizard):
|
|||||||
midGame = self.field("midGame")
|
midGame = self.field("midGame")
|
||||||
multiplier = self.field("multiplier")
|
multiplier = self.field("multiplier")
|
||||||
|
|
||||||
player_name = playerIsBlue and blueFaction or redFaction
|
player_name = blueFaction
|
||||||
enemy_name = playerIsBlue and redFaction or blueFaction
|
enemy_name = redFaction
|
||||||
|
|
||||||
if isTerrainPg:
|
if isTerrainPg:
|
||||||
conflicttheater = persiangulf.PersianGulfTheater()
|
conflicttheater = persiangulf.PersianGulfTheater()
|
||||||
@ -144,31 +143,28 @@ class FactionSelection(QtWidgets.QWizardPage):
|
|||||||
|
|
||||||
self.setMinimumHeight(250)
|
self.setMinimumHeight(250)
|
||||||
|
|
||||||
blues = [c for c in db.FACTIONS if db.FACTIONS[c]["side"] == "blue"]
|
|
||||||
reds = [c for c in db.FACTIONS if db.FACTIONS[c]["side"] == "red"]
|
|
||||||
|
|
||||||
|
|
||||||
# Factions selection
|
# Factions selection
|
||||||
self.factionsGroup = QtWidgets.QGroupBox("Factions")
|
self.factionsGroup = QtWidgets.QGroupBox("Factions")
|
||||||
self.factionsGroupLayout = QtWidgets.QGridLayout()
|
self.factionsGroupLayout = QtWidgets.QGridLayout()
|
||||||
|
|
||||||
blueFaction = QtWidgets.QLabel("<b>Blue Faction :</b>")
|
blueFaction = QtWidgets.QLabel("<b>Player Faction :</b>")
|
||||||
self.blueFactionSelect = QtWidgets.QComboBox()
|
self.blueFactionSelect = QtWidgets.QComboBox()
|
||||||
for f in blues:
|
for f in db.FACTIONS:
|
||||||
self.blueFactionSelect.addItem(f)
|
self.blueFactionSelect.addItem(f)
|
||||||
blueFaction.setBuddy(self.blueFactionSelect)
|
blueFaction.setBuddy(self.blueFactionSelect)
|
||||||
|
|
||||||
redFaction = QtWidgets.QLabel("<b>Red Faction :</b>")
|
redFaction = QtWidgets.QLabel("<b>Enemy Faction :</b>")
|
||||||
self.redFactionSelect = QtWidgets.QComboBox()
|
self.redFactionSelect = QtWidgets.QComboBox()
|
||||||
for r in reds:
|
for i, r in enumerate(db.FACTIONS):
|
||||||
self.redFactionSelect.addItem(r)
|
self.redFactionSelect.addItem(r)
|
||||||
|
if r == "Russia 1990": # Default ennemy
|
||||||
|
self.redFactionSelect.setCurrentIndex(i)
|
||||||
redFaction.setBuddy(self.redFactionSelect)
|
redFaction.setBuddy(self.redFactionSelect)
|
||||||
|
|
||||||
self.blueSideRecap = QtWidgets.QLabel("")
|
self.blueSideRecap = QtWidgets.QLabel("")
|
||||||
self.blueSideRecap.setFont(CONST.FONT_PRIMARY_I)
|
self.blueSideRecap.setFont(CONST.FONT_PRIMARY_I)
|
||||||
self.blueSideRecap.setWordWrap(True)
|
self.blueSideRecap.setWordWrap(True)
|
||||||
|
|
||||||
self.blueGroup = QtWidgets.QGroupBox("Redfor")
|
|
||||||
self.redSideRecap = QtWidgets.QLabel("")
|
self.redSideRecap = QtWidgets.QLabel("")
|
||||||
self.redSideRecap.setFont(CONST.FONT_PRIMARY_I)
|
self.redSideRecap.setFont(CONST.FONT_PRIMARY_I)
|
||||||
self.redSideRecap.setWordWrap(True)
|
self.redSideRecap.setWordWrap(True)
|
||||||
@ -188,28 +184,14 @@ class FactionSelection(QtWidgets.QWizardPage):
|
|||||||
self.requiredModsGroupLayout.addWidget(self.requiredMods)
|
self.requiredModsGroupLayout.addWidget(self.requiredMods)
|
||||||
self.requiredModsGroup.setLayout(self.requiredModsGroupLayout)
|
self.requiredModsGroup.setLayout(self.requiredModsGroupLayout)
|
||||||
|
|
||||||
# Player faction selection
|
|
||||||
sideGroup = QtWidgets.QGroupBox("Player Side")
|
|
||||||
blueforRadioButton = QtWidgets.QRadioButton("BLUEFOR")
|
|
||||||
redforRadioButton = QtWidgets.QRadioButton("REDFOR")
|
|
||||||
blueforRadioButton.setChecked(True)
|
|
||||||
|
|
||||||
# Link form fields
|
# Link form fields
|
||||||
self.registerField('blueFaction', self.blueFactionSelect)
|
self.registerField('blueFaction', self.blueFactionSelect)
|
||||||
self.registerField('redFaction', self.redFactionSelect)
|
self.registerField('redFaction', self.redFactionSelect)
|
||||||
self.registerField('playerIsBlue', blueforRadioButton)
|
|
||||||
self.registerField('playerIsRed', redforRadioButton)
|
|
||||||
|
|
||||||
# Build layout
|
# Build layout
|
||||||
sideGroupLayout = QtWidgets.QVBoxLayout()
|
|
||||||
sideGroupLayout.addWidget(blueforRadioButton)
|
|
||||||
sideGroupLayout.addWidget(redforRadioButton)
|
|
||||||
sideGroup.setLayout(sideGroupLayout)
|
|
||||||
|
|
||||||
layout = QtWidgets.QVBoxLayout()
|
layout = QtWidgets.QVBoxLayout()
|
||||||
layout.addWidget(self.factionsGroup)
|
layout.addWidget(self.factionsGroup)
|
||||||
layout.addWidget(self.requiredModsGroup)
|
layout.addWidget(self.requiredModsGroup)
|
||||||
layout.addWidget(sideGroup)
|
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
self.updateUnitRecap()
|
self.updateUnitRecap()
|
||||||
|
|
||||||
|
|||||||
@ -64,6 +64,7 @@ def generate_groundobjects(theater: ConflictTheater, game):
|
|||||||
tpls = pickle.load(f)
|
tpls = pickle.load(f)
|
||||||
|
|
||||||
group_id = 0
|
group_id = 0
|
||||||
|
cp_to_remove = []
|
||||||
for cp in theater.controlpoints:
|
for cp in theater.controlpoints:
|
||||||
group_id = generate_cp_ground_points(cp, theater, game, group_id, tpls)
|
group_id = generate_cp_ground_points(cp, theater, game, group_id, tpls)
|
||||||
|
|
||||||
@ -94,6 +95,8 @@ def generate_groundobjects(theater: ConflictTheater, game):
|
|||||||
# Set new name :
|
# Set new name :
|
||||||
if "carrier_names" in db.FACTIONS[faction_name]:
|
if "carrier_names" in db.FACTIONS[faction_name]:
|
||||||
cp.name = random.choice(db.FACTIONS[faction_name]["carrier_names"])
|
cp.name = random.choice(db.FACTIONS[faction_name]["carrier_names"])
|
||||||
|
else:
|
||||||
|
cp_to_remove.append(cp)
|
||||||
elif cp.cptype == ControlPointType.LHA_GROUP:
|
elif cp.cptype == ControlPointType.LHA_GROUP:
|
||||||
# Create ground object group
|
# Create ground object group
|
||||||
group_id = group_id + 1
|
group_id = group_id + 1
|
||||||
@ -116,6 +119,8 @@ def generate_groundobjects(theater: ConflictTheater, game):
|
|||||||
if "lhanames" in db.FACTIONS[faction_name]:
|
if "lhanames" in db.FACTIONS[faction_name]:
|
||||||
cp.name = random.choice(db.FACTIONS[faction_name]["lhanames"])
|
cp.name = random.choice(db.FACTIONS[faction_name]["lhanames"])
|
||||||
else:
|
else:
|
||||||
|
cp_to_remove.append(cp)
|
||||||
|
else:
|
||||||
|
|
||||||
for i in range(random.randint(3,6)):
|
for i in range(random.randint(3,6)):
|
||||||
|
|
||||||
@ -181,6 +186,8 @@ def generate_groundobjects(theater: ConflictTheater, game):
|
|||||||
g.groups.append(group)
|
g.groups.append(group)
|
||||||
cp.ground_objects.append(g)
|
cp.ground_objects.append(g)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if "missiles" in db.FACTIONS[faction_name].keys():
|
if "missiles" in db.FACTIONS[faction_name].keys():
|
||||||
|
|
||||||
missiles_count = 1
|
missiles_count = 1
|
||||||
@ -214,6 +221,9 @@ def generate_groundobjects(theater: ConflictTheater, game):
|
|||||||
g.groups.append(group)
|
g.groups.append(group)
|
||||||
cp.ground_objects.append(g)
|
cp.ground_objects.append(g)
|
||||||
|
|
||||||
|
for cp in cp_to_remove:
|
||||||
|
theater.controlpoints.remove(cp)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def generate_airbase_defense_group(airbase_defense_group_id, ground_obj:TheaterGroundObject, faction, game, cp):
|
def generate_airbase_defense_group(airbase_defense_group_id, ground_obj:TheaterGroundObject, faction, game, cp):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user