mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
7a8dfeb819
@ -21,6 +21,7 @@ class Event:
|
||||
silent = False
|
||||
informational = False
|
||||
is_awacs_enabled = False
|
||||
ca_slots = 0
|
||||
operation = None # type: Operation
|
||||
difficulty = 1 # type: int
|
||||
game = None # type: Game
|
||||
@ -74,6 +75,7 @@ class Event:
|
||||
|
||||
def generate(self):
|
||||
self.operation.is_awacs_enabled = self.is_awacs_enabled
|
||||
self.operation.ca_slots = self.ca_slots
|
||||
|
||||
self.operation.prepare(self.game.theater.terrain, is_quick=False)
|
||||
self.operation.generate()
|
||||
|
||||
@ -27,6 +27,7 @@ class Operation:
|
||||
trigger_radius = TRIGGER_RADIUS_MEDIUM
|
||||
is_quick = None
|
||||
is_awacs_enabled = False
|
||||
ca_slots = 0
|
||||
|
||||
def __init__(self,
|
||||
game,
|
||||
@ -50,7 +51,6 @@ class Operation:
|
||||
def initialize(self, mission: Mission, conflict: Conflict):
|
||||
self.mission = mission
|
||||
self.conflict = conflict
|
||||
|
||||
self.armorgen = ArmorConflictGenerator(mission, conflict)
|
||||
self.airgen = AircraftConflictGenerator(mission, conflict, self.game.settings)
|
||||
self.aagen = AAConflictGenerator(mission, conflict)
|
||||
@ -90,6 +90,13 @@ class Operation:
|
||||
if self.is_awacs_enabled:
|
||||
self.briefinggen.append_frequency("AWACS", "133 MHz AM")
|
||||
|
||||
# combined arms
|
||||
self.mission.groundControl.pilot_can_control_vehicles = self.ca_slots > 0
|
||||
if self.game.player in [country.name for country in self.mission.coalition["blue"].countries.values()]:
|
||||
self.mission.groundControl.blue_tactical_commander = self.ca_slots
|
||||
else:
|
||||
self.mission.groundControl.red_tactical_commander = self.ca_slots
|
||||
|
||||
# ground infrastructure
|
||||
self.groundobjectgen.generate()
|
||||
self.extra_aagen.generate()
|
||||
|
||||
@ -45,6 +45,9 @@ class ArmorConflictGenerator:
|
||||
group_size=1,
|
||||
move_formation=PointAction.OffRoad)
|
||||
|
||||
vehicle: Vehicle = group.units[0]
|
||||
vehicle.player_can_drive = True
|
||||
|
||||
if not to:
|
||||
to = self.conflict.position.point_from_heading(0, 500)
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ from .styles import STYLES, RED
|
||||
|
||||
class EventMenu(Menu):
|
||||
scramble_entries = None # type: typing.Dict[typing.Type[Task], typing.Dict[typing.Type[UnitType], typing.Tuple[Entry, Entry]]]
|
||||
|
||||
ca_slot_entry = None # type: Entry
|
||||
error_label = None # type: Label
|
||||
awacs = None # type: IntVar
|
||||
|
||||
@ -100,8 +100,15 @@ class EventMenu(Menu):
|
||||
header("Support:")
|
||||
# Options
|
||||
awacs_enabled = self.game.budget >= AWACS_BUDGET_COST and NORMAL or DISABLED
|
||||
Checkbutton(self.frame, var=self.awacs, state=awacs_enabled, **STYLES["radiobutton"]).grid(row=row, column=0, sticky=E)
|
||||
Label(self.frame, text="AWACS ({}m)".format(AWACS_BUDGET_COST), **STYLES["widget"]).grid(row=row, column=3, sticky=W, padx=5, pady=5)
|
||||
Checkbutton(self.frame, var=self.awacs, state=awacs_enabled, **STYLES["radiobutton"]).grid(row=row, column=2, sticky=E)
|
||||
Label(self.frame, text="AWACS ({}m)".format(AWACS_BUDGET_COST), **STYLES["widget"]).grid(row=row, column=0, sticky=W, pady=5)
|
||||
row += 1
|
||||
|
||||
Label(self.frame, text="Combined Arms Slots", **STYLES["widget"]).grid(row=row, sticky=W)
|
||||
self.ca_slot_entry = Entry(self.frame, width=2)
|
||||
self.ca_slot_entry.insert(0, "0")
|
||||
self.ca_slot_entry.grid(column=1, row=row, sticky=W, padx=5)
|
||||
Button(self.frame, text="+", command=self.add_ca_slot, **STYLES["btn-primary"]).grid(column=2, row=row, padx=5, sticky=W)
|
||||
row += 1
|
||||
|
||||
header("Ready?")
|
||||
@ -124,6 +131,12 @@ class EventMenu(Menu):
|
||||
|
||||
return action
|
||||
|
||||
def add_ca_slot(self):
|
||||
value = self.ca_slot_entry.get()
|
||||
amount = int(value and value or "0")
|
||||
self.ca_slot_entry.delete(0, END)
|
||||
self.ca_slot_entry.insert(0, str(amount+1))
|
||||
|
||||
def client_one(self, task: typing.Type[Task], unit_type: UnitType) -> typing.Callable:
|
||||
def action():
|
||||
entry = self.scramble_entries[task][unit_type][1] # type: Entry
|
||||
@ -140,6 +153,13 @@ class EventMenu(Menu):
|
||||
else:
|
||||
self.event.is_awacs_enabled = False
|
||||
|
||||
ca_slot_entry_value = self.ca_slot_entry.get()
|
||||
try:
|
||||
ca_slots = int(ca_slot_entry_value and ca_slot_entry_value or "0")
|
||||
except:
|
||||
ca_slots = 0
|
||||
self.event.ca_slots = ca_slots
|
||||
|
||||
flights = {k: {} for k in self.event.tasks} # type: db.TaskForceDict
|
||||
units_scramble_counts = {} # type: typing.Dict[typing.Type[UnitType], int]
|
||||
tasks_scramble_counts = {} # type: typing.Dict[typing.Type[Task], int]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user