updates to strike missions; frontline operations invalid units placement fixed; minor UI updates

This commit is contained in:
Vasyl Horbachenko
2018-09-09 04:15:44 +03:00
parent e0d82da6cb
commit 4ba1dd87e8
25 changed files with 176 additions and 97 deletions

View File

@@ -1,3 +1,5 @@
import webbrowser
from tkinter import *
from tkinter.ttk import *
from .styles import STYLES
@@ -64,7 +66,16 @@ class ConfigurationMenu(Menu):
Checkbutton(body, variable=self.night_var, **STYLES["radiobutton"]).grid(row=4, column=1, sticky=E)
Button(body, text="Back", command=self.dismiss, **STYLES["btn-primary"]).grid(row=5, column=1, sticky=E, pady=30)
Button(body, text="Cheat +200m", command=self.cheat_money, **STYLES["btn-danger"]).grid(row=6, column=1)
Label(body, text="Contributors: ", **STYLES["widget"]).grid(row=6, column=0, sticky=W)
Label(body, text="shdwp - author, maintainer", **STYLES["widget"]).grid(row=7, column=0, sticky=W)
Button(body, text="[github]", command=lambda: webbrowser.open_new_tab("http://github.com/shdwp"), **STYLES["widget"]).grid(row=7, column=1, sticky=E)
Label(body, text="Khopa - contributions", **STYLES["widget"]).grid(row=8, column=0, sticky=W)
Button(body, text="[github]", command=lambda: webbrowser.open_new_tab("http://github.com/Khopa"), **STYLES["widget"]).grid(row=8, column=1, sticky=E)
Button(body, text="Cheat +200m", command=self.cheat_money, **STYLES["btn-danger"]).grid(row=10, column=1, pady=30)
def cheat_money(self):
self.game.budget += 200

View File

@@ -13,6 +13,6 @@ class CorruptedSaveMenu(Menu):
def display(self):
self.window.clear_right_pane()
Label(text="Your save game was corrupted!", **STYLES["widget"]).grid(row=0, column=0)
Label(text="Your save game is either incompatible or was corrupted!", **STYLES["widget"]).grid(row=0, column=0)
Label(text="Please restore it by replacing \"liberation_save\" file with \"liberation_save_tmp\" to restore last saved copy.", **STYLES["widget"]).grid(row=1, column=0)
Label(text="You can find those files under user DCS directory.", **STYLES["widget"]).grid(row=2, column=0)
Label(text="You can find those files under user Saved Games\\DCS directory.", **STYLES["widget"]).grid(row=2, column=0)

View File

@@ -8,14 +8,14 @@ from .styles import STYLES, RED
UNITTYPES_FOR_EVENTS = {
FrontlineAttackEvent: [CAS, PinpointStrike],
FrontlinePatrolEvent: [CAP, PinpointStrike],
BaseAttackEvent: [CAP, CAS, PinpointStrike],
StrikeEvent: [CAP, CAS],
InterceptEvent: [CAP],
InsurgentAttackEvent: [CAS],
NavalInterceptEvent: [CAS],
InfantryTransportEvent: [Embarking],
FrontlineAttackEvent: [[CAS, PinpointStrike], [CAP]],
FrontlinePatrolEvent: [[CAP, PinpointStrike], [CAP]],
BaseAttackEvent: [[CAP, CAS, PinpointStrike], [CAP, CAS, PinpointStrike]],
StrikeEvent: [[CAP, CAS], [CAP]],
InterceptEvent: [[CAP], [CAP]],
InsurgentAttackEvent: [[CAS], [CAP]],
NavalInterceptEvent: [[CAS], [CAP]],
InfantryTransportEvent: [[Embarking], [CAP]],
}
AI_BAN_FOR_EVENTS = {
@@ -115,7 +115,8 @@ class EventMenu(Menu):
Label(self.frame, text="Client slots", **STYLES["widget"]).grid(row=row, column=3, columnspan=2)
row += 1
filter_to = UNITTYPES_FOR_EVENTS[self.event.__class__]
filter_attackers_index = 0 if self.game.is_player_attack(self.event) else 1
filter_to = UNITTYPES_FOR_EVENTS[self.event.__class__][filter_attackers_index]
for unit_type, count in self.base.aircraft.items():
if filter_to and db.unit_task(unit_type) not in filter_to:
continue
@@ -262,12 +263,6 @@ class EventMenu(Menu):
elif type(self.event) is NavalInterceptEvent:
e = self.event # type: NavalInterceptEvent
if self.game.is_player_attack(self.event):
e.player_attacking(strikegroup=scrambled_aircraft, clients=scrambled_clients)
else:
e.player_defending(interceptors=scrambled_aircraft, clients=scrambled_clients)
elif type(self.event) is AntiAAStrikeEvent:
e = self.event # type: AntiAAStrikeEvent
if self.game.is_player_attack(self.event):
e.player_attacking(strikegroup=scrambled_aircraft, clients=scrambled_clients)
else:

View File

@@ -86,6 +86,10 @@ class EventResultsMenu(Menu):
header("Enemy losses")
if self.debriefing.destroyed_objects:
Label(self.frame, text="Ground assets", **STYLES["widget"]).grid(row=row)
Label(self.frame, text="{}".format(len(self.debriefing.destroyed_objects)), **STYLES["widget"]).grid(column=1, row=row)
for unit_type, count in self.enemy_losses.items():
if count == 0:
continue

View File

@@ -51,10 +51,9 @@ class MainMenu(Menu):
nonlocal row, body
frame = LabelFrame(body, **STYLES["label-frame"])
frame.grid(row=row, sticky=NSEW)
Message(frame, text="{}{} at {}".format(
Message(frame, text="{}{}".format(
event.defender_name == self.game.player and "Enemy attacking: " or "",
event,
event.to_cp,
event
), aspect=1600, **STYLES["widget"]).grid(column=0, row=0, sticky=NSEW)
Button(body, text=">", command=self.start_event(event), **STYLES["btn-primary"]).grid(column=1, row=row, sticky=E)
row += 1
@@ -63,9 +62,8 @@ class MainMenu(Menu):
nonlocal row, body
Label(body, text=text, **STYLES["strong"]).grid(column=0, columnspan=2, row=row, sticky=N+EW, pady=(pady,0)); row += 1
#Separator(self.frame, orient='horizontal').grid(row=row, sticky=EW); row += 1
events = self.game.events
events.sort(key=lambda x: x.to_cp.name)
events.sort(key=lambda x: x.from_cp.name)
events.sort(key=lambda x: x.informational and 2 or (self.game.is_player_attack(x) and 1 or 0))
@@ -74,7 +72,7 @@ class MainMenu(Menu):
for event in events:
if not event.informational:
if self.game.is_player_attack(event):
new_destination = event.from_cp.name
new_destination = "From {} to {}".format(event.from_cp.name, event.to_cp.name)
else:
new_destination = "Enemy attack"
if destination != new_destination:

View File

@@ -81,6 +81,7 @@ 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)
distance = max(distance, 1000)
start_coords = self.transform_point(frontline_pos, treshold=10)
end_coords = self.transform_point(frontline_pos.point_from_heading(heading, distance), treshold=60)