mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9c1dd980b | ||
|
|
74c1861240 | ||
|
|
e8226782c1 | ||
|
|
a592cf3a05 | ||
|
|
0b1cb0d770 | ||
|
|
a4aa1cff3a | ||
|
|
6a02d2ffb6 |
@@ -2,6 +2,7 @@
|
||||
import os
|
||||
import sys
|
||||
import dcs
|
||||
import logging
|
||||
|
||||
import theater.caucasus
|
||||
import theater.persiangulf
|
||||
@@ -14,11 +15,13 @@ import ui.corruptedsavemenu
|
||||
|
||||
from game.game import Game
|
||||
from theater import start_generator
|
||||
from userdata import persistency, logging
|
||||
|
||||
from userdata import persistency, logging as logging_module
|
||||
|
||||
persistency.setup(sys.argv[1])
|
||||
dcs.planes.FlyingType.payload_dirs.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), "resources\\payloads"))
|
||||
dcs.planes.FlyingType.payload_dirs = [os.path.join(os.path.dirname(os.path.realpath(__file__)), "resources\\payloads")]
|
||||
|
||||
logging_module.setup_version_string(sys.argv[2])
|
||||
logging.info("Using {} as userdata folder".format(persistency.base_path()))
|
||||
|
||||
|
||||
def proceed_to_main_menu(game: Game):
|
||||
|
||||
@@ -37,10 +37,10 @@ and prioritization for the enemy (i.e. less important bases will receive units w
|
||||
PRICES = {
|
||||
# fighter
|
||||
C_101CC: 8,
|
||||
MiG_23MLD: 20,
|
||||
MiG_23MLD: 18,
|
||||
Su_27: 24,
|
||||
Su_33: 25,
|
||||
MiG_29A: 22,
|
||||
MiG_29A: 24,
|
||||
MiG_29S: 26,
|
||||
|
||||
F_5E_3: 6,
|
||||
@@ -137,6 +137,7 @@ UNIT_BY_TASK = {
|
||||
CAP: [
|
||||
C_101CC,
|
||||
F_5E_3,
|
||||
MiG_23MLD,
|
||||
Su_27,
|
||||
Su_33,
|
||||
MiG_21Bis,
|
||||
@@ -243,6 +244,7 @@ UNIT_BY_COUNTRY = {
|
||||
"Russia": [
|
||||
C_101CC,
|
||||
AJS37,
|
||||
MiG_23MLD,
|
||||
F_5E_3,
|
||||
Su_25,
|
||||
Su_27,
|
||||
@@ -287,6 +289,7 @@ UNIT_BY_COUNTRY = {
|
||||
],
|
||||
|
||||
"USA": [
|
||||
F_5E_3,
|
||||
F_15C,
|
||||
FA_18C_hornet,
|
||||
AJS37,
|
||||
@@ -340,7 +343,7 @@ Payload will be used for operation of following type, "*" category will be used
|
||||
"""
|
||||
PLANE_PAYLOAD_OVERRIDES = {
|
||||
FA_18C_hornet: {
|
||||
"*": "AIM-9M*6, AIM-7M*2, FUEL*3",
|
||||
"*": "AIM-120*4,AIM-9*2,AIM-7*2,Fuel",
|
||||
},
|
||||
|
||||
Su_33: {
|
||||
|
||||
@@ -37,14 +37,18 @@ TRANSPORT_LANDING_ALT = 1000
|
||||
DEFENCE_ENGAGEMENT_MAX_DISTANCE = 60000
|
||||
INTERCEPT_MAX_DISTANCE = 200000
|
||||
|
||||
GROUP_VERTICAL_OFFSET = 300
|
||||
|
||||
|
||||
class AircraftConflictGenerator:
|
||||
escort_targets = [] # type: typing.List[typing.Tuple[PlaneGroup, int]]
|
||||
vertical_offset = None # type: int
|
||||
|
||||
def __init__(self, mission: Mission, conflict: Conflict, settings: Settings):
|
||||
self.m = mission
|
||||
self.settings = settings
|
||||
self.conflict = conflict
|
||||
self.vertical_offset = 0
|
||||
self.escort_targets = []
|
||||
|
||||
def _start_type(self) -> StartType:
|
||||
@@ -123,14 +127,15 @@ class AircraftConflictGenerator:
|
||||
assert count > 0
|
||||
assert unit is not None
|
||||
|
||||
self.vertical_offset += GROUP_VERTICAL_OFFSET
|
||||
if unit_type in helicopters.helicopter_map.values():
|
||||
alt = WARM_START_HELI_ALT + random.randint(50, 200)
|
||||
alt = WARM_START_HELI_ALT + self.vertical_offset
|
||||
speed = WARM_START_HELI_AIRSPEED
|
||||
else:
|
||||
alt = WARM_START_ALTITUDE + random.randint(50, 200)
|
||||
alt = WARM_START_ALTITUDE + self.vertical_offset
|
||||
speed = WARM_START_AIRSPEED
|
||||
|
||||
pos = Point(at.x + random.randint(100, 200), at.y + random.randint(100, 200))
|
||||
pos = Point(at.x + random.randint(100, 1000), at.y + random.randint(100, 1000))
|
||||
|
||||
logging.info("airgen: {} for {} at {} at {}".format(unit_type, side.id, alt, speed))
|
||||
return self.m.flight_group(
|
||||
|
||||
@@ -33,7 +33,7 @@ class AirSupportConflictGenerator:
|
||||
plane_type=tanker_unit,
|
||||
position=tanker_position,
|
||||
altitude=TANKER_ALT,
|
||||
frequency=140,
|
||||
frequency=240,
|
||||
start_type=StartType.Warm,
|
||||
tacanchannel="99X",
|
||||
)
|
||||
@@ -49,6 +49,6 @@ class AirSupportConflictGenerator:
|
||||
altitude=AWACS_ALT,
|
||||
airport=None,
|
||||
position=self.conflict.position.random_point_within(AWACS_DISTANCE, AWACS_DISTANCE),
|
||||
frequency=180,
|
||||
frequency=244,
|
||||
start_type=StartType.Warm,
|
||||
)
|
||||
|
||||
@@ -149,10 +149,10 @@ class TriggersGenerator:
|
||||
description = ""
|
||||
description += "FREQUENCIES:"
|
||||
description += "\nFlight: 251 MHz AM"
|
||||
description += "\nTanker: 10X/140 MHz"
|
||||
description += "\nTanker: 10X/240 MHz"
|
||||
|
||||
if awacs_enabled:
|
||||
description += "\nAWACS: 180 MHz"
|
||||
description += "\nAWACS: 244 MHz"
|
||||
|
||||
if self.conflict.from_cp.is_global or self.conflict.to_cp.is_global:
|
||||
description += "\nCarrier: 20X/ICLS CHAN1"
|
||||
|
||||
Binary file not shown.
@@ -4,11 +4,11 @@ from dcs.mission import Mission
|
||||
from dcs.terrain import PersianGulf
|
||||
|
||||
m = Mission()
|
||||
m.load_file("tools/cau_terrain.miz")
|
||||
m.load_file("./gulf_terrain.miz")
|
||||
|
||||
landmap = []
|
||||
for plane_group in m.country("USA").plane_group:
|
||||
landmap.append([(x.position.x, x.position.y) for x in plane_group.points])
|
||||
|
||||
with open("./caulandmap.p", "wb") as f:
|
||||
with open("../gulflandmap.p", "wb") as f:
|
||||
pickle.dump(landmap, f)
|
||||
|
||||
Binary file not shown.
52
resources/tools/mkrelease.py
Normal file
52
resources/tools/mkrelease.py
Normal file
@@ -0,0 +1,52 @@
|
||||
import os
|
||||
|
||||
from zipfile import *
|
||||
|
||||
|
||||
IGNORED_PATHS = [
|
||||
"__pycache__",
|
||||
".gitignore",
|
||||
".gitmodules",
|
||||
".git",
|
||||
".idea",
|
||||
".DS_Store",
|
||||
"submodules",
|
||||
|
||||
"build",
|
||||
"venv",
|
||||
]
|
||||
|
||||
VERSION = "1.3.3"
|
||||
|
||||
|
||||
def _zip_dir(archieve, path):
|
||||
for path, directories, files in os.walk(path):
|
||||
is_ignored = False
|
||||
for ignored_path in IGNORED_PATHS:
|
||||
if ignored_path in path:
|
||||
is_ignored = True
|
||||
break
|
||||
|
||||
if is_ignored:
|
||||
continue
|
||||
|
||||
for file in files:
|
||||
if file in IGNORED_PATHS:
|
||||
continue
|
||||
archieve.write(os.path.join(path, file))
|
||||
|
||||
|
||||
def _mk_archieve():
|
||||
path = os.path.join("build", "dcs_liberation_{}.zip".format(VERSION))
|
||||
if os.path.exists(path):
|
||||
print("version already exists")
|
||||
return
|
||||
|
||||
archieve = ZipFile(path, "w")
|
||||
archieve.writestr("start.bat", "py.exe __init__.py \"%UserProfile%\" \"{}\"".format(VERSION))
|
||||
_zip_dir(archieve, ".")
|
||||
os.chdir("submodules\\dcs")
|
||||
_zip_dir(archieve, "dcs")
|
||||
|
||||
|
||||
_mk_archieve()
|
||||
Submodule submodules/dcs updated: c913af9c76...fae1266891
@@ -35,11 +35,11 @@ class PersianGulfTheater(ConflictTheater):
|
||||
tunb_kochak = ControlPoint.from_airport(persiangulf.Tunb_Kochak, [135, 180], SIZE_SMALL, 1.2, has_frontline=False)
|
||||
|
||||
bandar_lengeh = ControlPoint.from_airport(persiangulf.Bandar_Lengeh, [270, 315, 0, 45], SIZE_SMALL, 1.1)
|
||||
qeshm = ControlPoint.from_airport(persiangulf.Qeshm_Island, [270, 315, 0, 45, 90, 135, 180], SIZE_SMALL, 1.3, has_frontline=False)
|
||||
qeshm = ControlPoint.from_airport(persiangulf.Qeshm_Island, [270, 315, 0, 45, 90, 135, 180], SIZE_SMALL, 1.2, has_frontline=False)
|
||||
|
||||
havadarya = ControlPoint.from_airport(persiangulf.Havadarya, COAST_DL_W, SIZE_REGULAR, 1.2)
|
||||
bandar_abbas = ControlPoint.from_airport(persiangulf.Bandar_Abbas_Intl, LAND, SIZE_BIG, 1.3)
|
||||
lar = ControlPoint.from_airport(persiangulf.Lar_Airbase, LAND, SIZE_REGULAR, 1.1)
|
||||
havadarya = ControlPoint.from_airport(persiangulf.Havadarya, COAST_DL_W, SIZE_REGULAR, 1.1)
|
||||
bandar_abbas = ControlPoint.from_airport(persiangulf.Bandar_Abbas_Intl, LAND, SIZE_BIG, 1.2)
|
||||
lar = ControlPoint.from_airport(persiangulf.Lar_Airbase, LAND, SIZE_REGULAR, IMPORTANCE_LOW)
|
||||
shiraz = ControlPoint.from_airport(persiangulf.Shiraz_International_Airport, LAND, SIZE_BIG, IMPORTANCE_LOW)
|
||||
kerman = ControlPoint.from_airport(persiangulf.Kerman_Airport, LAND, SIZE_BIG, IMPORTANCE_LOW)
|
||||
|
||||
@@ -48,6 +48,10 @@ class PersianGulfTheater(ConflictTheater):
|
||||
def __init__(self):
|
||||
super(PersianGulfTheater, self).__init__()
|
||||
|
||||
self.add_controlpoint(self.shiraz, connected_to=[self.lar, self.kerman])
|
||||
self.add_controlpoint(self.kerman, connected_to=[self.lar, self.shiraz])
|
||||
self.add_controlpoint(self.lar, connected_to=[self.bandar_lengeh, self.qeshm, self.havadarya, self.shiraz, self.kerman])
|
||||
|
||||
self.add_controlpoint(self.al_dhafra, connected_to=[self.sir_abu_nuayr, self.al_maktoum])
|
||||
self.add_controlpoint(self.al_maktoum, connected_to=[self.al_dhafra, self.al_minhad, self.sir_abu_nuayr])
|
||||
self.add_controlpoint(self.al_minhad, connected_to=[self.al_maktoum, self.dubai])
|
||||
@@ -66,9 +70,6 @@ class PersianGulfTheater(ConflictTheater):
|
||||
self.add_controlpoint(self.qeshm, connected_to=[self.bandar_lengeh, self.havadarya, self.tunb_island, self.lar])
|
||||
self.add_controlpoint(self.havadarya, connected_to=[self.lar, self.qeshm, self.bandar_abbas])
|
||||
self.add_controlpoint(self.bandar_abbas, connected_to=[self.havadarya])
|
||||
self.add_controlpoint(self.lar, connected_to=[self.bandar_lengeh, self.qeshm, self.havadarya, self.shiraz, 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.add_controlpoint(self.west_carrier)
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class OverviewCanvas:
|
||||
self.canvas = Canvas(frame, width=self.image.width(), height=self.image.height())
|
||||
self.canvas.grid(column=0, row=0, sticky=NSEW)
|
||||
|
||||
def transform_point(self, p: Point) -> (int, int):
|
||||
def transform_point(self, p: Point, treshold=30) -> (int, int):
|
||||
point_a = list(self.game.theater.reference_points.keys())[0]
|
||||
point_a_img = self.game.theater.reference_points[point_a]
|
||||
|
||||
@@ -44,7 +44,6 @@ class OverviewCanvas:
|
||||
X = point_b_img[1] + X_offset * X_scale
|
||||
Y = point_a_img[0] - Y_offset * Y_scale
|
||||
|
||||
treshold = 30
|
||||
return X > treshold and X or treshold, Y > treshold and Y or treshold
|
||||
|
||||
def create_cp_title(self, coords, cp: ControlPoint):
|
||||
@@ -81,7 +80,9 @@ class OverviewCanvas:
|
||||
|
||||
if cp.captured and not connected_cp.captured and Conflict.has_frontline_between(cp, connected_cp):
|
||||
frontline_pos, heading, distance = Conflict.frontline_vector(cp, connected_cp, self.game.theater)
|
||||
start_coords, end_coords = self.transform_point(frontline_pos), self.transform_point(frontline_pos.point_from_heading(heading, distance))
|
||||
start_coords = self.transform_point(frontline_pos, treshold=10)
|
||||
end_coords = self.transform_point(frontline_pos.point_from_heading(heading, distance), treshold=60)
|
||||
|
||||
self.canvas.create_line((*start_coords, *end_coords), width=2, fill=color)
|
||||
|
||||
for cp in self.game.theater.controlpoints:
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import logging
|
||||
import traceback
|
||||
import sys
|
||||
|
||||
from io import StringIO
|
||||
from tkinter import *
|
||||
from tkinter.scrolledtext import *
|
||||
|
||||
log_stream = StringIO()
|
||||
logging.basicConfig(stream=log_stream, level=logging.INFO)
|
||||
_version_string = None
|
||||
|
||||
|
||||
def _error_prompt():
|
||||
@@ -25,5 +25,16 @@ def _handle_exception(self, exception: BaseException, *args):
|
||||
_error_prompt()
|
||||
|
||||
|
||||
Tk.report_callback_exception = _handle_exception
|
||||
logging.info("DCS Libration 1.3 RC2")
|
||||
def setup_version_string(str):
|
||||
global _version_string
|
||||
_version_string = str
|
||||
|
||||
|
||||
if "--stdout" in sys.argv:
|
||||
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
|
||||
else:
|
||||
log_stream = StringIO()
|
||||
logging.basicConfig(stream=log_stream, level=logging.INFO)
|
||||
Tk.report_callback_exception = _handle_exception
|
||||
|
||||
logging.info("DCS Libration {}".format(_version_string))
|
||||
|
||||
@@ -2,6 +2,7 @@ import logging
|
||||
import typing
|
||||
import pickle
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
_user_folder = None # type: str
|
||||
@@ -17,7 +18,7 @@ def base_path() -> str:
|
||||
assert _user_folder
|
||||
|
||||
openbeta_path = os.path.join(_user_folder, "Saved Games", "DCS.openbeta")
|
||||
if os.path.exists(openbeta_path):
|
||||
if "--force-stable-DCS" not in sys.argv and os.path.exists(openbeta_path):
|
||||
return openbeta_path
|
||||
else:
|
||||
return os.path.join(_user_folder, "Saved Games", "DCS")
|
||||
|
||||
Reference in New Issue
Block a user