mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
refactor of previous commits
refactor to enum typing and many other fixes fix tests attempt to fix some typescript more typescript fixes more typescript test fixes revert all API changes update to pydcs mypy fixes Use properties to check if player is blue/red/neutral update requirements.txt black -_- bump pydcs and fix mypy add opponent property bump pydcs
This commit is contained in:
@@ -35,6 +35,7 @@ from game.runways import RunwayData
|
||||
from game.settings import Settings
|
||||
from game.squadrons import AirWing
|
||||
from game.squadrons import Squadron
|
||||
from game.theater.player import Player
|
||||
from game.theater.controlpoint import (
|
||||
ControlPoint,
|
||||
OffMapSpawn,
|
||||
@@ -833,7 +834,7 @@ class PretenseAircraftGenerator:
|
||||
"""
|
||||
self.initialize_pretense_data_structures(cp)
|
||||
|
||||
is_player = True
|
||||
is_player = Player.BLUE
|
||||
if country == cp.coalition.faction.country:
|
||||
offmap_transport_cp = self.find_pretense_cargo_plane_cp(cp)
|
||||
|
||||
@@ -868,7 +869,7 @@ class PretenseAircraftGenerator:
|
||||
coalition = (
|
||||
self.game.coalition_for(is_player)
|
||||
if country == self.game.coalition_for(is_player).faction.country
|
||||
else self.game.coalition_for(False)
|
||||
else self.game.coalition_for(Player.RED)
|
||||
)
|
||||
self.generate_pretense_aircraft_for_other_side(cp, coalition, ato)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ from game.missiongenerator.aircraft.flightgroupspawner import (
|
||||
)
|
||||
from game.missiongenerator.missiondata import MissionData
|
||||
from game.naming import NameGenerator
|
||||
from game.theater import Airfield, ControlPoint, Fob, NavalControlPoint
|
||||
from game.theater import Airfield, ControlPoint, Fob, NavalControlPoint, Player
|
||||
|
||||
|
||||
class PretenseNameGenerator(NameGenerator):
|
||||
@@ -87,7 +87,7 @@ class PretenseFlightGroupSpawner(FlightGroupSpawner):
|
||||
|
||||
def insert_into_pretense(self, name: str) -> None:
|
||||
cp = self.flight.departure
|
||||
is_player = True
|
||||
is_player = Player.BLUE
|
||||
cp_side = (
|
||||
2
|
||||
if self.flight.coalition
|
||||
|
||||
@@ -1495,13 +1495,13 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
cp_name.replace("ä", "a")
|
||||
cp_name.replace("ö", "o")
|
||||
cp_name.replace("ø", "o")
|
||||
cp_side = 2 if cp.captured else 1
|
||||
cp_side = 2 if cp.captured.is_blue else 1
|
||||
|
||||
if isinstance(cp, OffMapSpawn):
|
||||
continue
|
||||
elif (
|
||||
cp.is_fleet
|
||||
and cp.captured
|
||||
and cp.captured.is_blue
|
||||
and self.game.settings.pretense_controllable_carrier
|
||||
):
|
||||
# Friendly carrier, generate carrier parameters
|
||||
@@ -1591,7 +1591,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
# Also connect carrier and LHA control points to adjacent friendly points
|
||||
if cp.is_fleet and (
|
||||
not self.game.settings.pretense_controllable_carrier
|
||||
or not cp.captured
|
||||
or cp.captured.is_red
|
||||
):
|
||||
num_of_carrier_connections = 0
|
||||
for (
|
||||
@@ -1616,7 +1616,7 @@ class PretenseLuaGenerator(LuaGenerator):
|
||||
try:
|
||||
if (
|
||||
cp.is_fleet
|
||||
and cp.captured
|
||||
and cp.captured.is_blue
|
||||
and self.game.settings.pretense_controllable_carrier
|
||||
):
|
||||
break
|
||||
|
||||
@@ -28,6 +28,7 @@ from game.missiongenerator.visualsgenerator import VisualsGenerator
|
||||
from game.naming import namegen
|
||||
from game.persistency import pre_pretense_backups_dir
|
||||
from game.pretense.pretenseaircraftgenerator import PretenseAircraftGenerator
|
||||
from game.theater import Player
|
||||
from game.theater.bullseye import Bullseye
|
||||
from game.unitmap import UnitMap
|
||||
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
||||
@@ -233,7 +234,7 @@ class PretenseMissionGenerator(MissionGenerator):
|
||||
callsign=callsign,
|
||||
region=frontline,
|
||||
code=str(code),
|
||||
blue=True,
|
||||
blue=Player.BLUE,
|
||||
freq=freq,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -49,6 +49,7 @@ from game.theater import (
|
||||
TheaterUnit,
|
||||
NavalControlPoint,
|
||||
PresetLocation,
|
||||
Player,
|
||||
)
|
||||
from game.theater.theatergroundobject import (
|
||||
CarrierGroundObject,
|
||||
@@ -248,7 +249,7 @@ class PretenseGroundObjectGenerator(GroundObjectGenerator):
|
||||
"""
|
||||
unit_type = None
|
||||
faction = self.coalition.faction
|
||||
is_player = True
|
||||
is_player = Player.BLUE
|
||||
side = (
|
||||
2
|
||||
if self.country == self.game.coalition_for(is_player).faction.country
|
||||
@@ -458,7 +459,7 @@ class PretenseGroundObjectGenerator(GroundObjectGenerator):
|
||||
cp_name_trimmed = PretenseNameGenerator.pretense_trimmed_cp_name(
|
||||
control_point.name
|
||||
)
|
||||
is_player = True
|
||||
is_player = Player.BLUE
|
||||
side = (
|
||||
2
|
||||
if self.country
|
||||
@@ -567,7 +568,7 @@ class PretenseGroundObjectGenerator(GroundObjectGenerator):
|
||||
cp_name_trimmed = PretenseNameGenerator.pretense_trimmed_cp_name(
|
||||
control_point.name
|
||||
)
|
||||
is_player = True
|
||||
is_player = Player.BLUE
|
||||
side = (
|
||||
2
|
||||
if self.country == self.game.coalition_for(is_player).faction.country
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import math
|
||||
import random
|
||||
from typing import TYPE_CHECKING, List
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from dcs import Point
|
||||
from dcs.action import (
|
||||
@@ -11,10 +9,6 @@ from dcs.action import (
|
||||
DoScript,
|
||||
MarkToAll,
|
||||
SetFlag,
|
||||
RemoveSceneObjects,
|
||||
RemoveSceneObjectsMask,
|
||||
SceneryDestructionZone,
|
||||
Smoke,
|
||||
)
|
||||
from dcs.condition import (
|
||||
AllOfCoalitionOutsideZone,
|
||||
@@ -22,7 +16,6 @@ from dcs.condition import (
|
||||
FlagIsTrue,
|
||||
PartOfCoalitionInZone,
|
||||
TimeAfter,
|
||||
TimeSinceFlag,
|
||||
)
|
||||
from dcs.mission import Mission
|
||||
from dcs.task import Option
|
||||
@@ -31,12 +24,11 @@ from dcs.terrain.syria.airports import Damascus, Khalkhalah
|
||||
from dcs.translation import String
|
||||
from dcs.triggers import Event, TriggerCondition, TriggerOnce
|
||||
from dcs.unit import Skill
|
||||
from numpy import cross, einsum, arctan2
|
||||
from shapely import MultiPolygon, Point as ShapelyPoint
|
||||
|
||||
from game.naming import ALPHA_MILITARY
|
||||
from game.pretense.pretenseflightgroupspawner import PretenseNameGenerator
|
||||
from game.theater import Airfield
|
||||
from game.theater import Airfield, Player
|
||||
from game.theater.controlpoint import Fob, TRIGGER_RADIUS_CAPTURE, OffMapSpawn
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -157,7 +149,7 @@ class PretenseTriggerGenerator:
|
||||
zone = self.mission.triggers.add_triggerzone(
|
||||
location, radius=10, hidden=True, name="MARK"
|
||||
)
|
||||
if cp.captured:
|
||||
if cp.captured.is_blue:
|
||||
name = ground_object.obj_name + " [ALLY]"
|
||||
else:
|
||||
name = ground_object.obj_name + " [ENEMY]"
|
||||
@@ -174,7 +166,7 @@ class PretenseTriggerGenerator:
|
||||
"""
|
||||
for cp in self.game.theater.controlpoints:
|
||||
if isinstance(cp, self.capture_zone_types) and not cp.is_carrier:
|
||||
if cp.captured:
|
||||
if cp.captured.is_blue:
|
||||
attacking_coalition = enemy_coalition
|
||||
attack_coalition_int = 1 # 1 is the Event int for Red
|
||||
defending_coalition = player_coalition
|
||||
@@ -243,7 +235,7 @@ class PretenseTriggerGenerator:
|
||||
self.game.settings.pretense_carrier_zones_navmesh == "Blue navmesh"
|
||||
)
|
||||
sea_zones_landmap = self.game.coalition_for(
|
||||
player=False
|
||||
player=Player.RED
|
||||
).nav_mesh.theater.landmap
|
||||
if (
|
||||
self.game.settings.pretense_controllable_carrier
|
||||
@@ -251,7 +243,7 @@ class PretenseTriggerGenerator:
|
||||
):
|
||||
navmesh_number = 0
|
||||
for navmesh_poly in self.game.coalition_for(
|
||||
player=use_blue_navmesh
|
||||
player=Player.BLUE if use_blue_navmesh else Player.RED
|
||||
).nav_mesh.polys:
|
||||
navmesh_number += 1
|
||||
if sea_zones_landmap.sea_zones.intersects(navmesh_poly.poly):
|
||||
@@ -325,7 +317,7 @@ class PretenseTriggerGenerator:
|
||||
if (
|
||||
cp.is_fleet
|
||||
and self.game.settings.pretense_controllable_carrier
|
||||
and cp.captured
|
||||
and cp.captured.is_blue
|
||||
):
|
||||
# Friendly carrier zones are generated above
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user