Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Vasyl Horbachenko 2018-10-11 03:45:31 +03:00
commit 7a8dfeb819
4 changed files with 36 additions and 4 deletions

View File

@ -21,6 +21,7 @@ class Event:
silent = False silent = False
informational = False informational = False
is_awacs_enabled = False is_awacs_enabled = False
ca_slots = 0
operation = None # type: Operation operation = None # type: Operation
difficulty = 1 # type: int difficulty = 1 # type: int
game = None # type: Game game = None # type: Game
@ -74,6 +75,7 @@ class Event:
def generate(self): def generate(self):
self.operation.is_awacs_enabled = self.is_awacs_enabled 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.prepare(self.game.theater.terrain, is_quick=False)
self.operation.generate() self.operation.generate()

View File

@ -27,6 +27,7 @@ class Operation:
trigger_radius = TRIGGER_RADIUS_MEDIUM trigger_radius = TRIGGER_RADIUS_MEDIUM
is_quick = None is_quick = None
is_awacs_enabled = False is_awacs_enabled = False
ca_slots = 0
def __init__(self, def __init__(self,
game, game,
@ -50,7 +51,6 @@ class Operation:
def initialize(self, mission: Mission, conflict: Conflict): def initialize(self, mission: Mission, conflict: Conflict):
self.mission = mission self.mission = mission
self.conflict = conflict self.conflict = conflict
self.armorgen = ArmorConflictGenerator(mission, conflict) self.armorgen = ArmorConflictGenerator(mission, conflict)
self.airgen = AircraftConflictGenerator(mission, conflict, self.game.settings) self.airgen = AircraftConflictGenerator(mission, conflict, self.game.settings)
self.aagen = AAConflictGenerator(mission, conflict) self.aagen = AAConflictGenerator(mission, conflict)
@ -90,6 +90,13 @@ class Operation:
if self.is_awacs_enabled: if self.is_awacs_enabled:
self.briefinggen.append_frequency("AWACS", "133 MHz AM") 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 # ground infrastructure
self.groundobjectgen.generate() self.groundobjectgen.generate()
self.extra_aagen.generate() self.extra_aagen.generate()

View File

@ -45,6 +45,9 @@ class ArmorConflictGenerator:
group_size=1, group_size=1,
move_formation=PointAction.OffRoad) move_formation=PointAction.OffRoad)
vehicle: Vehicle = group.units[0]
vehicle.player_can_drive = True
if not to: if not to:
to = self.conflict.position.point_from_heading(0, 500) to = self.conflict.position.point_from_heading(0, 500)

View File

@ -9,7 +9,7 @@ from .styles import STYLES, RED
class EventMenu(Menu): class EventMenu(Menu):
scramble_entries = None # type: typing.Dict[typing.Type[Task], typing.Dict[typing.Type[UnitType], typing.Tuple[Entry, Entry]]] 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 error_label = None # type: Label
awacs = None # type: IntVar awacs = None # type: IntVar
@ -100,8 +100,15 @@ class EventMenu(Menu):
header("Support:") header("Support:")
# Options # Options
awacs_enabled = self.game.budget >= AWACS_BUDGET_COST and NORMAL or DISABLED 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) 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=3, sticky=W, padx=5, pady=5) 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 row += 1
header("Ready?") header("Ready?")
@ -124,6 +131,12 @@ class EventMenu(Menu):
return action 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 client_one(self, task: typing.Type[Task], unit_type: UnitType) -> typing.Callable:
def action(): def action():
entry = self.scramble_entries[task][unit_type][1] # type: Entry entry = self.scramble_entries[task][unit_type][1] # type: Entry
@ -140,6 +153,13 @@ class EventMenu(Menu):
else: else:
self.event.is_awacs_enabled = False 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 flights = {k: {} for k in self.event.tasks} # type: db.TaskForceDict
units_scramble_counts = {} # type: typing.Dict[typing.Type[UnitType], int] units_scramble_counts = {} # type: typing.Dict[typing.Type[UnitType], int]
tasks_scramble_counts = {} # type: typing.Dict[typing.Type[Task], int] tasks_scramble_counts = {} # type: typing.Dict[typing.Type[Task], int]