Possible to mix factions side. Player will always be blue.

This commit is contained in:
Khopa
2020-08-01 14:21:34 +02:00
parent 456a82acaa
commit a4e93276b8
8 changed files with 51 additions and 74 deletions

View File

@@ -206,10 +206,10 @@ class Event:
# ------------------------------
# Captured bases
if self.game.player_country in db.BLUEFOR_FACTIONS:
coalition = 2 # Value in DCS mission event for BLUE
else:
coalition = 1 # Value in DCS mission event for RED
#if self.game.player_country in db.BLUEFOR_FACTIONS:
coalition = 2 # Value in DCS mission event for BLUE
#else:
# coalition = 1 # Value in DCS mission event for RED
for captured in debriefing.base_capture_events:
try:

View File

@@ -379,37 +379,19 @@ class Game:
# 1 = red, 2 = blue
def get_player_coalition_id(self):
if self.player_country in db.BLUEFOR_FACTIONS:
return 2
else:
return 1
return 2
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):
if self.player_country in db.BLUEFOR_FACTIONS:
return dcs.action.Coalition.Blue
else:
return dcs.action.Coalition.Red
return dcs.action.Coalition.Blue
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):
if self.get_player_coalition_id() == 1:
return "red"
else:
return "blue"
return "blue"
def get_enemy_color(self):
if self.get_player_coalition_id() == 1:
return "blue"
else:
return "red"
return "red"

View File

@@ -88,12 +88,21 @@ class Operation:
# Setup coalition :
self.current_mission.coalition["blue"] = Coalition("blue")
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)]())
self.current_mission.coalition["red"].add_country(country_dict[db.country_id_from_name(self.game.enemy_country)]())
else:
self.current_mission.coalition["blue"].add_country(country_dict[db.country_id_from_name(self.game.enemy_country)]())
self.current_mission.coalition["red"].add_country(country_dict[db.country_id_from_name(self.game.player_country)]())
p_country = self.game.player_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:
if self.game.player_country != "Russia":
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["red"].countries.keys()])