mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fixed issue with lost helicopters causing errors in debriefing.
Mission generated now configure bluefor and redfor coalition properly, so it is possible to use country that are not in the default coalitions. Added insurgent faction.
This commit is contained in:
parent
a7e202bbc8
commit
bd95258176
24
game/db.py
24
game/db.py
@ -16,6 +16,7 @@ from dcs.unitgroup import *
|
|||||||
from game.factions.china_2000 import China_2000
|
from game.factions.china_2000 import China_2000
|
||||||
from game.factions.france_1995 import France_1995
|
from game.factions.france_1995 import France_1995
|
||||||
from game.factions.germany_1990 import Germany_1990
|
from game.factions.germany_1990 import Germany_1990
|
||||||
|
from game.factions.insurgent import Insurgent
|
||||||
from game.factions.iran_2015 import Iran_2015
|
from game.factions.iran_2015 import Iran_2015
|
||||||
from game.factions.israel_2000 import Israel_2000
|
from game.factions.israel_2000 import Israel_2000
|
||||||
from game.factions.italy_1990 import Italy_1990
|
from game.factions.italy_1990 import Italy_1990
|
||||||
@ -163,6 +164,7 @@ PRICES = {
|
|||||||
Armor.IFV_BMP_2: 16,
|
Armor.IFV_BMP_2: 16,
|
||||||
Armor.IFV_BMP_3: 20,
|
Armor.IFV_BMP_3: 20,
|
||||||
|
|
||||||
|
Armor.APC_Cobra: 4,
|
||||||
Armor.APC_M113: 6,
|
Armor.APC_M113: 6,
|
||||||
Armor.APC_M1043_HMMWV_Armament: 2,
|
Armor.APC_M1043_HMMWV_Armament: 2,
|
||||||
Armor.ATGM_M1045_HMMWV_TOW: 8,
|
Armor.ATGM_M1045_HMMWV_TOW: 8,
|
||||||
@ -174,6 +176,7 @@ PRICES = {
|
|||||||
Armor.MBT_Leclerc: 35,
|
Armor.MBT_Leclerc: 35,
|
||||||
Armor.MBT_Leopard_1A3: 24,
|
Armor.MBT_Leopard_1A3: 24,
|
||||||
Armor.MBT_Leopard_2: 35,
|
Armor.MBT_Leopard_2: 35,
|
||||||
|
Armor.MBT_Merkava_Mk__4: 35,
|
||||||
Armor.TPz_Fuchs: 8,
|
Armor.TPz_Fuchs: 8,
|
||||||
Armor.MBT_Challenger_II: 30,
|
Armor.MBT_Challenger_II: 30,
|
||||||
|
|
||||||
@ -211,6 +214,7 @@ PRICES = {
|
|||||||
Armor.MT_M4_Sherman:4,
|
Armor.MT_M4_Sherman:4,
|
||||||
Armor.MT_M4A4_Sherman_Firefly:6,
|
Armor.MT_M4A4_Sherman_Firefly:6,
|
||||||
Armor.M30_Cargo_Carrier:2,
|
Armor.M30_Cargo_Carrier:2,
|
||||||
|
Armor.APC_M2A1:2,
|
||||||
AirDefence.AAA_Bofors_40mm:4,
|
AirDefence.AAA_Bofors_40mm:4,
|
||||||
AirDefence.AAA_Flak_36:6,
|
AirDefence.AAA_Flak_36:6,
|
||||||
AirDefence.AAA_Flak_18:4,
|
AirDefence.AAA_Flak_18:4,
|
||||||
@ -344,6 +348,10 @@ UNIT_BY_TASK = {
|
|||||||
Armor.MBT_T_80U,
|
Armor.MBT_T_80U,
|
||||||
Armor.MBT_T_90,
|
Armor.MBT_T_90,
|
||||||
|
|
||||||
|
Armor.APC_Cobra,
|
||||||
|
Armor.APC_Cobra,
|
||||||
|
Armor.APC_Cobra,
|
||||||
|
Armor.APC_Cobra,
|
||||||
Armor.APC_M113,
|
Armor.APC_M113,
|
||||||
Armor.APC_M113,
|
Armor.APC_M113,
|
||||||
Armor.APC_M113,
|
Armor.APC_M113,
|
||||||
@ -369,16 +377,26 @@ UNIT_BY_TASK = {
|
|||||||
Armor.MBT_Leclerc,
|
Armor.MBT_Leclerc,
|
||||||
Armor.MBT_Leopard_2,
|
Armor.MBT_Leopard_2,
|
||||||
Armor.MBT_Challenger_II,
|
Armor.MBT_Challenger_II,
|
||||||
|
Armor.MBT_Merkava_Mk__4,
|
||||||
|
|
||||||
Armor.MT_Pz_Kpfw_V_Panther_Ausf_G,
|
Armor.MT_Pz_Kpfw_V_Panther_Ausf_G,
|
||||||
Armor.MT_Pz_Kpfw_IV_Ausf_H,
|
Armor.MT_Pz_Kpfw_IV_Ausf_H,
|
||||||
Armor.HT_Pz_Kpfw_VI_Tiger_I,
|
Armor.HT_Pz_Kpfw_VI_Tiger_I,
|
||||||
Armor.HT_Pz_Kpfw_VI_Ausf__B__Tiger_II,
|
Armor.HT_Pz_Kpfw_VI_Ausf__B__Tiger_II,
|
||||||
Armor.APC_Sd_Kfz_251,
|
Armor.APC_Sd_Kfz_251,
|
||||||
|
Armor.APC_Sd_Kfz_251,
|
||||||
|
Armor.APC_Sd_Kfz_251,
|
||||||
|
Armor.APC_Sd_Kfz_251,
|
||||||
|
Armor.IFV_Sd_Kfz_234_2_Puma,
|
||||||
Armor.IFV_Sd_Kfz_234_2_Puma,
|
Armor.IFV_Sd_Kfz_234_2_Puma,
|
||||||
Armor.MT_M4_Sherman,
|
Armor.MT_M4_Sherman,
|
||||||
Armor.MT_M4A4_Sherman_Firefly,
|
Armor.MT_M4A4_Sherman_Firefly,
|
||||||
Armor.M30_Cargo_Carrier,
|
Armor.M30_Cargo_Carrier,
|
||||||
|
Armor.M30_Cargo_Carrier,
|
||||||
|
Armor.APC_M2A1,
|
||||||
|
Armor.APC_M2A1,
|
||||||
|
Armor.APC_M2A1,
|
||||||
|
Armor.APC_M2A1,
|
||||||
|
|
||||||
],
|
],
|
||||||
AirDefence: [
|
AirDefence: [
|
||||||
@ -481,7 +499,8 @@ EXTRA_AA = {
|
|||||||
"Turkey": AirDefence.AAA_Vulcan_M163,
|
"Turkey": AirDefence.AAA_Vulcan_M163,
|
||||||
"Israel": AirDefence.AAA_Vulcan_M163,
|
"Israel": AirDefence.AAA_Vulcan_M163,
|
||||||
"India": AirDefence.SPAAA_ZSU_23_4_Shilka,
|
"India": AirDefence.SPAAA_ZSU_23_4_Shilka,
|
||||||
"United Arab Emirates": AirDefence.Stinger_MANPADS
|
"United Arab Emirates": AirDefence.Stinger_MANPADS,
|
||||||
|
"Insurgents": AirDefence.AAA_ZU_23_Insurgent_on_Ural_375
|
||||||
}
|
}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -497,6 +516,7 @@ FACTIONS = {
|
|||||||
"Iran 2015": Iran_2015,
|
"Iran 2015": Iran_2015,
|
||||||
"China 2000": China_2000,
|
"China 2000": China_2000,
|
||||||
"North Korea 2000": NorthKorea_2000,
|
"North Korea 2000": NorthKorea_2000,
|
||||||
|
"Insurgent": Insurgent,
|
||||||
|
|
||||||
"USA 2005": USA_2005,
|
"USA 2005": USA_2005,
|
||||||
"USA 1990": USA_1990,
|
"USA 1990": USA_1990,
|
||||||
@ -731,6 +751,8 @@ def unit_type_from_name(name: str) -> UnitType:
|
|||||||
return plane_map[name]
|
return plane_map[name]
|
||||||
elif name in ship_map:
|
elif name in ship_map:
|
||||||
return ship_map[name]
|
return ship_map[name]
|
||||||
|
if name in helicopter_map:
|
||||||
|
return helicopter_map[name]
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ from dcs.planes import *
|
|||||||
from dcs.vehicles import *
|
from dcs.vehicles import *
|
||||||
|
|
||||||
Germany_1944 = {
|
Germany_1944 = {
|
||||||
"country": "Russia", # WIP
|
"country": "Third Reich",
|
||||||
"side": "red",
|
"side": "red",
|
||||||
"units": [
|
"units": [
|
||||||
|
|
||||||
|
|||||||
25
game/factions/insurgent.py
Normal file
25
game/factions/insurgent.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
from dcs.vehicles import *
|
||||||
|
from dcs.ships import *
|
||||||
|
from dcs.planes import *
|
||||||
|
from dcs.helicopters import *
|
||||||
|
|
||||||
|
Insurgent = {
|
||||||
|
"country": "Insurgents",
|
||||||
|
"side": "red",
|
||||||
|
"units": [
|
||||||
|
|
||||||
|
AirDefence.AAA_ZU_23_Insurgent_Closed,
|
||||||
|
AirDefence.AAA_ZU_23_Insurgent_on_Ural_375,
|
||||||
|
|
||||||
|
Armor.APC_Cobra,
|
||||||
|
|
||||||
|
Unarmed.Transport_Ural_375,
|
||||||
|
Unarmed.Transport_UAZ_469,
|
||||||
|
Infantry.Soldier_AK,
|
||||||
|
Infantry.Infantry_Soldier_Insurgents,
|
||||||
|
|
||||||
|
Bulk_cargo_ship_Yakushev,
|
||||||
|
Dry_cargo_ship_Ivanov,
|
||||||
|
Tanker_Elnya_160
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -29,11 +29,11 @@ Iran_2015 = {
|
|||||||
Mi_28N,
|
Mi_28N,
|
||||||
Mi_24V,
|
Mi_24V,
|
||||||
|
|
||||||
AirDefence.AAA_ZU_23_Closed,
|
|
||||||
AirDefence.AAA_ZU_23_Insurgent_on_Ural_375,
|
|
||||||
AirDefence.SPAAA_ZSU_23_4_Shilka,
|
|
||||||
AirDefence.SAM_Hawk_PCP,
|
AirDefence.SAM_Hawk_PCP,
|
||||||
AirDefence.SAM_SA_2_LN_SM_90,
|
AirDefence.SAM_SA_2_LN_SM_90,
|
||||||
|
AirDefence.SAM_SA_6_Kub_LN_2P25,
|
||||||
|
AirDefence.HQ_7_Self_Propelled_LN,
|
||||||
|
AirDefence.SAM_SA_11_Buk_LN_9A310M1,
|
||||||
|
|
||||||
Armor.APC_M113,
|
Armor.APC_M113,
|
||||||
Armor.APC_BTR_80,
|
Armor.APC_BTR_80,
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
from dcs.countries import country_dict
|
||||||
from dcs.lua.parse import loads
|
from dcs.lua.parse import loads
|
||||||
|
|
||||||
from gen import *
|
from gen import *
|
||||||
@ -84,6 +85,22 @@ class Operation:
|
|||||||
|
|
||||||
self.current_mission = dcs.Mission(terrain)
|
self.current_mission = dcs.Mission(terrain)
|
||||||
|
|
||||||
|
print(self.game.player_country)
|
||||||
|
print(country_dict[db.country_id_from_name(self.game.player_country)])
|
||||||
|
print(country_dict[db.country_id_from_name(self.game.player_country)]())
|
||||||
|
|
||||||
|
# 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)]())
|
||||||
|
print([c for c in self.current_mission.coalition["blue"].countries.keys()])
|
||||||
|
print([c for c in self.current_mission.coalition["red"].countries.keys()])
|
||||||
|
|
||||||
if is_quick:
|
if is_quick:
|
||||||
self.quick_mission = self.current_mission
|
self.quick_mission = self.current_mission
|
||||||
else:
|
else:
|
||||||
|
|||||||
25
gen/sam/aaa_zu23_insurgent.py
Normal file
25
gen/sam/aaa_zu23_insurgent.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import random
|
||||||
|
|
||||||
|
from dcs.vehicles import AirDefence
|
||||||
|
|
||||||
|
from gen.sam.group_generator import AntiAirGroupGenerator
|
||||||
|
|
||||||
|
|
||||||
|
class ZU23InsurgentGenerator(AntiAirGroupGenerator):
|
||||||
|
"""
|
||||||
|
This generate a ZU23 insurgent flak artillery group
|
||||||
|
"""
|
||||||
|
|
||||||
|
def generate(self):
|
||||||
|
grid_x = random.randint(2, 4)
|
||||||
|
grid_y = random.randint(2, 4)
|
||||||
|
|
||||||
|
spacing = random.randint(10,40)
|
||||||
|
|
||||||
|
index = 0
|
||||||
|
for i in range(grid_x):
|
||||||
|
for j in range(grid_y):
|
||||||
|
index = index+1
|
||||||
|
self.add_unit(AirDefence.AAA_ZU_23_Insurgent_Closed, "AAA#" + str(index),
|
||||||
|
self.position.x + spacing*i,
|
||||||
|
self.position.y + spacing*j, self.heading)
|
||||||
@ -10,6 +10,7 @@ from dcs.vehicles import AirDefence
|
|||||||
from game import db
|
from game import db
|
||||||
from gen.sam.aaa_bofors import BoforsGenerator
|
from gen.sam.aaa_bofors import BoforsGenerator
|
||||||
from gen.sam.aaa_flak36 import Flak36Generator
|
from gen.sam.aaa_flak36 import Flak36Generator
|
||||||
|
from gen.sam.aaa_zu23_insurgent import ZU23InsurgentGenerator
|
||||||
from gen.sam.sam_avenger import AvengerGenerator
|
from gen.sam.sam_avenger import AvengerGenerator
|
||||||
from gen.sam.sam_chaparral import ChaparralGenerator
|
from gen.sam.sam_chaparral import ChaparralGenerator
|
||||||
from gen.sam.sam_gepard import GepardGenerator
|
from gen.sam.sam_gepard import GepardGenerator
|
||||||
@ -33,6 +34,7 @@ from gen.sam.sam_vulcan import VulcanGenerator
|
|||||||
from gen.sam.sam_zsu23 import ZSU23Generator
|
from gen.sam.sam_zsu23 import ZSU23Generator
|
||||||
from gen.sam.sam_zu23 import ZU23Generator
|
from gen.sam.sam_zu23 import ZU23Generator
|
||||||
from gen.sam.sam_zu23_ural import ZU23UralGenerator
|
from gen.sam.sam_zu23_ural import ZU23UralGenerator
|
||||||
|
from gen.sam.sam_zu23_ural_insurgent import ZU23UralInsurgentGenerator
|
||||||
|
|
||||||
|
|
||||||
def generate_anti_air_group(game, parent_cp, ground_object, faction:str):
|
def generate_anti_air_group(game, parent_cp, ground_object, faction:str):
|
||||||
@ -47,9 +49,12 @@ def generate_anti_air_group(game, parent_cp, ground_object, faction:str):
|
|||||||
SAM_MAP = {
|
SAM_MAP = {
|
||||||
|
|
||||||
AirDefence.SAM_Hawk_PCP:HawkGenerator,
|
AirDefence.SAM_Hawk_PCP:HawkGenerator,
|
||||||
|
AirDefence.AAA_ZU_23_Emplacement: ZU23Generator,
|
||||||
AirDefence.AAA_ZU_23_Closed:ZU23Generator,
|
AirDefence.AAA_ZU_23_Closed:ZU23Generator,
|
||||||
AirDefence.AAA_ZU_23_on_Ural_375: ZU23UralGenerator,
|
AirDefence.AAA_ZU_23_on_Ural_375: ZU23UralGenerator,
|
||||||
AirDefence.AAA_ZU_23_Insurgent_on_Ural_375:ZU23UralGenerator,
|
AirDefence.AAA_ZU_23_Insurgent_on_Ural_375:ZU23UralInsurgentGenerator,
|
||||||
|
AirDefence.AAA_ZU_23_Insurgent_Closed: ZU23InsurgentGenerator,
|
||||||
|
AirDefence.AAA_ZU_23_Insurgent: ZU23InsurgentGenerator,
|
||||||
AirDefence.SPAAA_ZSU_23_4_Shilka:ZSU23Generator,
|
AirDefence.SPAAA_ZSU_23_4_Shilka:ZSU23Generator,
|
||||||
AirDefence.AAA_Vulcan_M163: VulcanGenerator,
|
AirDefence.AAA_Vulcan_M163: VulcanGenerator,
|
||||||
AirDefence.SAM_Linebacker_M6: LinebackerGenerator,
|
AirDefence.SAM_Linebacker_M6: LinebackerGenerator,
|
||||||
|
|||||||
18
gen/sam/sam_zu23_ural_insurgent.py
Normal file
18
gen/sam/sam_zu23_ural_insurgent.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import random
|
||||||
|
|
||||||
|
from dcs.vehicles import AirDefence
|
||||||
|
|
||||||
|
from gen.sam.group_generator import AntiAirGroupGenerator
|
||||||
|
|
||||||
|
|
||||||
|
class ZU23UralInsurgentGenerator(AntiAirGroupGenerator):
|
||||||
|
"""
|
||||||
|
This generate a Zu23 Ural group
|
||||||
|
"""
|
||||||
|
|
||||||
|
def generate(self):
|
||||||
|
num_launchers = random.randint(2, 8)
|
||||||
|
|
||||||
|
positions = self.get_circular_position(num_launchers, launcher_distance=80, coverage=360)
|
||||||
|
for i, position in enumerate(positions):
|
||||||
|
self.add_unit(AirDefence.AAA_ZU_23_Insurgent_on_Ural_375, "SPAA#" + str(i), position[0], position[1], position[2])
|
||||||
@ -134,7 +134,7 @@ class VisualGenerator:
|
|||||||
mission_units.add(db.unit_type_of(unit))
|
mission_units.add(db.unit_type_of(unit))
|
||||||
|
|
||||||
for unit_type in mission_units:
|
for unit_type in mission_units:
|
||||||
self.mission.static_group(self.mission.country("USA"), "a", unit_type, Point(0, 300000), hidden=True)
|
self.mission.static_group(self.mission.country(self.game.player_country), "a", unit_type, Point(0, 300000), hidden=True)
|
||||||
|
|
||||||
def generate_target_smokes(self, target):
|
def generate_target_smokes(self, target):
|
||||||
spread = target.size * DESTINATION_SMOKE_DISTANCE_FACTOR
|
spread = target.size * DESTINATION_SMOKE_DISTANCE_FACTOR
|
||||||
|
|||||||
122
qt_ui/main2.py
122
qt_ui/main2.py
@ -1,63 +1,67 @@
|
|||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from dcs import Mission
|
# from dcs import Mission
|
||||||
from dcs.terrain import Caucasus
|
# from dcs.terrain import Caucasus
|
||||||
from dcs.vehicles import AirDefence
|
# from dcs.vehicles import AirDefence
|
||||||
|
#
|
||||||
|
# from game import Game
|
||||||
|
# from gen.sam.sam_avenger import AvengerGenerator
|
||||||
|
# from gen.sam.sam_chaparral import ChaparralGenerator
|
||||||
|
# from gen.sam.sam_gepard import GepardGenerator
|
||||||
|
# from gen.sam.sam_hawk import HawkGenerator
|
||||||
|
# from gen.sam.sam_linebacker import LinebackerGenerator
|
||||||
|
# from gen.sam.sam_patriot import PatriotGenerator
|
||||||
|
# from gen.sam.sam_rapier import RapierGenerator
|
||||||
|
# from gen.sam.sam_roland import RolandGenerator
|
||||||
|
# from gen.sam.sam_sa10 import SA10Generator
|
||||||
|
# from gen.sam.sam_sa11 import SA11Generator
|
||||||
|
# from gen.sam.sam_sa13 import SA13Generator
|
||||||
|
# from gen.sam.sam_sa15 import SA15Generator
|
||||||
|
# from gen.sam.sam_sa19 import SA19Generator
|
||||||
|
# from gen.sam.sam_sa2 import SA2Generator
|
||||||
|
# from gen.sam.sam_sa3 import SA3Generator
|
||||||
|
# from gen.sam.sam_sa6 import SA6Generator
|
||||||
|
# from gen.sam.sam_sa8 import SA8Generator
|
||||||
|
# from gen.sam.sam_sa9 import SA9Generator
|
||||||
|
# from gen.sam.sam_zsu23 import ZSU23Generator
|
||||||
|
# from gen.sam.sam_zu23 import ZU23Generator
|
||||||
|
# from gen.sam.sam_zu23_ural import ZU23UralGenerator
|
||||||
|
# from theater import TheaterGroundObject
|
||||||
|
# from theater.caucasus import WesternGeorgia
|
||||||
|
#
|
||||||
|
# ter = Caucasus()
|
||||||
|
# m = Mission()
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# game = Game("USA 1990", "Iran 2015", WesternGeorgia(), datetime.datetime.now())
|
||||||
|
#
|
||||||
|
# generated_groups = []
|
||||||
|
#
|
||||||
|
# for i,c in enumerate([SA3Generator, SA2Generator, SA6Generator, RapierGenerator,
|
||||||
|
# HawkGenerator, SA10Generator, SA19Generator, ZU23Generator,
|
||||||
|
# SA8Generator, SA11Generator, SA9Generator, SA13Generator,
|
||||||
|
# ZSU23Generator, SA15Generator, GepardGenerator, RolandGenerator,
|
||||||
|
# PatriotGenerator, ZU23UralGenerator, ChaparralGenerator,
|
||||||
|
# AvengerGenerator, LinebackerGenerator]):
|
||||||
|
# t = TheaterGroundObject()
|
||||||
|
# t.position = ter.kutaisi().position
|
||||||
|
# t.position.x += i*250
|
||||||
|
# t.dcs_identifier = "AA"
|
||||||
|
# gen = c(game, t)
|
||||||
|
# gen.generate()
|
||||||
|
# vehicle_group = gen.get_generated_group()
|
||||||
|
# generated_groups.append(vehicle_group)
|
||||||
|
#
|
||||||
|
# for g in generated_groups:
|
||||||
|
# g.name = m.string(g.name)
|
||||||
|
# for unit in g.units:
|
||||||
|
# unit.name = m.string(unit.name)
|
||||||
|
# m.country("USA").add_vehicle_group(g)
|
||||||
|
#
|
||||||
|
# m.save("./test.miz")
|
||||||
|
from dcs.helicopters import SA342M
|
||||||
|
|
||||||
from game import Game
|
from game import db
|
||||||
from gen.sam.sam_avenger import AvengerGenerator
|
|
||||||
from gen.sam.sam_chaparral import ChaparralGenerator
|
|
||||||
from gen.sam.sam_gepard import GepardGenerator
|
|
||||||
from gen.sam.sam_hawk import HawkGenerator
|
|
||||||
from gen.sam.sam_linebacker import LinebackerGenerator
|
|
||||||
from gen.sam.sam_patriot import PatriotGenerator
|
|
||||||
from gen.sam.sam_rapier import RapierGenerator
|
|
||||||
from gen.sam.sam_roland import RolandGenerator
|
|
||||||
from gen.sam.sam_sa10 import SA10Generator
|
|
||||||
from gen.sam.sam_sa11 import SA11Generator
|
|
||||||
from gen.sam.sam_sa13 import SA13Generator
|
|
||||||
from gen.sam.sam_sa15 import SA15Generator
|
|
||||||
from gen.sam.sam_sa19 import SA19Generator
|
|
||||||
from gen.sam.sam_sa2 import SA2Generator
|
|
||||||
from gen.sam.sam_sa3 import SA3Generator
|
|
||||||
from gen.sam.sam_sa6 import SA6Generator
|
|
||||||
from gen.sam.sam_sa8 import SA8Generator
|
|
||||||
from gen.sam.sam_sa9 import SA9Generator
|
|
||||||
from gen.sam.sam_zsu23 import ZSU23Generator
|
|
||||||
from gen.sam.sam_zu23 import ZU23Generator
|
|
||||||
from gen.sam.sam_zu23_ural import ZU23UralGenerator
|
|
||||||
from theater import TheaterGroundObject
|
|
||||||
from theater.caucasus import WesternGeorgia
|
|
||||||
|
|
||||||
ter = Caucasus()
|
|
||||||
m = Mission()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
game = Game("USA 1990", "Iran 2015", WesternGeorgia(), datetime.datetime.now())
|
|
||||||
|
|
||||||
generated_groups = []
|
|
||||||
|
|
||||||
for i,c in enumerate([SA3Generator, SA2Generator, SA6Generator, RapierGenerator,
|
|
||||||
HawkGenerator, SA10Generator, SA19Generator, ZU23Generator,
|
|
||||||
SA8Generator, SA11Generator, SA9Generator, SA13Generator,
|
|
||||||
ZSU23Generator, SA15Generator, GepardGenerator, RolandGenerator,
|
|
||||||
PatriotGenerator, ZU23UralGenerator, ChaparralGenerator,
|
|
||||||
AvengerGenerator, LinebackerGenerator]):
|
|
||||||
t = TheaterGroundObject()
|
|
||||||
t.position = ter.kutaisi().position
|
|
||||||
t.position.x += i*250
|
|
||||||
t.dcs_identifier = "AA"
|
|
||||||
gen = c(game, t)
|
|
||||||
gen.generate()
|
|
||||||
vehicle_group = gen.get_generated_group()
|
|
||||||
generated_groups.append(vehicle_group)
|
|
||||||
|
|
||||||
for g in generated_groups:
|
|
||||||
g.name = m.string(g.name)
|
|
||||||
for unit in g.units:
|
|
||||||
unit.name = m.string(unit.name)
|
|
||||||
m.country("USA").add_vehicle_group(g)
|
|
||||||
|
|
||||||
m.save("./test.miz")
|
|
||||||
|
|
||||||
|
print(db.unit_type_name(None))
|
||||||
@ -42,14 +42,20 @@ class QDebriefingWindow(QDialog):
|
|||||||
|
|
||||||
row = 0
|
row = 0
|
||||||
for unit_type, count in self.debriefing.player_dead_aircraft_dict.items():
|
for unit_type, count in self.debriefing.player_dead_aircraft_dict.items():
|
||||||
|
try:
|
||||||
lostUnitsLayout.addWidget(QLabel(db.unit_type_name(unit_type)), row, 0)
|
lostUnitsLayout.addWidget(QLabel(db.unit_type_name(unit_type)), row, 0)
|
||||||
lostUnitsLayout.addWidget(QLabel("{}".format(count)), row, 1)
|
lostUnitsLayout.addWidget(QLabel("{}".format(count)), row, 1)
|
||||||
row += 1
|
row += 1
|
||||||
|
except:
|
||||||
|
print("Issue adding " + str(unit_type) + " to debriefing information")
|
||||||
|
|
||||||
for unit_type, count in self.debriefing.player_dead_units_dict.items():
|
for unit_type, count in self.debriefing.player_dead_units_dict.items():
|
||||||
|
try:
|
||||||
lostUnitsLayout.addWidget(QLabel(db.unit_type_name(unit_type)), row, 0)
|
lostUnitsLayout.addWidget(QLabel(db.unit_type_name(unit_type)), row, 0)
|
||||||
lostUnitsLayout.addWidget(QLabel("{}".format(count)), row, 1)
|
lostUnitsLayout.addWidget(QLabel("{}".format(count)), row, 1)
|
||||||
row += 1
|
row += 1
|
||||||
|
except:
|
||||||
|
print("Issue adding " + str(unit_type) + " to debriefing information")
|
||||||
|
|
||||||
self.layout.addWidget(lostUnits)
|
self.layout.addWidget(lostUnits)
|
||||||
|
|
||||||
@ -67,9 +73,12 @@ class QDebriefingWindow(QDialog):
|
|||||||
for unit_type, count in self.debriefing.enemy_dead_aircraft_dict.items():
|
for unit_type, count in self.debriefing.enemy_dead_aircraft_dict.items():
|
||||||
if count == 0:
|
if count == 0:
|
||||||
continue
|
continue
|
||||||
|
try:
|
||||||
enemylostUnitsLayout.addWidget(QLabel(db.unit_type_name(unit_type)), row, 0)
|
enemylostUnitsLayout.addWidget(QLabel(db.unit_type_name(unit_type)), row, 0)
|
||||||
enemylostUnitsLayout.addWidget(QLabel("{}".format(count)), row, 1)
|
enemylostUnitsLayout.addWidget(QLabel("{}".format(count)), row, 1)
|
||||||
row += 1
|
row += 1
|
||||||
|
except:
|
||||||
|
print("Issue adding " + str(unit_type) + " to debriefing information")
|
||||||
|
|
||||||
for unit_type, count in self.debriefing.enemy_dead_units_dict.items():
|
for unit_type, count in self.debriefing.enemy_dead_units_dict.items():
|
||||||
if count == 0:
|
if count == 0:
|
||||||
|
|||||||
@ -20,7 +20,7 @@ local function messageAll(message)
|
|||||||
end
|
end
|
||||||
|
|
||||||
write_state = function()
|
write_state = function()
|
||||||
messageAll("Writing DCS Liberation State...")
|
--messageAll("Writing DCS Liberation State...")
|
||||||
local fp = io.open(debriefing_file_location, 'w')
|
local fp = io.open(debriefing_file_location, 'w')
|
||||||
local game_state = {
|
local game_state = {
|
||||||
["killed_aircrafts"] = killed_aircrafts,
|
["killed_aircrafts"] = killed_aircrafts,
|
||||||
@ -31,7 +31,7 @@ write_state = function()
|
|||||||
}
|
}
|
||||||
fp:write(json:encode(game_state))
|
fp:write(json:encode(game_state))
|
||||||
fp:close()
|
fp:close()
|
||||||
messageAll("Done writing DCS Liberation state.")
|
--messageAll("Done writing DCS Liberation state.")
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.scheduleFunction(write_state, {}, timer.getTime() + 10, 60, timer.getTime() + 3600)
|
mist.scheduleFunction(write_state, {}, timer.getTime() + 10, 60, timer.getTime() + 3600)
|
||||||
@ -39,7 +39,7 @@ mist.scheduleFunction(write_state, {}, timer.getTime() + 10, 60, timer.getTime()
|
|||||||
activeWeapons = {}
|
activeWeapons = {}
|
||||||
local function onEvent(event)
|
local function onEvent(event)
|
||||||
if event.id == world.event.S_EVENT_CRASH and event.initiator then
|
if event.id == world.event.S_EVENT_CRASH and event.initiator then
|
||||||
messageAll("Crash :" .. event.initiator.getName(event.initiator))
|
messageAll("Destroyed :" .. event.initiator.getName(event.initiator))
|
||||||
killed_aircrafts[#killed_aircrafts + 1] = event.initiator.getName(event.initiator)
|
killed_aircrafts[#killed_aircrafts + 1] = event.initiator.getName(event.initiator)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -52,6 +52,7 @@ local function onEvent(event)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if event.id == world.event.S_EVENT_BASE_CAPTURED and event.place then
|
if event.id == world.event.S_EVENT_BASE_CAPTURED and event.place then
|
||||||
|
messageAll("Base captured :" .. event.place.getName(event.place))
|
||||||
base_capture_events[#base_capture_events + 1] = event.place.getID(event.place) .. "||" .. event.place.getCoalition(event.place) .. "||" .. event.place.getName(event.place)
|
base_capture_events[#base_capture_events + 1] = event.place.getID(event.place) .. "||" .. event.place.getCoalition(event.place) .. "||" .. event.place.getName(event.place)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -47,6 +47,9 @@ class PersianGulfTheater(ConflictTheater):
|
|||||||
al_ain = ControlPoint.from_airport(persiangulf.Al_Ain_International_Airport, LAND, SIZE_BIG, IMPORTANCE_HIGH)
|
al_ain = ControlPoint.from_airport(persiangulf.Al_Ain_International_Airport, LAND, SIZE_BIG, IMPORTANCE_HIGH)
|
||||||
liwa = ControlPoint.from_airport(persiangulf.Liwa_Airbase, LAND, SIZE_BIG, IMPORTANCE_HIGH)
|
liwa = ControlPoint.from_airport(persiangulf.Liwa_Airbase, LAND, SIZE_BIG, IMPORTANCE_HIGH)
|
||||||
|
|
||||||
|
jiroft = ControlPoint.from_airport(persiangulf.Jiroft_Airport, LAND, SIZE_BIG, IMPORTANCE_HIGH)
|
||||||
|
bandar_e_jask = ControlPoint.from_airport(persiangulf.Bandar_e_Jask_airfield, LAND, SIZE_TINY, IMPORTANCE_LOW)
|
||||||
|
|
||||||
west_carrier = ControlPoint.carrier("West carrier", Point(-69043.813952358, -159916.65947136))
|
west_carrier = ControlPoint.carrier("West carrier", Point(-69043.813952358, -159916.65947136))
|
||||||
east_carrier = ControlPoint.carrier("East carrier", Point(59514.324335475, 28165.517980635))
|
east_carrier = ControlPoint.carrier("East carrier", Point(59514.324335475, 28165.517980635))
|
||||||
|
|
||||||
@ -125,6 +128,8 @@ class IranianCampaign(ConflictTheater):
|
|||||||
shiraz = ControlPoint.from_airport(persiangulf.Shiraz_International_Airport, LAND, SIZE_BIG, IMPORTANCE_HIGH)
|
shiraz = ControlPoint.from_airport(persiangulf.Shiraz_International_Airport, LAND, SIZE_BIG, IMPORTANCE_HIGH)
|
||||||
kerman = ControlPoint.from_airport(persiangulf.Kerman_Airport, LAND, SIZE_BIG, IMPORTANCE_HIGH)
|
kerman = ControlPoint.from_airport(persiangulf.Kerman_Airport, LAND, SIZE_BIG, IMPORTANCE_HIGH)
|
||||||
|
|
||||||
|
jiroft = ControlPoint.from_airport(persiangulf.Jiroft_Airport, LAND, SIZE_BIG, IMPORTANCE_HIGH)
|
||||||
|
bandar_e_jask = ControlPoint.from_airport(persiangulf.Bandar_e_Jask_airfield, LAND, SIZE_TINY, IMPORTANCE_LOW)
|
||||||
ras_al_khaimah = ControlPoint.from_airport(persiangulf.Ras_Al_Khaimah, LAND, SIZE_REGULAR, IMPORTANCE_MEDIUM)
|
ras_al_khaimah = ControlPoint.from_airport(persiangulf.Ras_Al_Khaimah, LAND, SIZE_REGULAR, IMPORTANCE_MEDIUM)
|
||||||
|
|
||||||
east_carrier = ControlPoint.carrier("East carrier", Point(59514.324335475, 28165.517980635))
|
east_carrier = ControlPoint.carrier("East carrier", Point(59514.324335475, 28165.517980635))
|
||||||
@ -133,15 +138,16 @@ class IranianCampaign(ConflictTheater):
|
|||||||
super(IranianCampaign, self).__init__()
|
super(IranianCampaign, self).__init__()
|
||||||
|
|
||||||
self.add_controlpoint(self.ras_al_khaimah, connected_to=[self.khasab])
|
self.add_controlpoint(self.ras_al_khaimah, connected_to=[self.khasab])
|
||||||
self.add_controlpoint(self.khasab, connected_to=[self.ras_al_khaimah, self.qeshm])
|
self.add_controlpoint(self.khasab, connected_to=[self.ras_al_khaimah])
|
||||||
|
|
||||||
self.add_controlpoint(self.bandar_lengeh, connected_to=[self.lar, self.qeshm])
|
self.add_controlpoint(self.bandar_lengeh, connected_to=[self.lar])
|
||||||
self.add_controlpoint(self.qeshm, connected_to=[self.khasab, self.bandar_lengeh, self.havadarya])
|
self.add_controlpoint(self.qeshm, connected_to=[])
|
||||||
self.add_controlpoint(self.havadarya, connected_to=[self.lar, self.qeshm, self.bandar_abbas])
|
self.add_controlpoint(self.havadarya, connected_to=[self.lar, self.bandar_abbas])
|
||||||
self.add_controlpoint(self.bandar_abbas, connected_to=[self.havadarya, self.kerman])
|
self.add_controlpoint(self.bandar_abbas, connected_to=[self.havadarya, self.jiroft])
|
||||||
|
|
||||||
self.add_controlpoint(self.shiraz, connected_to=[self.lar, self.kerman])
|
self.add_controlpoint(self.shiraz, connected_to=[self.lar, self.kerman])
|
||||||
self.add_controlpoint(self.kerman, connected_to=[self.lar, self.shiraz, self.bandar_abbas])
|
self.add_controlpoint(self.jiroft, connected_to=[self.kerman, self.bandar_abbas])
|
||||||
|
self.add_controlpoint(self.kerman, connected_to=[self.lar, self.shiraz, self.jiroft])
|
||||||
self.add_controlpoint(self.lar, connected_to=[self.bandar_lengeh, self.havadarya, self.shiraz, self.kerman])
|
self.add_controlpoint(self.lar, connected_to=[self.bandar_lengeh, self.havadarya, self.shiraz, self.kerman])
|
||||||
|
|
||||||
self.add_controlpoint(self.east_carrier)
|
self.add_controlpoint(self.east_carrier)
|
||||||
@ -149,3 +155,6 @@ class IranianCampaign(ConflictTheater):
|
|||||||
self.al_dhafra.captured = True
|
self.al_dhafra.captured = True
|
||||||
self.ras_al_khaimah.captured = True
|
self.ras_al_khaimah.captured = True
|
||||||
self.khasab.captured = True
|
self.khasab.captured = True
|
||||||
|
self.qeshm.captured = True
|
||||||
|
self.havadarya.captured = True
|
||||||
|
self.bandar_abbas.captured = True
|
||||||
|
|||||||
@ -25,6 +25,9 @@ class DebriefingDeadUnitInfo:
|
|||||||
self.player_unit = player_unit
|
self.player_unit = player_unit
|
||||||
self.type = type
|
self.type = type
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return str(self.country_id) + " " + str(self.player_unit) + " " + str(self.type)
|
||||||
|
|
||||||
class Debriefing:
|
class Debriefing:
|
||||||
def __init__(self, state_data, game):
|
def __init__(self, state_data, game):
|
||||||
self.base_capture_events = state_data["base_capture_events"]
|
self.base_capture_events = state_data["base_capture_events"]
|
||||||
@ -70,6 +73,11 @@ class Debriefing:
|
|||||||
self.player_dead_units = [a for a in self.dead_units if a.country_id == self.player_country_id]
|
self.player_dead_units = [a for a in self.dead_units if a.country_id == self.player_country_id]
|
||||||
self.enemy_dead_units = [a for a in self.dead_units if a.country_id == self.enemy_country_id]
|
self.enemy_dead_units = [a for a in self.dead_units if a.country_id == self.enemy_country_id]
|
||||||
|
|
||||||
|
print(self.player_dead_aircraft)
|
||||||
|
print(self.enemy_dead_aircraft)
|
||||||
|
print(self.player_dead_units)
|
||||||
|
print(self.enemy_dead_units)
|
||||||
|
|
||||||
self.player_dead_aircraft_dict = {}
|
self.player_dead_aircraft_dict = {}
|
||||||
for a in self.player_dead_aircraft:
|
for a in self.player_dead_aircraft:
|
||||||
if a.type in self.player_dead_aircraft_dict.keys():
|
if a.type in self.player_dead_aircraft_dict.keys():
|
||||||
@ -98,6 +106,12 @@ class Debriefing:
|
|||||||
else:
|
else:
|
||||||
self.enemy_dead_units_dict[a.type] = 1
|
self.enemy_dead_units_dict[a.type] = 1
|
||||||
|
|
||||||
|
print(self.player_dead_aircraft_dict)
|
||||||
|
print(self.enemy_dead_aircraft_dict)
|
||||||
|
print(self.player_dead_units_dict)
|
||||||
|
print(self.enemy_dead_units_dict)
|
||||||
|
|
||||||
|
|
||||||
def _poll_new_debriefing_log(callback: typing.Callable, game):
|
def _poll_new_debriefing_log(callback: typing.Callable, game):
|
||||||
if os.path.isfile("state.json"):
|
if os.path.isfile("state.json"):
|
||||||
last_modified = os.path.getmtime("state.json")
|
last_modified = os.path.getmtime("state.json")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user