mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
fixed land map for gulf; ability to get logs from settings; minor trigger updates
This commit is contained in:
parent
7a8dfeb819
commit
5bbf3fc49f
@ -53,11 +53,6 @@ class TriggersGenerator:
|
|||||||
vehicle_group.late_activation = True
|
vehicle_group.late_activation = True
|
||||||
activate_by_trigger.append(vehicle_group)
|
activate_by_trigger.append(vehicle_group)
|
||||||
|
|
||||||
for plane_group in country.plane_group:
|
|
||||||
if plane_group.task in [x.name for x in AirSupportConflictGenerator.support_tasks()]:
|
|
||||||
plane_group.late_activation = True
|
|
||||||
activate_by_trigger.append(plane_group)
|
|
||||||
|
|
||||||
conflict_distance = player_cp.position.distance_to_point(self.conflict.position)
|
conflict_distance = player_cp.position.distance_to_point(self.conflict.position)
|
||||||
minimum_radius = max(conflict_distance - TRIGGER_MIN_DISTANCE_FROM_START, TRIGGER_RADIUS_MINIMUM)
|
minimum_radius = max(conflict_distance - TRIGGER_MIN_DISTANCE_FROM_START, TRIGGER_RADIUS_MINIMUM)
|
||||||
if minimum_radius < 0:
|
if minimum_radius < 0:
|
||||||
@ -86,37 +81,39 @@ class TriggersGenerator:
|
|||||||
if player_cp.position.distance_to_point(group.position) > PUSH_TRIGGER_SIZE * 3:
|
if player_cp.position.distance_to_point(group.position) > PUSH_TRIGGER_SIZE * 3:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
regroup_heading = self.conflict.to_cp.position.heading_between_point(player_cp.position)
|
|
||||||
|
|
||||||
pos1 = group.position.point_from_heading(regroup_heading, REGROUP_ZONE_DISTANCE)
|
|
||||||
pos2 = group.position.point_from_heading(regroup_heading, REGROUP_ZONE_DISTANCE+5000)
|
|
||||||
w1 = group.add_waypoint(pos1, REGROUP_ALT)
|
|
||||||
w2 = group.add_waypoint(pos2, REGROUP_ALT)
|
|
||||||
|
|
||||||
group.points.remove(w1)
|
|
||||||
group.points.remove(w2)
|
|
||||||
|
|
||||||
group.points.insert(1, w2)
|
|
||||||
group.points.insert(1, w1)
|
|
||||||
|
|
||||||
w1.tasks.append(Silence(True))
|
|
||||||
|
|
||||||
switch_waypoint_task = ControlledTask(SwitchWaypoint(from_waypoint=3, to_waypoint=2))
|
|
||||||
switch_waypoint_task.start_if_user_flag(1, False)
|
|
||||||
w2.tasks.append(switch_waypoint_task)
|
|
||||||
group.points[3].tasks.append(Silence(False))
|
|
||||||
|
|
||||||
group.add_trigger_action(SwitchWaypoint(to_waypoint=4))
|
|
||||||
push_by_trigger.append(group)
|
push_by_trigger.append(group)
|
||||||
|
|
||||||
push_trigger_zone = self.mission.triggers.add_triggerzone(player_cp.position, PUSH_TRIGGER_SIZE, name="Push zone")
|
if not group.units[0].is_human():
|
||||||
|
regroup_heading = self.conflict.to_cp.position.heading_between_point(player_cp.position)
|
||||||
|
|
||||||
|
pos1 = group.position.point_from_heading(regroup_heading, REGROUP_ZONE_DISTANCE)
|
||||||
|
pos2 = group.position.point_from_heading(regroup_heading, REGROUP_ZONE_DISTANCE+5000)
|
||||||
|
w1 = group.add_waypoint(pos1, REGROUP_ALT)
|
||||||
|
w2 = group.add_waypoint(pos2, REGROUP_ALT)
|
||||||
|
|
||||||
|
group.points.remove(w1)
|
||||||
|
group.points.remove(w2)
|
||||||
|
|
||||||
|
group.points.insert(1, w2)
|
||||||
|
group.points.insert(1, w1)
|
||||||
|
|
||||||
|
w1.tasks.append(Silence(True))
|
||||||
|
|
||||||
|
switch_waypoint_task = ControlledTask(SwitchWaypoint(from_waypoint=3, to_waypoint=2))
|
||||||
|
switch_waypoint_task.start_if_user_flag(1, False)
|
||||||
|
w2.tasks.append(switch_waypoint_task)
|
||||||
|
group.points[3].tasks.append(Silence(False))
|
||||||
|
|
||||||
|
group.add_trigger_action(SwitchWaypoint(to_waypoint=4))
|
||||||
|
|
||||||
push_trigger = TriggerOnce(Event.NoEvent, "Push trigger")
|
push_trigger = TriggerOnce(Event.NoEvent, "Push trigger")
|
||||||
|
|
||||||
for group in push_by_trigger:
|
for group in push_by_trigger:
|
||||||
for unit in group.units:
|
for unit in group.units:
|
||||||
push_trigger.add_condition(UnitAltitudeHigherAGL(unit.id, PUSH_TRIGGER_ACTIVATION_AGL))
|
push_trigger.add_condition(UnitAltitudeHigherAGL(unit.id, PUSH_TRIGGER_ACTIVATION_AGL))
|
||||||
|
|
||||||
push_trigger.add_action(AITaskPush(group.id, 1))
|
if group.units[0].is_human():
|
||||||
|
push_trigger.add_action(AITaskPush(group.id, 1))
|
||||||
|
|
||||||
message_string = self.mission.string("Task force is in the air, proceed with the objective (activate waypoint 3).")
|
message_string = self.mission.string("Task force is in the air, proceed with the objective (activate waypoint 3).")
|
||||||
push_trigger.add_action(MessageToAll(message_string, clearview=True))
|
push_trigger.add_action(MessageToAll(message_string, clearview=True))
|
||||||
|
|||||||
36
resources/tools/generate_example_groundobjects.py
Normal file
36
resources/tools/generate_example_groundobjects.py
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import typing
|
||||||
|
|
||||||
|
from dcs.mission import *
|
||||||
|
from dcs.terrain import *
|
||||||
|
|
||||||
|
from theater.persiangulf import *
|
||||||
|
from theater.controlpoint import *
|
||||||
|
|
||||||
|
def find_ground_location(near, theater, max, min) -> typing.Optional[Point]:
|
||||||
|
for _ in range(500):
|
||||||
|
p = near.random_point_within(max, min)
|
||||||
|
if theater.is_on_land(p):
|
||||||
|
return p
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
mission = Mission(PersianGulf())
|
||||||
|
theater = PersianGulfTheater()
|
||||||
|
|
||||||
|
for cp in theater.enemy_points():
|
||||||
|
for _ in range(0, random.randrange(3, 6)):
|
||||||
|
p = find_ground_location(cp.position, theater, 120000, 5000)
|
||||||
|
if not p:
|
||||||
|
print("Didn't find ground location for {}".format(cp))
|
||||||
|
continue
|
||||||
|
|
||||||
|
mission.flight_group_inflight(
|
||||||
|
mission.country("USA"),
|
||||||
|
"",
|
||||||
|
A_10C,
|
||||||
|
p,
|
||||||
|
10000
|
||||||
|
)
|
||||||
|
|
||||||
|
mission.save("resources/tools/a.miz")
|
||||||
@ -76,9 +76,13 @@ class ConflictTheater:
|
|||||||
if not self.landmap:
|
if not self.landmap:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
for inclusion_zone in self.landmap[0]:
|
is_point_included = False
|
||||||
if not poly_contains(point.x, point.y, inclusion_zone):
|
for i, inclusion_zone in enumerate(self.landmap[0]):
|
||||||
return False
|
if poly_contains(point.x, point.y, inclusion_zone):
|
||||||
|
is_point_included = True
|
||||||
|
|
||||||
|
if not is_point_included:
|
||||||
|
return False
|
||||||
|
|
||||||
for exclusion_zone in self.landmap[1]:
|
for exclusion_zone in self.landmap[1]:
|
||||||
if poly_contains(point.x, point.y, exclusion_zone):
|
if poly_contains(point.x, point.y, exclusion_zone):
|
||||||
|
|||||||
@ -45,7 +45,7 @@ class PersianGulfTheater(ConflictTheater):
|
|||||||
|
|
||||||
west_carrier = ControlPoint.carrier("East carrier", Point(-100531.972946, 60939.275818))
|
west_carrier = ControlPoint.carrier("East carrier", Point(-100531.972946, 60939.275818))
|
||||||
|
|
||||||
def __init__(self, load_ground_objects=True):
|
def __init__(self):
|
||||||
super(PersianGulfTheater, self).__init__()
|
super(PersianGulfTheater, self).__init__()
|
||||||
|
|
||||||
self.add_controlpoint(self.shiraz, connected_to=[self.lar, self.kerman])
|
self.add_controlpoint(self.shiraz, connected_to=[self.lar, self.kerman])
|
||||||
@ -75,14 +75,3 @@ class PersianGulfTheater(ConflictTheater):
|
|||||||
|
|
||||||
self.west_carrier.captured = True
|
self.west_carrier.captured = True
|
||||||
self.kerman.captured = True
|
self.kerman.captured = True
|
||||||
|
|
||||||
"""
|
|
||||||
Mid game:
|
|
||||||
self.al_maktoum.captured = True
|
|
||||||
self.al_minhad.captured = True
|
|
||||||
self.dubai.captured = True
|
|
||||||
self.sharjah.captured = True
|
|
||||||
self.fujairah.captured = True
|
|
||||||
self.khasab.captured = True
|
|
||||||
self.sir_abu_nuayr.captured = True
|
|
||||||
"""
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ CATEGORY_MAP = {
|
|||||||
"aa": ["AA"],
|
"aa": ["AA"],
|
||||||
"power": ["Workshop A", "Electric power box", "Garage A"],
|
"power": ["Workshop A", "Electric power box", "Garage A"],
|
||||||
"warehouse": ["Warehouse", "Hangar A"],
|
"warehouse": ["Warehouse", "Hangar A"],
|
||||||
"fuel": ["Tank", "Tank 2", "Fuel tank"],
|
"fuel": ["Tank", "Tank 2", "Tank 3", "Fuel tank"],
|
||||||
"ammo": [".Ammunition depot", "Hangar B"],
|
"ammo": [".Ammunition depot", "Hangar B"],
|
||||||
"farp": ["FARP Tent", "FARP Ammo Dump Coating", "FARP Fuel Depot", "FARP Command Post", "FARP CP Blindage"],
|
"farp": ["FARP Tent", "FARP Ammo Dump Coating", "FARP Fuel Depot", "FARP Command Post", "FARP CP Blindage"],
|
||||||
"fob": ["Bunker 2", "Bunker 1", "Garage small B", ".Command Center", "Barracks 2"],
|
"fob": ["Bunker 2", "Bunker 1", "Garage small B", ".Command Center", "Barracks 2"],
|
||||||
|
|||||||
@ -4,6 +4,7 @@ from tkinter import *
|
|||||||
from tkinter.ttk import *
|
from tkinter.ttk import *
|
||||||
from .styles import STYLES
|
from .styles import STYLES
|
||||||
|
|
||||||
|
from userdata.logging import ShowLogsException
|
||||||
from ui.window import *
|
from ui.window import *
|
||||||
|
|
||||||
|
|
||||||
@ -65,6 +66,7 @@ class ConfigurationMenu(Menu):
|
|||||||
Checkbutton(body, variable=self.takeoff_var, **STYLES["radiobutton"]).grid(row=3, column=1, sticky=E)
|
Checkbutton(body, variable=self.takeoff_var, **STYLES["radiobutton"]).grid(row=3, column=1, sticky=E)
|
||||||
Checkbutton(body, variable=self.night_var, **STYLES["radiobutton"]).grid(row=4, column=1, sticky=E)
|
Checkbutton(body, variable=self.night_var, **STYLES["radiobutton"]).grid(row=4, column=1, sticky=E)
|
||||||
|
|
||||||
|
Button(body, text="Display logs", command=self.display_logs, **STYLES["btn-primary"]).grid(row=5, column=0, sticky=E, pady=30)
|
||||||
Button(body, text="Back", command=self.dismiss, **STYLES["btn-primary"]).grid(row=5, column=1, sticky=E, pady=30)
|
Button(body, text="Back", command=self.dismiss, **STYLES["btn-primary"]).grid(row=5, column=1, sticky=E, pady=30)
|
||||||
|
|
||||||
Label(body, text="Contributors: ", **STYLES["widget"]).grid(row=6, column=0, sticky=W)
|
Label(body, text="Contributors: ", **STYLES["widget"]).grid(row=6, column=0, sticky=W)
|
||||||
@ -77,5 +79,8 @@ class ConfigurationMenu(Menu):
|
|||||||
|
|
||||||
Button(body, text="Cheat +200m", command=self.cheat_money, **STYLES["btn-danger"]).grid(row=10, column=1, pady=30)
|
Button(body, text="Cheat +200m", command=self.cheat_money, **STYLES["btn-danger"]).grid(row=10, column=1, pady=30)
|
||||||
|
|
||||||
|
def display_logs(self):
|
||||||
|
raise ShowLogsException()
|
||||||
|
|
||||||
def cheat_money(self):
|
def cheat_money(self):
|
||||||
self.game.budget += 200
|
self.game.budget += 200
|
||||||
|
|||||||
@ -9,9 +9,14 @@ from tkinter.scrolledtext import *
|
|||||||
_version_string = None
|
_version_string = None
|
||||||
|
|
||||||
|
|
||||||
def _error_prompt():
|
class ShowLogsException(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def _error_prompt(oops=True):
|
||||||
tk = Tk()
|
tk = Tk()
|
||||||
Label(tk, text="Oops, something went wrong.").grid(row=0)
|
if oops:
|
||||||
|
Label(tk, text="Oops, something went wrong.").grid(row=0)
|
||||||
Label(tk, text="Please send following text to the developer:").grid(row=1)
|
Label(tk, text="Please send following text to the developer:").grid(row=1)
|
||||||
|
|
||||||
text = ScrolledText(tk)
|
text = ScrolledText(tk)
|
||||||
@ -22,7 +27,7 @@ def _error_prompt():
|
|||||||
|
|
||||||
def _handle_exception(self, exception: BaseException, *args):
|
def _handle_exception(self, exception: BaseException, *args):
|
||||||
logging.exception(exception)
|
logging.exception(exception)
|
||||||
_error_prompt()
|
_error_prompt(isinstance(exception, ShowLogsException))
|
||||||
|
|
||||||
|
|
||||||
def setup_version_string(str):
|
def setup_version_string(str):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user